import{r as e}from"./rolldown-runtime-DIIn1E2Q.js";import{ft as t}from"./vendor-primevue-DOcVZxnt.js";import"./vendor-firebase-yTFzdAQf.js";import{D as n,Dt as r,F as i,I as a,It as o,O as s,R as c,Rt as l,S as u,Vt as d,_ as f,_t as p,et as m,gt as h,j as g}from"./vendor-vue-core-CvBSzfTV.js";import"./vendor-other-ZVm7XS8K.js";import"./useFeatureFlags-CMK9o9Rw.js";import"./api-OgmjiUkn.js";import"./colorUtil-C9tyO6rZ.js";import{n as _}from"./vendor-i18n-B2MApQxA.js";import"./i18n-S80A-Sy1.js";import"./vendor-reka-ui-EFkcZtPy.js";import{t as v}from"./src-DpgoZgDv.js";import{t as y}from"./Button-C-kbn1lh.js";import{Xn as b}from"./dialogService-Dp405gae.js";import"./systemStatsStore-BAnEcJS2.js";import"./useErrorHandling-DfKSzlg9.js";import{t as x}from"./dialogStore-BDXSs8Ic.js";import"./userStore-C5cqCkur.js";import"./useCopyToClipboard-_eFTtqIy.js";import"./vendor-tiptap-BZCaYoPl.js";import"./vendor-markdown-Gcn_JH9N.js";import"./markdownRendererUtil-BD0lrBqH.js";import"./useExternalLink-CZSEXO8Q.js";var S={class:`flex w-full max-w-[512px] flex-col rounded-2xl border border-border-default bg-base-background`},C={class:`flex h-12 items-center justify-between border-b border-border-default px-4`},w={class:`m-0 text-sm font-normal text-base-foreground`},T=[`aria-label`],E={class:`flex flex-col gap-4 px-4 py-4`},D={class:`m-0 text-sm text-muted-foreground`},O=[`placeholder`],k={class:`flex items-center justify-end gap-4 px-4 py-4`},A={class:`flex flex-col gap-4 px-4 py-4`},j={class:`m-0 text-sm text-muted-foreground`},M={class:`m-0 text-sm font-medium text-base-foreground`},N={class:`relative`},P=[`value`],F={class:`flex items-center justify-end gap-4 px-4 py-4`},I=c({__name:`InviteMemberDialogContent`,setup(e){let c=x(),I=t(),{t:L}=_(),R=b(),z=r(!1),B=r(``),V=r(`email`),H=r(``),U=r(!1),W=n(()=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(B.value));function onCancel(){c.closeDialog({key:`invite-member`})}async function onCreateLink(){if(W.value){z.value=!0;try{H.value=await R.createInviteLink(B.value),V.value=`link`}catch(e){I.add({severity:`error`,summary:L(`workspacePanel.inviteMemberDialog.linkCopyFailed`),detail:e instanceof Error?e.message:void 0,life:3e3})}finally{z.value=!1}}}async function onCopyLink(){try{await navigator.clipboard.writeText(H.value),U.value=!0,setTimeout(()=>{U.value=!1},759),I.add({severity:`success`,summary:L(`workspacePanel.inviteMemberDialog.linkCopied`),life:2e3})}catch{I.add({severity:`error`,summary:L(`workspacePanel.inviteMemberDialog.linkCopyFailed`),life:3e3})}}function onSelectLink(e){e.target.select()}return(e,t)=>(m(),g(`div`,S,[s(`div`,C,[s(`h2`,w,d(V.value===`email`?e.$t(`workspacePanel.inviteMemberDialog.title`):e.$t(`workspacePanel.inviteMemberDialog.linkStep.title`)),1),s(`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[1]||=[s(`i`,{class:`pi pi-times size-4`},null,-1)],8,T)]),V.value===`email`?(m(),g(u,{key:0},[s(`div`,E,[s(`p`,D,d(e.$t(`workspacePanel.inviteMemberDialog.message`)),1),p(s(`input`,{"onUpdate:modelValue":t[0]||=e=>B.value=e,type:`email`,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.inviteMemberDialog.placeholder`)},null,8,O),[[f,B.value]])]),s(`div`,k,[a(y,{variant:`muted-textonly`,onClick:onCancel},{default:h(()=>[i(d(e.$t(`g.cancel`)),1)]),_:1}),a(y,{variant:`primary`,size:`lg`,loading:z.value,disabled:!W.value,onClick:onCreateLink},{default:h(()=>[i(d(e.$t(`workspacePanel.inviteMemberDialog.createLink`)),1)]),_:1},8,[`loading`,`disabled`])])],64)):(m(),g(u,{key:1},[s(`div`,A,[s(`p`,j,d(e.$t(`workspacePanel.inviteMemberDialog.linkStep.message`)),1),s(`p`,M,d(B.value),1),s(`div`,N,[s(`input`,{value:H.value,readonly:``,class:`w-full cursor-pointer rounded-lg border border-border-default bg-transparent px-3 py-2 pr-10 text-sm text-base-foreground focus:outline-none`,onClick:onSelectLink},null,8,P),s(`div`,{class:`absolute right-3 top-2.5 cursor-pointer`,onClick:onCopyLink},[s(`i`,{class:l(o(v)(`pi size-4`,U.value?`pi-check text-green-500`:`pi-copy`))},null,2)])])]),s(`div`,F,[a(y,{variant:`muted-textonly`,onClick:onCancel},{default:h(()=>[i(d(e.$t(`g.cancel`)),1)]),_:1}),a(y,{variant:`primary`,size:`lg`,onClick:onCopyLink},{default:h(()=>[i(d(e.$t(`workspacePanel.inviteMemberDialog.linkStep.copyLink`)),1)]),_:1})])],64))]))}});export{I as default};
//# sourceMappingURL=InviteMemberDialogContent-I4d8lNK_.js.map