Files
ONE-OS/axhub-make/admin/assets/chunks/AppDialogProvider.js
王冕 a27e3b8e43 feat: sync full workspace including web modules, docs, and configurations to Gitea
Optimized the root .gitignore to exclude virtual environments, node modules,
and temp folders to ensure clean and lightweight version tracking.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-09 18:12:25 +08:00

2 lines
12 KiB
JavaScript

import{R as o,j as s}from"./vendor-react.js?v=1775123024591";import{cQ as M,d as U,cR as W,bh as N,cS as y,cT as Q,cU as j,cV as K,cW as X,cX as $,cY as Y,cn as J,bd as T,be as Z,bf as D,bg as ee,ba as te,bi as k,bj as E,bk as se}from"./vendor-common.js?v=1775123024591";const ne="make",re="make",ae="integrationWs",oe="integrationClientId",ie="integrationChannel";function je(t,e){const r=e??(typeof window<"u"?window.location.origin:"http://localhost"),a=new URL(t,r);return a.searchParams.set(ae,"1"),a.searchParams.set(oe,ne),a.searchParams.set(ie,re),a.toString()}function l(...t){return M(U(t))}const le=N("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[color,box-shadow] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 focus-visible:outline-none",{variants:{variant:{default:"bg-primary !text-white shadow-sm hover:bg-primary/90",brand:"bg-brand !text-white shadow-sm hover:bg-brand/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-6",xl:"h-11 rounded-lg px-8 text-sm",xs:"h-7 rounded-md px-2.5 text-xs",icon:"h-9 w-9","icon-sm":"h-8 w-8","icon-xs":"h-7 w-7","icon-lg":"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),b=o.forwardRef(({className:t,variant:e,size:r,asChild:a=!1,type:d="button",...i},m)=>{const x=a?W:"button";return s.jsx(x,{className:l(le({variant:e,size:r,className:t})),ref:m,type:a?void 0:d,...i})});b.displayName="Button";const de=N("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),A=o.forwardRef(({className:t,...e},r)=>s.jsx(y,{ref:r,className:l(de(),t),...e}));A.displayName=y.displayName;const ce=({delayDuration:t=0,...e})=>s.jsx(Y,{delayDuration:t,...e}),ue=X,me=$,C=o.forwardRef(({className:t,sideOffset:e=0,arrow:r=!0,arrowClassName:a,children:d,...i},m)=>s.jsx(Q,{children:s.jsxs(j,{ref:m,sideOffset:e,className:l("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs leading-5 text-left break-words",t),...i,children:[d,r?s.jsx(K,{className:l("bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]",a)}):null]})}));C.displayName=j.displayName;const I=({className:t,...e})=>s.jsx("div",{className:l("grid gap-2",t),...e});I.displayName="Field";const O=({className:t,...e})=>s.jsx("p",{className:l("text-sm text-muted-foreground",t),...e});O.displayName="FieldDescription";const R=o.forwardRef(({className:t,children:e,hint:r,tooltipClassName:a,...d},i)=>s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(A,{ref:i,className:l("text-sm font-medium text-foreground",t),...d,children:e}),r?s.jsx(ce,{children:s.jsxs(ue,{children:[s.jsx(me,{asChild:!0,children:s.jsx("button",{type:"button",className:"inline-flex h-4 w-4 items-center justify-center rounded text-muted-foreground hover:text-foreground","aria-label":"字段说明",children:s.jsx(J,{className:"h-3.5 w-3.5"})})}),s.jsx(C,{arrow:!0,className:l("max-w-[360px]",a),children:r})]})}):null]}));R.displayName="FieldLabelWithHint";const fe=se,pe=Z,P=o.forwardRef(({className:t,...e},r)=>s.jsx(T,{ref:r,className:l("fixed inset-0 z-[100] bg-black/40 data-[state=open]:animate-in data-[state=closed]:animate-out",t),...e}));P.displayName=T.displayName;const _=o.forwardRef(({className:t,children:e,...r},a)=>s.jsxs(pe,{children:[s.jsx(P,{}),s.jsxs(D,{ref:a,className:l("ax-dialog-content fixed left-[50%] top-[50%] z-[100] grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg outline-none ring-0 duration-200 focus:outline-none focus:ring-0 focus-visible:outline-none focus-visible:ring-0 data-[state=open]:animate-in data-[state=closed]:animate-out sm:rounded-lg",t),...r,children:[e,s.jsx(ee,{asChild:!0,children:s.jsx(b,{type:"button",variant:"ghost",size:"icon-xs",className:"absolute right-4 top-4","aria-label":"关闭","data-dialog-close":"",children:s.jsx(te,{className:"h-4 w-4"})})})]})]}));_.displayName=D.displayName;const S=({className:t,...e})=>s.jsx("div",{className:l("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});S.displayName="DialogHeader";const z=({className:t,...e})=>s.jsx("div",{className:l("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});z.displayName="DialogFooter";const G=o.forwardRef(({className:t,...e},r)=>s.jsx(k,{ref:r,className:l("m-0 text-lg font-semibold leading-none tracking-tight",t),...e}));G.displayName=k.displayName;const V=o.forwardRef(({className:t,...e},r)=>s.jsx(E,{ref:r,className:l("m-0 text-sm text-muted-foreground",t),...e}));V.displayName=E.displayName;const L=o.forwardRef(({className:t,type:e,...r},a)=>s.jsx("input",{type:e,className:l("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm text-foreground shadow-xs transition-[color,box-shadow] file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 disabled:cursor-not-allowed disabled:opacity-50",t),ref:a,...r}));L.displayName="Input";const F=o.forwardRef(({className:t,...e},r)=>s.jsx("textarea",{ref:r,className:l("flex min-h-[84px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm text-foreground shadow-xs transition-[color,box-shadow] placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 disabled:cursor-not-allowed disabled:opacity-50",t),...e}));F.displayName="Textarea";const q=o.createContext(null);let w=0,B=null;function h(){return w+=1,w}function xe(t){return typeof t=="string"?s.jsx("div",{className:"whitespace-pre-line",children:t}):t}function ge(t,e){return t==="destructive"?"bg-destructive/10 text-destructive":e==="prompt"||t==="brand"?"bg-brand/10 text-brand":"bg-muted text-foreground"}function be(t,e){return t==="destructive"?"危险操作":e==="prompt"?"输入信息":t==="brand"?"操作确认":"提示"}function he(t){return t==="destructive"?"destructive":t==="brand"?"brand":"default"}function Te(t){B=t}function De(){return B}function ve(){let t=null;const e=[],r=new Set,a=()=>{r.forEach(n=>n())},d=()=>{t||e.length===0||(t=e.shift()??null)},i=n=>{n(),t=null,d(),a()};return{confirm:n=>new Promise(u=>{e.push({id:h(),kind:"confirm",title:n.title,description:n.description,confirmText:n.confirmText??"确定",cancelText:n.cancelText??"取消",tone:n.tone??"brand",dismissible:n.dismissible??!1,resolve:u}),d(),a()}),alert:n=>new Promise(u=>{e.push({id:h(),kind:"alert",title:n.title,description:n.description,confirmText:n.confirmText??"知道了",tone:n.tone??"brand",dismissible:n.dismissible??!0,resolve:u}),d(),a()}),prompt:n=>new Promise(u=>{e.push({id:h(),kind:"prompt",title:n.title,description:n.description,label:n.label??"名称",placeholder:n.placeholder,defaultValue:n.defaultValue??"",confirmText:n.confirmText??"确认",cancelText:n.cancelText??"取消",tone:n.tone??"brand",dismissible:n.dismissible??!0,validate:n.validate,mode:n.mode??"input",readOnly:n.readOnly??!1,rows:n.rows??8,selectOnOpen:n.selectOnOpen??!1,resolve:u}),d(),a()}),getSnapshot:()=>t,subscribe:n=>(r.add(n),()=>{r.delete(n)}),dismiss:()=>{if(!t||t.dismissible===!1)return;if(t.kind==="confirm"){const u=t;i(()=>u.resolve(!1));return}if(t.kind==="prompt"){const u=t;i(()=>u.resolve(null));return}const n=t;i(()=>n.resolve())},confirmActive:n=>{if(!t)return;if(t.kind==="prompt"){const f=t;i(()=>f.resolve(n));return}if(t.kind==="confirm"){const f=t;i(()=>f.resolve(!0));return}const u=t;i(()=>u.resolve())},cancelActive:()=>{if(t){if(t.kind==="confirm"){const n=t;i(()=>n.resolve(!1));return}if(t.kind==="prompt"){const n=t;i(()=>n.resolve(null))}}}}}function we({controller:t}){const e=o.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot),[r,a]=o.useState(""),[d,i]=o.useState(""),m=o.useRef(null),x=o.useRef(null);o.useEffect(()=>{if((e==null?void 0:e.kind)==="prompt"){a(e.defaultValue??""),i("");return}a(""),i("")},[e]),o.useEffect(()=>{if((e==null?void 0:e.kind)!=="prompt")return;const c=e.selectOnOpen,p=e.mode==="textarea"?x.current:m.current;if(!p)return;const H=window.setTimeout(()=>{p.focus(),c&&p.select()},0);return()=>{window.clearTimeout(H)}},[e]);const g=(e==null?void 0:e.tone)??"brand",n=(e==null?void 0:e.kind)==="confirm"||(e==null?void 0:e.kind)==="prompt",u=(e==null?void 0:e.dismissible)===!1,f=o.useCallback(()=>{var c;if(e){if(e.kind==="prompt"){if(!e.readOnly){const p=((c=e.validate)==null?void 0:c.call(e,r))??null;if(p){i(p);return}}t.confirmActive(r);return}t.confirmActive(r)}},[e,t,r]),v=o.useCallback(c=>{a(c.target.value),d&&i("")},[d]);return s.jsx(fe,{open:!!e,onOpenChange:c=>!c&&t.dismiss(),children:e?s.jsx(_,{className:l("w-[min(92vw,520px)] max-w-[520px] overflow-hidden rounded-[24px] border-border bg-card p-0 text-sm shadow-md","data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",u&&"[&>[data-dialog-close]]:hidden"),onEscapeKeyDown:c=>{e.dismissible===!1&&c.preventDefault()},onInteractOutside:c=>{e.dismissible===!1&&c.preventDefault()},children:s.jsxs("div",{className:"px-6 pb-6 pt-5 sm:px-7 sm:pb-7 sm:pt-6",children:[s.jsx("div",{className:l("mb-3 inline-flex items-center rounded-full px-3 py-1 text-xs font-semibold",ge(g,e.kind)),children:be(g,e.kind)}),s.jsxs(S,{className:"space-y-2 text-left",children:[s.jsx(G,{className:"text-[24px] font-semibold leading-tight tracking-tight text-foreground",children:e.title}),e.description?s.jsx(V,{className:"text-sm leading-6 text-muted-foreground",children:xe(e.description)}):null]}),e.kind==="prompt"?s.jsx("div",{className:"mt-5",children:s.jsxs(I,{children:[s.jsx(R,{children:e.label}),e.mode==="textarea"?s.jsx(F,{ref:x,value:r,rows:e.rows,readOnly:e.readOnly,placeholder:e.placeholder,className:l(e.readOnly&&"cursor-text resize-y bg-muted/30 font-mono text-xs leading-5"),onChange:v}):s.jsx(L,{ref:m,value:r,readOnly:e.readOnly,placeholder:e.placeholder,onChange:v,onKeyDown:c=>{c.key==="Enter"&&(c.preventDefault(),f())}}),d?s.jsx(O,{className:"text-destructive",children:d}):null]})}):null,s.jsxs(z,{className:"mt-6 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end sm:space-x-0",children:[n?s.jsx(b,{type:"button",variant:"outline",onClick:()=>t.cancelActive(),children:e.cancelText}):null,s.jsx(b,{type:"button",variant:he(g),onClick:f,children:e.confirmText})]})]})}):null})}function ke({children:t}){const[e]=o.useState(()=>ve()),r=o.useMemo(()=>({confirm:e.confirm,alert:e.alert,prompt:e.prompt}),[e]);return s.jsxs(q.Provider,{value:r,children:[t,s.jsx(we,{controller:e})]})}function Ee(){const t=o.useContext(q);if(!t)throw new Error("useAppDialog must be used within AppDialogProvider");return t}export{ke as A,b as B,fe as D,I as F,ne as G,L as I,A as L,F as T,je as a,re as b,l as c,_ as d,S as e,G as f,R as g,O as h,z as i,V as j,ce as k,ue as l,me as m,C as n,De as o,we as p,ve as q,Te as s,Ee as u};