import{r as e}from"./rolldown-runtime-DCMCV6zW.js";import{pt as t}from"./vendor-primevue-DxVRNMbC.js";import"./vendor-firebase-CdLSXhbt.js";import{D as n,Dt as r,F as i,I as a,O as o,R as s,Vt as c,_ as l,_t as u,et as d,gt as f,j as p,y as m}from"./vendor-vue-core-X6q-rGJs.js";import"./vendor-other-CyG3qq8S.js";import"./useFeatureFlags-CxRWjdi1.js";import"./api-DQLKc1Xa.js";import"./vendor-markdown-Cola12Wc.js";import"./colorUtil-Cth7eqhK.js";import{n as h}from"./vendor-i18n-B5g6Drzm.js";import"./i18n-DjV_9lZM.js";import"./vendor-reka-ui-CHPbCe4i.js";import{t as g}from"./Button-C7dWyQyS.js";import{yn as _}from"./dialogService-Cqui0UMO.js";import"./systemStatsStore-D9aNY5gT.js";import"./useErrorHandling-BFB8eSj5.js";import{t as v}from"./dialogStore-CXD5Bcfy.js";import"./useCopyToClipboard-C74olorb.js";import"./vendor-tiptap-BXSIIPYY.js";import"./markdownRendererUtil-Bm7Umh6C.js";import"./useExternalLink-Cc30SNi3.js";var y={class:`flex w-full max-w-[400px] flex-col rounded-2xl border border-border-default bg-base-background`},b={class:`flex h-12 items-center justify-between border-b border-border-default px-4`},x={class:`m-0 text-sm font-normal text-base-foreground`},S=[`aria-label`],C={class:`flex flex-col gap-4 px-4 py-4`},w={class:`m-0 text-sm text-muted-foreground`},T={class:`flex flex-col gap-2`},E={class:`text-sm text-base-foreground`},D=[`placeholder`],O={class:`flex items-center justify-end gap-4 px-4 py-4`},k=s({__name:`CreateWorkspaceDialogContent`,props:{onConfirm:{type:Function}},setup(e){let{t:s}=h(),k=v(),A=t(),j=_(),M=r(!1),N=r(``),P=n(()=>{let e=N.value.trim();return e.length>=1&&e.length<=50&&/^[a-zA-Z0-9][a-zA-Z0-9\s\-_'.,()&+]*$/.test(e)});function onCancel(){k.closeDialog({key:`create-workspace`})}async function onCreate(){if(P.value){M.value=!0;try{let t=N.value.trim();await e.onConfirm?.(t),k.closeDialog({key:`create-workspace`}),await j.createWorkspace(t)}catch(e){console.error(`[CreateWorkspaceDialog] Failed to create workspace:`,e),A.add({severity:`error`,summary:s(`workspacePanel.toast.failedToCreateWorkspace`),detail:e instanceof Error?e.message:s(`g.unknownError`),life:5e3})}finally{M.value=!1}}}return(e,t)=>(d(),p(`div`,y,[o(`div`,b,[o(`h2`,x,c(e.$t(`workspacePanel.createWorkspaceDialog.title`)),1),o(`button`,{class:`cursor-pointer rounded border-none bg-transparent p-0 text-muted-foreground transition-colors hover:text-base-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-secondary-foreground`,"aria-label":e.$t(`g.close`),onClick:onCancel},t[2]||=[o(`i`,{class:`pi pi-times size-4`},null,-1)],8,S)]),o(`div`,C,[o(`p`,w,c(e.$t(`workspacePanel.createWorkspaceDialog.message`)),1),o(`div`,T,[o(`label`,E,c(e.$t(`workspacePanel.createWorkspaceDialog.nameLabel`)),1),u(o(`input`,{"onUpdate:modelValue":t[0]||=e=>N.value=e,type:`text`,class:`w-full rounded-lg border border-border-default bg-transparent px-3 py-2 text-sm text-base-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-secondary-foreground`,placeholder:e.$t(`workspacePanel.createWorkspaceDialog.namePlaceholder`),onKeydown:t[1]||=m(e=>P.value&&onCreate(),[`enter`])},null,40,D),[[l,N.value]])])]),o(`div`,O,[a(g,{variant:`muted-textonly`,onClick:onCancel},{default:f(()=>[i(c(e.$t(`g.cancel`)),1)]),_:1}),a(g,{variant:`primary`,size:`lg`,loading:M.value,disabled:!P.value,onClick:onCreate},{default:f(()=>[i(c(e.$t(`workspacePanel.createWorkspaceDialog.create`)),1)]),_:1},8,[`loading`,`disabled`])])]))}});export{k as default};
//# sourceMappingURL=CreateWorkspaceDialogContent-Dyk_fMTF.js.map