1import{j as e,a as t}from"./react-query-DywPi3Wo.js";import{s as a,K as s,a3 as r,u as i,cH as o,aj as n,F as l,a1 as c,a4 as d,c2 as m,c3 as g,c4 as p}from"./index-DlKj98-E.js";import{t as h}from"./notifications-CniyskoD.js";import{S as x}from"./SettingsFormRow-CErmIcCJ.js";import{F as f,a0 as u,H as b,G as y,T as w}from"./fontawesome--Aw3gwP5.js";import{c as j,g as k,d as v,e as N,u as _}from"./useFocusOnMount-DXh1ANQ0.js";import{b as T}from"./useWorkspaceMergeQueries-D-PvsL4l.js";import{u as S,L as C,N as P}from"./router-CfEbv8XI.js";import"./react-vendor-6ULW7vKx.js";import"./ui-utils-4YCDwm7v.js";import"./state-management-D35o73Ew.js";import"./date-fns-core-DhfE3dwm.js";import"./radix-ui-CdNO4ynG.js";import"./api-utils-DeT0SS0P.js";import"./tiptap-complete-I_SUyZ8Y.js";import"./collaboration-protocols-oLklGwa8.js";import"./collaboration-provider-DYKWCpdb.js";import"./lucide-icons-B0eZXG9a.js";import"./command-utils-Ca9Q8TxB.js";import"./virtualization-CdcdMTXM.js";import"./react-day-picker-CHkWmtOp.js";import"./MergeService-CjllDHcl.js";const W={merge_in_progress:{label:"Neither workspace is already merging",reason:"One of these workspaces is already part of an active merge.",guidance:"Wait for the in-progress merge to finish or be cancelled, then try again."},partner_managed:{label:"Neither workspace is partner-managed",reason:"Partner-managed workspaces cannot be merged.",guidance:"Contact support to discuss options for partner-managed workspaces."},active_capture:{label:"This workspace has no active recording",reason:"A meeting in this workspace is still being captured.",guidance:"Wait for the meeting to end and its recording to finish processing."},test_workspace:{label:"Neither workspace is a test workspace",reason:"Test workspaces cannot be merged.",guidance:"Use two regular workspaces, or contact support."},invalid_peer:{label:"The target admin email is eligible",reason:"We could not use that address to identify a workspace to merge into.",guidance:"Check the address with the other workspace, and make sure it belongs to an admin or owner there."}},I={passed:{icon:y,className:"text-green-contio-800",statusText:"Passed"},failed:{icon:b,className:"text-coral-contio-700",statusText:"Blocked"},not_evaluated:{icon:u,className:"text-gray-contio-600",statusText:"Not checked"}},M=t=>{const i=a.c(27),{status:o,gates:n,onProceed:l,proceedLabel:c,isProceeding:d}=t;let m;i[0]!==n?(m=void 0===n?[]:n,i[0]=n,i[1]=m):m=i[1];const g=m,p=void 0===c?"Notify target admin":c,h=void 0!==d&&d;let x;i[2]!==g||i[3]!==o?(x="pass"===o&&j.every(e=>"passed"===k(e,g)),i[2]=g,i[3]=o,i[4]=x):x=i[4];const u=x;let b,y,v;i[5]===Symbol.for("react.memo_cache_sentinel")?(b=e.jsx("h2",{id:"merge-preflight-heading",className:"text-md font-bold",children:"Eligibility check"}),i[5]=b):b=i[5],i[6]!==o?(y="loading"===o&&e.jsx(f,{icon:w,className:"animate-spin text-gray-contio-500","aria-hidden":!0}),i[6]=o,i[7]=y):y=i[7],i[8]!==y?(v=e.jsxs("div",{className:"flex items-center gap-2",children:[b,y]}),i[8]=y,i[9]=v):v=i[9];const N="loading"===o&&"Checking whether these workspaces can be mergedâ¦",_="pass"===o&&"These workspaces are eligible to be merged.",T="fail"===o&&"These workspaces cannot be merged yet.";let S,C,P,M;return i[10]!==_||i[11]!==T||i[12]!==N?(S=e.jsxs("p",{role:"status",className:"text-sm text-gray-contio-600","data-testid":"merge-preflight-status",children:[N,_,T]}),i[10]=_,i[11]=T,i[12]=N,i[13]=S):S=i[13],i[14]!==g||i[15]!==o?(C="loading"!==o&&e.jsx("ul",{className:"space-y-3","data-testid":"merge-preflight-gate-list",children:j.map(t=>{const a=k(t,g),r=I[a],i=W[t];return e.jsxs("li",{className:"flex gap-3","data-testid":`merge-preflight-gate-${t}`,children:[e.jsx(f,{icon:r.icon,className:s("mt-0.5",r.className),"aria-hidden":!0}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsx("p",{id:`merge-preflight-gate-label-${t}`,className:"text-sm font-bold",children:i.label}),e.jsx("p",{className:s("text-xs font-bold uppercase",r.className),children:r.statusText}),"failed"===a&&e.jsxs("div",{role:"region","aria-labelledby":`merge-preflight-gate-label-${t}`,className:"space-y-1 text-sm text-gray-contio-600","data-testid":`merge-preflight-gate-detail-${t}`,children:[e.jsx("p",{children:i.reason}),e.jsx("p",{children:i.guidance})]})]})]},t)})}),i[14]=g,i[15]=o,i[16]=C):C=i[16],i[17]!==u||i[18]!==h||i[19]!==l||i[20]!==p?(P=l&&e.jsx(r,{type:"button",color:"danger",variant:"solid",disabled:!u||h,onClick:l,"data-testid":"merge-preflight-proceed-button",children:p}),i[17]=u,i[18]=h,i[19]=l,i[20]=p,i[21]=P):P=i[21],i[22]!==S||i[23]!==C||i[24]!==P||i[25]!==v?(M=e.jsxs("section",{className:"max-w-xl space-y-4 rounded-lg border border-gray-contio-200 bg-white p-4 shadow-sm","aria-labelledby":"merge-preflight-heading","data-testid":"merge-preflight-panel",children:[v,S,C,P]}),i[22]=S,i[23]=C,i[24]=P,i[25]=v,i[26]=M):M=i[26],M},F=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,$=d=>{const m=a.c(35),{cancelTo:g,workspaceId:p}=d,f=void 0===g?"/settings/workspace":g,u=S(),b=T(p),y=b.data&&"cancelled"!==b.data.state;let w;m[0]!==b.error?(w=i(b.error),m[0]=b.error,m[1]=w):w=m[1];const j=w,k=b.isError&&403!==j&&404!==j,P=!!p&&b.isPending,W=v(),I=N(),[$,E]=t.useState(""),[q,A]=t.useState(""),[L,O]=t.useState("idle");let B;m[2]===Symbol.for("react.memo_cache_sentinel")?(B=[],m[2]=B):B=m[2];const[D,H]=t.useState(B),K=_("sent"===L),R="preflight_loading"===L||"preflight_passed"===L||I.isPending;let z;m[3]!==q||m[4]!==L?(z=e=>{E(e),"preflight_failed"===L&&(O("idle"),H([])),q&&A(F.test(e.trim())?"":"Enter a valid email address")},m[3]=q,m[4]=L,m[5]=z):z=m[5];const G=z;let Q;m[6]!==I||m[7]!==$?(Q=e=>(H(e.gates),O("preflight_passed"),I.mutateAsync($.trim()).then(()=>{O("sent"),h.success("If an admin exists at that address, they've been notified.")}).catch(e=>{l.error("Merge proposal creation failed:",e),O("idle"),h.error("We could not notify the target admin. Please try again.")})),m[6]=I,m[7]=$,m[8]=Q):Q=m[8];const U=Q;let V;m[9]!==U||m[10]!==W||m[11]!==$?(V=()=>{const e=$.trim();F.test(e)?(A(""),H([]),O("preflight_loading"),W.mutateAsync(e).then(e=>"fail"===e.status?(H(e.gates),void O("preflight_failed")):U(e)).catch(e=>{l.error("Merge preflight failed:",e),O("idle"),h.error("We could not check eligibility. Please try again.")})):A("Enter a valid email address")},m[9]=U,m[10]=W,m[11]=$,m[12]=V):V=m[12];const J=V;let X,Y,Z,ee,te;return m[13]===Symbol.for("react.memo_cache_sentinel")?(X=e.jsx(c,{title:"Merge this workspace"}),m[13]=X):X=m[13],m[14]===Symbol.for("react.memo_cache_sentinel")?(Y=e.jsxs("div",{className:"max-w-xl space-y-2",children:[e.jsx("p",{className:"text-sm text-gray-contio-600",children:"Merging moves this workspace's people and content into another workspace. It is one-way: this workspace is retired, its integrations are revoked, and its members continue in the target workspace."}),e.jsx("p",{className:"text-sm text-gray-contio-600",children:"Links to this workspace keep working â visitors are redirected to the target workspace."}),e.jsx("p",{className:"text-sm text-gray-contio-600",children:"The target admin is notified by email and can also approve or decline from their own workspace: the merge follows whichever workspace is being viewed, so admins of the target see the pending request under Settings â Workspace."})]}),m[14]=Y):Y=m[14],m[15]!==y||m[16]!==f||m[17]!==q||m[18]!==G||m[19]!==J||m[20]!==R||m[21]!==k||m[22]!==P||m[23]!==u||m[24]!==b.data?.state||m[25]!==K||m[26]!==L||m[27]!==$?(Z=P?e.jsx("p",{role:"status","aria-busy":"true",className:"max-w-xl text-sm text-gray-contio-600","data-testid":"merge-workspace-lifecycle-loading",children:"Checking for an existing mergeâ¦"}):k?e.jsxs("div",{role:"alert",className:"max-w-xl space-y-2 rounded-lg border border-coral-contio-200 bg-white p-4","data-testid":"merge-workspace-lifecycle-error",children:[e.jsx("p",{className:"text-sm font-bold",children:"We couldn't check for an existing merge"}),e.jsx("p",{className:"text-sm text-gray-contio-600",children:"Refresh the page to try again. If the problem persists, contact support."})]}):y?e.jsxs("div",{className:"max-w-xl space-y-4","data-testid":"merge-workspace-in-progress",children:[e.jsx("p",{role:"status",className:"text-sm font-bold",children:"tombstoned"===b.data?.state?"This workspace has been merged.":"A merge is already in progress for this workspace."}),e.jsx("p",{className:"text-sm text-gray-contio-600",children:"Follow its progress, retry a failed step, or review the closeout summary on the status page."}),e.jsx(C,{to:o,"data-testid":"merge-workspace-status-link",className:"inline-flex h-9 items-center rounded-md bg-brand-contio-600 px-4 text-sm font-medium text-white hover:bg-brand-contio-700 focus-visible:ring-2 focus-visible:ring-brand-contio-500 focus-visible:ring-offset-2 focus-visible:outline-none",children:"View merge status"})]}):"sent"===L?e.jsxs("div",{className:"max-w-xl space-y-4","data-testid":"merge-workspace-sent",children:[e.jsx("p",{ref:K,tabIndex:-1,role:"status",className:"text-sm font-bold focus:outline-none",children:"If an admin exists at that address, they've been notified."}),e.jsx("p",{className:"text-sm text-gray-contio-600",children:"The merge starts only after they approve it, and you will be asked to confirm the consequences before anything moves."}),e.jsx(r,{type:"button",color:"secondary",variant:"outline",onClick:()=>u(f),"data-testid":"merge-workspace-done-button",children:"Back to workspace settings"})]}):e.jsxs("div",{className:"max-w-sm space-y-5",children:[e.jsxs(x,{htmlFor:"merge-target-a
1dmin-email",label:"Target admin",required:!0,children:[e.jsx(n,{id:"merge-target-admin-email",type:"email","aria-label":"Target workspace admin email","aria-invalid":!!q,"aria-describedby":q?"merge-target-admin-email-error":void 0,placeholder:"[email protected]",value:$,onChange:e=>G(e.target.value),onKeyDown:e=>{"Enter"===e.key&&J()},disabled:R,className:s(q?"border-destructive":""),"data-testid":"merge-target-admin-email-input"}),q&&e.jsx("p",{id:"merge-target-admin-email-error",className:"text-sm text-destructive",role:"alert","data-testid":"merge-target-admin-email-error",children:q})]}),e.jsxs("div",{className:"space-y-3 rounded-lg border border-coral-contio-300 bg-white p-3",role:"region","aria-labelledby":"merge-irreversible-heading",children:[e.jsx("p",{id:"merge-irreversible-heading",className:"text-sm font-bold",children:"This cannot be undone"}),e.jsx("p",{id:"merge-irreversible-warning",className:"text-sm text-gray-contio-600",children:"This workspace will be merged into the target workspace. This cannot be undone."}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(r,{type:"button",color:"danger",variant:"solid","aria-describedby":"merge-irreversible-warning",disabled:R,onClick:J,"data-testid":"merge-check-eligibility-button",children:"preflight_loading"===L?"Checking eligibilityâ¦":R?"Notifying target adminâ¦":"Check eligibility and notify target admin"}),e.jsx(r,{type:"button",color:"secondary",variant:"outline",disabled:R,onClick:()=>u(f),"data-testid":"merge-cancel-button",children:"Cancel"})]})]})]}),m[15]=y,m[16]=f,m[17]=q,m[18]=G,m[19]=J,m[20]=R,m[21]=k,m[22]=P,m[23]=u,m[24]=b.data?.state,m[25]=K,m[26]=L,m[27]=$,m[28]=Z):Z=m[28],m[29]!==D||m[30]!==L?(ee=("preflight_loading"===L||"preflight_passed"===L||"preflight_failed"===L)&&e.jsx(M,{status:"preflight_failed"===L?"fail":"preflight_passed"===L?"pass":"loading",gates:D}),m[29]=D,m[30]=L,m[31]=ee):ee=m[31],m[32]!==ee||m[33]!==Z?(te=e.jsxs("div",{className:"flex h-full flex-col",children:[X,e.jsxs("div",{className:"min-h-0 flex-1 space-y-8 overflow-y-auto bg-gray-contio-50 p-4 pb-22","data-testid":"merge-workspace-settings-entry",children:[Y,Z,ee]})]}),m[32]=ee,m[33]=Z,m[34]=te):te=m[34],te},E=()=>{const t=a.c(4),{user:s}=d();if(!s){let a;return t[0]===Symbol.for("react.memo_cache_sentinel")?(a=e.jsx(p,{}),t[0]=a):a=t[0],a}if(!m("edit_workspace_settings",g(s)).hasPermission){let a;return t[1]===Symbol.for("react.memo_cache_sentinel")?(a=e.jsx(P,{to:"/settings/workspace",replace:!0}),t[1]=a):a=t[1],a}const r=s.workspace?.id;let i;return t[2]!==r?(i=e.jsx($,{workspaceId:r}),t[2]=r,t[3]=i):i=t[3],i};export{E as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.