PageSourceSearch

https://www.unifiedcrm.ai/assets/DashboardRoute-D6MHuWPk.js

js unifiedcrm.ai collected 2026-10-05 13:10:44 UTC 76,615 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ObjectIcon-DirRsqjg.js","assets/index-BokBcvef.js","assets/index-Bnm3lZ7c.css","assets/Logo-BQftxmvq.js","assets/Logo-CBZWm_tS.css","assets/WarningOctagon.es-BPQTGpVh.js","assets/Card-DuADMCgg.js","assets/Card-PdP8CU5-.css","assets/Skeleton-fQvEY9Jq.js","assets/Skeleton-BgXnpnXL.css","assets/Banner-LYMtZ1YA.js","assets/Banner-DSoR3rnm.css","assets/site-meta-BMinDe9p.js","assets/quota-plans-BI2dQx_Z.js","assets/analytics-C4bPpHpE.js","assets/highlight-text-_FusPQ_W.js","assets/booking-types-rHJx1g2H.js","assets/microsoft_logo-BmSJe2pD.js","assets/ObjectIcon-FjvjHYD8.css"])))=>i.map(i=>d[i]);
2import{fb as Rt,fc as cs,fd as Tt,ag as Je,j as e,E as $e,r as i,p as et,dZ as ls,d_ as ds,fe as us,I as O,o as ee,ab as tt,aj as de,F as je,ff as hs,dB as ms,dU as It,M as ps,O as lt,at as ke,W as gs,ad as fs,fg as _s,ar as vs,D as se,b as qe,k as st,e as Ne,a6 as ys,a7 as Dt,aa as bs,S as Q,l as Pe,ah as xs,b3 as ws,_ as js,dS as Et,a9 as ks,fh as Ns,U as At,fi as ze,a1 as Le,fj as Ss,fk as dt,A as Cs}from"./index-BokBcvef.js";import{h as Fe,dN as $t,c5 as pe,O as We,I as ge,r as Pt,dO as zt,s as Lt,eJ as Rs,eK as Ge,eL as ut,eM as Ts,eN as Is,c as Ds,eO as Es,eP as As,b as $s,C as Ps,b2 as zs,u as Ls,a as ht,D as Ms,eQ as Os,S as qs,eR as Fs,eS as Ws,ee as Ks,ef as Bs,P as Us,ek as at,eT as Gs,aQ as me,aX as ce,cc as ue,j as Vs,E as G,Q as Se,l as Qs,eU as Hs,eV as mt,e as Ke,cH as Zs,eW as Ys,eX as Xs,eY as Js,eZ as ea,e_ as ta,e$ as sa,f0 as aa,f1 as na,R as oa,f2 as ra,f3 as ia,f4 as ca,f5 as la,co as da,f6 as pt,b6 as Mt,aT as ua,aU as ha,cb as ma,f7 as pa,aR as ga,f8 as fa,f9 as _a,fa as va,fb as ya,fc as gt,aA as ba,aP as xa,aO as wa,ag as ja,fd as ka,d as Na,fe as Sa,w as Ca,cC as Ra}from"./ObjectIcon-DirRsqjg.js";import{E as Ta,Q as Ia,b as Da}from"./ExitTransition.module-DXXCXwut.js";import{B as Ea}from"./Banner-LYMtZ1YA.js";import{aw as Aa,j as $a,ax as Pa,ay as za,r as La,q as Ma,az as Oa,T as Ze,aA as X,aB as qa,aC as Fa,C as Wa,aD as Ka}from"./App-BGMiVqzd.js";import{x as Ba,y as Ua,z as Ga,P as Va,B as Qa,H as Ot,u as Ha,I as Za,v as Ya}from"./ObjectDetailsTabs-DX8dgCKH.js";import{g as Xa}from"./day-part-Dv_T9At2.js";import{S as E}from"./Skeleton-fQvEY9Jq.js";import{u as qt,r as Ja}from"./useReportList-3UGu5j0d.js";import{d as en,l as tn}from"./useVoiceChat-BNC2Gc_H.js";import"./site-meta-BMinDe9p.js";import"./analytics-C4bPpHpE.js";import{I as Ft}from"./InfiniteScrollList-BcGHrSBd.js";import{i as Wt}from"./interactive-DuHD2VhF.js";import{O as Kt}from"./ObjectListItem-NDFjM5rx.js";import{a as Bt}from"./useRecordListReconciler-Rt2DKcDV.js";import{I as sn}from"./infiniteQueryObserver-ohOe3dQY.js";import"./Logo-BQftxmvq.js";import"./WarningOctagon.es-BPQTGpVh.js";import"./Card-DuADMCgg.js";import"./highlight-text-_FusPQ_W.js";import"./quota-plans-BI2dQx_Z.js";import"./booking-types-rHJx1g2H.js";import"./microsoft_logo-BmSJe2pD.js";import"./api-DtGdU2Cw.js";import"./api-wplEdlCb.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";import"./ValidationBadge-clvaNYI2.js";import"./LoadingDots-B3_bgDm0.js";function ne(t,s){return Rt({...t,enabled:!0,suspense:!0,throwOnError:Tt,placeholderData:void 0},cs,s)}function an(t,s){return Rt({...t,enabled:!0,suspense:!0,throwOnError:Tt},sn,s)}const nn={"ref-row-archived":"_ref-row-archived_xye3s_3"},on=900;function ft({workspaceId:t,objectId:s,objectTypeId:a,storedLabel:n,onClick:o,onRemove:l,trailing:r,description:h,variant:d,removeIcon:u,removeIconWeight:b,removeLabel:m,showPopover:f=!1}){const _=Fe(),{data:p,isError:N}=Je(t??void 0,s),w=p&&_&&_.getTitle(a,p.data,p.id)||n,C=p,x=typeof r=="function"?r(C):r,g=typeof h=="function"?h(C):h,y={variant:d,removeIcon:u,removeIconWeight:b,removeLabel:m},j=$t({data:p??null,showDelay:on});if(N)return e.jsx(pe,{icon:"warning-circle",label:n,description:g,trailing:x,onClick:o,onRemove:l,...y});const v=_?.getIconField(a)??null?e.jsx(We,{objectTypeId:a,data:p?.data,workspaceId:t??void 0,objectId:s,size:"sm",linkedUserId:p?.linkedUserId}):e.jsx(ge,{icon:_?.getIcon(a)??"cube",size:"lg"}),T=Pt(p),z=Lt(T),q=T!==null,P=f&&!q,M=e.jsxs("div",{ref:P?j.anchorRef:void 0,onMouseEnter:P?j.onAnchorMouseEnter:void 0,onMouseLeave:P?j.onAnchorMouseLeave:void 0,className:q?nn["ref-row-archived"]:void 0,children:[e.jsx(pe,{leading:v,label:w,description:g,trailing:x,onClick:q?void 0:o,onRemove:l,...y}),P&&t&&j.data&&e.jsx(zt,{workspaceId:t,object:j.data,open:j.open,onClose:j.close,anchorRef:j.anchorRef,onMouseEnter:j.onPop
2overMouseEnter,onMouseLeave:j.onPopoverMouseLeave})]});return z?e.jsx($e,{content:z,children:M}):M}function rn(t,s){let a=null;const n=[],o=[];for(const r of t)r.isDefault&&r.userId===s?a=r:r.isShared?o.push(r):r.userId===s&&n.push(r);const l=(r,h)=>r.name.localeCompare(h.name);return n.sort(l),o.sort(l),{defaultDashboard:a,privateDashboards:n,sharedDashboards:o}}let cn=1;function ln(t){return t.map(s=>s.map(a=>({instanceId:`widget-${Date.now()}-${cn++}`,widgetType:a.widgetType,config:{...a.config}})))}function _t(t,s,a){if(a){const n=t.find(o=>o.id===a);if(n)return n}return t.find(n=>n.isDefault&&n.userId===s)??t[0]??null}const dn=1e3;function un(t,s,a){const[n,o]=i.useState([]),[l,r]=i.useState(null),[h,d]=i.useState(!0),[u,b]=i.useState(!1),[m,f]=i.useState(0),_=et(),p=i.useRef(_);p.current=_,i.useEffect(()=>{let k=!1;return d(!0),b(!1),Promise.all([Rs(t),ls().catch(()=>null)]).then(([{dashboards:S},c])=>{if(k)return;const D=c?.lastDashboard?.[t];o(S);const $=a?S.find(W=>W.id===a):void 0;r($?.id??_t(S,s,D)?.id??null)}).catch(()=>{k||b(!0)}).finally(()=>{k||d(!1)}),()=>{k=!0}},[t,s,m,a]);const N=i.useCallback(()=>f(k=>k+1),[]),w=l?n.find(k=>k.id===l)??null:null,C=!!w&&w.userId===s,x=!!w&&!C,g=i.useCallback(k=>{ds({lastDashboard:{[t]:k}}).catch(()=>{})},[t]),y=i.useCallback(k=>{r(k),g(k)},[g]),j=i.useRef(null),R=i.useRef(null),v=i.useCallback(k=>{R.current=null,Ge(t,k.id,{rows:k.rows}).catch(()=>{p.current.error("Failed to save dashboard layout")})},[t]);i.useEffect(()=>()=>{j.current&&clearTimeout(j.current),R.current&&v(R.current)},[v]);const T=i.useCallback(k=>{o(S=>{const c=l?S.find(W=>W.id===l):null;if(!c||c.userId!==s)return S;const D=k(c.rows),$={...c,rows:D,updatedAt:new Date().toISOString()};return R.current={id:c.id,rows:D},j.current&&clearTimeout(j.current),j.current=setTimeout(()=>v({id:c.id,rows:D}),dn),S.map(W=>W.id===c.id?$:W)})},[l,s,v]),z=i.useCallback(async k=>{try{const{dashboard:S}=await ut(t,{name:k.name,description:k.description,isShared:k.isShared});o(c=>[...c,S]),r(S.id),g(S.id),p.current.success("Dashboard created")}catch{throw p.current.error("Failed to create dashboard"),new Error("create failed")}},[t,g]),q=i.useCallback(async(k,S)=>{const c={};if(S.name!==k.name&&(c.name=S.name),S.description!==k.description&&(c.description=S.description),!k.isDefault&&S.isShared!==k.isShared&&(c.isShared=S.isShared),Object.keys(c).length!==0)try{const{dashboard:D}=await Ge(t,k.id,c);o($=>$.map(W=>W.id===D.id?D:W)),p.current.success("Dashboard updated")}catch{throw p.current.error("Failed to update dashboard"),new Error("update failed")}},[t]),P=i.useCallback(async k=>{try{const S=new Set(n.map(D=>D.name)),{dashboard:c}=await ut(t,{name:Ba(k.name,S),description:k.description,isShared:!1,rows:ln(k.rows)});o(D=>[...D,c]),r(c.id),g(c.id),p.current.success("Copied to your dashboards")}catch{p.current.error("Failed to copy dashboard")}},[t,n,g]),M=i.useCallback(async(k,S)=>{try{const{dashboard:c}=await Ge(t,k.id,{isShared:S});o(D=>D.map($=>$.id===c.id?c:$)),p.current.success(S?"Shared with workspace":"Made private")}catch{p.current.error(S?"Failed to share dashboard":"Failed to make dashboard private")}},[t]),U=i.useCallback(async k=>{try{await Ts(t,k.id),o(S=>{const c=S.filter(D=>D.id!==k.id);return r(D=>{if(D!==k.id)return D;const $=_t(c,s,void 0);return $&&g($.id),$?.id??null}),c}),p.current.success("Dashboard deleted")}catch{p.current.error("Failed to delete dashboard")}},[t,s,g]);return{dashboards:n,loading:h,loadError:u,reload:N,active:w,isOwner:C,isReadOnly:x,selectDashboard:y,createNew:z,saveEdits:q,duplicate:P,setShared:M,remove:U,updateActiveRows:T}}const nt=new Map;function oe(t){nt.set(t.type,t)}function Ut(t){return nt.get(t)}function hn(){return Array.from(nt.values())}const Ee=3;function fe(t,s){for(let a=0;a<t.length;a++){const n=t[a].findIndex(o=>o.instanceId===s);if(n!==-1)return[a,n]}return[-1,-1]}function Ce(t){return t.map(s=>[...s])}function Gt(t){return t.filter(s=>s.length>0)}function mn(t,s,a,n){if(a<0||a>=t.length)return t;const o=Ce(t),[l,r]=fe(o,s);if(l===-1||l===a)return t;const[h]=o[l].splice(r,1),u=o[a].length>=Ee?Ee-1:o[a].length,b=Math.max(0,Math.min(n,u));o[a].splice(b,0,h);let m=a;for(;o[m].length>Ee;){const f=o[m].pop();if(m+1<o.length)o[m+1].unshift(f),m++;else{o.push([f]);break}}return o}function vt(t,s,a){const[n,o]=fe(t,s),[l,r]=fe(t,a);if(n===-1||l===-1||n!==l||o===r)return t;const h=Ce(t),[d]=h[n].splice(o,1);return h[n].splice(r,0,d),h}function yt(t,s,a){const n=Ce(t),[o,l]=fe(n,s);if(o===-1)return t;const[r]=n[o].splice(l,1),h=Math.max(0,Math.min(a,n.length));return n.splice(h,0,[r]),Gt(n)}function pn(t,s){const a=Ce(t),n=a[0];return!n||n.length>=Ee?a.unshift([s]):n.unshift(s),a}function gn(t,s){if(t.length!==s.length)return!1;for(let a=0;a<t.length;a++){if(t[a].length!==s[a].length)return!1;for(let n=0;
2n<t[a].length;n++)if(t[a][n].instanceId!==s[a][n].instanceId)return!1}return!0}const Vt=i.createContext(null);function re(){const t=i.useContext(Vt);if(!t)throw new Error("useWidgetContext must be used within a <WidgetProvider>");return t}function fn({workspace:t,children:s}){const a=i.useMemo(()=>({workspace:t}),[t]);return e.jsx(Vt.Provider,{value:a,children:s})}const ot="__new-row-drop-zone__",Be="__row-drop-",rt="__row-gap-",Ae=t=>t.startsWith(Be),Qt=t=>t.startsWith(rt),Ht=t=>t===ot||Qt(t),Ye=(t,s)=>Number(t.slice(s.length));function _n(t){const{getRows:s,lastOverIdRef:a,recentlyMovedRef:n}=t,o=t.detectors??{pointerWithin:Es,closestCorners:Is,closestCenter:Ds};return l=>{if(n.current&&a.current!=null)return[{id:a.current}];if(!l.pointerCoordinates){const u=o.closestCorners(l);return u.length>0&&(a.current=u[0].id),u}const r=o.pointerWithin(l);if(r.length===0)return a.current!=null?[{id:a.current}]:[];const h=r.find(u=>Ht(String(u.id)));if(h)return a.current=h.id,[h];let d=As(r,"id");if(d!=null){const u=s(),b=String(d);let m=null;if(Ae(b))m=u[Ye(b,Be)]??[];else{const f=u.find(_=>_.some(p=>p.instanceId===String(l.active.id)));f?.some(_=>_.instanceId===b)&&(m=f)}if(m&&m.length>0){const f=new Set(m.map(p=>p.instanceId)),_=o.closestCenter({...l,droppableContainers:l.droppableContainers.filter(p=>f.has(String(p.id)))});_.length>0&&(d=_[0].id)}}return d==null?a.current!=null?[{id:a.current}]:[]:(a.current=d,[{id:d}])}}const vn="_shell_10d5v_3",yn="_header_10d5v_15",bn="_content_10d5v_79",xn="_dragging_10d5v_106",te={shell:vn,header:yn,"header-static":"_header-static_10d5v_32","header-icon":"_header-icon_10d5v_37","header-title":"_header-title_10d5v_44","menu-btn":"_menu-btn_10d5v_58",content:bn,"error-fallback":"_error-fallback_10d5v_88","error-fallback-text":"_error-fallback-text_10d5v_98",dragging:xn};class wn extends i.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(s,a){console.error(`[WidgetShell] ${this.props.widgetName} crashed:`,s,a)}handleRetry=()=>{this.props.onReset(),this.setState({hasError:!1})};render(){return this.state.hasError?e.jsxs("div",{className:te["error-fallback"],children:[e.jsx(O,{name:"warning",size:24}),e.jsx("p",{className:te["error-fallback-text"],children:"This widget encountered an error."}),e.jsx(ee,{size:"sm",variant:"secondary",onClick:this.handleRetry,children:"Retry"})]}):this.props.children}}function jn({instance:t,definition:s,onRemove:a,titleOverride:n,className:o,extraMenuActions:l,readOnly:r=!1,children:h}){const{reset:d}=us(),u=i.useMemo(()=>{const g=[];for(const y of l??[]){y.separatorBefore&&g.push({separator:!0});const j=y.active!==void 0;g.push({id:y.id,label:y.label,icon:j?void 0:y.icon,checked:j?y.active:void 0,variant:y.variant,disabled:y.disabled})}return(l??[]).length>0&&g.push({separator:!0}),g.push({id:"remove",label:"Remove",icon:e.jsx(O,{name:"trash",size:14}),variant:"danger"}),g},[l]),b=g=>{if(g==="remove"){a();return}(l??[]).find(j=>j.id===g)?.onSelect()},{attributes:m,listeners:f,setNodeRef:_,isDragging:p,transform:N,transition:w}=$s({id:t.instanceId,disabled:r,transition:{duration:320,easing:"cubic-bezier(0.22, 0.61, 0.36, 1)"}}),C=[te.shell,p?te.dragging:"",o??""].filter(Boolean).join(" "),x={transform:N?Ps.Transform.toString({...N,scaleX:1,scaleY:1}):void 0,transition:w};return e.jsxs("div",{ref:_,className:C,style:x,...m,"data-instance-id":t.instanceId,children:[e.jsxs("div",{className:`${te.header}${r?` ${te["header-static"]}`:""}`,...r?{}:f,children:[e.jsx("span",{className:te["header-icon"],children:e.jsx(O,{name:s.icon,size:20})}),e.jsx("h3",{className:te["header-title"],children:n||s.name}),!r&&e.jsx(zs,{items:u,onSelect:b,trigger:e.jsx(ee,{variant:"ghost",size:"xs",circular:!0,className:te["menu-btn"],"aria-label":"Widget options",icon:e.jsx(O,{name:"dots-three",size:16})}),align:"end",minWidth:140})]}),e.jsx("div",{className:te.content,children:e.jsx(wn,{widgetName:s.name,onReset:d,children:h})})]})}const H={"dashboard-rows":"_dashboard-rows_bva6k_3","dashboard-row":"_dashboard-row_bva6k_3","is-dragging":"_is-dragging_bva6k_31","widget-removing":"_widget-removing_bva6k_40","dashboard-row-empty":"_dashboard-row-empty_bva6k_53","row-gap-zone":"_row-gap-zone_bva6k_60","row-gap-zone-over":"_row-gap-zone-over_bva6k_70","drag-ghost":"_drag-ghost_bva6k_84","dashboard-drop-zone":"_dashboard-drop-zone_bva6k_98","dashboard-drop-zone-over":"_dashboard-drop-zone-over_bva6k_111","widget-fallback":"_widget-fallback_bva6k_120","widget-fallback-row":"_widget-fallback-row_bva6k_129"};function kn({isActive:t}){const{setNodeRef:s,isOver:a}=at({id:ot});return t?e.jsxs("div",{ref:s,className:`${H["dashboard-drop-zone"]}${a?` ${H["dashboard-drop-zone-over"]}`:""}`,children:[e.jsx(O,{name:"plus",size:16}),e.jsx("span",{children:"Drop here to create a new row"})]}):null}function Nn({rowIndex:t}){const{setNodeRef:s,isOver:a}=at({id:`${rt}${t}`});return e.jsx("div",{ref:s,className:`${H["row-gap-zone"]}${a?` ${H["row-gap-zone-over"]}`:""}`})}function Sn({rowIndex:t,isEmpty:s,children:a}){const{setNodeRef:n}
2=at({id:`${Be}${t}`});return e.jsx("div",{ref:n,className:`${H["dashboard-row"]}${s?` ${H["dashboard-row-empty"]}`:""}`,children:a})}function Cn(){return e.jsxs("div",{className:H["widget-fallback"],children:[e.jsx("div",{className:H["widget-fallback-row"]}),e.jsx("div",{className:H["widget-fallback-row"]}),e.jsx("div",{className:H["widget-fallback-row"]})]})}const Rn=i.memo(function({instance:s,definition:a,onRemove:n,onWidgetConfigChange:o,titleOverride:l,isRemoving:r,readOnly:h}){const d=i.useCallback(()=>n(s.instanceId),[n,s.instanceId]),u=i.useCallback(p=>o(s.instanceId,p),[o,s.instanceId]),b=a.component,m=a.skeleton,f=m?e.jsx(m,{config:s.config}):e.jsx(Cn,{}),_=a.menuEntries?.({config:s.config,onConfigChange:u});return e.jsx(jn,{instance:s,definition:a,onRemove:d,titleOverride:l,extraMenuActions:_,readOnly:h,className:r?H["widget-removing"]:void 0,children:e.jsx(i.Suspense,{fallback:f,children:e.jsx(b,{config:s.config,onConfigChange:u})})})});function Tn({activeId:t,width:s,offsetX:a}){const n=i.useRef(null);return i.useEffect(()=>{const o=n.current;if(!o)return;const l=document.querySelector(`[data-instance-id="${window.CSS?.escape?window.CSS.escape(t):t}"]`);if(!l)return;const r=l.cloneNode(!0);r.removeAttribute("data-instance-id"),r.classList.remove(te.dragging),r.style.transform="none",r.style.transition="none",r.style.opacity="1",r.style.width="100%",r.style.height="100%",o.replaceChildren(r)},[t]),e.jsx("div",{ref:n,className:H["drag-ghost"],style:{width:s!=null?`${s}px`:"100%",marginLeft:a?`${a}px`:void 0}})}function In({layout:t,onLayoutChange:s,onRemove:a,onWidgetConfigChange:n,removingIds:o,readOnly:l=!1}){const[r,h]=i.useState(null),[d,u]=i.useState(null),b=i.useRef(null),m=i.useRef(t.rows),f=i.useRef(null),_=i.useRef(!1),p=Ls(ht(Us,{activationConstraint:{distance:8}}),ht(Bs,{coordinateGetter:Ks}));i.useEffect(()=>{requestAnimationFrame(()=>{_.current=!1})},[d]);const N=i.useMemo(()=>_n({getRows:()=>m.current,lastOverIdRef:f,recentlyMovedRef:_}),[]),w=i.useRef(null),[C,x]=i.useState(null),g=i.useRef(0),y=i.useRef(null),j=i.useCallback(M=>{const U=String(M.active.id);h(U),f.current=null,_.current=!1,w.current=null;const k=M.active.rect.current.initial,S=M.activatorEvent;k&&k.width>0&&typeof S?.clientX=="number"?(g.current=Math.min(1,Math.max(0,(S.clientX-k.left)/k.width)),y.current=k.width):(g.current=0,y.current=null),x(null);const c=Ce(t.rows);b.current=c,u(c)},[t.rows]),R=i.useCallback(M=>{const{active:U,over:k}=M,S=b.current;if(!k||!S)return;const c=String(k.id);if(Ht(c))return;const D=String(U.id);let $,W;if(Ae(c))$=Ye(c,Be),W=S[$]?.length??0;else{if([$,W]=fe(S,c),$===-1)return;const ve=U.rect.current.translated;if(ve&&k.rect){const Te=ve.left+ve.width/2,Ue=k.rect.left+k.rect.width/2;Te>Ue&&(W+=1)}}const[Z]=fe(S,D);if(Z===-1)return;if(Z===$){w.current=c===D||Ae(c)?null:c;return}const _e=mn(S,D,$,W);_e!==S&&(w.current=null,_.current=!0,b.current=_e,u(_e))},[]),v=i.useCallback(M=>{const{active:U,over:k}=M,S=b.current,c=Z=>{b.current=null,f.current=null,_.current=!1,w.current=null,u(Z),h(null)};if(!S){c(null);return}const D=String(U.id);let $=S;if(k){const Z=String(k.id);Z===ot?$=yt(S,D,S.length):Qt(Z)?$=yt(S,D,Ye(Z,rt)):!Ae(Z)&&Z!==D&&($=vt(S,D,Z))}$===S&&w.current&&($=vt(S,D,w.current));const W=Gt($);gn(W,t.rows)?c(null):(c(W),s(W))},[s,t.rows]),T=i.useCallback(()=>{b.current=null,f.current=null,_.current=!1,w.current=null,u(null),h(null)},[]),z=i.useDeferredValue(t.rows),q=d??z;m.current=q,i.useEffect(()=>{!r&&d&&z===t.rows&&u(null)},[r,d,z,t.rows]),i.useEffect(()=>{if(!r){x(null);return}const M=document.querySelector(`[data-instance-id="${window.CSS?.escape?window.CSS.escape(r):r}"]`);M&&x(M.getBoundingClientRect().width)},[r,d]);const P=r?q.flat().find(M=>M.instanceId===r)??null:null;return e.jsxs(Ms,{sensors:p,collisionDetection:N,measuring:{droppable:{strategy:Os.Always}},onDragStart:j,onDragOver:R,onDragEnd:v,onDragCancel:T,children:[e.jsxs("div",{className:`${H["dashboard-rows"]}${r?` ${H["is-dragging"]}`:""}`,children:[q.map((M,U)=>{const k=M.map(c=>({instance:c,def:Ut(c.widgetType)})).filter(c=>c.def!=null);if(k.length===0&&!r)return null;const S=k.map(c=>c.instance.instanceId);return e.jsxs(Sn,{rowIndex:U,isEmpty:k.length===0,children:[r&&e.jsx(Nn,{rowIndex:U}),e.jsx(qs,{items:S,strategy:Fs,children:k.map(({instance:c,def:D})=>{const $=c.widgetType==="report_chart"&&c.config.reportName?c.config.reportName:void 0;return e.jsx(Rn,{instance:c,definition:D,onRemove:a,onWidgetConfigChange:n,titleOverride:$,isRemoving:o?.has(c.instanceId)??!1,readOnly:l},c.instanceId)})})]},U)}),e.jsx(kn,{isActive:!!r})]}),e.jsx(Ws,{children:P?e.jsx(Tn,{activeId:P.instanceId,width:C,offsetX:C!=null&&y.current!=null?(y.current-C)*g.current:0}):null})]})}const Dn="_greeting_1q1nv_3",En="_meta_1q1nv_12",An="_headline_1q1nv_23",Ve={greeting:Dn,meta:En,headline:An},$n=3e4;function Pn(){const t=tt(),s=de(),a=je(),[n,o]=i.useState(()=>new Date);i.useEffect(()=>{const d=setInterval(()=>
2o(new Date),$n);return()=>clearInterval(d)},[]);const l=n.toISOString(),{hour:r}=hs(n,s),h=t.name?.trim();return e.jsxs("div",{className:Ve.greeting,children:[e.jsxs("time",{className:Ve.meta,dateTime:l,children:[ms(l,s)," · ",It(l,s,a)]}),e.jsxs("h1",{className:Ve.headline,children:[Xa(r),h?`, ${h}`:""]})]})}const bt={"row-icon-default":"_row-icon-default_10g51_4","row-icon-private":"_row-icon-private_10g51_9"};function zn(t,s){if(!s)return[{id:"duplicate",label:"Make a copy",icon:e.jsx(O,{name:"copy",size:14})}];const a=[{id:"edit",label:"Rename & edit",icon:e.jsx(O,{name:"pencil-simple",size:14})},{id:"duplicate",label:"Duplicate",icon:e.jsx(O,{name:"copy",size:14})}];return t.isDefault||a.push(t.isShared?{id:"unshare",label:"Make private",icon:e.jsx(O,{name:"lock",size:14})}:{id:"share",label:"Share with workspace",icon:e.jsx(O,{name:"users-three",size:14})},{separator:!0},{id:"delete",label:"Delete",icon:e.jsx(O,{name:"trash",size:14}),variant:"danger"}),a}function Ln({workspaceId:t,currentUserId:s,dashboards:a,activeId:n,onSelect:o,onCreate:l,onEdit:r,onDuplicate:h,onToggleShare:d,onDelete:u,triggerVariant:b="default"}){const{defaultDashboard:m,privateDashboards:f,sharedDashboards:_}=i.useMemo(()=>rn(a,s),[a,s]),p=n?a.find(y=>y.id===n):null,N=i.useMemo(()=>_.map(y=>y.userId),[_]),{resolve:w}=Aa(t,N),C=i.useMemo(()=>[{id:"default",label:"Default",icon:"house",items:m?[m]:[]},{id:"private",label:"Private",icon:"lock-simple",items:f,emptyText:"No private dashboards"},{id:"shared",label:"Shared with workspace",icon:"users-three",items:_}],[m,f,_]),x=i.useCallback(y=>{const j=y.userId===s;if(y.isDefault&&j)return e.jsx(O,{name:"house",size:15,weight:"fill",className:bt["row-icon-default"]});if(y.isShared){const{name:R,avatarFileId:v}=w(y.userId);return e.jsx(Ua,{workspaceId:t,ownerName:R,avatarFileId:v,isOwner:j,entityNoun:"dashboard"})}return e.jsx(O,{name:"lock-simple",size:14,className:bt["row-icon-private"]})},[s,w,t]),g=i.useCallback((y,j,R)=>{switch(y){case"edit":R(),r(j);break;case"duplicate":R(),h(j);break;case"share":d(j,!0);break;case"unshare":d(j,!1);break;case"delete":R(),u(j);break}},[r,h,d,u]);return e.jsx(Ta,{triggerLabel:p?.name||"Dashboard",triggerLeading:p?x(p):void 0,triggerVariant:b,sections:C,activeId:n,onSelect:y=>o(y.id),renderLeading:x,getItemActions:y=>zn(y,y.userId===s),onItemAction:g,itemActionsTooltip:"Dashboard options",itemActionsMinWidth:190,createLabel:"Create new dashboard",onCreate:l})}const F={"widget-catalog-content":"_widget-catalog-content_1tpm4_6","widget-catalog-category-label":"_widget-catalog-category-label_1tpm4_16","widget-catalog-grid":"_widget-catalog-grid_1tpm4_27","widget-catalog-card":"_widget-catalog-card_1tpm4_33","widget-catalog-card-loading":"_widget-catalog-card-loading_1tpm4_53","widget-catalog-card-icon":"_widget-catalog-card-icon_1tpm4_57","widget-catalog-card-chart":"_widget-catalog-card-chart_1tpm4_72","widget-catalog-card-info":"_widget-catalog-card-info_1tpm4_81","widget-catalog-card-name":"_widget-catalog-card-name_1tpm4_86","widget-catalog-card-desc":"_widget-catalog-card-desc_1tpm4_93","widget-catalog-empty":"_widget-catalog-empty_1tpm4_103","widget-catalog-empty-full":"_widget-catalog-empty-full_1tpm4_113"},Mn={overview:"Overview",charts:"Charts",lists:"Lists"},On=["overview","lists","charts"];function qn(t){const s=t?.chart;return s==null||s===""?null:typeof s=="string"?s:JSON.stringify(s)}function Fn({workspaceId:t,currentWidgets:s,onAdd:a,onClose:n}){const[o,l]=i.useState(""),r=i.useRef(null),{reports:h,loading:d,error:u,retry:b}=qt(t);i.useEffect(()=>{r.current?.focus()},[]);const m=i.useMemo(()=>new Set(s.map(v=>v.widgetType)),[s]),f=i.useMemo(()=>new Set(s.filter(v=>v.widgetType==="report_chart"&&v.config?.reportId).map(v=>v.config.reportId)),[s]),p=hn().filter(v=>v.type==="report_chart"?!1:v.allowMultiple||!m.has(v.type)),N=o?p.filter(v=>v.name.toLowerCase().includes(o.toLowerCase())||v.description.toLowerCase().includes(o.toLowerCase())):p,w=h.filter(v=>!f.has(v.id)),C=o?w.filter(v=>(v.data?.name||"").toLowerCase().includes(o.toLowerCase())):w,x=On.map(v=>({category:v,label:Mn[v],widgets:N.filter(T=>T.category===v)})),g=w.length>0||d||u,y=x.findIndex(v=>v.category==="charts"),j=x.filter((v,T)=>T===y&&g?!0:v.widgets.length>0).map(v=>{const T=v.widgets.map(z=>({key:`widget:${z.type}`,kind:"widget",def:z}));
2if(v.category==="charts"&&!d&&!u)for(const z of C)T.push({key:`report:${z.id}`,kind:"report",report:z});return{...v,cards:T}}),R=v=>a("report_chart",{reportId:v.id,reportName:v.data?.name||"Report"});return e.jsx(ps,{open:!0,onClose:n,title:"Add Widget",size:"md",scrollShadows:!0,subheader:e.jsx(gs,{ref:r,placeholder:"Search widgets...",value:o,onChange:l}),children:e.jsx("div",{className:F["widget-catalog-content"],children:e.jsx(lt,{items:j,getKey:v=>v.category,empty:e.jsx("div",{className:F["widget-catalog-empty"],children:p.length===0&&w.length===0?"All widgets are already on your dashboard.":"No widgets match your search."}),children:v=>e.jsxs("div",{className:F["widget-catalog-category"],children:[e.jsx("p",{className:F["widget-catalog-category-label"],children:v.label}),e.jsxs("div",{className:F["widget-catalog-grid"],children:[e.jsx(lt,{items:v.cards,getKey:T=>T.key,variant:"card",empty:v.category==="charts"&&!d&&!u?e.jsx("div",{className:`${F["widget-catalog-empty"]} ${F["widget-catalog-empty-full"]}`,children:w.length===0&&h.length>0?"All reports are already on your dashboard.":"No other reports found. Create a report first."}):void 0,children:T=>T.kind==="widget"?e.jsx(Wn,{def:T.def,onAdd:()=>a(T.def.type)}):e.jsx(Kn,{report:T.report,workspaceId:t,onAdd:()=>R(T.report)})}),v.category==="charts"&&u&&e.jsx("div",{className:F["widget-catalog-empty-full"],children:e.jsx(ke,{variant:"block",message:"Couldn't load reports",onRetry:()=>{b()}})}),v.category==="charts"&&d&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`${F["widget-catalog-card"]} ${F["widget-catalog-card-loading"]}`,children:[e.jsx(E,{width:36,height:36}),e.jsxs("div",{className:F["widget-catalog-card-info"],children:[e.jsx(E,{variant:"text",width:"60%"}),e.jsx(E,{variant:"text-sm",width:"80%"})]})]}),e.jsxs("div",{className:`${F["widget-catalog-card"]} ${F["widget-catalog-card-loading"]}`,children:[e.jsx(E,{width:36,height:36}),e.jsxs("div",{className:F["widget-catalog-card-info"],children:[e.jsx(E,{variant:"text",width:"50%"}),e.jsx(E,{variant:"text-sm",width:"70%"})]})]})]})]})]})})})})}function Wn({def:t,onAdd:s}){return e.jsxs("div",{className:F["widget-catalog-card"],onClick:s,role:"button",tabIndex:0,onKeyDown:a=>{a.key==="Enter"&&s()},children:[e.jsx("div",{className:F["widget-catalog-card-icon"],children:e.jsx(O,{name:t.icon,size:18})}),e.jsxs("div",{className:F["widget-catalog-card-info"],children:[e.jsx("p",{className:F["widget-catalog-card-name"],children:t.name}),e.jsx("p",{className:F["widget-catalog-card-desc"],children:t.description})]})]})}function Kn({report:t,workspaceId:s,onAdd:a}){const n=qn(t.data);return e.jsxs("div",{className:F["widget-catalog-card"],onClick:a,role:"button",tabIndex:0,onKeyDown:o=>{o.key==="Enter"&&a()},children:[n?e.jsx("div",{className:F["widget-catalog-card-chart"],children:e.jsx(Gs,{json:n,workspaceId:s,sizePx:36})}):e.jsx("div",{className:F["widget-catalog-card-icon"],children:e.jsx(O,{name:"presentation-chart",size:18})}),e.jsxs("div",{className:F["widget-catalog-card-info"],children:[e.jsx("p",{className:F["widget-catalog-card-name"],children:t.data?.name||"Untitled Report"}),e.jsx("p",{className:F["widget-catalog-card-desc"],children:t.data?.description||"Report chart"})]})]})}const xt=6;function Bn(t){return(t??[]).reduce((s,a)=>s+a,0)}function Un(t,s){return s<=0?xt:Math.max(xt,t/s*100)}function Gn(t,s,{now:a=new Date,timeZone:n,locale:o=vs()}={}){const l=-(s-1-t),r=fs(l,n,a);return r?new Intl.DateTimeFormat(o,{day:"numeric",month:"short",timeZone:"UTC"}).format(_s(r)):""}function Vn(t,s,a={}){return`${Gn(t,s.length,a)} · ${s[t]??0}`}const Qn="_pane_ozw5s_7",Hn="_top_ozw5s_32",Zn="_hero_ozw5s_44",Yn="_tiles_ozw5s_130",Xn="_tile_ozw5s_130",Jn="_strip_ozw5s_190",eo="_bars_ozw5s_224",to="_bar_ozw5s_224",A={pane:Qn,top:Hn,hero:Zn,"hero-tile":"_hero-tile_ozw5s_90","hero-spacer":"_hero-spacer_ozw5s_96","hero-count":"_hero-count_ozw5s_100","hero-label":"_hero-label_ozw5s_111","hero-hint":"_hero-hint_ozw5s_118",tiles:Yn,tile:Xn,"tile-text":"_tile-text_ozw5s_162","tile-count":"_tile-count_ozw5s_169","tile-label":"_tile-label_ozw5s_178",strip:Jn,"strip-total":"_strip-total_ozw5s_199","strip-count":"_strip-count_ozw5s_207","strip-label":"_strip-label_ozw5s_217",bars:eo,"bar-col":"_bar-col_ozw5s_235",bar:to,"bars-grown":"_bars-grown_ozw5s_244","bar-today":"_bar-today_ozw5s_262","bar-skeleton":"_bar-skeleton_ozw5s_279","day-label":"_day-label_ozw5s_288","day-label-active":"_day-label-active_ozw5s_300","hero-skeleton":"_hero-skeleton_ozw5s_308","tile-skeleton":"_tile-skeleton_ozw5s_309"},so=t=>["dashboard","workspace-summary",t],ao=30,Qe=new Set;function no(){return e.jsxs("div",{className:A.pane,children:[e.jsxs("div",{className:A.top,children:[e.jsx("div",{className:se(A.hero,A["hero-skeleton"]),children:e.jsxs("span",{children:[e.jsx(E,{width:34,he
2ight:34,shape:"rounded"}),e.jsx("span",{className:A["hero-spacer"]}),e.jsx(E,{variant:"heading",width:72,height:40}),e.jsx(E,{variant:"text",width:90}),e.jsx(E,{variant:"text-sm",width:80})]})}),e.jsx("div",{className:A.tiles,children:Array.from({length:4},(t,s)=>e.jsxs("div",{className:se(A.tile,A["tile-skeleton"]),children:[e.jsx(E,{width:32,height:32,shape:"rounded"}),e.jsxs("span",{className:A["tile-text"],children:[e.jsx(E,{variant:"text",width:36}),e.jsx(E,{variant:"text-sm",width:56})]})]},s))})]}),e.jsxs("div",{className:A.strip,children:[e.jsxs("div",{className:A["strip-total"],children:[e.jsx(E,{variant:"text",width:48}),e.jsx(E,{variant:"text-sm",width:80})]}),e.jsx("div",{className:A.bars,children:Array.from({length:ao},(t,s)=>e.jsx("span",{className:A["bar-col"],children:e.jsx("span",{className:se(A.bar,A["bar-skeleton"])})},s))}),e.jsx("span",{className:A["day-label"]})]})]})}async function oo(t){const s=async h=>{try{return(await h).total}catch{return 0}},[a,n,o,l,r]=await Promise.all([s(ce(t,"person","",0,1)),s(ce(t,"company","",0,1)),s(ce(t,"deal","",0,1,void 0,{selectFilters:[{field:"stage",operator:"not_contains_any",values:["closed_won","closed_lost"]}]})),s(ce(t,"person","",0,1,void 0,{stringFilters:[{field:"linkedUserId",operator:"is_set",value:""}]})),s(ce(t,"task","",0,1,void 0,{selectFilters:[{field:"status",operator:"not_contains_any",values:["done"]}]}))]);return{people:a,companies:n,liveDeals:o,users:l,openTasks:r}}function ro({days:t,growKey:s}){const a=de(),n=Bn(t),o=Math.max(0,...t),l=me(n,void 0,!1,`${s}:activity-30d`),[r,h]=i.useState(null),[d,u]=i.useState(()=>Qe.has(s));return i.useEffect(()=>{if(Qe.has(s)){u(!0);return}const b=requestAnimationFrame(()=>{Qe.add(s),u(!0)});return()=>cancelAnimationFrame(b)},[s]),e.jsxs("div",{className:A.strip,children:[e.jsxs("div",{className:A["strip-total"],children:[e.jsx("span",{className:A["strip-count"],children:l}),e.jsx("span",{className:A["strip-label"],children:"Activity (30d)"})]}),e.jsx("div",{className:se(A.bars,d&&A["bars-grown"]),role:"img","aria-label":`Activity over the last ${t.length} days: ${n} events`,onMouseLeave:()=>h(null),children:t.map((b,m)=>e.jsx("span",{className:A["bar-col"],"data-testid":"activity-bar",onMouseEnter:()=>h(m),children:e.jsx("span",{className:se(A.bar,m===t.length-1&&A["bar-today"]),style:{"--bar-h":`${Un(b,o)}%`,"--bar-i":m}})},m))}),e.jsx("span",{className:se(A["day-label"],r!==null&&A["day-label-active"]),"data-testid":"activity-day-label",children:r===null?"Last 30 days":Vn(r,t,{timeZone:a})})]})}function io(t){const{workspace:s}=re(),a=Fe(),n=qe(),{id:o}=st(),{data:l}=ne({queryKey:so(s.id),queryFn:()=>oo(s.id)}),r=x=>a?.getSlugForType(x)??x,h=(x,g)=>a?.getPluralLabel(x)??g,d=(x,g)=>a?.getIcon(x)??g,u=x=>n(`/workspaces/${o}/${r(x)}`),b=x=>`ws-summary:${s.id}:${x}`,m=me(l.liveDeals,void 0,!1,b("live-deals")),f=me(l.users,void 0,!1,b("users")),_=me(l.openTasks,void 0,!1,b("open-tasks")),p=me(l.people,void 0,!1,b("people")),N=me(l.companies,void 0,!1,b("companies")),w=`Live ${h("deal","Deals")}`,C=[{id:"users",icon:"user-circle",count:f,raw:l.users,label:"Users",typeId:"person"},{id:"open-tasks",icon:d("task","check-square"),count:_,raw:l.openTasks,label:`Open ${h("task","Tasks")}`,typeId:"task"},{id:"people",icon:d("person","user"),count:p,raw:l.people,label:h("person","People"),typeId:"person"},{id:"companies",icon:d("company","buildings"),count:N,raw:l.companies,label:h("company","Companies"),typeId:"company"}];return e.jsxs("div",{className:A.pane,children:[e.jsxs("div",{className:A.top,children:[e.jsxs(ee,{variant:"ghost",size:"lg",className:A.hero,onClick:()=>u("deal"),"aria-label":`${w}: ${l.liveDeals}. View pipeline`,children:[e.jsx(ge,{icon:d("deal","handshake"),size:"lg",className:A["hero-tile"]}),e.jsx("span",{className:A["hero-spacer"]}),e.jsx("span",{className:A["hero-count"],children:m}),e.jsx("span",{className:A["hero-label"],children:w}),e.jsxs("span",{className:A["hero-hint"],children:["View pipeline",e.jsx(O,{name:"arrow-right",size:Ne.xxs,weight:"bold"})]})]}),e.jsx("div",{className:A.tiles,children:C.map(x=>e.jsxs(ee,{variant:"ghost",size:"lg",className:A.tile,onClick:()=>u(x.typeId),"aria-label":`${x.label}: ${x.raw}`,children:[e.jsx(ge,{icon:x.icon,size:"lg"}),e.jsxs("span",{className:A["tile-text"],children:[e.jsx("span",{className:A["tile-count"],children:x.count}),e.jsx("span",{className:A["tile-label"],children:x.label})]})]},x.id))})]}),e.jsx(ro,{days:s.activity30d??[],growKey:b("bars")})]})}oe({type:"project_summary",name:"Workspace Summary",description:"Live deals, users, open tasks, people, company, and activity counts",icon:"chart-bar",category:"overview",defaultConfig:{},component:io,skeleton:no});const co="_pane_1lpe9_3",lo="_list_1lpe9_17",uo="_rows_1lpe9_15",ho="_meta_1lpe9_32",mo="_row_1lpe9_15",B={pane:co,list:lo,rows:uo,meta:ho,"open-action":"_open-action_1lpe9_42",row:mo,"skeleton-tabs":"_skeleton-tabs_1lpe9_55","skeleton-rows":"_skeleton-rows_1lpe9_62","skeleton-row":"_skeleton-row_1lpe9_62","skeleton-lines":"_skeleton-lines_1lpe9_75"},wt=t=>["dashboard","shortcuts","chats",t],jt=t=>["dashboard","shortcuts","views",t];function po(){return e.jsxs("div",{className:B.pane,children:[e.jsxs("div",{className:B["skeleton-tabs"],children:[e.jsx(E,{variant:"badge",width:90}),e.jsx(E,{variant:"badge",width:80}),e.jsx(E,{variant:"badge",width:70}),e.jsx(E,{variant:"badge",width:70}),e.jsx(E,{variant:"badge",width:60})]}),e.jsx("div",{className:B["skeleton-rows"],children:Array.from({length:6},(t,s)=>e.jsxs("div",{className:B["skeleton-row"],children:[e.jsx(E,{width:28,height:28,shape:"rounded"}),e.jsx("div",{className:B["skeleton-lines"],children:e.jsx(E,{variant:"text",width:`${45+s%4*12}%`})}),e.jsx(E,{variant:"text-sm",width:24})]},s))})]})}function go(t){const{workspace:s}=re(),a=ys(),n=de(),o=Fe(),l=c=>o?.getSlugForType(c)??c,r=qe(),{id:h}=st(),[,d]=Dt(),u=et(),{openPreview:b}=ue(),m=$a(),{data:f}=ne({queryKey:Pa.list(s.id),queryFn:()=>qa(s.id).then(c=>c.favourites)}),{data:_}=ne({queryKey:za.list(s.id),queryFn:()=>Fa(s.id).then(c=>c.watchedRecords)}),{data:p}=ne({queryKey:wt(s.id),queryFn:()=>tn(s.id)}),{data:N}=ne({queryKey:jt(s.id),queryFn:()=>Qs(s.id).then(c=>c.views)}),[w,C]=i.useState("favourites"),[x,g]=i.useState(!1);i.useEffect(()=>{x||(g(!0),f.length>0?C("favourites"):_.length>0?C("watching"):p.length>0?C("chats"):N.length>0?C("views"):(o?.listTypes?.length??0)>0&&C("lists"))},[x,f.length,_.length,p.length,N.length]);const y=i.useCallback(async c=>{m.removeFavourite(s.id,c);try{await La(s.id,c)}catch{u.error("Failed to remove favourite")}},[s.id,u,m]),j=i.useCallback(async c=>{m.removeWatched(s.id,c);try{await Ma(s.id,c)}catch{u.error("Failed to unwatch")}},[s.id,u,m]),R=i.useCallback(c=>{d(D=>{const $=new URLSearchParams(D);return $.set("chatSession",c.id),$},{replace:!0})},[d]),v=i.useCallback(async c=>{a.setQueryData(wt(s.id),D=>D&&D.filter($=>$.id!==c));try{await en(c)}catch{u.error("Failed to delete chat")}},[u,a,s.id]),T=i.useCallback(c=>{const D=l(c.objectTypeId);
2r(`/workspaces/${h}/${D}?view=${c.id}`)},[l,r,h]),z=i.useCallback(async c=>{a.setQueryData(jt(s.id),D=>D&&D.filter($=>$.id!==c));try{await Vs(s.id,c)}catch{u.error("Failed to delete view")}},[s.id,u,a]),{get:q}=bs(),P=i.useMemo(()=>Oa(q("listOrder")?.[s.id],(o?.listTypes??[]).map(c=>({...c,id:c.objectTypeId}))),[o,q,s.id]),M=i.useCallback(c=>{r(`/workspaces/${h}/lists/${c}`)},[r,h]),U=i.useCallback(c=>c?.updatedDate?e.jsx(Ze,{date:c.updatedDate,timezone:n,compact:!0,className:B.meta}):null,[n]),k=i.useMemo(()=>[{id:"favourites",label:"Favourites",count:f.length},{id:"watching",label:"Watching",count:_.length},{id:"chats",label:"Chats",count:p.length},{id:"views",label:"Views",count:N.length},{id:"lists",label:"Lists",count:P.length}],[f.length,_.length,p.length,N.length,P.length]);return f.length===0&&_.length===0&&p.length===0&&N.length===0&&P.length===0?e.jsx(G,{iconName:"rocket-launch",title:"No shortcuts yet"}):e.jsxs("div",{className:B.pane,children:[e.jsx(Se,{tabs:k,activeTab:w,onTabChange:c=>C(c),size:"sm",variant:"quiet"}),w==="favourites"&&e.jsx(Q,{className:B.list,children:f.length===0?e.jsx(G,{iconName:"heart",title:"No favourites"}):e.jsx("div",{className:B.rows,children:f.map(c=>e.jsx(ft,{workspaceId:s.id,objectId:c.objectId,objectTypeId:c.objectTypeId,storedLabel:c.label,variant:"quiet",trailing:U,removeIcon:X.favourites.icon,removeIconWeight:X.favourites.weight,removeLabel:X.favourites.label,onClick:()=>b(c.objectId),onRemove:()=>y(c.objectId),showPopover:!0},c.id))})}),w==="watching"&&e.jsx(Q,{className:B.list,children:_.length===0?e.jsx(G,{iconName:"eye",title:"Not watching anything"}):e.jsx("div",{className:B.rows,children:_.map(c=>e.jsx(ft,{workspaceId:s.id,objectId:c.objectId,objectTypeId:c.objectTypeId,storedLabel:c.label,variant:"quiet",trailing:U,removeIcon:X.watching.icon,removeIconWeight:X.watching.weight,removeLabel:X.watching.label,onClick:()=>b(c.objectId),onRemove:()=>j(c.objectId),showPopover:!0},c.id))})}),w==="chats"&&e.jsx(Q,{className:B.list,children:p.length===0?e.jsx(G,{iconName:"chat-circle",title:"No chat sessions"}):e.jsx("div",{className:B.rows,children:p.map(c=>e.jsx(pe,{variant:"quiet",label:c.title||"Untitled chat",leading:e.jsx(ge,{icon:"chat-circle",size:"lg"}),trailing:c.updatedAt?e.jsx(Ze,{date:c.updatedAt,timezone:n,compact:!0,className:B.meta}):void 0,removeIcon:X.chats.icon,removeLabel:X.chats.label,onClick:()=>R(c),onRemove:()=>v(c.id)},c.id))})}),w==="views"&&e.jsx(Q,{className:B.list,children:N.length===0?e.jsx(G,{iconName:"bookmark-simple",title:"No saved views"}):e.jsx("div",{className:B.rows,children:N.map(c=>e.jsx(pe,{variant:"quiet",label:c.name,leading:e.jsx(ge,{icon:o?.getIcon(c.objectTypeId)??"cube",size:"lg"}),removeIcon:X.views.icon,removeLabel:X.views.label,onClick:()=>T(c),onRemove:()=>z(c.id)},c.id))})}),w==="lists"&&e.jsx(Q,{className:B.list,children:P.length===0?e.jsx(G,{iconName:"list-bullets",title:"No lists yet"}):e.jsx("div",{className:B.rows,children:P.map(c=>e.jsx(pe,{variant:"quiet",className:B.row,label:c.label,leading:e.jsx(ge,{icon:c.icon||"list-bullets",size:"lg"}),trailing:e.jsx(ee,{variant:"ghost",size:"sm",className:B["open-action"],"aria-label":X.lists.label,icon:e.jsx(O,{name:X.lists.icon,size:Ne.sm}),onClick:D=>{D.stopPropagation(),M(c.objectTypeId)}}),onClick:()=>M(c.objectTypeId)},c.objectTypeId))})})]})}oe({type:"shortcuts",name:"Shortcuts",description:"Quick access to favourites, watched records, chats, saved views, and lists",icon:"rocket-launch",category:"lists",defaultConfig:{},component:go,skeleton:po});const fo="_feed_ulrgn_3",_o={feed:fo},Ie=50,vo=["critical","high","medium","low"];function yo(t,s,a){return t*s<a}const bo=t=>["dashboard","suggestions",t],xo=(t,s)=>["dashboard","suggestion-targets",t,s];function wo(){return e.jsx(Hs,{})}function jo(t){const{workspace:s}=re(),{data:a}=ne({queryKey:bo(s.id),queryFn:()=>mt(s.id,{status:"active",limit:Ie,offset:0})}),[n,o]=i.useState([]),[l,r]=i.useState(null),[h,d]=i.useState(1),[u,b]=i.useState(!1),[m,f]=i.useState(new Set),_=i.useMemo(()=>{const j=new Set,R=[];for(const v of[...a.suggestions,...n])j.has(v.id)||m.has(v.id)||(j.add(v.id),R.push(v));return R},[a.suggestions,n,m]),p=l??a.total,N=yo(h,Ie,p),w=i.useMemo(()=>Array.from(new Set(_.map(j=>
2j.targetRecordId).filter(Boolean))),[_]),{data:C={}}=Pe({queryKey:xo(s.id,w),queryFn:()=>xs(s.id,w),enabled:w.length>0,staleTime:6e4}),x=i.useCallback(async()=>{if(!(u||!N)){b(!0);try{const j=await mt(s.id,{status:"active",limit:Ie,offset:h*Ie});o(R=>[...R,...j.suggestions]),r(j.total),d(R=>R+1)}catch{}finally{b(!1)}}},[u,N,s.id,h]),g=i.useCallback(j=>{f(R=>{if(R.has(j))return R;const v=new Set(R);return v.add(j),v}),r(R=>Math.max(0,(R??a.total)-1))},[a.total]);if(_.length===0)return e.jsx(G,{iconName:"check-circle",title:"All caught up"});const y=_.reduce((j,R)=>((j[R.priority]||=[]).push(R),j),{});return e.jsx(Q,{children:e.jsx(Ft,{className:_o.feed,hasMore:N,loading:u,onLoadMore:x,compact:!0,children:vo.map(j=>{const R=y[j];return!R||R.length===0?null:R.map(v=>e.jsx(Ga,{workspaceId:s.id,suggestion:v,onResolved:g,targetRecord:C[v.targetRecordId]},v.id))})})})}oe({type:"suggestions_feed",name:"Plays",description:"Actionable recommendations based on sales signals and activity",icon:"play",category:"lists",defaultConfig:{},component:jo,skeleton:wo});const ko="_centered_82m3b_35",No="_description_82m3b_51",So="_picker_82m3b_69",ie={"chart-wrapper":"_chart-wrapper_82m3b_3","chart-area":"_chart-area_82m3b_11",centered:ko,description:No,picker:So,"picker-heading":"_picker-heading_82m3b_76"},Co=ws(()=>js(()=>import("./ObjectIcon-DirRsqjg.js").then(t=>t.i$),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18])));function Zt(){return e.jsx("div",{className:ie.centered,children:e.jsx(E,{variant:"chart"})})}function Ro(){return e.jsxs("div",{className:ie.picker,children:[e.jsx(E,{variant:"text-sm",width:"40%"}),Array.from({length:4},(t,s)=>e.jsx(E,{variant:"text",width:`${65-s*5}%`},s))]})}function To({workspaceId:t,onSelect:s}){const{reports:a,loading:n,error:o,retry:l}=qt(t);return n?e.jsx(Ro,{}):o?e.jsx("div",{className:ie.picker,children:e.jsx(ke,{variant:"block",message:"Couldn't load reports",onRetry:()=>{l()}})}):a.length===0?e.jsx(G,{iconName:"presentation-chart",title:"No reports found",hint:"Create a report first."}):e.jsxs("div",{className:ie.picker,children:[e.jsx("p",{className:ie["picker-heading"],children:"Select a report:"}),a.map(r=>e.jsx(pe,{label:r.data?.name||r.id,icon:"presentation-chart",onClick:()=>s(r)},r.id))]})}function Io({reportId:t,reportName:s,workspaceId:a,onMissing:n}){const o=qe(),{id:l}=st(),{openPreview:r}=ue(),{getObjectType:h,getSlugForType:d}=Ke(),[u,b]=i.useState(!1),{data:m}=ne({queryKey:Ja(a,t),queryFn:async()=>{try{const p=await Et(a,t);return{configJson:p.data?.chart??p.data?.filter??"",name:typeof p.data?.name=="string"?p.data.name:""}}catch(p){if(p instanceof ks&&p.status===404)return null;throw p}}});if(i.useEffect(()=>{m===null&&n()},[m,n]),m===null)return null;const f=m.configJson,_=m.name||s;
2return f?e.jsx(Do,{configJson:f,reportId:t,reportName:_,workspaceId:a,routeWorkspaceId:l,modalOpen:u,setModalOpen:b,onPreview:()=>r(t),onNavigateToReport:()=>o(`/workspaces/${l}/objects/${t}`),onNavigate:o,getObjectType:h,getSlugForType:d}):e.jsx(G,{iconName:"presentation-chart",title:"No chart configured",hint:"This report has no chart configured yet."})}function Do({configJson:t,reportId:s,reportName:a,workspaceId:n,routeWorkspaceId:o,modalOpen:l,setModalOpen:r,onPreview:h,onNavigateToReport:d,onNavigate:u,getObjectType:b,getSlugForType:m}){const f=Ke(),{description:_,boardPath:p,parsed:N,fieldSchema:w}=i.useMemo(()=>{if(!t)return{description:"",boardPath:null,parsed:null,fieldSchema:[]};const g=Ns(t),y=g.dataSource?b(g.dataSource):void 0;return{description:Xs(g,f),boardPath:o?Ys(g,o,m):null,parsed:g,fieldSchema:y?Zs(y,f.objectTypes,f.associationTypes):[]}},[t,b,m,o,f]),C=!!N&&!!o&&Js(N,w),x=i.useCallback(g=>{if(!N||!o)return;const y=ea(N,o,m,w,g);y&&u(y)},[N,o,m,w,u]);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:ie["chart-wrapper"],onClick:h,children:[e.jsx("div",{className:ie["chart-area"],children:e.jsx(ta,{configJson:t,workspaceId:n,onEdit:o?d:void 0,onPopout:()=>r(!0),onOpenBoard:p?()=>u(p):void 0,onViewSegment:C?x:void 0,animationKey:`report-chart:${n}:${s}`})}),_&&e.jsx("p",{className:ie.description,children:_})]}),l&&e.jsx(i.Suspense,{children:e.jsx(Co,{configJson:t,workspaceId:n,objectId:s,title:a||void 0,onEdit:o?d:void 0,onOpenBoard:p?()=>u(p):void 0,onViewSegment:C?x:void 0,onClose:()=>r(!1)})})]})}function Eo({config:t,onConfigChange:s}){const{workspace:a}=re(),n=t.reportId??"",o=t.reportName??"",l=i.useCallback(h=>{s?.({reportId:h.id,reportName:h.data?.name||h.id})},[s]),r=i.useCallback(()=>{s?.({reportId:"",reportName:""})},[s]);return n?e.jsx(i.Suspense,{fallback:e.jsx(Zt,{}),children:e.jsx(Io,{reportId:n,reportName:o,workspaceId:a.id,onMissing:r})}):e.jsx(To,{workspaceId:a.id,onSelect:l})}oe({type:"report_chart",name:"Report Chart",description:"Display a report chart or metric on the dashboard",icon:"presentation-chart",category:"charts",allowMultiple:!0,defaultConfig:{reportId:"",reportName:""},component:Eo,skeleton:Zt});async function Ao(t,s="today"){return At(`/api/workspaces/${t}/digest?timeRange=${s}`)}const Yt=["today","tomorrow","this_week","last_week"],Xt={today:"Today",tomorrow:"Tomorrow",this_week:"This Week",last_week:"Last Week"},$o=5,Po=["concerns","meetings","tasks","plays","emails"];function Me(t){const s={concerns:{key:"concerns",count:t.sentimentConcernsCount,rows:t.sentimentConcerns.length},meetings:{key:"meetings",count:t.meetingCount,rows:t.meetings.length},tasks:{key:"tasks",count:t.taskCount,rows:t.tasks.length},plays:{key:"plays",count:t.suggestions.total,rows:t.suggestions.items.length},emails:{key:"emails",count:t.emailsReceived,rows:t.recentEmails.length}};return Po.map(a=>s[a])}function zo(t,s){return Me(t).filter(a=>a.rows>0&&(s===null||s===a.key)).map(a=>a.key)}function Lo(t,s){return t===s?null:s}function Mo(t){return Me(t).every(s=>s.rows===0)}function be(t,s){const a=s?[...t]:t.slice(0,$o);return{visible:a,remaining:Math.max(0,t.length-a.length)}}function Oo(t){return`${t} negative`}function qo(t,s,a){const n=sa(t),o=aa(s,a);return[n?`with ${n}`:"",o??""].filter(Boolean).join(" · ")}function Fo(t,s){return[t?`Due ${t}`:"",s??""].filter(Boolean).join(" · ")}function Wo(t){const s=(t??"").trim();if(s)return/^re:/i.test(s)?s:`Re: ${s}`}const Ko="_digest_6uuys_9",Bo="_content_6uuys_21",Uo="_body_6uuys_28",Go="_tiles_6uuys_37",Vo="_tile_6uuys_37",Qo="_section_6uuys_113",Ho="_row_6uuys_172",Zo="_leading_6uuys_215",Yo="_check_6uuys_239",Xo="_text_6uuys_261",Jo="_title_6uuys_270",er="_subline_6uuys_294",tr="_trailing_6uuys_316",sr="_expanded_6uuys_332",ar="_snippet_6uuys_339",nr="_description_6uuys_364",or="_actions_6uuys_379",rr="_action_6uuys_379",I={digest:Ko,content:Bo,body:Uo,tiles:Go,tile:Vo,"tile-top":"_tile-top_6uuys_65","tile-icon":"_tile-icon_6uuys_72","tile-count":"_tile-count_6uuys_77","tile-label":"_tile-label_6uuys_87","tile-alert":"_tile-alert_6uuys_101",section:Qo,"section-heading":"_section-heading_6uuys_119","section-label":"_section-label_6uuys_126","section-label-alert":"_section-label-alert_6uuys_137","section-count":"_section-count_6uuys_141","section-rule":"_section-rule_6uuys_152","filter-empty":"_filter-empty_6uuys_158",row:Ho,"row-open":"_row-open_6uuys_184","row-main":"_row-main_6uuys_192","row-inert":"_row-inert_6uuys_206",leading:Zo,"time-col":"_time-col_6uuys_223","check-slot":"_check-slot_6uuys_239",check:Yo,"play-tile":"_play-tile_6uuys_249",text:Xo,"title-line":"_title-line_6uuys_270",title:Jo,"title-done":"_title-done_
26uuys_289",subline:er,"subline-quote":"_subline-quote_6uuys_306","subline-wrap":"_subline-wrap_6uuys_311",trailing:tr,expanded:sr,snippet:ar,"snippet-quote":"_snippet-quote_6uuys_347","snippet-meta":"_snippet-meta_6uuys_356",description:nr,actions:or,action:rr,"load-more":"_load-more_6uuys_396","skeleton-row":"_skeleton-row_6uuys_422"},ir=Yt.map(t=>({id:t,label:Xt[t]})),cr="meeting-attendee";function Jt(){const t=Fe();return{concerns:{key:"concerns",label:"Concerns",icon:"warning",alert:!0},meetings:{key:"meetings",label:t?.getPluralLabel("meeting")??"Meetings",icon:t?.getIcon("meeting")??"calendar-blank"},tasks:{key:"tasks",label:t?.getPluralLabel("task")??"Tasks",icon:t?.getIcon("task")??"check-square"},plays:{key:"plays",label:"Plays",icon:"play"},emails:{key:"emails",label:"Emails",icon:t?.getIcon("message")??"envelope-simple"}}}function es({label:t,count:s,alert:a}){return e.jsxs("div",{className:I["section-heading"],children:[e.jsx("span",{className:se(I["section-label"],a&&I["section-label-alert"]),children:t}),e.jsx("span",{className:I["section-count"],children:s}),e.jsx("span",{className:I["section-rule"]})]})}function lr({meta:t,count:s,selected:a,onClick:n}){const o=!!t.alert&&s>0;return e.jsxs(ee,{variant:"secondary",size:"sm",selected:a,onClick:n,"aria-label":`${t.label}: ${s}`,className:se(I.tile,o&&I["tile-alert"]),children:[e.jsxs("span",{className:I["tile-top"],children:[e.jsx(O,{name:t.icon,size:Ne.md,className:I["tile-icon"]}),e.jsx("span",{className:I["tile-count"],children:s})]}),e.jsx("span",{className:I["tile-label"],children:t.label})]})}function dr({count:t,onClick:s}){return e.jsx("span",{...Wt(s),className:I["load-more"],children:e.jsx(Le,{label:`+${t} more`,color:"info",size:"xs"})})}function Oe({icon:t,label:s,onClick:a}){return e.jsx(ee,{variant:"chip",size:"sm",icon:e.jsx(O,{name:t,size:Ne.sm}),className:I.action,onClick:n=>{n.stopPropagation(),a()},children:s})}function Re({leading:t,title:s,pill:a,subline:n,quoteSubline:o,trailing:l,done:r,onActivate:h,expanded:d,children:u,ariaLabel:b}){const m=d!==void 0;return e.jsxs("div",{className:se(I.row,d&&I["row-open"],!h&&I["row-inert"]),children:[e.jsxs("div",{...h?Wt(h):{},"aria-expanded":m?d:void 0,"aria-label":b,className:I["row-main"],children:[e.jsx("span",{className:I.leading,children:t}),e.jsxs("span",{className:I.text,children:[e.jsxs("span",{className:I["title-line"],children:[e.jsx("span",{className:se(I.title,r&&I["title-done"]),children:s}),a]}),n?e.jsx("span",{className:se(I.subline,o&&I["subline-quote"],d&&I["subline-wrap"]),children:n}):null]}),l?e.jsx("span",{className:I.trailing,children:l}):null]}),d?e.jsx("div",{className:I.expanded,children:u}):null]})}function it(t,s){const{data:a}=Je(t,s.id),n=a?Pt(a):null;return{obj:a??null,lifecycleLabel:n?Lt(n):null}}function ct(t,s){return t?e.jsx($e,{content:t,children:s}):s}function ur({meeting:t,workspaceId:s,onNavigateToRecord:a}){const n=de(),o=je(),{obj:l,lifecycleLabel:r}=it(s,t),{data:h}=ra(s,t.id,cr),d=l?.data??t.data,u=typeof d.start=="string"?d.start:"",b=qo((h??[]).map(m=>m.label),d.start,d.end);return ct(r,e.jsx(Re,{leading:e.jsx("span",{className:I["time-col"],children:u?It(u,n,o):""}),title:t.title,subline:b||void 0,onActivate:r?void 0:()=>a(t.id)}))}function hr({task:t,workspaceId:s,onNavigateToRecord:a}){const n=de(),o=je(),{obj:l,lifecycleLabel:r}=it(s,t),h=l??{id:t.id,workspaceId:s,objectTypeId:t.objectTypeId,type:t.objectTypeId,data:t.data},{done:d,canToggle:u,setDone:b}=na(h,!!r),m=h.data??{},f=typeof m.due_date=="string"&&m.due_date?ze(m.due_date,n,o):null,_=m.status,p=_&&_!==ca&&_!==la?ia[_]??null:null,N=Fo(f,p),w=C=>C.stopPropagation();return ct(r,e.jsx(Re,{leading:e.jsx("span",{className:I["check-slot"],onClick:w,onKeyDown:w,children:e.jsx(oa,{checked:d,disabled:!u,onChange:b,ariaLabel:d?`Mark "${t.title}" as to do`:`Mark "${t.title}" as done`,className:I.check})}),title:t.title,done:d,subline:N||void 0,onActivate:r?void 0:()=>a(t.id)}))}function mr({email:t,workspaceId:s,onNavigateToRecord:a}){const n=de(),o=je(),{obj:l,lifecycleLabel:r}=it(s,t),h=l?.data??t.data,d=h.date||h.receivedAt;return ct(r,e.jsx(Re,{leading:e.jsx(We,{objectTypeId:t.objectTypeId,data:l?.data,workspaceId:s,objectId:t.id,size:"md"}),title:h.subject||t.title||"(no subject)",trailing:typeof d=="str
2ing"&&d?ze(d,n,o):void 0,onActivate:r?void 0:()=>a(t.id)}))}function pr({concern:t,workspaceId:s,open:a,onToggle:n,onNavigateToRecord:o,onDraftReply:l}){const r=de(),h=je(),[d,...u]=t.snippets;return e.jsxs(Re,{leading:e.jsx(We,{objectTypeId:"person",workspaceId:s,objectId:t.personId,name:t.personName,size:"md"}),title:t.personName,pill:t.snippets.length>0?e.jsx(Le,{label:Oo(t.snippets.length),color:"error",size:"xs"}):e.jsx(Le,{sentiment:t.recentSentiment,size:"xs"}),subline:d?`“${d.text}”`:"No recent negative signals",quoteSubline:!!d,trailing:d?ze(d.date,r,h):void 0,expanded:a,onActivate:n,ariaLabel:`${t.personName}, ${a?"collapse":"expand"}`,children:[u.map((b,m)=>e.jsxs("div",{className:I.snippet,children:[e.jsx(Ia,{variant:"plain",className:I["snippet-quote"],children:b.text}),e.jsx("span",{className:I["snippet-meta"],children:[b.emailSubject,ze(b.date,r,h)].filter(Boolean).join(" · ")})]},m)),e.jsxs("div",{className:I.actions,children:[e.jsx(Oe,{icon:"arrow-up-right",label:"View record",onClick:()=>o(t.personId)}),l&&e.jsx(Oe,{icon:"sparkle",label:"Draft reply",onClick:()=>l(t)})]})]})}function gr({play:t,workspaceId:s,open:a,onToggle:n,onNavigateToRecord:o,onRunPlay:l}){return e.jsxs(Re,{leading:e.jsx("span",{className:I["play-tile"],children:e.jsx(O,{name:"play",size:Ne.md,weight:"fill"})}),title:t.title,pill:e.jsx(Le,{label:Qa[t.priority]||t.priority,color:Va[t.priority]||"muted",size:"xs"}),subline:t.targetName,expanded:a,onActivate:n,ariaLabel:`${t.title}, ${a?"collapse":"expand"}`,children:[t.description?e.jsx("p",{className:I.description,children:t.description}):null,e.jsxs("div",{className:I.actions,children:[t.targetRecordId&&e.jsx(Oe,{icon:"arrow-up-right",label:"View record",onClick:()=>o(t.targetRecordId)}),l&&e.jsx(Oe,{icon:"play",label:"Run play",onClick:()=>l(t)})]})]})}const fr=[3,2,3],kt=["64%","48%","71%"];function ts(){const t=Jt(),s=[t.meetings,t.tasks,t.emails];return e.jsxs("div",{"data-testid":"digest-content-skeleton",className:I.body,children:[e.jsx("div",{className:I.tiles,children:Array.from({length:5},(a,n)=>e.jsx(E,{shape:"rounded",height:58},n))}),s.map((a,n)=>e.jsxs("div",{className:I.section,children:[e.jsx(es,{label:a.label,count:e.jsx(E,{variant:"badge",width:16})}),Array.from({length:fr[n]},(o,l)=>e.jsxs("div",{className:I["skeleton-row"],children:[e.jsx(E,{variant:"avatar"}),e.jsx(E,{variant:"text",width:kt[l%kt.length]}),e.jsx(E,{variant:"badge",width:60})]},l))]},a.key))]})}function ss(){return e.jsx(Q,{className:I.content,"data-testid":"digest-content",children:e.jsx(ts,{})})}function _r({digest:t,loading:s,error:a,timeRange:n,onTimeRangeChange:o,onNavigateToRecord:l,onDraftReply:r,onRunPlay:h,workspaceId:d}){const[u,b]=i.useState({}),[m,f]=i.useState(null),_=Jt(),p=i.useCallback(g=>{b(y=>({...y,[g]:!y[g]}))},[]),N=i.useCallback(g=>{b({}),f(null),o(g)},[o]),w=(g,y)=>!!u[`${g}:${y}`],C=!!t&&Mo(t),x=g=>{if(!t)return null;const y=Me(t).find(z=>z.key===g),j=!!u[`more:${g}`],R=z=>!j&&z>0?e.jsx(dr,{count:z,onClick:()=>p(`more:${g}`)}):null;let v=null,T=null;switch(g){case"concerns":{const{visible:z,remaining:q}=be(t.sentimentConcerns,j);v=z.map(P=>e.jsx(pr,{concern:P,workspaceId:d,open:w("concern",P.personId),onToggle:()=>p(`concern:${P.personId}`),onNavigateToRecord:l,onDraftReply:r},P.personId)),T=R(q);break}case"meetings":{const{visible:z,remaining:q}=be(t.meetings,j);v=z.map(P=>e.jsx(ur,{meeting:P,workspaceId:d,onNavigateToRecord:l},P.id)),T=R(q);break}case"tasks":{const{visible:z,remaining:q}=be(t.tasks,j);v=z.map(P=>e.jsx(hr,{task:P,workspaceId:d,onNavigateToRecord:l},P.id)),T=R(q);break}case"plays":{const{visible:z,remaining:q}=be(t.suggestions.items,j);v=z.map(P=>e.jsx(gr,{play:P,workspaceId:d,open:w("play",P.id),onToggle:()=>p(`play:${P.id}`),onNavigateToRecord:l,onRunPlay:h},P.id)),T=R(q);break}case"emails":{const{visible:z,remaining:q}=be(t.recentEmails,j);v=z.map(P=>e.jsx(mr,{email:P,workspaceId:d,onNavigateToRecord:l},P.id)),T=R(q);break}}return e.jsxs("section",{className:I.section,"aria-label":_[g].label,children:[e.jsx(es,{label:_[g].label,count:y.count,alert:_[g].alert}),v,T]},g)};return e.jsxs("div",{className:I.digest,children:[e.jsx(Se,{tabs:ir,activeTab:n,onTabChange:N,size:"sm"}),e.jsx(i.Suspense,{fallback:e.jsx(ss,{}),children:a?e.jsx(ke,{message:a}):!s&&(!t||C)?e.jsx(G,{iconName:"newspaper",title:"Nothing to report",hint:"No activity for this period."}):e.jsx(Q,{className:I.content,"data-testid":"digest-content",children:s||!t?e.jsx(ts,{}):e.jsxs("div",{className:I.body,children:[e.jsx("div",{className:I.tiles,role:"group","aria-label":"Filter by section",children:Me(t).map(g=>e.jsx(lr,{meta:_[g.key],count:g.count,selected:m===g.key,onClick:()=>f(y=>Lo(y,g.key))},g.key))}),(()=>{const g=zo(t,m);return g.length>0?g.map(x):e.jsxs("span",{className:I["filter-empty"],children:["Nothing in ",_[m].label.toLowerCase()," for this period."]})})()]})})})]})}const vr={"skeleton-pane":"_skeleton-pane_vea6x_4"},yr=(t,s)=>["dashboard","digest",t,s];function br(){return e.jsxs("div",{className:vr["skeleton-pane"],children:[e.jsx(Se,{tabs:Yt.map(t=>({id:t,label:Xt[t]})),activeTab:"today",onTabChange:()=>{},size:"sm"}),e.jsx(ss,{})]})}function xr(t){const{workspace:s}=re(),{openPreview:a}=ue(),n=da(),o=qe(),[l,r]=i.useState("today"),h=i.useCallback(f=>{n?.openCompose({to:[{id:f.personId,label:f.personName}],subject:Wo(f.snippets[0]?.emailSubject)})},[n]),d=i.useCallback(f=>{const _=new URLSearchParams;f.priority&&_.set("priority",f.priority);const p=_.toString();
2o(`/workspaces/${s.id}/suggestions${p?`?${p}`:""}`)},[o,s.id]),{data:u,isPending:b,error:m}=Pe({queryKey:yr(s.id,l),queryFn:()=>Ao(s.id,l),staleTime:5*6e4});return e.jsx(_r,{digest:u??null,loading:b,error:m?m instanceof Error?m.message:"Failed to load digest":null,timeRange:l,onTimeRangeChange:r,onNavigateToRecord:a,onDraftReply:n?h:void 0,onRunPlay:d,workspaceId:s.id})}oe({type:"digest",name:"Digest",description:"Daily summary of emails, meetings, tasks, and signals",icon:"newspaper",category:"overview",defaultConfig:{},component:xr,skeleton:br});const wr="_pane_jry9e_3",jr="_container_jry9e_10",kr="_sentinel_jry9e_22",Nr="_skeletons_jry9e_29",xe={pane:wr,container:jr,sentinel:kr,skeletons:Nr},He=50,Sr=t=>["dashboard","user-activity",t];function Cr(){return e.jsx("div",{className:xe.container,children:e.jsx("div",{className:xe.skeletons,children:e.jsx(Ot,{count:5,rail:!0})})})}function Rr(t){const{workspace:s}=re(),{getFields:a}=Ke(),{data:n}=ne({queryKey:Sr(s.id),queryFn:()=>pt(s.id,{limit:He})}),[o,l]=i.useState([]),[r,h]=i.useState(null),[d,u]=i.useState(!1),{openPreview:b}=ue(),m=i.useMemo(()=>[...n.events,...o],[n.events,o]),f=r??n.total,_=m.length>=He&&m.length<f,p=i.useMemo(()=>{const C={},x=new Set;for(const g of m){const y=g.objectTypeId;y&&!x.has(y)&&(x.add(y),C[y]=a(y))}return C},[m,a]),N=i.useCallback(async()=>{if(!(d||!_)){u(!0);try{const C=await pt(s.id,{limit:He,offset:m.length});l(x=>[...x,...C.events]),h(C.total)}catch{}finally{u(!1)}}}
2,[d,_,s.id,m.length]),w=Ha({onLoadMore:()=>{N()},enabled:_});return m.length===0?e.jsx(G,{iconName:"pulse",title:"No activity yet"}):e.jsx("div",{className:xe.pane,children:e.jsx(Q,{className:xe.container,children:e.jsx(Za,{events:m,fields:p,workspaceId:s.id,showRecordContext:!0,groupByActor:!0,onPreview:C=>b(C),footer:_?e.jsx("div",{ref:w,className:xe.sentinel,children:d&&e.jsx(Ot,{count:2,rail:!0,label:"Loading more activity"})}):null})})})}oe({type:"user_activity",name:"Feed",description:"Recent activity across the workspace — field updates, record creates, emails, and more",icon:"pulse",category:"lists",defaultConfig:{},component:Rr,skeleton:Cr});const Tr="_pane_1k19u_3",Ir="_list_1k19u_11",ae={pane:Tr,list:Ir,"skeleton-item":"_skeleton-item_1k19u_24","skeleton-icon":"_skeleton-icon_1k19u_35","skeleton-lines":"_skeleton-lines_1k19u_40","skeleton-line-title":"_skeleton-line-title_1k19u_53","skeleton-line-meta":"_skeleton-line-meta_1k19u_54"},Nt={today:"today",tomorrow:"tomorrow",week:"this_week",month:"this_month"},Xe=["today","tomorrow","week","month"],Dr={today:"today",tomorrow:"tomorrow",week:"this week",month:"this month"},as={today:"Today",tomorrow:"Tomorrow",week:"This Week",month:"This Month"},St=(t,s)=>["dashboard","meetings",t,s],Er=t=>["dashboard","meeting-counts",t],Ar=[["62%","38%"],["48%","45%"],["70%","33%"],["55%","40%"]];function ns(){return e.jsx("div",{"data-testid":"meetings-rows-skeleton",children:Ar.map(([t,s],a)=>e.jsxs("div",{className:ae["skeleton-item"],children:[e.jsx(E,{className:ae["skeleton-icon"],width:28,height:28}),e.jsxs("div",{className:ae["skeleton-lines"],children:[e.jsx("div",{className:ae["skeleton-line-title"],children:e.jsx(E,{variant:"text",width:t})}),e.jsx("div",{className:ae["skeleton-line-meta"],children:e.jsx(E,{variant:"text-sm",width:s})})]}),e.jsx("div",{className:ae["skeleton-line-meta"],children:e.jsx(E,{variant:"text-sm",width:30})})]},a))})}function os(){return e.jsx(Q,{className:ae.list,"data-testid":"meetings-content",children:e.jsx(ns,{})})}function $r(){return e.jsxs("div",{className:ae.pane,children:[e.jsx(Se,{tabs:Xe.map(t=>({id:t,label:as[t]})),activeTab:"today",onTabChange:()=>{},size:"sm"}),e.jsx(os,{})]})}function Pr(t){const{workspace:s}=re(),a=Ss(),{openPreview:n}=ue(),[o,l]=i.useState("today"),{data:r,isError:h,refetch:d}=Pe({queryKey:[...St(s.id,o),a],queryFn:async()=>{const f=dt(Nt[o],void 0,new Date,a),_=await ce(s.id,"meeting","",0,50,void 0,{dateFrom:f.from,dateTo:f.to,sort:"start:asc"});return{results:_.results??[],total:_.total??_.results?.length??0}}});Bt(Mt(),St(s.id,o),i.useMemo(()=>new Set(r?.results.map(f=>f.id)??[]),[r]));const{data:u}=Pe({queryKey:[...Er(s.id),a],queryFn:async()=>{const f=await Promise.all(Xe.map(async _=>{const p=dt(Nt[_],void 0,new Date,a);try{const N=await ce(s.id,"meeting","",0,1,void 0,{dateFrom:p.from,dateTo:p.to});return[_,N.total??N.results?.length??0]}catch{return[_,0]}}));return Object.fromEntries(f)},staleTime:6e4}),b=i.useMemo(()=>Xe.map(f=>({id:f,label:as[f],count:(f===o&&r?r.total:u?.[f])||void 0})),[u,o,r]),m=f=>{l(f)};return e.jsxs("div",{className:ae.pane,children:[e.jsx(Se,{tabs:b,activeTab:o,onTabChange:m,size:"sm"}),e.jsx(i.Suspense,{fallback:e.jsx(os,{}),children:h?e.jsx(ke,{message:"Couldn't load meetings.",onRetry:()=>{d()}}):r&&r.results.length===0?e.jsx(G,{iconName:"calendar-blank",title:`No meetings ${Dr[o]}`}):e.jsx(Q,{className:ae.list,"data-testid":"meetings-content",children:r?r.results.map(f=>e.jsx(Kt,{object:f,onClick:()=>n(f.id)},f.id)):e.jsx(ns,{})})})]})}oe({type:"meetings",name:"Meetings",description:"Upcoming meetings for today, tomorrow, and this week",icon:"calendar-blank",category:"lists",defaultConfig:{},component:Pr,skeleton:$r});async function zr(t,s={}){const a=new URLSearchParams;s.limit!=null&&a.set("limit",String(s.limit)),s.cursor&&a.set("cursor",s.cursor);const n=a.toString();return At(`/api/workspaces/${encodeURIComponent(t)}/emails/awaiting-response${n?`?${n}`:""}`,{signal:s.signal})}const Lr="_pane_112q2_1",Mr="_list_112q2_9",le={pane:Lr,list:Mr,"skeleton-item":"_skeleton-item_112q2_15","skeleton-lines":"_skeleton-lines_112q2_22"},Or=50,Ct=t=>["dashboard","emails-awaiting-response",t];function qr(){return e.jsx("div",{className:le.pane,children:e.jsx("div",{className:le.list,children:Array.from({length:5},(t,s)=>e.jsxs("div",{className:le["skeleton-item"],children:[e.jsx(E,{width:32,height:32,shape:"circle"}),e.jsxs("div",{className:le["skeleton-lines"],children:[e.jsx(E,{variant:"text-sm",width:`${55+s%3*15}%`}),e.jsx(E,{variant:"text-sm",width:`${35+s%2*10}%`})]})]},s))})})}function Fr(t){const{workspace:s}=re(),{openPreview:a}=ue(),{data:n,hasNextPage:o,isFetchingNextPage:l,fetchNextPage:r}=an({queryKey:Ct(s.id),queryFn:({pageParam:d,signal:u})=>zr(s.id,{limit:Or,cursor:d??void 0,signal:u}),initialPageParam:null,getNextPageParam:d=>d.nextCursor??void 0}),h=i.useMemo(()=>n.pages.flatMap(d=>d.items),[n.pages]);
2return Bt(Mt(),Ct(s.id),i.useMemo(()=>new Set(h.map(d=>d.id)),[h])),h.length===0?e.jsx("div",{className:le.pane,children:e.jsx(G,{iconName:"envelope-open",title:"Inbox zero",hint:"No emails are waiting on a reply from you."})}):e.jsx(Q,{className:le.pane,children:e.jsx(Ft,{className:le.list,hasMore:o,loading:l,onLoadMore:()=>{r()},children:h.map(d=>e.jsx(Kt,{object:d,onClick:()=>a(d.id)},d.id))})})}oe({type:"emails_to_respond",name:"Emails to Respond To",description:"Recent emails where you are the recipient and have not yet replied",icon:"envelope-open",category:"lists",defaultConfig:{},component:Fr,skeleton:qr});const Wr="_container_y97dq_5",Kr="_row_y97dq_25",Br="_meta_y97dq_47",Ur="_name_y97dq_55",Gr="_sub_y97dq_64",Vr="_dot_y97dq_83",Qr="_spark_y97dq_87",Hr="_count_y97dq_96",Zr="_chevron_y97dq_110",Yr="_panel_y97dq_127",L={container:Wr,row:Kr,meta:Br,name:Ur,sub:Gr,"sub-role":"_sub-role_y97dq_78",dot:Vr,spark:Qr,count:Hr,chevron:Zr,"chevron-open":"_chevron-open_y97dq_118","panel-wrap":"_panel-wrap_y97dq_127","panel-wrap-open":"_panel-wrap-open_y97dq_133","panel-wrap-inner":"_panel-wrap-inner_y97dq_137",panel:Yr,"panel-inset":"_panel-inset_y97dq_152","panel-head":"_panel-head_y97dq_161","record-row":"_record-row_y97dq_172","record-icon":"_record-icon_y97dq_179","record-link":"_record-link_y97dq_183","record-count":"_record-count_y97dq_203","record-empty":"_record-empty_y97dq_214","skeleton-row":"_skeleton-row_y97dq_224","skeleton-lines":"_skeleton-lines_y97dq_238","skeleton-bars":"_skeleton-bars_y97dq_247","row-outer":"_row-outer_y97dq_258","row-contact-actions":"_row-contact-actions_y97dq_264","contact-action-btn":"_contact-action-btn_y97dq_273"},we={sort:"recent",showPresence:!0},Xr=7,Jr=t=>["dashboard","recently-active",t];function De(t){if(!t.lastActiveAt)return-1/0;const s=Date.parse(t.lastActiveAt);return Number.isNaN(s)?-1/0:s}function ei(t,s){const a=[...t];return a.sort((n,o)=>s==="active"?o.eventCount-n.eventCount||De(o)-De(n):De(o)-De(n)||o.eventCount-n.eventCount),a}function ti(){return e.jsx("div",{className:L.container,children:Array.from({length:5},(t,s)=>e.jsxs("div",{className:L["skeleton-row"],children:[e.jsx(E,{width:34,height:34,shape:"circle"}),e.jsxs("div",{className:L["skeleton-lines"],children:[e.jsx(E,{variant:"text-sm",width:`${45+s%3*12}%`}),e.jsx(E,{variant:"text-sm",width:`${30+s%2*10}%`})]}),e.jsx("div",{className:L["skeleton-bars"],children:Array.from({length:7},(a,n)=>e.jsx(E,{width:4,height:4+(n+s)%4*4,shape:"rounded"},n))}),e.jsx(E,{variant:"badge",width:26})]},s))})}function si({row:t,onOpenRecord:s}){return e.jsx("div",{className:L.panel,children:e.jsxs("div",{className:L["panel-inset"],children:[e.jsx("div",{className:L["panel-head"],children:"Records touched"}),t.recordsTouched.length===0?e.jsx("div",{className:L["record-empty"],children:"Logins only, no record activity"}):t.recordsTouched.map(a=>e.jsxs("div",{className:L["record-row"],children:[a.objectTypeId&&e.jsx(We,{objectTypeId:a.objectTypeId,size:"xs",previewMode:!0,name:a.typeLabel||void 0,className:L["record-icon"]}),e.jsx("button",{type:"button",className:L["record-link"],onClick:()=>s(a.recordId),title:a.title||a.recordId,children:a.title||"Untitled record"}),e.jsxs("span",{className:L["record-count"],children:[a.eventCount," ",a.eventCount===1?"event":"events"]})]},a.recordId))]})})}function ai({row:t,workspaceId:s,avatarFieldKey:a,isViewer:n,expanded:o,showPresence:l,hasEmailProvider:r,chatController:h,onCompose:d,onToggle:u,onOpenRecord:b}){const m=ga(t.lastActiveAt),f=`recently-active-panel-${t.userId}`,_=n?"You":t.name,p=t.isAgent?fa(s):t.personRecordId??"",{data:N}=Je(s,p),{avatarUrl:w}=Ya(s,N?.data,a),C=w??t.avatarUrl??void 0,x=i.useRef(null),g=i.useCallback(async()=>N||(p?Et(s,p):null),[s,p,N]),y=$t({data:N??null,loadData:g}),j=_a(),R=n||!N?[]:va(N,{hasEmailProvider:r,canMessage:!!h,canAgentChat:!!j,audioChatActive:!!j?.voiceActive}),v=t.isAgent?ya:t.lastActiveAt?e.jsx(Ze,{date:t.lastActiveAt}):"Not seen yet";return e.jsxs("div",{className:L["row-outer"],children:[e.jsxs("div",{role:"button",tabIndex:0,className:L.row,"aria-expanded":o,"aria-controls":f,onClick:u,onKeyDown:T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),u())},children:[e.jsxs("span",{ref:x,className:gt["avatar-presence-wrapper"],onMouseEnter:y.onAnchorMouseEnter,onMouseLeave:y.onAnchorMouseLeave,children:[t.isAgent?e.jsx(ba,{size:36}):e.jsx(Cs,{name:t.name,src:C,size:"md"}),l&&!t.isAgent&&e.jsx(xa,{state:m,size:"sm",withRing:!0,className:gt["avatar-presence-dot"]})]}),e.jsxs("span",{className:L.meta,children:[e.jsx("span",{className:L.name,children:_}),e.jsxs("span",{className:L.sub,children:[t.role&&e.jsx("span",{className:L["sub-role"],children:t.role}),t.role&&e.jsx("span",{className:L.dot,children:"·"}),e.jsx("span",{children:v})]})]}),e.jsx("span",{className:L["row-contact-actions"],children:R.map(T=>e.jsx($e,{content:T.label,children:e.jsx(ee,{variant:"ghost",size:"xs",circular:!0,className:L["contact-action-btn"],"aria-label":`${T.label}: ${t.name}`,icon:e.jsx(O,{name:T.icon,size:16,weight:"regular"}),disabled:T.disabled,onClick:z=>{z.stopPropagation(),T.id==="email"&&t.personRecordId?d(t.personRecordId,t.name):T.id==="message"&&N?.linkedUserId?h?.openDmWith(N.linkedUserId):T.id==="audio-chat"?j?.startVoiceChat():T.id==="agent-chat"&&j?.startNewAgentChat()}})},T.id))}),e.jsx("span",{className:L.spark,children:e.jsx(wa,{values:t.dailyCounts,chartType:"bar",variant:"neutral",highlightThreshold:Xr,width:44,height:16,barGap:2,ariaLabel:`${t.name}: ${t.eventCount} events over the last 7 days`})}),e.jsx("span",{className:L.count,children:e.jsx($e,{content:`${t.eventCount} events in the last 7 days`,children:e.jsx(Wa,{value:t.eventCount,showZero:!0})})}),e.jsx("span",{className:`${L.chevron} ${o?L["chevron-open"]:""}`,children:e.jsx(O,{name:"caret-down",size:14})})]}),(y.data??N)&&e.jsx(zt,{workspaceId:s,object:y.data??N,open:y.open,onClose:y.close,anchorRef:x,onMouseEnter:y.onPop
2overMouseEnter,onMouseLeave:y.onPopoverMouseLeave}),e.jsx("div",{id:f,className:`${L["panel-wrap"]} ${o?L["panel-wrap-open"]:""}`,"aria-hidden":!o,children:e.jsx("div",{className:L["panel-wrap-inner"],children:e.jsx(si,{row:t,onOpenRecord:b})})})]})}function ni({config:t}){const{workspace:s}=re(),{openPreview:a}=ue(),{getIconField:n}=Ke(),o=tt(),l=n("person")?.key,r=t.sort??we.sort,h=t.showPresence??we.showPresence,{provider:d}=ua(s.id),{openCompose:u}=ha(),b=ma(),{data:m}=ne({queryKey:Jr(s.id),queryFn:()=>pa(s.id),staleTime:6e4,refetchInterval:12e4}),f=i.useMemo(()=>ei(m.members,r),[m.members,r]),[_,p]=i.useState(()=>new Set),N=w=>p(C=>{const x=new Set(C);return x.has(w)?x.delete(w):x.add(w),x});return f.length===0?e.jsx(G,{iconName:"users-three",title:"No recent activity"}):e.jsx(Q,{className:L.container,children:f.map(w=>e.jsx(ai,{row:w,workspaceId:s.id,avatarFieldKey:l,isViewer:!!o.id&&!!w.userId&&w.userId===o.id,expanded:_.has(w.userId),showPresence:h,hasEmailProvider:!!d,chatController:b,onCompose:(C,x)=>u({to:[{id:C,label:x}]}),onToggle:()=>N(w.userId),onOpenRecord:a},w.userId))})}function oi({config:t,onConfigChange:s}){const a=t.sort??we.sort,n=t.showPresence??we.showPresence;return[{id:"sort-recent",label:"Sort: most recent",active:a==="recent",onSelect:()=>s({sort:"recent"})},{id:"sort-active",label:"Sort: most active",active:a==="active",onSelect:()=>s({sort:"active"})},{id:"toggle-presence",label:"Show presence",active:n,separatorBefore:!0,onSelect:()=>s({showPresence:!n})}]}oe({type:"recently_active",name:"Recently Active",description:"Who has been working in the workspace and what they touched",icon:"users-three",category:"lists",defaultConfig:we,component:ni,skeleton:ti,menuEntries:oi});const ri="_header_2cjc4_34",J={"widget-dashboard":"_widget-dashboard_2cjc4_6","scroll-inner":"_scroll-inner_2cjc4_20",header:ri,"read-only-banner":"_read-only-banner_2cjc4_35","header-divider":"_header-divider_2cjc4_53","header-description":"_header-description_2cjc4_62","header-actions":"_header-actions_2cjc4_73","header-cta":"_header-cta_2cjc4_92","empty-panel":"_empty-panel_2cjc4_105"};let ii=1;function ci(){return`widget-${Date.now()}-${ii++}`}function li({workspace:t}){const s=tt(),a=et(),[n]=Dt(),o=n.get("dashboard"),{dashboards:l,loading:r,loadError:h,reload:d,active:u,isOwner:b,isReadOnly:m,selectDashboard:f,createNew:_,saveEdits:p,duplicate:N,setShared:w,remove:C,updateActiveRows:x}=un(t.id,s.id,o??void 0),[g,y]=i.useState(null),[j,R]=i.useState(!1),[v,T]=i.useState(null),[z,q]=i.useState(!1),[P,M]=i.useState(!1),[U,k]=i.useState(!1),S=i.useRef(null),{users:c}=ja(t.id),D=u?Ka(u.userId,c,void 0,void 0).name:"",$=i.useCallback(async K=>{if(g){R(!0);try{g.mode==="create"?await _(K):await p(g.dashboard,K),y(null)}catch{}finally{R(!1)}}},[g,_,p]),W=i.useCallback(async()=>{if(v){q(!0);try{await C(v),T(null)}finally{q(!1)}}},[v,C]),Z=i.useCallback(K=>{x(()=>K)},[x]),_e=i.useCallback((K,Y)=>{const V=Ut(K);if(!V)return;const ye={instanceId:ci(),widgetType:K,config:{...V.defaultConfig,...Y}};x(he=>pn(he,ye)),a.success("Widget added")},[x,a]),[ve,Te]=i.useState(new Set),Ue=i.useCallback(K=>{Te(Y=>{if(Y.has(K))return Y;const V=new Set(Y);return V.add(K),V}),setTimeout(()=>{x(Y=>Y.map(V=>V.filter(ye=>ye.instanceId!==K)).filter(V=>V.length>0)),Te(Y=>{const V=new Set(Y);return V.delete(K),V}),a.success("Widget removed")},280)},[x,a]),rs=i.useCallback((K,Y)=>{x(V=>V.map(ye=>ye.map(he=>he.instanceId===K?{...he,config:{...he.config,...Y}}:he)))},[x]);if(r)return e.jsx("div",{className:J["widget-dashboard"],children:e.jsx(ka,{})});if(h||!u)return e.jsx("div",{className:J["widget-dashboard"],children:e.jsx(ke,{message:"Failed to load dashboards",variant:"block",onRetry:d})});const is=u.rows.some(K=>K.length>0);return e.jsxs("div",{className:J["widget-dashboard"],children:[e.jsxs("div",{className:J.header,children:[e.jsx(Pn,{}),e.jsxs("div",{className:J["header-actions"],children:[u.description&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:J["header-description"],children:u.description}),e.jsx(Na,{direction:"vertical",className:J["header-divider"]})]}),e.jsx(Ln,{workspaceId:t.id,currentUserId:s.id,dashboards:l,activeId:u.id,onSelect:f,onCreate:()=>y({mode:"create"}),onEdit:K=>y({mode:"edit",dashboard:K}),onDuplicate:N,onToggleShare:w,onDelete:T}),u.isShared&&e.jsx(ee,{ref:S,variant:"secondary",size:"sm",className:J["header-cta"],icon:e.jsx(O,{name:"share",size:14}),responsive:!0,responsiveAt:680,onClick:()=>k(!0),children:"Share"}),b&&e.jsx(ee,{variant:"primary",size:"sm",className:J["header-cta"],icon:e.jsx(O,{name:"plus",size:14,weight:"bold"}),responsive:!0,responsiveAt:680,onClick:()=>M(!0),children:"Add widget"})]})]}),u.isShared&&e.jsx(Sa,{open:U,onClose:()=>k(!1),anchorRef:S,records:[],dashboard:u}),m&&e.jsxs(Ea,{variant:"info",icon:e.jsx(O,{name:"eye",size:18,weight:"fill"}),className:J["read-only-banner"],actions:e.jsx(ee,{variant:"primary",size:"sm",icon:e.jsx(O,{name:"copy",size:13,weight:"bold"}),onClick:()=>N(u),children:"Make a copy"}),children:["Shared by ",e.jsx("strong",{children:D||"a teammate"})," — this dashboard is read-only. Make a copy to edit its widgets."]}),e.jsx(Q,{stableGutter:!0,children:e.jsx("div",{className:J["scroll-inner"],children:is?e.jsx(fn,{workspace:t,children:e.jsx(In,{layout:{version:u.version,rows:u.rows,updatedAt:u.updatedAt},onLayoutChange:Z,onRemove:Ue,onWidgetConfigChange:rs,removingIds:ve,readOnly:m})}):e.jsx("div",{className:J["empty-panel"],children:e.jsx(G,{iconName:"squares-four",title:"No widgets yet",hint:b?"Add a widget to start building this dashboard.":"The owner has not added any widgets yet.",action:b?e.jsx(ee,{variant:"primary",icon:e.jsx(O,{name:"plus",size:14}),onClick:()=>M(!0),children:"Add widget"}):void 0,size:"lg"})})})}),P&&b&&e.jsx(Fn,{workspaceId:t.id,currentWidgets:u.rows.flat(),onAdd:(K,Y)=>{_e(K,Y),M(!1)},onClose:()=>M(!1)}),e.jsx(Da,{open:g!==null,title:g?.mode==="edit"?"Rename & edit dashboard":"Create dashboard",saveLabel:g?.mode==="edit"?"Save":"Create",onClose:()=>y(null),onSave:$,loading:j,namePlaceholder:"Dashboard name…",initialName:g?.mode==="edit"?g.dashboard.name:"",showDescription:!0,descriptionPlaceholder:"What is this dashboard for?",initialDescription:g?.mode==="edit"?g.dashboard.description:"",shareHelp:g?.mode==="edit"&&g.dashboard.isDefault?void 0:"Anyone in your workspace will see this dashboard in their switcher.",initialIsShared:g?.mode==="edit"?g.dashboard.isShared:!1}),e.jsx(Ca,{open:v!==null,onConfirm:W,onCancel:()=>T(null),title:"Delete dashboard",message:`Delete "${v?.name}
2"? This can't be undone.`,confirmLabel:"Delete",loading:z})]})}function Bi(){const{workspace:t}=Ra();return e.jsx(li,{workspace:t})}export{Bi 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.