1import{dE as ue,dF as me,r,j as e,I as T,e as A,a1 as ne,g as _e,p as pe,ab as re,dG as he,dH as ge,M as be,a5 as Q,W as Z,dI as xe,o as D,E as fe,x as ye,c as je,b as ve,a6 as we,l as Ne,C as ke,at as Ce,S as Se}from"./index-BokBcvef.js";import{c as $e,f as Re,w as ee,l as Ee}from"./api-DtGdU2Cw.js";import{az as Le,a3 as De,aN as Ue,f as We,aO as ze,aP as Me,aQ as Te,aR as Ae,aS as Ie,E as Pe}from"./ObjectIcon-DirRsqjg.js";import{C as K}from"./Card-DuADMCgg.js";import{S as X}from"./Skeleton-fQvEY9Jq.js";import"./site-meta-BMinDe9p.js";import"./analytics-C4bPpHpE.js";import{u as Fe,i as oe,m as Oe,T as Ke,C as Be,f as qe}from"./App-BGMiVqzd.js";import{U as He}from"./api-wplEdlCb.js";import{L as J}from"./Logo-BQftxmvq.js";import{i as Ye}from"./useKeyboardShortcut-CF0zJ76c.js";import{i as Ge}from"./interactive-DuHD2VhF.js";import{s as Qe}from"./sortWorkspacesForList-BGXyS6KK.js";import"./WarningOctagon.es-BPQTGpVh.js";import"./Banner-LYMtZ1YA.js";import"./highlight-text-_FusPQ_W.js";import"./quota-plans-BI2dQx_Z.js";import"./booking-types-rHJx1g2H.js";import"./microsoft_logo-BmSJe2pD.js";import"./useVoiceChat-BNC2Gc_H.js";import"./useTween-DQfAWz8r.js";import"./credit-addons-BackbiXZ.js";import"./referrals-DcnDmGru.js";import"./plan-copy-BPyxMWSl.js";import"./plan-features-CsHW5Oov.js";import"./PasswordStrengthMeter-GOnegCEt.js";const ce="ucrm-ws-count:";function Xe(a){if(!a)return null;try{const s=localStorage.getItem(ce+a);if(s==null)return null;const t=Number(s);return Number.isInteger(t)&&t>=0?t:null}catch{return null}}function Ze(a,s){if(a)try{localStorage.setItem(ce+a,String(s))}catch{}}function Ve(a){const s=Le(a??"");return s&&!De(s)?s:""}function se(a){return a instanceof Error?a.message:"unknown error"}async function Je(a){const{workspace:s}=await $e({name:a.name,defaultCurrency:a.currency,weekStart:ue()});a.onWorkspaceCreated?.(s);const t=[],c={internalDomains:[a.internalDomain]};if(a.logoFile)try{const n=await me(s.id,void 0,"workspace::logo",a.logoFile,void 0);c.logo=n.file.id}catch(n){t.push(`Workspace created but logo upload failed: ${se(n)}`)}try{const{workspace:n}=await Fe(s.id,c);return{workspace:n,warnings:t}}catch(n){return t.push(`Workspace created but details could not be saved: ${se(n)}`),{workspace:s,warnings:t}}}const V=4,es=[900,900,850,950];function ss(a){switch(a){case"pending":return 3;case"created":return V;case"finished":return V+1}}function as(){const[a,s]=r.useState("form"),[t,c]=r.useState(0),[n,d]=r.useState("pending"),p=r.useRef(0),_=r.useCallback(()=>{p.current=Date.now(),d("pending"),c(1),s("creating")},[]),i=r.useCallback(()=>{d(x=>x==="pending"?"created":x)},[]),u=r.useCallback(()=>d("finished"),[]),g=r.useCallback(()=>{s("form"),c(0),d("pending")},[]);return r.useEffect(()=>{if(a!=="creating"||t>=ss(n))return;const x=Date.now()-p.current,h=Math.max(0,es[t-1]-x),y=window.setTimeout(()=>{p.current=Date.now();const C=t+1;c(C),C>V&&s("done")},h);return()=>window.clearTimeout(y)},[a,t,n]),{phase:a,step:t,start:_,markCreated:i,markFinished:u,fail:g}}const ts="_row_1jfy2_1",ns="_tile_1jfy2_8",rs="_letter_1jfy2_25",os="_halo_1jfy2_32",cs="_badge_1jfy2_41",is="_text_1jfy2_57",ls="_name_1jfy2_65",ds="_placeholder_1jfy2_75",us="_domain_1jfy2_79",v={row:ts,tile:ns,"tile-lit":"_tile-lit_1jfy2_18",letter:rs,halo:os,badge:cs,text:is,name:ls,placeholder:ds,domain:us};function ms({name:a,domain:s,logoSrc:t,building:c=!1,done:n=!1,onLogoUpload:d,onLogoRemove:p}){const _=a.trim(),i=(_[0]??"U").toUpperCase();return e.jsx(K,{padding:"sm",children:e.jsxs("div",{className:v.row,children:[e.jsxs("span",{className:`${v.tile} ${c||n?v["tile-lit"]:""}`,children:[c&&e.jsx("span",{className:v.halo,"aria-hidden":"true"}),e.jsx("span",{className:v.letter,children:e.jsx(J,{src:t,name:_||i,size:"lg",onUpload:d,onRemove:p,cameraOnHover:!0})},t?"img":i),n&&e.jsx("span",{className:v.badge,"aria-hidden":"true",children:e.jsx(T,{name:"check",size:A.xs,weight:"bold"})})]}),e.jsxs("span",{className:v.text,children:[e.jsx("span",{className:_?v.name:`${v.name} ${v.placeholder}`,children:_||"My Workspace"}),e.jsx("span",{className:v.domain,children:s?`@${s}`:"Your company domain"})]})]})})}const ae=["var(--ds-color-accent)","var(--ds-color-accent-light)","var(--ds-color-status-yellow)","var(--ds-color-status-orange)"];function _s(a=14){return Array.from({length:a},(s,t)=>{const c=t/a*Math.PI*2+(t%2?.2:0),n=70+t%3*26;return{x:Math.cos(c)*18,y:Math.sin(c)*10,dx:Math.cos(c)*n*1.6,dy:Math.sin(c)*n*.7,size:t%3===0?7:5,square:t%4===1,color:ae[t%ae.length],duration:.8+t%3*.15,delay:.05+t%4*.03}})}const ps="_stage_1b0m8_1",hs="_heading_1b0m8_11",gs="_title_1b0m8_18",bs="_sub_1b0m8_26",xs="_ready_1b0m8_35",f
1s="_burst_1b0m8_45",ys="_particle_1b0m8_54",js="_board_1b0m8_95",vs="_nav_1b0m8_117",ws="_columns_1b0m8_159",Ns="_column_1b0m8_159",ks="_dot_1b0m8_186",Cs="_deal_1b0m8_199",Ss="_owner_1b0m8_242",$s="_sweep_1b0m8_267",Rs="_steps_1b0m8_285",Es="_step_1b0m8_285",o={stage:ps,"build-stage-in":"_build-stage-in_1b0m8_1",heading:hs,title:gs,sub:bs,ready:xs,burst:fs,particle:ys,"ready-burst":"_ready-burst_1b0m8_1","ready-pill":"_ready-pill_1b0m8_63","ready-pop":"_ready-pop_1b0m8_1","ready-title":"_ready-title_1b0m8_69","ready-in":"_ready-in_1b0m8_1","ready-shine":"_ready-shine_1b0m8_1",board:js,"board-done":"_board-done_1b0m8_104","board-inner":"_board-inner_1b0m8_111",nav:vs,"nav-initial":"_nav-initial_1b0m8_134","nav-bar":"_nav-bar_1b0m8_148","nav-bar-active":"_nav-bar-active_1b0m8_155",columns:ws,column:Ns,"column-head":"_column-head_1b0m8_179",dot:ks,"column-bar":"_column-bar_1b0m8_192",deal:Cs,"deal-text":"_deal-text_1b0m8_216","deal-bar":"_deal-bar_1b0m8_224","deal-value":"_deal-value_1b0m8_231",owner:Ss,in:"_in_1b0m8_251",sweep:$s,"build-sweep":"_build-sweep_1b0m8_1",steps:Rs,step:Es,"step-pending":"_step-pending_1b0m8_304","step-active":"_step-active_1b0m8_308","step-done":"_step-done_1b0m8_312","step-icon":"_step-icon_1b0m8_316","step-ring":"_step-ring_1b0m8_325","step-check":"_step-check_1b0m8_333","build-check-in":"_build-check-in_1b0m8_1","step-label":"_step-label_1b0m8_345"},Ls=[{dot:"var(--ds-color-status-blue)",cards:[["62%","12.4k","var(--ds-color-status-orange)"],["48%","4.8k","var(--ds-color-status-teal)"]]},{dot:"var(--ds-color-accent)",cards:[["70%","30k","var(--ds-color-status-purple)"],["54%","9.2k","var(--ds-color-status-yellow)"],["40%","2.1k","var(--ds-color-status-blue)"]]},{dot:"var(--ds-color-status-green)",cards:[["58%","18k","var(--ds-color-status-teal)"]]}],Ds=_s();function Us(a,s,t){return t||a<s-1?"done":a===s-1?"active":"pending"}function Ws({step:a,done:s,initial:t,currencySymbol:c,domain:n,minHeight:d}){const p=["Creating contacts and companies","Building your deal pipeline","Setting up your data",`Recognising ${n} as your team`];let _=0;return e.jsxs("div",{className:o.stage,style:d?{minHeight:d}:void 0,"aria-live":"polite",children:[s?e.jsxs("div",{className:o.ready,children:[e.jsx("span",{className:o.burst,"aria-hidden":"true",children:Ds.map((i,u)=>e.jsx("span",{className:o.particle,style:{left:i.x,top:i.y,width:i.size,height:i.size,borderRadius:i.square?1.5:"50%",background:i.color,animationDuration:`${i.duration}s`,animationDelay:`${i.delay}s`,"--burst-dx":`${i.dx}px`,"--burst-dy":`${i.dy}px`}},u))}),e.jsx("span",{className:o["ready-pill"],children:e.jsx(ne,{color:"accent",icon:"sparkle",size:"sm",uppercase:!0,children:"All set"})}),e.jsx("p",{className:o["ready-title"],children:"Your workspace is ready"})]}):e.jsxs("div",{className:o.heading,children:[e.jsx("p",{className:o.title,children:"Setting up your workspace"}),e.jsx("p",{className:o.sub,children:"This only takes a moment."})]}),e.jsx(K,{padding:"none",flat:!0,className:`${o.board} ${s?o["board-done"]:""}`,children:e.jsxs("div",{className:o["board-inner"],"aria-hidden":"true","data-step":s?"done":a,children:[e.jsxs("div",{className:`${o.nav} ${a>=1?o.in:""}`,children:[e.jsx("span",{className:o["nav-initial"],children:t}),e.jsx("span",{className:`${o["nav-bar"]} ${o["nav-bar-active"]}`}),e.jsx("span",{className:o["nav-bar"]}),e.jsx("span",{className:o["nav-bar"]}),e.jsx("span",{className:o["nav-bar"]})]}),e.jsx("div",{className:o.columns,children:Ls.map((i,u)=>e.jsxs("div",{className:`${o.column} ${a>=2?o.in:""}`,style:{transitionDelay:`${u*90}ms`},children:[e.jsxs("div",{className:o["column-head"],children:[e.jsx("span",{className:o.dot,style:{background:i.dot}}),e.jsx("span",{className:o["column-bar"]})]}),i.cards.map(([g,x,h])=>{const y=`${120+_++*70}ms`;return e.jsxs("div",{className:`${o.deal} ${a>=2?o.in:""}`,style:{transitionDelay:y},children:[e.jsxs("span",{className:o["deal-text"],children:[e.jsx("span",{className:o["deal-bar"],style:{width:g}}),e.jsxs("span",{className:`${o["deal-value"]} ${a>=3?o.in:""}`,style:{transitionDelay:y},children:[c,x]})]}),e.jsx("span",{className:`${o.owner} ${a>=4?o.in:""}`,style:{background:h,transitionDelay:y}})]},x)})]},u))}),!s&&e.jsx("span",{className:o.sweep})]})}),e.jsx("ol",{className:o.steps,children:p.map((i,u)=>{const g=Us(u,a,s);return e.jsxs("li",{className:`${o.step} ${o[`step-${g}`]}`,"data-state":g,children:[e.jsxs("span",{className:o["step-icon"],children:[g==="active"&&e.jsx(_e,{size:"sm"}),g==="done"&&e.jsx("span",{className:o["step-check"],children:e.jsx(T,{name:"check",size:A.xxs,weight:"bold"})}),g==="pending"&&e.jsx("span",{className:o["step-ring"]})]}),e.jsx("span",{className:o["step-label"],children:i})]},u)})})]})}const zs={"create-workspace-body":"_create-workspace-body_q2gtp_1"};function Ms({onCreated:a,onClose:s,initialName:t=""}){const c=pe(),n=re(),d=r.useMemo(()=>Ve(n.email),[n.email]),[p,_]=r.useState(t),[i,u]=r.useState(()=>he(navigator.language)),[g,x]=r.useState(d),h=as(),y=h.phase==="creating",[C,w]=r.useState(null),N=r.useRef(null),[U,B]=r.useState(void 0),[I,P]=r.useState(null),W=r.useRef(null),[k,F]=r.useState(null),S=p.trim(),R=r.useMemo(()=>Ue(g),[g]),f=R.ok?R.domain??null:null,$=S.length>0&&f!==null,z=S?R.ok?null:R.reason??"Enter a valid company domain":"Enter a workspace name",O=r.useRef(0);r.useEffect(()=>{if(!f){P(null);return}const b=++O.current,M=window.setTimeout(()=>{Re(f).then(G=>{b===O.current&&P(G.logoUrl)}
1).catch(()=>{b===O.current&&P(null)})},300);return()=>window.clearTimeout(M)},[f]);const m=r.useRef(null);m.current=k,r.useEffect(()=>()=>{m.current&&URL.revokeObjectURL(m.current)},[]);const j=r.useCallback(async b=>(W.current=b,F(M=>(M&&URL.revokeObjectURL(M),URL.createObjectURL(b))),"pending"),[]),q=k?async()=>{URL.revokeObjectURL(k),F(null),W.current=null}:void 0,H=r.useCallback(async()=>{if(!(!$||!f||h.phase!=="form")){B(N.current?.offsetHeight),h.start();try{const{workspace:b,warnings:M}=await Je({name:S,currency:i,internalDomain:f,logoFile:W.current,onWorkspaceCreated:h.markCreated});M.forEach(G=>c.error(G)),w(b),h.markFinished()}catch(b){h.fail(),c.error(b instanceof Error?b.message:"Failed to create workspace")}}},[$,f,h,S,i,c]),Y=h.phase==="done"&&C!==null,le=ge[i]?.symbol??i,de=Y?e.jsx(D,{size:"md",onClick:()=>a(C),iconTrailing:e.jsx(T,{name:"arrow-right",size:A.sm,weight:"bold"}),children:"Open workspace"}):y?e.jsx(D,{size:"md",loading:!0,disabled:!0,children:"Creatingâ¦"}):e.jsxs(e.Fragment,{children:[e.jsx(D,{variant:"ghost",size:"md",onClick:s,children:"Cancel"}),e.jsx(fe,{content:z??"",disabled:!z,children:e.jsx(D,{size:"md",onClick:H,disabled:!$,children:"Create"})})]});return e.jsx(be,{open:!0,onClose:s,title:"Create Workspace",size:"sm",preventClose:y,footer:de,children:e.jsxs("div",{className:zs["create-workspace-body"],children:[e.jsx(ms,{name:p,domain:f,logoSrc:k??I??void 0,building:y,done:Y,onLogoUpload:h.phase==="form"?j:void 0,onLogoRemove:h.phase==="form"?q:void 0}),h.phase==="form"?e.jsx("div",{ref:N,children:e.jsxs(We,{variant:"card",children:[e.jsx(Q,{label:"Name",layout:"vertical",children:e.jsx(Z,{value:p,onChange:_,onKeyDown:b=>{b.key==="Enter"&&$&&H()},placeholder:"My Workspace",maxLength:48,autoFocus:!0})}),e.jsx(Q,{label:"Default currency",layout:"vertical",children:e.jsx(xe,{value:i,onChange:u})}),e.jsx(Q,{label:"Company domain",layout:"vertical",help:"People with this email domain are treated as colleagues and excluded from suggestions and health scoring. You can add more domains later in settings.",children:e.jsx(Z,{inputType:"domain",value:g,onChange:x,onKeyDown:b=>{b.key==="Enter"&&$&&H()},leadingText:"@",placeholder:"yourcompany.com"})})]})}):e.jsx(Ws,{step:h.step,done:Y,initial:(S[0]??"U").toUpperCase(),currencySymbol:le,domain:f??"",minHeight:U})]})})}function Ts(a,s){const t=s.trim().toLowerCase();return t?a.filter(c=>c.name.toLowerCase().includes(t)||(c.subtitle??"").toLowerCase().includes(t)):a}function As(a,s,t){return t<=0?-1:a<0||a>=t?s===1?0:t-1:(a+s+t)%t}function ie(a=oe()){return a?{code:"KeyK",meta:!0}:{code:"KeyK",ctrl:!0}}function Is(a){const s=r.useRef(a);r.useLayoutEffect(()=>{s.current=a}),r.useEffect(()=>{const t=ie(),c=n=>{const d=s.current;if(!d.enabled)return;if(Oe(n,t)){n.preventDefault();const u=d.searchEl();(u?.matches("input")?u:u?.querySelector("input"))?.focus();return}if(n.key!=="ArrowDown"&&n.key!=="ArrowUp"||n.altKey||n.ctrlKey||n.metaKey||n.shiftKey)return;const p=d.searchEl(),_=!!p&&n.target instanceof Node&&p.contains(n.target);if(!_&&Ye(n)||d.count===0)return;n.preventDefault();const i=As(d.cursor,n.key==="ArrowDown"?1:-1,d.count);d.setCursor(i),_||d.focusRow(i)};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[])}const Ps="_row_r2591_7",Fs="_field_r2591_14",Os="_tile_r2591_41",Ks="_input_r2591_70",Bs="_cta_r2591_106",E={row:Ps,field:Fs,tile:Os,"tile-logo":"_tile-logo_r2591_52","tile-on":"_tile-on_r2591_60",input:Ks,cta:Bs},qs=48,Hs=r.forwardRef(function({value:s,onChange:t,onSubmit:c,placeholder:n,ariaLabel:d},p){const _=s.trim().length>0,i=r.useCallback(u=>{u.preventDefault(),_&&c()},[_,c]);return e.jsxs("form",{noValidate:!0,className:E.row,onSubmit:i,children:[e.jsxs("label",{className:E.field,children:[e.jsx("span",{className:`${E.tile} ${_?E["tile-on"]:""}`,"aria-hidden":"true",children:e.jsx("span",{className:E["tile-logo"],children:e.jsx(J,{name:s,size:"sm",tone:"soft"})})}),e.jsx(Z,{ref:p,value:s,onChange:t,placeholder:n,maxLength:qs,autoFocus:!0,"aria-label":d,className:E.input})]}),e.jsx(D,{type:"submit",variant:"primary",size:"lg",disabled:!_,iconTrailing:e.jsx(T,{name:"arrow-right",size:A.xs,weight:"bold"}),className:E.cta,children:"Create workspace"})]})}),Ys="_empty_1d7zm_10",Gs="_column_1d7zm_22",Qs="_headline_1d7zm_30",Xs="_form_1d7zm_31",Zs="_suggestions_1d7zm_32",Vs="_chips_1d7zm_70",L={empty:Ys,column:Gs,headline:Qs,form:Xs,suggestions:Zs,"suggestions-label":"_suggestions-label_1d7zm_61",chips:Vs},Js=["Sales Team","Revenue Team","Commercial","Accounts","Customer Success","RevOps","Sales Ops","Pipeline","CRM","My Workspace"];function ea({onRequestCreate:a}){const[s,t]=r.useState(""),c=r.useRef(null),n=()=>{const d=s.trim();d&&a(d)};return e.jsx("div",{className:L.empty,children:e.jsxs("div",{className:L.column,children:[e.jsx("h1",{className:L.headline,children:"What should we call your first workspace?"}),e.jsx("div",{className:L.form,children:e.jsx(Hs,{ref:c,value:s,onChange:t,onSubmit:n,placeholder:"e.g. Acme Sales",ariaLabel:"Workspace name"})}),e.jsxs("div",{className:L.suggestions,children:[e.jsx("span",{className:L["suggestions-label"],id:"workspace-name-suggestions",children:"Suggestions"}),e.jsx("div",{className:L.chips,role:"group","aria-labelledby":"workspace-name-suggestions",children:Js.map(d=>e.jsx(D,{variant:"chip",size:"sm",selected:s===d,onClick:()=>{t(d),c.current?.focus()},children:d},d))})]})]})})}const sa="_page_1dmu3_14",aa="_topbar_1dmu3_32",ta="_main_1dmu3_47",na="_header_1dmu3_66",ra="_title_1dmu3_84",oa="_count_1dmu3_99",ca="_lede_1dmu3_104",ia="_actions_1dmu3_109",la="_search_1dmu3_116",da="_keycap_1dmu3_126",ua="_cta_1dmu3_151",ma="_table_1dmu3_184",_a="_columns_1dmu3_194",pa="_head_1dmu3_66",ha="_body_1dmu3_218",ga="_rows_1dmu3_236",ba="_row_1dmu3_236 _columns_1dmu3_194",xa="_workspace_1dmu3_268",fa="_icon_1dmu3_275",ya="_text_1dmu3_285",ja="_name_1dmu3_291",va="_subtitle_1dmu3_292",wa="_role_1dmu3_313",Na="_bars_1dmu3_323",ka="_unread_1dmu3_335",Ca="_last_1dmu3_350",Sa="_presence_1dmu3_362",$a="_chevron_1dmu3_379",l={page:sa,topbar:aa,main:ta,"main-empty":"_main-empty_1dmu3_60",header:na,"header-title":"_header-title_1dmu3_77","title-row":"_title-row_1dmu3_84",title:ra,count:oa,lede:ca,actions:ia,search:la,keycap:da,cta:ua,"cta-plus":"_cta-plus_1dmu3_172",table:ma,columns:_a,head:pa,body:ha,rows:ga,row:ba,workspace:xa,icon:fa,text:ya,name:ja,subtitle:va,"subtitle-empty":"_subtitle-empty_1dmu3_309",role:wa,bars:Na,unread:ka,"unread-badge":"_unread-badge_1dmu3_339",last:Ca,presence:Sa,chevron:$a,"row-skeleton":"_row-skeleton_1dmu3_395","row-skeleton-text":"_row-skeleton-text_1dmu3_403"},Ra=10,Ea=600,La=5;function Da({value:a}){const s=ye(),[t,c]=r.useState(s);r.useEffect(()=>{if(t)return;const d=setTimeout(()=>c(!0),Ea);return()=>clearTimeout(d)},[t]);const n=Number(Te(t?a:0,String,!1,void 0,s));return e.jsx(Be,{value:n,showZero:!0,className:l["unread-badge"],"aria-label":`${a} unread`})}const Ua=r.forwardRef(function({workspace:s,onOpen:t,active:c=!1,onActivate:n,index:d=0},p){const _=s.unreadCount??0,i=s.activity30d??[],u=s.lastActivityAt,g=Ae(u);return e.jsxs("div",{ref:p,className:l.row,"data-active":c||void 0,style:{"--i":Math.min(d,Ra)},...Ge(t),"aria-label":`Open ${s.name}`,onMouseEnter:n,onFocus:n,children:[e.jsxs("span",{className:l.workspace,children:[e.jsx("span",{className:l.icon,children:e.jsx(J,{src:s.logoUrl,fileId:s.logo,workspaceId:s.id,name:s.name,size:"md",tone:"soft"})}),e.jsxs("span",{className:l.text,children:[e.jsx("span",{className:l.name,children:s.name}),e.jsx("span",{className:s.subtitle?l.subtitle:`${l.subtitle} ${l["subtitle-empty"]}`,children:s.subtitle||"No description"})]})]}),e.jsx("span",{className:l.role,children:s.roleName}),e.jsx("span",{className:l.bars,children:i.length>0&&e.jsx(ze,{values:i,chartType:"bar",width:i.length*La,height:22,barGap:2,animate:!0,color:"var(--row-bar)",ariaLabel:`Activity over the last ${i.length} days`})}),e.jsx("span",{className:l.unread,children:_>0&&e.jsx(Da,{value:_})}),e.jsx("span",{className:l.last,children:u&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:l.presence,"data-live":g==="online"||void 0,children:e.jsx(Me,{state:g,size:"xs"})}),e.jsx(Ke,{date:u})]})}),e.jsx("span",{className:l.chevron,"aria-hidden":"true",children:e.jsx(T,{name:"caret-right",size:A.md})})]})});function te({days:a}){return e.jsxs("div",{className:`${l.columns} ${l.head}
1`,"aria-hidden":"true",children:[e.jsx("span",{children:"Workspace"}),e.jsx("span",{children:"Role"}),e.jsxs("span",{children:["Activity · ",a,"d"]}),e.jsx("span",{children:"Unread"}),e.jsx("span",{children:"Last active"}),e.jsx("span",{})]})}function ot(){const{sound:a}=je(),s=ve(),t=we(),c=re(),[n]=r.useState(()=>(Xe(c.id)??0)>0),[d,p]=r.useState(!1),[_,i]=r.useState(""),[u,g]=r.useState(""),[x,h]=r.useState(-1),y=r.useRef(null),C=r.useRef([]),{data:w=[],isPending:N,error:U,refetch:B}=Ne({queryKey:ee.all,queryFn:async()=>(await Ee()).workspaces}),I=U?ke(U):"";r.useEffect(()=>{!N&&!U&&Ze(c.id,w.length)},[N,U,w.length,c.id]);const P=m=>{a("success"),t.setQueryData(ee.all,j=>j?[...j,m]:[m]),s(`/workspaces/${m.id}`)},W=r.useMemo(()=>Qe(w),[w]),k=r.useMemo(()=>Ts(W,u),[W,u]),F=w.find(m=>m.activity30d?.length)?.activity30d?.length??30,S=m=>{m&&s(`/workspaces/${m.id}`)};Is({enabled:!d,count:k.length,cursor:x,setCursor:h,searchEl:()=>y.current,focusRow:m=>C.current[m]?.focus()});const R=()=>{p(!0),a("click")},f=!N&&!I&&w.length===0,$=!f&&(!N||n),z=oe(),O=qe(ie(z),z);return e.jsxs("div",{className:l.page,children:[e.jsx("header",{className:l.topbar,children:e.jsx(He,{size:26,wordmarkSize:15,gap:10})}),e.jsxs("main",{className:`${l.main} ${f?l["main-empty"]:""}`,children:[$&&e.jsxs("div",{className:l.header,children:[e.jsxs("div",{className:l["header-title"],children:[e.jsxs("div",{className:l["title-row"],children:[e.jsx("h1",{className:l.title,children:"Workspaces"}),!N&&e.jsx(ne,{label:String(w.length),color:"muted",size:"sm",shape:"rounded",className:l.count})]}),e.jsx("span",{className:l.lede,children:"Select a workspace to continue."})]}),e.jsxs("div",{className:l.actions,children:[e.jsxs("div",{ref:y,className:l.search,children:[e.jsx(Ie,{value:u,onChange:m=>{g(m),h(m.trim()?0:-1)},placeholder:"Find a workspace",disabled:N,onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),S(k[Math.max(0,x)]))},inputProps:{"aria-keyshortcuts":z?"Meta+K":"Control+K"}}),!u&&e.jsx("kbd",{className:l.keycap,"aria-hidden":"true",children:O})]}),e.jsx(D,{variant:"primary",className:l.cta,icon:e.jsx(T,{name:"plus",size:A.xs,weight:"bold",className:l["cta-plus"]}),onClick:R,children:"New workspace"})]})]}),d&&e.jsx(Ms,{onCreated:P,initialName:_,onClose:()=>{p(!1),i("")}}),I&&e.jsx(Ce,{message:I,onRetry:()=>B(),variant:"block"}),N?$&&e.jsxs(K,{padding:"none",flat:!0,className:l.table,"aria-hidden":"true",children:[e.jsx(te,{days:F}),Array.from({length:4}).map((m,j)=>e.jsxs("div",{className:l["row-skeleton"],children:[e.jsx(X,{variant:"avatar",shape:"rounded"}),e.jsxs("div",{className:l["row-skeleton-text"],children:[e.jsx(X,{variant:"text",width:"30%"}),e.jsx(X,{variant:"text-sm",width:"45%"})]})]},j))]}):f?e.jsx(ea,{onRequestCreate:m=>{i(m),R()}}):w.length>0?e.jsxs(K,{padding:"none",flat:!0,className:l.table,children:[e.jsx(te,{days:F}),e.jsx(Se,{className:l.body,children:e.jsxs("div",{className:l.rows,onMouseLeave:()=>h(-1),children:[k.map((m,j)=>e.jsx(Ua,{ref:q=>{C.current[j]=q},workspace:m,index:j,active:x===j,onActivate:()=>h(j),onOpen:()=>S(m)},m.id)),k.length===0&&e.jsx(Pe,{size:"sm",iconName:"magnifying-glass",title:`No workspaces match â${u.trim()}â.`})]})})]}):null]})]})}export{ot 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.