import{r as e}from"./rolldown-runtime-DCMCV6zW.js";import{pt as t}from"./vendor-primevue-7po8Zk9v.js";import"./vendor-firebase-CdLSXhbt.js";import{$ as n,A as r,Bt as i,D as a,E as o,Et as s,F as c,L as l,P as u,g as d,gt as f,ht as p,v as m}from"./vendor-vue-core-D3IvUUeM.js";import"./vendor-other-CrvBxfcV.js";import"./types-0oh-UGWL.js";import"./remoteConfig-CNDr9CtS.js";import"./api-3C7_IVZO.js";import"./colorUtil-C83P1Arv.js";import{n as h}from"./vendor-i18n-CsAN_zFP.js";import"./i18n-DjEVEIh2.js";import"./useErrorHandling-CBX3YQ5l.js";import"./vendor-reka-ui-Bm3o_ZTf.js";import{t as g}from"./Button-mG8zDgxj.js";import"./dialogService-BC0EXJA5.js";import"./systemStatsStore-gvlzOl4W.js";import{t as _}from"./dialogStore-BbHfkjRE.js";import"./useCopyToClipboard-CUuoo5Dm.js";import"./vendor-tiptap-DsZVujQD.js";import"./vendor-markdown-yjaB1jgA.js";import"./markdownRendererUtil-D5cHPoK2.js";import{t as v}from"./teamWorkspaceStore-BvhKZUrb.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:`flex flex-col gap-2`},T={class:`text-sm text-base-foreground`},E={class:`flex items-center justify-end gap-4 px-4 py-4`},D=l({__name:`EditWorkspaceDialogContent`,setup(e){let{t:l}=h(),D=t(),O=_(),k=v(),A=s(!1),j=s(k.workspaceName),M=o(()=>{let e=j.value.trim();return e.length>=1&&e.length<=50&&/^[a-zA-Z0-9][a-zA-Z0-9\s\-_'.,()&+]*$/.test(e)});function onCancel(){O.closeDialog({key:`edit-workspace`})}async function onSave(){if(M.value){A.value=!0;try{await k.updateWorkspaceName(j.value.trim()),O.closeDialog({key:`edit-workspace`}),D.add({severity:`success`,summary:l(`workspacePanel.toast.workspaceUpdated.title`),detail:l(`workspacePanel.toast.workspaceUpdated.message`),life:5e3})}catch(e){console.error(`[EditWorkspaceDialog] Failed to update workspace:`,e),D.add({severity:`error`,summary:l(`workspacePanel.toast.failedToUpdateWorkspace`),detail:e instanceof Error?e.message:l(`g.unknownError`),life:5e3})}finally{A.value=!1}}}return(e,t)=>(n(),r(`div`,y,[a(`div`,b,[a(`h2`,x,i(e.$t(`workspacePanel.editWorkspaceDialog.title`)),1),a(`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]||=[a(`i`,{class:`pi pi-times size-4`},null,-1)],8,S)]),a(`div`,C,[a(`div`,w,[a(`label`,T,i(e.$t(`workspacePanel.editWorkspaceDialog.nameLabel`)),1),f(a(`input`,{"onUpdate:modelValue":t[0]||=e=>j.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`,onKeydown:t[1]||=m(e=>M.value&&onSave(),[`enter`])},null,544),[[d,j.value]])])]),a(`div`,E,[c(g,{variant:`muted-textonly`,onClick:onCancel},{default:p(()=>[u(i(e.$t(`g.cancel`)),1)]),_:1}),c(g,{variant:`primary`,size:`lg`,loading:A.value,disabled:!M.value,onClick:onSave},{default:p(()=>[u(i(e.$t(`workspacePanel.editWorkspaceDialog.save`)),1)]),_:1},8,[`loading`,`disabled`])])]))}});export{D as default};
//# sourceMappingURL=EditWorkspaceDialogContent-Cn1G6DhG.js.map