1import{r as o,j as e,g as M,a7 as Ct,h as _t,k as Pt,l as Lt,m as Bt,n as Tt,p as Dt,s as T,bE as Fs,y as g,af as It,ag as At,Z as Rt,D as Et,A as Ut,E as Ft,F as Mt,G as Ot,H as zt,a1 as F,_ as u,t as j,v as y,w as C,U as b,I as ie,C as Te,Y as _s,an as Ps,x as D,R as De,J as q,bp as $t,bo as qt,V as Ht,W as Yt,X as Vt,L as Ie,aG as Ae,a8 as Re,bc as Kt,aj as Gt}from"./index-Dmz6Wrx6.js";import{L as K}from"./label-DhkKtgJx.js";import{S as Ls,a as Bs,b as Ts,c as Ds,d as Is}from"./select-DvrOGt2h.js";import{A as le,h as oe,a as ce,b as de,c as ge,d as me,e as pe,f as ue,g as xe}from"./alert-dialog-BwDgCqn9.js";import{S as As}from"./switch-i-t1EkDD.js";import{n as Qt}from"./workspaceBranding-DOJ4dzPv.js";import{u as Xt}from"./useCustomApps-DpFOp1BG.js";import{T as Ee}from"./triangle-alert-BcJSzTab.js";import"./index-CQon2M73.js";const Jt=Ct("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),G=o.forwardRef(({className:s,variant:m,...h},O)=>e.jsx("div",{ref:O,role:"alert",className:M(Jt({variant:m}),s),...h}));G.displayName="Alert";const Q=o.forwardRef(({className:s,...m},h)=>e.jsx("h5",{ref:h,className:M("mb-1 font-medium leading-none tracking-tight",s),...m}));Q.displayName="AlertTitle";const X=o.forwardRef(({className:s,...m},h)=>e.jsx("div",{ref:h,className:M("text-sm [&_p]:leading-relaxed",s),...m}));X.displayName="AlertDescription";const Me=["bg-violet-600","bg-blue-600","bg-emerald-600","bg-orange-600","bg-rose-600","bg-teal-600","bg-amber-600"],Ue={"bg-violet-600":"violet","bg-blue-600":"blue","bg-emerald-600":"emerald","bg-orange-600":"orange","bg-rose-600":"rose","bg-teal-600":"teal","bg-amber-600":"amber"},Rs=(s,m)=>
1m??Me[s.charCodeAt(0)%Me.length],Es=[{id:"general"},{id:"branding"},{id:"members"},{id:"apps"},{id:"billing"},{id:"activity"}],Fe=["workspace_admin","creator","viewer"],he=(s,m)=>{const h=(s/100).toLocaleString(void 0,{style:"currency",currency:"USD",maximumFractionDigits:0});return m?`${h}/${m==="year"?"yr":"mo"}`:h},Us=({role:s,subscribed:m,billingPlanKey:h})=>{if(m){if(h==="pro")return"pro";if(h==="enterprise")return"enterprise"}return s==="admin"?"admin":"free"},Zt=({role:s,subscribed:m,billingPlanKey:h,paidSeatQuantity:O})=>{if(s==="admin")return 0;if(m){if(h==="enterprise")return null;if(h==="pro")return Math.max(O??0,0)}return Fs};function oa(){const{t:s}=_t(),m=Pt(),[h,O]=Lt(),c=h.get("team"),H=h.get("section")??"general",{user:f}=Bt(),{role:Oe,subscribed:S,loading:Ms,subscriptionEnd:J,billingPlanKey:I,paidSeatQuantity:fe,hasProPlan:Os,hasEnterprisePlan:zs,refreshRole:$s}=Tt(),{allWorkspaces:ze,activeWorkspaceId:$e,setActiveWorkspaceId:qs,members:qe,invites:Hs,loading:je,renameWorkspace:Ys,updateTileColor:Vs,updateWorkspaceBranding:we,updateMemberRole:Ks,removeMember:Gs,leaveWorkspace:Qs,inviteMember:Xs,revokeInvite:Js,deleteWorkspace:Zs,refreshDetails:Ws}=Dt(),A=ze.find(t=>t.workspace.id===c),a=A==null?void 0:A.workspace,v=(A==null?void 0:A.role)==="workspace_admin",[et,He]=o.useState(()=>new Set(c?[c]:[])),[st,Z]=o.useState(!1),[be,Ye]=o.useState((a==null?void 0:a.name)??""),[Ve,Ke]=o.useState(!1),[W,Ge]=o.useState(!1),[Qe,Xe]=o.useState(!1),[Je,Ze]=o.useState(!1),[ke,Se]=o.useState((a==null?void 0:a.branding_primary_color)??"#6DC5B7"),We=o.useRef(null),[ee,es]=o.useState(""),[se,ss]=o.useState("viewer"),[ts,as]=o.useState(!1),[ve,rs]=o.useState(null),[ns,Ne]=o.useState(0),[is,ls]=o.useState(!1),[x,ye]=o.useState(null),[tt,Ce]=o.useState(!1),[te,os]=o.useState(!1),[Y,cs]=o.useState(!1),[_,_e]=o.useState(null),{customApps:ae,renameCustomApp:at,deleteCustomApp:rt,checkCustomAppUsage:nt}=Xt((a==null?void 0:a.id)??null,{includeLegacyGlobal:!1}),[it,lt]=o.useState({}),[ot,re]=o.useState(null),[ds,gs]=o.useState("");o.useEffect(()=>{if(!a)return;let t=!1;return(async()=>{const i=await Promise.all(ae.map(async r=>[r.id,await nt(a.id,r.name)]));t||lt(Object.fromEntries(i))})(),()=>{t=!0}},[ae,a==null?void 0:a.id]),o.useEffect(()=>{Se((a==null?void 0:a.branding_primary_color)??"#6DC5B7")},[a==null?void 0:a.branding_primary_color]);const[k,ms]=o.useState(null),P=qe.filter(t=>t.seat_type==="full"&&t.status==="active").length;o.useEffect(()=>{c&&c!==$e?qs(c):c===$e&&Ws()},[c]),o.useEffect(()=>{je||!A||!v&&H!=="general"&&H!=="apps"&&O({team:c??"",section:"general"})},[v,H,je,A]),o.useEffect(()=>{a&&(Ye(a.name),He(t=>new Set([...t,a.id])))},[a==null?void 0:a.id]),o.useEffect(()=>{if(ms(null),!(a!=null&&a.id))return;let t=!1;return T.rpc("workspace_billing_summary",{p_workspace_id:a.id}).then(({data:i,error:r})=>{if(t)return;if(r){console.error("Failed to fetch workspace billing summary:",r);return}const l=Array.isArray(i)?i[0]:i;l&&ms({plan_key:l.plan_key,seat_cap:l.seat_cap})}),()=>{t=!0}},[a==null?void 0:a.id]),o.useEffect(()=>{S&&I==="pro"&&Ne(0)},[S,I,fe,P]);const ct=(t,i)=>{O({team:t,section:i})},dt=t=>{He(i=>{const r=new Set(i);return r.has(t)?r.delete(t):r.add(t),r})},ps=async()=>{!be.trim()||!c||(await Ys(c,be.trim()),Z(!1))},us=async t=>{c&&(Ke(!0),await Vs(c,t),Ke(!1))},xs=async()=>{if(!ee.trim()||!c){u.error(s("workspaceSettings.toasts.enterEmailAddress"));return}if(f!=null&&f.email&&ee.trim().toLowerCase()===f.email.toLowerCase()){u.error(s("workspaceSettings.toasts.cannotInviteSelf"));return}const t=ee.trim(),i=se!=="viewer",r=P+(i?1:0);if(i&&N!==null&&r>N){if(!z){u.error(s("workspaceSettings.toasts.ownerMustIncreaseSeats"));return}if(!(S&&I==="pro")){u.error(s("workspaceSettings.toasts.upgradeBeforeInviting")),m("/pricing");return}await fs(r,{email:t,role:se});return}await hs(t,se)},hs=async(t,i)=>{if(!c)return;as(!0),rs(null);const r=await Xs(c,t,i);r.success&&(es(""),ss("viewer"),r.accept_url&&rs(r.accept_url)),as(!1)},fs=async(t,i)=>{var r;if(c){os(!0);try{const{data:l}=await T.auth.getSession(),d=(r=l==null?void 0:l.session)==null?void 0:r.access_token;if(!d)throw new Error(s("workspaceSettings.toasts.signInRequiredPreviewSeat"));const{data:n,error:p}=await T.functions.invoke("preview-seat-change",{headers:{Authorization:`Bearer ${d}`},body:{workspace_id:c,target_paid_seats:t}});if(p||n!=null&&n.error)throw new Error((n==null?void 0:n.error)??(p==null?void 0:p.message)??s("workspaceSettings.toasts.previewSeatChangeFailed"));_e(i??null),ye(n),Ce(!0)}catch(l){u.error(l instanceof Error?l.message:s("workspaceSettings.toasts.previewSeatChangeFailed"))}finally{os(!1)}}},js=()=>{Y||(Ce(!1),ye(null),_e(null))},gt=()=>{Ce(!1),ye(null),_e(null)},ws=async()=>{var i;
1if(!c||!x)return;const t=_;cs(!0);try{const{data:r}=await T.auth.getSession(),l=(i=r==null?void 0:r.session)==null?void 0:i.access_token;if(!l)throw new Error(s("workspaceSettings.toasts.signInRequiredApplySeat"));const{data:d,error:n}=await T.functions.invoke("apply-seat-change",{headers:{Authorization:`Bearer ${l}`},body:{workspace_id:c,target_paid_seats:x.target_quantity}});if(n||d!=null&&d.error)throw new Error((d==null?void 0:d.error)??(n==null?void 0:n.message)??s("workspaceSettings.toasts.applySeatChangeFailed"));await $s(f==null?void 0:f.id),Ne(0),gt(),t?(u.success(s("workspaceSettings.toasts.paidSeatsUpdatedBilling")),await hs(t.email,t.role)):u.success(s("workspaceSettings.toasts.paidSeatsUpdated"))}catch(r){u.error(r instanceof Error?r.message:s("workspaceSettings.toasts.applySeatChangeFailed"))}finally{cs(!1)}},mt=async()=>{!c||!x||!_||await ws()},z=(a==null?void 0:a.owner_id)===(f==null?void 0:f.id),R=Os||zs,pt=Us(z?{role:Oe,subscribed:S,billingPlanKey:I}:{role:"free",subscribed:(k==null?void 0:k.plan_key)==="pro"||(k==null?void 0:k.plan_key)==="enterprise",billingPlanKey:(k==null?void 0:k.plan_key)??null}),ut=s(`workspaceSettings.billing.planNames.${pt}`),N=z?Zt({role:Oe,subscribed:S,billingPlanKey:I,paidSeatQuantity:fe}):k?k.seat_cap:Fs,Pe=N===null||P<N,bs=z&&S&&I==="pro",Le=t=>t==="viewer"?!1:!Pe,ks=t=>t==="viewer"||Pe?!1:!bs,Ss=async t=>{try{const i=new URL(t),r="/storage/v1/object/public/workspace-branding/",l=i.pathname.indexOf(r);if(l===-1)return;const d=decodeURIComponent(i.pathname.slice(l+r.length));if(!d)return;await T.storage.from("workspace-branding").remove([d])}catch{}},vs=async(t,i)=>{if(c){Ge(!0);try{return await we(c,t)?(u.success(i),!0):!1}finally{Ge(!1)}}},xt=t=>{Se(t)},ht=async()=>{const t=ke,i=(a==null?void 0:a.branding_primary_color)??"#6DC5B7";if(t===i)return;await vs({branding_primary_color:t},s("workspaceSettings.toasts.brandColorUpdated"))||Se(i)},Ns=async(t,i)=>{await vs({[t]:i},s("workspaceSettings.toasts.brandingPreferencesUpdated"))},ft=async t=>{var l;const i=(l=t.target.files)==null?void 0:l[0];if(t.target.value="",!i||!c)return;if(!R){u.error(s("workspaceSettings.toasts.upgradeToUploadBranding"));return}if(!new Set(["image/png","image/jpeg","image/jpg","image/webp"]).has(i.type)){u.error(s("workspaceSettings.toasts.selectValidImageType"));return}if(i.size>1*1024*1024){u.error(s("workspaceSettings.toasts.logoSizeTooLarge"));return}Xe(!0);try{const d=(i.name.split(".").pop()||"png").toLowerCase(),n=d==="webp"?"webp":d==="jpg"||d==="jpeg"?"jpg":"png",p=`${c}/${Date.now()}-logo.${n}`,{error:w}=await T.storage.from("workspace-branding").upload(p,i,{upsert:!1,contentType:i.type||void 0});if(w)throw w;const{data:{publicUrl:L}}=T.storage.from("workspace-branding").getPublicUrl(p),E=a==null?void 0:a.branding_logo_url;if(!await we(c,{branding_logo_url:L})){await T.storage.from("workspace-branding").remove([p]);return}E&&await Ss(E),u.success(s("workspaceSettings.toasts.companyLogoUpdated"))}catch(d){console.error("Workspace branding upload error:",d),u.error(s("workspaceSettings.toasts.uploadLogoFailed"))}finally{Xe(!1)}},jt=async()=>{if(!(!c||!(a!=null&&a.branding_logo_url))){Ze(!0);try{const t=a.branding_logo_url;if(!await we(c,{branding_logo_url:null}))return;await Ss(t),u.success(s("workspaceSettings.toasts.companyLogoRemoved"))}finally{Ze(!1)}}},ys=()=>{const t=a?Rs(a.name,a.tile_color):void 0;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold",children:s("workspaceSettings.sections.general")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("workspaceSettings.general.description")})]}),e.jsxs(j,{children:[e.jsx(y,{children:e.jsx(C,{className:"text-base",children:s("workspaceSettings.general.workspaceNameTitle")})}),e.jsx(b,{children:v&&st?e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ie,{value:be,onChange:i=>Ye(i.target.value),onKeyDown:i=>{i.key==="Enter"&&ps(),i.key==="Escape"&&Z(!1)},className:"max-w-sm",autoFocus:!0}),e.jsx(g,{size:"icon",variant:"ghost",onClick:ps,children:e.jsx(Te,{className:"h-4 w-4"})}),e.jsx(g,{size:"icon",variant:"ghost",onClick:()=>Z(!1),children:e.jsx(_s,{className:"h-4 w-4"})})]}):e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-lg font-medium",children:a==null?void 0:a.name}),v&&e.jsx(g,{size:"icon",variant:"ghost",onClick:()=>Z(!0),children:e.jsx(Ps,{className:"h-4 w-4"})})]})})]}),v&&e.jsxs(j,{children:[e.jsxs(y,{children:[e.jsx(C,{className:"text-base",children:s("workspaceSettings.general.tileColorTitle")}),e.jsx(D,{children:s("workspaceSettings.general.tileColorDescription")})]}),e.jsxs(b,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:M("h-10 w-10 rounded-lg flex items-center justify-center text-white text-base font-bold shadow-sm",t),children:a==null?void 0:a.name[0].toUpperCase()}),e.jsx("span",{className:"text-sm text-muted-foreground",children:a!=null&&a.tile_color?s("workspaceSettings.general.customColorLabel",{color:Ue[a.tile_color]?s(`workspaceSettings.colors.${Ue[a.tile_color]}`):a.tile_color}):s("workspaceSettings.general.defaultColorLabel")})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:Me.map(i=>{const r=t===i;return e.jsx("button",{disabled:Ve,title:s(`workspaceSettings.colors.${Ue[i]}`),onClick:()=>us(i),className:M("h-8 w-8 rounded-full transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",i,r?"ring-2 ring-offset-2 ring-foreground scale-110":"hover:scale-110 opacity-80 hover:opacity-100"),children:r&&e.jsx(Te,{className:"h-4 w-4 text-white mx-auto"})},i)})}),(a==null?void 0:a.tile_color)&&e.jsx(g,{variant:"ghost",size:"sm",disabled:Ve,onClick:()=>us(null),className:"text-muted-foreground h-auto px-0 text-xs hover:text-foreground",children:s("workspaceSettings.general.resetColorButton")})]})]}),v&&e.jsxs(j,{className:"border-destructive/50",children:[e.jsxs(y,{children:[e.jsx(C,{className:"text-base text-destructive",children:s("workspaceSettings.general.deleteWorkspaceTitle")}),e.jsx(D,{children:s("workspaceSettings.general.deleteWorkspaceDescription")})]}),e.jsx(b,{children:e.jsxs(le,{children:[e.jsx(oe,{asChild:!0,children:e.jsxs(g,{variant:"destructive",className:"gap-2",children:[e.jsx(De,{className:"h-4 w-4"}),s("workspaceSettings.general.deleteWorkspaceButton")]})}),e.jsxs(ce,{children:[e.jsxs(de,{children:[e.jsx(ge,{children:s("workspaceSettings.general.deleteWorkspaceConfirmTitle")}),e.jsxs(me,{children:[s("workspaceSettings.general.deleteWorkspaceConfirmBefore")," ",e.jsx("strong",{children:a==null?void 0:a.name})," ",s("workspaceSettings.general.deleteWorkspaceConfirmAfter")]})]}),e.jsxs(pe,{children:[e.jsx(ue,{children:s("workspaceSettings.cancel")}),e.jsx(xe,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",disabled:is,onClick:async()=>
1{if(c){ls(!0);try{await Zs(c)&&m("/dashboard")}catch{u.error(s("workspaceSettings.toasts.deleteWorkspaceFailed"))}finally{ls(!1)}}},children:s(is?"workspaceSettings.general.deletingButton":"workspaceSettings.general.deleteWorkspaceButton")})]})]})]})})]})]})},wt=()=>{const t=qe.filter(n=>n.status==="active"),i=Hs.filter(n=>n.status==="pending"),r=t.length+i.length,l=t.filter(n=>n.role==="workspace_admin"&&n.user_id!==(f==null?void 0:f.id)),d=!z&&l.length>0;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold",children:s("workspaceSettings.sections.members")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("workspaceSettings.members.subtitle",{active:t.length,pending:i.length})})]}),e.jsx(j,{children:e.jsxs(b,{className:"pt-4 space-y-3",children:[t.map(n=>{var w,L,E,$,V,ne;const p=n.user_id===(f==null?void 0:f.id);return e.jsxs("div",{className:"flex items-center gap-3 rounded-lg border p-3",children:[e.jsxs(Ht,{className:"h-8 w-8 shrink-0",children:[e.jsx(Yt,{src:((w=n.profiles)==null?void 0:w.avatar_url)??void 0}),e.jsx(Vt,{className:"text-xs",children:(((L=n.profiles)==null?void 0:L.first_name)||((E=n.profiles)==null?void 0:E.username)||"?").charAt(0).toUpperCase()})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:[($=n.profiles)==null?void 0:$.first_name,(V=n.profiles)==null?void 0:V.last_name].filter(Boolean).join(" ")||((ne=n.profiles)==null?void 0:ne.username)||s("workspaceSettings.members.unknownUser")}),e.jsx(q,{className:"text-[10px] px-1.5 py-0 bg-emerald-100 text-emerald-700 border-emerald-200 hover:bg-emerald-100",children:s("workspaceSettings.members.activeBadge")})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[n.seat_type==="full"?s("workspaceSettings.members.billableSeatLabel"):s("workspaceSettings.members.freeSeatLabel"),n.joined_at&&` · ${s("workspaceSettings.members.joinedOn",{date:new Date(n.joined_at).toLocaleDateString()})}`]})]}),v&&!p?e.jsxs(Ls,{value:n.role,onValueChange:B=>{const U=B;if(Le(U)&&n.role==="viewer"){const Be=N===0?s("workspaceSettings.toasts.seatLimitUpgradeToPro"):s("workspaceSettings.toasts.seatLimitReached",{plan:ut,count:N});u.error(Be);return}Ks(n.id,U)},children:[e.jsx(Bs,{className:"w-36 h-8 text-xs",children:e.jsx(Ts,{})}),e.jsxs(Ds,{children:[Fe.map(B=>{const U=Le(B)&&n.role==="viewer";return e.jsx(Is,{value:B,className:"text-xs",disabled:U,children:e.jsxs("span",{className:"flex items-center gap-1.5",children:[s(`workspaceSettings.roles.${B}.label`),U&&e.jsx(Ie,{className:"h-3 w-3 text-muted-foreground"})]})},B)}),Le("creator")&&n.role==="viewer"&&e.jsxs("div",{className:"px-2 py-1.5 text-[11px] text-muted-foreground border-t",children:[e.jsx("button",{className:"text-primary hover:underline",onClick:()=>m("/pricing"),children:s("workspaceSettings.members.upgradePlanLink")})," ",s("workspaceSettings.members.toAssignPaidRoles")]})]})]}):e.jsxs(q,{variant:"outline",className:"text-xs",children:[s(`workspaceSettings.roles.${n.role}.label`),p?s("workspaceSettings.members.youSuffix"):""]}),v&&!p&&e.jsxs(le,{children:[e.jsx(oe,{asChild:!0,children:e.jsx(g,{size:"icon",variant:"ghost",className:"text-destructive hover:text-destructive",children:e.jsx(De,{className:"h-4 w-4"})})}),e.jsxs(ce,{children:[e.jsxs(de,{children:[e.jsx(ge,{children:s("workspaceSettings.members.removeMemberTitle")}),e.jsx(me,{children:s("workspaceSettings.members.removeMemberDescription")})]}),e.jsxs(pe,{children:[e.jsx(ue,{children:s("workspaceSettings.cancel")}),e.jsx(xe,{onClick:()=>Gs(n.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:s("workspaceSettings.members.removeButton")})]})]})]}),p&&(d?e.jsxs(le,{children:[e.jsx(oe,{asChild:!0,children:e.jsx(g,{size:"sm",variant:"outline",className:"text-destructive border-destructive/40 hover:bg-destructive/10 hover:text-destructive shrink-0",children:s("workspaceSettings.members.leaveButton")})}),e.jsxs(ce,{children:[e.jsxs(de,{children:[e.jsx(ge,{children:s("workspaceSettings.members.leaveWorkspaceConfirmTitle")}),e.jsx(me,{children:s("workspaceSettings.members.leaveWorkspaceConfirmDescription")})]}),e.jsxs(pe,{children:[e.jsx(ue,{children:s("workspaceSettings.cancel")}),e.jsx(xe,{onClick:async()=>{await Qs(c)&&m("/dashboard")},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:s("workspaceSettings.members.leaveWorkspaceConfirmButton")})]})]})]}):e.jsx(g,{size:"sm",variant:"outline",className:"text-destructive border-destructive/40 hover:bg-destructive/10 hover:text-destructive shrink-0",onClick:()=>u.warning(s(z?"workspaceSettings.toasts.ownerCannotLeave":"workspaceSettings.toasts.assignAnotherAdminFirst")),children:s("workspaceSettings.members.leaveButton")}))]},n.id)}),v&&i.map(n=>e.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-dashed p-3 op
1acity-80",children:[e.jsx("div",{className:"h-8 w-8 rounded-full bg-muted flex items-center justify-center shrink-0",children:e.jsx(Ae,{className:"h-4 w-4 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:n.email}),e.jsx(q,{className:"text-[10px] px-1.5 py-0 bg-amber-100 text-amber-700 border-amber-200 hover:bg-amber-100",children:s("workspaceSettings.members.pendingBadge")})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s(`workspaceSettings.roles.${n.role}.label`)," · ",s("workspaceSettings.members.expiresOn",{date:new Date(n.expires_at).toLocaleDateString()})]})]}),e.jsx(g,{size:"sm",variant:"ghost",className:"text-destructive hover:text-destructive shrink-0",onClick:()=>Js(n.id),children:s("workspaceSettings.members.revokeButton")})]},n.id)),r===0&&e.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:s("workspaceSettings.members.noMembersYet")})]})}),v&&e.jsxs(j,{children:[e.jsxs(y,{children:[e.jsxs(C,{className:"text-base flex items-center gap-2",children:[e.jsx(Ae,{className:"h-4 w-4"}),s("workspaceSettings.members.inviteMemberTitle")]}),e.jsx(D,{children:s("workspaceSettings.members.inviteMemberDescription")})]}),e.jsxs(b,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-[1fr_auto_auto] gap-3 items-end",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(K,{htmlFor:"invite-email",children:s("workspaceSettings.members.emailAddressLabel")}),e.jsx(ie,{id:"invite-email",type:"email",placeholder:"[email protected]",value:ee,onChange:n=>es(n.target.value),onKeyDown:n=>n.key==="Enter"&&xs()})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(K,{children:s("workspaceSettings.members.roleLabel")}),e.jsxs(Ls,{value:se,onValueChange:n=>ss(n),children:[e.jsx(Bs,{className:"w-36",children:e.jsx(Ts,{})}),e.jsxs(Ds,{children:[Fe.map(n=>{const p=ks(n);return e.jsx(Is,{value:n,disabled:p,children:e.jsxs("span",{className:"flex items-center gap-1.5",children:[s(`workspaceSettings.roles.${n}.label`),p&&e.jsx(Ie,{className:"h-3 w-3 text-muted-foreground"})]})},n)}),ks("creator")?e.jsxs("div",{className:"px-2 py-1.5 text-[11px] text-muted-foreground border-t",children:[e.jsx("button",{className:"text-primary hover:underline",onClick:()=>m("/pricing"),children:s("workspaceSettings.members.upgradePlanLink")})," ",s("workspaceSettings.members.toInviteCreatorsAdmins")]}):!Pe&&bs?e.jsx("div",{className:"px-2 py-1.5 text-[11px] text-muted-foreground border-t",children:s("workspaceSettings.members.seatIncreaseConfirmNotice")}):null]})]})]}),e.jsxs(g,{onClick:xs,disabled:ts||te,children:[ts||te?e.jsx(F,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(Ae,{className:"h-4 w-4 mr-2"}),s("workspaceSettings.members.sendInviteButton")]})]}),e.jsx(Re,{}),ve&&e.jsxs("div",{className:"rounded-md border border-dashed p-3 space-y-2",children:[e.jsxs("p",{className:"text-xs font-medium flex items-center gap-1.5",children:[e.jsx(Kt,{className:"h-3.5 w-3.5 text-muted-foreground"}),s("workspaceSettings.members.inviteLinkLabel")]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 text-xs bg-muted rounded px-2 py-1.5 truncate select-all",children:ve}),e.jsxs(g,{size:"sm",variant:"outline",className:"shrink-0",onClick:()=>{navigator.clipboard.writeText(ve),u.success(s("workspaceSettings.toasts.inviteLinkCopied"))},children:[e.jsx(Gt,{className:"h-3.5 w-3.5 mr-1"}),s("workspaceSettings.members.copyButton")]})]})]}),e.jsx(Re,{}),e.jsx("div",{className:"text-xs text-muted-foreground space-y-1",children:Fe.map(n=>e.jsxs("p",{children:[e.jsxs("span",{className:"font-medium",children:[s(`workspaceSettings.roles.${n}.label`),":"]})," ",s(`workspaceSettings.roles.${n}.description`)]},n))})]})]})]})},bt=()=>{const t=Qt(a),i=W||Qe||Je;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold",children:s("workspaceSettings.sections.branding")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("workspaceSettings.branding.description")})]}),e.jsxs(j,{children:[e.jsxs(y,{children:[e.jsx(C,{className:"text-base",children:s("workspaceSettings.branding.companyBrandingTitle")}),e.jsx(D,{children:s("workspaceSettings.branding.companyBrandingDescription")})]}),e.jsxs(b,{className:"space-y-6",children:[!R&&e.jsxs(G,{children:[e.jsx(Ie,{className:"h-4 w-4"}),e.jsx(Q,{children:s("workspaceSettings.branding.proRequiredTitle")}),e.jsx(X,{children:s("workspaceSettings.branding.proRequiredDescription")})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(K,{children:s("workspaceSettings.branding.companyLogoLabel")}
1),e.jsxs("div",{className:"flex items-center gap-4 rounded-lg border p-4",children:[e.jsx("div",{className:"flex h-16 w-16 items-center justify-center overflow-hidden rounded-xl border bg-muted/30",children:t.logoUrl?e.jsx("img",{src:t.logoUrl,alt:s("workspaceSettings.branding.workspaceLogoAlt"),className:"h-full w-full object-contain p-2"}):e.jsx("span",{className:"text-xs text-muted-foreground",children:s("workspaceSettings.branding.noLogoText")})}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("workspaceSettings.branding.logoUploadHint")}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(g,{type:"button",variant:"outline",onClick:()=>{var r;return(r=We.current)==null?void 0:r.click()},disabled:!R||i,children:[Qe?e.jsx(F,{className:"mr-2 h-4 w-4 animate-spin"}):null,t.logoUrl?s("workspaceSettings.branding.replaceLogoButton"):s("workspaceSettings.branding.uploadLogoButton")]}),t.logoUrl&&e.jsxs(g,{type:"button",variant:"ghost",onClick:jt,disabled:!R||i,children:[Je?e.jsx(F,{className:"mr-2 h-4 w-4 animate-spin"}):null,s("workspaceSettings.branding.removeLogoButton")]})]}),e.jsx("input",{ref:We,type:"file",accept:"image/png,image/jpeg,image/jpg,image/webp",className:"hidden",onChange:ft})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(K,{htmlFor:"workspace-brand-color",children:s("workspaceSettings.branding.brandColorLabel")}),e.jsxs("div",{className:"flex flex-wrap items-center gap-4 roun
1ded-lg border p-4",children:[e.jsx("input",{id:"workspace-brand-color",type:"color",value:ke,disabled:!R||W,onChange:r=>xt(r.target.value),onBlur:()=>void ht(),className:"h-12 w-16 cursor-pointer rounded border bg-transparent p-1 disabled:cursor-not-allowed"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:ke}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("workspaceSettings.branding.brandColorHint")})]})]})]}),e.jsxs("div",{className:"space-y-4 rounded-lg border p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s("workspaceSettings.branding.useBrandColorClickMarkersTitle")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("workspaceSettings.branding.useBrandColorClickMarkersDescription")})]}),e.jsx(As,{checked:t.useForClickMarkers,disabled:!R||W,onCheckedChange:r=>void Ns("branding_use_for_click_markers",r)})]}),e.jsx(Re,{}),e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s("workspaceSettings.branding.useBrandColorButtonsTitle")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("workspaceSettings.branding.useBrandColorButtonsDescription")})]}),e.jsx(As,{checked:t.useForButtonColor,disabled:!R||W,onCheckedChange:r=>void Ns("branding_use_for_button_color",r)})]})]}),!R&&e.jsx(g,{variant:"outline",onClick:()=>m("/pricing"),disabled:i,children:s("workspaceSettings.branding.viewProPricingButton")})]})]})]})},kt=()=>{if(Ms)return e.jsx("div",{className:"flex items-center justify-center py-16",children:e.jsx(F,{className:"h-6 w-6 animate-spin text-muted-foreground"})});const t=S&&I==="pro",i=S&&I==="enterprise",r=S&&!t&&!i,l=!S&&!t&&!i,d=!1,n=N===null?fe??P:N,p=N===null?null:Math.max(N-P,0),w=ns,L=n+w,E=Math.max(P,1),$=Math.max(E-L,0),V=w<0&&$>0,ne=L<1||V,B=w!==0&&!ne,U=w===0?s("workspaceSettings.billing.noSeatChange"):s("workspaceSettings.billing.seatChangeSummary",{count:Math.abs(w),signedCount:`${w>0?"+":""}${w}`,total:L}),Be=()=>{t?fs(L):i?window.location.href="mailto:[email protected]":m("/checkout?plan=pro&seats=3")};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold",children:s("workspaceSettings.sections.billing")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("workspaceSettings.billing.description")})]}),l&&e.jsxs(e.Fragment,{children:[e.jsxs(j,{children:[e.jsx(y,{children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-base",children:s("workspaceSettings.billing.freePlanTitle")}),e.jsx(D,{className:"mt-1",children:s("workspaceSettings.billing.freePlanDescription")})]}),e.jsx(q,{variant:"secondary",children:s("workspaceSettings.billing.currentPlanBadge")})]})}),e.jsx(b,{children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.jsx("span",{className:"font-medium text-foreground",children:P})," ",s("workspaceSettings.billing.billableSeatsUsed",{count:P})]})})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs(j,{className:"p-5 flex flex-col gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold",children:s("workspaceSettings.billing.proCardTitle")}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s("workspaceSettings.billing.proCardDescription",{entryPrice:qt,volumePrice:$t})})]}),e.jsx(g,{variant:"outline",className:"w-full",onClick:()=>m("/pricing"),children:s("workspaceSettings.branding.viewProPricingButton")})]}),e.jsxs(j,{className:"p-5 flex flex-col gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold",children:s("workspaceSettings.billing.enterpriseCardTitle")}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s("workspaceSettings.billing.enterpriseCardDescription")})]}),e.jsx(g,{variant:"outline",className:"w-full",onClick:()=>window.location.href="mailto:[email protected]",children:s("workspaceSettings.billing.contactSalesButton")})]})]})]}),t&&e.jsxs(e.Fragment,{children:[e.jsxs(j,{children:[e.jsx(y,{children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-base",children:s("workspaceSettings.billing.proPlanTitle")}),e.jsx(D,{className:"mt-1",children:J?s("workspaceSettings.billing.renewsOn",{date:new Date(J).toLocaleDateString()}):s("workspaceSettings.billing.activeSubscription")})]}),e.jsx(q,{className:"bg-primary/10 text-primary border-primary/20",children:s("workspaceSettings.billing.currentPlanBadge")})]})}),e.jsxs(b,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-3xl font-bold",children:n}),e.jsx("span",{className:"text-sm text-muted-foreground",children:s("workspaceSettings.billing.paidSeatsIncluded",{count:n})})]}),e.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:[s("workspaceSettings.billing.seatsInUse",{c
1ount:P}),p===null?"":s("workspaceSettings.billing.seatsRemaining",{count:p}),"."]})]})]}),e.jsxs(j,{children:[e.jsxs(y,{children:[e.jsx(C,{className:"text-base",children:s("workspaceSettings.billing.manageSeatsTitle")}),e.jsx(D,{children:s("workspaceSettings.billing.manageSeatsDescription")})]}),e.jsxs(b,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-end gap-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(K,{htmlFor:"seat-input",children:s("workspaceSettings.billing.addSubtractSeatsLabel")}),e.jsx(ie,{id:"seat-input",type:"number",step:1,value:ns,onChange:yt=>Ne(parseInt(yt.target.value,10)||0),className:"w-24"})]}),e.jsx("p",{className:"text-sm text-muted-foreground pb-1",children:U})]}),V?e.jsx("p",{className:"text-xs text-amber-700",children:s("workspaceSettings.billing.seatReductionBlocked",{count:$,decreaseBy:Math.abs(w)})}):e.jsx("p",{className:"text-xs text-muted-foreground",children:s("workspaceSettings.billing.seatChangeHint",{count:E})}),e.jsxs(g,{onClick:Be,variant:"outline",disabled:!B||te||Y,children:[te?e.jsx(F,{className:"h-4 w-4 mr-2 animate-spin"}):null,s("workspaceSettings.billing.reviewSeatChangeButton")]})]})]})]}),i&&e.jsxs(j,{children:[e.jsx(y,{children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx(C,{className:"text-base",children:s("workspaceSettings.billing.enterprisePlanTitle")}),e.jsx(D,{className:"mt-1",children:J?s("workspaceSettings.billing.renewsOn",{date:new Date(J).toLocaleDateString()}):s("workspaceSettings.billing.managedBilling")})]}),e.jsx(q,{className:"bg-primary/10 text-primary border-primary/20",children:s("workspaceSettings.billing.currentPlanBadge")})]})}),e.jsxs(b,{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s("workspaceSettings.billing.enterpriseBillingManagedText")}),e.jsx(g,{variant:"outline",onClick:()=>window.location.href="mailto:[email protected]",children:s("workspaceSettings.billing.contactSupportButton")})]})]}),r&&e.jsxs(j,{children:[e.jsxs(y,{children:[e.jsx(C,{className:"text-base",children:s("workspaceSettings.billing.unsupportedBillingTitle")}),e.jsx(D,{children:s("workspaceSettings.billing.unsupportedBillingDescription")})]}),e.jsx(b,{children:e.jsx(g,{variant:"outline",onClick:()=>m("/checkout?plan=pro&seats=3"),children:s("workspaceSettings.billing.moveToProButton")})})]}),d]})},St=()=>e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold",children:s("workspaceSettings.sections.activity")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("workspaceSettings.activity.description")})]}),e.jsx(j,{children:e.jsx(b,{className:"py-12 text-center text-muted-foreground",children:s("workspaceSettings.activity.comingSoon")})})]}),vt=()=>{const t=async r=>{if(!a)return;const l=await at(r,ds,a.id);l.status==="renamed"?(u.success(s("workspaceSettings.toasts.appRenamed")),re(null)):l.status==="conflict"?u.error(s("workspaceSettings.toasts.appRenameConflict",{name:l.existingName})):u.error(s("workspaceSettings.toasts.appRenameFailed"))},i=async r=>{await rt(r)?u.success(s("workspaceSettings.toasts.appDeleted")):u.error(s("workspaceSettings.toasts.appDeleteFailed"))};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold",children:s("workspaceSettings.sections.apps")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("workspaceSettings.apps.description")})]}),e.jsx(j,{children:e.jsxs(b,{className:"pt-4 space-y-3",children:[ae.map(r=>{const l=it[r.id],d=((l==null?void 0:l.tutorials)??0)+((l==null?void 0:l.workbooks)??0),n=ot===r.id;return e.jsxs("div",{className:"flex items-center gap-3 rounded-lg border p-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[n?e.jsxs("div",{className:"flex gap-2",children:[e.jsx(ie,{value:ds,onChange:p=>gs(p.target.value),onKeyDown:p=>{p.key==="Enter"&&t(r.id),p.key==="Escape"&&re(null)},className:"h-8 text-sm max-w-xs",autoFocus:!0}),e.jsx(g,{size:"icon",variant:"ghost",onClick:()=>t(r.id),children:e.jsx(Te,{className:"h-4 w-4"})}),e.jsx(g,{size:"icon",variant:"ghost",onClick:()=>re(null),children:e.jsx(_s,{className:"h-4 w-4"})})]}):e.jsx("p",{className:"text-sm font-medium truncate",children:r.name}),l&&e.jsx("p",{className:"text-xs text-muted-foreground",children:s("workspaceSettings.apps.usedIn",{count:d})})]}),!n&&e.jsx(g,{size:"icon",variant:"ghost","aria-label":d>0?s("workspaceSettings.apps.renameDisabledInUse"):s("workspaceSettings.apps.renameLabel"),title:d>0?s("workspaceSettings.apps.renameDisabledInUse"):s("workspaceSettings.apps.renameLabel"),disabled:d>0,onClick:()=>{re(r.id),gs(r.name)},children:e.jsx(Ps,{className:"h-4 w-4"})}),e.jsxs(le,{children:[e.jsx(oe,{asChild:!0,children:e.jsx(g,{size:"icon",variant:"ghost",className:"text-destructive hover:text-destructive","aria-label":s("workspaceSettings.apps.deleteButton"),disabled:d>0,children:e.jsx(De,{className:"h-4 w-4"})})}),e.jsxs(ce,{children:[e.jsxs(de,{children:[e.jsx(ge,{children:s("workspaceSettings.apps.deleteTitle")}),e.jsx(me,{children:s("workspaceSettings.apps.deleteDescription",{name:r.name})})]}),e.jsxs(pe,{children:[e.jsx(ue,{children:s("workspaceSettings.cancel")}),e.jsx(xe,{onClick:()=>i(r.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:s("workspaceSettings.apps.deleteButton")})]})]})]})]},r.id)}),ae.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:s("workspaceSettings.apps.noAppsYet")})]})})]})},Nt=()=>{if(!c||!a)return e.jsx("div",{className:"text-center text-muted-foreground py-16",children:s("workspaceSettings.selectTeamPrompt")});if(je)return e.jsx("div",{className:"flex items-center justify-center py-16",children:e.jsx(F,{className:"h-6 w-6 animate-spin text-muted-foreground"})});switch(H){case"general":return ys();case"branding":return bt();case"members":return wt();case"apps":return vt();case"billing":return kt();case"activity":return St();default:return ys()}},Cs=ze;return e.jsxs("div",{className:"min-h-screen flex flex-col bg-background",children:[e.jsxs("header",{className:"border-b px-6 py-3 flex items-center gap-3 shrink-0",children:[e.jsxs(g,{variant:"ghost",size:"sm",onClick:()=>
1m("/dashboard"),className:"gap-2",children:[e.jsx(It,{className:"h-4 w-4"}),s("workspaceSettings.backButton")]}),e.jsx("span",{className:"text-muted-foreground",children:"/"}),e.jsx("span",{className:"font-semibold",children:s("workspaceSettings.settingsBreadcrumb")}),a&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-muted-foreground",children:"/"}),e.jsx("span",{className:"text-muted-foreground text-sm",children:a.name})]})]}),e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e.jsxs("aside",{className:"w-56 border-r py-6 px-2 flex flex-col gap-1 shrink-0 overflow-y-auto",children:[e.jsx("p",{className:"px-3 mb-3 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:s("workspaceSettings.myWorkspacesLabel")}),Cs.length===0&&e.jsx("p",{className:"px-3 text-sm text-muted-foreground",children:s("workspaceSettings.noWorkspacesYet")}),Cs.map(t=>{const i=et.has(t.workspace.id);return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>dt(t.workspace.id),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md hover:bg-button-hover hover:text-button-hover-foreground text-sm font-medium",children:[e.jsx("div",{className:M("h-5 w-5 rounded flex items-center justify-center text-white text-[10px] font-bold shrink-0",Rs(t.workspace.name,t.workspace.tile_color)),children:t.workspace.name[0].toUpperCase()}),e.jsx("span",{className:"flex-1 truncate text-left",children:t.workspace.name}),i?e.jsx(At,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}):e.jsx(Rt,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"})]}),i&&e.jsx("div",{className:"ml-7 flex flex-col gap-0.5 mt-0.5",children:(t.role==="workspace_admin"?Es:Es.filter(r=>r.id==="general"||r.id==="apps")).map(r=>{const l=c===t.workspace.id&&H===r.id;return e.jsx("button",{onClick:()=>ct(t.workspace.id,r.id),className:M("text-left text-sm px-3 py-1.5 rounded-md transition-colors",l?"bg-primary text-primary-foreground font-medium":"text-muted-foreground hover:bg-button-hover hover:text-button-hover-foreground"),children:s(`workspaceSettings.sections.${r.id}`)},r.id)})})]},t.workspace.id)})]}),e.jsx("main",{className:"flex-1 overflow-y-auto py-8 px-8 max-w-3xl",children:Nt()})]}),e.jsx(Et,{open:tt,onOpenChange:t=>!t&&js(),children:e.jsxs(Ut,{children:[e.jsxs(Ft,{children:[e.jsx(Mt,{children:s(_?"workspaceSettings.seatPreview.confirmSeatIncreaseTitle":"workspaceSettings.seatPreview.confirmSeatChangeTitle")}),e.jsx(Ot,{children:s(_?"workspaceSettings.seatPreview.inviteNeedsSeatDescription":"workspaceSettings.seatPreview.reviewBillingImpactDescription")})]}),x&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs(G,{children:[e.jsx(Ee,{className:"h-4 w-4"}),e.jsx(Q,{children:s(_?"workspaceSettings.seatPreview.billingChangeRequiredTitle":"workspaceSettings.seatPreview.confirmBillingUpdateTitle")}),e.jsx(X,{children:_?e.jsxs(e.Fragment,{children:[s("workspaceSettings.seatPreview.changeSubscriptionInvite",{current:x.current_quantity,target:x.target_quantity})," ",e.jsx("span",{className:"font-medium text-foreground",children:_.email}),"."]}):e.jsx(e.Fragment,{children:s("workspaceSettings.seatPreview.changeSubscription",{current:x.current_quantity,target:x.target_quantity})})})]}),e.jsxs("div",{className:"rounded-lg border p-4 text-sm",children:[e.jsxs("div",{className:"flex justify-between gap-4 py-1",children:[e.jsx("span",{className:"text-muted-foreground",children:s("workspaceSettings.seatPreview.currentRecurringTotalLabel")}),e.jsx("span",{className:"font-medium",children:he(x.current_total_amount,x.billing_interval)})]}),e.jsxs("div",{className:"flex justify-between gap-4 py-1",children:[e.jsx("span",{className:"text-muted-foreground",children:s("workspaceSettings.seatPreview.newRecurringTotalLabel")}),e.jsx("span",{className:"font-medium",children:he(x.target_total_amount,x.billing_interval)})]}),e.jsxs("div",{className:"flex justify-between gap-4 py-1",children:[e.jsx("span",{className:"text-muted-foreground",children:s("workspaceSettings.seatPreview.perSeatRateLabel")}),e.jsx("span",{className:"font-medium",children:he(x.target_unit_amount,x.billing_interval)})]}),e.jsxs("div",{className:"mt-2 flex justify-between gap-4 border-t pt-2",children:[e.jsx("span",{className:"text-muted-foreground",children:x.change_amount>0?s("workspaceSettings.seatPreview.dueTodayLabel"):x.change_amount<0?s("workspaceSettings.seatPreview.creditedTodayLabel"):s("workspaceSettings.seatPreview.noChargeTodayLabel")}),e.jsx("span",{className:"font-medium",children:he(Math.abs(x.change_amount))})]})]}),x.threshold_crossed&&e.jsxs(G,{children:[e.jsx(Ee,{className:"h-4 w-4"}),e.jsx(Q,{children:s("workspaceSettings.seatPreview.bulkPricingThresholdCrossedTitle")}),e.jsx(X,{children:s("workspaceSettings.seatPreview.bulkPricingThresholdCrossedDescription")})]}),x.threshold_dropped&&e.jsxs(G,{children:[e.jsx(Ee,{className:"h-4 w-4"}),e.jsx(Q,{children:s("workspaceSettings.seatPreview.volumePricingDroppedTitle")}),e.jsx(X,{children:s("workspaceSettings.seatPreview.volumePricingDroppedDescription")})]})]}),e.jsxs(zt,{children:[e.jsx(g,{variant:"outline",onClick:js,disabled:Y,children:s("workspaceSettings.cancel")}),e.jsxs(g,{onClick:_?mt:ws,disabled:Y||!(x!=null&&x.requires_change),children:[Y?e.jsx(F,{className:"h-4 w-4 mr-2 animate-spin"}):null,s(_?"workspaceSettings.seatPreview.confirmAndSendInviteButton":"workspaceSettings.seatPreview.confirmSeatChangeButton")]})]})]})})]})}export{oa 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.