react-semaphor 0.1.432 → 0.1.433

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. package/dist/chunks/{dashboard-BNNLoBLt.js → dashboard-CCRvBqUy.js} +203 -199
  2. package/dist/chunks/{dashboard-DxwOPUB6.js → dashboard-DxynqfO7.js} +23 -23
  3. package/dist/chunks/{dashboard-briefing-launcher-B2jFSq0-.js → dashboard-briefing-launcher-B5y65OKI.js} +2 -2
  4. package/dist/chunks/{dashboard-briefing-launcher-Hvo4V3np.js → dashboard-briefing-launcher-h9DIL6l1.js} +1 -1
  5. package/dist/chunks/{dashboard-controls-CB2dDJP4.js → dashboard-controls-BN09XPen.js} +342 -342
  6. package/dist/chunks/dashboard-controls-Cp_Q8acT.js +36 -0
  7. package/dist/chunks/{dashboard-json-n4hMQPtc.js → dashboard-json-BNxt7dUo.js} +1 -1
  8. package/dist/chunks/{dashboard-json-cSLaRjlU.js → dashboard-json-Bf3-8gq8.js} +1 -1
  9. package/dist/chunks/{edit-dashboard-visual-BwXL-sin.js → edit-dashboard-visual-B8Mofk1U.js} +1 -1
  10. package/dist/chunks/{edit-dashboard-visual-C5eejq9I.js → edit-dashboard-visual-DX76RXmE.js} +2 -2
  11. package/dist/chunks/{report-preferences-dialog-D8Qe2GGf.js → report-preferences-dialog-DMQjY7oS.js} +1 -1
  12. package/dist/chunks/{report-preferences-dialog-CDYDm7dt.js → report-preferences-dialog-DxK9_fbn.js} +1 -1
  13. package/dist/chunks/{use-create-flow-overlay-state-Dv5iYPzX.js → use-create-flow-overlay-state-BX3dLUMB.js} +1 -1
  14. package/dist/chunks/{use-create-flow-overlay-state-9-aceNp5.js → use-create-flow-overlay-state-C6savp4F.js} +1 -1
  15. package/dist/dashboard/index.cjs +1 -1
  16. package/dist/dashboard/index.js +1 -1
  17. package/dist/data-app-builder/index.cjs +1 -1
  18. package/dist/data-app-builder/index.js +1 -1
  19. package/dist/index.cjs +1 -1
  20. package/dist/index.js +4 -4
  21. package/dist/surfboard/index.cjs +1 -1
  22. package/dist/surfboard/index.js +2 -2
  23. package/package.json +1 -1
  24. package/dist/chunks/dashboard-controls-DwW7cOds.js +0 -36
@@ -0,0 +1,36 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("./code-editor-BSENCZwR.js"),t=require("./dashboard-DxynqfO7.js"),U=require("./index-jSrCwPQz.js");require("./analyze-result-contract-BswhsmWT.js");require("../value-format-preferences/index.cjs");const g=require("react");require("./index-Dpm_VET4.js");require("./comparison-document-migration-DbU_BTxR.js");const Zs=require("react-dom");require("../briefings/index.cjs");const V=require("./dashboard-briefing-launcher-h9DIL6l1.js"),ys=require("./search-Dcud9ajy.js"),js=require("./index-D7KJindZ.js"),et=require("./report-preferences-dialog-DxK9_fbn.js"),st=require("./use-debounced-dirty-check-XHSwAefL.js"),Be=require("./normalize-dashboard-for-dirty-check-BXRUMVb2.js"),fs=require("./save-Xdc4pnys.js"),tt=require("./palette-C0yjT5Tv.js"),rt=require("./braces-CbO-aIwH.js");function at(s){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const a in s)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(s,a);Object.defineProperty(n,a,r.get?r:{enumerable:!0,get:()=>s[a]})}}return n.default=s,Object.freeze(n)}const L=at(g);/**
2
+ * @license lucide-react v0.453.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const nt=U.createLucideIcon("Glasses",[["circle",{cx:"6",cy:"15",r:"4",key:"vux9w4"}],["circle",{cx:"18",cy:"15",r:"4",key:"18o8ve"}],["path",{d:"M14 15a2 2 0 0 0-2-2 2 2 0 0 0-2 2",key:"1ag4bs"}],["path",{d:"M2.5 13 5 7c.7-1.3 1.4-2 3-2",key:"1hm1gs"}],["path",{d:"M21.5 13 19 7c-.7-1.3-1.5-2-3-2",key:"1r31ai"}]]);/**
7
+ * @license lucide-react v0.453.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const ot=U.createLucideIcon("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
12
+ * @license lucide-react v0.453.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const it=U.createLucideIcon("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
17
+ * @license lucide-react v0.453.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const dt=U.createLucideIcon("ShieldX",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]);/**
22
+ * @license lucide-react v0.453.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const lt=U.createLucideIcon("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
27
+ * @license lucide-react v0.453.0 - ISC
28
+ *
29
+ * This source code is licensed under the ISC license.
30
+ * See the LICENSE file in the root directory of this source tree.
31
+ */const ct=U.createLucideIcon("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/**
32
+ * @license lucide-react v0.453.0 - ISC
33
+ *
34
+ * This source code is licensed under the ISC license.
35
+ * See the LICENSE file in the root directory of this source tree.
36
+ */const ws=U.createLucideIcon("UserRound",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]),Se=["light","dark","system"];function ut(){const{theme:s,setTheme:n}=t.useTheme(),a=d.useDashboardStore(x=>x.actions.setDashboardTheme);function r(){const x=Se.includes(s)?s:"system",h=Se[(Se.indexOf(x)+1)%Se.length];n(h),a(h)}const o=s==="light"?lt:s==="dark"?it:ot,c=s==="light"?"Theme: light (click for dark)":s==="dark"?"Theme: dark (click for system)":"Theme: system (click for light)";return e.jsx(d.Button,{type:"button",variant:"ghost",size:"xs",className:"h-7 w-7 p-0 text-muted-foreground hover:text-foreground",onClick:r,"aria-label":c,title:c,children:e.jsx(o,{className:"h-3.5 w-3.5",strokeWidth:1.5})})}function Ds(s){const n=new Date().toISOString(),a=t.buildDashboardSheetsInputExecutionSnapshot({dashboard:s.dashboard,sheetIds:(s.dashboard.sheets||[]).filter(r=>r.kind!=="document").map(r=>r.id),sheetKind:"dashboard",mode:"dashboard",generatedAt:n,runtimeValues:{dashboardInputValues:s.dashboardInputValues,filterValues:s.filterValues,controlValues:s.controlValues,inlineFilterValuesMap:s.inlineFilterValuesMap,cardControlValuesMap:s.cardControlValuesMap}}).snapshot;return{generatedAt:n,dashboardInputValues:a.dashboardInputValues}}async function mt(s,n,a,r,o,c){if(!c)return null;const x=JSON.stringify(a),h=`${s}/v1/lens`;return await d.postRequest(h,c,{name:n,template:x,filterValues:r,inputValues:o,operation:"create"})}async function $e(s,n,a){if(!a)return null;const{id:r,template:o,filterValues:c,inputValues:x,isDefault:h,shared:p}=n,j=`${s}/v1/lens`;return await d.postRequest(j,a,{lensId:r,template:o,filterValues:c,inputValues:x,isDefault:h,shared:p,operation:"update"})}async function ht(s,n,a){if(!a)return null;const r=`${s}/v1/lens`;return await d.postRequest(r,a,{operation:"delete",lensId:n})}const pt="text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";function xt({open:s,onOpenChange:n}={}){const[a,r]=g.useState(""),[o,c]=g.useState(!1),x=d.useDashboardStore(y=>y.lenses),{setLenses:h,setSelectedLensId:p}=d.useDashboardActions(),[j,l]=g.useState(!1),[m,v]=g.useState(!1),f=s!==void 0,D=f?s:m,w=y=>{f||v(y),n==null||n(y)},u=d.useDashboardStore(y=>y.dashboard),k=d.useDashboardStore(y=>y.filterValues),{authToken:S,tokenProps:E}=t.useSemaphorContext();async function N(){l(!0);const y=d.useDashboardStore.getState(),q=Ds({dashboard:u,dashboardInputValues:y.dashboardInputValues,filterValues:k,controlValues:y.controlValues,inlineFilterValuesMap:y.inlineFilterValuesMap,cardControlValuesMap:y.cardControlValuesMap}),B=await mt(E.apiServiceUrl,a,u,k,q,S==null?void 0:S.accessToken);B&&(h([...x||[],B]),p(B.id),w(!1)),l(!1)}return e.jsxs(t.Dialog,{open:D,onOpenChange:w,children:[f?null:e.jsx(t.DialogTrigger,{asChild:!0,children:e.jsxs(d.Button,{variant:"secondary",size:"xs",children:[e.jsx(t.Plus,{className:"h-3.5 w-3.5"}),"Lens"]})}),e.jsxs(t.DialogContent,{className:"rounded-control border-border/60 sm:max-w-[420px] sm:rounded-control",children:[e.jsxs(t.DialogHeader,{children:[e.jsx(t.DialogTitle,{className:"text-[15px]",children:"Create lens"}),e.jsx(t.DialogDescription,{className:"text-[13px] leading-5",children:"Lenses are private by default and are only visible to you."})]}),e.jsxs("div",{className:"space-y-1.5 py-1",children:[e.jsx(d.Label,{htmlFor:"lens-name",className:pt,children:"Name"}),e.jsx(d.Input,{id:"lens-name",size:"xs",value:a,placeholder:"Monthly review, West region, …",onChange:y=>r(y.target.value)}),o&&e.jsx("p",{className:"text-[12px] text-destructive",children:"A lens with this name already exists. Pick a different one."})]}),e.jsxs(t.DialogFooter,{children:[e.jsx(d.Button,{variant:"outline",size:"xs",onClick:()=>w(!1),children:"Cancel"}),e.jsx(d.Button,{size:"xs",type:"submit",onClick:N,disabled:j||!a.trim(),children:j?"Creating…":"Create"})]})]})]})}function ft({includeLabel:s=!1}={}){const n=d.useDashboardStore(l=>l.lenses),a=d.useDashboardStore(l=>l.selectedLensId),{setLenses:r,setSelectedLensId:o}=d.useDashboardActions(),{authToken:c,tokenProps:x}=t.useSemaphorContext();async function h(l){o(l)}async function p(l){if(await ht(x.apiServiceUrl,l,c==null?void 0:c.accessToken)){const v=n==null?void 0:n.filter(f=>f.id!==l);r(v||[]),o("original")}}async function j(l){const m=n==null?void 0:n.map(D=>D.id===l.id?{...D,isDefault:!l.isDefault}:{...D,isDefault:!1});r(m||[]);const v={...l,isDefault:!l.isDefault};await $e(x.apiServiceUrl,v,c==null?void 0:c.accessToken);const f=n==null?void 0:n.find(D=>D.isDefault);if(f&&f.id!==l.id){const D={...f,isDefault:!1};await $e(x.apiServiceUrl,D,c==null?void 0:c.accessToken)}}return e.jsxs(e.Fragment,{children:[s?e.jsxs(e.Fragment,{children:[e.jsx(t.DropdownMenuLabel,{className:"px-3",children:"Lenses"}),e.jsx(t.DropdownMenuSeparator,{})]}):null,e.jsxs(t.DropdownMenuRadioGroup,{value:a,onValueChange:h,children:[e.jsx(t.DropdownMenuRadioItem,{value:"original",children:"Original"}),n==null?void 0:n.map(l=>e.jsxs(t.DropdownMenuRadioItem,{className:"group flex justify-between gap-2",value:l.id,children:[e.jsx("p",{children:l.name}),e.jsxs("span",{className:"flex items-center gap-3",children:[e.jsx(t.House,{onClick:m=>{m.preventDefault(),j(l)},className:d.cn("size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",{invisible:!l.isDefault,"text-green-500":l.isDefault}),strokeWidth:1.5}),e.jsx(t.Cross2Icon,{onClick:m=>{m.preventDefault(),p(l.id)},className:"invisible size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",strokeWidth:1.5})]})]},l.id))]})]})}function gt(){const{displayPreferences:s,shouldShowElement:n}=t.useDisplayPreferences(),{currentUser:a,userContext:r}=t.useCurrentUserInfo(),o=g.useMemo(()=>t.getRoleBasedDisplayOverrides(a),[a]),c=g.useMemo(()=>h=>o&&o[h]!==void 0&&o[h]===!1?!1:n(h),[o,n,s]),x=g.useMemo(()=>{var h,p,j,l,m;return{canEdit:((h=r==null?void 0:r.permissions)==null?void 0:h.canEdit)??t.canUserEdit(a),canUseFilters:((p=r==null?void 0:r.permissions)==null?void 0:p.canEdit)??t.canUserUseFilters(a),canManageDashboards:((j=r==null?void 0:r.permissions)==null?void 0:j.canCreateDashboard)??t.canUserManageDashboards(a),canCreateDashboards:((l=r==null?void 0:r.permissions)==null?void 0:l.canCreateDashboard)??t.canUserCreateDashboards(a),canAccessVisuals:((m=r==null?void 0:r.permissions)==null?void 0:m.canEdit)??t.canUserAccessVisuals(a)}},[a,r]);return{displayPreferences:s,shouldShowElement:c,permissions:x,currentUser:a}}var Ge="Avatar",[bt]=d.createContextScope(Ge),vt=[0,()=>{}],[yt,Ns]=bt(Ge),ze=L.forwardRef((s,n)=>{const{__scopeAvatar:a,...r}=s,[o,c]=L.useState("idle"),[x,h]=wt();return e.jsx(yt,{scope:a,imageLoadingStatus:o,setImageLoadingStatus:c,imageCount:x,setImageCount:h,children:e.jsx(d.Primitive.span,{...r,ref:n})})});ze.displayName=Ge;var Ss="AvatarImage",_e=L.forwardRef((s,n)=>{const{__scopeAvatar:a,src:r,onLoadingStatusChange:o,...c}=s,x=Ns(Ss,a);Dt(x.setImageCount);const h=jt(r,{referrerPolicy:c.referrerPolicy,crossOrigin:c.crossOrigin,loadingStatus:x.imageLoadingStatus,setLoadingStatus:x.setImageLoadingStatus}),p=d.useCallbackRef(l=>{o==null||o(l)}),j=L.useRef(h);return d.useLayoutEffect2(()=>{const l=j.current;j.current=h,h!==l&&p(h)},[h,p]),h==="loaded"?e.jsx(d.Primitive.img,{...c,ref:n,src:r}):null});_e.displayName=Ss;var Cs="AvatarFallback",He=L.forwardRef((s,n)=>{const{__scopeAvatar:a,delayMs:r,...o}=s,c=Ns(Cs,a),[x,h]=L.useState(r===void 0);return L.useEffect(()=>{if(r!==void 0){const p=window.setTimeout(()=>h(!0),r);return()=>window.clearTimeout(p)}},[r]),x&&c.imageLoadingStatus!=="loaded"?e.jsx(d.Primitive.span,{...o,ref:n}):null});He.displayName=Cs;function jt(s,{loadingStatus:n,setLoadingStatus:a,referrerPolicy:r,crossOrigin:o}){return d.useLayoutEffect2(()=>{if(!s){a("error");return}const c=new window.Image,x=p=>{const j=p.currentTarget;a(gs(j))},h=()=>a("error");return c.addEventListener("load",x),c.addEventListener("error",h),r&&(c.referrerPolicy=r),c.crossOrigin=o??null,c.src=s,a(gs(c)),()=>{c.removeEventListener("load",x),c.removeEventListener("error",h),a("idle")}},[s,o,r,a]),n}function gs(s){return s.complete?s.naturalWidth>0?"loaded":"error":"loading"}function wt(){let s=vt;{s=L.useState(0);const[n]=s,a=L.useRef(!1);L.useEffect(()=>{n>1&&!a.current&&(a.current=!0,console.warn("Avatar: Only one `Avatar.Image` component should be rendered per `Avatar.Root`, but multiple were detected. This will lead to unexpected behavior."))},[n])}return s}function Dt(s){L.useEffect(()=>(s(n=>n+1),()=>{s(n=>n-1)}),[s])}const ks=L.forwardRef(({className:s,...n},a)=>e.jsx(ze,{ref:a,className:d.cn("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",s),...n}));ks.displayName=ze.displayName;const Nt=L.forwardRef(({className:s,...n},a)=>e.jsx(_e,{ref:a,className:d.cn("aspect-square h-full w-full",s),...n}));Nt.displayName=_e.displayName;const Ms=L.forwardRef(({className:s,...n},a)=>e.jsx(He,{ref:a,className:d.cn("flex h-full w-full items-center justify-center rounded-full bg-muted",s),...n}));Ms.displayName=He.displayName;const St=async(s,n,a)=>{const r=`${s}/management/v1/groups`;return await d.postRequestRegular(r,n,a)},Ct=async(s,n,a,r)=>{const o=`${s}/management/v1/groups/${a}`;return d.requestJsonRegular(o,n,"PATCH",r)},kt=async(s,n,a)=>{const r=`${s}/management/v1/groups/${a}`;await d.requestJsonRegular(r,n,"DELETE")},Mt=async(s,n,a,r)=>{const o=`${s}/management/v1/groups/${a}/members`;return await d.postRequestRegular(o,n,r)},It=async(s,n,a,r)=>{const o=`${s}/management/v1/groups/${a}/members`;await d.requestJsonRegular(o,n,"DELETE",r)};function Lt(){const{authToken:s,tokenProps:n}=t.useSemaphorContext(),a=t.useQueryClient();return t.useMutation({mutationFn:r=>St(n.apiServiceUrl,(s==null?void 0:s.accessToken)||"",r),onSuccess:()=>{a.invalidateQueries({queryKey:["groups"]}),t.ue.success("Group created successfully")},onError:r=>{console.error("Failed to create group:",r),t.ue.error("Failed to create group",{description:d.getRequestErrorMessage(r,"Failed to create group")})}})}function Et(){const{authToken:s,tokenProps:n}=t.useSemaphorContext(),a=t.useQueryClient();return t.useMutation({mutationFn:({groupId:r,data:o})=>Ct(n.apiServiceUrl,(s==null?void 0:s.accessToken)||"",r,o),onSuccess:(r,o)=>{a.invalidateQueries({queryKey:["group",o.groupId]}),a.invalidateQueries({queryKey:["groups"]}),t.ue.success("Group updated successfully")},onError:r=>{console.error("Failed to update group:",r),t.ue.error("Failed to update group",{description:d.getRequestErrorMessage(r,"Failed to update group")})}})}function At(){const{authToken:s,tokenProps:n}=t.useSemaphorContext(),a=t.useQueryClient();return t.useMutation({mutationFn:r=>kt(n.apiServiceUrl,(s==null?void 0:s.accessToken)||"",r),onSuccess:(r,o)=>{a.invalidateQueries({queryKey:["groups"]}),a.removeQueries({queryKey:["group",o]}),t.ue.success("Group deleted successfully")},onError:r=>{console.error("Failed to delete group:",r),t.ue.error("Failed to delete group",{description:d.getRequestErrorMessage(r,"Failed to delete group")})}})}function Pt(){const{authToken:s,tokenProps:n}=t.useSemaphorContext(),a=t.useQueryClient();return t.useMutation({mutationFn:({groupId:r,data:o})=>Mt(n.apiServiceUrl,(s==null?void 0:s.accessToken)||"",r,o),onSuccess:(r,o)=>{a.invalidateQueries({queryKey:["group",o.groupId]}),a.invalidateQueries({queryKey:["group-members",o.groupId]}),a.invalidateQueries({queryKey:["groups"]}),t.ue.success("Members added successfully")},onError:r=>{console.error("Failed to add group members:",r),t.ue.error("Failed to add members",{description:d.getRequestErrorMessage(r,"Failed to add members")})}})}function Rt(){const{authToken:s,tokenProps:n}=t.useSemaphorContext(),a=t.useQueryClient();return t.useMutation({mutationFn:({groupId:r,data:o})=>It(n.apiServiceUrl,(s==null?void 0:s.accessToken)||"",r,o),onSuccess:(r,o)=>{a.invalidateQueries({queryKey:["group",o.groupId]}),a.invalidateQueries({queryKey:["group-members",o.groupId]}),a.invalidateQueries({queryKey:["groups"]}),t.ue.success("Members removed successfully")},onError:r=>{console.error("Failed to remove group members:",r),t.ue.error("Failed to remove members",{description:d.getRequestErrorMessage(r,"Failed to remove members")})}})}const Ut=[];function Ft({open:s,onOpenChange:n}){var S,E,N;const{tokenProps:a}=t.useSemaphorContext(),{currentUser:r}=t.useCurrentUserInfo(),o=(r==null?void 0:r.type)==="tenant",c=a==null?void 0:a.tenantId,{groups:x,isLoading:h,error:p,refetch:j}=t.useGroups({type:o?"TENANT_GROUP":"all",tenantId:o?c:void 0,includeMembers:!1}),l=p?Is(p,"Unable to load groups."):null,[m,v]=g.useState({kind:"list"}),[f,D]=g.useState(null),w=At();g.useEffect(()=>{s||(v({kind:"list"}),D(null))},[s]);const u=m.kind==="members"&&x.find(y=>y.id===m.groupId)||null,k=async()=>{if(f)try{await w.mutateAsync(f.id),D(null),v({kind:"list"}),j()}catch{}};return e.jsx(t.Dialog,{open:s,onOpenChange:n,children:e.jsxs(t.DialogContent,{className:"flex max-h-[640px] w-[720px] max-w-[92vw] flex-col gap-0 overflow-hidden p-0",children:[m.kind==="list"?e.jsxs("div",{className:"shrink-0 border-b border-border px-5 pt-4 pb-3.5",children:[e.jsx(t.DialogTitle,{className:"text-[15px] font-semibold tracking-tight",children:"Group management"}),e.jsx(t.DialogDescription,{className:"mt-1 text-[12px] leading-[1.5] text-muted-foreground",children:"Organize people into groups for shared access."})]}):m.kind==="create"?e.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-1.5 border-b border-border px-5",children:[e.jsx("button",{type:"button",onClick:()=>v({kind:"list"}),"aria-label":"Back",className:"-ml-1 flex h-6 w-6 items-center justify-center rounded-[3px] text-muted-foreground hover:bg-accent hover:text-foreground",children:e.jsx(t.ArrowLeft,{className:"h-3.5 w-3.5"})}),e.jsx(t.DialogTitle,{className:"truncate text-[13px] font-medium",children:"New group"}),e.jsx(t.DialogDescription,{className:"sr-only",children:"Create a new group to organize members."})]}):null,m.kind==="list"&&e.jsx(Tt,{groups:x,isLoading:h,errorMessage:l,onRetry:()=>j(),currentUserId:r==null?void 0:r.id,onOpenGroup:y=>v({kind:"members",groupId:y}),onCreate:()=>v({kind:"create"}),onDeleteRequest:y=>D(y)}),m.kind==="members"&&u&&e.jsx(qt,{group:u,isTenantViewer:o,canEdit:((S=u.permissions)==null?void 0:S.canEdit)??u.createdBy===(r==null?void 0:r.id),canDelete:((E=u.permissions)==null?void 0:E.canDelete)??u.createdBy===(r==null?void 0:r.id),canManageMembers:((N=u.permissions)==null?void 0:N.canManageMembers)??u.createdBy===(r==null?void 0:r.id),onBack:()=>v({kind:"list"}),onMembersChanged:j,onUpdated:j,onRequestDelete:()=>D(u)},u.id),m.kind==="create"&&e.jsx(Bt,{isTenantUser:o,tenantId:c,onCancel:()=>v({kind:"list"}),onCreated:y=>{j(),v({kind:"members",groupId:y})}}),f&&e.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-t border-border bg-muted/40 px-5 py-2.5",children:[e.jsxs("div",{className:"min-w-0 text-[12px] text-foreground",children:["Delete ",e.jsx("span",{className:"font-medium",children:f.name}),"?",e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Members lose any access granted via this group."})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[e.jsx("button",{type:"button",onClick:()=>D(null),disabled:w.isPending,className:"h-7 rounded-[5px] px-2.5 text-[12px] font-medium text-foreground/80 hover:bg-background",children:"Cancel"}),e.jsxs("button",{type:"button",onClick:k,disabled:w.isPending,className:"inline-flex h-7 items-center gap-1.5 rounded-[5px] bg-rose-600 px-2.5 text-[12px] font-medium text-white hover:bg-rose-700 disabled:opacity-60",children:[w.isPending?e.jsx(d.LoaderCircle,{className:"h-3 w-3 animate-spin"}):e.jsx(t.Trash2,{className:"h-3 w-3"}),"Delete group"]})]})]})]})})}function Tt({groups:s,isLoading:n,errorMessage:a,onRetry:r,currentUserId:o,onOpenGroup:c,onCreate:x,onDeleteRequest:h}){const[p,j]=g.useState(""),l=g.useMemo(()=>s.filter(m=>!p.trim()||m.name.toLowerCase().includes(p.toLowerCase())||(m.description||"").toLowerCase().includes(p.toLowerCase())),[s,p]);return e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-5 py-2.5",children:[e.jsxs("div",{className:"flex flex-1 items-center gap-2 rounded-[5px] border border-border bg-background px-2 focus-within:border-foreground/40",children:[e.jsx(ys.Search,{className:"h-3 w-3 text-muted-foreground"}),e.jsx("input",{value:p,onChange:m=>j(m.target.value),placeholder:"Search groups…",className:"h-7 flex-1 bg-transparent text-[12px] text-foreground placeholder:text-muted-foreground focus:outline-none"}),p&&e.jsx("button",{type:"button",onClick:()=>j(""),className:"flex h-4 w-4 items-center justify-center rounded-[3px] text-muted-foreground hover:bg-accent hover:text-foreground",children:e.jsx(U.X,{className:"h-2.5 w-2.5"})})]}),e.jsxs("button",{type:"button",onClick:x,className:"inline-flex h-7 items-center gap-1.5 rounded-[5px] bg-foreground px-2.5 text-[12px] font-medium text-background hover:opacity-90",children:[e.jsx(t.Plus,{className:"h-3 w-3"}),"New group"]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:n?e.jsx("div",{className:"space-y-px p-3",children:[1,2,3].map(m=>e.jsx("div",{className:"h-12 animate-pulse rounded-[4px] bg-muted/60"},m))}):a?e.jsx(Ls,{title:"Can't load groups",message:a,onRetry:r}):l.length===0&&s.length===0?e.jsx(Vt,{onCreate:x}):l.length===0?e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-1 py-10 text-center",children:[e.jsxs("div",{className:"text-[12px] text-foreground",children:['No groups match "',p,'"']}),e.jsx("div",{className:"text-[11px] text-muted-foreground",children:"Try a different search."})]}):l.map(m=>{var v;return e.jsx(Ot,{group:m,canDelete:((v=m.permissions)==null?void 0:v.canDelete)??m.createdBy===o,onClick:()=>c(m.id),onDelete:()=>h(m)},m.id)})})]})}function Ot({group:s,canDelete:n,onClick:a,onDelete:r}){let o="";try{o=js.format(new Date(s.createdAt),"MMM d, yyyy")}catch{o=""}return e.jsxs("button",{type:"button",onClick:a,className:"group flex w-full items-center gap-3 border-b border-border/60 px-5 py-2.5 text-left hover:bg-accent/40",children:[e.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-[4px] border border-border bg-background text-muted-foreground",children:e.jsx(t.UsersRound,{className:"h-3.5 w-3.5"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-[13px] font-medium text-foreground",children:s.name}),e.jsxs("div",{className:"mt-0.5 flex items-center gap-2 text-[11px] text-muted-foreground",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(ws,{className:"h-2.5 w-2.5"}),s.memberCount," member",s.memberCount===1?"":"s"]}),o&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-border",children:"·"}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(t.Calendar,{className:"h-2.5 w-2.5"}),o]})]}),s.description&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-border",children:"·"}),e.jsx("span",{className:"truncate text-muted-foreground",children:s.description})]})]})]}),e.jsxs("div",{className:"flex items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100",children:[n&&e.jsx("span",{role:"button",tabIndex:0,onClick:c=>{c.stopPropagation(),r()},onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),c.stopPropagation(),r())},"aria-label":`Delete ${s.name}`,className:"flex h-6 w-6 items-center justify-center rounded-[3px] text-muted-foreground hover:bg-accent hover:text-foreground",children:e.jsx(t.Trash2,{className:"h-3 w-3"})}),e.jsx(ys.ChevronRight,{className:"h-3.5 w-3.5 text-muted-foreground"})]})]})}function Vt({onCreate:s}){return e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 py-12 text-center",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-full border border-border bg-muted/40 text-muted-foreground",children:e.jsx(t.Users,{className:"h-4 w-4"})}),e.jsx("div",{className:"text-[13px] font-medium text-foreground",children:"No groups yet"}),e.jsx("div",{className:"max-w-[320px] text-[11.5px] leading-[1.55] text-muted-foreground",children:"Groups let you grant shared access to dashboards. Create one and add members."}),e.jsxs("button",{type:"button",onClick:s,className:"mt-1 inline-flex h-7 items-center gap-1.5 rounded-[5px] bg-foreground px-2.5 text-[12px] font-medium text-background hover:opacity-90",children:[e.jsx(t.Plus,{className:"h-3 w-3"}),"New group"]})]})}function qt({group:s,isTenantViewer:n,canEdit:a,canDelete:r,canManageMembers:o,onBack:c,onMembersChanged:x,onUpdated:h,onRequestDelete:p}){const{data:j,isLoading:l,error:m,refetch:v}=t.useGroupMembers(s.id),f=(j==null?void 0:j.members)??Ut,D=m?Is(m,"Unable to load members for this group."):null,w=s.type==="TENANT_GROUP"?"tenant":"organization",{users:u}=t.useUnifiedUsers({type:w,tenantId:s.tenantId||void 0,active:!0,limit:200}),k=g.useMemo(()=>new Set(f.map(b=>b.userId)),[f]),S=Pt(),E=Rt(),N=Et(),[y,q]=g.useState(!1),[B,$]=g.useState(s.name),[Ce,G]=g.useState(!1),[J,z]=g.useState(s.description||""),[X,Y]=g.useState(""),[ce,Q]=g.useState(!1),ke=g.useMemo(()=>{const b=X.trim().toLowerCase();return u.filter(A=>!k.has(A.id)).filter(A=>!b||(A.name||"").toLowerCase().includes(b)||(A.email||"").toLowerCase().includes(b)).slice(0,50)},[u,k,X]),Z=async()=>{const b=B.trim();if(q(!1),b.length>=3&&b!==s.name)try{await N.mutateAsync({groupId:s.id,data:{name:b}}),h()}catch{}},ue=async()=>{const b=J.trim();if(G(!1),b!==(s.description||""))try{await N.mutateAsync({groupId:s.id,data:{description:b}}),h()}catch{}},me=async b=>{if(o){Y(""),Q(!1);try{await S.mutateAsync({groupId:s.id,data:{userIds:[b.id],userType:w==="tenant"?"tenant":"org"}}),v(),x()}catch{}}},Me=async b=>{if(o)try{await E.mutateAsync({groupId:s.id,data:{userIds:[b]}}),v(),x()}catch{}};let F="";try{F=js.format(new Date(s.createdAt),"MMM d, yyyy")}catch{F=""}return e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-1.5 border-b border-border px-5",children:[e.jsx("button",{type:"button",onClick:c,"aria-label":"Back",className:"-ml-1 flex h-6 w-6 items-center justify-center rounded-[3px] text-muted-foreground hover:bg-accent hover:text-foreground",children:e.jsx(t.ArrowLeft,{className:"h-3.5 w-3.5"})}),y?e.jsx("input",{autoFocus:!0,value:B,onChange:b=>$(b.target.value),onBlur:Z,onKeyDown:b=>{b.key==="Enter"&&Z(),b.key==="Escape"&&($(s.name),q(!1))},className:"h-6 min-w-0 flex-1 rounded-[3px] border border-border bg-background px-1.5 text-[13px] font-medium text-foreground focus:border-foreground/40 focus:outline-none"}):e.jsx("button",{type:"button",onClick:()=>{a&&($(s.name),q(!0))},title:a?"Click to rename":s.name,disabled:!a,className:"truncate rounded-[3px] px-1 text-[13px] font-medium text-foreground enabled:hover:bg-accent disabled:cursor-default",children:s.name}),e.jsxs("span",{className:"ml-1 inline-flex shrink-0 items-center gap-1 text-[10.5px] text-muted-foreground",children:[e.jsx(ws,{className:"h-2.5 w-2.5"}),f.length," member",f.length===1?"":"s"]})]}),e.jsx("div",{className:"shrink-0 border-b border-border px-5 py-2.5",children:Ce?e.jsxs("div",{children:[e.jsx("textarea",{autoFocus:!0,rows:2,value:J,onChange:b=>z(b.target.value),maxLength:200,onKeyDown:b=>{b.key==="Escape"&&(z(s.description||""),G(!1)),b.key==="Enter"&&(b.metaKey||b.ctrlKey)&&ue()},placeholder:"What is this group for?",className:"block w-full resize-none rounded-[5px] border border-border bg-background px-2 py-1.5 text-[12px] text-foreground placeholder:text-muted-foreground focus:border-foreground/40 focus:outline-none"}),e.jsxs("div",{className:"mt-1.5 flex items-center justify-between",children:[e.jsxs("span",{className:"text-[10.5px] text-muted-foreground",children:[J.length,"/200 · Esc to cancel · ⌘↩ to save"]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("button",{type:"button",onClick:()=>{z(s.description||""),G(!1)},className:"h-6 rounded-[5px] px-2 text-[11px] font-medium text-foreground/80 hover:bg-accent",children:"Cancel"}),e.jsx("button",{type:"button",onClick:ue,className:"inline-flex h-6 items-center rounded-[5px] bg-foreground px-2 text-[11px] font-medium text-background hover:opacity-90",children:"Save"})]})]})]}):e.jsxs("button",{type:"button",onClick:()=>{a&&(z(s.description||""),G(!0))},disabled:!a,title:a?"Click to edit description":void 0,className:"block w-full rounded-[3px] px-1 py-0.5 text-left enabled:hover:bg-accent/40 disabled:cursor-default",children:[s.description?e.jsx("p",{className:"text-[12px] leading-[1.55] text-foreground/90",children:s.description}):e.jsx("p",{className:"text-[12px] leading-[1.55] text-muted-foreground",children:a?"Add a description…":"No description"}),e.jsxs("p",{className:"mt-1 text-[10.5px] text-muted-foreground",children:[F?`Created ${F}`:"Recently created",a?" · You can edit this group":""]})]})}),o&&e.jsx($t,{query:X,setQuery:Y,open:ce,setOpen:Q,candidates:ke,showKindChip:!n,onAdd:me,busy:S.isPending}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:l?e.jsx("div",{className:"space-y-px p-3",children:[1,2,3].map(b=>e.jsx("div",{className:"h-10 animate-pulse rounded-[4px] bg-muted/60"},b))}):D?e.jsx(Ls,{title:"Can't load members",message:D,onRetry:()=>v()}):f.length===0?e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-1 py-10 text-center",children:[e.jsx("div",{className:"text-[12px] text-foreground",children:"No members yet"}),e.jsx("div",{className:"text-[11px] text-muted-foreground",children:o?"Search above to add people to this group.":"This group does not have any members."})]}):f.map(b=>{var A,ee,_,se,H,he;return e.jsxs("div",{className:"group flex items-center gap-2 border-b border-border/60 px-5 py-2",children:[e.jsx(Es,{name:((A=b.user)==null?void 0:A.name)||((ee=b.user)==null?void 0:ee.email)||"?"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-[12.5px] font-medium text-foreground",children:((_=b.user)==null?void 0:_.name)||((se=b.user)==null?void 0:se.email)||"Unknown"}),((H=b.user)==null?void 0:H.email)&&b.user.name&&e.jsx("div",{className:"truncate text-[10.5px] text-muted-foreground",children:b.user.email})]}),!n&&e.jsx("span",{className:"text-[10px] uppercase tracking-[0.06em] text-muted-foreground",children:b.userType}),e.jsx("button",{type:"button",onClick:()=>Me(b.userId),disabled:!o||E.isPending,"aria-label":`Remove ${((he=b.user)==null?void 0:he.name)||"member"}`,className:"flex h-6 w-6 items-center justify-center rounded-[3px] text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-foreground group-hover:opacity-100 disabled:opacity-30",children:e.jsx(U.X,{className:"h-3 w-3"})})]},b.id)})}),r&&e.jsx("div",{className:"flex shrink-0 items-center justify-end gap-1.5 border-t border-border bg-muted/30 px-5 py-2.5",children:e.jsxs("button",{type:"button",onClick:p,className:"inline-flex h-7 items-center gap-1.5 rounded-[5px] border border-rose-200 bg-background px-2.5 text-[12px] font-medium text-rose-600 hover:bg-rose-50 dark:border-rose-900/60 dark:text-rose-400 dark:hover:bg-rose-950/30",children:[e.jsx(t.Trash2,{className:"h-3 w-3"}),"Delete group"]})})]})}function Bt({isTenantUser:s,tenantId:n,onCancel:a,onCreated:r}){const[o,c]=g.useState(""),[x,h]=g.useState(""),[p,j]=g.useState(null),l=Lt(),m=o.trim().length>=3&&o.trim().length<=50,v=async()=>{if(!m)return;j(null);const f={name:o.trim(),description:x.trim()||void 0,type:s?"TENANT_GROUP":"ORG_GROUP",...s&&n?{tenantId:n}:{}};try{const D=await l.mutateAsync(f),w=D==null?void 0:D.id;w?r(w):a()}catch(D){j(D instanceof Error?D.message:"Failed to create group")}};return e.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex-1 overflow-y-auto px-5 py-4",children:[e.jsx(bs,{children:"Name"}),e.jsx("input",{autoFocus:!0,value:o,onChange:f=>c(f.target.value),placeholder:"Marketing leads, North America sales, …",maxLength:50,className:"mt-1 block h-7 w-full rounded-[5px] border border-border bg-background px-2 text-[12px] text-foreground placeholder:text-muted-foreground focus:border-foreground/40 focus:outline-none"}),e.jsx("div",{className:"mt-1 text-[10.5px] text-muted-foreground",children:"3–50 characters."}),e.jsxs("div",{className:"mt-4",children:[e.jsx(bs,{children:"Description (optional)"}),e.jsx("textarea",{rows:2,value:x,onChange:f=>h(f.target.value),maxLength:200,placeholder:"What is this group for?",className:"mt-1 block w-full resize-none rounded-[5px] border border-border bg-background px-2 py-1.5 text-[12px] text-foreground placeholder:text-muted-foreground focus:border-foreground/40 focus:outline-none"}),e.jsxs("div",{className:"mt-1 flex justify-end text-[10.5px] text-muted-foreground",children:[x.length,"/200"]})]}),p&&e.jsx("div",{className:"mt-3 rounded-[5px] border border-rose-200 bg-rose-50 px-2 py-1.5 text-[11.5px] text-rose-700 dark:border-rose-900/60 dark:bg-rose-950/30 dark:text-rose-300",children:p})]}),e.jsxs("div",{className:"flex shrink-0 items-center justify-end gap-1.5 border-t border-border bg-muted/30 px-5 py-2.5",children:[e.jsx("button",{type:"button",onClick:a,disabled:l.isPending,className:"h-7 rounded-[5px] px-2.5 text-[12px] font-medium text-foreground/80 hover:bg-accent",children:"Cancel"}),e.jsx("button",{type:"button",onClick:v,disabled:!m||l.isPending,className:"inline-flex h-7 items-center gap-1.5 rounded-[5px] bg-foreground px-2.5 text-[12px] font-medium text-background hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-60",children:l.isPending?e.jsxs(e.Fragment,{children:[e.jsx(d.LoaderCircle,{className:"h-3 w-3 animate-spin"}),"Creating…"]}):e.jsxs(e.Fragment,{children:[e.jsx(t.Plus,{className:"h-3 w-3"}),"Create group"]})})]})]})}function $t({query:s,setQuery:n,open:a,setOpen:r,candidates:o,showKindChip:c,onAdd:x,busy:h}){const p=g.useRef(null),j=g.useRef(null),[l,m]=g.useState(null);g.useLayoutEffect(()=>{if(!a){m(null);return}const f=()=>{const D=p.current;if(!D)return;const w=D.getBoundingClientRect(),u=240,S=window.innerHeight-w.bottom<u+16&&w.top>u;m({left:w.left,top:S?w.top-6:w.bottom+6,width:w.width,above:S})};return f(),window.addEventListener("resize",f),window.addEventListener("scroll",f,!0),()=>{window.removeEventListener("resize",f),window.removeEventListener("scroll",f,!0)}},[a,o.length]),g.useEffect(()=>{if(!a)return;const f=D=>{var u,k;const w=D.target;(u=p.current)!=null&&u.contains(w)||(k=j.current)!=null&&k.contains(w)||r(!1)};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[a,r]);const v=a&&o.length>0&&l;return e.jsxs("div",{className:"shrink-0 border-b border-border px-5 py-2.5",children:[e.jsxs("div",{ref:p,className:"flex items-center gap-2 rounded-[5px] border border-border bg-background px-2 focus-within:border-foreground/40",children:[e.jsx(ct,{className:"h-3 w-3 text-muted-foreground"}),e.jsx("input",{value:s,onChange:f=>{n(f.target.value),r(!0)},onFocus:()=>r(!0),placeholder:"Add a member by name or email…",disabled:h,className:"h-7 flex-1 bg-transparent text-[12px] text-foreground placeholder:text-muted-foreground focus:outline-none disabled:cursor-not-allowed"})]}),v&&typeof document<"u"&&Zs.createPortal(e.jsx("div",{ref:j,style:{position:"fixed",left:l.left,top:l.top,width:l.width,transform:l.above?"translateY(-100%)":void 0},className:"z-[60] max-h-[240px] overflow-y-auto rounded-[5px] border border-border bg-background shadow-[0_8px_24px_-12px_rgba(0,0,0,0.18)]",children:o.map(f=>e.jsxs("button",{type:"button",onClick:()=>x(f),className:"flex w-full items-center gap-2 border-b border-border/60 px-2.5 py-2 text-left last:border-b-0 hover:bg-accent",children:[e.jsx(Es,{name:f.name||f.email||"?"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-[12px] font-medium text-foreground",children:f.name||f.email||"Unknown"}),f.email&&f.name&&e.jsx("div",{className:"truncate text-[10.5px] text-muted-foreground",children:f.email})]}),c&&f.type&&e.jsx("span",{className:"text-[10px] uppercase tracking-[0.06em] text-muted-foreground",children:f.type==="tenant"?"tenant":"org"})]},f.id))}),document.body)]})}function Is(s,n){if(!s)return n;if(s instanceof Error){const a=s.message||"",r=a.match(/\{[\s\S]*"error"\s*:\s*"([^"]+)"[\s\S]*\}/);return r?r[1]:a||n}return typeof s=="string"?s:n}function Ls({title:s,message:n,onRetry:a}){return e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 px-6 py-10 text-center",children:[e.jsx("div",{className:"text-[12.5px] font-medium text-foreground",children:s}),e.jsx("div",{className:"max-w-[360px] text-[11.5px] leading-[1.55] text-muted-foreground",children:n}),a&&e.jsx("button",{type:"button",onClick:a,className:"mt-1 inline-flex h-7 items-center rounded-[5px] border border-border bg-background px-2.5 text-[11.5px] font-medium text-foreground hover:bg-accent",children:"Try again"})]})}function bs({children:s}){return e.jsx("label",{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:s})}function Es({name:s}){const n=s.split(" ").map(a=>a[0]).filter(Boolean).slice(0,2).join("").toUpperCase();return e.jsx(ks,{className:"h-6 w-6 shrink-0",children:e.jsx(Ms,{className:"text-[9px] font-semibold",children:n||"?"})})}function de(s,n,a){var c,x;const r=(s.controls||[]).find(h=>h.id===a);if(r)return r.label;const o=(x=(c=d.findCardById(s,n))==null?void 0:c.controls)==null?void 0:x.find(h=>h.id===a);return(o==null?void 0:o.label)||a}function le(s,n){var a;return((a=d.findCardById(s,n))==null?void 0:a.title)||n}function Gt(s){const{errors:n,dashboard:a}=s;if(!a)return n;const r=new Map;for(const o of n){const c=o.match(/^Card '(.+)' binding for control '(.+)' maps to missing metric '(.+)'\.$/);if(c){const[,l,m]=c,v=`${l}:${m}:missing-metric`;r.has(v)||r.set(v,`"${le(a,l)}" has an outdated "${de(a,l,m)}" mapping. Some choices still point to metrics that are no longer available on this card. Open the card controls and choose replacements.`);continue}const x=o.match(/^Card '(.+)' binding for control '(.+)' maps to missing group-by field '(.+)'\.$/);if(x){const[,l,m]=x,v=`${l}:${m}:missing-group-by`;r.has(v)||r.set(v,`"${le(a,l)}" has an outdated "${de(a,l,m)}" mapping. Some choices still point to fields that are no longer available on this card. Open the card controls and choose replacements.`);continue}const h=o.match(/^Card '(.+)' binding for control '(.+)' maps to an invalid metric target\.$/);if(h){const[,l,m]=h,v=`${l}:${m}:invalid-metric`;r.has(v)||r.set(v,`"${le(a,l)}" has an invalid "${de(a,l,m)}" metric mapping. Open the card controls and choose a valid metric for each option.`);continue}const p=o.match(/^Card '(.+)' binding for control '(.+)' maps to an invalid group-by target\.$/);if(p){const[,l,m]=p,v=`${l}:${m}:invalid-group-by`;r.has(v)||r.set(v,`"${le(a,l)}" has an invalid "${de(a,l,m)}" field mapping. Open the card controls and choose a valid field for each option.`);continue}const j=o.match(/^Card '(.+)' binding for control '(.+)' requires at least one temporal group-by field\.$/);if(j){const[,l,m]=j,v=`${l}:${m}:missing-temporal-group-by`;r.has(v)||r.set(v,`"${le(a,l)}" can no longer use "${de(a,l,m)}" for time grain because the card does not currently group by a date field.`);continue}r.set(o,o)}return Array.from(r.values())}function zt({visible:s,onSelect:n}){return s?e.jsxs(t.DropdownMenuItem,{onSelect:n,children:[e.jsx(t.CalendarClock,{className:"h-3.5 w-3.5"}),"Schedule email report"]}):null}function _t({scheduleReportVisible:s,analyticalBriefingVisible:n,onScheduleReport:a,onCreateAnalyticalBriefing:r}){return e.jsxs(e.Fragment,{children:[e.jsx(zt,{visible:s,onSelect:a}),n?e.jsxs(t.DropdownMenuItem,{onSelect:r,children:[e.jsx(t.Plus,{className:"h-3.5 w-3.5"}),"Create analytical briefing"]}):null]})}function vs(s,n){return{dashboard:t.cloneDeep(s),semanticExecutionPayload:t.cloneDeep(n)}}function Ht(){var ds,ls,cs,us,ms,hs,ps;V.useExportRecovery(),V.useExportPolling();const{authToken:s,tokenProps:n,id:a,showBriefings:r}=t.useSemaphorContext(),o=t.useBriefingUiCapabilities(),{isLocalDev:c}=t.useDashboardPreferences(),{openBrandStudioPreview:x}=t.useBrandStudioPreview(),{permissions:h}=gt(),p=t.useHasDashboardId(),{isLoading:j}=t.useDashboardQuery(),l=d.useDashboardStore(i=>i.theme),m=d.useDashboardStore(i=>i.isDownloadingPdf),v=d.useDashboardStore(i=>i.dashboardAssistantDraftScopeKey),f=d.useDashboardStore(i=>i.lenses),D=d.useDashboardStore(i=>i.selectedLensId),w=f==null?void 0:f.find(i=>i.id===D),u=d.useDashboardStore(i=>i.dashboard),k=d.useDashboardStore(i=>i.selectedSheetId),S=(ds=u==null?void 0:u.sheets)==null?void 0:ds.find(i=>i.id===k),E=d.isDocumentSheet(S),N=E?(ls=S==null?void 0:S.document)==null?void 0:ls.page:void 0,y=d.useDashboardStore(i=>i.isDashboardEditing),{setDashboardTitle:q}=d.useDashboardStore(i=>i.actions),[B,$]=g.useState(!1),[Ce,G]=g.useState(!1),[J,z]=g.useState(!1),[X,Y]=g.useState(!1),[ce,Q]=g.useState(null),[ke,Z]=g.useState(!1),[ue,me]=g.useState(!1),[Me,F]=g.useState(!1),[b,A]=g.useState(null),[ee,_]=g.useState([]),[se,H]=g.useState(!1),[he,Ke]=g.useState(!1),Qe=d.useDashboardStore(i=>i.filterValues),M=d.useDashboardStore(i=>i.isVisualEditing);d.useEditorStore(i=>i.card);const te=t.useManagementStore(i=>i.selectedDashboard),pe=t.useManagementStore(i=>i.initialDashboard);t.useManagementStore(i=>i.selectedVisual),d.useDashboardStore(i=>i.selectedFrameId),d.useEditorStore(i=>i.frame);const xe=te?(us=te==null?void 0:te.permissions)==null?void 0:us.canEdit:(cs=pe==null?void 0:pe.permissions)==null?void 0:cs.canEdit,We=d.useDashboardStore(i=>i.showDashboardJSON),Ie=d.useDashboardStore(i=>i.onSaveFunction),{setIsDashboardEditing:Je,setShowDashboardJSON:Xe}=d.useDashboardStore(i=>i.actions),{setInitialDashboard:Ye,clearSelectedDashboard:Le}=t.useManagementStore(i=>i.actions),re=!!n.orgUserId||!!(n.tenantId&&n.endUserId&&n.endUserEmail),{resources:fe}=t.useResourceManagement(t.ResourceType.DASHBOARD),{data:Ee}=t.useUserPreferences(),As=((ms=Ee==null?void 0:Ee.preference)==null?void 0:ms.defaultDashboardId)||null,{mutate:Ps,isPending:Rs}=t.useDefaultDashboardMutation(),{currentUser:Us}=t.useCurrentUserInfo(),Fs=t.canUserManageGroups(Us),T=te||pe,W=t.resolveDashboardControlsVisibility({config:n.config,canNavigateDashboardHub:re,canShareDashboard:((hs=T==null?void 0:T.permissions)==null?void 0:hs.canShare)===!0,canManageGroups:Fs}),Ze=T?{id:T.id,title:(u==null?void 0:u.title)||T.title||"Dashboard"}:null,{handleAddNewFrame:Ts}=t.useAddNewFrame(),[Ae,Pe]=g.useState(!1),[Os,ae]=g.useState(!1),[Re,ge]=g.useState("close"),ne=t.useUpdateResource(t.ResourceType.DASHBOARD),[P,be]=g.useState(null),Vs=async(i,C)=>{if(!(u!=null&&u.id)){console.log("No dashboard ID found");return}console.log("Updating dashboard title:",{dashboardId:u.id,newTitle:i,previousTitle:C}),ne.mutate({resourceId:u.id,data:{title:i}},{onSuccess:()=>{console.log("Dashboard title updated successfully"),t.ue.success("Dashboard title updated")},onError:R=>{console.error("Failed to update dashboard title:",R),t.ue.error("Failed to update dashboard title"),q(C)}})};g.useEffect(()=>{if(fe&&fe.length>0){const i=u==null?void 0:u.id;if(i){const C=fe.find(R=>R.id===i);C&&Ye(C)}}},[fe,u==null?void 0:u.id,Ye]);const oe=n.orgUserId||n.tenantId,Ue=g.useMemo(()=>Kt({accessToken:s==null?void 0:s.accessToken,dashboardId:(u==null?void 0:u.id)||a||n.dashboard_id,selectedSheetId:E?k:void 0,pageSize:N==null?void 0:N.size,orientation:N==null?void 0:N.orientation,theme:l}),[s==null?void 0:s.accessToken,a,u==null?void 0:u.id,E,N==null?void 0:N.orientation,N==null?void 0:N.size,k,l,n.dashboard_id]),es=y&&!M&&oe&&xe,{setDashboard:ss}=d.useDashboardStore(i=>i.actions),ts=d.useDashboardStore(i=>i.semanticExecutionPayload),qs=()=>{Je(!0)},Fe=()=>{Je(!1),Xe(!1),be(null)};g.useEffect(()=>{if(!y){P&&be(null);return}P||!u||j||be(vs(u,ts))},[u,P,y,j,ts]);const ve=(P==null?void 0:P.dashboard)??null,{isDirty:rs,isDirtyPending:Bs,resetDirty:ye}=st.useDebouncedDirtyCheck(u,ve,300,1e3,Be.serializeDashboardForDirtyCheck),as=g.useCallback(()=>ve?Be.serializeDashboardForDirtyCheck(u)!==Be.serializeDashboardForDirtyCheck(ve):!1,[u,ve]),ns=rs||Bs,je=Ae||ne.isPending,$s=()=>{as()?(ge("close"),ae(!0)):(Fe(),ye())},Gs=async()=>{await Te({closeAfterSave:!0,navigateHomeAfterSave:Re==="home"})},zs=()=>{const i=Re==="home"&&!!re;P&&ss(P.dashboard,{semanticExecutionPayload:P.semanticExecutionPayload}),Fe(),i&&Le(),ge("close"),ae(!1),ye()},_s=()=>{P&&(ss(P.dashboard,{semanticExecutionPayload:P.semanticExecutionPayload}),ye())},Hs=()=>{if(re){if(y&&as()){ge("home"),ae(!0);return}Le()}};async function Te(i){const C=d.useDashboardStore.getState().dashboard;if(!C)return;const R=(i==null?void 0:i.closeAfterSave)??se,Oe=(i==null?void 0:i.navigateHomeAfterSave)??!1;H(R),R&&ae(!1);const Ve=t.cloneDeep(C);F(!0),A(null),_([]),Pe(!0);const Ys={template:C};ne.mutate({resourceId:C.id,data:Ys},{onSuccess:I=>{var we,De,xs;const K=(I==null?void 0:I.id)||((we=I==null?void 0:I.dashboard)==null?void 0:we.id)||((De=I==null?void 0:I.resource)==null?void 0:De.id)||((xs=I==null?void 0:I.template)==null?void 0:xs.id)||null;if(!C.id&&K){const qe=d.useAIInteractionStore.getState(),Ne=qe.pendingDashboardDraftMigration;(Ne==null?void 0:Ne.scopeKey)===v?qe.actions.setPendingDashboardDraftMigrationExpectedDashboardId(K):Ne&&qe.actions.clearPendingDashboardDraftMigration()}Pe(!1),t.ue.success("Dashboard saved!"),be(vs(Ve,d.useDashboardStore.getState().semanticExecutionPayload)),F(!1),H(!1),R&&(Fe(),ye(),Oe&&re&&Le()),ge("close")},onError:I=>{Pe(!1),A("Failed to save dashboard. Please try again.");const K=I.details,we=Array.isArray(K==null?void 0:K.errors)?(K.errors||[]).filter(De=>typeof De=="string"):[];_(Gt({errors:we,dashboard:C||void 0})),t.ue.error("Failed to save dashboard")}})}async function Ks(){if($(!0),!D||!w)return;const i=d.useDashboardStore.getState().dashboard;if(!i){$(!1);return}const C=JSON.stringify(i),R=d.useDashboardStore.getState(),Oe=Ds({dashboard:i,dashboardInputValues:R.dashboardInputValues,filterValues:Qe,controlValues:R.controlValues,inlineFilterValuesMap:R.inlineFilterValuesMap,cardControlValuesMap:R.cardControlValuesMap}),Ve={...w,template:C,filterValues:Qe,inputValues:Oe};await $e(n.apiServiceUrl,Ve,s==null?void 0:s.accessToken),t.ue.success("Lens saved"),Ie==null||Ie(i),$(!1)}const os=(w==null?void 0:w.name)||u.title;ne.isPending&&console.log("Title during update:",{title:os,dashboardStateTitle:u.title,dashboardId:u==null?void 0:u.id,currentLensName:w==null?void 0:w.name});const Qs=re&&!!(s!=null&&s.accessToken)&&!!(n!=null&&n.apiServiceUrl),Ws=W.showDashboardHub&&Qs,Js=p&&W.showDashboardHub,O=(u==null?void 0:u.id)||null,is=t.resolveDashboardBriefingsVisibility((ps=n.config)==null?void 0:ps.showBriefings,r),ie=!!O&&As===O,Xs=()=>{O&&Ps({dashboardId:ie?null:O})};return!p&&!M?null:e.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between gap-2 overflow-x-auto border-b px-4 py-2",role:"dashboard-controls",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[Js&&!M&&e.jsx(t.IconButton,{"aria-label":"Dashboard Hub",tooltip:"Dashboard Hub",onClick:Hs,className:"h-7 w-7 px-0",buttonProps:{size:"xs"},children:e.jsx(t.House,{className:"h-3.5 w-3.5"})}),!M&&p&&(j?e.jsx("div",{className:"h-4 w-28 animate-pulse rounded-md bg-muted/70","aria-label":"Loading dashboard title",role:"status",children:e.jsx("span",{className:"sr-only",children:"Loading dashboard title"})}):e.jsxs(e.Fragment,{children:[e.jsx(t.EditableText,{value:os||"Untitled Dashboard",onSave:i=>{console.log("EditableText onSave called:",{newTitle:i,canEditDashboard:xe,dashboardId:u==null?void 0:u.id});const C=(u==null?void 0:u.title)||"";q(i),Vs(i,C)},isEditable:t.resolveDashboardTitleEditability({isDashboardEditing:y,canEditDashboard:xe===!0,hasCurrentLens:!!w}),displayClassName:"text-[13px] font-medium",inputClassName:"text-[13px] font-medium",placeholder:"Dashboard Title",isPending:ne.isPending}),W.showDashboardHub&&ie&&e.jsx("span",{className:"shrink-0 rounded-[4px] border border-border/60 px-1.5 py-px text-[10px] font-medium uppercase tracking-[0.06em] text-muted-foreground",title:"Default dashboard",children:"Default"}),Ws&&O&&e.jsx(d.TooltipProvider,{children:e.jsxs(d.Tooltip,{children:[e.jsx(d.TooltipTrigger,{asChild:!0,children:e.jsx(d.Button,{variant:"ghost",size:"xs",onClick:Xs,disabled:Rs||!(s!=null&&s.accessToken)||!(n!=null&&n.apiServiceUrl),className:"w-7 px-0 text-muted-foreground hover:text-foreground","aria-label":ie?"Clear default dashboard":"Set as default dashboard",children:ie?e.jsx(t.PinOff,{className:"h-3.5 w-3.5"}):e.jsx(t.Pin,{className:"h-3.5 w-3.5"})})}),e.jsx(d.TooltipContent,{children:e.jsx("p",{children:ie?"Clear default":"Set as default"})})]})})]}))]}),e.jsxs("div",{className:"flex items-center gap-2",children:[M&&e.jsxs(e.Fragment,{children:[e.jsx(V.AdvancedModeToggle,{}),e.jsx(V.VisualEditingControls,{})]}),!M&&p&&W.showDashboardSharing&&e.jsxs(d.Button,{variant:"outline",size:"xs",onClick:()=>G(!0),children:[e.jsx(t.Share2,{className:"h-3.5 w-3.5"}),"Share"]}),!M&&y&&h.canUseFilters&&p&&e.jsx(V.DashboardFilterControlsLauncher,{}),y&&!M&&oe&&w&&c&&p&&e.jsxs(d.Button,{variant:"secondary",size:"xs",disabled:B,onClick:Ks,children:[e.jsx(fs.Save,{className:"h-3.5 w-3.5"}),"Save Lens"]}),y&&!M&&p&&!E&&e.jsxs("div",{className:"inline-flex h-7 items-stretch overflow-hidden rounded-control border border-input bg-background",children:[e.jsxs(d.Button,{variant:"ghost",size:"xs",disabled:!y,onClick:()=>void Ts(),className:"h-full rounded-none border-0 shadow-none hover:bg-accent",children:[e.jsx(t.Plus,{className:"h-3.5 w-3.5"}),"Visual"]}),e.jsxs(t.DropdownMenu,{modal:!1,children:[e.jsx(t.DropdownMenuTrigger,{asChild:!0,children:e.jsx(d.Button,{variant:"ghost",size:"xs",className:"h-full w-7 rounded-none border-0 border-l border-border/60 px-0 shadow-none hover:bg-accent","aria-label":"Open visual options",disabled:!y,children:e.jsx(U.ChevronDown,{className:"h-3.5 w-3.5"})})}),e.jsx(t.DropdownMenuContent,{align:"end",className:"z-[60] w-48 rounded-[6px] border-border/60 p-1 shadow-sm",children:e.jsxs(t.DropdownMenuItem,{onClick:()=>Ke(!0),children:[e.jsx(t.Plus,{className:"h-3.5 w-3.5"}),"From library..."]})})]}),e.jsx(V.VisualsLibraryDialog,{open:he,onOpenChange:Ke})]}),!M&&!y&&xe&&p&&e.jsxs(d.Button,{size:"xs",onClick:qs,children:[e.jsx(t.Pencil,{className:"h-3.5 w-3.5"}),"Edit"]}),es&&p&&rs&&e.jsxs(d.Button,{variant:"outline",size:"xs",onClick:_s,disabled:je,children:[e.jsx(t.Undo2,{className:"h-3.5 w-3.5"}),"Undo"]}),es&&p&&e.jsxs(d.Button,{size:"xs",className:d.cn(!ns&&"opacity-60"),disabled:je||!ns,onClick:()=>Te(),children:[je?e.jsx(d.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(fs.Save,{className:"h-3.5 w-3.5"}),je?"Saving...":"Save"]}),y&&!M&&p&&e.jsxs(d.Button,{variant:"outline",size:"xs",onClick:$s,children:[e.jsx(t.Cross2Icon,{className:"h-3.5 w-3.5"}),"Close"]}),!M&&p&&e.jsx("div",{className:"ml-2",children:e.jsx(V.NotificationBell,{})}),!M&&c&&e.jsx(ut,{}),!M&&p&&e.jsxs(t.DropdownMenu,{children:[e.jsx(t.DropdownMenuTrigger,{asChild:!0,children:e.jsx(t.IconButton,{tooltip:"More Options",className:"w-7 px-0 text-muted-foreground hover:text-foreground",buttonProps:{size:"xs",variant:"ghost","aria-label":"More dashboard options"},children:e.jsx(t.EllipsisVertical,{className:"h-3.5 w-3.5"})})}),e.jsxs(t.DropdownMenuContent,{align:"end",className:"w-56 rounded-control border border-border/60 p-1 shadow-sm",children:[e.jsx(t.DropdownMenuLabel,{children:"Reports & briefings"}),e.jsxs(t.DropdownMenuItem,{disabled:m,onSelect:()=>me(!0),children:[e.jsx(t.Download,{className:"h-3.5 w-3.5"}),"Export"]}),e.jsx(_t,{scheduleReportVisible:!!(is&&o.surfaceVisible&&O&&!y),analyticalBriefingVisible:!!(is&&o.surfaceVisible&&O&&!y),onScheduleReport:()=>Q("scheduled_report"),onCreateAnalyticalBriefing:()=>Q("analytical_briefing")}),e.jsx(t.DropdownMenuSeparator,{}),W.showGroupManagement&&e.jsxs(e.Fragment,{children:[e.jsx(t.DropdownMenuLabel,{children:"Access"}),e.jsxs(t.DropdownMenuItem,{onClick:()=>z(!0),children:[e.jsx(t.Users,{className:"h-3.5 w-3.5"}),"Manage Groups"]}),e.jsx(t.DropdownMenuSeparator,{})]}),e.jsx(t.DropdownMenuLabel,{children:"Preferences"}),e.jsxs(t.DropdownMenuItem,{onClick:()=>Y(!0),children:[e.jsx(t.Calendar,{className:"h-3.5 w-3.5"}),"Report preferences"]}),c&&p&&e.jsxs(e.Fragment,{children:[e.jsx(t.DropdownMenuSeparator,{}),e.jsx(t.DropdownMenuLabel,{children:"Developer"}),e.jsxs(t.DropdownMenuItem,{onSelect:()=>{var i;s!=null&&s.accessToken&&((i=navigator==null?void 0:navigator.clipboard)!=null&&i.writeText?navigator.clipboard.writeText(s.accessToken).then(()=>t.ue.success("Token copied to clipboard")).catch(()=>t.ue.error("Unable to copy token")):t.ue.error("Clipboard not available"))},children:[e.jsx(t.Copy,{className:"h-3.5 w-3.5"}),"Copy token"]}),E&&e.jsxs(t.DropdownMenuItem,{disabled:!Ue,onSelect:()=>{var i;if(!Ue){t.ue.error("Open a document sheet with a token to copy the local PDF URL");return}(i=navigator==null?void 0:navigator.clipboard)!=null&&i.writeText?navigator.clipboard.writeText(Ue).then(()=>t.ue.success("Local document PDF URL copied to clipboard")).catch(()=>t.ue.error("Unable to copy local document PDF URL")):t.ue.error("Clipboard not available")},children:[e.jsx(t.Copy,{className:"h-3.5 w-3.5"}),"Copy local document PDF URL"]}),e.jsxs(t.DropdownMenuItem,{onSelect:()=>d.invalidateToken(n.apiServiceUrl),children:[e.jsx(dt,{className:"h-3.5 w-3.5"}),"Invalidate token"]}),e.jsxs(t.DropdownMenuItem,{onSelect:x,children:[e.jsx(tt.Palette,{className:"h-3.5 w-3.5"}),"Brand Studio"]}),y&&e.jsxs(t.DropdownMenuItem,{onSelect:()=>Xe(!We),children:[e.jsx(rt.Braces,{className:"h-3.5 w-3.5"}),We?"Hide dashboard JSON":"Show dashboard JSON"]}),oe&&y&&e.jsxs(t.DropdownMenuItem,{onSelect:()=>Z(!0),children:[e.jsx(t.Plus,{className:"h-3.5 w-3.5"}),"Add lens"]}),oe&&e.jsxs(t.DropdownMenuSub,{children:[e.jsxs(t.DropdownMenuSubTrigger,{children:[e.jsx(nt,{className:"h-3.5 w-3.5"}),"Lenses"]}),e.jsx(t.DropdownMenuSubContent,{className:"w-60",children:e.jsx(ft,{})})]})]})]})]}),Ce&&Ze&&e.jsx(t.ShareDialog,{resource:Ze,resourceType:t.ResourceType.DASHBOARD,onClose:()=>G(!1)}),W.showGroupManagement&&e.jsx(Ft,{open:J,onOpenChange:z}),e.jsx(et.ReportPreferencesDialog,{open:X,onOpenChange:Y}),O&&ce?e.jsx(V.DashboardBriefingLauncher,{dashboardId:O,dashboardTitle:(u==null?void 0:u.title)||(T==null?void 0:T.title),open:!0,onOpenChange:i=>{i||Q(null)},hideTrigger:!0,workflowIntent:ce}):null,c&&oe&&p&&e.jsx(xt,{open:ke,onOpenChange:Z}),p&&e.jsx(t.DownloadPdf,{open:ue,onOpenChange:me}),e.jsx(t.AlertDialog,{open:Me,onOpenChange:i=>{!i&&Ae&&!b||(F(i),i||(A(null),_([]),H(!1)))},children:e.jsxs(t.AlertDialogContent,{className:"max-w-sm",children:[e.jsxs(t.AlertDialogHeader,{children:[e.jsx(t.AlertDialogTitle,{children:b?"Save failed":"Saving dashboard"}),e.jsx(t.AlertDialogDescription,{className:"pt-2",children:b?"We could not save the dashboard. Please try again.":"Please wait while we save your changes."}),ee.length>0&&e.jsxs("div",{className:"space-y-1 rounded-md border border-destructive/20 bg-destructive/5 p-3 text-left",children:[e.jsx("div",{className:"text-sm font-medium text-destructive",children:"What needs attention"}),e.jsx("ul",{className:"list-disc space-y-1 pl-4 text-xs text-muted-foreground",children:ee.slice(0,5).map(i=>e.jsx("li",{children:i},i))})]})]}),e.jsx(t.AlertDialogFooter,{className:"flex-col gap-2 sm:flex-row sm:justify-end",children:b?e.jsxs(e.Fragment,{children:[e.jsx(t.AlertDialogCancel,{onClick:()=>{F(!1),A(null),_([]),H(!1)},className:"m-0",children:"Close"}),e.jsx(t.AlertDialogAction,{onClick:()=>Te({closeAfterSave:se,navigateHomeAfterSave:Re==="home"}),className:"m-0",children:"Retry"})]}):e.jsxs(t.AlertDialogAction,{disabled:!0,className:"m-0 cursor-default",children:[e.jsx(d.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]})})]})}),e.jsx(V.UnsavedChangesAlert,{open:Os,onOpenChange:i=>{ae(i)},onSave:Gs,onDiscard:zs,isSaving:Ae,saveLabel:"Save",discardLabel:"Discard"})]})]})}function Kt({accessToken:s,dashboardId:n,selectedSheetId:a,pageSize:r,orientation:o,theme:c}){if(!s||!a)return null;const x=new URL("http://localhost:5173/print-document");x.searchParams.set("token",s),n&&x.searchParams.set("dashboardId",n),x.searchParams.set("selectedSheetId",a),c&&x.searchParams.set("theme",c);const h=new URL("http://127.0.0.1:3002/");return h.searchParams.set("pdfMode","document"),h.searchParams.set("pageSize",r||"letter"),h.searchParams.set("orientation",o||"portrait"),h.searchParams.set("url",x.toString()),h.toString()}exports.default=Ht;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),o=require("react"),b=require("./index-jSrCwPQz.js"),s=require("./code-editor-BSENCZwR.js");require("./analyze-result-contract-BswhsmWT.js");require("../value-format-preferences/index.cjs");require("./dashboard-DxwOPUB6.js");require("./index-Dpm_VET4.js");require("./comparison-document-migration-DbU_BTxR.js");require("react-dom");require("../briefings/index.cjs");function S(){const t=s.useDashboardStore(e=>e.dashboard),u=s.useDashboardStore(e=>e.actions.setDashboard),c=s.useDashboardStore(e=>e.showDashboardJSON),h=s.useDashboardStore(e=>e.actions.setShowDashboardJSON),r=o.useMemo(()=>t?JSON.stringify(t,null,2):"",[t]),[l,i]=o.useState(r),n=o.useRef(r);return o.useEffect(()=>{r!==n.current&&(i(r),n.current=r)},[r]),a.jsxs("div",{className:s.cn("relative p-2",{hidden:!c}),children:[a.jsxs(s.Button,{variant:"secondary",size:"sm",className:"absolute right-2 top-2 z-10 h-8",onClick:()=>h(!1),children:[a.jsx(b.X,{className:"mr-2 h-4 w-4"}),"Close"]}),a.jsx("div",{className:"h-[550px] overflow-hidden",children:a.jsx(s.CodeEditor,{value:l,onValueChange:e=>{i(e);try{const d=JSON.parse(e);n.current=JSON.stringify(d,null,2),u(d)}catch{}},language:"json"})})]})}exports.default=S;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),o=require("react"),b=require("./index-jSrCwPQz.js"),s=require("./code-editor-BSENCZwR.js");require("./analyze-result-contract-BswhsmWT.js");require("../value-format-preferences/index.cjs");require("./dashboard-DxynqfO7.js");require("./index-Dpm_VET4.js");require("./comparison-document-migration-DbU_BTxR.js");require("react-dom");require("../briefings/index.cjs");function S(){const t=s.useDashboardStore(e=>e.dashboard),u=s.useDashboardStore(e=>e.actions.setDashboard),c=s.useDashboardStore(e=>e.showDashboardJSON),h=s.useDashboardStore(e=>e.actions.setShowDashboardJSON),r=o.useMemo(()=>t?JSON.stringify(t,null,2):"",[t]),[l,i]=o.useState(r),n=o.useRef(r);return o.useEffect(()=>{r!==n.current&&(i(r),n.current=r)},[r]),a.jsxs("div",{className:s.cn("relative p-2",{hidden:!c}),children:[a.jsxs(s.Button,{variant:"secondary",size:"sm",className:"absolute right-2 top-2 z-10 h-8",onClick:()=>h(!1),children:[a.jsx(b.X,{className:"mr-2 h-4 w-4"}),"Close"]}),a.jsx("div",{className:"h-[550px] overflow-hidden",children:a.jsx(s.CodeEditor,{value:l,onValueChange:e=>{i(e);try{const d=JSON.parse(e);n.current=JSON.stringify(d,null,2),u(d)}catch{}},language:"json"})})]})}exports.default=S;
@@ -4,7 +4,7 @@ import { X as S } from "./index-xHCrHprY.js";
4
4
  import { u as o, B as N, C as D, c as J } from "./code-editor-C8zzmSgt.js";
5
5
  import "./analyze-result-contract-CfOBEwaC.js";
6
6
  import "../value-format-preferences/index.js";
7
- import "./dashboard-BNNLoBLt.js";
7
+ import "./dashboard-CCRvBqUy.js";
8
8
  import "./index-If0wlXGi.js";
9
9
  import "./comparison-document-migration-Dj6xZMCb.js";
10
10
  import "react-dom";
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),v=require("react"),n=require("./dashboard-DxwOPUB6.js"),ae=require("./index-jSrCwPQz.js"),t=require("./code-editor-BSENCZwR.js");require("./analyze-result-contract-BswhsmWT.js");const Es=require("../value-format-preferences/index.cjs"),Ue=require("./search-Dcud9ajy.js"),ke=require("./use-create-flow-overlay-state-Dv5iYPzX.js"),Lt=require("./card-config-utils-15sRtebL.js"),er=require("react-dom");require("./index-Dpm_VET4.js");require("./comparison-document-migration-DbU_BTxR.js");require("../briefings/index.cjs");const ta=require("./numeric-presentation-Dlb-Dk4c.js"),In=require("./metric-comparison-DVy3fll_.js"),tr=require("./palette-C0yjT5Tv.js"),sr=require("./common-types-C73-Ud1-.js");function nr(s){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const r in s)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(a,r,o.get?o:{enumerable:!0,get:()=>s[r]})}}return a.default=s,Object.freeze(a)}const ar=nr(v);/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),v=require("react"),n=require("./dashboard-DxynqfO7.js"),ae=require("./index-jSrCwPQz.js"),t=require("./code-editor-BSENCZwR.js");require("./analyze-result-contract-BswhsmWT.js");const Es=require("../value-format-preferences/index.cjs"),Ue=require("./search-Dcud9ajy.js"),ke=require("./use-create-flow-overlay-state-BX3dLUMB.js"),Lt=require("./card-config-utils-15sRtebL.js"),er=require("react-dom");require("./index-Dpm_VET4.js");require("./comparison-document-migration-DbU_BTxR.js");require("../briefings/index.cjs");const ta=require("./numeric-presentation-Dlb-Dk4c.js"),In=require("./metric-comparison-DVy3fll_.js"),tr=require("./palette-C0yjT5Tv.js"),sr=require("./common-types-C73-Ud1-.js");function nr(s){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const r in s)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(a,r,o.get?o:{enumerable:!0,get:()=>s[r]})}}return a.default=s,Object.freeze(a)}const ar=nr(v);/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,13 +1,13 @@
1
1
  import { jsx as e, jsxs as n, Fragment as Se } from "react/jsx-runtime";
2
2
  import * as zc from "react";
3
3
  import tn, { useState as K, useEffect as Ce, useRef as Ee, useCallback as Ie, useMemo as ce, useContext as wr, Suspense as $c } from "react";
4
- import { d0 as Ri, aH as Fn, aI as Rn, aJ as Pn, aK as Ln, aL as Xn, aF as ms, bm as Et, bq as jt, d1 as Pi, d2 as is, aG as et, d3 as Li, d4 as os, b4 as Ia, aZ as bt, ci as Sr, b2 as ta, br as na, bn as wt, d5 as hs, d6 as Tr, d7 as Vi, d8 as Bi, d9 as qc, da as jc, db as Kc, b8 as vs, dc as Uc, dd as Gc, de as cr, df as cs, az as zn, an as _i, dg as Hc, dh as Qc, di as zi, dj as $i, dk as Wc, dl as Jc, dm as Yc, dn as Xc, bg as $n, bh as Nn, bi as Cn, bj as ja, bk as nn, bl as Yn, dp as dr, dq as Zc, ca as wa, dr as qi, aN as sn, aO as ft, ds as ed, dt as ji, cJ as gn, cQ as Ki, du as kr, dv as td, dw as Ui, dx as nd, dy as Gi, dz as ad, dA as sd, dB as rd, aD as Hi, dC as ld, dD as id, dE as od, dF as cd, dG as dd, dH as ud, dI as zs, dJ as md, dK as zl, dL as hd, dM as $l, dN as pd, dO as fd, cf as aa, cg as sa, ch as ra, b$ as mt, dP as Da, b5 as Qi, bv as Wt, bx as Jt, dQ as Ir, bM as Dr, aM as Er, dR as gd, dS as xd, dT as Ar, dU as bd, dV as Wi, dW as Ji, dX as Yi, dY as Xi, dZ as Ht, d_ as yd, d$ as vd, e0 as Nd, e1 as Cd, e2 as Zi, e3 as eo, r as to, e4 as no, e5 as wd, e6 as Sd, e7 as Td, e8 as Ea, M as kd, e9 as Id, ea as Dd, eb as ql, ec as Ed, E as Ns, e as Or, ed as Ad, ee as Mr, bE as Od, ef as jl, I as gt, eg as Md, eh as Fd, ei as ao, ej as so, ek as Rd, el as Fr, em as Rr, en as ro, eo as lo, ep as Kl, eq as Ka, er as Pd, es as Ld, et as Vd, eu as Bd, ev as _d, ew as ps, ex as zd, ey as $d, ez as io, eA as oo, eB as qd, eC as jd, ct as Kd, eD as Ud, eE as co, eF as Gd, eG as Hd, cu as Cs, eH as ws, bF as Aa, bG as Qt, eI as mn, eJ as Pr, eK as Vn, eL as Bn, eM as xn, eN as Zn, eO as Qd, eP as Wd, eQ as Jd, eR as Yd, eS as Xd, eT as Zd, eU as eu, eV as tu, eW as Ul, bw as an, eX as nu, eY as uo, eZ as au, e_ as su, e$ as mo, f0 as ru, f1 as lu, f2 as iu, f3 as ou, f4 as $s, f5 as cu, f6 as du, f7 as Ss, f8 as uu, f9 as mu, fa as ho, fb as hu, fc as pu, fd as fu, fe as gu, ff as xu, fg as ur, fh as bu, fi as yu, fj as mr, fk as vu, fl as Nu, fm as Cu, fn as wu, fo as Gl, b3 as hr, a$ as bn, aP as Su, aQ as Tu, aS as ku, aT as Iu, aU as Du, aV as Eu, aW as Au, aX as Ou, aY as Mu, c1 as Fu, fp as Oa, fq as Ma, fr as Fa, ck as Lr, cl as Ru, b1 as Pu, fs as Lu, ft as Vu, fu as Bu, fv as Ts, fw as it, fx as ot, fy as ct, fz as _u, fA as zu, fB as po, fC as fo, fD as go, fE as $u, fF as qu, fG as pr, fH as ju, fI as Ku, fJ as Uu, fK as Gu, fL as Hu, fM as Qu, fN as Wu, fO as Ju, fP as Yu, fQ as Xu, fR as Zu, fS as em, fT as Dn, fU as va, fV as tm, fW as Hl, fX as nm, fY as am, fZ as qs, f_ as Ql, f$ as sm, g0 as rm, g1 as lm, g2 as im, g3 as om, aB as Vr, aC as Ra, g4 as js, g5 as xo, b6 as cm, g6 as fs, g7 as dm, g8 as bo, g9 as yo, ga as um, gb as mm, ar as hm, gc as as, gd as pm, ge as Wl, gf as fm, gg as gm, gh as Jl, gi as xm, gj as bm, gk as ym, gl as vm, gm as Nm, aR as vo, gn as Cm, go as wm, gp as Sm, gq as Tm, gr as km, gs as Im, gt as Dm, gu as Em, gv as No, gw as Am, gx as Om, gy as ks, cK as Is, gz as Co, gA as Mm, gB as Fm, gC as wo, gD as Rm, gE as Pm, gF as Ds, gG as Ks, gH as Lm, gI as Vm, gJ as Bm, gK as _m, gL as ea, gM as Yl, gN as So, gO as zm, cw as $m, gP as To, gQ as ko, gR as ds, gS as Io, gT as Do, gU as qm, gV as Xl, gW as jm, gX as Km, gY as us, gZ as Um, g_ as Br, g$ as Gm, h0 as gs, h as Pa, i as La, k as Va, j as Ba, l as _a, m as za, h1 as Hm, h2 as $a, h3 as hn, h4 as fr, h5 as gr, h6 as qa, h7 as Eo, h8 as Qm, h9 as Us, ha as Gs, hb as Wm, hc as Hs, hd as Jm, he as Zl, hf as ei, cS as Ym, hg as Xm, cT as Zm, cV as eh, cW as th, av as nh, hh as ah, hi as sh, hj as rh, cm as lh, cn as ih, co as oh, b_ as Es, hk as As, hl as ti, hm as Ao, cM as Qs, hn as ch, ho as dh, hp as uh, F as mh, bp as hh, hq as ph, hr as fh } from "./dashboard-BNNLoBLt.js";
4
+ import { d0 as Ri, aH as Fn, aI as Rn, aJ as Pn, aK as Ln, aL as Xn, aF as ms, bm as Et, bq as jt, d1 as Pi, d2 as is, aG as et, d3 as Li, d4 as os, b4 as Ia, aZ as bt, ci as Sr, b2 as ta, br as na, bn as wt, d5 as hs, d6 as Tr, d7 as Vi, d8 as Bi, d9 as qc, da as jc, db as Kc, b8 as vs, dc as Uc, dd as Gc, de as cr, df as cs, az as zn, an as _i, dg as Hc, dh as Qc, di as zi, dj as $i, dk as Wc, dl as Jc, dm as Yc, dn as Xc, bg as $n, bh as Nn, bi as Cn, bj as ja, bk as nn, bl as Yn, dp as dr, dq as Zc, ca as wa, dr as qi, aN as sn, aO as ft, ds as ed, dt as ji, cJ as gn, cQ as Ki, du as kr, dv as td, dw as Ui, dx as nd, dy as Gi, dz as ad, dA as sd, dB as rd, aD as Hi, dC as ld, dD as id, dE as od, dF as cd, dG as dd, dH as ud, dI as zs, dJ as md, dK as zl, dL as hd, dM as $l, dN as pd, dO as fd, cf as aa, cg as sa, ch as ra, b$ as mt, dP as Da, b5 as Qi, bv as Wt, bx as Jt, dQ as Ir, bM as Dr, aM as Er, dR as gd, dS as xd, dT as Ar, dU as bd, dV as Wi, dW as Ji, dX as Yi, dY as Xi, dZ as Ht, d_ as yd, d$ as vd, e0 as Nd, e1 as Cd, e2 as Zi, e3 as eo, r as to, e4 as no, e5 as wd, e6 as Sd, e7 as Td, e8 as Ea, M as kd, e9 as Id, ea as Dd, eb as ql, ec as Ed, E as Ns, e as Or, ed as Ad, ee as Mr, bE as Od, ef as jl, I as gt, eg as Md, eh as Fd, ei as ao, ej as so, ek as Rd, el as Fr, em as Rr, en as ro, eo as lo, ep as Kl, eq as Ka, er as Pd, es as Ld, et as Vd, eu as Bd, ev as _d, ew as ps, ex as zd, ey as $d, ez as io, eA as oo, eB as qd, eC as jd, ct as Kd, eD as Ud, eE as co, eF as Gd, eG as Hd, cu as Cs, eH as ws, bF as Aa, bG as Qt, eI as mn, eJ as Pr, eK as Vn, eL as Bn, eM as xn, eN as Zn, eO as Qd, eP as Wd, eQ as Jd, eR as Yd, eS as Xd, eT as Zd, eU as eu, eV as tu, eW as Ul, bw as an, eX as nu, eY as uo, eZ as au, e_ as su, e$ as mo, f0 as ru, f1 as lu, f2 as iu, f3 as ou, f4 as $s, f5 as cu, f6 as du, f7 as Ss, f8 as uu, f9 as mu, fa as ho, fb as hu, fc as pu, fd as fu, fe as gu, ff as xu, fg as ur, fh as bu, fi as yu, fj as mr, fk as vu, fl as Nu, fm as Cu, fn as wu, fo as Gl, b3 as hr, a$ as bn, aP as Su, aQ as Tu, aS as ku, aT as Iu, aU as Du, aV as Eu, aW as Au, aX as Ou, aY as Mu, c1 as Fu, fp as Oa, fq as Ma, fr as Fa, ck as Lr, cl as Ru, b1 as Pu, fs as Lu, ft as Vu, fu as Bu, fv as Ts, fw as it, fx as ot, fy as ct, fz as _u, fA as zu, fB as po, fC as fo, fD as go, fE as $u, fF as qu, fG as pr, fH as ju, fI as Ku, fJ as Uu, fK as Gu, fL as Hu, fM as Qu, fN as Wu, fO as Ju, fP as Yu, fQ as Xu, fR as Zu, fS as em, fT as Dn, fU as va, fV as tm, fW as Hl, fX as nm, fY as am, fZ as qs, f_ as Ql, f$ as sm, g0 as rm, g1 as lm, g2 as im, g3 as om, aB as Vr, aC as Ra, g4 as js, g5 as xo, b6 as cm, g6 as fs, g7 as dm, g8 as bo, g9 as yo, ga as um, gb as mm, ar as hm, gc as as, gd as pm, ge as Wl, gf as fm, gg as gm, gh as Jl, gi as xm, gj as bm, gk as ym, gl as vm, gm as Nm, aR as vo, gn as Cm, go as wm, gp as Sm, gq as Tm, gr as km, gs as Im, gt as Dm, gu as Em, gv as No, gw as Am, gx as Om, gy as ks, cK as Is, gz as Co, gA as Mm, gB as Fm, gC as wo, gD as Rm, gE as Pm, gF as Ds, gG as Ks, gH as Lm, gI as Vm, gJ as Bm, gK as _m, gL as ea, gM as Yl, gN as So, gO as zm, cw as $m, gP as To, gQ as ko, gR as ds, gS as Io, gT as Do, gU as qm, gV as Xl, gW as jm, gX as Km, gY as us, gZ as Um, g_ as Br, g$ as Gm, h0 as gs, h as Pa, i as La, k as Va, j as Ba, l as _a, m as za, h1 as Hm, h2 as $a, h3 as hn, h4 as fr, h5 as gr, h6 as qa, h7 as Eo, h8 as Qm, h9 as Us, ha as Gs, hb as Wm, hc as Hs, hd as Jm, he as Zl, hf as ei, cS as Ym, hg as Xm, cT as Zm, cV as eh, cW as th, av as nh, hh as ah, hi as sh, hj as rh, cm as lh, cn as ih, co as oh, b_ as Es, hk as As, hl as ti, hm as Ao, cM as Qs, hn as ch, ho as dh, hp as uh, F as mh, bp as hh, hq as ph, hr as fh } from "./dashboard-CCRvBqUy.js";
5
5
  import { c as Ue, C as Ft, X as tt } from "./index-xHCrHprY.js";
6
6
  import { D as Ne, B as ee, N as xs, H as Ua, c as J, aN as gh, O as q, _ as ne, $ as ae, a0 as se, a1 as re, a2 as j, E as P, Y as At, Q as Bt, V as Ot, W as Mt, P as Rt, a as Lt, b as Pt, C as yn, aO as xh, aG as Sa, aP as _r, aQ as Oo, aD as zr, aB as bh, Z as Pe, aR as yh, L as vn, u as ye, d as wn, aS as $r, X as rn, A as Mo, T as Ga, F as Ha, G as Yt, I as On, M as Os, S as _n, i as vh, aH as Mn, aT as Nh, aU as Ch, aV as Fo, af as wh, aJ as Sh, aW as Th, aX as kh, aY as ni, aZ as Ih, a_ as Dh, a$ as Eh, b0 as Ah, b1 as Oh, b2 as Mh, b3 as ai, b4 as Fh, b5 as si, R as xr, b6 as la, b7 as Rh, a3 as Ke, b8 as Ph, b9 as qr, ba as br, bb as Ro, bc as pn, bd as ss, be as Po, bf as Lh, bg as Lo, bh as Vh, bi as Bh, bj as Vt, bk as _h, K as Vo, bl as ht, bm as Bo, w as ri, bn as zh, bo as $h, bp as qh, bq as jh, br as Kh, bs as Uh, bt as Gh, bu as Hh, bv as Qh, bw as Wh, bx as Jh, by as Yh, bz as Xh, bA as li, bB as Zh, bC as ep, bD as tp, bE as np, J as Ms, a6 as ap } from "./code-editor-C8zzmSgt.js";
7
7
  import "./analyze-result-contract-CfOBEwaC.js";
8
8
  import { DEFAULT_RESOLVED_VALUE_FORMAT_PREFERENCES as yr } from "../value-format-preferences/index.js";
9
9
  import { C as Kt, E as vr, S as Fs, M as sp, a as rp } from "./search-DHZCro8B.js";
10
- import { f as lp, g as yt, r as _o, h as Qa, i as zo, V as $o, e as ip, C as op } from "./use-create-flow-overlay-state-9-aceNp5.js";
10
+ import { f as lp, g as yt, r as _o, h as Qa, i as zo, V as $o, e as ip, C as op } from "./use-create-flow-overlay-state-C6savp4F.js";
11
11
  import { h as ia } from "./card-config-utils-BYZ5MJOh.js";
12
12
  import { createPortal as cp } from "react-dom";
13
13
  import "./index-If0wlXGi.js";
@@ -1,6 +1,6 @@
1
1
  import { jsxs as l, Fragment as R, jsx as a } from "react/jsx-runtime";
2
2
  import le, { useState as C, useRef as Y, useEffect as U, useCallback as A, useMemo as _ } from "react";
3
- import { az as Q, aA as ce, aB as B, aC as $, aD as oe, h as ie, i as ue, j as de, k as fe, l as M, m as W, aE as me, aF as V, aG as z, a as he, aH as pe, aI as ve, aJ as ye, aK as ge, aL as be } from "./dashboard-BNNLoBLt.js";
3
+ import { az as Q, aA as ce, aB as B, aC as $, aD as oe, h as ie, i as ue, j as de, k as fe, l as M, m as W, aE as me, aF as V, aG as z, a as he, aH as pe, aI as ve, aJ as ye, aK as ge, aL as be } from "./dashboard-CCRvBqUy.js";
4
4
  import { u as X, c as F, O as q, P as we, a as Ce, B as L, b as Se, d as G, L as ee, T as ke, F as Te, G as H, I as K } from "./code-editor-C8zzmSgt.js";
5
5
  import { parseCalendarPreferencesResponse as xe } from "../report-runtime-context/index.js";
6
6
  import "./index-xHCrHprY.js";
@@ -1 +1 @@
1
- "use strict";const e=require("react/jsx-runtime"),l=require("react"),n=require("./dashboard-DxwOPUB6.js"),o=require("./code-editor-BSENCZwR.js"),V=require("../report-runtime-context/index.cjs");require("./index-jSrCwPQz.js");require("./analyze-result-contract-BswhsmWT.js");const D=require("../value-format-preferences/index.cjs");function M(s={}){const{authToken:i,tokenProps:a}=n.useSemaphorContext(),p=o.useDashboardStore(C=>C.actions.applyResolvedCalendarPreferences),d=s.enabled??!0,c=(i==null?void 0:i.accessToken)??null,m=(a==null?void 0:a.apiServiceUrl)??null,[v,b]=l.useState(!1),[g,j]=l.useState(!1),[y,k]=l.useState(!1),[T,f]=l.useState(null),[N,P]=l.useState(null),h=l.useRef(c);h.current=c,l.useEffect(()=>{P(null),f(null),b(!1),j(!1),k(!1)},[c]);const w=l.useCallback(async C=>{const r=V.parseCalendarPreferencesResponse(await C.json());if(!r.ok)throw new Error("Calendar preferences response is invalid");return r.value},[]),S=l.useCallback(async()=>{if(!d||!c||!m)return;const C=c;b(!0),f(null);try{const r=await fetch(`${m}/v1/user-preferences/calendar`,{method:"GET",headers:{Authorization:`Bearer ${c}`}});if(!r.ok){const x=await r.json().catch(()=>({}));throw new Error(x.error||"Failed to fetch preferences")}const t=await w(r);h.current===C&&P(t)}catch(r){h.current===C&&f(r instanceof Error?r.message:"Unknown error")}finally{h.current===C&&b(!1)}},[c,m,d,w]);l.useEffect(()=>{d&&S()},[d,S]);const E=l.useCallback(async C=>{if(!c||!m)return f("Not authenticated"),!1;const r=c;j(!0),f(null);try{const t=await fetch(`${m}/v1/user-preferences/calendar`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${c}`},body:JSON.stringify(C)});if(!t.ok){const z=await t.json().catch(()=>({}));throw new Error(z.error||"Failed to update preferences")}const x=await w(t);return h.current!==r?!1:(P(x),p(x.resolved,x.sources),!0)}catch(t){return h.current===r&&f(t instanceof Error?t.message:"Unknown error"),!1}finally{h.current===r&&j(!1)}},[c,m,p,w]),A=l.useCallback(async()=>{if(!c||!m)return f("Not authenticated"),!1;const C=c;k(!0),f(null);try{const r=await fetch(`${m}/v1/user-preferences/calendar`,{method:"DELETE",headers:{Authorization:`Bearer ${c}`}});if(!r.ok){const x=await r.json().catch(()=>({}));throw new Error(x.error||"Failed to clear preferences")}const t=await w(r);return h.current!==C?!1:(P(t),p(t.resolved,t.sources),!0)}catch(r){return h.current===C&&f(r instanceof Error?r.message:"Unknown error"),!1}finally{h.current===C&&k(!1)}},[c,m,p,w]);return{preferences:N,isLoading:v,isSaving:g,isClearing:y,error:T,updatePreferences:E,clearPreferences:A,refetch:S}}const F=[{value:"America/New_York",label:"Eastern Time (US & Canada)"},{value:"America/Chicago",label:"Central Time (US & Canada)"},{value:"America/Denver",label:"Mountain Time (US & Canada)"},{value:"America/Los_Angeles",label:"Pacific Time (US & Canada)"},{value:"America/Phoenix",label:"Arizona"},{value:"America/Anchorage",label:"Alaska"},{value:"Pacific/Honolulu",label:"Hawaii"},{value:"Europe/London",label:"London"},{value:"Europe/Paris",label:"Paris, Berlin, Rome"},{value:"Asia/Tokyo",label:"Tokyo"},{value:"Asia/Shanghai",label:"Beijing, Shanghai"},{value:"Asia/Kolkata",label:"Mumbai, New Delhi"},{value:"Australia/Sydney",label:"Sydney"},{value:"UTC",label:"UTC"}],I=[{value:0,label:"Sunday"},{value:1,label:"Monday"},{value:6,label:"Saturday"}],R="text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";function _(){try{const s=Intl;if(s.supportedValuesOf)return s.supportedValuesOf("timeZone")}catch{}return F.map(s=>s.value)}function G(s){if(!s)return"default";if(s.tz!==s.weekStart)return"inherited";switch(s.tz){case"viewer_tenant":return"tenant";case"viewer_organization":return"organization";case"system_default":return"system";case"session_initial":return"embedded";default:return"default"}}function U(s){const i=F.find(a=>a.value===s);return i?i.label:s}function W(s){const i=I.find(a=>a.value===s);return i?i.label:String(s)}function H({active:s,onClose:i}){const{preferences:a,isLoading:p,isSaving:d,isClearing:c,updatePreferences:m,clearPreferences:v}=M({enabled:s}),b=n.useCalendarContext(),g=(a==null?void 0:a.resolved.tz)||(b==null?void 0:b.tz)||"UTC",j=(a==null?void 0:a.resolved.weekStart)??(b==null?void 0:b.weekStart)??1,[y,k]=l.useState((a==null?void 0:a.stored)===null),[T,f]=l.useState(!1),[N,P]=l.useState(g),[h,w]=l.useState(j),[S,E]=l.useState(!1),A=l.useMemo(()=>_(),[]),C=l.useMemo(()=>A.filter(u=>!F.some($=>$.value===u)),[A]),r=l.useMemo(()=>U(N),[N]),t=a!=null&&a.inherited?U(a.inherited.tz):"UTC",x=a!=null&&a.inherited?W(a.inherited.weekStart):"Monday",z=G(a==null?void 0:a.inheritedSources);l.useEffect(()=>{if(!s){f(!1);return}T||(a&&k(a.stored===null),P(g),w(j))},[s,T,a,g,j]);const B=async()=>{if(p){n.ue.error("Preferences are still loading. Please try again.");return}y?await v()?(n.ue.success("Now using default settings."),i()):n.ue.error("Failed to save preferences. Please try again."):await m({tz:N,weekStart:h})?(n.ue.success("Preferences saved."),i()):n.ue.error("Failed to save preferences. Please try again.")},q=()=>{i()},L=d||c,O=L||p;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-4 py-1",children:[e.jsxs(n.RadioGroup,{value:y?"defaults":"custom",onValueChange:u=>{f(!0),k(u==="defaults")},className:"space-y-0.5",children:[e.jsxs("label",{htmlFor:"mode-defaults",className:o.cn("flex cursor-pointer items-start gap-2 rounded-control px-2 py-1.5 hover:bg-muted/50",y&&"bg-muted/50"),onClick:()=>{f(!0),k(!0)},children:[e.jsx(n.RadioGroupItem,{value:"defaults",id:"mode-defaults",className:"mt-0.5"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"text-[13px] font-medium text-foreground",children:["Use ",z," defaults"]}),e.jsxs("p",{className:"text-[12px] text-muted-foreground",children:[t,", week starts ",x]})]})]}),e.jsxs("label",{htmlFor:"mode-custom",className:o.cn("flex cursor-pointer items-start gap-2 rounded-control px-2 py-1.5 hover:bg-muted/50",!y&&"bg-muted/50"),onClick:()=>{f(!0),k(!1)},children:[e.jsx(n.RadioGroupItem,{value:"custom",id:"mode-custom",className:"mt-0.5"}),e.jsx("p",{className:"flex-1 text-[13px] font-medium text-foreground",children:"Use custom settings"})]})]}),e.jsxs("div",{className:o.cn("space-y-4 border-t border-border/60 pt-4 transition-opacity",y&&"pointer-events-none opacity-50"),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(o.Label,{className:R,children:"Timezone"}),e.jsxs(o.Popover,{open:S,onOpenChange:E,modal:!0,children:[e.jsx(o.PopoverTrigger,{asChild:!0,children:e.jsxs(o.Button,{variant:"outline",size:"xs",role:"combobox","aria-expanded":S,className:"w-full justify-between text-[12px] font-normal",disabled:y,children:[e.jsx("span",{className:"truncate",children:r}),e.jsx(n.ChevronsUpDown,{className:"ml-2 h-3.5 w-3.5 shrink-0 opacity-50"})]})}),e.jsx(o.PopoverContent,{className:"z-50 w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(n.Command,{className:"overflow-visible",children:[e.jsx(n.CommandInput,{placeholder:"Search timezones…"}),e.jsxs(n.CommandList,{children:[e.jsx(n.CommandEmpty,{children:"No timezone found."}),e.jsx(n.CommandGroup,{heading:"Common",children:F.map(u=>e.jsxs(n.CommandItem,{value:`${u.value} ${u.label}`,onSelect:()=>{f(!0),P(u.value),E(!1)},children:[e.jsx(o.Check,{className:o.cn("h-3.5 w-3.5",N===u.value?"opacity-100":"opacity-0")}),e.jsx("span",{className:"flex-1",children:u.label}),e.jsx("span",{className:"text-[11px] text-muted-foreground",children:u.value})]},u.value))}),e.jsx(n.CommandSeparator,{}),e.jsx(n.CommandGroup,{heading:"All timezones",children:C.map(u=>e.jsxs(n.CommandItem,{value:u,onSelect:()=>{f(!0),P(u),E(!1)},children:[e.jsx(o.Check,{className:o.cn("h-3.5 w-3.5",N===u?"opacity-100":"opacity-0")}),u]},u))})]})]})})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(o.Label,{className:R,children:"Week starts on"}),e.jsx(n.RadioGroup,{value:String(h),onValueChange:u=>{f(!0),w(Number(u))},className:"flex gap-4",disabled:y,children:I.map(u=>e.jsxs("label",{htmlFor:`week-start-${u.value}`,className:o.cn("flex cursor-pointer items-center gap-2 text-[13px]",y&&"cursor-not-allowed"),children:[e.jsx(n.RadioGroupItem,{value:String(u.value),id:`week-start-${u.value}`,disabled:y}),u.label]},u.value))})]})]})]}),e.jsxs(n.DialogFooter,{children:[e.jsx(o.Button,{variant:"outline",size:"xs",onClick:q,disabled:L,children:"Cancel"}),e.jsx(o.Button,{size:"xs",onClick:B,disabled:O,children:L?e.jsxs(e.Fragment,{children:[e.jsx(o.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Saving…"]}):"Save"})]})]})}function K(s={}){const{authToken:i,tokenProps:a}=n.useSemaphorContext(),p=o.useDashboardStore(r=>r.actions.applyResolvedValueFormatPreferences),d=s.enabled??!0,c=(i==null?void 0:i.accessToken)??null,m=(a==null?void 0:a.apiServiceUrl)??null,v=l.useRef(c);v.current=c;const[b,g]=l.useState(null),[j,y]=l.useState(!1),[k,T]=l.useState(!1),[f,N]=l.useState(!1),[P,h]=l.useState(null);l.useEffect(()=>{g(null),h(null),y(!1),T(!1),N(!1)},[c]);const w=l.useCallback(async r=>{const t=D.parseValueFormatPreferencesResponse(await r.json());if(!t.ok)throw new Error("Value format preferences response is invalid");return t.value},[]),S=l.useCallback(async(r,t)=>{if(!c||!m)throw new Error("Not authenticated");const x=await fetch(`${m}/v1/user-preferences/value-format`,{method:r,headers:{Authorization:`Bearer ${c}`,...t?{"Content-Type":"application/json"}:{}},body:t?JSON.stringify(t):void 0});if(!x.ok){const z=await x.json().catch(()=>({}));throw new Error(z.error||"Failed to update preferences")}return w(x)},[c,m,w]),E=l.useCallback(async()=>{if(!d||!c||!m)return;const r=c;y(!0),h(null);try{const t=await S("GET");v.current===r&&g(t)}catch(t){v.current===r&&h(t instanceof Error?t.message:"Unknown error")}finally{v.current===r&&y(!1)}},[c,m,d,S]);l.useEffect(()=>{d&&E()},[d,E]);const A=l.useCallback(async r=>{const t=c;T(!0),h(null);try{const x=await S("PATCH",r);return v.current!==t?!1:(g(x),p(x.resolved,x.sources),!0)}catch(x){return v.current===t&&h(x instanceof Error?x.message:"Unknown error"),!1}finally{v.current===t&&T(!1)}},[c,p,S]),C=l.useCallback(async()=>{const r=c;N(!0),h(null);try{const t=await S("DELETE");return v.current!==r?!1:(g(t),p(t.resolved,t.sources),!0)}catch(t){return v.current===r&&h(t instanceof Error?t.message:"Unknown error"),!1}finally{v.current===r&&N(!1)}},[c,p,S]);return{preferences:b,isLoading:j,isSaving:k,isClearing:f,error:P,updatePreferences:A,clearPreferences:C,refetch:E}}function J({active:s,onClose:i}){var v,b;const{preferences:a,isLoading:p,isSaving:d,updatePreferences:c}=K({enabled:s});if(!s)return null;if(!a)return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"py-2",children:e.jsx("div",{className:"flex min-h-36 items-center justify-center text-[12px] text-muted-foreground",children:p?"Loading preferences…":"Preferences unavailable."})}),e.jsxs(n.DialogFooter,{className:"justify-between sm:justify-between",children:[e.jsx(o.Button,{variant:"ghost",size:"xs",disabled:!0,children:"Reset locale and currency"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(o.Button,{variant:"outline",size:"xs",onClick:i,children:"Cancel"}),e.jsx(o.Button,{size:"xs",disabled:!0,children:"Save"})]})]})]});const m=[((v=a.stored)==null?void 0:v.locale)??"",((b=a.stored)==null?void 0:b.defaultCurrency)??""].join(":");return e.jsx(Z,{preferences:a,isSaving:d,updatePreferences:c,onClose:i},m)}function Z({preferences:s,isSaving:i,updatePreferences:a,onClose:p}){const[d,c]=l.useState(()=>{var g,j;return{locale:(g=s.stored)==null?void 0:g.locale,defaultCurrency:(j=s.stored)==null?void 0:j.defaultCurrency}}),m=(d.locale===void 0||D.canonicalizeSupportedLocale(d.locale)!==void 0)&&(d.defaultCurrency===void 0||D.canonicalizeSupportedCurrencyCode(d.defaultCurrency)!==void 0),v=async()=>{var T,f;const g={},j=[];d.locale!==void 0?g.locale=d.locale:((T=s.stored)==null?void 0:T.locale)!==void 0&&j.push("locale"),d.defaultCurrency!==void 0?g.defaultCurrency=d.defaultCurrency:((f=s.stored)==null?void 0:f.defaultCurrency)!==void 0&&j.push("defaultCurrency");const y={...Object.keys(g).length>0?{set:g}:{},...j.length>0?{clear:j}:{}};(Object.keys(y).length===0?!0:await a(y))?(n.ue.success("Display format preferences saved."),p()):n.ue.error("Failed to save preferences. Please try again.")},b=async()=>{await a({clear:["locale","defaultCurrency"]})?(n.ue.success("Locale and currency preferences reset."),p()):n.ue.error("Failed to reset locale and currency preferences. Please try again.")};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"py-2",children:e.jsx(n.DisplayFormatPreferencesFields,{value:d,inherited:s.inherited,inheritedSources:s.inheritedSources,onChange:c,disabled:i})}),e.jsxs(n.DialogFooter,{className:"justify-between sm:justify-between",children:[e.jsx(o.Button,{variant:"ghost",size:"xs",onClick:b,disabled:i||s.stored===null,children:"Reset locale and currency"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(o.Button,{variant:"outline",size:"xs",onClick:p,disabled:i,children:"Cancel"}),e.jsx(o.Button,{size:"xs",onClick:v,disabled:i||!m,children:i?e.jsxs(e.Fragment,{children:[e.jsx(o.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Saving…"]}):"Save"})]})]})]})}function Y({open:s,onOpenChange:i}){const[a,p]=l.useState("display"),d=()=>i(!1);return e.jsx(n.Dialog,{open:s,onOpenChange:i,children:e.jsxs(n.DialogContent,{className:"rounded-control border-border/60 sm:max-w-[440px] sm:rounded-control",children:[e.jsxs(n.DialogHeader,{children:[e.jsx(n.DialogTitle,{className:"text-[15px]",children:"Report preferences"}),e.jsx(n.DialogDescription,{className:"text-[13px] leading-5",children:"Set how values and Calendar periods appear for you."})]}),e.jsxs(o.Tabs,{value:a,onValueChange:p,children:[e.jsxs(o.TabsList,{variant:"underline",className:"w-full justify-start",children:[e.jsx(o.TabsTrigger,{value:"display",children:"Display formats"}),e.jsx(o.TabsTrigger,{value:"calendar",children:"Calendar"})]}),e.jsx(o.TabsContent,{value:"display",children:e.jsx(J,{active:s&&a==="display",onClose:d})}),e.jsx(o.TabsContent,{value:"calendar",children:e.jsx(H,{active:s&&a==="calendar",onClose:d})})]})]})})}exports.ReportPreferencesDialog=Y;
1
+ "use strict";const e=require("react/jsx-runtime"),l=require("react"),n=require("./dashboard-DxynqfO7.js"),o=require("./code-editor-BSENCZwR.js"),V=require("../report-runtime-context/index.cjs");require("./index-jSrCwPQz.js");require("./analyze-result-contract-BswhsmWT.js");const D=require("../value-format-preferences/index.cjs");function M(s={}){const{authToken:i,tokenProps:a}=n.useSemaphorContext(),p=o.useDashboardStore(C=>C.actions.applyResolvedCalendarPreferences),d=s.enabled??!0,c=(i==null?void 0:i.accessToken)??null,m=(a==null?void 0:a.apiServiceUrl)??null,[v,b]=l.useState(!1),[g,j]=l.useState(!1),[y,k]=l.useState(!1),[T,f]=l.useState(null),[N,P]=l.useState(null),h=l.useRef(c);h.current=c,l.useEffect(()=>{P(null),f(null),b(!1),j(!1),k(!1)},[c]);const w=l.useCallback(async C=>{const r=V.parseCalendarPreferencesResponse(await C.json());if(!r.ok)throw new Error("Calendar preferences response is invalid");return r.value},[]),S=l.useCallback(async()=>{if(!d||!c||!m)return;const C=c;b(!0),f(null);try{const r=await fetch(`${m}/v1/user-preferences/calendar`,{method:"GET",headers:{Authorization:`Bearer ${c}`}});if(!r.ok){const x=await r.json().catch(()=>({}));throw new Error(x.error||"Failed to fetch preferences")}const t=await w(r);h.current===C&&P(t)}catch(r){h.current===C&&f(r instanceof Error?r.message:"Unknown error")}finally{h.current===C&&b(!1)}},[c,m,d,w]);l.useEffect(()=>{d&&S()},[d,S]);const E=l.useCallback(async C=>{if(!c||!m)return f("Not authenticated"),!1;const r=c;j(!0),f(null);try{const t=await fetch(`${m}/v1/user-preferences/calendar`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${c}`},body:JSON.stringify(C)});if(!t.ok){const z=await t.json().catch(()=>({}));throw new Error(z.error||"Failed to update preferences")}const x=await w(t);return h.current!==r?!1:(P(x),p(x.resolved,x.sources),!0)}catch(t){return h.current===r&&f(t instanceof Error?t.message:"Unknown error"),!1}finally{h.current===r&&j(!1)}},[c,m,p,w]),A=l.useCallback(async()=>{if(!c||!m)return f("Not authenticated"),!1;const C=c;k(!0),f(null);try{const r=await fetch(`${m}/v1/user-preferences/calendar`,{method:"DELETE",headers:{Authorization:`Bearer ${c}`}});if(!r.ok){const x=await r.json().catch(()=>({}));throw new Error(x.error||"Failed to clear preferences")}const t=await w(r);return h.current!==C?!1:(P(t),p(t.resolved,t.sources),!0)}catch(r){return h.current===C&&f(r instanceof Error?r.message:"Unknown error"),!1}finally{h.current===C&&k(!1)}},[c,m,p,w]);return{preferences:N,isLoading:v,isSaving:g,isClearing:y,error:T,updatePreferences:E,clearPreferences:A,refetch:S}}const F=[{value:"America/New_York",label:"Eastern Time (US & Canada)"},{value:"America/Chicago",label:"Central Time (US & Canada)"},{value:"America/Denver",label:"Mountain Time (US & Canada)"},{value:"America/Los_Angeles",label:"Pacific Time (US & Canada)"},{value:"America/Phoenix",label:"Arizona"},{value:"America/Anchorage",label:"Alaska"},{value:"Pacific/Honolulu",label:"Hawaii"},{value:"Europe/London",label:"London"},{value:"Europe/Paris",label:"Paris, Berlin, Rome"},{value:"Asia/Tokyo",label:"Tokyo"},{value:"Asia/Shanghai",label:"Beijing, Shanghai"},{value:"Asia/Kolkata",label:"Mumbai, New Delhi"},{value:"Australia/Sydney",label:"Sydney"},{value:"UTC",label:"UTC"}],I=[{value:0,label:"Sunday"},{value:1,label:"Monday"},{value:6,label:"Saturday"}],R="text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";function _(){try{const s=Intl;if(s.supportedValuesOf)return s.supportedValuesOf("timeZone")}catch{}return F.map(s=>s.value)}function G(s){if(!s)return"default";if(s.tz!==s.weekStart)return"inherited";switch(s.tz){case"viewer_tenant":return"tenant";case"viewer_organization":return"organization";case"system_default":return"system";case"session_initial":return"embedded";default:return"default"}}function U(s){const i=F.find(a=>a.value===s);return i?i.label:s}function W(s){const i=I.find(a=>a.value===s);return i?i.label:String(s)}function H({active:s,onClose:i}){const{preferences:a,isLoading:p,isSaving:d,isClearing:c,updatePreferences:m,clearPreferences:v}=M({enabled:s}),b=n.useCalendarContext(),g=(a==null?void 0:a.resolved.tz)||(b==null?void 0:b.tz)||"UTC",j=(a==null?void 0:a.resolved.weekStart)??(b==null?void 0:b.weekStart)??1,[y,k]=l.useState((a==null?void 0:a.stored)===null),[T,f]=l.useState(!1),[N,P]=l.useState(g),[h,w]=l.useState(j),[S,E]=l.useState(!1),A=l.useMemo(()=>_(),[]),C=l.useMemo(()=>A.filter(u=>!F.some($=>$.value===u)),[A]),r=l.useMemo(()=>U(N),[N]),t=a!=null&&a.inherited?U(a.inherited.tz):"UTC",x=a!=null&&a.inherited?W(a.inherited.weekStart):"Monday",z=G(a==null?void 0:a.inheritedSources);l.useEffect(()=>{if(!s){f(!1);return}T||(a&&k(a.stored===null),P(g),w(j))},[s,T,a,g,j]);const B=async()=>{if(p){n.ue.error("Preferences are still loading. Please try again.");return}y?await v()?(n.ue.success("Now using default settings."),i()):n.ue.error("Failed to save preferences. Please try again."):await m({tz:N,weekStart:h})?(n.ue.success("Preferences saved."),i()):n.ue.error("Failed to save preferences. Please try again.")},q=()=>{i()},L=d||c,O=L||p;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-4 py-1",children:[e.jsxs(n.RadioGroup,{value:y?"defaults":"custom",onValueChange:u=>{f(!0),k(u==="defaults")},className:"space-y-0.5",children:[e.jsxs("label",{htmlFor:"mode-defaults",className:o.cn("flex cursor-pointer items-start gap-2 rounded-control px-2 py-1.5 hover:bg-muted/50",y&&"bg-muted/50"),onClick:()=>{f(!0),k(!0)},children:[e.jsx(n.RadioGroupItem,{value:"defaults",id:"mode-defaults",className:"mt-0.5"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"text-[13px] font-medium text-foreground",children:["Use ",z," defaults"]}),e.jsxs("p",{className:"text-[12px] text-muted-foreground",children:[t,", week starts ",x]})]})]}),e.jsxs("label",{htmlFor:"mode-custom",className:o.cn("flex cursor-pointer items-start gap-2 rounded-control px-2 py-1.5 hover:bg-muted/50",!y&&"bg-muted/50"),onClick:()=>{f(!0),k(!1)},children:[e.jsx(n.RadioGroupItem,{value:"custom",id:"mode-custom",className:"mt-0.5"}),e.jsx("p",{className:"flex-1 text-[13px] font-medium text-foreground",children:"Use custom settings"})]})]}),e.jsxs("div",{className:o.cn("space-y-4 border-t border-border/60 pt-4 transition-opacity",y&&"pointer-events-none opacity-50"),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(o.Label,{className:R,children:"Timezone"}),e.jsxs(o.Popover,{open:S,onOpenChange:E,modal:!0,children:[e.jsx(o.PopoverTrigger,{asChild:!0,children:e.jsxs(o.Button,{variant:"outline",size:"xs",role:"combobox","aria-expanded":S,className:"w-full justify-between text-[12px] font-normal",disabled:y,children:[e.jsx("span",{className:"truncate",children:r}),e.jsx(n.ChevronsUpDown,{className:"ml-2 h-3.5 w-3.5 shrink-0 opacity-50"})]})}),e.jsx(o.PopoverContent,{className:"z-50 w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(n.Command,{className:"overflow-visible",children:[e.jsx(n.CommandInput,{placeholder:"Search timezones…"}),e.jsxs(n.CommandList,{children:[e.jsx(n.CommandEmpty,{children:"No timezone found."}),e.jsx(n.CommandGroup,{heading:"Common",children:F.map(u=>e.jsxs(n.CommandItem,{value:`${u.value} ${u.label}`,onSelect:()=>{f(!0),P(u.value),E(!1)},children:[e.jsx(o.Check,{className:o.cn("h-3.5 w-3.5",N===u.value?"opacity-100":"opacity-0")}),e.jsx("span",{className:"flex-1",children:u.label}),e.jsx("span",{className:"text-[11px] text-muted-foreground",children:u.value})]},u.value))}),e.jsx(n.CommandSeparator,{}),e.jsx(n.CommandGroup,{heading:"All timezones",children:C.map(u=>e.jsxs(n.CommandItem,{value:u,onSelect:()=>{f(!0),P(u),E(!1)},children:[e.jsx(o.Check,{className:o.cn("h-3.5 w-3.5",N===u?"opacity-100":"opacity-0")}),u]},u))})]})]})})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(o.Label,{className:R,children:"Week starts on"}),e.jsx(n.RadioGroup,{value:String(h),onValueChange:u=>{f(!0),w(Number(u))},className:"flex gap-4",disabled:y,children:I.map(u=>e.jsxs("label",{htmlFor:`week-start-${u.value}`,className:o.cn("flex cursor-pointer items-center gap-2 text-[13px]",y&&"cursor-not-allowed"),children:[e.jsx(n.RadioGroupItem,{value:String(u.value),id:`week-start-${u.value}`,disabled:y}),u.label]},u.value))})]})]})]}),e.jsxs(n.DialogFooter,{children:[e.jsx(o.Button,{variant:"outline",size:"xs",onClick:q,disabled:L,children:"Cancel"}),e.jsx(o.Button,{size:"xs",onClick:B,disabled:O,children:L?e.jsxs(e.Fragment,{children:[e.jsx(o.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Saving…"]}):"Save"})]})]})}function K(s={}){const{authToken:i,tokenProps:a}=n.useSemaphorContext(),p=o.useDashboardStore(r=>r.actions.applyResolvedValueFormatPreferences),d=s.enabled??!0,c=(i==null?void 0:i.accessToken)??null,m=(a==null?void 0:a.apiServiceUrl)??null,v=l.useRef(c);v.current=c;const[b,g]=l.useState(null),[j,y]=l.useState(!1),[k,T]=l.useState(!1),[f,N]=l.useState(!1),[P,h]=l.useState(null);l.useEffect(()=>{g(null),h(null),y(!1),T(!1),N(!1)},[c]);const w=l.useCallback(async r=>{const t=D.parseValueFormatPreferencesResponse(await r.json());if(!t.ok)throw new Error("Value format preferences response is invalid");return t.value},[]),S=l.useCallback(async(r,t)=>{if(!c||!m)throw new Error("Not authenticated");const x=await fetch(`${m}/v1/user-preferences/value-format`,{method:r,headers:{Authorization:`Bearer ${c}`,...t?{"Content-Type":"application/json"}:{}},body:t?JSON.stringify(t):void 0});if(!x.ok){const z=await x.json().catch(()=>({}));throw new Error(z.error||"Failed to update preferences")}return w(x)},[c,m,w]),E=l.useCallback(async()=>{if(!d||!c||!m)return;const r=c;y(!0),h(null);try{const t=await S("GET");v.current===r&&g(t)}catch(t){v.current===r&&h(t instanceof Error?t.message:"Unknown error")}finally{v.current===r&&y(!1)}},[c,m,d,S]);l.useEffect(()=>{d&&E()},[d,E]);const A=l.useCallback(async r=>{const t=c;T(!0),h(null);try{const x=await S("PATCH",r);return v.current!==t?!1:(g(x),p(x.resolved,x.sources),!0)}catch(x){return v.current===t&&h(x instanceof Error?x.message:"Unknown error"),!1}finally{v.current===t&&T(!1)}},[c,p,S]),C=l.useCallback(async()=>{const r=c;N(!0),h(null);try{const t=await S("DELETE");return v.current!==r?!1:(g(t),p(t.resolved,t.sources),!0)}catch(t){return v.current===r&&h(t instanceof Error?t.message:"Unknown error"),!1}finally{v.current===r&&N(!1)}},[c,p,S]);return{preferences:b,isLoading:j,isSaving:k,isClearing:f,error:P,updatePreferences:A,clearPreferences:C,refetch:E}}function J({active:s,onClose:i}){var v,b;const{preferences:a,isLoading:p,isSaving:d,updatePreferences:c}=K({enabled:s});if(!s)return null;if(!a)return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"py-2",children:e.jsx("div",{className:"flex min-h-36 items-center justify-center text-[12px] text-muted-foreground",children:p?"Loading preferences…":"Preferences unavailable."})}),e.jsxs(n.DialogFooter,{className:"justify-between sm:justify-between",children:[e.jsx(o.Button,{variant:"ghost",size:"xs",disabled:!0,children:"Reset locale and currency"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(o.Button,{variant:"outline",size:"xs",onClick:i,children:"Cancel"}),e.jsx(o.Button,{size:"xs",disabled:!0,children:"Save"})]})]})]});const m=[((v=a.stored)==null?void 0:v.locale)??"",((b=a.stored)==null?void 0:b.defaultCurrency)??""].join(":");return e.jsx(Z,{preferences:a,isSaving:d,updatePreferences:c,onClose:i},m)}function Z({preferences:s,isSaving:i,updatePreferences:a,onClose:p}){const[d,c]=l.useState(()=>{var g,j;return{locale:(g=s.stored)==null?void 0:g.locale,defaultCurrency:(j=s.stored)==null?void 0:j.defaultCurrency}}),m=(d.locale===void 0||D.canonicalizeSupportedLocale(d.locale)!==void 0)&&(d.defaultCurrency===void 0||D.canonicalizeSupportedCurrencyCode(d.defaultCurrency)!==void 0),v=async()=>{var T,f;const g={},j=[];d.locale!==void 0?g.locale=d.locale:((T=s.stored)==null?void 0:T.locale)!==void 0&&j.push("locale"),d.defaultCurrency!==void 0?g.defaultCurrency=d.defaultCurrency:((f=s.stored)==null?void 0:f.defaultCurrency)!==void 0&&j.push("defaultCurrency");const y={...Object.keys(g).length>0?{set:g}:{},...j.length>0?{clear:j}:{}};(Object.keys(y).length===0?!0:await a(y))?(n.ue.success("Display format preferences saved."),p()):n.ue.error("Failed to save preferences. Please try again.")},b=async()=>{await a({clear:["locale","defaultCurrency"]})?(n.ue.success("Locale and currency preferences reset."),p()):n.ue.error("Failed to reset locale and currency preferences. Please try again.")};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"py-2",children:e.jsx(n.DisplayFormatPreferencesFields,{value:d,inherited:s.inherited,inheritedSources:s.inheritedSources,onChange:c,disabled:i})}),e.jsxs(n.DialogFooter,{className:"justify-between sm:justify-between",children:[e.jsx(o.Button,{variant:"ghost",size:"xs",onClick:b,disabled:i||s.stored===null,children:"Reset locale and currency"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(o.Button,{variant:"outline",size:"xs",onClick:p,disabled:i,children:"Cancel"}),e.jsx(o.Button,{size:"xs",onClick:v,disabled:i||!m,children:i?e.jsxs(e.Fragment,{children:[e.jsx(o.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Saving…"]}):"Save"})]})]})]})}function Y({open:s,onOpenChange:i}){const[a,p]=l.useState("display"),d=()=>i(!1);return e.jsx(n.Dialog,{open:s,onOpenChange:i,children:e.jsxs(n.DialogContent,{className:"rounded-control border-border/60 sm:max-w-[440px] sm:rounded-control",children:[e.jsxs(n.DialogHeader,{children:[e.jsx(n.DialogTitle,{className:"text-[15px]",children:"Report preferences"}),e.jsx(n.DialogDescription,{className:"text-[13px] leading-5",children:"Set how values and Calendar periods appear for you."})]}),e.jsxs(o.Tabs,{value:a,onValueChange:p,children:[e.jsxs(o.TabsList,{variant:"underline",className:"w-full justify-start",children:[e.jsx(o.TabsTrigger,{value:"display",children:"Display formats"}),e.jsx(o.TabsTrigger,{value:"calendar",children:"Calendar"})]}),e.jsx(o.TabsContent,{value:"display",children:e.jsx(J,{active:s&&a==="display",onClose:d})}),e.jsx(o.TabsContent,{value:"calendar",children:e.jsx(H,{active:s&&a==="calendar",onClose:d})})]})]})})}exports.ReportPreferencesDialog=Y;
@@ -1,4 +1,4 @@
1
- "use strict";const C=require("react"),s=require("./code-editor-BSENCZwR.js"),f=require("./dashboard-DxwOPUB6.js"),e=require("react/jsx-runtime"),ee=require("./index-jSrCwPQz.js");require("./analyze-result-contract-BswhsmWT.js");require("../value-format-preferences/index.cjs");const ke=require("./save-Xdc4pnys.js"),ye=require("./search-Dcud9ajy.js");/**
1
+ "use strict";const C=require("react"),s=require("./code-editor-BSENCZwR.js"),f=require("./dashboard-DxynqfO7.js"),e=require("react/jsx-runtime"),ee=require("./index-jSrCwPQz.js");require("./analyze-result-contract-BswhsmWT.js");require("../value-format-preferences/index.cjs");const ke=require("./save-Xdc4pnys.js"),ye=require("./search-Dcud9ajy.js");/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,6 +1,6 @@
1
1
  import { useState as H, useEffect as ie, useCallback as B, useMemo as P, useRef as Se, Fragment as gt } from "react";
2
2
  import { D as de, A as _e, u as Z, E as M, a4 as yt, Q as vt, V as xt, W as Ct, c as fe, Y as St, a5 as kt, B as q, d as Nt, L as Ze, a6 as wt, a7 as Dt, a8 as Et, a9 as pe, aa as je, ab as Re, ac as ke, ad as Ne, ae as It, af as Qe, ag as Ft, ah as Vt, ai as me, aj as Tt, ak as $e, al as et, am as tt, an as rt, O as oe, Z as at, _ as we, $ as De, a0 as Ee, a1 as Ie, a2 as Fe, ao as st, ap as _t, aq as Pe, ar as At, as as We, at as Lt, au as qt, av as Ve } from "./code-editor-C8zzmSgt.js";
3
- import { b7 as Mt, az as Ot, b8 as ce, b9 as zt, ba as Ae, bb as Ut, bc as Bt, bd as jt, aG as j, be as Rt, bf as Qt, bg as nt, bh as $t, bi as Pt, bj as Wt, bk as Kt, bl as Ht, av as Yt, bm as Gt, bn as ot, bo as lt, bp as Jt, bq as Xt, br as Zt, bs as er, bt as it, bu as dt, bv as tr, bw as rr, bx as ar, by as sr, bz as nr, aZ as or, bA as lr, bB as ir } from "./dashboard-BNNLoBLt.js";
3
+ import { b7 as Mt, az as Ot, b8 as ce, b9 as zt, ba as Ae, bb as Ut, bc as Bt, bd as jt, aG as j, be as Rt, bf as Qt, bg as nt, bh as $t, bi as Pt, bj as Wt, bk as Kt, bl as Ht, av as Yt, bm as Gt, bn as ot, bo as lt, bp as Jt, bq as Xt, br as Zt, bs as er, bt as it, bu as dt, bv as tr, bw as rr, bx as ar, by as sr, bz as nr, aZ as or, bA as lr, bB as ir } from "./dashboard-CCRvBqUy.js";
4
4
  import { jsx as r, jsxs as m, Fragment as ae } from "react/jsx-runtime";
5
5
  import { c as ct, X as ut, C as Ke } from "./index-xHCrHprY.js";
6
6
  import "./analyze-result-contract-CfOBEwaC.js";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../chunks/dashboard-DxwOPUB6.js"),e=require("../chunks/common-types-C73-Ud1-.js");exports.Dashboard=o.Dashboard;exports.CONTROL_CARD_DEFAULT_VALUE=e.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=e.EMPTY_SELECTION;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../chunks/dashboard-DxynqfO7.js"),e=require("../chunks/common-types-C73-Ud1-.js");exports.Dashboard=o.Dashboard;exports.CONTROL_CARD_DEFAULT_VALUE=e.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=e.EMPTY_SELECTION;
@@ -1,4 +1,4 @@
1
- import { D as o } from "../chunks/dashboard-BNNLoBLt.js";
1
+ import { D as o } from "../chunks/dashboard-CCRvBqUy.js";
2
2
  import { C as s, E as C } from "../chunks/common-types-ClkOI-3O.js";
3
3
  export {
4
4
  s as CONTROL_CARD_DEFAULT_VALUE,
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("react"),An=require("react-dom/client"),k=require("../chunks/dashboard-DxwOPUB6.js"),w=require("../chunks/code-editor-BSENCZwR.js"),Ze=require("../data-app-builder-browser-runtime/index.cjs"),Q=require("../chunks/index-jSrCwPQz.js"),Cn=require("../chunks/save-Xdc4pnys.js"),tt=require("../chunks/search-Dcud9ajy.js");function Tr(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const d=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(s,a,d.get?d:{enumerable:!0,get:()=>t[a]})}}return s.default=t,Object.freeze(s)}const Rn=Tr(p),Bn=Tr(An);/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("react"),An=require("react-dom/client"),k=require("../chunks/dashboard-DxynqfO7.js"),w=require("../chunks/code-editor-BSENCZwR.js"),Ze=require("../data-app-builder-browser-runtime/index.cjs"),Q=require("../chunks/index-jSrCwPQz.js"),Cn=require("../chunks/save-Xdc4pnys.js"),tt=require("../chunks/search-Dcud9ajy.js");function Tr(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const d=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(s,a,d.get?d:{enumerable:!0,get:()=>t[a]})}}return s.default=t,Object.freeze(s)}const Rn=Tr(p),Bn=Tr(An);/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -2,7 +2,7 @@ import { jsx as r, jsxs as c, Fragment as re } from "react/jsx-runtime";
2
2
  import * as Zn from "react";
3
3
  import { useContext as qn, useState as x, useRef as oe, useMemo as ze, useEffect as W, useCallback as Ot } from "react";
4
4
  import * as Xn from "react-dom/client";
5
- import { aM as ea, aN as ta, aO as Ir, aP as jr, aQ as zr, aR as ra, aS as Wr, aT as Hr, aU as Jr, aV as Vr, aW as _r, aX as Ur, aY as Gr, aZ as na, a_ as aa, a$ as oa, b0 as Ht, b1 as on, R as Kr, b2 as sa, b3 as Vt, b4 as sn, b5 as ia, b6 as la } from "../chunks/dashboard-BNNLoBLt.js";
5
+ import { aM as ea, aN as ta, aO as Ir, aP as jr, aQ as zr, aR as ra, aS as Wr, aT as Hr, aU as Jr, aV as Vr, aW as _r, aX as Ur, aY as Gr, aZ as na, a_ as aa, a$ as oa, b0 as Ht, b1 as on, R as Kr, b2 as sa, b3 as Vt, b4 as sn, b5 as ia, b6 as la } from "../chunks/dashboard-CCRvBqUy.js";
6
6
  import { B as H, P as it, a as lt, b as dt, _ as da, $ as ca, a0 as ua, a1 as pa, a2 as ha, L as me, R as ma, d as _t } from "../chunks/code-editor-C8zzmSgt.js";
7
7
  import { loadSemaphorBrowserRuntime as ot } from "../data-app-builder-browser-runtime/index.js";
8
8
  import { c as $e, X as Je } from "../chunks/index-xHCrHprY.js";
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/dashboard-DxwOPUB6.js"),d=require("./chunks/common-types-C73-Ud1-.js"),v=require("./chunks/report-preferences-dialog-CDYDm7dt.js"),i=require("react/jsx-runtime"),r=require("./chunks/code-editor-BSENCZwR.js"),h=require("react"),P=require("./types/index.cjs"),l=require("./chunks/dashboard-briefing-launcher-Hvo4V3np.js"),N=require("./chunks/use-debounced-dirty-check-XHSwAefL.js");require("./chunks/analyze-result-contract-BswhsmWT.js");require("./value-format-preferences/index.cjs");const R=require("./report-runtime-context/index.cjs");require("react-dom");require("./chunks/index-Dpm_VET4.js");const B=require("./chunks/normalize-dashboard-for-dirty-check-BXRUMVb2.js"),_=require("./chunks/index-jSrCwPQz.js");function w(a){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const o in a)if(o!=="default"){const u=Object.getOwnPropertyDescriptor(a,o);Object.defineProperty(t,o,u.get?u:{enumerable:!0,get:()=>a[o]})}}return t.default=a,Object.freeze(t)}const C=w(h);function j(a){const{displayPreferences:t,cardId:o,...u}=a,n={...u,id:a.dashboardId};return i.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:i.jsxs(e.SemaphorContextProvider,{dashboardProps:n,children:[i.jsx(e.SemaphorReadyIndicator,{componentType:"visual",componentId:a.cardId}),i.jsx(e.UXProvider,{appearance:a.appearance,children:i.jsx(e.DisplayPreferencesProvider,{displayPreferences:t,children:i.jsx(e.Container,{type:"visual",cardId:o,...n,children:i.jsx(L,{cardId:o})})})})]})})}function L({cardId:a}){const t=r.useDashboardStore(n=>{var c;return(c=n.dashboard)==null?void 0:c.sheets}),{card:o,frame:u}=h.useMemo(()=>{const n=t==null?void 0:t.flatMap(s=>s.frames),c=n==null?void 0:n.flatMap(s=>s==null?void 0:s.cards),D=c==null?void 0:c.find(s=>(s==null?void 0:s.id)===a),E=n==null?void 0:n.find(s=>{var m;return(m=s==null?void 0:s.cards)==null?void 0:m.find(g=>(g==null?void 0:g.id)===a)});return{card:D,frame:E}},[t,a]);return!o||!u?i.jsx(e.FallbackVisual,{error:new Error("Card not found"),resetErrorBoundary:()=>{},customerFacingMessage:`Card not found with ID: ${a}`}):i.jsx("main",{className:"flex h-full grow flex-col",children:i.jsx(e.ErrorBoundary,{FallbackComponent:({error:n,resetErrorBoundary:c})=>i.jsx(e.FallbackVisual,{error:n,resetErrorBoundary:c,customerFacingMessage:"Error creating visual. Please try again."}),children:i.jsx(e.DashboardCard,{card:o,frame:u})})})}function M(a,t,o,u){h.useEffect(()=>{a&&!o&&t&&u(e.cloneDeep(t))},[a,o,t,u])}function I({name:a,items:t,value:o,onChange:u,isLoading:n,isError:c,refetch:D,className:E,icon:s,showNone:m=!1}){const g=C.useRef(null),[b,T]=C.useState(!1),[y,S]=C.useState("100%"),x=m?[...t||[],{id:"none",name:"None"}]:t;C.useLayoutEffect(()=>{g.current&&S(g.current.offsetWidth)},[]);function A(){var f;return n?"Loading...":c?"Error":o?(f=t==null?void 0:t.find(p=>p.id===o))==null?void 0:f.name:`Select ${a}`}function F(f,p){u(p),T(!1)}return i.jsxs(r.Popover,{open:b,onOpenChange:T,children:[i.jsx(r.PopoverTrigger,{asChild:!0,children:i.jsxs(r.Button,{ref:g,variant:"outline",role:"combobox","aria-expanded":b,className:r.cn("flex h-9 w-full justify-between",E),children:[i.jsxs("div",{className:"flex items-center gap-2",children:[s&&i.jsx("div",{className:"mr-2",children:s}),i.jsx("span",{className:"max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:A()})]}),i.jsx(_.ChevronDown,{className:"size-4 opacity-50"})]})}),i.jsx(r.PopoverContent,{className:"w-full p-0",style:{minWidth:y},children:i.jsxs(e.Command,{children:[i.jsxs("div",{className:"flex h-9 items-center justify-between border-b pr-1",children:[i.jsx(e.CommandInput,{className:"h-9",placeholder:"Search..."}),i.jsx(e.IconButton,{className:"h-7",onClick:D,children:i.jsx(e.RefreshCw,{className:r.cn("size-3.5 opacity-50",n&&"animate-spin")})})]}),i.jsxs(e.CommandList,{children:[i.jsxs(e.CommandEmpty,{children:["No ",a==null?void 0:a.toLowerCase()," found."]}),i.jsx(e.CommandGroup,{children:x==null?void 0:x.map(f=>i.jsx(e.CommandItem,{className:"overflow-x-auto",value:f.name,onSelect:p=>F(p,f.id),children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(r.Check,{className:r.cn("size-4",o===f.id?"opacity-100":"opacity-0")}),i.jsx("div",{title:f.name,children:f.name})]})},f.id))})]})]})})]})}function U(a,t){h.useEffect(()=>(a&&t&&(window.__SEMAPHOR_PRINT_STATE__={...t}),()=>{a&&window.__SEMAPHOR_PRINT_STATE__&&delete window.__SEMAPHOR_PRINT_STATE__}),[a,t])}exports.BriefingAuthor=e.BriefingAuthor;exports.BriefingAuthorDialog=e.BriefingAuthorDialog;exports.BriefingUiCapabilitiesBoundary=e.BriefingUiCapabilitiesBoundary;exports.BriefingUiCapabilitiesProvider=e.BriefingUiCapabilitiesProvider;exports.BriefingsApiError=e.BriefingsApiError;exports.CardSummary=e.CardSummary;exports.Dashboard=e.Dashboard;exports.DashboardCreateDialogBase=e.DashboardCreateDialogBase;exports.DashboardExportDialog=e.DashboardExportDialog;exports.DashboardWC=e.DashboardWC;exports.DisplayFormatPreferencesFields=e.DisplayFormatPreferencesFields;exports.ExportError=e.ExportError;exports.MatrixTableVisual=e.MatrixTableVisual;exports.ResourceType=e.ResourceType;exports.SemaphorContextProvider=e.SemaphorContextProvider;exports.SemaphorDataProvider=e.SemaphorQueryClient;exports.SemaphorQueryClient=e.SemaphorQueryClient;exports.ShareDialog=e.ShareDialog;exports.SummaryCard=e.SummaryCard;exports.Surfboard=e.DashboardPlus;exports.applyBriefingFormPatch=e.applyBriefingFormPatch;exports.briefingFormDraftToCreateRequest=e.briefingFormDraftToCreateRequest;exports.briefingFormDraftToUpdateRequest=e.briefingFormDraftToUpdateRequest;exports.briefingToFormDraft=e.briefingToFormDraft;exports.cancelBriefingPreviewRun=e.cancelBriefingPreviewRun;exports.cancelBriefingRun=e.cancelBriefingRun;exports.cancelExport=e.cancelExport;exports.cloneDeep=e.cloneDeep;exports.createBriefing=e.createBriefing;exports.createBriefingFormDraft=e.createBriefingFormDraft;exports.createExport=e.createExport;exports.deleteBriefing=e.deleteBriefing;exports.deleteBriefingRun=e.deleteBriefingRun;exports.downloadDocumentPdf=e.downloadDocumentPdf;exports.downloadPdf=e.downloadPdf;exports.formatFileSize=e.formatFileSize;exports.getBriefing=e.getBriefing;exports.getBriefingArtifact=e.getBriefingArtifact;exports.getBriefingEvidence=e.getBriefingEvidence;exports.getBriefingPreviewRun=e.getBriefingPreviewRun;exports.getBriefingRun=e.getBriefingRun;exports.getDownloadUrl=e.getDownloadUrl;exports.getExportStatus=e.getExportStatus;exports.getExports=e.getExports;exports.isExportComplete=e.isExportComplete;exports.isExportInProgress=e.isExportInProgress;exports.listBriefingRuns=e.listBriefingRuns;exports.listBriefingTenantSummaries=e.listBriefingTenantSummaries;exports.listBriefings=e.listBriefings;exports.pauseBriefing=e.pauseBriefing;exports.polishBriefingText=e.polishBriefingText;exports.previewBriefingPlan=e.previewBriefingPlan;exports.resumeBriefing=e.resumeBriefing;exports.runBriefingNow=e.runBriefingNow;exports.runBriefingPreview=e.runBriefingPreview;exports.updateBriefing=e.updateBriefing;exports.useActiveExports=e.useActiveExports;exports.useAddNewFrame=e.useAddNewFrame;exports.useBriefingUiCapabilities=e.useBriefingUiCapabilities;exports.useCard=e.useCard;exports.useCardSummary=e.useCardSummary;exports.useDashboardById=e.useDashboardById;exports.useDashboardQuery=e.useDashboardQuery;exports.useDashboardSummary=e.useDashboardSummary;exports.useDataColumns=e.useDataColumns;exports.useDateFilterHook=e.useDateFilterHook;exports.useEditorAside=e.useEditorAside;exports.useExportActions=e.useExportActions;exports.useExportStore=e.useExportStore;exports.useInProgressExportsCount=e.useInProgressExportsCount;exports.useManagementStore=e.useManagementStore;exports.useResourceManagement=e.useResourceManagement;exports.useTextFilterHook=e.useTextFilterHook;exports.validateBriefingFormDraft=e.validateBriefingFormDraft;exports.CALCULATED_FIELD_ENTITY_MARKER=d.CALCULATED_FIELD_ENTITY_MARKER;exports.CONTROL_CARD_DEFAULT_VALUE=d.CONTROL_CARD_DEFAULT_VALUE;exports.DATE_FORMAT_VALUES=d.DATE_FORMAT_VALUES;exports.EMPTY_SELECTION=d.EMPTY_SELECTION;exports.PivotMarkerEnum=d.PivotMarkerEnum;exports.getFieldRuntimeColumnName=d.getFieldRuntimeColumnName;exports.hasCalculatedFieldMarker=d.hasCalculatedFieldMarker;exports.hasCalculatedFormulaInputs=d.hasCalculatedFormulaInputs;exports.isCalculatedDimension=d.isCalculatedDimension;exports.isCalculatedField=d.isCalculatedField;exports.isCalculatedMetric=d.isCalculatedMetric;exports.ReportPreferencesDialog=v.ReportPreferencesDialog;exports.createEmptyKpiConfig=r.createEmptyKpiConfig;exports.createSqlGenConfig=r.createSqlGenConfig;exports.emitDashboardLoad=r.emitDashboardLoad;exports.emitDashboardUnload=r.emitDashboardUnload;exports.fmt=r.fmt;exports.getColumnDataType=r.getColumnDataType;exports.getFilterValueType=r.getFilterValueType;exports.getFormattedTableNameForQuery=r.getFormattedTableNameForQuery;exports.getQualifiedTableName=r.getQualifiedTableName;exports.getSql=r.getSql;exports.invalidateToken=r.invalidateToken;exports.isBooleanDataType=r.isBooleanDataType;exports.isColumnInSqlGen=r.isColumnInSqlGen;exports.isDateDataType=r.isDateDataType;exports.isNumberDataType=r.isNumberDataType;exports.isTextDataType=r.isTextDataType;exports.resolveDataType=r.resolveDataType;exports.resolveDatamodelName=r.resolveDatamodelName;exports.useCurrentActiveCard=r.useCurrentActiveCard;exports.useCurrentCardConfig=r.useCurrentCardConfig;exports.useCurrentSheetActiveCards=r.useCurrentSheetActiveCards;exports.useDashboardActions=r.useDashboardActions;exports.useDashboardStore=r.useDashboardStore;exports.useEditorActions=r.useEditorActions;exports.useEditorStore=r.useEditorStore;exports.DEFAULT_SEMANTIC_DOMAIN_ACCESS=P.DEFAULT_SEMANTIC_DOMAIN_ACCESS;exports.AdvancedModeToggle=l.AdvancedModeToggle;exports.DashboardBriefingLauncher=l.DashboardBriefingLauncher;exports.DashboardControlsSettings=l.DashboardControlsSettings;exports.DashboardFilterControlsButton=l.DashboardFilterControlsButton;exports.DashboardFilterControlsLauncher=l.DashboardFilterControlsLauncher;exports.DocumentControlsSettings=l.DocumentControlsSettings;exports.ExportNotificationItem=l.ExportNotificationItem;exports.ExportNotificationList=l.ExportNotificationList;exports.NotificationBell=l.NotificationBell;exports.UnsavedChangesAlert=l.UnsavedChangesAlert;exports.VisualEditingControls=l.VisualEditingControls;exports.VisualsLibraryDialog=l.VisualsLibraryDialog;exports.WatchDashboardButton=l.WatchDashboardButton;exports.useExportPolling=l.useExportPolling;exports.useExportRecovery=l.useExportRecovery;exports.useDebouncedDirtyCheck=N.useDebouncedDirtyCheck;exports.DEFAULT_CALENDAR_CONTEXT=R.DEFAULT_CALENDAR_CONTEXT;exports.normalizeDashboardForDirtyCheck=B.normalizeDashboardForDirtyCheck;exports.serializeDashboardForDirtyCheck=B.serializeDashboardForDirtyCheck;exports.Combobox=I;exports.Visual=j;exports.useExposePrintState=U;exports.usePristineSnapshotInitializer=M;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/dashboard-DxynqfO7.js"),d=require("./chunks/common-types-C73-Ud1-.js"),v=require("./chunks/report-preferences-dialog-DxK9_fbn.js"),i=require("react/jsx-runtime"),r=require("./chunks/code-editor-BSENCZwR.js"),h=require("react"),P=require("./types/index.cjs"),l=require("./chunks/dashboard-briefing-launcher-h9DIL6l1.js"),N=require("./chunks/use-debounced-dirty-check-XHSwAefL.js");require("./chunks/analyze-result-contract-BswhsmWT.js");require("./value-format-preferences/index.cjs");const R=require("./report-runtime-context/index.cjs");require("react-dom");require("./chunks/index-Dpm_VET4.js");const B=require("./chunks/normalize-dashboard-for-dirty-check-BXRUMVb2.js"),_=require("./chunks/index-jSrCwPQz.js");function w(a){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const o in a)if(o!=="default"){const u=Object.getOwnPropertyDescriptor(a,o);Object.defineProperty(t,o,u.get?u:{enumerable:!0,get:()=>a[o]})}}return t.default=a,Object.freeze(t)}const C=w(h);function j(a){const{displayPreferences:t,cardId:o,...u}=a,n={...u,id:a.dashboardId};return i.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:i.jsxs(e.SemaphorContextProvider,{dashboardProps:n,children:[i.jsx(e.SemaphorReadyIndicator,{componentType:"visual",componentId:a.cardId}),i.jsx(e.UXProvider,{appearance:a.appearance,children:i.jsx(e.DisplayPreferencesProvider,{displayPreferences:t,children:i.jsx(e.Container,{type:"visual",cardId:o,...n,children:i.jsx(L,{cardId:o})})})})]})})}function L({cardId:a}){const t=r.useDashboardStore(n=>{var c;return(c=n.dashboard)==null?void 0:c.sheets}),{card:o,frame:u}=h.useMemo(()=>{const n=t==null?void 0:t.flatMap(s=>s.frames),c=n==null?void 0:n.flatMap(s=>s==null?void 0:s.cards),D=c==null?void 0:c.find(s=>(s==null?void 0:s.id)===a),E=n==null?void 0:n.find(s=>{var m;return(m=s==null?void 0:s.cards)==null?void 0:m.find(g=>(g==null?void 0:g.id)===a)});return{card:D,frame:E}},[t,a]);return!o||!u?i.jsx(e.FallbackVisual,{error:new Error("Card not found"),resetErrorBoundary:()=>{},customerFacingMessage:`Card not found with ID: ${a}`}):i.jsx("main",{className:"flex h-full grow flex-col",children:i.jsx(e.ErrorBoundary,{FallbackComponent:({error:n,resetErrorBoundary:c})=>i.jsx(e.FallbackVisual,{error:n,resetErrorBoundary:c,customerFacingMessage:"Error creating visual. Please try again."}),children:i.jsx(e.DashboardCard,{card:o,frame:u})})})}function M(a,t,o,u){h.useEffect(()=>{a&&!o&&t&&u(e.cloneDeep(t))},[a,o,t,u])}function I({name:a,items:t,value:o,onChange:u,isLoading:n,isError:c,refetch:D,className:E,icon:s,showNone:m=!1}){const g=C.useRef(null),[b,T]=C.useState(!1),[y,S]=C.useState("100%"),x=m?[...t||[],{id:"none",name:"None"}]:t;C.useLayoutEffect(()=>{g.current&&S(g.current.offsetWidth)},[]);function A(){var f;return n?"Loading...":c?"Error":o?(f=t==null?void 0:t.find(p=>p.id===o))==null?void 0:f.name:`Select ${a}`}function F(f,p){u(p),T(!1)}return i.jsxs(r.Popover,{open:b,onOpenChange:T,children:[i.jsx(r.PopoverTrigger,{asChild:!0,children:i.jsxs(r.Button,{ref:g,variant:"outline",role:"combobox","aria-expanded":b,className:r.cn("flex h-9 w-full justify-between",E),children:[i.jsxs("div",{className:"flex items-center gap-2",children:[s&&i.jsx("div",{className:"mr-2",children:s}),i.jsx("span",{className:"max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:A()})]}),i.jsx(_.ChevronDown,{className:"size-4 opacity-50"})]})}),i.jsx(r.PopoverContent,{className:"w-full p-0",style:{minWidth:y},children:i.jsxs(e.Command,{children:[i.jsxs("div",{className:"flex h-9 items-center justify-between border-b pr-1",children:[i.jsx(e.CommandInput,{className:"h-9",placeholder:"Search..."}),i.jsx(e.IconButton,{className:"h-7",onClick:D,children:i.jsx(e.RefreshCw,{className:r.cn("size-3.5 opacity-50",n&&"animate-spin")})})]}),i.jsxs(e.CommandList,{children:[i.jsxs(e.CommandEmpty,{children:["No ",a==null?void 0:a.toLowerCase()," found."]}),i.jsx(e.CommandGroup,{children:x==null?void 0:x.map(f=>i.jsx(e.CommandItem,{className:"overflow-x-auto",value:f.name,onSelect:p=>F(p,f.id),children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(r.Check,{className:r.cn("size-4",o===f.id?"opacity-100":"opacity-0")}),i.jsx("div",{title:f.name,children:f.name})]})},f.id))})]})]})})]})}function U(a,t){h.useEffect(()=>(a&&t&&(window.__SEMAPHOR_PRINT_STATE__={...t}),()=>{a&&window.__SEMAPHOR_PRINT_STATE__&&delete window.__SEMAPHOR_PRINT_STATE__}),[a,t])}exports.BriefingAuthor=e.BriefingAuthor;exports.BriefingAuthorDialog=e.BriefingAuthorDialog;exports.BriefingUiCapabilitiesBoundary=e.BriefingUiCapabilitiesBoundary;exports.BriefingUiCapabilitiesProvider=e.BriefingUiCapabilitiesProvider;exports.BriefingsApiError=e.BriefingsApiError;exports.CardSummary=e.CardSummary;exports.Dashboard=e.Dashboard;exports.DashboardCreateDialogBase=e.DashboardCreateDialogBase;exports.DashboardExportDialog=e.DashboardExportDialog;exports.DashboardWC=e.DashboardWC;exports.DisplayFormatPreferencesFields=e.DisplayFormatPreferencesFields;exports.ExportError=e.ExportError;exports.MatrixTableVisual=e.MatrixTableVisual;exports.ResourceType=e.ResourceType;exports.SemaphorContextProvider=e.SemaphorContextProvider;exports.SemaphorDataProvider=e.SemaphorQueryClient;exports.SemaphorQueryClient=e.SemaphorQueryClient;exports.ShareDialog=e.ShareDialog;exports.SummaryCard=e.SummaryCard;exports.Surfboard=e.DashboardPlus;exports.applyBriefingFormPatch=e.applyBriefingFormPatch;exports.briefingFormDraftToCreateRequest=e.briefingFormDraftToCreateRequest;exports.briefingFormDraftToUpdateRequest=e.briefingFormDraftToUpdateRequest;exports.briefingToFormDraft=e.briefingToFormDraft;exports.cancelBriefingPreviewRun=e.cancelBriefingPreviewRun;exports.cancelBriefingRun=e.cancelBriefingRun;exports.cancelExport=e.cancelExport;exports.cloneDeep=e.cloneDeep;exports.createBriefing=e.createBriefing;exports.createBriefingFormDraft=e.createBriefingFormDraft;exports.createExport=e.createExport;exports.deleteBriefing=e.deleteBriefing;exports.deleteBriefingRun=e.deleteBriefingRun;exports.downloadDocumentPdf=e.downloadDocumentPdf;exports.downloadPdf=e.downloadPdf;exports.formatFileSize=e.formatFileSize;exports.getBriefing=e.getBriefing;exports.getBriefingArtifact=e.getBriefingArtifact;exports.getBriefingEvidence=e.getBriefingEvidence;exports.getBriefingPreviewRun=e.getBriefingPreviewRun;exports.getBriefingRun=e.getBriefingRun;exports.getDownloadUrl=e.getDownloadUrl;exports.getExportStatus=e.getExportStatus;exports.getExports=e.getExports;exports.isExportComplete=e.isExportComplete;exports.isExportInProgress=e.isExportInProgress;exports.listBriefingRuns=e.listBriefingRuns;exports.listBriefingTenantSummaries=e.listBriefingTenantSummaries;exports.listBriefings=e.listBriefings;exports.pauseBriefing=e.pauseBriefing;exports.polishBriefingText=e.polishBriefingText;exports.previewBriefingPlan=e.previewBriefingPlan;exports.resumeBriefing=e.resumeBriefing;exports.runBriefingNow=e.runBriefingNow;exports.runBriefingPreview=e.runBriefingPreview;exports.updateBriefing=e.updateBriefing;exports.useActiveExports=e.useActiveExports;exports.useAddNewFrame=e.useAddNewFrame;exports.useBriefingUiCapabilities=e.useBriefingUiCapabilities;exports.useCard=e.useCard;exports.useCardSummary=e.useCardSummary;exports.useDashboardById=e.useDashboardById;exports.useDashboardQuery=e.useDashboardQuery;exports.useDashboardSummary=e.useDashboardSummary;exports.useDataColumns=e.useDataColumns;exports.useDateFilterHook=e.useDateFilterHook;exports.useEditorAside=e.useEditorAside;exports.useExportActions=e.useExportActions;exports.useExportStore=e.useExportStore;exports.useInProgressExportsCount=e.useInProgressExportsCount;exports.useManagementStore=e.useManagementStore;exports.useResourceManagement=e.useResourceManagement;exports.useTextFilterHook=e.useTextFilterHook;exports.validateBriefingFormDraft=e.validateBriefingFormDraft;exports.CALCULATED_FIELD_ENTITY_MARKER=d.CALCULATED_FIELD_ENTITY_MARKER;exports.CONTROL_CARD_DEFAULT_VALUE=d.CONTROL_CARD_DEFAULT_VALUE;exports.DATE_FORMAT_VALUES=d.DATE_FORMAT_VALUES;exports.EMPTY_SELECTION=d.EMPTY_SELECTION;exports.PivotMarkerEnum=d.PivotMarkerEnum;exports.getFieldRuntimeColumnName=d.getFieldRuntimeColumnName;exports.hasCalculatedFieldMarker=d.hasCalculatedFieldMarker;exports.hasCalculatedFormulaInputs=d.hasCalculatedFormulaInputs;exports.isCalculatedDimension=d.isCalculatedDimension;exports.isCalculatedField=d.isCalculatedField;exports.isCalculatedMetric=d.isCalculatedMetric;exports.ReportPreferencesDialog=v.ReportPreferencesDialog;exports.createEmptyKpiConfig=r.createEmptyKpiConfig;exports.createSqlGenConfig=r.createSqlGenConfig;exports.emitDashboardLoad=r.emitDashboardLoad;exports.emitDashboardUnload=r.emitDashboardUnload;exports.fmt=r.fmt;exports.getColumnDataType=r.getColumnDataType;exports.getFilterValueType=r.getFilterValueType;exports.getFormattedTableNameForQuery=r.getFormattedTableNameForQuery;exports.getQualifiedTableName=r.getQualifiedTableName;exports.getSql=r.getSql;exports.invalidateToken=r.invalidateToken;exports.isBooleanDataType=r.isBooleanDataType;exports.isColumnInSqlGen=r.isColumnInSqlGen;exports.isDateDataType=r.isDateDataType;exports.isNumberDataType=r.isNumberDataType;exports.isTextDataType=r.isTextDataType;exports.resolveDataType=r.resolveDataType;exports.resolveDatamodelName=r.resolveDatamodelName;exports.useCurrentActiveCard=r.useCurrentActiveCard;exports.useCurrentCardConfig=r.useCurrentCardConfig;exports.useCurrentSheetActiveCards=r.useCurrentSheetActiveCards;exports.useDashboardActions=r.useDashboardActions;exports.useDashboardStore=r.useDashboardStore;exports.useEditorActions=r.useEditorActions;exports.useEditorStore=r.useEditorStore;exports.DEFAULT_SEMANTIC_DOMAIN_ACCESS=P.DEFAULT_SEMANTIC_DOMAIN_ACCESS;exports.AdvancedModeToggle=l.AdvancedModeToggle;exports.DashboardBriefingLauncher=l.DashboardBriefingLauncher;exports.DashboardControlsSettings=l.DashboardControlsSettings;exports.DashboardFilterControlsButton=l.DashboardFilterControlsButton;exports.DashboardFilterControlsLauncher=l.DashboardFilterControlsLauncher;exports.DocumentControlsSettings=l.DocumentControlsSettings;exports.ExportNotificationItem=l.ExportNotificationItem;exports.ExportNotificationList=l.ExportNotificationList;exports.NotificationBell=l.NotificationBell;exports.UnsavedChangesAlert=l.UnsavedChangesAlert;exports.VisualEditingControls=l.VisualEditingControls;exports.VisualsLibraryDialog=l.VisualsLibraryDialog;exports.WatchDashboardButton=l.WatchDashboardButton;exports.useExportPolling=l.useExportPolling;exports.useExportRecovery=l.useExportRecovery;exports.useDebouncedDirtyCheck=N.useDebouncedDirtyCheck;exports.DEFAULT_CALENDAR_CONTEXT=R.DEFAULT_CALENDAR_CONTEXT;exports.normalizeDashboardForDirtyCheck=B.normalizeDashboardForDirtyCheck;exports.serializeDashboardForDirtyCheck=B.serializeDashboardForDirtyCheck;exports.Combobox=I;exports.Visual=j;exports.useExposePrintState=U;exports.usePristineSnapshotInitializer=M;
package/dist/index.js CHANGED
@@ -1,14 +1,14 @@
1
- import { E as b, F as N, S, c as P, U as w, d as _, C as F, e as x, f as R, g as M, h as I, i as L, I as k, R as U, j as O, k as V, l as z, m as q } from "./chunks/dashboard-BNNLoBLt.js";
2
- import { B as pa, n as ma, o as ha, p as ga, q as Ca, r as Da, D as Ea, s as xa, t as ba, u as Ta, a as ya, v as Ba, M as va, w as Aa, x as Na, x as Sa, y as Pa, z as wa, b as _a, A as Fa, G as Ra, H as Ma, J as Ia, K as La, L as ka, N as Ua, O as Oa, P as Va, Q as za, T as qa, V as Wa, W as ja, X as Ha, Y as Qa, Z as Ga, _ as Ka, $ as Xa, a0 as Ya, a1 as $a, a2 as Ja, a3 as Za, a4 as ae, a5 as ee, a6 as se, a7 as re, a8 as oe, a9 as ie, aa as te, ab as ne, ac as le, ad as de, ae as ue, af as ce, ag as fe, ah as pe, ai as me, aj as he, ak as ge, al as Ce, am as De, an as Ee, ao as xe, ap as be, aq as Te, ar as ye, as as Be, at as ve, au as Ae, av as Ne, aw as Se, ax as Pe, ay as we } from "./chunks/dashboard-BNNLoBLt.js";
1
+ import { E as b, F as N, S, c as P, U as w, d as _, C as F, e as x, f as R, g as M, h as I, i as L, I as k, R as U, j as O, k as V, l as z, m as q } from "./chunks/dashboard-CCRvBqUy.js";
2
+ import { B as pa, n as ma, o as ha, p as ga, q as Ca, r as Da, D as Ea, s as xa, t as ba, u as Ta, a as ya, v as Ba, M as va, w as Aa, x as Na, x as Sa, y as Pa, z as wa, b as _a, A as Fa, G as Ra, H as Ma, J as Ia, K as La, L as ka, N as Ua, O as Oa, P as Va, Q as za, T as qa, V as Wa, W as ja, X as Ha, Y as Qa, Z as Ga, _ as Ka, $ as Xa, a0 as Ya, a1 as $a, a2 as Ja, a3 as Za, a4 as ae, a5 as ee, a6 as se, a7 as re, a8 as oe, a9 as ie, aa as te, ab as ne, ac as le, ad as de, ae as ue, af as ce, ag as fe, ah as pe, ai as me, aj as he, ak as ge, al as Ce, am as De, an as Ee, ao as xe, ap as be, aq as Te, ar as ye, as as Be, at as ve, au as Ae, av as Ne, aw as Se, ax as Pe, ay as we } from "./chunks/dashboard-CCRvBqUy.js";
3
3
  import { a as Fe, C as Re, D as Me, E as Ie, P as Le, g as ke, h as Ue, b as Oe, i as Ve, c as ze, d as qe } from "./chunks/common-types-ClkOI-3O.js";
4
- import { R as je } from "./chunks/report-preferences-dialog-D8Qe2GGf.js";
4
+ import { R as je } from "./chunks/report-preferences-dialog-DMQjY7oS.js";
5
5
  import { jsx as a, jsxs as d } from "react/jsx-runtime";
6
6
  import { u as W, P as j, a as H, B as Q, c as C, b as G, d as K } from "./chunks/code-editor-C8zzmSgt.js";
7
7
  import { e as Qe, f as Ge, g as Ke, h as Xe, i as Ye, j as $e, k as Je, l as Ze, m as as, n as es, o as ss, p as rs, q as os, r as is, s as ts, t as ns, v as ls, w as ds, x as us, y as cs, z as fs, A as ps, D as ms, E as hs } from "./chunks/code-editor-C8zzmSgt.js";
8
8
  import * as p from "react";
9
9
  import { useMemo as X, useEffect as T } from "react";
10
10
  import { DEFAULT_SEMANTIC_DOMAIN_ACCESS as Cs } from "./types/index.js";
11
- import { A as Es, D as xs, a as bs, b as Ts, c as ys, d as Bs, E as vs, e as As, N as Ns, U as Ss, V as Ps, f as ws, W as _s, u as Fs, g as Rs } from "./chunks/dashboard-briefing-launcher-B2jFSq0-.js";
11
+ import { A as Es, D as xs, a as bs, b as Ts, c as ys, d as Bs, E as vs, e as As, N as Ns, U as Ss, V as Ps, f as ws, W as _s, u as Fs, g as Rs } from "./chunks/dashboard-briefing-launcher-B5y65OKI.js";
12
12
  import { u as Is } from "./chunks/use-debounced-dirty-check-BwAbnX_5.js";
13
13
  import "./chunks/analyze-result-contract-CfOBEwaC.js";
14
14
  import "./value-format-preferences/index.js";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/dashboard-DxwOPUB6.js"),r=require("../chunks/common-types-C73-Ud1-.js"),o=require("../chunks/report-preferences-dialog-CDYDm7dt.js");exports.DisplayFormatPreferencesFields=e.DisplayFormatPreferencesFields;exports.Surfboard=e.DashboardPlus;exports.CONTROL_CARD_DEFAULT_VALUE=r.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;exports.ReportPreferencesDialog=o.ReportPreferencesDialog;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/dashboard-DxynqfO7.js"),r=require("../chunks/common-types-C73-Ud1-.js"),o=require("../chunks/report-preferences-dialog-DxK9_fbn.js");exports.DisplayFormatPreferencesFields=e.DisplayFormatPreferencesFields;exports.Surfboard=e.DashboardPlus;exports.CONTROL_CARD_DEFAULT_VALUE=r.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;exports.ReportPreferencesDialog=o.ReportPreferencesDialog;
@@ -1,6 +1,6 @@
1
- import { a, b as o } from "../chunks/dashboard-BNNLoBLt.js";
1
+ import { a, b as o } from "../chunks/dashboard-CCRvBqUy.js";
2
2
  import { C as f, E } from "../chunks/common-types-ClkOI-3O.js";
3
- import { R as t } from "../chunks/report-preferences-dialog-D8Qe2GGf.js";
3
+ import { R as t } from "../chunks/report-preferences-dialog-DMQjY7oS.js";
4
4
  export {
5
5
  f as CONTROL_CARD_DEFAULT_VALUE,
6
6
  a as DisplayFormatPreferencesFields,
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.1.432",
8
+ "version": "0.1.433",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",