react-semaphor 0.1.402 → 0.1.403
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.
- package/dist/chunks/{calendar-preferences-dialog-BZgOJhHz.js → calendar-preferences-dialog-B1tgIEiO.js} +1 -1
- package/dist/chunks/{calendar-preferences-dialog-CGTZM3U8.js → calendar-preferences-dialog-CuopKVbJ.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-wngYnkEs.js → dashboard-briefing-launcher-5eLlNzsk.js} +1 -1
- package/dist/chunks/{dashboard-briefing-launcher-wimPjqbV.js → dashboard-briefing-launcher-sjEVZFqF.js} +2 -2
- package/dist/chunks/{dashboard-controls-DMz7mAnh.js → dashboard-controls-D4jS0E-d.js} +3 -3
- package/dist/chunks/{dashboard-controls-YqmXJpRK.js → dashboard-controls-yMYyJeGD.js} +1 -1
- package/dist/chunks/{dashboard-json-smJ7897T.js → dashboard-json-BM0aC2mQ.js} +1 -1
- package/dist/chunks/{dashboard-json-CFlCh87B.js → dashboard-json-Bt_MiK2h.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-DP0h664h.js → edit-dashboard-visual-BWjU4Cq2.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-Cl1pzC53.js → edit-dashboard-visual-DlWURcWJ.js} +2 -2
- package/dist/chunks/{index-CiqoOZXW.js → index-DfV9K_Ke.js} +2 -2
- package/dist/chunks/{index-B6k_ANqY.js → index-t_L3sxNY.js} +15 -13
- package/dist/chunks/{use-create-flow-overlay-state-BSUFfv5z.js → use-create-flow-overlay-state-BJR7YAFW.js} +1 -1
- package/dist/chunks/{use-create-flow-overlay-state-BfqXB1zO.js → use-create-flow-overlay-state-CHWPr7ke.js} +1 -1
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/data-app-builder/index.cjs +1 -1
- package/dist/data-app-builder/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +4 -4
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as r, jsxs as s, Fragment as X } from "react/jsx-runtime";
|
|
2
2
|
import ee, { useState as h, useCallback as F, useEffect as ae, useMemo as H } from "react";
|
|
3
|
-
import { u as re, b as te, c as se, d as ne, e as le, f as oe, R as W, g as O, C as ie, h as ce, i as de, j as ue, k as me, l as _, m as R, n as fe, o as he, p as N } from "./index-
|
|
3
|
+
import { u as re, b as te, c as se, d as ne, e as le, f as oe, R as W, g as O, C as ie, h as ce, i as de, j as ue, k as me, l as _, m as R, n as fe, o as he, p as N } from "./index-t_L3sxNY.js";
|
|
4
4
|
import { c as S, L as G, P as pe, a as ge, B as j, b as ve, d as V, e as be } from "./switch-CXMExaSF.js";
|
|
5
5
|
import "./x-CXDkqdur.js";
|
|
6
6
|
import "./analyze-result-contract-BUgK3759.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),l=require("react"),t=require("./index-
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),l=require("react"),t=require("./index-DfV9K_Ke.js"),o=require("./switch-oim6Xl36.js");require("./x-B6ghREd2.js");require("./analyze-result-contract-S8u7CcPL.js");function G(n={}){var y,P,z,A;const{authToken:d,tokenProps:a}=t.useSemaphorContext(),x=n.enabled??!0,m=(d==null?void 0:d.accessToken)??null,f=(a==null?void 0:a.apiServiceUrl)??null,[L,C]=l.useState(!1),[j,b]=l.useState(!1),[h,g]=l.useState(!1),[N,c]=l.useState(null),[v,S]=l.useState(null),k=v||{tz:((P=(y=a==null?void 0:a.params)==null?void 0:y.calendarContext)==null?void 0:P.tz)||null,weekStart:((A=(z=a==null?void 0:a.params)==null?void 0:z.calendarContext)==null?void 0:A.weekStart)??null},p=l.useCallback(async()=>{if(!(!x||!m||!f)){C(!0),c(null);try{const i=await fetch(`${f}/v1/user-preferences/calendar`,{method:"GET",headers:{Authorization:`Bearer ${m}`}});if(!i.ok){const u=await i.json().catch(()=>({}));throw new Error(u.error||"Failed to fetch preferences")}const r=await i.json();S({tz:r.tz,weekStart:r.weekStart,source:r.source,isInherited:r.isInherited,userHasPrefs:r.userHasPrefs,inherited:r.inherited})}catch(i){const r=i instanceof Error?i.message:"Unknown error";c(r)}finally{C(!1)}}},[m,f,x]);l.useEffect(()=>{x&&p()},[x,p]);const T=l.useCallback(async i=>{if(!m||!f)return c("Not authenticated"),!1;b(!0),c(null);try{const r=await fetch(`${f}/v1/user-preferences/calendar`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${m}`},body:JSON.stringify(i)});if(!r.ok){const u=await r.json().catch(()=>({}));throw new Error(u.error||"Failed to update preferences")}return await p(),!0}catch(r){const u=r instanceof Error?r.message:"Unknown error";return c(u),!1}finally{b(!1)}},[m,f,p]),w=l.useCallback(async()=>{if(!m||!f)return c("Not authenticated"),!1;g(!0),c(null);try{const i=await fetch(`${f}/v1/user-preferences/calendar`,{method:"DELETE",headers:{Authorization:`Bearer ${m}`}});if(!i.ok){const u=await i.json().catch(()=>({}));throw new Error(u.error||"Failed to clear preferences")}const r=await i.text();if(r)try{const u=JSON.parse(r);return S({tz:u.tz,weekStart:u.weekStart,source:u.source,isInherited:u.isInherited??!0,userHasPrefs:!1,inherited:u.inherited}),!0}catch{}return await p(),!0}catch(i){const r=i instanceof Error?i.message:"Unknown error";return c(r),!1}finally{g(!1)}},[m,f,p]);return{preferences:k,isLoading:L,isSaving:j,isClearing:h,error:N,updatePreferences:T,clearPreferences:w,refetch:p}}const E=[{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"}],M=[{value:0,label:"Sunday"},{value:1,label:"Monday"},{value:6,label:"Saturday"}],H="text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";function W(){try{const n=Intl;if(n.supportedValuesOf)return n.supportedValuesOf("timeZone")}catch{}return E.map(n=>n.value)}function _(n){switch(n){case"tenant":return"tenant";case"organization":return"organization";case"system":return"system";default:return"default"}}function O(n){const d=E.find(a=>a.value===n);return d?d.label:n}function q(n){const d=M.find(a=>a.value===n);return d?d.label:String(n)}function V({open:n,onOpenChange:d}){var D,U,F;const{preferences:a,isLoading:x,isSaving:m,isClearing:f,updatePreferences:L,clearPreferences:C}=G({enabled:n}),j=a.tz||((D=a.inherited)==null?void 0:D.tz)||Intl.DateTimeFormat().resolvedOptions().timeZone,b=a.weekStart??((U=a.inherited)==null?void 0:U.weekStart)??1,[h,g]=l.useState(!a.userHasPrefs),[N,c]=l.useState(!1),[v,S]=l.useState(j),[k,p]=l.useState(b),[T,w]=l.useState(!1),y=l.useMemo(()=>W(),[]),P=l.useMemo(()=>y.filter(s=>!E.some(R=>R.value===s)),[y]),z=l.useMemo(()=>O(v),[v]),A=a.inherited?O(a.inherited.tz):"UTC",i=a.inherited?q(a.inherited.weekStart):"Monday",r=_((F=a.inherited)==null?void 0:F.source);l.useEffect(()=>{if(!n){c(!1);return}N||(a.userHasPrefs!==void 0&&g(!a.userHasPrefs),S(j),p(b))},[n,N,a.userHasPrefs,j,b]);const u=async()=>{if(x){t.ue.error("Preferences are still loading. Please try again.");return}h?await C()?(t.ue.success("Now using default settings. Please refresh the page to apply changes.",{duration:5e3}),d(!1)):t.ue.error("Failed to save preferences. Please try again."):await L({tz:v,weekStart:k})?(t.ue.success("Preferences saved. Please refresh the page to apply changes.",{duration:5e3}),d(!1)):t.ue.error("Failed to save preferences. Please try again.")},$=()=>{d(!1)},I=m||f,B=I||x;return e.jsx(t.Dialog,{open:n,onOpenChange:d,children:e.jsxs(t.DialogContent,{className:"rounded-control border-border/60 sm:max-w-[440px] sm:rounded-control",children:[e.jsxs(t.DialogHeader,{children:[e.jsx(t.DialogTitle,{className:"text-[15px]",children:"Calendar preferences"}),e.jsx(t.DialogDescription,{className:"text-[13px] leading-5",children:"Set your timezone and week-start for date calculations and displays."})]}),e.jsxs("div",{className:"space-y-4 py-1",children:[e.jsxs(t.RadioGroup,{value:h?"defaults":"custom",onValueChange:s=>{c(!0),g(s==="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",h&&"bg-muted/50"),onClick:()=>{c(!0),g(!0)},children:[e.jsx(t.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 ",r," defaults"]}),e.jsxs("p",{className:"text-[12px] text-muted-foreground",children:[A,", week starts ",i]})]})]}),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",!h&&"bg-muted/50"),onClick:()=>{c(!0),g(!1)},children:[e.jsx(t.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",h&&"pointer-events-none opacity-50"),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(o.Label,{className:H,children:"Timezone"}),e.jsxs(o.Popover,{open:T,onOpenChange:w,modal:!0,children:[e.jsx(o.PopoverTrigger,{asChild:!0,children:e.jsxs(o.Button,{variant:"outline",size:"xs",role:"combobox","aria-expanded":T,className:"w-full justify-between text-[12px] font-normal",disabled:h,children:[e.jsx("span",{className:"truncate",children:z}),e.jsx(t.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(t.Command,{className:"overflow-visible",children:[e.jsx(t.CommandInput,{placeholder:"Search timezones…"}),e.jsxs(t.CommandList,{children:[e.jsx(t.CommandEmpty,{children:"No timezone found."}),e.jsx(t.CommandGroup,{heading:"Common",children:E.map(s=>e.jsxs(t.CommandItem,{value:`${s.value} ${s.label}`,onSelect:()=>{c(!0),S(s.value),w(!1)},children:[e.jsx(o.Check,{className:o.cn("h-3.5 w-3.5",v===s.value?"opacity-100":"opacity-0")}),e.jsx("span",{className:"flex-1",children:s.label}),e.jsx("span",{className:"text-[11px] text-muted-foreground",children:s.value})]},s.value))}),e.jsx(t.CommandSeparator,{}),e.jsx(t.CommandGroup,{heading:"All timezones",children:P.map(s=>e.jsxs(t.CommandItem,{value:s,onSelect:()=>{c(!0),S(s),w(!1)},children:[e.jsx(o.Check,{className:o.cn("h-3.5 w-3.5",v===s?"opacity-100":"opacity-0")}),s]},s))})]})]})})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(o.Label,{className:H,children:"Week starts on"}),e.jsx(t.RadioGroup,{value:String(k),onValueChange:s=>{c(!0),p(Number(s))},className:"flex gap-4",disabled:h,children:M.map(s=>e.jsxs("label",{htmlFor:`week-start-${s.value}`,className:o.cn("flex cursor-pointer items-center gap-2 text-[13px]",h&&"cursor-not-allowed"),children:[e.jsx(t.RadioGroupItem,{value:String(s.value),id:`week-start-${s.value}`,disabled:h}),s.label]},s.value))})]})]})]}),e.jsxs(t.DialogFooter,{children:[e.jsx(o.Button,{variant:"outline",size:"xs",onClick:$,disabled:I,children:"Cancel"}),e.jsx(o.Button,{size:"xs",onClick:u,disabled:B,children:I?e.jsxs(e.Fragment,{children:[e.jsx(o.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Saving…"]}):"Save"})]})]})})}exports.CalendarPreferencesDialog=V;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),h=require("react"),i=require("./index-
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),h=require("react"),i=require("./index-DfV9K_Ke.js"),o=require("./switch-oim6Xl36.js"),ss=require("./layout-grid-C0OI-MRn.js"),K=require("./x-B6ghREd2.js"),me=require("./use-create-flow-overlay-state-CHWPr7ke.js");require("./analyze-result-contract-S8u7CcPL.js");const Ae=require("./search-DNCejM7Z.js"),Gs=require("./date-formatter-B4EBSe9C.js");require("./index-DRlMUglg.js");require("react-dom");/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as t, jsxs as s, Fragment as le } from "react/jsx-runtime";
|
|
2
2
|
import bo, { useState as S, useEffect as fe, useMemo as O, useContext as xo, useRef as Me, useCallback as ye } from "react";
|
|
3
|
-
import { b as rt, c as at, e as st, aF as ka, bs as yo, bO as vo, bP as No, ar as Rt, bC as Sa, aW as gt, J as wo, A as Co, bQ as ko, ah as Jt, ak as Qt, al as Xt, am as Yt, an as Zt, ao as en, ap as tn, aq as Yn, aV as nn, p as be, bR as So, bS as Do, bT as In, bD as rn, bE as an, bU as Zn, bF as sn, bG as De, av as Eo, b8 as jt, bV as Da, br as $n, d as bt, f as xt, bW as Ao, o as Ea, aE as Io, aT as Aa, bX as To, aU as _n, y as Lo, ae as Fo, ax as Ro, u as Pt, a0 as mt, ab as er, a7 as Ia, a8 as tr, a1 as Ta, a6 as Po, ad as Bo, bJ as Mo, bY as Vo, b4 as Oo, a9 as qr, x as zt, a3 as Uo, bZ as $o, b_ as _o, b$ as jo, c0 as zo, c1 as Ko, c2 as qo, c3 as Ho, c4 as Go, c5 as La, c6 as Wo, c7 as Jo, c8 as Qo, c9 as Xo, ca as Yo, ay as yt, cb as Zo, bH as Fa, cc as ei, cd as ti, ce as ni, cf as ri, cg as ai, ch as si, ci as oi, cj as Ra, ck as ii, cl as li, cm as Pa, cn as Ba, co as Ma, cp as di, cq as ci, be as Va, bp as ui, bm as mi, cr as hi, aw as Oa, cs as pi, ct as fi, cu as gi, cv as bi, cw as jn, cx as xi, cy as yi, cz as Ua, cA as nr, cB as vi, cC as Ni, cD as $a, cE as wi, cF as Ci, cG as ki, cH as _a, as as Si, cI as Di, cJ as Ei, cK as Ai, cL as Ii, cM as Ti, cN as Li, cO as Fi } from "./index-
|
|
3
|
+
import { b as rt, c as at, e as st, aF as ka, bs as yo, bO as vo, bP as No, ar as Rt, bC as Sa, aW as gt, J as wo, A as Co, bQ as ko, ah as Jt, ak as Qt, al as Xt, am as Yt, an as Zt, ao as en, ap as tn, aq as Yn, aV as nn, p as be, bR as So, bS as Do, bT as In, bD as rn, bE as an, bU as Zn, bF as sn, bG as De, av as Eo, b8 as jt, bV as Da, br as $n, d as bt, f as xt, bW as Ao, o as Ea, aE as Io, aT as Aa, bX as To, aU as _n, y as Lo, ae as Fo, ax as Ro, u as Pt, a0 as mt, ab as er, a7 as Ia, a8 as tr, a1 as Ta, a6 as Po, ad as Bo, bJ as Mo, bY as Vo, b4 as Oo, a9 as qr, x as zt, a3 as Uo, bZ as $o, b_ as _o, b$ as jo, c0 as zo, c1 as Ko, c2 as qo, c3 as Ho, c4 as Go, c5 as La, c6 as Wo, c7 as Jo, c8 as Qo, c9 as Xo, ca as Yo, ay as yt, cb as Zo, bH as Fa, cc as ei, cd as ti, ce as ni, cf as ri, cg as ai, ch as si, ci as oi, cj as Ra, ck as ii, cl as li, cm as Pa, cn as Ba, co as Ma, cp as di, cq as ci, be as Va, bp as ui, bm as mi, cr as hi, aw as Oa, cs as pi, ct as fi, cu as gi, cv as bi, cw as jn, cx as xi, cy as yi, cz as Ua, cA as nr, cB as vi, cC as Ni, cD as $a, cE as wi, cF as Ci, cG as ki, cH as _a, as as Si, cI as Di, cJ as Ei, cK as Ai, cL as Ii, cM as Ti, cN as Li, cO as Fi } from "./index-t_L3sxNY.js";
|
|
4
4
|
import { B as Z, L as Lt, Z as zn, e as se, N as ja, d as je, c as v, M as za, E as vt, u as Q, A as Nt, aF as Hr, a6 as Ka, F as qa, S as rr, P as $e, a as ot, b as it, aG as Ri, aH as Pi, aD as Ha, aI as Ga, _ as Ye, $ as Ze, a0 as et, a1 as tt, a2 as xe, aJ as Wa, aK as Ja, X as nt, T as Bi, G as Mi, H as Gr, aL as Vi } from "./switch-CXMExaSF.js";
|
|
5
5
|
import { L as ar } from "./layout-grid-CiubineE.js";
|
|
6
6
|
import { c as Pe, X as Ae, C as Ge } from "./x-CXDkqdur.js";
|
|
7
|
-
import { u as sr, V as Oi, E as Wr, a as Jr, b as Ui, c as $i, L as _i, d as ji, e as Qa, C as Xa, f as zi, R as Ki, S as qi } from "./use-create-flow-overlay-state-
|
|
7
|
+
import { u as sr, V as Oi, E as Wr, a as Jr, b as Ui, c as $i, L as _i, d as ji, e as Qa, C as Xa, f as zi, R as Ki, S as qi } from "./use-create-flow-overlay-state-BJR7YAFW.js";
|
|
8
8
|
import "./analyze-result-contract-BUgK3759.js";
|
|
9
9
|
import { S as Hi, M as Gi, a as Bt, C as Kn } from "./search-BHsQIWBV.js";
|
|
10
10
|
import { l as Qr } from "./date-formatter-BlhBftA9.js";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsx as e, jsxs as o, Fragment as R } from "react/jsx-runtime";
|
|
2
2
|
import { u as D, B as O, av as dt, A as Wt, L as jr, Z as Kr, c as he, aw as Qr, ax as Wr, ay as rt, az as fe, aA as ct, aB as Jt, e as Ge, aC as Yt, aD as Jr, E as _t, Q as Yr, V as Xr, W as Zr, Y as en, i as tn, aE as rn } from "./switch-CXMExaSF.js";
|
|
3
|
-
import { b5 as nn, u as G, b as Xt, b6 as an, ar as j, c as Zt, d as sn, e as nt, f as at, o as on, b7 as pe, b8 as $e, b9 as dn, ba as Rt, bb as er, bc as tr, bd as cn, be as lt, bf as ln, bg as un, bh as mn, bi as pn, bj as hn, bk as fn, aC as ge, bl as be, p as E, bm as gn, bn as rr, aW as ut, bo as bn, bp as xn, bq as nr, br as ar, bs as vn, bt as yn, bu as wn, z as Nn, y as Te, K as Sn, A as Xe, bv as Dn, bw as Cn, bx as kn, $ as En, by as Ln, I as Ut, bz as An, bA as In, bB as Mn, bC as Pn, bD as Tt, bE as Ft, bF as $t, bG as T, bH as On, bI as _n, bJ as Rn, av as Gt, bK as Un, bL as Tn, bM as Fn, J as $n, bN as Gn, ah as Bn, ak as zn, al as qn, am as Hn, an as Vn, ao as jn, ap as Kn, aq as Bt, w as st } from "./index-
|
|
3
|
+
import { b5 as nn, u as G, b as Xt, b6 as an, ar as j, c as Zt, d as sn, e as nt, f as at, o as on, b7 as pe, b8 as $e, b9 as dn, ba as Rt, bb as er, bc as tr, bd as cn, be as lt, bf as ln, bg as un, bh as mn, bi as pn, bj as hn, bk as fn, aC as ge, bl as be, p as E, bm as gn, bn as rr, aW as ut, bo as bn, bp as xn, bq as nr, br as ar, bs as vn, bt as yn, bu as wn, z as Nn, y as Te, K as Sn, A as Xe, bv as Dn, bw as Cn, bx as kn, $ as En, by as Ln, I as Ut, bz as An, bA as In, bB as Mn, bC as Pn, bD as Tt, bE as Ft, bF as $t, bG as T, bH as On, bI as _n, bJ as Rn, av as Gt, bK as Un, bL as Tn, bM as Fn, J as $n, bN as Gn, ah as Bn, ak as zn, al as qn, am as Hn, an as Vn, ao as jn, ap as Kn, aq as Bt, w as st } from "./index-t_L3sxNY.js";
|
|
4
4
|
import { c as Q, X as sr, C as Qn } from "./x-CXDkqdur.js";
|
|
5
5
|
import "./analyze-result-contract-BUgK3759.js";
|
|
6
6
|
import * as I from "react";
|
|
7
7
|
import or, { useState as w, useMemo as K, useEffect as Be, useRef as zt, useLayoutEffect as Wn, useCallback as Jn } from "react";
|
|
8
8
|
import "./index-CJdxSyQq.js";
|
|
9
9
|
import { createPortal as Yn } from "react-dom";
|
|
10
|
-
import { O as Xn, c as Zn, u as ea, A as ta, a as ra, M as na, f as aa, V as sa, P as oa, N as ia, U as da } from "./dashboard-briefing-launcher-
|
|
10
|
+
import { O as Xn, c as Zn, u as ea, A as ta, a as ra, M as na, f as aa, V as sa, P as oa, N as ia, U as da } from "./dashboard-briefing-launcher-sjEVZFqF.js";
|
|
11
11
|
import { S as ca, C as la } from "./search-BHsQIWBV.js";
|
|
12
12
|
import { d as ir } from "./index-CjzRe2su.js";
|
|
13
|
-
import { C as ua } from "./calendar-preferences-dialog-
|
|
13
|
+
import { C as ua } from "./calendar-preferences-dialog-B1tgIEiO.js";
|
|
14
14
|
import { u as ma } from "./use-debounced-dirty-check-BwAbnX_5.js";
|
|
15
15
|
import { s as Ze } from "./normalize-dashboard-for-dirty-check-5KpZN8xr.js";
|
|
16
16
|
import { S as qt } from "./save-DgMfP0j8.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("./switch-oim6Xl36.js"),s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("./switch-oim6Xl36.js"),s=require("./index-DfV9K_Ke.js"),R=require("./x-B6ghREd2.js");require("./analyze-result-contract-S8u7CcPL.js");const v=require("react");require("./index-DRlMUglg.js");const ss=require("react-dom"),P=require("./dashboard-briefing-launcher-5eLlNzsk.js"),ft=require("./search-DNCejM7Z.js"),gt=require("./index-D7KJindZ.js"),rs=require("./calendar-preferences-dialog-CuopKVbJ.js"),ns=require("./use-debounced-dirty-check-XHSwAefL.js"),Ue=require("./normalize-dashboard-for-dirty-check-BXRUMVb2.js"),lt=require("./save-C__QggEE.js"),as=require("./palette-C4KTXOug.js"),os=require("./braces-D2tStQjF.js");function is(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(a,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return a.default=t,Object.freeze(a)}const L=is(v);/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),o=require("react"),b=require("./x-B6ghREd2.js"),s=require("./switch-oim6Xl36.js");require("./analyze-result-contract-S8u7CcPL.js");require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),o=require("react"),b=require("./x-B6ghREd2.js"),s=require("./switch-oim6Xl36.js");require("./analyze-result-contract-S8u7CcPL.js");require("./index-DfV9K_Ke.js");require("./index-DRlMUglg.js");require("react-dom");function S(){const t=s.useDashboardStore(e=>e.dashboard),c=s.useDashboardStore(e=>e.actions.setDashboard),u=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:!u}),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),c(d)}catch{}},language:"json"})})]})}exports.default=S;
|
|
@@ -3,7 +3,7 @@ import { useMemo as m, useState as f, useRef as b, useEffect as p } from "react"
|
|
|
3
3
|
import { X as S } from "./x-CXDkqdur.js";
|
|
4
4
|
import { u as o, c as N, B as D, C as J } from "./switch-CXMExaSF.js";
|
|
5
5
|
import "./analyze-result-contract-BUgK3759.js";
|
|
6
|
-
import "./index-
|
|
6
|
+
import "./index-t_L3sxNY.js";
|
|
7
7
|
import "./index-CJdxSyQq.js";
|
|
8
8
|
import "react-dom";
|
|
9
9
|
function j() {
|
|
@@ -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("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),v=require("react"),n=require("./index-DfV9K_Ke.js"),re=require("./x-B6ghREd2.js"),t=require("./switch-oim6Xl36.js");require("./analyze-result-contract-S8u7CcPL.js");const ze=require("./search-DNCejM7Z.js"),Ne=require("./use-create-flow-overlay-state-CHWPr7ke.js"),Ua=require("react-dom");require("./index-DRlMUglg.js");const Ga=require("./palette-C4KTXOug.js"),Ha=require("./common-types-C73-Ud1-.js");function Qa(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 Wa=Qa(v);/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as e, jsxs as a, Fragment as De } from "react/jsx-runtime";
|
|
2
2
|
import * as Sc from "react";
|
|
3
3
|
import ea, { useState as K, useEffect as Se, useRef as Me, useCallback as Ee, useMemo as de, useContext as wr, Suspense as Tc } from "react";
|
|
4
|
-
import { cP as Ei, b as Aa, c as Oa, d as Ma, e as Fa, f as Ya, o as hs, aQ as kt, aV as wt, cQ as Ai, cR as is, p as Ze, cS as Oi, cC as os, ay as In, ar as vt, bH as Sr, aw as nn, aW as qn, aR as Nt, cT as ps, cG as Tr, cU as kc, cV as Mi, cW as Dc, aC as Ns, cX as Ic, cY as Ec, cZ as mr, c_ as cs, u as xa, z as Fi, c$ as Ac, d0 as Oc, d1 as Ri, d2 as Li, d3 as Mc, d4 as Fc, d5 as Rc, aK as Va, aL as ba, aM as ya, aN as jn, aO as ta, aP as Qa, d6 as hr, bz as Sn, d7 as Pi, af as na, ag as ft, d8 as Lc, d9 as Vi, c5 as ma, cH as Bi, da as kr, db as _i, dc as Pc, dd as Vc, de as Bc, C as zi, df as _c, dg as zc, dh as $c, di as qc, dj as jc, dk as Kc, dl as zs, dm as Uc, dn as zl, dp as Gc, dq as $l, dr as Hc, ds as Wc, bD as sn, bE as rn, bF as ln, bG as ct, dt as En, az as $i, du as Qc, a_ as Qt, b0 as Jt, dv as Dr, be as Ir, ae as Er, dw as Jc, dx as Yc, dy as Ar, dz as Xc, dA as qi, dB as ji, dC as Ki, dD as Ht, dE as Zc, dF as ed, dG as td, dH as ad, dI as Ui, dJ as Gi, X as Hi, dK as Wi, dL as nd, dM as sd, dN as rd, dO as An, M as ld, dP as id, dQ as od, dR as ql, dS as cd, E as Cs, t as Or, dT as dd, dU as Mr, b6 as ud, dV as jl, I as gt, dW as md, dX as hd, dY as Qi, dZ as Ji, d_ as pd, d$ as Fr, e0 as Rr, e1 as Yi, e2 as Xi, e3 as Kl, e4 as Kn, e5 as fd, e6 as gd, e7 as xd, e8 as bd, e9 as yd, ea as fs, eb as vd, ec as Nd, ed as Zi, ee as eo, ef as Cd, eg as wd, bR as Sd, eh as Td, ei as to, ej as kd, ek as Dd, bS as ws, el as Ss, b7 as On, b8 as Wt, em as oa, en as Ra, eo as La, ep as ha, eq as Xa, er as Id, es as Ed, et as Ad, eu as Od, ev as Md, ew as Fd, ex as Rd, ey as Ld, ez as Ul, a$ as aa, eA as Pd, eB as Vd, eC as Bd, eD as _d, eE as ao, eF as zd, eG as $d, eH as qd, eI as jd, eJ as Kd, eK as pr, eL as Ud, eM as Gd, eN as fr, eO as Hd, eP as Wd, eQ as Qd, eR as Jd, eS as Gl, ax as gr, at as pa, ah as Yd, ai as Xd, ak as Zd, al as eu, am as tu, an as au, ao as nu, ap as su, aq as ru, bs as lu, eT as iu, eU as Za, eV as en, eW as tn, bI as Lr, bJ as ou, av as cu, eX as du, eY as uu, eZ as mu, e_ as Ts, e$ as st, f0 as rt, f1 as lt, cE as hu, cF as pu, f2 as no, f3 as so, cD as fu, f4 as gu, f5 as xu, f6 as bu, f7 as yu, f8 as vu, f9 as Nu, fa as Cu, fb as wu, fc as Su, fd as Tu, fe as ku, ff as Du, fg as Ta, fh as vn, fi as Ja, fj as Iu, fk as Hl, fl as Eu, fm as Au, fn as $s, fo as Wl, fp as Ou, fq as Mu, fr as Fu, fs as Ru, ft as Lu, R as Pr, g as Mn, fu as qs, fv as ro, aA as Pu, fw as gs, fx as Vu, fy as lo, fz as Bu, fA as io, co as _u, fB as zu, a4 as $u, fC as ns, fD as qu, fE as Ql, fF as ju, fG as Ku, fH as Jl, fI as Uu, fJ as Gu, fK as Hu, fL as Wu, fM as Qu, aj as oo, fN as Ju, fO as Yu, fP as Xu, fQ as Zu, fR as em, fS as tm, fT as am, fU as nm, fV as sm, fW as co, fX as rm, fY as ks, c6 as Ds, fZ as uo, f_ as lm, f$ as im, g0 as mo, g1 as om, g2 as cm, g3 as Is, g4 as js, g5 as dm, g6 as um, g7 as mm, g8 as hm, g9 as pm, ga as Yl, gb as an, gc as ho, gd as fm, bU as gm, ge as po, gf as fo, gg as ds, gh as go, gi as xo, gj as Xl, gk as xm, gl as bm, gm as us, gn as ym, go as Vr, gp as vm, gq as xs, h as Fn, i as Rn, k as Ln, j as Pn, l as Vn, m as Bn, gr as Nm, gs as _n, gt as ca, gu as xr, gv as br, gw as zn, gx as bo, gy as Cm, gz as Ks, gA as Us, gB as wm, gC as Gs, gD as Sm, gE as Zl, gF as ei, cJ as Tm, gG as km, cK as Dm, cM as Im, cN as Em, y as Am, gH as Om, gI as Mm, gJ as Fm, bK as Rm, bL as Lm, bM as Pm, br as Es, cA as As, gK as ti, gL as yo, cc as Hs, gM as Vm, gN as Bm, gO as _m, F as zm, aT as $m, gP as qm, gQ as jm, aU as Km } from "./index-
|
|
4
|
+
import { cP as Ei, b as Aa, c as Oa, d as Ma, e as Fa, f as Ya, o as hs, aQ as kt, aV as wt, cQ as Ai, cR as is, p as Ze, cS as Oi, cC as os, ay as In, ar as vt, bH as Sr, aw as nn, aW as qn, aR as Nt, cT as ps, cG as Tr, cU as kc, cV as Mi, cW as Dc, aC as Ns, cX as Ic, cY as Ec, cZ as mr, c_ as cs, u as xa, z as Fi, c$ as Ac, d0 as Oc, d1 as Ri, d2 as Li, d3 as Mc, d4 as Fc, d5 as Rc, aK as Va, aL as ba, aM as ya, aN as jn, aO as ta, aP as Qa, d6 as hr, bz as Sn, d7 as Pi, af as na, ag as ft, d8 as Lc, d9 as Vi, c5 as ma, cH as Bi, da as kr, db as _i, dc as Pc, dd as Vc, de as Bc, C as zi, df as _c, dg as zc, dh as $c, di as qc, dj as jc, dk as Kc, dl as zs, dm as Uc, dn as zl, dp as Gc, dq as $l, dr as Hc, ds as Wc, bD as sn, bE as rn, bF as ln, bG as ct, dt as En, az as $i, du as Qc, a_ as Qt, b0 as Jt, dv as Dr, be as Ir, ae as Er, dw as Jc, dx as Yc, dy as Ar, dz as Xc, dA as qi, dB as ji, dC as Ki, dD as Ht, dE as Zc, dF as ed, dG as td, dH as ad, dI as Ui, dJ as Gi, X as Hi, dK as Wi, dL as nd, dM as sd, dN as rd, dO as An, M as ld, dP as id, dQ as od, dR as ql, dS as cd, E as Cs, t as Or, dT as dd, dU as Mr, b6 as ud, dV as jl, I as gt, dW as md, dX as hd, dY as Qi, dZ as Ji, d_ as pd, d$ as Fr, e0 as Rr, e1 as Yi, e2 as Xi, e3 as Kl, e4 as Kn, e5 as fd, e6 as gd, e7 as xd, e8 as bd, e9 as yd, ea as fs, eb as vd, ec as Nd, ed as Zi, ee as eo, ef as Cd, eg as wd, bR as Sd, eh as Td, ei as to, ej as kd, ek as Dd, bS as ws, el as Ss, b7 as On, b8 as Wt, em as oa, en as Ra, eo as La, ep as ha, eq as Xa, er as Id, es as Ed, et as Ad, eu as Od, ev as Md, ew as Fd, ex as Rd, ey as Ld, ez as Ul, a$ as aa, eA as Pd, eB as Vd, eC as Bd, eD as _d, eE as ao, eF as zd, eG as $d, eH as qd, eI as jd, eJ as Kd, eK as pr, eL as Ud, eM as Gd, eN as fr, eO as Hd, eP as Wd, eQ as Qd, eR as Jd, eS as Gl, ax as gr, at as pa, ah as Yd, ai as Xd, ak as Zd, al as eu, am as tu, an as au, ao as nu, ap as su, aq as ru, bs as lu, eT as iu, eU as Za, eV as en, eW as tn, bI as Lr, bJ as ou, av as cu, eX as du, eY as uu, eZ as mu, e_ as Ts, e$ as st, f0 as rt, f1 as lt, cE as hu, cF as pu, f2 as no, f3 as so, cD as fu, f4 as gu, f5 as xu, f6 as bu, f7 as yu, f8 as vu, f9 as Nu, fa as Cu, fb as wu, fc as Su, fd as Tu, fe as ku, ff as Du, fg as Ta, fh as vn, fi as Ja, fj as Iu, fk as Hl, fl as Eu, fm as Au, fn as $s, fo as Wl, fp as Ou, fq as Mu, fr as Fu, fs as Ru, ft as Lu, R as Pr, g as Mn, fu as qs, fv as ro, aA as Pu, fw as gs, fx as Vu, fy as lo, fz as Bu, fA as io, co as _u, fB as zu, a4 as $u, fC as ns, fD as qu, fE as Ql, fF as ju, fG as Ku, fH as Jl, fI as Uu, fJ as Gu, fK as Hu, fL as Wu, fM as Qu, aj as oo, fN as Ju, fO as Yu, fP as Xu, fQ as Zu, fR as em, fS as tm, fT as am, fU as nm, fV as sm, fW as co, fX as rm, fY as ks, c6 as Ds, fZ as uo, f_ as lm, f$ as im, g0 as mo, g1 as om, g2 as cm, g3 as Is, g4 as js, g5 as dm, g6 as um, g7 as mm, g8 as hm, g9 as pm, ga as Yl, gb as an, gc as ho, gd as fm, bU as gm, ge as po, gf as fo, gg as ds, gh as go, gi as xo, gj as Xl, gk as xm, gl as bm, gm as us, gn as ym, go as Vr, gp as vm, gq as xs, h as Fn, i as Rn, k as Ln, j as Pn, l as Vn, m as Bn, gr as Nm, gs as _n, gt as ca, gu as xr, gv as br, gw as zn, gx as bo, gy as Cm, gz as Ks, gA as Us, gB as wm, gC as Gs, gD as Sm, gE as Zl, gF as ei, cJ as Tm, gG as km, cK as Dm, cM as Im, cN as Em, y as Am, gH as Om, gI as Mm, gJ as Fm, bK as Rm, bL as Lm, bM as Pm, br as Es, cA as As, gK as ti, gL as yo, cc as Hs, gM as Vm, gN as Bm, gO as _m, F as zm, aT as $m, gP as qm, gQ as jm, aU as Km } from "./index-t_L3sxNY.js";
|
|
5
5
|
import { c as $e, C as At, X as et } from "./x-CXDkqdur.js";
|
|
6
6
|
import { F as Ne, B as Z, O as bs, I as Un, c as J, aM as Um, L as $, _ as ae, $ as ne, a0 as se, a1 as re, a2 as j, E as O, Y as Dt, Q as Vt, V as It, W as Et, P as Ot, a as Rt, b as Mt, C as fa, aN as Gm, aE as Tn, aO as Br, aP as vo, aB as _r, az as Hm, Z as Fe, aQ as Wm, e as ga, u as Ie, d as va, aR as zr, aS as Gn, X as Xt, A as No, T as Hn, G as Wn, H as Yt, J as Ia, N as Os, S as Pa, h as Qm, aF as Ea, aT as Jm, aU as Ym, aV as Co, ae as Xm, aH as Zm, aW as eh, aX as th, aY as ai, aZ as ah, a_ as nh, a$ as sh, b0 as rh, aL as lh, b1 as ih, b2 as ni, b3 as oh, b4 as si, R as yr, b5 as on, b6 as ch, a3 as Je, b7 as dh, b8 as $r, b9 as $n, ba as ys, bb as da, bc as ss, bd as ri, be as uh, bf as Pt, bg as mh, M as wo, bh as nt, bi as So, s as li, bj as hh, bk as ph, bl as fh, bm as gh, bn as xh, bo as bh, bp as yh, bq as vh, br as Nh, bs as Ch, bt as wh, bu as Sh, bv as ii, bw as Th, bx as kh, by as Dh, K as Ms } from "./switch-CXMExaSF.js";
|
|
7
7
|
import "./analyze-result-contract-BUgK3759.js";
|
|
8
8
|
import { C as $t, E as vr, S as Fs, M as Ih, a as Eh } from "./search-BHsQIWBV.js";
|
|
9
|
-
import { f as Ah, g as xt, r as To, h as Qn, S as Oh, i as ko, V as Do, e as Mh, C as Fh, R as Rs } from "./use-create-flow-overlay-state-
|
|
9
|
+
import { f as Ah, g as xt, r as To, h as Qn, S as Oh, i as ko, V as Do, e as Mh, C as Fh, R as Rs } from "./use-create-flow-overlay-state-BJR7YAFW.js";
|
|
10
10
|
import { createPortal as Rh } from "react-dom";
|
|
11
11
|
import "./index-CJdxSyQq.js";
|
|
12
12
|
import { P as Lh } from "./palette-Cp1hqZtm.js";
|
|
@@ -586,7 +586,7 @@ result = df.to_dict('records') # must return 'result' as [dict] type
|
|
|
586
586
|
|
|
587
587
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
588
588
|
|
|
589
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return Q.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Txe="DialogDescriptionWarning",Ixe=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${oY(Txe).contentName}}.`;return Q.useEffect(()=>{var s;const o=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},h_=UG,SP=WG,m_=YG,tg=KG,ng=ZG,z0=QG,B0=eY,p_=nY;const ks=h_,sY=SP,Exe=m_,iY=Q.forwardRef(({className:e,...t},n)=>l.jsx(tg,{ref:n,className:p.cn("fixed inset-0 z-50 bg-zinc-950/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));iY.displayName=tg.displayName;const ls=Q.forwardRef(({className:e,children:t,showCloseButton:n=!0,hideOverlay:r=!1,...o},s)=>l.jsxs(Exe,{children:[!r&&l.jsx(p.PortalScope,{children:l.jsx(iY,{})}),l.jsx(p.PortalScope,{children:l.jsxs(ng,{ref:s,className:p.cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 focus:outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...o,children:[t,n?l.jsxs(p_,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[l.jsx(Te.X,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]}):null]})})]}));ls.displayName=ng.displayName;const Xi=({className:e,...t})=>l.jsx("div",{className:p.cn("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Xi.displayName="DialogHeader";const Ic=({className:e,...t})=>l.jsx("div",{className:p.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Ic.displayName="DialogFooter";const cs=Q.forwardRef(({className:e,...t},n)=>l.jsx(z0,{ref:n,className:p.cn("text-lg font-semibold leading-none tracking-tight",e),...t}));cs.displayName=z0.displayName;const Gs=Q.forwardRef(({className:e,...t},n)=>l.jsx(B0,{ref:n,className:p.cn("text-sm text-muted-foreground",e),...t}));Gs.displayName=B0.displayName;function n1(e,t){return`${e.replace(/\/$/,"")}/dashboard-authoring${t}`}function Dxe(e=!0){const{authToken:t,tokenProps:n}=bt();return Rn({queryKey:["dashboard-authoring-sources",n.apiServiceUrl,n.project_id,n.tenantId,n.endUserId,n.orgUserId,t==null?void 0:t.accessToken],enabled:e&&!!(t!=null&&t.accessToken)&&!!n.apiServiceUrl,queryFn:async()=>(await p.getRequest(n1(n.apiServiceUrl,"/sources"),(t==null?void 0:t.accessToken)||"")).sources||[]})}function Mxe(){const{authToken:e,tokenProps:t}=bt(),n=(e==null?void 0:e.accessToken)||"",r=t.apiServiceUrl,o=ss({mutationFn:async a=>(await p.postRequestRegular(n1(r,"/plan"),n,a)).plan}),s=ss({mutationFn:async a=>{const c="domainId"in a?{mode:"suggestions",domainId:a.domainId,datasetNames:a.datasetNames,instruction:a.instruction}:{mode:"suggestions",dataset:a.dataset,instruction:a.instruction};return(await p.postRequestRegular(n1(r,"/plan"),n,c)).suggestions||[]}}),i=ss({mutationFn:async a=>{const c="plan"in a?{plan:a.plan,sharing:a.sharing}:{plan:a};return p.postRequestRegular(n1(r,"/create"),n,{...c})}});return{planDashboard:o,suggestDashboards:s,createDashboardFromPlan:i}}const rT="__describe_own__",sb=6,Axe=350;function oT(e){return e.kind==="semantic"?e.label||e.datasetName:e.label||[e.databaseName,e.schemaName,e.tableName].filter(Boolean).join(".")||e.tableName}function E$(e){if(e){if(typeof e=="string")return e;if(typeof e=="object"){const t=e;return typeof t.label=="string"&&t.label||typeof t.name=="string"&&t.name||typeof t.qualifiedFieldName=="string"&&t.qualifiedFieldName||void 0}}}function D$(e){return e.kind==="semantic"?{kind:"semantic",domainId:e.domainId,datasetName:e.datasetName,datasetId:e.datasetId,label:e.label,connectionId:e.connectionId}:{kind:"physical",connectionId:e.connectionId,databaseName:e.databaseName,schemaName:e.schemaName,tableName:e.tableName,label:e.label}}function Rxe(e){const t=new Map;for(const n of e){if(n.kind!=="semantic")continue;const r=n.domainId;t.has(r)||t.set(r,{id:r,label:n.domainLabel||n.domainName||"Semantic domain",items:[]}),t.get(r).items.push(n)}return Array.from(t.values())}function aw(e){return Array.from(new Set(Array.from(e).map(t=>t.trim()).filter(Boolean)))}function Pxe(e){switch(e){case"kpi":return"KPI";case"line":return"Trend";case"bar":case"stackedBar":return"Breakdown";case"table":return"Table";case"text":return"Text";default:return e?e.replace(/([A-Z])/g," $1"):"Card"}}function Fxe(e){return(e==null?void 0:e.kind)==="semantic"?e.datasetName:void 0}function aY(e){var o,s,i,a,c,u,d;const t=e.analyticsIntent,n=new Set,r=f=>{const h=Fxe(f);h&&n.add(h)};return t&&(r(t.source),t.kind==="metric"&&((o=t.measures)==null||o.forEach(f=>r(f.source)),r((s=t.primaryMeasure)==null?void 0:s.source),(i=t.dimensions)==null||i.forEach(f=>r(f.source)),r((a=t.dateField)==null?void 0:a.source),(c=t.filters)==null||c.forEach(f=>r(f.field.source))),t.kind==="records"&&((u=t.fields)==null||u.forEach(f=>r(f.source)),r((d=t.dateField)==null?void 0:d.source))),n}function Oxe(e){var s;const t=e.sheets.flatMap(i=>i.cards),n=t.filter(i=>i.type!=="text"),r=n.filter(i=>aY(i).size>1),o=((s=e.filterInputs)==null?void 0:s.length)||0;return{cards:t,dataCards:n,joinedCards:r,filterCount:o,datasetCount:e.datasets.length}}function lY({open:e,onOpenChange:t,onCreateBlank:n,onAiCreateSuccess:r,isCreatingBlank:o,sources:s,sourcesLoading:i=!1,suggestDashboards:a,planDashboard:c,createDashboardFromPlan:u,settingsSlot:d,blankDescription:f="",description:h="Start blank, or pick a dataset to see starter ideas tailored to your data.",canCreate:m=!0,initialDomainId:g}){const[b,x]=S.useState("blank"),[y,w]=S.useState(null),[v,C]=S.useState([]),[N,_]=S.useState(!1),[k,j]=S.useState(null),[I,T]=S.useState(""),[E,D]=S.useState(""),[A,P]=S.useState(""),[M,L]=S.useState(""),[$,z]=S.useState(""),[W,F]=S.useState("idle"),[X,Y]=S.useState("choose"),[R,K]=S.useState(null),O=S.useRef(!1),U=S.useRef(0),V=S.useRef(null),H=S.useRef(!1),[q,B]=S.useState(!1),G=()=>{U.current+=1,Y("choose"),K(null)},Z=S.useMemo(()=>s.filter(Ae=>Ae.kind==="semantic"),[s]),J=Z.length>0,oe=b,ie=x,ue=oe==="blank",xe=oe==="dataset",te=i?"Checking datasets...":J?void 0:"No datasets found",ye=S.useMemo(()=>{const Ae=new Set;for(const ht of Z)ht.kind==="semantic"&&Ae.add(ht.domainId);return Ae.size===1},[Z]),se=S.useMemo(()=>Rxe(Z),[Z]);S.useEffect(()=>{if(!e){V.current=null,H.current=!1;return}if(!g||H.current||V.current===g)return;if((y==null?void 0:y.kind)==="semantic"&&y.domainId===g){V.current=g;return}const Ae=Z.filter(Xe=>Xe.kind==="semantic"&&Xe.domainId===g),ht=Ae[0];ht&&(V.current=g,ie("dataset"),w(ht),C(Ae.map(Xe=>Xe.datasetName)),_(Ae.length>1),j(null),U.current+=1,Y("choose"),K(null),z(""))},[g,e,y,Z,ie]),S.useEffect(()=>{!y&&ye&&Z.length>0&&(w(Z[0]),C([Z[0].datasetName]))},[y,ye,Z]);const Ie=S.useMemo(()=>!y||y.kind!=="semantic"?[]:Z.filter(Ae=>Ae.kind==="semantic"&&Ae.domainId===y.domainId),[y,Z]);S.useEffect(()=>{if(!y||y.kind!=="semantic"){v.length>0&&C([]),N&&_(!1);return}const Ae=new Set(Ie.map(Xe=>Xe.datasetName));let ht=aw(v).filter(Xe=>Ae.has(Xe));N||(ht=ht.slice(0,sb)),ht.length===0&&ht.push(y.datasetName),ht.join("|")!==v.join("|")&&C(ht),Ie.length<=1&&N&&_(!1)},[v,Ie,y,N]);const fe=S.useMemo(()=>new Set(v),[v]),me=S.useMemo(()=>!y||y.kind!=="semantic"?[]:Ie.filter(Ae=>fe.has(Ae.datasetName)),[fe,Ie,y]),we=N?Ie.length:me.length,ee=xe&&!!y&&we>0,re=S.useMemo(()=>N?new Set(Ie.map(Ae=>Ae.datasetName)):fe,[N,Ie,fe]),ne=S.useMemo(()=>new Set(Ie.map(Ae=>Ae.datasetName)),[Ie]),le=!N&&v.length<sb,ae=ee&&!N&&me.length>1?me.map(Ae=>Ae.datasetName):void 0,Ne=S.useMemo(()=>!y||!ee?"":y.kind==="semantic"?N?`${y.domainId}:whole`:`${y.domainId}:${me.map(Ae=>Ae.datasetName).join(",")}`:[y.connectionId,y.databaseName,y.schemaName,y.tableName].filter(Boolean).join(":"),[ee,me,y,N]),[Ee,Ve]=S.useState(Ne);S.useEffect(()=>{const Ae=window.setTimeout(()=>{Ve(Ne)},Axe);return()=>window.clearTimeout(Ae)},[Ne]);const ge=Ne===Ee;S.useEffect(()=>{e||(ie("blank"),w(null),C([]),_(!1),j(null),T(""),D(""),P(""),L(""),z(""),F("idle"),G())},[e,ie]);const pe=S.useMemo(()=>{if(!y||!ee||!ge)return null;if(y.kind==="semantic"&&(N||me.length>1))return["dashboard-suggestions","semantic-domain",y.domainId,N?"whole":me.map(Ae=>Ae.datasetName).join(","),E];if(y.kind==="semantic"){const Ae=me[0]||y;return["dashboard-suggestions","semantic",Ae.domainId,Ae.datasetName,E]}return["dashboard-suggestions","physical",y.connectionId,y.databaseName,y.schemaName,y.tableName,E]},[E,ee,me,y,ge,N]),ze=S.useMemo(()=>!y||!ee||!ge?null:y.kind==="semantic"&&(N||me.length>1)?{domainId:y.domainId,datasetNames:ae,instruction:E||void 0}:{dataset:D$(me[0]||y),instruction:E||void 0},[E,ee,ae,me,y,ge,N]),Le=Rn({queryKey:pe??["dashboard-suggestions","idle"],queryFn:()=>a(ze),enabled:!!ze&&e,staleTime:5*60*1e3,gcTime:10*60*1e3}),Be=Le.data??null,Ke=(pe==null?void 0:pe.join("|"))??"";S.useEffect(()=>{j(null),G()},[Ke]);const Je=()=>{!y||!ee||(j(null),G(),Le.refetch())},Ce=S.useMemo(()=>(Be==null?void 0:Be.find(Ae=>Ae.id===k))||null,[Be,k]),Qe=(y==null?void 0:y.kind)==="semantic"&&se.find(Ae=>Ae.id===y.domainId)||null,He=(Qe==null?void 0:Qe.label)||"this domain",_e=y?N?`All ${Ie.length} datasets in ${He}`:`${we} of ${Ie.length} datasets in ${He}`:te||"Pick data to see recommendations",Me=Ae=>{if(Ae.kind!=="semantic")return;H.current=!0;const ht=(y==null?void 0:y.kind)==="semantic"&&y.domainId===Ae.domainId;w(Ae),_(!1),C(Xe=>ht&&Xe.length>0&&!N?Xe.slice(0,sb):[Ae.datasetName]),j(null),G(),z("")},De=Ae=>{if(Ae.kind!=="semantic")return;H.current=!0;const ht=(y==null?void 0:y.kind)==="semantic"&&y.domainId===Ae.domainId;w(Ae),_(!1),C(Xe=>{const ce=ht&&!N?Xe:[],Pe=new Set(ce);if(Pe.has(Ae.datasetName))Pe.delete(Ae.datasetName);else{if(Pe.size>=sb)return aw(Pe);Pe.add(Ae.datasetName)}return Pe.size===0&&Pe.add(Ae.datasetName),aw(Pe)}),j(null),G(),z("")},je=Ae=>{const ht=Ae.items[0];ht&&(H.current=!0,w(ht),C(Ae.items.map(Xe=>Xe.datasetName)),_(!0),j(null),G(),z(""))},Ue=Ae=>{const ht=Ie.find(Xe=>Xe.datasetName===Ae);ht&&(re.has(Ae)||De(ht))},mt=I.trim(),pt=ee&&mt!==E,ct=()=>{pt&&(D(mt),j(null),G(),z(""))},ft=Ae=>{Ae.key!=="Enter"||Ae.shiftKey||Ae.nativeEvent.isComposing||(Ae.preventDefault(),ct())},nt=k===rT,At=k!==null&&!nt,Re=A.trim().length>0,Ye=At||nt&&Re,et=M.trim().length>0,it=xe&&ee&&!N&&me.length===1,wt=xe&&ee&&!Ye&&!it,zt=ue||xe&&!Ye&&it,It=X==="review"&&!!R,en=ue?et:xe&&ee&&(Ye||et&&it),Tt=q||c.isPending||u.isPending||o,ot=()=>{var ce;if(!y)return null;const Ae=(Ce==null?void 0:Ce.prompt)||A.trim()||"Create a starter dashboard.",ht=aw(((ce=Ce==null?void 0:Ce.datasets)==null?void 0:ce.map(Pe=>Pe.name))||[]),Xe=y.kind==="semantic"?ht.length>1?ht:ae:void 0;return y.kind==="semantic"&&(N||me.length>1)?{prompt:Ae,domainId:y.domainId,datasetNames:Xe}:{prompt:Ae,dataset:D$(me[0]||y)}},St=async()=>{if(O.current||Tt)return;O.current=!0,B(!0),z("");let Ae=null;try{if(ue){await n({title:M.trim()||"Untitled dashboard",description:f});return}if(!y)return;if(!Ye){if(!it)return;await n({title:M.trim()||"Untitled dashboard",description:f,dataset:me[0]||y});return}if(!R){const ce=ot();if(!ce)return;const Pe=U.current+1;U.current=Pe,Ae=Pe,F("planning");const gt=await c.mutateAsync(ce);if(U.current!==Pe)return;K(gt),Y("review");return}const ht=M.trim()?{...R,title:M.trim()}:R;F("validating");const Xe=await u.mutateAsync(ht);r(Xe)}catch(ht){if(Ae!==null&&U.current!==Ae)return;z(p.getRequestErrorMessage(ht,"The dashboard could not be created from this recommendation."))}finally{O.current=!1,B(!1),F("idle")}};return l.jsx(ks,{open:e,onOpenChange:t,children:l.jsxs(ls,{className:`flex max-w-[94vw] flex-col gap-0 overflow-hidden p-0 transition-[width,height] duration-300 ease-out motion-reduce:transition-none ${xe?"h-[720px] max-h-[88vh] w-[1120px]":"h-[440px] w-[520px]"}`,children:[l.jsx("div",{className:"shrink-0 border-b border-border px-5 pt-4 pb-3.5",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx(cs,{className:"text-[15px] font-semibold tracking-tight",children:"New dashboard"}),l.jsx(Gs,{className:"mt-1 text-[12px] leading-[1.5] text-muted-foreground",children:xe?te||"Pick data on the left, then choose a starter idea.":h})]}),xe&&l.jsx("button",{type:"button",onClick:()=>{H.current=!0,ie("blank"),j(null),P(""),G(),z("")},className:"mr-6 mt-0.5 text-[11px] font-medium text-muted-foreground hover:text-foreground",children:"Start blank instead"})]})}),ue?l.jsxs("div",{className:"flex-1 overflow-y-auto px-5 py-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[l.jsx(M$,{kind:"blank",selected:!0,onClick:()=>{H.current=!0,ie("blank"),j(null),P(""),z("")}}),l.jsx(M$,{kind:"dataset",selected:!1,hint:te,onClick:()=>{ie("dataset"),z("")}})]}),l.jsxs("div",{className:"mt-4",children:[l.jsx(A$,{children:"Title"}),l.jsx("input",{type:"text",value:M,onChange:Ae=>L(Ae.target.value),placeholder:"Name your dashboard",className:"mt-1 block h-7 w-full rounded-[5px] border border-border bg-background px-2 text-[12px] text-foreground focus:border-foreground/40 focus:outline-none"})]}),d?l.jsx("div",{className:"mt-4",children:d}):null]}):l.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-[320px_1fr] overflow-hidden",children:[l.jsx(Bxe,{groups:se,loading:i,selectedSource:y,selectedDatasetNames:fe,useWholeDomain:N,selectionLimit:sb,onPickSource:Me,onToggleDataset:De,onUseWholeDomain:je,summary:ee?_e:null}),l.jsxs("div",{className:"flex min-w-0 flex-col overflow-hidden",children:[X==="choose"&&l.jsx("div",{className:"shrink-0 border-b border-border px-4 py-3",children:l.jsxs("div",{className:"flex items-end gap-2 rounded-[6px] border border-border bg-background px-3 py-2 focus-within:border-foreground/40",children:[l.jsx("textarea",{rows:2,value:I,onChange:Ae=>T(Ae.target.value),onKeyDown:ft,placeholder:"Add context to steer every idea. e.g. focus on last quarter, use USD, exclude internal accounts.",className:"block flex-1 resize-none bg-transparent text-[12px] leading-[1.55] text-foreground placeholder:text-muted-foreground focus:outline-none"}),l.jsx(p.Button,{type:"button",size:"xs",variant:mt?"default":"secondary",disabled:!pt,onClick:ct,children:"Update ideas"})]})}),l.jsxs("div",{className:"flex shrink-0 items-center gap-4 border-b border-border px-4 py-2",children:[l.jsx($xe,{step:It?"review":"choose"}),!It&&l.jsxs("button",{type:"button",onClick:Je,disabled:!ee||Be===null,className:"ml-auto inline-flex h-6 items-center gap-1 rounded-[3px] px-1.5 text-[10.5px] text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-50",children:[l.jsx(Kf,{className:"h-2.5 w-2.5"}),"Suggest more"]})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[It?l.jsx(zxe,{plan:R,titleOverride:M.trim()}):ee?l.jsx("div",{children:Be===null?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[l.jsx(p.LoaderCircle,{className:"h-3 w-3 animate-spin"}),"Fetching recommendations…"]}),l.jsx("div",{className:"grid grid-cols-2 gap-2.5",children:Array.from({length:4}).map((Ae,ht)=>l.jsx(qxe,{},ht))})]}):l.jsxs("div",{className:"grid grid-cols-2 gap-2.5",children:[Be.slice(0,4).map(Ae=>l.jsx(Vxe,{suggestion:Ae,selected:k===Ae.id,selectedDatasetNames:re,domainDatasetNames:ne,canAddDataset:le,onAddDataset:Ue,onClick:()=>{j(ht=>ht===Ae.id?null:Ae.id),P(""),G(),z("")}},Ae.id)),l.jsx(Uxe,{selected:nt,onClick:()=>{j(Ae=>Ae===rT?null:rT),G(),z("")}})]})}):l.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-1 text-center",children:[l.jsx(Bi,{className:"h-5 w-5 text-muted-foreground"}),l.jsx("div",{className:"mt-2 text-[12.5px] font-medium text-foreground",children:i?"Loading datasets…":"Pick data to see recommendations"}),l.jsx("div",{className:"max-w-[320px] text-[11.5px] leading-relaxed text-muted-foreground",children:"Pick one or more datasets on the left, or All datasets in a domain."})]}),nt&&l.jsx("div",{className:"mt-3 rounded-[5px] border border-border bg-background focus-within:border-foreground/40",children:l.jsx("textarea",{rows:3,autoFocus:!0,value:A,onChange:Ae=>{P(Ae.target.value),G(),z("")},placeholder:"e.g. Executive view with revenue KPIs, weekly trend, and a top-customers table.",className:"block w-full resize-none bg-transparent px-2.5 py-2 text-[12px] leading-[1.55] text-foreground placeholder:text-muted-foreground focus:outline-none"})}),ee&&(Ye||it)&&l.jsxs("div",{className:"mt-4",children:[l.jsx(A$,{children:zt?"Title":"Title (optional)"}),l.jsx("input",{type:"text",value:M,onChange:Ae=>L(Ae.target.value),placeholder:zt?"Name your dashboard":(Ce==null?void 0:Ce.title)||"We will suggest one",className:"mt-1 block h-7 w-full rounded-[5px] border border-border bg-background px-2 text-[12px] text-foreground focus:border-foreground/40 focus:outline-none"})]}),wt&&l.jsx("div",{className:"mt-4 rounded-[5px] border border-border bg-muted/30 px-3 py-2 text-[11.5px] leading-relaxed text-muted-foreground",children:"Choose a recommendation or describe what you want to create from this data scope."}),$&&l.jsx("div",{className:"mt-4 rounded-[5px] border border-destructive/30 bg-destructive/5 px-3 py-2 text-[11.5px] leading-relaxed text-destructive",children:$}),d?l.jsx("div",{className:"mt-4",children:d}):null]})]})]}),l.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-t border-border bg-muted/30 px-5 py-2.5",children:[Ye&&Tt?l.jsx("span",{className:"text-[11px] text-muted-foreground",children:W==="validating"?"Validating cards against your data.":"This may take up to 30 seconds."}):l.jsx("span",{}),l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx(p.Button,{type:"button",variant:"ghost",size:"xs",onClick:()=>t(!1),disabled:Tt,children:"Cancel"}),It?l.jsx(p.Button,{type:"button",variant:"secondary",size:"xs",onClick:()=>{G(),z("")},disabled:Tt,children:"Back to ideas"}):null,l.jsx(p.Button,{type:"button",size:"xs",disabled:!en||!m||Tt,onClick:St,children:Tt?l.jsxs(l.Fragment,{children:[l.jsx(p.LoaderCircle,{className:"h-3 w-3 animate-spin"}),Ye?W==="planning"?"Planning Insights…":W==="validating"?"Validating cards…":"Building dashboard…":"Creating…"]}):l.jsxs(l.Fragment,{children:[Ye&&!It?"Review plan":"Create dashboard",l.jsx(t_,{className:"h-3 w-3"})]})})]})]})]})})}function Lxe({open:e,onOpenChange:t,onCreateBlank:n,onAiCreateSuccess:r,isCreatingBlank:o}){const s=Dxe(e),{suggestDashboards:i,planDashboard:a,createDashboardFromPlan:c}=Mxe();return l.jsx(lY,{open:e,onOpenChange:t,onCreateBlank:n,onAiCreateSuccess:r,isCreatingBlank:o,sources:s.data||[],sourcesLoading:s.isLoading,suggestDashboards:i.mutateAsync,planDashboard:a,createDashboardFromPlan:c})}function $xe({step:e}){const t=[{id:"choose",label:"Choose idea"},{id:"review",label:"Review plan"}],n=t.findIndex(r=>r.id===e);return l.jsx("div",{className:"flex items-center gap-2",children:t.map((r,o)=>{const s=r.id===e,i=o<n;return l.jsxs("div",{className:"flex items-center gap-2",children:[o>0&&l.jsx("span",{className:"h-px w-4 bg-border","aria-hidden":"true"}),l.jsxs("span",{className:`inline-flex h-5 items-center gap-1 rounded-full px-2 text-[10px] font-medium ${s?"bg-foreground text-background":i?"bg-muted text-foreground":"bg-transparent text-muted-foreground"}`,children:[i?l.jsx(p.Check,{className:"h-2.5 w-2.5"}):l.jsx("span",{children:o+1}),r.label]})]},r.id)})})}function zxe({plan:e,titleOverride:t}){const n=Oxe(e),r=e.datasets.map(s=>s.kind==="semantic"?s.label||s.datasetName:s.kind==="physical"?s.label||[s.databaseName,s.schemaName,s.tableName].filter(Boolean).join(".")||s.tableName:s.label||"Dataset"),o=[...(e.warnings||[]).map(s=>s.message),...e.unresolvedRequests||[]].filter(Boolean);return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:t||e.title||"Dashboard plan"}),e.description&&l.jsx("div",{className:"mt-1 max-w-[680px] text-[11.5px] leading-relaxed text-muted-foreground",children:e.description})]}),l.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[l.jsx(lw,{label:"Cards",value:n.dataCards.length}),l.jsx(lw,{label:"Datasets",value:n.datasetCount}),l.jsx(lw,{label:"Filters",value:n.filterCount}),l.jsx(lw,{label:"Joined cards",value:n.joinedCards.length})]}),l.jsxs("div",{children:[l.jsx("div",{className:"mb-1.5 text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Cards to create"}),l.jsx("div",{className:"divide-y divide-border rounded-[6px] border border-border",children:n.cards.slice(0,zhe.DASHBOARD_AUTHORING_MAX_GENERATED_CARDS).map(s=>{const i=Array.from(aY(s));return l.jsxs("div",{className:"grid grid-cols-[88px_1fr_auto] items-center gap-2 px-2.5 py-2",children:[l.jsx("span",{className:"rounded-[3px] bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground",children:Pxe(s.type)}),l.jsx("span",{className:"min-w-0 truncate text-[12px] text-foreground",children:s.title}),i.length>0&&l.jsx("span",{className:"max-w-[220px] truncate text-[10.5px] text-muted-foreground",children:i.join(" + ")})]},s.id)})})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsx(sT,{title:"Datasets",empty:"No datasets selected",items:r}),l.jsx(sT,{title:"Filters",empty:"No dashboard filters planned",items:(e.filterInputs||[]).map(s=>s.label)})]}),n.joinedCards.length>0&&l.jsx(sT,{title:"Relationship-based cards",empty:"No relationship-based cards planned",items:n.joinedCards.map(s=>s.title)}),o.length>0&&l.jsx("div",{className:"rounded-[6px] border border-amber-300/60 bg-amber-50/60 px-3 py-2 text-[11.5px] leading-relaxed text-amber-800 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300",children:o.slice(0,3).map(s=>l.jsx("div",{children:s},s))})]})}function lw({label:e,value:t}){return l.jsxs("div",{className:"rounded-[6px] border border-border bg-muted/20 px-2.5 py-2",children:[l.jsx("div",{className:"text-[15px] font-semibold tabular-nums text-foreground",children:t}),l.jsx("div",{className:"mt-0.5 truncate text-[10px] font-medium uppercase tracking-[0.06em] text-muted-foreground",children:e})]})}function sT({title:e,empty:t,items:n}){return l.jsxs("div",{children:[l.jsx("div",{className:"mb-1.5 text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:e}),l.jsx("div",{className:"min-h-10 rounded-[6px] border border-border px-2.5 py-2 text-[11.5px] leading-relaxed",children:n.length>0?l.jsx("div",{className:"flex flex-wrap gap-1.5",children:n.slice(0,8).map(r=>l.jsx("span",{className:"max-w-full truncate rounded-[3px] bg-muted px-1.5 py-0.5 text-muted-foreground",children:r},r))}):l.jsx("span",{className:"text-muted-foreground",children:t})})]})}function Bxe({groups:e,loading:t,selectedSource:n,selectedDatasetNames:r,useWholeDomain:o,selectionLimit:s,onPickSource:i,onToggleDataset:a,onUseWholeDomain:c,summary:u}){const[d,f]=S.useState(""),[h,m]=S.useState({}),g=d.trim().toLowerCase(),b=(n==null?void 0:n.kind)==="semantic"?n.domainId:null,x=!o&&r.size>=s,y=C=>!g||(C||"").toLowerCase().includes(g),w=e.filter(C=>y(C.label)||C.items.some(N=>y(oT(N)))),v=C=>h[C.id]!==void 0?h[C.id]:g||e.length===1?!0:C.id===b;return l.jsxs("div",{className:"flex min-w-0 flex-col overflow-hidden border-r border-border",children:[l.jsxs("div",{className:"shrink-0 border-b border-border px-3 py-2.5",children:[l.jsxs("div",{className:"flex items-center gap-2 rounded-[5px] border border-border bg-background px-2 focus-within:border-foreground/40",children:[l.jsx(Pt.Search,{className:"h-3 w-3 text-muted-foreground"}),l.jsx("input",{value:d,onChange:C=>f(C.target.value),placeholder:"Search datasets…",className:"h-7 flex-1 bg-transparent text-[12px] text-foreground placeholder:text-muted-foreground focus:outline-none"}),d&&l.jsx("button",{type:"button",onClick:()=>f(""),className:"flex h-4 w-4 items-center justify-center rounded-[3px] text-muted-foreground hover:bg-accent hover:text-foreground",children:l.jsx(Te.X,{className:"h-2.5 w-2.5"})})]}),l.jsxs("div",{className:"mt-2.5 flex items-center justify-between gap-2",children:[l.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Dashboard scope"}),x&&l.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["Max ",s," · clear one to swap"]})]})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto px-2 py-2",children:[t&&l.jsxs("div",{className:"flex items-center gap-2 px-1 py-2 text-[11px] text-muted-foreground",children:[l.jsx(p.LoaderCircle,{className:"h-3 w-3 animate-spin"}),"Loading datasets…"]}),!t&&w.length===0&&l.jsxs("div",{className:"flex h-full flex-col items-center justify-center px-4 text-center",children:[l.jsx("div",{className:"text-[12px] text-foreground",children:"No datasets found"}),l.jsx("div",{className:"mt-1 text-[11px] text-muted-foreground",children:"Try a different search or connect a semantic domain."})]}),w.map(C=>{const N=v(C),_=C.items.filter(T=>b===C.id&&r.has(T.datasetName)).length,k=b===C.id&&o,j=y(C.label),I=g&&!j?C.items.filter(T=>y(oT(T))):C.items;return l.jsxs("div",{className:"mb-0.5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 rounded-[4px] px-1.5 py-1.5 hover:bg-accent/60",children:[l.jsxs("button",{type:"button",onClick:()=>m(T=>({...T,[C.id]:!N})),className:"flex min-w-0 flex-1 items-center gap-1.5 text-left",children:[N?l.jsx(Te.ChevronDown,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):l.jsx(Pt.ChevronRight,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),l.jsx(Bi,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),l.jsx("span",{className:"truncate text-[12px] font-medium text-foreground",children:C.label}),l.jsx("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:_>0?`${_}/${C.items.length}`:C.items.length})]}),k?l.jsxs("button",{type:"button",onClick:()=>i(C.items[0]),className:"inline-flex h-5 items-center gap-1 rounded-[3px] bg-foreground px-1.5 text-[10px] font-medium text-background",title:"All datasets in this domain are selected. Click to go back to picking datasets.",children:[l.jsx(P0,{className:"h-2.5 w-2.5"}),"All datasets"]}):l.jsx("button",{type:"button",onClick:()=>c(C),className:"inline-flex h-5 items-center rounded-[3px] border border-border px-1.5 text-[10px] font-medium text-muted-foreground hover:border-foreground/40 hover:text-foreground",title:"Use every dataset in this domain",children:"All datasets"})]}),N&&l.jsx("div",{className:"ml-3.5 border-l border-border pl-1.5",children:I.map(T=>{const E=b===C.id&&r.has(T.datasetName),D=b===C.id&&!o&&!E&&r.size>=s;return l.jsxs("button",{type:"button",onClick:()=>a(T),disabled:D,className:`flex w-full items-center gap-2 rounded-[4px] px-1.5 py-1.5 text-left ${E?"bg-accent":"hover:bg-accent/60"} ${D?"cursor-not-allowed opacity-45 hover:bg-transparent":""}`,children:[l.jsx("span",{className:`flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded-[4px] border ${E?"border-foreground bg-foreground text-background":"border-border"}`,children:E&&l.jsx(p.Check,{className:"h-2.5 w-2.5"})}),l.jsx(p.Table2,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),l.jsx("span",{className:"flex-1 truncate text-[12px] text-foreground/90",children:oT(T)}),E$(T.primaryDateField)&&l.jsx("span",{className:"truncate text-[10px] text-muted-foreground",children:E$(T.primaryDateField)})]},`${C.id}:${T.datasetName}`)})})]},C.id)})]}),l.jsx("div",{className:"shrink-0 border-t border-border px-3 py-2.5 text-[11px] leading-relaxed",children:u?l.jsxs("span",{className:"flex items-center gap-1.5 text-muted-foreground",children:[l.jsx(Mpe,{className:"h-3 w-3 shrink-0"}),l.jsx("span",{className:"font-medium text-foreground",children:u})]}):l.jsx("span",{className:"text-muted-foreground",children:"Pick data to see recommendations."})})]})}function Vxe({suggestion:e,selected:t,selectedDatasetNames:n,domainDatasetNames:r,canAddDataset:o,onAddDataset:s,onClick:i}){var a;return l.jsxs("div",{className:`group relative flex flex-col overflow-hidden rounded-[5px] border bg-background transition-colors ${t?"border-foreground":"border-border hover:border-foreground/30"}`,children:[l.jsxs("button",{type:"button",onClick:i,className:"block w-full px-2.5 pt-2.5 pb-1.5 text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-foreground/40",children:[l.jsxs("div",{className:"flex items-start justify-between gap-2",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"truncate text-[12.5px] font-medium text-foreground",title:e.title,children:e.title}),l.jsx("div",{className:"mt-0.5 line-clamp-2 text-[11px] leading-[1.4] text-muted-foreground",title:e.description,children:e.description})]}),t&&l.jsx("div",{className:"flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded-full bg-foreground",children:l.jsx(p.Check,{className:"h-2.5 w-2.5 text-background"})})]}),l.jsx("div",{className:"mt-2 flex gap-1",children:e.preview.slice(0,5).map((c,u)=>l.jsx(Wxe,{kind:c},u))})]}),l.jsx("div",{className:"flex flex-wrap items-center gap-1.5 px-2.5 pb-2.5 pt-1.5 text-[10px] text-muted-foreground",children:(a=e.datasets)!=null&&a.length?l.jsx(Hxe,{datasets:e.datasets,relationshipHints:e.relationshipHints,selectedDatasetNames:n,domainDatasetNames:r,canAddDataset:o,onAddDataset:s}):l.jsxs(l.Fragment,{children:[l.jsxs("span",{children:[e.cardCount," cards"]}),e.filterCount>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-border",children:"·"}),l.jsxs("span",{children:[e.filterCount," filter",e.filterCount>1?"s":""]})]})]})})]})}function Hxe({datasets:e,relationshipHints:t,selectedDatasetNames:n,domainDatasetNames:r,canAddDataset:o,onAddDataset:s}){const i=t!=null&&t.length?t.join(`
|
|
589
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return Q.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Txe="DialogDescriptionWarning",Ixe=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${oY(Txe).contentName}}.`;return Q.useEffect(()=>{var s;const o=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},h_=UG,SP=WG,m_=YG,tg=KG,ng=ZG,z0=QG,B0=eY,p_=nY;const ks=h_,sY=SP,Exe=m_,iY=Q.forwardRef(({className:e,...t},n)=>l.jsx(tg,{ref:n,className:p.cn("fixed inset-0 z-50 bg-zinc-950/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));iY.displayName=tg.displayName;const ls=Q.forwardRef(({className:e,children:t,showCloseButton:n=!0,hideOverlay:r=!1,...o},s)=>l.jsxs(Exe,{children:[!r&&l.jsx(p.PortalScope,{children:l.jsx(iY,{})}),l.jsx(p.PortalScope,{children:l.jsxs(ng,{ref:s,className:p.cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 focus:outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...o,children:[t,n?l.jsxs(p_,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[l.jsx(Te.X,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]}):null]})})]}));ls.displayName=ng.displayName;const Xi=({className:e,...t})=>l.jsx("div",{className:p.cn("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Xi.displayName="DialogHeader";const Ic=({className:e,...t})=>l.jsx("div",{className:p.cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Ic.displayName="DialogFooter";const cs=Q.forwardRef(({className:e,...t},n)=>l.jsx(z0,{ref:n,className:p.cn("text-lg font-semibold leading-none tracking-tight",e),...t}));cs.displayName=z0.displayName;const Gs=Q.forwardRef(({className:e,...t},n)=>l.jsx(B0,{ref:n,className:p.cn("text-sm text-muted-foreground",e),...t}));Gs.displayName=B0.displayName;function n1(e,t){return`${e.replace(/\/$/,"")}/dashboard-authoring${t}`}function Dxe(e=!0){const{authToken:t,tokenProps:n}=bt();return Rn({queryKey:["dashboard-authoring-sources",n.apiServiceUrl,n.project_id,n.tenantId,n.endUserId,n.orgUserId,t==null?void 0:t.accessToken],enabled:e&&!!(t!=null&&t.accessToken)&&!!n.apiServiceUrl,queryFn:async()=>(await p.getRequest(n1(n.apiServiceUrl,"/sources"),(t==null?void 0:t.accessToken)||"")).sources||[]})}function Mxe(){const{authToken:e,tokenProps:t}=bt(),n=(e==null?void 0:e.accessToken)||"",r=t.apiServiceUrl,o=ss({mutationFn:async a=>(await p.postRequestRegular(n1(r,"/plan"),n,a)).plan}),s=ss({mutationFn:async a=>{const c="domainId"in a?{mode:"suggestions",domainId:a.domainId,datasetNames:a.datasetNames,instruction:a.instruction}:{mode:"suggestions",dataset:a.dataset,instruction:a.instruction};return(await p.postRequestRegular(n1(r,"/plan"),n,c)).suggestions||[]}}),i=ss({mutationFn:async a=>{const c="plan"in a?{plan:a.plan,sharing:a.sharing}:{plan:a};return p.postRequestRegular(n1(r,"/create"),n,{...c})}});return{planDashboard:o,suggestDashboards:s,createDashboardFromPlan:i}}const rT="__describe_own__",sb=6,Axe=350;function oT(e){return e.kind==="semantic"?e.label||e.datasetName:e.label||[e.databaseName,e.schemaName,e.tableName].filter(Boolean).join(".")||e.tableName}function E$(e){if(e){if(typeof e=="string")return e;if(typeof e=="object"){const t=e;return typeof t.label=="string"&&t.label||typeof t.name=="string"&&t.name||typeof t.qualifiedFieldName=="string"&&t.qualifiedFieldName||void 0}}}function D$(e){return e.kind==="semantic"?{kind:"semantic",domainId:e.domainId,datasetName:e.datasetName,datasetId:e.datasetId,label:e.label,connectionId:e.connectionId}:{kind:"physical",connectionId:e.connectionId,databaseName:e.databaseName,schemaName:e.schemaName,tableName:e.tableName,label:e.label}}function Rxe(e){const t=new Map;for(const n of e){if(n.kind!=="semantic")continue;const r=n.domainId;t.has(r)||t.set(r,{id:r,label:n.domainLabel||n.domainName||"Semantic domain",items:[]}),t.get(r).items.push(n)}return Array.from(t.values())}function aw(e){return Array.from(new Set(Array.from(e).map(t=>t.trim()).filter(Boolean)))}function Pxe(e){switch(e){case"kpi":return"KPI";case"line":return"Trend";case"bar":case"stackedBar":return"Breakdown";case"table":return"Table";case"text":return"Text";default:return e?e.replace(/([A-Z])/g," $1"):"Card"}}function Fxe(e){return(e==null?void 0:e.kind)==="semantic"?e.datasetName:void 0}function aY(e){var o,s,i,a,c,u,d;const t=e.analyticsIntent,n=new Set,r=f=>{const h=Fxe(f);h&&n.add(h)};return t&&(r(t.source),t.kind==="metric"&&((o=t.measures)==null||o.forEach(f=>r(f.source)),r((s=t.primaryMeasure)==null?void 0:s.source),(i=t.dimensions)==null||i.forEach(f=>r(f.source)),r((a=t.dateField)==null?void 0:a.source),(c=t.filters)==null||c.forEach(f=>r(f.field.source))),t.kind==="records"&&((u=t.fields)==null||u.forEach(f=>r(f.source)),r((d=t.dateField)==null?void 0:d.source))),n}function Oxe(e){var s;const t=e.sheets.flatMap(i=>i.cards),n=t.filter(i=>i.type!=="text"),r=n.filter(i=>aY(i).size>1),o=((s=e.filterInputs)==null?void 0:s.length)||0;return{cards:t,dataCards:n,joinedCards:r,filterCount:o,datasetCount:e.datasets.length}}function lY({open:e,onOpenChange:t,onCreateBlank:n,onAiCreateSuccess:r,isCreatingBlank:o,sources:s,sourcesLoading:i=!1,suggestDashboards:a,planDashboard:c,createDashboardFromPlan:u,settingsSlot:d,blankDescription:f="",description:h="Start blank, or pick a dataset to see starter ideas tailored to your data.",canCreate:m=!0,initialDomainId:g}){const[b,x]=S.useState("blank"),[y,w]=S.useState(null),[v,C]=S.useState([]),[N,_]=S.useState(!1),[k,j]=S.useState(null),[I,T]=S.useState(""),[E,D]=S.useState(""),[A,P]=S.useState(""),[M,L]=S.useState(""),[$,z]=S.useState(""),[W,F]=S.useState("idle"),[X,Y]=S.useState("choose"),[R,K]=S.useState(null),O=S.useRef(!1),U=S.useRef(0),V=S.useRef(null),H=S.useRef(!1),[q,B]=S.useState(!1),G=()=>{U.current+=1,Y("choose"),K(null)},Z=S.useMemo(()=>s.filter(Ae=>Ae.kind==="semantic"),[s]),J=Z.length>0,oe=b,ie=x,ue=oe==="blank",xe=oe==="dataset",te=i?"Checking datasets...":J?void 0:"No datasets found",ye=S.useMemo(()=>{const Ae=new Set;for(const ht of Z)ht.kind==="semantic"&&Ae.add(ht.domainId);return Ae.size===1},[Z]),se=S.useMemo(()=>Rxe(Z),[Z]);S.useEffect(()=>{if(!e){V.current=null,H.current=!1;return}if(!g||H.current||V.current===g)return;if((y==null?void 0:y.kind)==="semantic"&&y.domainId===g){V.current=g;return}const Ae=Z.filter(Xe=>Xe.kind==="semantic"&&Xe.domainId===g),ht=Ae[0];ht&&(V.current=g,ie("dataset"),w(ht),C(Ae.map(Xe=>Xe.datasetName)),_(Ae.length>1),j(null),U.current+=1,Y("choose"),K(null),z(""))},[g,e,y,Z,ie]),S.useEffect(()=>{!y&&ye&&Z.length>0&&(w(Z[0]),C([Z[0].datasetName]))},[y,ye,Z]);const Ie=S.useMemo(()=>!y||y.kind!=="semantic"?[]:Z.filter(Ae=>Ae.kind==="semantic"&&Ae.domainId===y.domainId),[y,Z]);S.useEffect(()=>{if(!y||y.kind!=="semantic"){v.length>0&&C([]),N&&_(!1);return}const Ae=new Set(Ie.map(Xe=>Xe.datasetName));let ht=aw(v).filter(Xe=>Ae.has(Xe));N||(ht=ht.slice(0,sb)),ht.length===0&&ht.push(y.datasetName),ht.join("|")!==v.join("|")&&C(ht),Ie.length<=1&&N&&_(!1)},[v,Ie,y,N]);const fe=S.useMemo(()=>new Set(v),[v]),me=S.useMemo(()=>!y||y.kind!=="semantic"?[]:Ie.filter(Ae=>fe.has(Ae.datasetName)),[fe,Ie,y]),we=N?Ie.length:me.length,ee=xe&&!!y&&we>0,re=S.useMemo(()=>N?new Set(Ie.map(Ae=>Ae.datasetName)):fe,[N,Ie,fe]),ne=S.useMemo(()=>new Set(Ie.map(Ae=>Ae.datasetName)),[Ie]),le=!N&&v.length<sb,ae=ee&&!N&&me.length>1?me.map(Ae=>Ae.datasetName):void 0,Ne=S.useMemo(()=>!y||!ee?"":y.kind==="semantic"?N?`${y.domainId}:whole`:`${y.domainId}:${me.map(Ae=>Ae.datasetName).join(",")}`:[y.connectionId,y.databaseName,y.schemaName,y.tableName].filter(Boolean).join(":"),[ee,me,y,N]),[Ee,Ve]=S.useState(Ne);S.useEffect(()=>{const Ae=window.setTimeout(()=>{Ve(Ne)},Axe);return()=>window.clearTimeout(Ae)},[Ne]);const ge=Ne===Ee;S.useEffect(()=>{e||(ie("blank"),w(null),C([]),_(!1),j(null),T(""),D(""),P(""),L(""),z(""),F("idle"),G())},[e,ie]);const pe=S.useMemo(()=>{if(!y||!ee||!ge)return null;if(y.kind==="semantic"&&(N||me.length>1))return["dashboard-suggestions","semantic-domain",y.domainId,N?"whole":me.map(Ae=>Ae.datasetName).join(","),E];if(y.kind==="semantic"){const Ae=me[0]||y;return["dashboard-suggestions","semantic",Ae.domainId,Ae.datasetName,E]}return["dashboard-suggestions","physical",y.connectionId,y.databaseName,y.schemaName,y.tableName,E]},[E,ee,me,y,ge,N]),ze=S.useMemo(()=>!y||!ee||!ge?null:y.kind==="semantic"&&(N||me.length>1)?{domainId:y.domainId,datasetNames:ae,instruction:E||void 0}:{dataset:D$(me[0]||y),instruction:E||void 0},[E,ee,ae,me,y,ge,N]),Le=Rn({queryKey:pe??["dashboard-suggestions","idle"],queryFn:()=>a(ze),enabled:!!ze&&e,staleTime:5*60*1e3,gcTime:10*60*1e3}),Be=Le.data??null,Ke=(pe==null?void 0:pe.join("|"))??"";S.useEffect(()=>{j(null),G()},[Ke]);const Je=()=>{!y||!ee||(j(null),G(),Le.refetch())},Ce=S.useMemo(()=>(Be==null?void 0:Be.find(Ae=>Ae.id===k))||null,[Be,k]),Qe=(y==null?void 0:y.kind)==="semantic"&&se.find(Ae=>Ae.id===y.domainId)||null,He=(Qe==null?void 0:Qe.label)||"this domain",_e=y?N?`All ${Ie.length} datasets in ${He}`:`${we} of ${Ie.length} datasets in ${He}`:te||"Pick data to see recommendations",Me=Ae=>{if(Ae.kind!=="semantic")return;H.current=!0;const ht=(y==null?void 0:y.kind)==="semantic"&&y.domainId===Ae.domainId;w(Ae),_(!1),C(Xe=>ht&&Xe.length>0&&!N?Xe.slice(0,sb):[Ae.datasetName]),j(null),G(),z("")},De=Ae=>{if(Ae.kind!=="semantic")return;H.current=!0;const ht=(y==null?void 0:y.kind)==="semantic"&&y.domainId===Ae.domainId;w(Ae),_(!1),C(Xe=>{const ce=ht&&!N?Xe:[],Pe=new Set(ce);if(Pe.has(Ae.datasetName))Pe.delete(Ae.datasetName);else{if(Pe.size>=sb)return aw(Pe);Pe.add(Ae.datasetName)}return Pe.size===0&&Pe.add(Ae.datasetName),aw(Pe)}),j(null),G(),z("")},je=Ae=>{const ht=Ae.items[0];ht&&(H.current=!0,w(ht),C(Ae.items.map(Xe=>Xe.datasetName)),_(!0),j(null),G(),z(""))},Ue=Ae=>{const ht=Ie.find(Xe=>Xe.datasetName===Ae);ht&&(re.has(Ae)||De(ht))},mt=I.trim(),pt=ee&&mt!==E,ct=()=>{pt&&(D(mt),j(null),G(),z(""))},ft=Ae=>{Ae.key!=="Enter"||Ae.shiftKey||Ae.nativeEvent.isComposing||(Ae.preventDefault(),ct())},nt=k===rT,At=k!==null&&!nt,Re=A.trim().length>0,Ye=At||nt&&Re,et=M.trim().length>0,it=xe&&ee&&!N&&me.length===1,wt=xe&&ee&&!Ye&&!it,zt=ue||xe&&!Ye&&it,It=X==="review"&&!!R,en=ue?et:xe&&ee&&(Ye||et&&it),Tt=q||c.isPending||u.isPending||o,ot=()=>{var ce;if(!y)return null;const Ae=(Ce==null?void 0:Ce.prompt)||A.trim()||"Create a starter dashboard.",ht=aw(((ce=Ce==null?void 0:Ce.datasets)==null?void 0:ce.map(Pe=>Pe.name))||[]),Xe=y.kind==="semantic"?ht.length>1?ht:ae:void 0;return y.kind==="semantic"&&(N||me.length>1)?{prompt:Ae,domainId:y.domainId,datasetNames:Xe}:{prompt:Ae,dataset:D$(me[0]||y)}},St=async()=>{if(O.current||Tt)return;O.current=!0,B(!0),z("");let Ae=null;try{if(ue){await n({title:M.trim()||"Untitled dashboard",description:f});return}if(!y)return;if(!Ye){if(!it)return;await n({title:M.trim()||"Untitled dashboard",description:f,dataset:me[0]||y});return}if(!R){const ce=ot();if(!ce)return;const Pe=U.current+1;U.current=Pe,Ae=Pe,F("planning");const gt=await c.mutateAsync(ce);if(U.current!==Pe)return;K(gt),Y("review");return}const ht=M.trim()?{...R,title:M.trim()}:R;F("validating");const Xe=await u.mutateAsync(ht);r(Xe)}catch(ht){if(Ae!==null&&U.current!==Ae)return;z(p.getRequestErrorMessage(ht,"The dashboard could not be created from this recommendation."))}finally{O.current=!1,B(!1),F("idle")}};return l.jsx(ks,{open:e,onOpenChange:t,children:l.jsxs(ls,{className:`flex max-w-[94vw] flex-col gap-0 overflow-hidden p-0 transition-[width,height] duration-300 ease-out motion-reduce:transition-none ${xe?"h-[720px] max-h-[88vh] w-[1120px]":"h-[440px] w-[520px]"}`,children:[l.jsx("div",{className:"shrink-0 border-b border-border px-5 pt-4 pb-3.5",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx(cs,{className:"text-[15px] font-semibold tracking-tight",children:"New dashboard"}),l.jsx(Gs,{className:"mt-1 text-[12px] leading-[1.5] text-muted-foreground",children:xe?te||"Pick data on the left, then choose a starter idea.":h})]}),xe&&l.jsx("button",{type:"button",onClick:()=>{H.current=!0,ie("blank"),j(null),P(""),G(),z("")},className:"mr-6 mt-0.5 text-[11px] font-medium text-muted-foreground hover:text-foreground",children:"Start blank instead"})]})}),ue?l.jsxs("div",{className:"flex-1 overflow-y-auto px-5 py-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[l.jsx(M$,{kind:"blank",selected:!0,onClick:()=>{H.current=!0,ie("blank"),j(null),P(""),z("")}}),l.jsx(M$,{kind:"dataset",selected:!1,hint:te,onClick:()=>{ie("dataset"),z("")}})]}),l.jsxs("div",{className:"mt-4",children:[l.jsx(A$,{children:"Title"}),l.jsx("input",{type:"text",value:M,onChange:Ae=>L(Ae.target.value),placeholder:"Name your dashboard",className:"mt-1 block h-7 w-full rounded-[5px] border border-border bg-background px-2 text-[12px] text-foreground focus:border-foreground/40 focus:outline-none"})]}),d?l.jsx("div",{className:"mt-4",children:d}):null]}):l.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-[320px_1fr] overflow-hidden",children:[l.jsx(Bxe,{groups:se,loading:i,selectedSource:y,selectedDatasetNames:fe,useWholeDomain:N,selectionLimit:sb,onPickSource:Me,onToggleDataset:De,onUseWholeDomain:je,summary:ee?_e:null}),l.jsxs("div",{className:"flex min-w-0 flex-col overflow-hidden",children:[X==="choose"&&l.jsx("div",{className:"shrink-0 border-b border-border px-4 py-3",children:l.jsxs("div",{className:"flex items-end gap-2 rounded-[6px] border border-border bg-background px-3 py-2 focus-within:border-foreground/40",children:[l.jsx("textarea",{rows:2,value:I,onChange:Ae=>T(Ae.target.value),onKeyDown:ft,placeholder:"Add context to steer every idea. e.g. focus on last quarter, use USD, exclude internal accounts.",className:"block flex-1 resize-none bg-transparent text-[12px] leading-[1.55] text-foreground placeholder:text-muted-foreground focus:outline-none"}),l.jsx(p.Button,{type:"button",size:"xs",variant:mt?"default":"secondary",disabled:!pt,onClick:ct,children:"Update ideas"})]})}),l.jsxs("div",{className:"flex shrink-0 items-center gap-4 border-b border-border px-4 py-2",children:[l.jsx($xe,{step:It?"review":"choose"}),!It&&l.jsxs("button",{type:"button",onClick:Je,disabled:!ee||Be===null,className:"ml-auto inline-flex h-6 items-center gap-1 rounded-[3px] px-1.5 text-[10.5px] text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-50",children:[l.jsx(Kf,{className:"h-2.5 w-2.5"}),"Suggest more"]})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[It?l.jsx(zxe,{plan:R,titleOverride:M.trim()}):ee?l.jsx("div",{children:Be===null?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[l.jsx(p.LoaderCircle,{className:"h-3 w-3 animate-spin"}),"Fetching recommendations…"]}),l.jsx("div",{className:"grid grid-cols-2 gap-2.5",children:Array.from({length:4}).map((Ae,ht)=>l.jsx(qxe,{},ht))})]}):l.jsxs("div",{className:"grid grid-cols-2 gap-2.5",children:[Be.slice(0,4).map(Ae=>l.jsx(Vxe,{suggestion:Ae,selected:k===Ae.id,selectedDatasetNames:re,domainDatasetNames:ne,canAddDataset:le,onAddDataset:Ue,onClick:()=>{j(ht=>ht===Ae.id?null:Ae.id),P(""),G(),z("")}},Ae.id)),l.jsx(Uxe,{selected:nt,onClick:()=>{j(Ae=>Ae===rT?null:rT),G(),z("")}})]})}):l.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-1 text-center",children:[l.jsx(Bi,{className:"h-5 w-5 text-muted-foreground"}),l.jsx("div",{className:"mt-2 text-[12.5px] font-medium text-foreground",children:i?"Loading datasets…":"Pick data to see recommendations"}),l.jsx("div",{className:"max-w-[320px] text-[11.5px] leading-relaxed text-muted-foreground",children:"Pick one or more datasets on the left, or All datasets in a domain."})]}),nt&&l.jsx("div",{className:"mt-3 rounded-[5px] border border-border bg-background focus-within:border-foreground/40",children:l.jsx("textarea",{rows:3,autoFocus:!0,value:A,onChange:Ae=>{P(Ae.target.value),G(),z("")},placeholder:"e.g. Executive view with revenue KPIs, weekly trend, and a top-customers table.",className:"block w-full resize-none bg-transparent px-2.5 py-2 text-[12px] leading-[1.55] text-foreground placeholder:text-muted-foreground focus:outline-none"})}),ee&&(Ye||it)&&l.jsxs("div",{className:"mt-4",children:[l.jsx(A$,{children:zt?"Title":"Title (optional)"}),l.jsx("input",{type:"text",value:M,onChange:Ae=>L(Ae.target.value),placeholder:zt?"Name your dashboard":(Ce==null?void 0:Ce.title)||"We will suggest one",className:"mt-1 block h-7 w-full rounded-[5px] border border-border bg-background px-2 text-[12px] text-foreground focus:border-foreground/40 focus:outline-none"})]}),wt&&l.jsx("div",{className:"mt-4 rounded-[5px] border border-border bg-muted/30 px-3 py-2 text-[11.5px] leading-relaxed text-muted-foreground",children:"Choose a recommendation or describe what you want to create from this data scope."}),$&&l.jsx("div",{className:"mt-4 rounded-[5px] border border-destructive/30 bg-destructive/5 px-3 py-2 text-[11.5px] leading-relaxed text-destructive",children:$}),d?l.jsx("div",{className:"mt-4",children:d}):null]})]})]}),l.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-3 border-t border-border bg-muted/30 px-5 py-2.5",children:[Ye&&Tt?l.jsx("span",{className:"text-[11px] text-muted-foreground",children:W==="validating"?"Validating cards against your data.":"This may take up to 30 seconds."}):l.jsx("span",{}),l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx(p.Button,{type:"button",variant:"ghost",size:"xs",onClick:()=>t(!1),disabled:Tt,children:"Cancel"}),It?l.jsx(p.Button,{type:"button",variant:"secondary",size:"xs",onClick:()=>{G(),z("")},disabled:Tt,children:"Back to ideas"}):null,l.jsx(p.Button,{type:"button",size:"xs",disabled:!en||!m||Tt,onClick:St,children:Tt?l.jsxs(l.Fragment,{children:[l.jsx(p.LoaderCircle,{className:"h-3 w-3 animate-spin"}),Ye?W==="planning"?"Planning Insights…":W==="validating"?"Validating cards…":"Building dashboard…":"Creating…"]}):l.jsxs(l.Fragment,{children:[Ye&&!It?"Review plan":"Create dashboard",l.jsx(t_,{className:"h-3 w-3"})]})})]})]})]})})}function Lxe({open:e,onOpenChange:t,onCreateBlank:n,onAiCreateSuccess:r,isCreatingBlank:o,initialDomainId:s}){const i=Dxe(e),{suggestDashboards:a,planDashboard:c,createDashboardFromPlan:u}=Mxe();return l.jsx(lY,{open:e,onOpenChange:t,onCreateBlank:n,onAiCreateSuccess:r,isCreatingBlank:o,sources:i.data||[],sourcesLoading:i.isLoading,suggestDashboards:a.mutateAsync,planDashboard:c,createDashboardFromPlan:u,initialDomainId:s})}function $xe({step:e}){const t=[{id:"choose",label:"Choose idea"},{id:"review",label:"Review plan"}],n=t.findIndex(r=>r.id===e);return l.jsx("div",{className:"flex items-center gap-2",children:t.map((r,o)=>{const s=r.id===e,i=o<n;return l.jsxs("div",{className:"flex items-center gap-2",children:[o>0&&l.jsx("span",{className:"h-px w-4 bg-border","aria-hidden":"true"}),l.jsxs("span",{className:`inline-flex h-5 items-center gap-1 rounded-full px-2 text-[10px] font-medium ${s?"bg-foreground text-background":i?"bg-muted text-foreground":"bg-transparent text-muted-foreground"}`,children:[i?l.jsx(p.Check,{className:"h-2.5 w-2.5"}):l.jsx("span",{children:o+1}),r.label]})]},r.id)})})}function zxe({plan:e,titleOverride:t}){const n=Oxe(e),r=e.datasets.map(s=>s.kind==="semantic"?s.label||s.datasetName:s.kind==="physical"?s.label||[s.databaseName,s.schemaName,s.tableName].filter(Boolean).join(".")||s.tableName:s.label||"Dataset"),o=[...(e.warnings||[]).map(s=>s.message),...e.unresolvedRequests||[]].filter(Boolean);return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-[13px] font-semibold text-foreground",children:t||e.title||"Dashboard plan"}),e.description&&l.jsx("div",{className:"mt-1 max-w-[680px] text-[11.5px] leading-relaxed text-muted-foreground",children:e.description})]}),l.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[l.jsx(lw,{label:"Cards",value:n.dataCards.length}),l.jsx(lw,{label:"Datasets",value:n.datasetCount}),l.jsx(lw,{label:"Filters",value:n.filterCount}),l.jsx(lw,{label:"Joined cards",value:n.joinedCards.length})]}),l.jsxs("div",{children:[l.jsx("div",{className:"mb-1.5 text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Cards to create"}),l.jsx("div",{className:"divide-y divide-border rounded-[6px] border border-border",children:n.cards.slice(0,zhe.DASHBOARD_AUTHORING_MAX_GENERATED_CARDS).map(s=>{const i=Array.from(aY(s));return l.jsxs("div",{className:"grid grid-cols-[88px_1fr_auto] items-center gap-2 px-2.5 py-2",children:[l.jsx("span",{className:"rounded-[3px] bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground",children:Pxe(s.type)}),l.jsx("span",{className:"min-w-0 truncate text-[12px] text-foreground",children:s.title}),i.length>0&&l.jsx("span",{className:"max-w-[220px] truncate text-[10.5px] text-muted-foreground",children:i.join(" + ")})]},s.id)})})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[l.jsx(sT,{title:"Datasets",empty:"No datasets selected",items:r}),l.jsx(sT,{title:"Filters",empty:"No dashboard filters planned",items:(e.filterInputs||[]).map(s=>s.label)})]}),n.joinedCards.length>0&&l.jsx(sT,{title:"Relationship-based cards",empty:"No relationship-based cards planned",items:n.joinedCards.map(s=>s.title)}),o.length>0&&l.jsx("div",{className:"rounded-[6px] border border-amber-300/60 bg-amber-50/60 px-3 py-2 text-[11.5px] leading-relaxed text-amber-800 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300",children:o.slice(0,3).map(s=>l.jsx("div",{children:s},s))})]})}function lw({label:e,value:t}){return l.jsxs("div",{className:"rounded-[6px] border border-border bg-muted/20 px-2.5 py-2",children:[l.jsx("div",{className:"text-[15px] font-semibold tabular-nums text-foreground",children:t}),l.jsx("div",{className:"mt-0.5 truncate text-[10px] font-medium uppercase tracking-[0.06em] text-muted-foreground",children:e})]})}function sT({title:e,empty:t,items:n}){return l.jsxs("div",{children:[l.jsx("div",{className:"mb-1.5 text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:e}),l.jsx("div",{className:"min-h-10 rounded-[6px] border border-border px-2.5 py-2 text-[11.5px] leading-relaxed",children:n.length>0?l.jsx("div",{className:"flex flex-wrap gap-1.5",children:n.slice(0,8).map(r=>l.jsx("span",{className:"max-w-full truncate rounded-[3px] bg-muted px-1.5 py-0.5 text-muted-foreground",children:r},r))}):l.jsx("span",{className:"text-muted-foreground",children:t})})]})}function Bxe({groups:e,loading:t,selectedSource:n,selectedDatasetNames:r,useWholeDomain:o,selectionLimit:s,onPickSource:i,onToggleDataset:a,onUseWholeDomain:c,summary:u}){const[d,f]=S.useState(""),[h,m]=S.useState({}),g=d.trim().toLowerCase(),b=(n==null?void 0:n.kind)==="semantic"?n.domainId:null,x=!o&&r.size>=s,y=C=>!g||(C||"").toLowerCase().includes(g),w=e.filter(C=>y(C.label)||C.items.some(N=>y(oT(N)))),v=C=>h[C.id]!==void 0?h[C.id]:g||e.length===1?!0:C.id===b;return l.jsxs("div",{className:"flex min-w-0 flex-col overflow-hidden border-r border-border",children:[l.jsxs("div",{className:"shrink-0 border-b border-border px-3 py-2.5",children:[l.jsxs("div",{className:"flex items-center gap-2 rounded-[5px] border border-border bg-background px-2 focus-within:border-foreground/40",children:[l.jsx(Pt.Search,{className:"h-3 w-3 text-muted-foreground"}),l.jsx("input",{value:d,onChange:C=>f(C.target.value),placeholder:"Search datasets…",className:"h-7 flex-1 bg-transparent text-[12px] text-foreground placeholder:text-muted-foreground focus:outline-none"}),d&&l.jsx("button",{type:"button",onClick:()=>f(""),className:"flex h-4 w-4 items-center justify-center rounded-[3px] text-muted-foreground hover:bg-accent hover:text-foreground",children:l.jsx(Te.X,{className:"h-2.5 w-2.5"})})]}),l.jsxs("div",{className:"mt-2.5 flex items-center justify-between gap-2",children:[l.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Dashboard scope"}),x&&l.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["Max ",s," · clear one to swap"]})]})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto px-2 py-2",children:[t&&l.jsxs("div",{className:"flex items-center gap-2 px-1 py-2 text-[11px] text-muted-foreground",children:[l.jsx(p.LoaderCircle,{className:"h-3 w-3 animate-spin"}),"Loading datasets…"]}),!t&&w.length===0&&l.jsxs("div",{className:"flex h-full flex-col items-center justify-center px-4 text-center",children:[l.jsx("div",{className:"text-[12px] text-foreground",children:"No datasets found"}),l.jsx("div",{className:"mt-1 text-[11px] text-muted-foreground",children:"Try a different search or connect a semantic domain."})]}),w.map(C=>{const N=v(C),_=C.items.filter(T=>b===C.id&&r.has(T.datasetName)).length,k=b===C.id&&o,j=y(C.label),I=g&&!j?C.items.filter(T=>y(oT(T))):C.items;return l.jsxs("div",{className:"mb-0.5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 rounded-[4px] px-1.5 py-1.5 hover:bg-accent/60",children:[l.jsxs("button",{type:"button",onClick:()=>m(T=>({...T,[C.id]:!N})),className:"flex min-w-0 flex-1 items-center gap-1.5 text-left",children:[N?l.jsx(Te.ChevronDown,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):l.jsx(Pt.ChevronRight,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),l.jsx(Bi,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),l.jsx("span",{className:"truncate text-[12px] font-medium text-foreground",children:C.label}),l.jsx("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:_>0?`${_}/${C.items.length}`:C.items.length})]}),k?l.jsxs("button",{type:"button",onClick:()=>i(C.items[0]),className:"inline-flex h-5 items-center gap-1 rounded-[3px] bg-foreground px-1.5 text-[10px] font-medium text-background",title:"All datasets in this domain are selected. Click to go back to picking datasets.",children:[l.jsx(P0,{className:"h-2.5 w-2.5"}),"All datasets"]}):l.jsx("button",{type:"button",onClick:()=>c(C),className:"inline-flex h-5 items-center rounded-[3px] border border-border px-1.5 text-[10px] font-medium text-muted-foreground hover:border-foreground/40 hover:text-foreground",title:"Use every dataset in this domain",children:"All datasets"})]}),N&&l.jsx("div",{className:"ml-3.5 border-l border-border pl-1.5",children:I.map(T=>{const E=b===C.id&&r.has(T.datasetName),D=b===C.id&&!o&&!E&&r.size>=s;return l.jsxs("button",{type:"button",onClick:()=>a(T),disabled:D,className:`flex w-full items-center gap-2 rounded-[4px] px-1.5 py-1.5 text-left ${E?"bg-accent":"hover:bg-accent/60"} ${D?"cursor-not-allowed opacity-45 hover:bg-transparent":""}`,children:[l.jsx("span",{className:`flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded-[4px] border ${E?"border-foreground bg-foreground text-background":"border-border"}`,children:E&&l.jsx(p.Check,{className:"h-2.5 w-2.5"})}),l.jsx(p.Table2,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),l.jsx("span",{className:"flex-1 truncate text-[12px] text-foreground/90",children:oT(T)}),E$(T.primaryDateField)&&l.jsx("span",{className:"truncate text-[10px] text-muted-foreground",children:E$(T.primaryDateField)})]},`${C.id}:${T.datasetName}`)})})]},C.id)})]}),l.jsx("div",{className:"shrink-0 border-t border-border px-3 py-2.5 text-[11px] leading-relaxed",children:u?l.jsxs("span",{className:"flex items-center gap-1.5 text-muted-foreground",children:[l.jsx(Mpe,{className:"h-3 w-3 shrink-0"}),l.jsx("span",{className:"font-medium text-foreground",children:u})]}):l.jsx("span",{className:"text-muted-foreground",children:"Pick data to see recommendations."})})]})}function Vxe({suggestion:e,selected:t,selectedDatasetNames:n,domainDatasetNames:r,canAddDataset:o,onAddDataset:s,onClick:i}){var a;return l.jsxs("div",{className:`group relative flex flex-col overflow-hidden rounded-[5px] border bg-background transition-colors ${t?"border-foreground":"border-border hover:border-foreground/30"}`,children:[l.jsxs("button",{type:"button",onClick:i,className:"block w-full px-2.5 pt-2.5 pb-1.5 text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-foreground/40",children:[l.jsxs("div",{className:"flex items-start justify-between gap-2",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"truncate text-[12.5px] font-medium text-foreground",title:e.title,children:e.title}),l.jsx("div",{className:"mt-0.5 line-clamp-2 text-[11px] leading-[1.4] text-muted-foreground",title:e.description,children:e.description})]}),t&&l.jsx("div",{className:"flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded-full bg-foreground",children:l.jsx(p.Check,{className:"h-2.5 w-2.5 text-background"})})]}),l.jsx("div",{className:"mt-2 flex gap-1",children:e.preview.slice(0,5).map((c,u)=>l.jsx(Wxe,{kind:c},u))})]}),l.jsx("div",{className:"flex flex-wrap items-center gap-1.5 px-2.5 pb-2.5 pt-1.5 text-[10px] text-muted-foreground",children:(a=e.datasets)!=null&&a.length?l.jsx(Hxe,{datasets:e.datasets,relationshipHints:e.relationshipHints,selectedDatasetNames:n,domainDatasetNames:r,canAddDataset:o,onAddDataset:s}):l.jsxs(l.Fragment,{children:[l.jsxs("span",{children:[e.cardCount," cards"]}),e.filterCount>0&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"text-border",children:"·"}),l.jsxs("span",{children:[e.filterCount," filter",e.filterCount>1?"s":""]})]})]})})]})}function Hxe({datasets:e,relationshipHints:t,selectedDatasetNames:n,domainDatasetNames:r,canAddDataset:o,onAddDataset:s}){const i=t!=null&&t.length?t.join(`
|
|
590
590
|
`):e.map(a=>a.label||a.name).join(", ");return l.jsx("span",{className:"flex min-w-0 flex-wrap items-center gap-1",title:i,children:e.map(a=>{const c=n.has(a.name),u=!c&&o&&r.has(a.name),d=a.label||a.name;return u?l.jsxs("button",{type:"button",title:`Add ${d} to your selection`,"aria-label":`Add ${d} to your selection`,onClick:()=>s(a.name),className:"inline-flex max-w-[112px] cursor-pointer items-center gap-0.5 rounded-[3px] border border-amber-400/60 bg-amber-50 px-1.5 py-0.5 text-[9.5px] font-medium text-amber-700 hover:border-amber-500 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-amber-500 dark:border-amber-500/40 dark:bg-amber-500/10 dark:text-amber-400",children:[l.jsx(kr,{className:"h-2.5 w-2.5 shrink-0"}),l.jsx("span",{className:"truncate",children:d})]},a.name):l.jsx("span",{className:`max-w-[96px] truncate rounded-[3px] border px-1.5 py-0.5 text-[9.5px] ${c?"border-border bg-muted/40 text-muted-foreground":"border-amber-400/50 bg-amber-50/60 text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/5 dark:text-amber-400/90"}`,title:c?void 0:`${d} is not in your selection`,children:d},a.name)})})}function M$({kind:e,selected:t,onClick:n,disabled:r=!1,hint:o}){const s=e==="blank"?Epe:Bi,i=e==="blank"?"Blank dashboard":"From a dataset",a=e==="blank"?"Empty canvas. Build it yourself.":"Pick a dataset and we'll suggest starter ideas.";return l.jsxs("button",{type:"button",onClick:n,disabled:r,className:`group relative flex h-full flex-col gap-2 rounded-[5px] border bg-background px-3 py-2.5 text-left transition-colors ${t?"border-foreground":"border-border enabled:hover:border-foreground/30"} disabled:cursor-not-allowed disabled:opacity-60`,title:r&&o?o:void 0,children:[l.jsxs("div",{className:"flex items-start justify-between gap-2",children:[l.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-[4px] border border-border bg-muted/40 text-muted-foreground",children:l.jsx(s,{className:"h-3.5 w-3.5"})}),t&&l.jsx("div",{className:"flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded-full bg-foreground",children:l.jsx(p.Check,{className:"h-2.5 w-2.5 text-background"})})]}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"truncate text-[12.5px] font-medium text-foreground",children:i}),l.jsx("div",{className:"mt-0.5 line-clamp-2 text-[11px] leading-[1.4] text-muted-foreground",children:o||a})]})]})}function Uxe({selected:e,onClick:t}){return l.jsxs("button",{type:"button",onClick:t,className:`group relative flex flex-col overflow-hidden rounded-[5px] border border-dashed bg-background p-2.5 text-left transition-colors ${e?"border-foreground":"border-border hover:border-foreground/40"}`,children:[l.jsxs("div",{className:"flex items-start justify-between gap-2",children:[l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"truncate text-[12.5px] font-medium text-foreground",children:"Describe what you want"}),l.jsx("div",{className:"mt-0.5 line-clamp-2 text-[11px] leading-[1.4] text-muted-foreground",children:"Tell us the key metrics, breakdowns, and views you want to see."})]}),e&&l.jsx("div",{className:"flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded-full bg-foreground",children:l.jsx(p.Check,{className:"h-2.5 w-2.5 text-background"})})]}),l.jsx("div",{className:"mt-2 flex h-[28px] items-center justify-start rounded-[3px] border border-dashed border-border px-2 text-[10px] text-muted-foreground",children:"Metrics, breakdowns, KPIs…"}),l.jsx("div",{className:"mt-1.5 text-[10px] text-muted-foreground",children:"Tailored to what you describe"})]})}function qxe(){return l.jsxs("div",{className:"rounded-[5px] border border-border p-2.5",children:[l.jsx("div",{className:"h-3 w-32 rounded-[3px] bg-muted/60"}),l.jsx("div",{className:"mt-1 h-2 w-44 rounded-[3px] bg-muted/60"}),l.jsx("div",{className:"mt-2 flex gap-1",children:Array.from({length:4}).map((e,t)=>l.jsx("div",{className:"h-8 w-10 rounded-[3px] bg-muted/60"},t))})]})}function Wxe({kind:e}){return l.jsx("div",{className:"flex h-8 w-10 items-center justify-center rounded-[3px] border border-border bg-muted/30",children:l.jsx(Gxe,{kind:e})})}function Gxe({kind:e}){return e==="kpi"?l.jsx("div",{className:"text-[8px] font-semibold tabular-nums text-foreground/80",children:"1.2M"}):e==="line"?l.jsx("svg",{viewBox:"0 0 40 16",className:"h-3 w-8 text-muted-foreground",children:l.jsx("polyline",{fill:"none",stroke:"currentColor",strokeWidth:"1",points:"0,12 8,10 16,7 24,9 32,4 40,5"})}):e==="bar"?l.jsx("svg",{viewBox:"0 0 40 16",className:"h-3 w-8 text-muted-foreground",children:[6,10,7,12,9].map((t,n)=>l.jsx("rect",{x:n*8+1,y:15-t,width:"5",height:t,fill:"currentColor"},n))}):e==="donut"?l.jsxs("svg",{viewBox:"0 0 16 16",className:"h-3.5 w-3.5",children:[l.jsx("circle",{cx:"8",cy:"8",r:"6",fill:"none",strokeWidth:"2.5",className:"stroke-border"}),l.jsx("circle",{cx:"8",cy:"8",r:"6",fill:"none",strokeWidth:"2.5",strokeDasharray:"22 60",transform:"rotate(-90 8 8)",className:"stroke-muted-foreground"})]}):e==="table"?l.jsxs("div",{className:"space-y-0.5",children:[l.jsx("div",{className:"h-[2px] w-7 rounded-full bg-muted-foreground/60"}),l.jsx("div",{className:"h-[2px] w-7 rounded-full bg-muted-foreground/60"}),l.jsx("div",{className:"h-[2px] w-7 rounded-full bg-muted-foreground/60"}),l.jsx("div",{className:"h-[2px] w-7 rounded-full bg-muted-foreground/60"})]}):null}function A$({children:e}){return l.jsx("label",{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:e})}function cY(){const{authToken:e,tokenProps:t}=bt(),n=t==null?void 0:t.apiServiceUrl,r=t==null?void 0:t.project_id;return Rn({queryKey:["user-preferences",r],queryFn:async()=>{if(!n||!(e!=null&&e.accessToken))return{preference:null};try{return await p.getRequest(`${n}/management/v1/user-preferences`,e.accessToken)}catch(o){return console.error("Error fetching user preferences:",o),{preference:null}}},enabled:!!n&&!!(e!=null&&e.accessToken),staleTime:5*60*1e3,gcTime:10*60*1e3})}var Yxe=Symbol("radix.slottable");function Kxe(e){const t=({children:n})=>l.jsx(l.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Yxe,t}var uY="AlertDialog",[Zxe]=p.createContextScope(uY,[HG]),Ec=HG(),dY=e=>{const{__scopeAlertDialog:t,...n}=e,r=Ec(t);return l.jsx(h_,{...r,...n,modal:!0})};dY.displayName=uY;var Xxe="AlertDialogTrigger",fY=Q.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Ec(n);return l.jsx(SP,{...o,...r,ref:t})});fY.displayName=Xxe;var Qxe="AlertDialogPortal",hY=e=>{const{__scopeAlertDialog:t,...n}=e,r=Ec(t);return l.jsx(m_,{...r,...n})};hY.displayName=Qxe;var Jxe="AlertDialogOverlay",mY=Q.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Ec(n);return l.jsx(tg,{...o,...r,ref:t})});mY.displayName=Jxe;var Um="AlertDialogContent",[eye,tye]=Zxe(Um),nye=Kxe("AlertDialogContent"),pY=Q.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...o}=e,s=Ec(n),i=Q.useRef(null),a=p.useComposedRefs(t,i),c=Q.useRef(null);return l.jsx(kxe,{contentName:Um,titleName:gY,docsSlug:"alert-dialog",children:l.jsx(eye,{scope:n,cancelRef:c,children:l.jsxs(ng,{role:"alertdialog",...s,...o,ref:a,onOpenAutoFocus:p.composeEventHandlers(o.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=c.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:[l.jsx(nye,{children:r}),l.jsx(oye,{contentRef:i})]})})})});pY.displayName=Um;var gY="AlertDialogTitle",bY=Q.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Ec(n);return l.jsx(z0,{...o,...r,ref:t})});bY.displayName=gY;var xY="AlertDialogDescription",yY=Q.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Ec(n);return l.jsx(B0,{...o,...r,ref:t})});yY.displayName=xY;var rye="AlertDialogAction",vY=Q.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=Ec(n);return l.jsx(p_,{...o,...r,ref:t})});vY.displayName=rye;var wY="AlertDialogCancel",SY=Q.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:o}=tye(wY,n),s=Ec(n),i=p.useComposedRefs(t,o);return l.jsx(p_,{...s,...r,ref:i})});SY.displayName=wY;var oye=({contentRef:e})=>{const t=`\`${Um}\` requires a description for the component to be accessible for screen reader users.
|
|
591
591
|
|
|
592
592
|
You can add a description to the \`${Um}\` by passing a \`${xY}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
@@ -1343,4 +1343,4 @@ prismjs/prism.js:
|
|
|
1343
1343
|
More info: ${o.docs}`:"",a=typeof o.message=="string"&&o.message.trim()?o.message.trim():typeof o.error=="string"&&o.error.trim()?o.error.trim():null;if(a){const c=s?` (code: ${s})`:"",u=s==="insufficient_quota"||a.toLowerCase().includes("quota")?`
|
|
1344
1344
|
|
|
1345
1345
|
Semaphor supports bring-your-own OpenAI API keys. Add yours in Settings or drop a note to support@semaphor.cloud and we’ll help you get set up.`:"";return`${a}${c}${i}${u}`}return null};if(typeof e=="string"){const r=e.trim();if(!r)return"Something went wrong.";try{const o=JSON.parse(r),s=t(o);if(s)return s}catch{}return r}const n=t(e);if(n)return n;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function e$({errorMessage:e}){return l.jsxs("div",{className:"flex items-start gap-2 rounded-control border border-red-300 bg-red-50/60 p-2 text-[12px] text-red-700 dark:border-red-900/60 dark:bg-red-950/20 dark:text-red-300",children:[l.jsx(Vi,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),l.jsx("span",{className:"whitespace-pre-wrap break-words leading-[1.55]",children:J0t(e)})]})}function evt({error:e,resetErrorBoundary:t}){return l.jsxs("div",{className:"my-3 space-y-2 rounded-control border border-border/60 bg-muted/20 p-2.5",children:[l.jsx(e$,{errorMessage:e==null?void 0:e.message}),l.jsx("button",{type:"button",className:"text-[11px] font-medium text-muted-foreground underline underline-offset-2 hover:text-foreground",onClick:t,children:"Try again"})]})}function tvt({text:e,files:t}){return l.jsxs(Jfe,{who:"You",children:[e&&l.jsx("div",{className:"whitespace-pre-line text-[13px] leading-[1.55] text-foreground",children:e}),t&&t.length>0&&l.jsx("div",{className:"flex flex-wrap gap-2 pt-0.5",children:t.map(n=>l.jsx(Jdt,{file:n},n.id))})]})}function nvt({text:e}){const t=e.split("|"),n=t[0],r=t[1]||"{}",o=JSON.parse(r);return l.jsxs("div",{className:"space-y-1 text-xs",children:[l.jsxs("div",{children:[l.jsx("span",{className:"font-bold",children:"System Message:"})," ",n]}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("span",{className:"font-mono text-xs",children:"Scope:"}),l.jsx(bft,{children:JSON.stringify(o,null,2)})]})]})}function ehe(e,t){return!e||e.role!=="assistant"?!1:(e.parts??[]).some(r=>{if(!r)return!1;switch(r.type){case"text":return typeof r.text=="string"&&r.text.trim().length>0;case"reasoning":return typeof r.text=="string"&&r.text.trim().length>0||r.state==="streaming";case"error":return!0;default:return typeof r.type=="string"&&(r.type.startsWith("tool-")||r.type==="dynamic-tool")?J3(r,t):!1}})}function nq(){return l.jsx("span",{className:"relative grid h-2 w-2 shrink-0 place-items-center",children:l.jsx("span",{className:"absolute inset-0 animate-pulse rounded-full bg-muted-foreground/70"})})}function rvt({status:e,errorMessage:t,activeToolText:n}){return n?l.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-muted-foreground",children:[l.jsx(nq,{}),l.jsx("span",{children:n})]}):e==="submitted"||e==="streaming"?l.jsxs("div",{className:"flex items-center gap-2 text-[12px] text-muted-foreground",children:[l.jsx(nq,{}),l.jsx("span",{children:e==="submitted"?"Thinking":"Generating"})]}):e==="error"?l.jsx(e$,{errorMessage:t}):null}function ovt(e){var t;return e?(t=[...e].reverse().find(n=>{var r;return n.role==="assistant"&&((r=n.parts)==null?void 0:r.some(o=>o.type==="text"&&typeof o.text=="string"&&o.text.trim().length>0))}))==null?void 0:t.id:void 0}function svt({message:e,messageIndex:t,messages:n,showTools:r=!1,onAddToDashboard:o,showSystemMessage:s=!1,handleRun:i,onQuickReply:a,disableQuickReplies:c=!1}){var y,w,v,C;const u=ovt(n),d=e.id===u;if(e.role==="user"){const N=((y=e.parts)==null?void 0:y.filter(I=>I.type==="text"))||[],_=((w=e.parts)==null?void 0:w.filter(I=>I.type==="file"))||[],k=N.map(I=>I.text).join(`
|
|
1346
|
-
`).trim(),j=_.map((I,T)=>{var A,P;let E="",D;if((A=I.url)!=null&&A.startsWith("data:")){const M=I.url.match(/data:[^;]+;base64,(.+)/);M&&(E=M[1],(P=I.mediaType)!=null&&P.startsWith("image/")&&(D=I.url))}return{id:`${e.id||t}-file-${T}`,name:I.filename||`File ${T+1}`,size:0,type:I.mediaType||"application/octet-stream",data:E,preview:D}});return l.jsx(tvt,{text:k||void 0,files:j.length>0?j:void 0})}const f=((v=e.parts)==null?void 0:v.filter(N=>N.type==="reasoning"))||[],h=f.length>0,m=f.some(N=>N.state==="streaming"),g=f.filter(N=>N.text&&N.text.trim().length>0),b=h&&(g.length>0||m)?l.jsxs(Cc,{className:"space-y-2",defaultOpen:!1,children:[l.jsx(Nc,{asChild:!0,children:l.jsxs("button",{type:"button",className:"group inline-flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground",children:[l.jsx(Pt.ChevronRight,{className:"h-3 w-3 transition-transform duration-200 group-data-[state=open]:rotate-90"}),l.jsx("span",{className:m?"animate-pulse":"",children:m?"Reasoning":"Show reasoning"}),g.length>1&&l.jsxs("span",{className:"font-mono tabular-nums text-muted-foreground/70",children:["(",g.length," steps)"]})]})}),l.jsx(_c,{children:l.jsx("ol",{className:"space-y-2 border-l border-border/60 pl-3",children:g.map((N,_)=>l.jsxs("li",{className:"relative",children:[l.jsx("span",{className:"absolute -left-[15px] top-[3px] grid h-4 w-4 place-items-center rounded-full bg-muted font-mono text-[9px] text-muted-foreground",children:_+1}),l.jsx(YU,{className:"text-[12px] leading-[1.55] text-muted-foreground",text:N.text})]},`${e.id||t}-reasoning-${_}`))})})]},`${e.id||t}-reasoning`):null,x=(C=e.parts)==null?void 0:C.map((N,_)=>{var j;const k=`${e.id||t}-${_}`;switch(N.type){case"text":{const I=typeof N.text=="string"?N.text:JSON.stringify(N.text??"",null,2);if(e.role==="assistant"){const{cleanedText:T,quickReplies:E}=X0t(I),D=T.trim().length>0;return l.jsxs("div",{className:"space-y-2.5",children:[D&&l.jsx(YU,{text:T,handleRun:i,onAddToDashboard:o,messageId:e.id,messages:n}),E.length>0&&a&&d&&l.jsxs("div",{className:"space-y-1.5",children:[E.length>=3&&l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Suggested next steps"}),l.jsx("div",{className:"flex flex-wrap gap-1",children:E.map(({label:A,value:P},M)=>l.jsxs(p.Tooltip,{children:[l.jsx(p.TooltipTrigger,{asChild:!0,children:l.jsx(p.Button,{size:"sm",variant:"outline",className:"h-6 max-w-[220px] rounded-control border-border/60 bg-background px-2 text-[11px] font-normal text-foreground/85 transition-colors hover:border-border hover:bg-muted/40 hover:text-foreground disabled:opacity-50",disabled:c,onClick:()=>a(P),children:l.jsx("span",{className:"truncate",children:A})})}),l.jsx(p.TooltipContent,{side:"top",align:"center",children:l.jsx("p",{className:"max-w-xs text-xs",children:P})})]},`${k}-qr-${M}`))})]})]},k)}return e.role==="system"&&s?l.jsx(nvt,{text:I},k):null}case"error":{const I=N,T=I.errorText??I.error??I.message;return l.jsx("div",{className:"my-4",children:l.jsx(e$,{errorMessage:T})},k)}case"reasoning":return null;default:return((j=N.type)!=null&&j.startsWith("tool-")||N.type==="dynamic-tool")&&J3(N,r)?l.jsx(ka,{FallbackComponent:({error:I,resetErrorBoundary:T})=>l.jsx(evt,{error:I,resetErrorBoundary:T}),children:l.jsx(W0t,{part:N,idx:k,messageId:e.id,showTools:r,onAddToDashboard:o,messages:n})},k):null}});return e.role==="assistant"?ehe(e,r)?l.jsxs(Jfe,{who:"Assistant",className:"space-y-2",children:[b,x]}):null:l.jsxs("div",{className:"space-y-2",children:[b,x]})}const ivt=8,avt=24,lvt=20;function cvt(e,t,n,r){return e==="error"&&t?!0:r?!1:!!(n||e==="submitted"||e==="streaming")}function the({messages:e,showTools:t=!1,showSystemMessage:n=!1,handleRun:r,onAddToDashboard:o,onQuickReply:s,disableQuickReplies:i=!1,status:a,errorMessage:c,activeToolText:u,className:d,rowContentClassName:f,statusClassName:h,latestButtonClassName:m,scrollToEndSignal:g=0}){const b=S.useRef(null),x=S.useRef(null),y=S.useRef(e.length),w=S.useRef(!1),v=S.useRef(null),C=S.useRef(!1),N=S.useRef(g),[_,k]=S.useState(!0),[j,I]=S.useState(0),[T,E]=S.useState(avt);N.current!==g&&(N.current=g,C.current=!0);const D=e[e.length-1],A=ehe(D,t),P=cvt(a,c,u,A),M=gk({count:e.length,getScrollElement:()=>b.current,estimateSize:W=>{const F=e[W];return(F==null?void 0:F.role)==="user"?88:180},getItemKey:W=>{const F=e[W];return(F==null?void 0:F.id)||`message-${W}`},anchorTo:"end",followOnAppend:!0,scrollEndThreshold:ivt,overscan:6,gap:20,paddingEnd:P?T+lvt:0,useAnimationFrameWithResizeObserver:!0,onChange:W=>{const F=W.isAtEnd();k(X=>X===F?X:F),F&&I(0)}}),L=S.useCallback((W="smooth")=>{v.current!==null&&cancelAnimationFrame(v.current),v.current=requestAnimationFrame(()=>{v.current=null,M.scrollToEnd({behavior:W})}),I(0),k(!0)},[M]);S.useLayoutEffect(()=>{w.current||(w.current=!0,L("auto"))},[L]),S.useLayoutEffect(()=>{C.current&&(C.current=!1,L("auto"))},[e.length,g,L]),S.useEffect(()=>{const W=y.current;y.current=e.length,e.length>W&&!M.isAtEnd()&&I(F=>F+e.length-W),e.length===0&&(I(0),k(!0),w.current=!1,C.current=!1)},[e.length,M]);const $=M.getVirtualItems(),z=M.getTotalSize();return S.useEffect(()=>()=>{v.current!==null&&cancelAnimationFrame(v.current)},[]),S.useLayoutEffect(()=>{const W=x.current;if(!W||!P)return;const F=()=>{const Y=Math.ceil(W.getBoundingClientRect().height);Y>0&&E(R=>R===Y?R:Y)};if(F(),typeof ResizeObserver>"u")return;const X=new ResizeObserver(F);return X.observe(W),()=>X.disconnect()},[P,a,c,u]),l.jsxs(l.Fragment,{children:[l.jsx(Ea,{"data-role":"assistant-virtualized-scroll-area",ref:b,className:p.cn("min-h-0 min-w-0 flex-1 basis-0",d),children:l.jsxs("div",{className:"relative w-full",style:{height:z},children:[$.map(W=>{const F=e[W.index];return F?l.jsx("div",{ref:M.measureElement,"data-index":W.index,className:"absolute left-0 top-0 w-full",style:{transform:`translateY(${W.start}px)`},children:l.jsx("div",{className:p.cn("min-w-0",f),children:l.jsx(svt,{message:F,messageIndex:W.index,messages:e,showTools:t,showSystemMessage:n,handleRun:r,onAddToDashboard:o,onQuickReply:s,disableQuickReplies:i})})},W.key):null}),P&&l.jsx("div",{ref:x,className:p.cn("absolute left-0 top-0 w-full",h),style:{transform:`translateY(${Math.max(z-T,0)}px)`},children:l.jsx("div",{className:p.cn("min-w-0",f),children:l.jsx(rvt,{status:a,errorMessage:c,activeToolText:u})})})]})}),!_&&l.jsxs("button",{type:"button",onClick:()=>L("smooth"),"aria-label":"Scroll to latest",className:p.cn("absolute right-4 z-10 inline-flex h-7 items-center gap-1.5 rounded-full border border-border bg-background px-2.5 text-[11px] text-foreground shadow-[0_1px_2px_rgba(0,0,0,0.08)] transition-colors hover:bg-muted/40",m),children:[l.jsx(bo,{className:"h-3 w-3"}),"Latest",j>0&&l.jsx("span",{className:"grid h-4 min-w-[16px] place-items-center rounded-full bg-foreground px-1 font-mono text-[9px] tabular-nums text-background",children:j>9?"9+":j})]})]})}function uvt(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return"";const t=e;return(typeof t.userSql=="string"?t.userSql:"")||(typeof t.sourceSql=="string"?t.sourceSql:"")||(typeof t.sql=="string"?t.sql:"")}const dvt=[{title:"Show top 3 insights",subtitle:"from this dataset"},{title:"Create a bar chart for",subtitle:"sales by product category"}];function fvt({open:e,setOpen:t,isFullscreen:n,onFullscreenChange:r,fullscreenContainer:o}){const[s,i]=S.useState(!1),[a,c]=S.useState(p.isDevEnv),[u,d]=S.useState(!1),[f,h]=S.useState("auto"),[m,g]=S.useState(!1),[b,x]=S.useState(!1),[y,w]=S.useState(0),v=n??b,{isLocalDev:C,isConsoleMode:N}=eg(),_=C||N||a,k=S.useRef(null);p.useDashboardStore(ae=>ae.dashboard.aiScopeTables),p.useDashboardStore(ae=>ae.isDashboardEditing);const j=p.useDashboardStore(ae=>ae.selectedSheetId),{setDataSource:I}=p.useEditorActions(),{setSelectedFrameId:T,setIsDashboardEditing:E}=p.useDashboardActions(),D=xL(),{clearAssistantMessageContexts:A}=p.useAIActions(),{clearQueue:P}=p.useQueueActions(),{clearFileAttachments:M,getFileAttachments:L}=p.useFileActions(),$=p.useFileAttachments("dashboard"),z=p.useEditorStore(ae=>ae.card.dataSource),{assistantProfile:W}=lde(),F=p.useDashboardStore(ae=>ae.handleOpenAssistantProfile),{selectedEntities:X,applyDashboardDefaultEntities:Y}=oj("dashboard"),{sendMessage:R,isLoading:K,messages:O,setMessages:U,status:V,stop:H,errorMessage:q,clearError:B}=Mdt({dynamicVisualMode:f}),G=S.useCallback(()=>{w(ae=>ae+1)},[]),Z=S.useCallback(ae=>{r==null||r(ae),n===void 0&&x(ae)},[n,r]),J=S.useCallback(()=>{Z(!v)},[v,Z]);S.useEffect(()=>{if(!v)return;function ae(Ne){Ne.key==="Escape"&&Z(!1)}return window.addEventListener("keydown",ae),()=>{window.removeEventListener("keydown",ae)}},[v,Z]);const[oe,ie]=S.useState(""),ue=ae=>{ie(ae.target.value)};async function xe({sql:ae,cardTitle:Ne,connectionId:Ee,cardType:Ve,python:ge,cardConfig:pe,dataSource:ze,customVisualPreferences:Le,visualizationMode:Be,dynamicCardPreferences:Ke}){if(!j)return;const Je=Be==="dynamic",Ce=p.hasValidCardConfig(pe),Qe=Ee||(ze==null?void 0:ze.connectionId)||"",He=ze?{...ze,connectionId:Qe||ze.connectionId,connectionType:ze.connectionType||"",mode:ze.mode||"database",selectedEntities:ze.selectedEntities||[]}:Qe?{connectionId:Qe,connectionType:"",mode:"database",selectedEntities:[]}:Zp,Me=!(Ce&&(!Je||(Ke==null?void 0:Ke.provenance)==="card-config"||(Ke==null?void 0:Ke.provenance)==="query_spec")),De=Me?uvt(ae):"",je=Me?ge:"",Ue={id:p.v4(),title:Ne||"Title",preferences:{onClickFilter:[{columnIndex:0,expression:""}],chartOptions:{indexAxis:Ve==="horizontalBar"?"y":"x"},...Je&&{displayOptions:{showChrome:!1,allowScroll:!1}}},type:Ve,sql:De,python:je,dataSource:He,config:pe,connectionId:Qe,visualizationMode:Be,dynamicCardPreferences:Ke,customCardPreferences:Le?{url:Le.url,componentName:Le.componentName,pluginChartType:Le.pluginChartType,settings:Le.settings,type:"component"}:void 0},mt={id:p.v4(),cards:[Ue],activeCardId:Ue.id};try{await D(j,mt,"end"),E(!0),T(mt.id)}catch(pt){console.error("Failed to add assistant visual to dashboard:",pt),rt.error(pt instanceof Error?pt.message:"Failed to prepare semantic metadata for the new visual")}}const te=ae=>{ae.preventDefault();const Ne=oe.trim();if(!Ne&&$.length===0)return;const Ee=[];Ne&&Ee.push({type:"text",text:Ne}),$.forEach(Ve=>{Ve.data&&Ee.push({type:"file",mediaType:Ve.type,filename:Ve.name,url:`data:${Ve.type};base64,${Ve.data}`})}),R({role:"user",parts:Ee}),ie(""),M("dashboard"),G()};S.useEffect(()=>{var ae;e&&((ae=k.current)==null||ae.focus())},[e]),_de({assistantType:"dashboard",status:V,isLoading:K,sendMessage:R});const{hasActiveTools:ye,activeToolText:se}=kde(O);function Ie(ae){const Ne={role:"user",parts:[{type:"text",text:ae.title+" "+ae.subtitle}]};R(Ne),G()}function fe(ae){R({role:"user",parts:[{type:"text",text:ae}]}),G()}function me(ae){R({role:"user",parts:[{type:"text",text:ae}]}),G()}const we=S.useCallback(async()=>{const ae=JSON.stringify(O??[],null,2);try{if(typeof navigator>"u"||!navigator.clipboard)throw new Error("Clipboard API unavailable");await navigator.clipboard.writeText(ae),rt.success("Conversation copied")}catch(Ne){console.error("Failed to copy conversation",Ne),rt.error("Unable to copy conversation")}},[O]),ee=(oe==null?void 0:oe.length)===0&&(O==null?void 0:O.filter(ae=>ae.role==="user").length)===0;function re(){return l.jsx("div",{"data-role":"header",className:"flex items-center gap-2",children:l.jsx("span",{className:"text-[13px] font-medium text-foreground",children:"Assistant"})})}function ne(){return l.jsxs(Bo,{children:[l.jsx(Vo,{asChild:!0,children:l.jsx(uc,{className:"h-7 p-2 text-muted-foreground hover:text-foreground",children:l.jsx(Nh,{className:"size-3.5"})})}),l.jsxs(ko,{align:"end",children:[l.jsx(fa,{children:"Options"}),l.jsx(qi,{}),l.jsx(Zc,{checked:s,onCheckedChange:i,children:"Token Usage"}),l.jsx(Zc,{checked:a,onCheckedChange:c,children:"Tool Invocations"}),l.jsx(Zc,{checked:u,onCheckedChange:d,children:"System Message"}),(C||N)&&l.jsxs(l.Fragment,{children:[l.jsx(qi,{}),l.jsx(fa,{children:"Dynamic Visuals"}),l.jsx(Zc,{checked:f==="auto",onCheckedChange:()=>h("auto"),children:"Auto"}),l.jsx(Zc,{checked:f==="force",onCheckedChange:()=>h("force"),children:"Force Dynamic"}),l.jsx(Zc,{checked:f==="off",onCheckedChange:()=>h("off"),children:"Disable Dynamic"})]})]})]})}const le=l.jsxs("div",{"data-role":"dashboard-assistant",className:p.cn("relative flex h-full grow flex-col break-words bg-background",v&&"rounded-card border border-border/60 shadow-xl"),children:[l.jsxs("header",{"data-role":"header-section",className:"flex h-10 shrink-0 items-center gap-2 border-b border-border/60 px-3",children:[re(),F&&l.jsxs("button",{type:"button",onClick:F,className:"inline-flex h-6 items-center gap-1 rounded-[4px] border border-border/60 bg-muted/40 px-1.5 text-[11px] text-muted-foreground transition-colors hover:border-border hover:text-foreground",title:"Edit assistant profile",children:[l.jsx("span",{className:"h-1 w-1 rounded-full bg-muted-foreground/60"}),l.jsx("span",{className:"max-w-[180px] truncate",children:(W==null?void 0:W.name)||"Default profile"})]}),l.jsxs("div",{"data-role":"header-actions",className:"ml-auto flex items-center gap-0.5",children:[N&&ne(),_&&l.jsx(p.Button,{variant:"ghost",size:"sm",className:"h-6 px-1.5 text-[11px] text-muted-foreground hover:text-foreground",onClick:we,children:"Copy Conversation"}),l.jsx(uc,{className:"grid h-6 w-6 place-items-center rounded-[4px] p-0 text-muted-foreground hover:bg-muted hover:text-foreground",tooltip:v?"Exit fullscreen":"Expand",onClick:J,children:v?l.jsx(Pt.Minimize2,{className:"h-3.5 w-3.5"}):l.jsx(Pt.Maximize2,{className:"h-3.5 w-3.5"})}),l.jsx(uc,{className:"grid h-6 w-6 place-items-center rounded-[4px] p-0 text-muted-foreground hover:bg-muted hover:text-foreground",tooltip:"New chat",onClick:()=>{const ae=O.filter(Ne=>Ne.role==="assistant").map(Ne=>Ne.id).filter(Ne=>!!Ne);U([]),P("dashboard"),B(),A(ae)},children:l.jsx(oP,{className:"h-3.5 w-3.5"})}),l.jsx(uc,{className:"grid h-6 w-6 place-items-center rounded-[4px] p-0 text-muted-foreground hover:bg-muted hover:text-foreground",tooltip:"Close",onClick:()=>{t(!1)},children:l.jsx(Te.X,{className:"h-3.5 w-3.5"})})]})]}),l.jsx(the,{messages:O,showTools:a,showSystemMessage:u,onAddToDashboard:xe,onQuickReply:me,disableQuickReplies:K,status:V,errorMessage:q,activeToolText:K&&ye?se:void 0,className:p.cn(v?"px-6 py-5":"px-3 py-3"),rowContentClassName:p.cn(v&&"mx-auto w-full max-w-[680px]"),latestButtonClassName:e?"bottom-[148px]":"hidden",scrollToEndSignal:y}),l.jsxs("div",{className:"shrink-0 space-y-2 border-t border-border/60 px-3 pb-3 pt-2",children:[!W&&ee&&l.jsx(Bce,{onClick:Ie,placeholders:dvt}),ee&&W&&l.jsx(cde,{seedQuestions:W.seedQuestions||[],handleSeedQuestionClick:fe}),l.jsx(Nde,{assistantType:"dashboard"}),l.jsx(M3,{ref:k,setInput:ie,stop:H,input:oe,handleInputChange:ue,handleSubmit:ae=>{te(ae)},isLoading:K,status:V,assistantType:"dashboard",onFocus:()=>{}})]}),l.jsx(D3,{incomingSelectedEntities:X,open:m,onOpenChange:g,dataSource:z||Zp,dialogMode:"aiContext",saveAsDashboardDefault:!0,onSaveSelectedEntities:ae=>Y()})]});return v&&o?br.createPortal(l.jsx(Lg,{className:"pointer-events-auto absolute inset-0 z-50 flex bg-background/95 px-4 pb-4 pt-[calc(var(--app-header-height,15px)+0.5rem)] backdrop-blur-sm",children:l.jsx("div",{className:"flex h-full w-full",children:le})}),o):le}function hvt(e){const t=e.current,{getSelectedFrame:n,setSelectedFrameId:r}=p.useDashboardActions(),o=gie(),s=p.useDashboardStore(d=>d.dashboard.sheets),a=p.useDashboardStore(d=>d.selectedSheetId)??(s==null?void 0:s[0].id),c=p.useDashboardStore(d=>d.isDashboardEditing),u=p.useDashboardStore(d=>d.isVisualEditing);S.useEffect(()=>{if(!c||u)return;async function d(m){if(mvt(m.target))return;const g=m.ctrlKey||m.metaKey;g&&m.key==="c"?(await f(),rt.success("Card copied to clipboard"),m.preventDefault()):g&&m.key==="v"&&(await h(),m.preventDefault())}async function f(){try{const m=n();m&&await navigator.clipboard.writeText(JSON.stringify(m))}catch(m){console.error("Failed to copy text:",m)}}async function h(){if(!a)return null;try{const m=await navigator.clipboard.readText(),g=pvt(m);if(g!=null&&g.id){const b=hie(g),x=b.cards.findIndex(y=>y.id===b.activeCardId);x!==-1&&(b.cards[x].title=`${b.cards[x].title} (Copy)`),await o(a,b),r(b.id),rt.success("Card pasted from clipboard")}return m}catch(m){return console.error("Failed to paste text:",m),null}}return t==null||t.addEventListener("keydown",d),()=>t==null?void 0:t.removeEventListener("keydown",d)},[o,n,r,a,c,u,t])}function mvt(e){if(!(e instanceof HTMLElement))return!1;if(e.isContentEditable)return!0;const t=e.closest("[contenteditable]");return t&&t.getAttribute("contenteditable")!=="false"?!0:!!e.closest('input, textarea, select, [role="textbox"]')}function pvt(e){try{const t=JSON.parse(e);return t&&typeof t=="object"&&typeof t.id=="string"&&Array.isArray(t.cards)?t:null}catch{return null}}function gvt(e,t){switch(e.interactionMode){case"drillToDetail":bvt(e,t);break;case"drillThrough":xvt(e,t);break;case"drillToURL":yvt(e);break;case"inlineDrill":console.warn("Inline drill execution not yet implemented");break;case"clickFilter":case"drillDown":case"dynamicDrill":break;default:console.warn("Unknown interaction mode:",e.interactionMode)}}function bvt(e,t){var c;const{targetInsightId:n,contextMode:r,displayMode:o,filterGroups:s}=e;if(!n){console.warn("drillToDetail event missing targetInsightId");return}const i=r||"full";let a=[];switch(i){case"interactionFilters":a=s.flatMap(u=>u.filters);break;case"full":{const u=((c=t.getCurrentFilters)==null?void 0:c.call(t))||[],d=s.flatMap(f=>f.filters);a=[...u,...d];break}case"none":default:a=[];break}o==="replace-card"?t.replaceCardContent({cardId:e.sourceCardId,insightId:n,filters:a,contextMode:r}):t.openInsightModal({insightId:n,filters:a,contextMode:r})}function xvt(e,t){var u,d;const{targetDashboardId:n,contextMode:r="interactionFilters",filterGroups:o,sourceCardId:s}=e;if(!n){console.warn("[DrillThrough] Event missing targetDashboardId. This interaction needs to be reconfigured with a target dashboard.",e);return}const i=o.flatMap(f=>f.filters),a=((u=t.getCurrentDashboardId)==null?void 0:u.call(t))||"",c=(d=t.getCurrentDashboardTitle)==null?void 0:d.call(t);t.setGlobalDrillContext&&t.setGlobalDrillContext({filters:i,contextMode:r,sourceDashboardId:a,sourceDashboardTitle:c,targetDashboardId:n}),t.setPendingDrillThrough&&t.setPendingDrillThrough({targetDashboardId:n,sourceDashboardId:a,sourceDashboardTitle:c,filters:i,contextMode:r})}function yvt(e){const{url:t}=e;if(!t){console.warn("drillToURL event missing url");return}try{new URL(t)}catch(n){console.error("Invalid URL:",t,n);return}window.open(t,"_blank","noopener,noreferrer")}function vvt({open:e,onOpenChange:t,insightId:n,filters:r,filterDefinitions:o,contextMode:s,cardTitle:i,cardDescription:a}){return l.jsx(ks,{open:e,onOpenChange:t,children:l.jsxs(ls,{className:"max-h-[90vh] max-w-[90vw] p-6",children:[l.jsxs(Xi,{children:[l.jsx(cs,{children:i||"Insight Detail"}),l.jsx(Gs,{children:a||"View detailed insight data with applied filters"})]}),l.jsx(yie,{filters:r,filterDefinitions:o,contextMode:s}),l.jsx("div",{className:"h-[400px] flex-1 overflow-auto",children:n?l.jsx(Aie,{insightId:n,filters:r,contextMode:s}):l.jsx("div",{className:"flex items-center justify-center p-12 text-muted-foreground",children:"No insight selected"})})]})})}function wvt(){const e=p.useInteractionStore(C=>C.interactionStates),t=p.useInteractionStore(C=>C.setInteractionState),n=p.useInteractionStore(C=>C.clearLastInteractionEvent),r=p.useInteractionStore(C=>C.replaceCardWithInsight),o=p.useInteractionStore(C=>C.setPendingDrillThrough),s=p.useInteractionStore(C=>C.pendingDrillThrough),i=p.useInteractionStore(C=>C.clearPendingDrillThrough),{setSelectedSheetId:a,navigateWithDrill:c}=p.useDashboardActions(),{selectDashboard:u}=Sh(),d=p.useDashboardStore(C=>C.dashboard),f=p.useDashboardStore(C=>C.filterValues),{data:h,isLoading:m}=zG((s==null?void 0:s.targetDashboardId)||"",{enabled:!!(s!=null&&s.targetDashboardId)}),[g,b]=S.useState({open:!1,insightId:""}),x=Rie(g.insightId,{enabled:g.open&&!!g.insightId}),y=S.useRef(new Set),w=S.useMemo(()=>({setSelectedSheetId:a,openInsightModal:({insightId:C,filters:N,contextMode:_})=>{b({open:!0,insightId:C,filters:N,filterDefinitions:(d==null?void 0:d.filters)||[],contextMode:_})},replaceCardContent:({cardId:C,insightId:N,filters:_,contextMode:k})=>{r(C,N,_,k)},getCurrentFilters:()=>f||[],navigateWithDrill:c,getCurrentDashboardId:()=>(d==null?void 0:d.id)||"",getCurrentDashboardTitle:()=>d==null?void 0:d.title,setPendingDrillThrough:o,setGlobalDrillContext:({filters:C,contextMode:N,sourceDashboardId:_,sourceDashboardTitle:k,targetDashboardId:j})=>{const I={filters:C},T={sourceCardId:p.DRILL_CONTEXT_CARD_ID,interactionMode:"clickFilter",filterGroups:[I]},E={...p.createInitialInteractionState(),appliedClickFilters:[T],contextMode:N,sourceDashboardId:_,sourceDashboardTitle:k,targetDashboardId:j};t(p.DRILL_CONTEXT_CARD_ID,E)}}),[a,r,f,c,d,o,t]);S.useEffect(()=>{Object.entries(e).forEach(([C,N])=>{if(N!=null&&N.lastInteractionEvent){const _=N.lastInteractionEvent,k=`${C}-${_.interactionMode}-${_.sourceCardId}-${Date.now()}`;if(y.current.has(k))return;y.current.add(k);try{gvt(_,w)}catch(j){console.error("Error executing interaction event:",j)}finally{n(C),setTimeout(()=>{y.current.delete(k)},5e3)}}})},[e,n,w]),S.useEffect(()=>{if(!(!s||!h||m))try{u(h),c(s.targetDashboardId,s.sourceDashboardId,s.sourceDashboardTitle,s.filters,s.contextMode),i()}catch(C){console.error("[DrillThrough] Error during automatic navigation:",C),i()}},[s,h,m,u,c,i]);const v=()=>{b({open:!1,insightId:""})};return l.jsxs(l.Fragment,{children:[l.jsx(vvt,{open:g.open,onOpenChange:v,insightId:g.insightId,filters:g.filters,filterDefinitions:g.filterDefinitions,contextMode:g.contextMode,cardTitle:x.title,cardDescription:x.description}),s&&m&&l.jsx("div",{className:"fixed inset-0 z-[51] flex items-center justify-center bg-background/80 backdrop-blur-sm",children:l.jsxs("div",{className:"flex flex-col items-center gap-2.5 rounded-[6px] border border-border/60 bg-background px-4 py-3 shadow-sm",children:[l.jsx(p.LoaderCircle,{className:"h-5 w-5 animate-spin text-muted-foreground/60"}),l.jsx("div",{className:"text-[12px] text-muted-foreground",children:"Loading dashboard..."})]})})]})}function Svt(e){return e.length===0?"":e.map(t=>{const n=t.field.label||t.field.name,r=t.operator,o=Cvt(t.value);return r==="="?`${n} = ${o}`:`${n} ${r} ${o}`}).join(", ")}function Cvt(e){return e==null?"null":Array.isArray(e)?e.join(", "):typeof e=="object"&&e.toString?e.toString():String(e)}function Nvt(e){return e?`Back to ${e}`:"Back"}function _vt(){var y,w,v,C,N;const e=p.useInteractionStore(_=>_.interactionStates[p.DRILL_CONTEXT_CARD_ID]),t=p.useDashboardStore(_=>_.actions.goBackFromDrill),n=p.useDashboardStore(_=>_.actions.clearDrillContext),{selectDashboard:r}=Sh(),[o,s]=S.useState({x:16,y:16}),[i,a]=S.useState(!1),c=S.useRef({x:0,y:0});S.useEffect(()=>{if(!i)return;const _=j=>{s({x:j.clientX-c.current.x,y:j.clientY-c.current.y})},k=()=>{a(!1)};return document.addEventListener("mousemove",_),document.addEventListener("mouseup",k),()=>{document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",k)}},[i]);const u=e==null?void 0:e.sourceDashboardId,d=e==null?void 0:e.sourceDashboardTitle,f=((C=(v=(w=(y=e==null?void 0:e.appliedClickFilters)==null?void 0:y[0])==null?void 0:w.filterGroups)==null?void 0:v[0])==null?void 0:C.filters)||[],h=u?{id:u,title:d||"Previous Dashboard",description:"",isPrivate:!1,isPublic:!1,version:"",createdBy:null,createdByTenantUser:"",tenantId:"",projectId:"",createdAt:"",updatedAt:"",lastModified:"",lastModifiedBy:"",createdByUser:null,createdByTenantUserRel:{name:"",email:""},permissions:{canEdit:!0,canShare:!0,canDelete:!0},ownership:{status:"private",isOwner:!0,sharedCount:0,createdBy:{type:"user",userId:"",name:"",email:""}}}:null;if(!e||!((N=e.appliedClickFilters)!=null&&N.length))return null;const m=()=>{if(!h){console.warn("[DrillBack] No source dashboard in context");return}try{t(),r(h)}catch(_){console.error("[DrillBack] Error during back navigation:",_)}},g=()=>{n()},b=_=>{_.target.closest("button")||(a(!0),c.current={x:_.clientX-o.x,y:_.clientY-o.y})};Svt(f);const x=Nvt(d);return l.jsx("div",{className:"fixed z-50 max-w-md",style:{left:0,top:0,transform:`translate(${o.x}px, ${o.y}px)`,transition:i?"none":void 0},children:l.jsxs("div",{className:"select-none rounded-lg border bg-background/95 p-3 shadow-lg backdrop-blur-sm",onMouseDown:b,style:{cursor:i?"grabbing":"grab"},children:[l.jsxs("div",{className:"mb-3 flex items-start justify-between gap-2",children:[l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Viewing:"}),l.jsx("div",{className:"flex flex-wrap gap-2",children:f.map((_,k)=>{const j=_.field.label||_.field.name,I=String(_.value);return l.jsxs(co,{variant:"secondary",className:"pointer-events-none text-xs",children:[j," = ",I]},k)})})]}),l.jsx(p.Button,{variant:"ghost",size:"sm",onClick:g,className:"h-6 w-6 cursor-pointer p-0",title:"Clear drill context",children:l.jsx(Te.X,{className:"h-3 w-3"})})]}),l.jsx("div",{className:"flex items-center gap-2 border-t pt-2",children:l.jsxs(p.Button,{variant:"secondary",size:"sm",onClick:m,disabled:!h,className:"w-full cursor-pointer",children:[l.jsx(R0,{className:"mr-2 h-4 w-4"}),x]})})]})})}function kvt(e,t){return typeof e=="boolean"?e:typeof t=="boolean"?t:!1}function jvt({filter:e,isEditing:t=!1,disabled:n=!1,storageOptions:r,settingsVariant:o,filterQueryContext:s,inputVariableName:i,reservedInputVariableNames:a,onUpdateFilter:c,onRemoveFilter:u}){const{attributes:d,listeners:f,setNodeRef:h,transform:m,transition:g,isDragging:b}=qg({id:`filter:${e.id}`,disabled:n||!t}),x={transform:bi.Translate.toString(m),transition:g,opacity:b?.5:1,zIndex:b?10:void 0};return l.jsx("div",{ref:h,style:x,...d,children:l.jsx(Q5,{filter:e,isEditing:t,dragListeners:t?f:void 0,storageOptions:r,settingsVariant:o,filterQueryContext:s,inputVariableName:i,reservedInputVariableNames:a,onUpdateFilter:c,onRemoveFilter:u})})}const rq="text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",Tvt=[];function nhe({open:e,onOpenChange:t}){var O,U,V;const[n,r]=S.useState(!1),[o,s]=S.useState(!1),[i,a]=S.useState({sheetSelection:"current",protectPdf:!1,password:""}),c=p.useDashboardStore(H=>{var q;return(q=H.dashboard)==null?void 0:q.sheets}),u=p.useDashboardStore(H=>H.dashboard),d=p.useDashboardStore(H=>H.dashboardInputValues),f=p.useDashboardStore(H=>H.filterValues),h=p.useDashboardStore(H=>H.controlValues),m=p.useDashboardStore(H=>H.inlineFilterValuesMap),g=p.useDashboardStore(H=>H.cardControlValuesMap),b=p.useDashboardStore(H=>H.selectedSheetId),x=p.useDashboardStore(H=>H.selectedSheetId?H.documentInputRuntimeBySheetId[H.selectedSheetId]:void 0),y=p.useDashboardStore(H=>H.isDownloadingPdf),{authToken:w,tokenProps:v}=bt(),C=c==null?void 0:c.find(H=>H.id===b),N=S.useMemo(()=>p.getDashboardExportSheets(c),[c]),_=p.isDocumentSheet(C),k=_&&C?C.document:void 0,j=S.useMemo(()=>_&&C?Wv(u,C.id):[],[C,_,u]),I=j.length>0,T=S.useMemo(()=>_&&C?gce(u,C.id):!1,[C,_,u]),E=S.useMemo(()=>I?j.map(Gv):(k==null?void 0:k.inputs)||Tvt,[k,j,I]),D=((U=(O=v==null?void 0:v.params)==null?void 0:O.calendarContext)==null?void 0:U.tz)||((V=v==null?void 0:v.params)==null?void 0:V.timezone)||(typeof Intl<"u"?Intl.DateTimeFormat().resolvedOptions().timeZone:void 0),A=S.useMemo(()=>gle(E),[E]),P=S.useMemo(()=>mle(E,D),[E,D]),M=S.useMemo(()=>ple(E),[E]),L=x?x.filterValuesByInputId:P,$=x?x.controlValuesByInputId:M,z=S.useMemo(()=>_?T&&C&&k?wZ({dashboard:u,sheetId:C.id,sheetKind:"document",sectionIds:k.sections.map(H=>H.id),mode:"document",runtimeValues:{dashboardInputValues:d,filterValues:f,controlValues:h,inlineFilterValuesMap:m,cardControlValuesMap:g},timezone:D}):yle(E,L,$,A,A):[],[k,E,C,_,u,g,h,f,m,d,$,L,A,D,T]),W=!!C,F=N.length>0,X=((c==null?void 0:c.length)||0)>1||_,Y=i.sheetSelection==="current"&&(!W||_&&z.length>0)||i.sheetSelection==="all"&&!F;S.useEffect(()=>{e&&i.sheetSelection==="all"&&!F&&a(H=>({...H,sheetSelection:"current"}))},[F,e,i.sheetSelection]);const R=()=>{a({sheetSelection:"current",protectPdf:!1,password:""}),r(!1),t(!1)};async function K(){if(y){rt.error("A PDF export is already in progress");return}if(i.protectPdf&&!i.password){rt.error("Please enter a password to protect the PDF");return}if(i.sheetSelection==="current"&&!W){rt.error("No sheet is selected to export");return}if(i.sheetSelection==="all"&&!F){rt.error("No dashboard sheets are available to export");return}s(!0);const H=i.sheetSelection==="current"&&_,q=H?i.protectPdf?"Generating protected document PDF... may take up to 60 seconds":"Generating document PDF... may take up to 60 seconds":i.sheetSelection==="all"?"Generating PDF for all dashboard sheets... This may take a while.":i.protectPdf?"Generating protected PDF... may take up to 60 seconds":"Generating PDF... may take up to 60 seconds",B=rt.loading(q);try{if(H){if(!k||!C)throw new Error("Selected document sheet is missing document data");if(z.length>0){rt.dismiss(B),rt.error(`Set ${z.join(", ")} before exporting`);return}const Z=new Date().toISOString(),J=T?CZ({dashboard:u,sheetId:C.id,sheetKind:"document",sectionIds:k.sections.map(oe=>oe.id),mode:"document",runtimeValues:{dashboardInputValues:d,filterValues:f,controlValues:h,inlineFilterValuesMap:m,cardControlValuesMap:g},generatedAt:Z,timezone:D}).snapshot:void 0;await bF(v.apiServiceUrl,w,{sheetId:C.id,title:C.title||"Document",pageSize:k.page.size,orientation:k.page.orientation,timezone:D,password:i.protectPdf?i.password:void 0,inputSnapshot:J,...J?{}:{inputValues:{sheetId:C.id,filterValuesByInputId:L,controlValuesByInputId:$,generatedAt:Z}}})}else{const Z=ZJ();await IZ(v.apiServiceUrl,w,i.protectPdf?i.password:void 0,i.sheetSelection,Z)}rt.dismiss(B);const G=H?i.protectPdf?"Protected document PDF downloaded successfully!":"Document PDF downloaded successfully!":i.sheetSelection==="all"?"Dashboard sheets PDF downloaded successfully!":i.protectPdf?"Protected PDF downloaded successfully!":"PDF downloaded successfully!";rt.success(G,{duration:2e3}),R()}catch(G){rt.dismiss(B),rt.error("Failed to download PDF",{description:z_(G,"Please try again or contact support."),descriptionClassName:$_,closeButton:!0,duration:1/0,richColors:!0}),console.error("PDF download error:",G)}finally{s(!1)}}return l.jsx(ks,{open:e,onOpenChange:H=>{if(!H){R();return}t(!0)},children:l.jsxs(ls,{className:"rounded-control border-border/60 sm:max-w-[440px] sm:rounded-control",children:[l.jsxs(Xi,{children:[l.jsx(cs,{className:"text-[15px]",children:_?"Export document":"Export dashboard"}),l.jsx(Gs,{className:"text-[13px] leading-5",children:_?"Export this document sheet as a PDF document.":"Export this dashboard as a PDF document."})]}),l.jsxs("div",{className:"space-y-4 py-1",children:[X&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(p.Label,{className:rq,children:"Export scope"}),l.jsxs(Ca,{value:i.sheetSelection,onValueChange:H=>a({...i,sheetSelection:H}),className:"gap-1.5",children:[l.jsxs(p.Label,{htmlFor:"scope-current",className:p.cn("flex cursor-pointer items-center gap-2 rounded-control px-1 py-1 text-[13px] font-normal hover:bg-muted/50",!W&&"cursor-not-allowed opacity-50 hover:bg-transparent"),children:[l.jsx(Co,{value:"current",id:"scope-current",disabled:!W}),_?"This document":"This sheet"," (",(C==null?void 0:C.title)||"Current",")"]}),l.jsxs(p.Label,{htmlFor:"scope-all",className:p.cn("flex cursor-pointer items-center gap-2 rounded-control px-1 py-1 text-[13px] font-normal hover:bg-muted/50",!F&&"cursor-not-allowed opacity-50 hover:bg-transparent"),children:[l.jsx(Co,{value:"all",id:"scope-all",disabled:!F}),"Dashboard sheets (",N.length," ",N.length===1?"sheet":"sheets",")"]})]}),_&&l.jsx("p",{className:"text-[12px] leading-5 text-muted-foreground",children:z.length>0?`Set ${z.join(", ")} before exporting this document.`:'"Dashboard sheets" includes dashboard sheets only. Choose "This document" to export the selected document.'})]}),l.jsx(p.Separator,{className:"bg-border/60"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs(p.Label,{htmlFor:"protect-pdf",className:"flex cursor-pointer items-center gap-2 text-[13px] font-normal",children:[l.jsx(Tn,{id:"protect-pdf",checked:i.protectPdf,onCheckedChange:H=>{a({...i,protectPdf:H,password:H?i.password:""}),H||r(!1)}}),l.jsx(r_,{className:"h-3.5 w-3.5 text-muted-foreground"}),"Password protect PDF"]}),i.protectPdf&&l.jsxs("div",{className:"ml-6 space-y-1.5",children:[l.jsx(p.Label,{htmlFor:"pdf-password",className:rq,children:"Password"}),l.jsxs("div",{className:"relative",children:[l.jsx(p.Input,{id:"pdf-password",size:"xs",type:n?"text":"password",value:i.password,onChange:H=>a({...i,password:H.target.value}),placeholder:"Enter password",className:"pr-8",onKeyDown:H=>{H.key==="Enter"&&i.password&&K()}}),l.jsx("button",{type:"button",className:"absolute right-1 top-1/2 flex h-5 w-5 -translate-y-1/2 items-center justify-center rounded-control text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>r(!n),"aria-label":n?"Hide password":"Show password",children:n?l.jsx(n_,{className:"h-3.5 w-3.5"}):l.jsx(Pt.Eye,{className:"h-3.5 w-3.5"})})]}),l.jsx("p",{className:"text-[12px] text-muted-foreground",children:"Recipients will need this password to open the PDF."})]})]})]}),l.jsxs(Ic,{children:[l.jsx(p.Button,{variant:"outline",size:"xs",onClick:R,disabled:o,children:"Cancel"}),l.jsx(p.Button,{size:"xs",onClick:K,disabled:o||y||Y,children:o?l.jsxs(l.Fragment,{children:[l.jsx(p.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Exporting…"]}):l.jsxs(l.Fragment,{children:[l.jsx(jc,{className:"h-3.5 w-3.5"}),"Export"]})})]})]})})}function rhe({iconClassName:e,open:t,onOpenChange:n}){const[r,o]=S.useState(!1),s=t!==void 0,i=s?t:r,a=u=>{s||o(u),n==null||n(u)},c=p.useDashboardStore(u=>u.isDownloadingPdf);return l.jsxs(l.Fragment,{children:[s?null:l.jsx(p.Button,{variant:"ghost",size:"sm",className:"h-7 p-2",disabled:c,onClick:()=>a(!0),children:l.jsx(jc,{className:p.cn("size-4",e)})}),l.jsx(nhe,{open:i,onOpenChange:a})]})}function oq(e,t,n){const r=new Set(t),o=[...n];return e.map(s=>r.has(s.id)?o.shift()??s.id:s.id)}function Ivt({control:e,value:t,isEditing:n=!1,onChange:r}){const{attributes:o,listeners:s,setNodeRef:i,transform:a,transition:c,isDragging:u}=qg({id:`control:${e.id}`,disabled:!n}),d={transform:bi.Translate.toString(a),transition:c,opacity:u?.5:1,zIndex:u?10:void 0};return l.jsx("div",{ref:i,style:d,...o,children:l.jsx(Ale,{control:e,value:t,isEditing:n,dragListeners:n?s:void 0,onChange:r})})}function sq(e){var t;return(((t=e.values)==null?void 0:t.length)??0)>0||e.operation==="is null"||e.operation==="is not null"}function iq(e,t){return[...e.map(n=>`filter:${n.id}`),...t.map(n=>`control:${n.id}`)]}function Evt(e,t,n){const r=new Set([...t.map(a=>`filter:${a.id}`),...n.map(a=>`control:${a.id}`)]);if(!(e!=null&&e.length))return iq(t,n);const o=e.filter(a=>r.has(a)),s=new Set(o),i=iq(t,n).filter(a=>!s.has(a));return[...o,...i]}function Dvt(e,t){return p.getDashboardCardEntries({sheets:e.sheets||[]}).filter(n=>n.sheet.id===t).map(n=>n.card.id)}function Mvt(e){return Cp(e.dashboardInput,{sheetId:e.selectedSheetId,sheetKind:"dashboard"})?!0:e.dashboardInput.scope.kind!=="cards"?!1:e.selectedSheetCardIds.some(t=>Cp(e.dashboardInput,{sheetId:e.selectedSheetId,cardId:t,sheetKind:"dashboard"}))}function aq(e){var t;return((t=e.compatibility)==null?void 0:t.source)!=="dashboardFilter"}function Avt(e){const t={sheetId:e.selectedSheetId},n=p.getDashboardInputRuntimeSlot(e.dashboardInputValues,e.dashboardInput,t);if(n)return n;const r=p.getDashboardInputRuntimeSlot(e.defaultInputValues,e.dashboardInput,t);return r||p.getBackingDefaultSlot(e.dashboardInput)}function Rvt(e){return ohe(e).filter(t=>{var n,r;return t.filter.hide||t.filter.location==="frame"?!1:((n=t.compatibility)==null?void 0:n.source)==="dashboardFilter"?!0:(((r=t.presentation)==null?void 0:r.placement)||"toolbar")==="toolbar"})}function ohe(e){if(!e.selectedSheetId)return[];const t=e.selectedSheetId,n=Dvt(e.dashboard,t);return FK(D_({dashboard:e.dashboard}).allInputs).filter(r=>!(r.kind!=="filter"||!Mvt({dashboardInput:r,selectedSheetId:t,selectedSheetCardIds:n})))}function Pvt(e,t){return"toolbar"}function Fvt(){const e=Dc("interactive"),t=p.useDashboardStore(U=>U.selectedSheetId),n=p.useDashboardStore(U=>U.dashboard.filters),r=p.useDashboardStore(U=>U.dashboard.filterLayout),o=p.useDashboardStore(U=>U.isDashboardEditing),s=p.useDashboardStore(U=>U.controlValues),i=p.useDashboardStore(U=>U.filterValues);p.useDashboardStore(U=>U.filteringCards);const a=p.useDashboardStore(U=>U.inlineFilterValuesMap),c=p.useDashboardStore(U=>U.dashboardInputValues),u=p.useInteractionStore(U=>U.clearAllClickFilters),d=p.useInteractionStore(U=>Object.entries(U.interactionStates).reduce((V,[H,q])=>{var B;return H===p.DRILL_CONTEXT_CARD_ID?V:V+(((B=q.appliedClickFilters)==null?void 0:B.length)??0)},0)),f=p.useDashboardStore(U=>U.actions.removeCardInlineFilterValue),{reorderFilters:h,clearDashboardInputSlot:m,reorderDashboardControls:g,removeDashboardInput:b,setControlValue:x,setFilterLayout:y,setFilterValues:w,setFilteringCards:v,upsertDashboardInput:C}=p.useDashboardActions(),N=lj(Gp(Hg,{activationConstraint:{distance:5}})),_=p.useDashboardStore(U=>U.dashboard),k=Rvt({dashboard:_,selectedSheetId:t}).filter(U=>Pvt(U.filter)==="toolbar"),j=ohe({dashboard:_,selectedSheetId:t}),I=k.map(U=>U.filter),T=new Map(k.map(U=>[`filter:${U.filter.id}`,U])),E=HYe(_),D=E.filter(U=>!U.hidden&&t0(U)==="toolbar"),A=E.filter(U=>!U.hidden&&t0(U)==="advanced"),P=Evt(r==null?void 0:r.toolbarItemOrder,I,D),M=new Map(I.map(U=>[`filter:${U.id}`,U])),L=new Map(D.map(U=>[`control:${U.id}`,U]));function $(U){const{active:V,over:H}=U;if(!H||V.id===H.id)return;const q=String(V.id),B=String(H.id),G=P.findIndex(ye=>ye===q),Z=P.findIndex(ye=>ye===B);if(G===-1||Z===-1)return;const J=Ug(P,G,Z);y({toolbarItemOrder:J});const oe=new Set((n||[]).map(ye=>ye.id)),ie=P.filter(ye=>ye.startsWith("filter:")).map(ye=>ye.replace("filter:","")).filter(ye=>oe.has(ye)),ue=J.filter(ye=>ye.startsWith("filter:")).map(ye=>ye.replace("filter:","")).filter(ye=>oe.has(ye)),xe=P.filter(ye=>ye.startsWith("control:")).map(ye=>ye.replace("control:","")),te=J.filter(ye=>ye.startsWith("control:")).map(ye=>ye.replace("control:",""));h(oq(n||[],ie,ue)),g(oq(_.controls||[],xe,te))}const z=(r==null?void 0:r.toolbarWrap)??!1,W=(r==null?void 0:r.showDownloadButton)??!1,F=(i==null?void 0:i.filter(U=>sq(U)).length)??0,X=j.filter(aq),Y=X.filter(U=>{const V=Avt({dashboardInput:U,dashboardInputValues:c,defaultInputValues:_.defaultInputValues,selectedSheetId:t});return(V==null?void 0:V.status)==="set"&&V.value.kind==="filter"&&sq(V.value.filterValue)}).length,R=a?Object.values(a).reduce((U,V)=>U+((V==null?void 0:V.length)??0),0):0,K=F+Y+R+d,O=()=>{w([]),X.forEach(U=>{m(U,{sheetId:t})}),v([]),u(),a&&Object.entries(a).forEach(([U,V])=>{V==null||V.forEach(H=>{f(U,H.filterId)})})};return!I.length&&!D.length&&!A.length&&!W&&K===0?null:l.jsx("div",{className:"z-20 border-b border-border/60 bg-background/95 px-3 py-2 backdrop-blur supports-[backdrop-filter]:bg-background/85",style:e.containerStyle,role:"toolbar","aria-label":"Dashboard filters and controls",children:l.jsx(zv,{sensors:N,collisionDetection:Ov,onDragEnd:$,children:l.jsxs("div",{className:p.cn("flex items-center",z?"flex-wrap":"w-0 min-w-full overflow-x-auto"),children:[l.jsx(Bv,{items:P,strategy:jL,children:l.jsx(sR,{className:"gap-3 pr-0",wrap:z,children:P.map(U=>{const V=M.get(U);if(V){const q=T.get(U),B=q&&aq(q);return l.jsx(jvt,{filter:V,isEditing:o,storageOptions:B?{storageTarget:"dashboardInput",dashboardInput:q,sheetId:t??void 0}:void 0,inputVariableName:B?q.variableName:void 0,onUpdateFilter:B?(G,Z)=>{C({...q,variableName:(Z==null?void 0:Z.variableName)||q.variableName,filter:G})}:void 0,onRemoveFilter:B?()=>{w((i||[]).filter(G=>G.filterId!==V.id)),b(q.id)}:void 0},U)}const H=L.get(U);return H?l.jsx(Ivt,{control:H,value:s==null?void 0:s[H.id],isEditing:o,onChange:q=>x(H.id,q)},U):null})})}),A.length>0&&l.jsx(Tie,{title:"",controls:A,values:s,onChange:(U,V)=>x(U.id,V),immediatePlacement:"toolbar",advancedLabel:"More controls"}),K>0&&l.jsxs("button",{type:"button",onClick:O,"aria-label":"Clear all filters",className:"ml-auto inline-flex h-7 shrink-0 items-center gap-1 rounded-control px-2 text-[12px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:[l.jsx(Te.X,{className:"h-3 w-3"}),"Clear all",l.jsx("span",{className:"rounded-[3px] bg-muted px-1 text-[10px] tabular-nums text-muted-foreground",children:K})]}),W&&l.jsx("div",{className:p.cn(K>0?"ml-1.5":"ml-auto"),children:l.jsx(rhe,{})})]})})})}function she(){var me,we;const{showAssistant:e,tokenProps:t,renderMode:n}=bt(),r=kvt((me=t.config)==null?void 0:me.showDashboardAssistant,e),{preferences:o}=eg(),s=(we=o==null?void 0:o.cardDisplay)==null?void 0:we.mode,i=Rh(s),a=sZ({displayMode:s,renderMode:n}),c=S.useRef(null),u=S.useRef(null),[d,f]=S.useState(!1),{handleDragStart:h,isDraggingRef:m,getStyle:g,getPositionClasses:b}=yst({initialPosition:"bottom-right"}),x=kf(ee=>ee.setFullscreen),y=kf(ee=>ee.setPanelOpen),w=kf(ee=>ee.setContainer),v=HY("dashboard"),C=UY(),N=qY("dashboard"),_=v.isOpen,k=C==="dashboard",j=p.useDashboardStore(ee=>ee.isVisualEditing),I=p.useDashboardStore(ee=>ee.themeStyle),T=Mc(),E=p.useDashboardStore(ee=>{var re;return(re=ee.dashboard)==null?void 0:re.sheets}),D=p.useDashboardStore(ee=>ee.showFilters),A=p.useDashboardStore(ee=>ee.isDashboardEditing),P=p.useDashboardStore(ee=>ee.selectedSheetId),M=E==null?void 0:E.find(ee=>ee.id===P),L=p.useDashboardStore(ee=>{var re,ne,le;return(le=(ne=(re=ee.dashboard)==null?void 0:re.sheets)==null?void 0:ne.find(ae=>ae.id===ee.selectedSheetId))==null?void 0:le.kind}),$=p.useDashboardStore(ee=>{var re,ne;return((ne=(re=ee.dashboard)==null?void 0:re.summary)==null?void 0:ne.position)||"top"}),z=L==="document",W=p.useDashboardStore(ee=>{var re;return(re=ee.dashboard)==null?void 0:re.id}),{getDefaultSheetId:F,setDefaultSheetId:X,clearDefaultSheetId:Y}=Gq(W),[R,K]=S.useState(null),{setSelectedSheetId:O,setSheetTitle:U,addSheet:V,setSheets:H}=p.useDashboardActions();hvt(u);const{setActiveAssistantType:q}=p.useAIActions();S.useEffect(()=>{if(W){const ee=F();K(ee)}},[W,F]),S.useEffect(()=>{_?q("dashboard"):C==="dashboard"&&x(null)},[_,q,C,x]),S.useEffect(()=>{var ee;_||(ee=c.current)==null||ee.resize(0)},[_]);function B(ee){var re,ne;ee?((re=c.current)==null||re.resize(40),y("dashboard",!0),x("dashboard"),q("dashboard")):(y("dashboard",!1),x(null),(ne=c.current)==null||ne.resize(0),q(null))}function G(ee="dashboard"){const re={id:p.v4(),title:ee==="document"?"New Document":"New Sheet",...ee==="document"?{kind:ee,document:p.createDefaultDocumentDefinition()}:{}};V(re),O(re.id)}function Z(ee,re){if(!W)return;R===ee?(Y(),K(null),rt.success("Default sheet cleared")):(X(ee),K(ee),rt.success(`"${re}" set as default sheet`))}function J(ee){var re;ee<1?(y("dashboard",!1),x(null),q(null),(re=c.current)==null||re.resize(0)):(_||y("dashboard",!0),q("dashboard"))}function oe(){return(I==null?void 0:I.canvasTheme)==="muted"||!(I!=null&&I.canvasTheme)?"hsl(var(--semaphor-muted))":(I==null?void 0:I.canvasTheme)==="clear"?"":I==null?void 0:I.canvasTheme}const ie=(ee,re)=>{ee.dataTransfer.setData("tabIndex",re.toString())},ue=ee=>{ee.preventDefault()},xe=(ee,re)=>{const ne=ee.dataTransfer.getData("tabIndex");if(ne===re.toString())return;const le=Array.from(E||[]),[ae]=le.splice(parseInt(ne),1);le.splice(re,0,ae),H(le)},te=r===!0&&!i&&!_&&!j&&!D;function ye(){if(E&&E.length>1||A)return l.jsx("div",{className:"relative flex w-full items-stretch border-b border-border",children:l.jsxs("div",{className:"relative min-w-0 flex-1",children:[l.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-0 left-0 z-10 w-4 bg-gradient-to-r from-background to-transparent"}),l.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-0 right-0 z-10 w-4 bg-gradient-to-l from-background to-transparent"}),l.jsxs(p.TabsList,{role:"tab-list",className:"flex w-0 min-w-full items-stretch justify-start overflow-x-auto rounded-none bg-transparent p-0 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[E==null?void 0:E.map((ee,re)=>{const ne=P===ee.id,le=R===ee.id;return l.jsxs(p.TabsTrigger,{draggable:!0,onDragStart:ae=>ie(ae,re),onDragOver:ue,onDrop:ae=>xe(ae,re),onClick:()=>O(ee.id),className:p.cn("group relative inline-flex h-9 shrink-0 items-center gap-1.5 rounded-none bg-transparent px-3 py-0 text-[12px] font-medium text-muted-foreground transition-colors hover:bg-transparent hover:text-foreground data-[state=active]:bg-transparent data-[state=active]:text-foreground data-[state=active]:shadow-none","after:pointer-events-none after:absolute after:inset-x-2 after:-bottom-px after:h-0.5 after:bg-transparent data-[state=active]:after:bg-foreground"),value:ee.id,children:[ee.kind==="document"&&l.jsx(di,{className:"h-3 w-3 text-muted-foreground"}),l.jsx(mN,{enabled:A&&ne,text:ee.title,onSave:ae=>U(ee.id,ae),children:ee.title},ee.id),l.jsx("span",{role:"button",tabIndex:0,"aria-label":le?"Clear default sheet":"Set as default sheet",title:le?"Clear default sheet":"Set as default sheet",onClick:ae=>{ae.stopPropagation(),Z(ee.id,ee.title||"Sheet")},onKeyDown:ae=>{(ae.key==="Enter"||ae.key===" ")&&(ae.preventDefault(),ae.stopPropagation(),Z(ee.id,ee.title||"Sheet"))},className:p.cn("inline-flex h-4 w-4 shrink-0 cursor-pointer items-center justify-center rounded-[3px] transition-opacity hover:bg-muted focus:outline-none focus-visible:ring-1 focus-visible:ring-foreground",ne||le?"opacity-100":"opacity-0 group-hover:opacity-100"),children:l.jsx(DW,{className:p.cn("h-3 w-3 transition-colors",le?"fill-current text-amber-500":"text-muted-foreground")})}),A&&ne&&E.length>1&&l.jsx("span",{role:"button",tabIndex:0,"aria-label":"Delete sheet",className:"inline-flex h-4 w-4 shrink-0 cursor-pointer items-center justify-center rounded-[3px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus:outline-none focus-visible:ring-1 focus-visible:ring-foreground",onClick:ae=>{ae.stopPropagation(),f(!0)},onKeyDown:ae=>{(ae.key==="Enter"||ae.key===" ")&&(ae.preventDefault(),ae.stopPropagation(),f(!0))},children:l.jsx(Te.X,{className:"h-3 w-3"})})]},ee.id)}),A&&l.jsxs(Bo,{children:[l.jsx(Vo,{asChild:!0,children:l.jsxs("button",{type:"button","aria-label":"Add sheet",className:"ml-1 inline-flex h-9 shrink-0 items-center gap-1 px-3 text-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground",children:[l.jsx(kr,{className:"h-3 w-3"}),"Sheet"]})}),l.jsxs(ko,{align:"start",className:"w-48",children:[l.jsxs(Sn,{onSelect:()=>G("dashboard"),children:[l.jsx(Yf,{className:"h-4 w-4 text-muted-foreground"}),"Dashboard sheet"]}),l.jsxs(Sn,{onSelect:()=>G("document"),children:[l.jsx(di,{className:"h-4 w-4 text-muted-foreground"}),"Document"]})]})]})]})]})})}function se(){return l.jsx("div",{ref:u,style:{},className:"h-full min-h-0 grow",children:E==null?void 0:E.map(ee=>l.jsx(p.TabsContent,{style:{backgroundColor:oe(),...T.dashboardCanvasStyle},className:p.cn("mt-0 h-full min-h-0",{}),value:ee.id,children:l.jsx(eH,{sheet:ee})},ee.id))})}function Ie(){return l.jsxs(p.Tabs,{"data-role":"dashboard-tabs-container",className:p.cn("relative flex h-full flex-col",I==null?void 0:I.dashboardTabsContainer),onValueChange:ee=>{O(ee)},value:P||void 0,children:[ye(),$==="top"&&!z&&l.jsx($A,{}),P&&!z&&l.jsx(Fvt,{}),z?l.jsx("div",{"data-role":"dashboard-tabs-content",className:"min-h-0 flex-1 grow basis-0 overflow-hidden",children:se()}):l.jsx(Ea,{"data-role":"dashboard-tabs-content",className:"flex-1 grow basis-0 overflow-y-auto",children:se()}),$==="bottom"&&!z&&l.jsx($A,{}),l.jsx(vst,{open:d,setOpen:f})]})}const fe=S.useCallback(ee=>{w("dashboard",ee)},[w]);return E?a&&P&&!z?l.jsxs("div",{"data-document-render-error":"true",className:"bg-white p-8 text-sm text-zinc-700",children:['Requested document sheet "',P,'" was not found or is not a document sheet in the loaded dashboard.']}):a&&z&&M?l.jsx("div",{"data-role":"dashboard-document-print-content",className:"min-h-0 overflow-visible bg-white",children:l.jsx(eH,{sheet:M})}):l.jsxs(l.Fragment,{children:[l.jsx(wvt,{}),l.jsx(_vt,{}),l.jsxs("div",{className:"relative flex-1 basis-0 overflow-hidden",children:[l.jsxs(zce,{className:p.cn("flex-1 basis-0 overflow-y-auto transition-opacity",k&&"pointer-events-none opacity-0"),direction:"horizontal",children:[l.jsx(uR,{children:Ie()}),r===!0&&l.jsxs(l.Fragment,{children:[l.jsx(xst,{open:_,onTabClick:B,withHandle:!0,disabled:!_}),l.jsx(uR,{className:"flex grow","data-role":"dashboard-assistant-panel",onResize:J,defaultSize:_?40:0,ref:c,children:l.jsx("div",{className:"grow overflow-y-auto",children:l.jsx(fvt,{open:_,setOpen:B,isFullscreen:k,onFullscreenChange:ee=>x(ee?"dashboard":null),fullscreenContainer:N})})})]})]}),l.jsx("div",{ref:fe,className:p.cn("absolute inset-0",!k&&"pointer-events-none")}),te&&l.jsx("div",{className:p.cn("absolute z-50 transition-all duration-300 ease-in-out",b().horizontal,b().vertical),style:g(),children:l.jsx(p.Button,{size:"sm",variant:"outline",className:"h-12 w-12 cursor-grab rounded-full border-border bg-background p-0 shadow-lg hover:bg-muted active:cursor-grabbing",onClick:()=>{m.current||B(!0)},onMouseDown:h,onTouchStart:h,title:"Open Assistant (drag to move)",children:l.jsx(Fpe,{className:"h-5 w-5"})})})]})]}):null}const ihe=S.forwardRef(({appearance:e,organizationAppearance:t,tokenAppearance:n,reactAppearance:r,resolvedAppearance:o,children:s,className:i,style:a,...c},u)=>{const d=S.useId(),f=S.useMemo(()=>Ovt(d),[d]),{theme:h}=VR(),m=Lvt(h),g=S.useMemo(()=>o??kc.resolveAppearance({organizationAppearance:t,tokenAppearance:n,reactAppearance:r??e}),[e,t,r,o,n]),b=S.useMemo(()=>p.compileAppearance({spec:g,systemMode:m}),[g,m]),x=S.useMemo(()=>p.createAppearanceContextValue(f,b),[b,f]);return l.jsx(p.AppearanceContext.Provider,{value:x,children:l.jsx(Lg,{...c,ref:u,className:i,style:a,children:s})})});ihe.displayName="AppearanceProvider";function Ovt(e){return`semaphor-appearance-${e.replace(/[^a-zA-Z0-9_-]/g,"")}`}function Lvt(e){const t=U1(e),[n,r]=S.useState(()=>$vt());return S.useEffect(()=>{var i,a;if(t!=="system"||typeof window>"u")return;const o=(i=window.matchMedia)==null?void 0:i.call(window,"(prefers-color-scheme: dark)");if(!o)return;const s=()=>{r(o.matches?"dark":"light")};return s(),typeof o.addEventListener=="function"?(o.addEventListener("change",s),()=>o.removeEventListener("change",s)):((a=o.addListener)==null||a.call(o,s),()=>{var c;return(c=o.removeListener)==null?void 0:c.call(o,s)})},[t]),t==="system"?n:t}function $vt(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}const ahe=S.createContext({openBrandStudioPreview:()=>{}}),zvt=ahe.Provider;function Bvt(){return S.useContext(ahe)}function Vvt({children:e,defaultTheme:t="system",storageKey:n="vite-ui-theme",...r}){const o=U1(t),[s,i]=S.useState(()=>Hvt(n)||o),a=S.useCallback(u=>{const d=U1(u);Uvt(n,d),i(d)},[n]),c=S.useMemo(()=>({theme:s,setTheme:a}),[s,a]);return l.jsx(_q.Provider,{...r,value:c,children:e})}function Hvt(e){if(typeof window>"u")return null;try{const t=window.localStorage.getItem(e);if(!t)return null;const n=U1(t,"system");return n===t?n:null}catch{return null}}function Uvt(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(e,t)}catch{}}const qvt=S.lazy(()=>Promise.resolve().then(()=>require("../brand-studio/index.cjs")).then(e=>({default:e.BrandStudioEditor})));function t$({appearance:e,children:t}){var E,D;const{authToken:n,id:r,tokenProps:o}=bt(),s=M0(),i=(E=s.data)==null?void 0:E.organizationAppearance,a=(D=o.config)==null?void 0:D.appearance,[c,u]=S.useState(!1),[d,f]=S.useState(null),[h,m]=S.useState(null),[g,b]=S.useState(null),[x,y]=S.useState(null),w=`${o.apiServiceUrl??""}:${(n==null?void 0:n.accessToken)??""}`,v=Rn({queryKey:PG({resourceType:Zr.DASHBOARD,apiServiceUrl:o.apiServiceUrl,accessToken:n==null?void 0:n.accessToken}),queryFn:async()=>p.getRequest(`${o.apiServiceUrl}/management/v1/dashboards`,(n==null?void 0:n.accessToken)||""),select:A=>(A==null?void 0:A.organizationAppearance)??null,enabled:!s.dashboardIdToFetch&&i===void 0&&!!(n!=null&&n.accessToken)});S.useEffect(()=>{i!==void 0&&y({scopeKey:w,appearance:i})},[i,w]),S.useEffect(()=>{v.data!==void 0&&y({scopeKey:w,appearance:v.data})},[v.data,w]);const C=(x==null?void 0:x.scopeKey)===w?x.appearance:null,N=i!==void 0?i:v.data!==void 0?v.data:C,_=S.useMemo(()=>kc.resolveAppearance({organizationAppearance:N,tokenAppearance:a,reactAppearance:e}),[e,N,a]),k=S.useCallback(()=>{f(g??h??_),u(!0)},[g,h,_]),j=S.useCallback(()=>{u(!1)},[]);S.useEffect(()=>{f(null),m(null),b(null),u(!1)},[r]);const I=S.useMemo(()=>({openBrandStudioPreview:k}),[k]),T=g??h??e;return l.jsx(Vvt,{defaultTheme:"system",storageKey:"vite-ui-theme",children:l.jsx(zvt,{value:I,children:l.jsx(ihe,{organizationAppearance:N,tokenAppearance:a,reactAppearance:T,style:{height:"100%",width:"100%"},children:l.jsxs(p.TooltipProvider,{delayDuration:0,children:[t,c&&l.jsx("aside",{"aria-label":"Brand Studio","aria-modal":"false",role:"dialog",className:"fixed bottom-0 right-0 top-0 z-50 flex w-[min(520px,100vw)] flex-col border-l border-border bg-background text-foreground shadow-sm",children:l.jsx(S.Suspense,{fallback:l.jsx("div",{className:"flex h-full items-center justify-center text-[12px] text-muted-foreground",children:"Loading Brand Studio..."}),children:l.jsx(qvt,{appearance:d,onDraftChange:b,onSave:A=>{m(A),b(A),f(A)},onCancel:j})})})]})})})})}function lhe({children:e,preferences:t}){const{currentUser:n}=Zi(),r=S.useMemo(()=>{var o,s;return{preferences:t||{},isLocalDev:((o=t==null?void 0:t.uiMode)==null?void 0:o.developer)||!1,isConsoleMode:((s=t==null?void 0:t.uiMode)==null?void 0:s.console)||!1}},[t]);return l.jsx(MG.Provider,{value:r,children:l.jsx(nj,{displayPreferences:t==null?void 0:t.cardDisplay,currentUser:n,children:e})})}function Wvt(e=2e3,t=500){const n=Xme(),[r,o]=S.useState(!1),[s,i]=S.useState(!1),a=S.useRef(null);return S.useEffect(()=>{const c=setTimeout(()=>o(!0),e);return()=>clearTimeout(c)},[e]),S.useEffect(()=>{if(r){if(n>0){i(!1),a.current&&(clearTimeout(a.current),a.current=null);return}return a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{i(!0)},t),()=>{a.current&&clearTimeout(a.current)}}},[r,n,t]),s}function n$({delayMs:e=2e3,quietMs:t=500,componentType:n,componentId:r}){const o=Wvt(e,t);return S.useEffect(()=>(o&&(window.__SEMAPHOR_READY__={ready:!0,type:n,componentId:r||null,timestamp:Date.now()}),()=>{window.__SEMAPHOR_READY__={ready:!1,type:n,componentId:r||null,timestamp:Date.now()}}),[o,n,r]),l.jsx("div",{id:"idle-check","aria-hidden":"true",style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0},children:o?"ready":""})}function che(e){if(typeof window>"u")return null;const{preferences:t}=e;return l.jsx(ka,{FallbackComponent:ej,children:l.jsxs(YR,{dashboardProps:e,children:[l.jsx(n$,{componentType:"dashboard",componentId:e.id}),l.jsx(t$,{appearance:e.appearance,children:l.jsx(lhe,{preferences:t,children:l.jsx("main",{className:"flex h-full flex-col",children:l.jsx(_P,{...e,type:"dashboard",children:l.jsx(she,{})})})})})]})})}function Gvt(e=[]){const t=S.useRef(null),n=S.useRef(null),r=S.useRef(null),[o,s]=S.useState(),i=S.useCallback(()=>{var m,g,b;const a=((m=t.current)==null?void 0:m.clientWidth)??0,c=((g=r.current)==null?void 0:g.offsetWidth)??0,u=((b=n.current)==null?void 0:b.offsetWidth)??0,f=a-c-u-8,h=Math.max(f,0);s(x=>x===h?x:h)},[]);return S.useEffect(()=>{const a=t.current;if(!a||typeof ResizeObserver>"u")return;const c=new ResizeObserver(()=>i());return c.observe(a),i(),()=>c.disconnect()},[i,...e]),{headerRef:t,leftActionsRef:n,rightActionsRef:r,titleMaxWidth:o,updateAvailableWidth:i}}function Yvt({filter:e}){var g;const t=p.useDashboardStore(b=>b.isDashboardEditing),{preferences:n}=eg(),r=Rh((g=n==null?void 0:n.cardDisplay)==null?void 0:g.mode),o=p.useDashboardStore(b=>b.filterValues),s=o==null?void 0:o.some(b=>b.filterId===e.id),{removeFilterValues:i,removeFilter:a,updateFilter:c}=p.useDashboardActions(),{headerRef:u,leftActionsRef:d,rightActionsRef:f,titleMaxWidth:h,updateAvailableWidth:m}=Gvt([t,s,r]);return S.useEffect(()=>{m()},[e.title,m]),l.jsxs("div",{ref:u,className:"group mb-1 flex h-5 items-center justify-between",children:[l.jsxs("div",{className:"flex grow items-center gap-2 min-w-0",children:[l.jsx("div",{className:"min-w-0 flex-1",style:h!==void 0?{maxWidth:h}:void 0,children:l.jsx(p.Label,{className:"my-1 block w-full text-sm",children:l.jsx(Hs,{value:e.title||e.column,onSave:b=>c({...e,title:b}),isEditable:t,placeholder:"Filter",displayClassName:"text-sm truncate",inputClassName:"text-sm"})})}),l.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",ref:d,children:[t&&l.jsx(X5,{filter:e,isEditing:t}),t&&l.jsx("button",{onClick:()=>{i(e.id),a(e.id)},className:"text-muted-foreground hover:text-foreground",children:l.jsx(Te.X,{className:"size-3.5"})})]})]}),l.jsx("div",{className:"hidden",ref:f})]})}function Kvt(){const e=p.useDashboardStore(r=>r.dashboard.filters),t=p.useDashboardStore(r=>r.theme),n=e==null?void 0:e.filter(r=>r.hide);return n!=null&&n.length?l.jsx("div",{className:p.cn("mb-1 flex items-center gap-2 border-y px-0.5 pb-0.5",{"bg-[repeating-linear-gradient(45deg,_#ffffff_0_3px,_#f3f3f3_3px_6px)]":t==="light","bg-[repeating-linear-gradient(45deg,_#18171d_0_3px,_#272729_3px_6px)]":t==="dark"}),children:n==null?void 0:n.map(r=>l.jsxs("div",{className:"flex min-w-[250px] max-w-fit flex-col gap-1 p-2",children:[l.jsx(Yvt,{filter:r}),l.jsx(Gk,{filter:r})]},r.id))}):null}function Zvt(){var i;const e=p.useDashboardStore(a=>a.dashboard),t=p.useDashboardStore(a=>a.selectedSheetId),n=p.useDashboardStore(a=>a.isVisualEditing),r=p.useDashboardStore(a=>a.isDashboardEditing),o=(i=e.sheets)==null?void 0:i.find(a=>a.id===t),s=p.isDocumentSheet(o);return l.jsx("div",{role:"dashboard-plus-main",className:p.cn("",{"max-h-0 overflow-hidden":n,"flex min-h-0 grow basis-0 overflow-hidden":!n}),children:l.jsxs("section",{className:"flex min-h-0 grow basis-0 flex-col overflow-hidden",children:[r&&!s&&l.jsx(Kvt,{}),l.jsx(she,{})]})})}const Xvt=S.lazy(()=>Promise.resolve().then(()=>require("./dashboard-controls-YqmXJpRK.js"))),Qvt=S.lazy(()=>Promise.resolve().then(()=>require("./edit-dashboard-visual-DP0h664h.js"))),Jvt=S.lazy(()=>Promise.resolve().then(()=>require("./dashboard-json-smJ7897T.js")));function ewt({showControls:e=!1,showFooter:t=!0,...n}){const r=p.useDashboardStore(a=>a.isVisualEditing),o=p.useDashboardStore(a=>a.showDashboardJSON),{appearance:s,preferences:i}=n;return l.jsx(ka,{FallbackComponent:ej,children:l.jsxs(YR,{dashboardProps:n,children:[l.jsx(n$,{componentType:"surfboard",componentId:n.id}),l.jsxs(t$,{appearance:s,children:[l.jsx(Vbe,{toastOptions:{classNames:{toast:"max-w-[calc(100vw-2rem)] overflow-x-hidden !items-start [--toast-close-button-end:0.5rem] [--toast-close-button-start:auto] [--toast-close-button-transform:translate(0,0)] sm:max-w-[44rem]",content:"min-w-0 flex-1",icon:"mt-0.5 shrink-0",title:"max-w-full break-words pr-8",description:"max-w-full break-words",closeButton:"!top-2 h-6 w-6 rounded-md border-border bg-background text-muted-foreground hover:bg-muted hover:text-foreground"}}}),l.jsxs(lhe,{preferences:i,children:[o&&l.jsx(S.Suspense,{fallback:null,children:l.jsx(Jvt,{})}),l.jsxs("main",{className:"relative flex h-full w-full flex-col overflow-hidden",children:[e&&l.jsx(S.Suspense,{fallback:null,children:l.jsx(Xvt,{})}),l.jsx("div",{className:"flex grow overflow-hidden",children:l.jsx("div",{className:"flex min-w-0 flex-1",children:l.jsxs(_P,{...n,type:"dashboard",children:[r&&l.jsx(S.Suspense,{fallback:null,children:l.jsx(Qvt,{})}),l.jsx(Zvt,{})]})})})]})]})]})]})})}var twt=Object.defineProperty,nwt=(e,t,n)=>t in e?twt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ZS=(e,t,n)=>nwt(e,typeof t!="symbol"?t+"":t,n);const rwt={stringify:e=>e?"true":"false",parse:e=>/^[ty1-9]/i.test(e)},owt={stringify:e=>e.name,parse:(e,t,n)=>{const r=(()=>{if(typeof window<"u"&&e in window)return window[e];if(typeof global<"u"&&e in global)return global[e]})();return typeof r=="function"?r.bind(n):void 0}},swt={stringify:e=>JSON.stringify(e),parse:e=>JSON.parse(e)};function iwt(e){return e.replace(/([a-z0-9])([A-Z])/g,(t,n,r)=>`${n}-${r.toLowerCase()}`)}function uhe(e){return e.replace(/[-:]([a-z])/g,(t,n)=>`${n.toUpperCase()}`)}const awt={stringify:e=>e.name,parse:(e,t,n)=>{const r=(()=>{const o=uhe(t);if(typeof n<"u"&&o in n.container)return n.container[o]})();return typeof r=="function"?r.bind(n):void 0}},lwt={stringify:e=>`${e}`,parse:e=>parseFloat(e)},cwt={stringify:e=>e,parse:e=>e},HD={string:cwt,number:lwt,boolean:rwt,function:owt,method:awt,json:swt},Gb=Symbol.for("r2wc.render"),XS=Symbol.for("r2wc.connected"),Ld=Symbol.for("r2wc.context"),Qs=Symbol.for("r2wc.props");function uwt(e,t,n){var r,o,s;t.props||(t.props=e.propTypes?Object.keys(e.propTypes):[]),t.events||(t.events=[]);const i=Array.isArray(t.props)?t.props.slice():Object.keys(t.props),a=Array.isArray(t.events)?t.events.slice():Object.keys(t.events),c={},u={},d={},f={};for(const m of i){c[m]=Array.isArray(t.props)?"string":t.props[m];const g=iwt(m);d[m]=g,f[g]=m}for(const m of a)u[m]=Array.isArray(t.events)?{}:t.events[m];class h extends HTMLElement{constructor(){super(),ZS(this,s,!0),ZS(this,o),ZS(this,r,{}),ZS(this,"container"),t.shadow?this.container=this.attachShadow({mode:t.shadow}):this.container=this,this[Qs].container=this.container;for(const g of i){const b=d[g],x=this.getAttribute(b),y=c[g],w=y?HD[y]:null;if(y==="method"){const v=uhe(b);Object.defineProperty(this[Qs].container,v,{enumerable:!0,configurable:!0,get(){return this[Qs][v]},set(C){this[Qs][v]=C,this[Gb]()}}),this[Qs][g]=w.parse(x,b,this)}w!=null&&w.parse&&x&&(this[Qs][g]=w.parse(x,b,this))}for(const g of a)this[Qs][g]=b=>{const x=g.replace(/^on/,"").toLowerCase();this.dispatchEvent(new CustomEvent(x,{detail:b,...u[g]}))}}static get observedAttributes(){return Object.keys(f)}connectedCallback(){this[XS]=!0,this[Gb]()}disconnectedCallback(){this[XS]=!1,this[Ld]&&n.unmount(this[Ld]),delete this[Ld]}attributeChangedCallback(g,b,x){const y=f[g],w=c[y],v=w?HD[w]:null;y in c&&v!=null&&v.parse&&x&&(this[Qs][y]=v.parse(x,g,this),this[Gb]())}[(s=XS,o=Ld,r=Qs,Gb)](){this[XS]&&(this[Ld]?n.update(this[Ld],this[Qs]):this[Ld]=n.mount(this.container,e,this[Qs]))}}for(const m of i){const g=d[m],b=c[m];Object.defineProperty(h.prototype,m,{enumerable:!0,configurable:!0,get(){return this[Qs][m]},set(x){this[Qs][m]=x;const y=b?HD[b]:null;if(y!=null&&y.stringify){const w=y.stringify(x,g,this);this.getAttribute(g)!==w&&this.setAttribute(g,w)}else this[Gb]()}})}return h}function dwt(e,t,n){const r=Ohe.createRoot(e),o=S.createElement(t,n);return r.render(o),{root:r,ReactComponent:t}}function fwt({root:e,ReactComponent:t},n){const r=S.createElement(t,n);e.render(r)}function hwt({root:e}){e.unmount()}function mwt(e,t={}){return uwt(e,t,{mount:dwt,update:fwt,unmount:hwt})}const pwt={id:"string",version:"string",authToken:"json",placeholders:"json",defaultFilterValues:"json",defaultControlValues:"json",controlContractOverrides:"json",documentInputValues:"json",dashboardInputExecutionSnapshot:"json",renderMode:"string",currentTheme:"string",customCards:"json",customStyle:"json",appearance:"json",onChartElementClicked:"function",onFilterValuesChange:"function",onEvent:"function",onSave:"function",LoadingComponent:"function",ErrorComponent:"function",showAssistant:"boolean",showBriefings:"boolean",selectedSheetId:"string",eventHandlers:"json",preferences:"json"},gwt=mwt(che,{props:pwt}),bwt=S.memo(function({context:t="editor"}={}){return l.jsxs("div",{"data-content":"fields-section",className:"flex h-full grow flex-col items-center overflow-hidden",children:[" ",l.jsx(XL,{context:t})," "]})}),dhe=new Set(["askForMoreInfo","getAvailableChartTypes","getChartSQLSyntax","getDomainRelationships","getTableColumns","getUserSql","validateCardConfigFormat"]),xwt=new Set(["createChartFromSql","createForecast","generateQueryConfig","getChartDataFromCardConfig","getChartDataFromSqlAndPython","getForecastDataFromSqlAndPython"]),ywt=Array.from(dhe).join(", "),vwt=3,wwt="Self-heal",Swt=new Set(["SQL_PARSE_ERROR","SQL_EXPLAIN_ERROR"]);function Cwt({card:e}){var W,F,X,Y,R;const[t,n]=S.useState({}),{authToken:r}=bt(),o=p.getTokenParams(r==null?void 0:r.accessToken),{compiledAppearance:s}=p.useAppearance(),i=S.useMemo(()=>Tv(s),[s]),a=p.useEditorStore(K=>K.frame),c=p.useEditorStore(K=>K.inlineFilterValuesMap[e.id]),u=p.useEditorStore(K=>K.actions.setCardInlineFilterValue),d=p.useEditorStore(K=>K.actions.removeCardInlineFilterValue),f=e,{getCard:h,manifest:m}=Vh(((W=f.customCardPreferences)==null?void 0:W.url)||""),g=(F=m==null?void 0:m.visuals)==null?void 0:F.find(K=>{var O;return K.name===((O=f.customCardPreferences)==null?void 0:O.componentName)}),b=Iv(f,g)??"single",x=S.useMemo(()=>nL({frame:a,configCard:f,isMultiInputVisual:b==="multiple"}),[a,f,b]),y=S.useMemo(()=>{const K=x.findIndex(O=>(O==null?void 0:O.id)===e.id);return K<0?-1:Xy(e,K)},[x,e]),w=S.useMemo(()=>b!=="multiple"||y<0?e.type:Jm(e,y,g==null?void 0:g.slots)??e.type,[b,y,e,g==null?void 0:g.slots]),v=S.useMemo(()=>b==="multiple"?{...e,connectionId:void 0,dataSource:void 0,sql:"",python:"",config:void 0,queryConfig:void 0}:w!==e.type?{...e,type:w}:e,[e,w,b]),{data:C}=O_(v),N=p.useInteractionStore(K=>K.interactionStates),_=p.useDashboardStore(K=>{var O;return(O=K.dashboard)==null?void 0:O.id}),k=p.useDashboardStore(K=>K.dashboard.filters),j=p.useDashboardStore(K=>K.filterValues),I=p.useDashboardStore(K=>K.selectedSheetId),T=S.useMemo(()=>J5({card:e,sheetId:I||"",inlineFilterValues:c,setInlineFilterValue:K=>u(e.id,K),removeInlineFilterValue:K=>d(e.id,K)}),[e,I,c,u,d]),{cardFilters:E,cardFilterValues:D}=S.useMemo(()=>W0({card:e,interactionStates:N,currentDashboardId:_,filters:k,filterValues:j,selectedSheetId:I}),[e,N,_,k,j,I]),A=S.useCallback((K,O)=>{const U=oL(O);n(V=>({...V,[K]:U}))},[]),P=(X=f.customCardPreferences)==null?void 0:X.componentName,M=P?h(P):null,L=fN((Y=f.customCardPreferences)==null?void 0:Y.settings,f),$=S.useMemo(()=>tL(x),[x]),z=S.useMemo(()=>$.map((K,O)=>Jm(K,O,g==null?void 0:g.slots)),[$,g==null?void 0:g.slots]);return P?l.jsx("div",{className:"semaphor-custom mb-3 flex grow basis-0 flex-col space-y-2 overflow-y-auto",children:l.jsxs(S.Suspense,{fallback:l.jsx(l.Fragment,{}),children:[M&&b==="single"&&l.jsx(M,{editing:!0,params:o,theme:i,settings:L,cardMetadata:Wse({card:e,dataMetadata:C==null?void 0:C.metadata}),onDataChange:A,data:(C==null?void 0:C.records)||[],filters:E,filterValues:[...D||[],...c||[]],inlineFilters:T}),M&&b==="multiple"&&l.jsxs(l.Fragment,{children:[x.map((K,O)=>{if(!K)return null;const U=Xy(K,O),V=Jm(K,U,g==null?void 0:g.slots);return l.jsx(_5,{onDataChange:A,card:K,effectiveCardType:V},`${K.id}-${U}`)}),l.jsx("div",{className:"flex flex-col gap-2",children:l.jsx(M,{editing:!0,onDataChange:A,...sL({configCard:f,slotOrderedCards:$,slotTypes:z,multiInputData:t,params:o,theme:i,chartSettings:L,filters:E,filterValues:[...D||[],...c||[]],inlineFilters:T})})})]})]},(R=f.customCardPreferences)==null?void 0:R.componentName)}):null}const Nwt=S.memo(Cwt,(e,t)=>{var n,r,o,s,i,a,c,u;return e.card.id===t.card.id&&e.card.inlineFilters===t.card.inlineFilters&&((n=e.card.customCardPreferences)==null?void 0:n.settings)===((r=t.card.customCardPreferences)==null?void 0:r.settings)&&((o=e.card.customCardPreferences)==null?void 0:o.slotSettings)===((s=t.card.customCardPreferences)==null?void 0:s.slotSettings)&&((i=e.card.customCardPreferences)==null?void 0:i.url)===((a=t.card.customCardPreferences)==null?void 0:a.url)&&((c=e.card.customCardPreferences)==null?void 0:c.componentName)===((u=t.card.customCardPreferences)==null?void 0:u.componentName)}),_wt=p.create()(p.persist((e,t)=>({starredCharts:[],isStarred:(n,r)=>t().starredCharts.some(o=>o.type===n&&o.id===r),toggleStar:n=>{e(r=>{const o=r.starredCharts.findIndex(s=>s.type===n.type&&s.id===n.id);return o>=0?{starredCharts:r.starredCharts.filter((s,i)=>i!==o)}:{starredCharts:[...r.starredCharts,n]}})},getStarredChart:(n,r)=>t().starredCharts.find(o=>o.type===n&&o.id===r)}),{name:"semaphor-starred-charts"}));var fhe=["PageUp","PageDown"],hhe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],mhe={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Qg="Slider",[OR,kwt,jwt]=p.createCollection(Qg),[phe]=p.createContextScope(Qg,[jwt]),[Twt,Zj]=phe(Qg),ghe=Q.forwardRef((e,t)=>{const{name:n,min:r=0,max:o=100,step:s=1,orientation:i="horizontal",disabled:a=!1,minStepsBetweenThumbs:c=0,defaultValue:u=[r],value:d,onValueChange:f=()=>{},onValueCommit:h=()=>{},inverted:m=!1,form:g,...b}=e,x=Q.useRef(new Set),y=Q.useRef(0),v=i==="horizontal"?Iwt:Ewt,[C=[],N]=p.useControllableState({prop:d,defaultProp:u,onChange:E=>{var A;(A=[...x.current][y.current])==null||A.focus(),f(E)}}),_=Q.useRef(C);function k(E){const D=Pwt(C,E);T(E,D)}function j(E){T(E,y.current)}function I(){const E=_.current[y.current];C[y.current]!==E&&h(C)}function T(E,D,{commit:A}={commit:!1}){const P=$wt(s),M=zwt(Math.round((E-r)/s)*s+r,P),L=p.clamp(M,[r,o]);N(($=[])=>{const z=Awt($,L,D);if(Lwt(z,c*s)){y.current=z.indexOf(L);const W=String(z)!==String($);return W&&A&&h(z),W?z:$}else return $})}return l.jsx(Twt,{scope:e.__scopeSlider,name:n,disabled:a,min:r,max:o,valueIndexToChangeRef:y,thumbs:x.current,values:C,orientation:i,form:g,children:l.jsx(OR.Provider,{scope:e.__scopeSlider,children:l.jsx(OR.Slot,{scope:e.__scopeSlider,children:l.jsx(v,{"aria-disabled":a,"data-disabled":a?"":void 0,...b,ref:t,onPointerDown:p.composeEventHandlers(b.onPointerDown,()=>{a||(_.current=C)}),min:r,max:o,inverted:m,onSlideStart:a?void 0:k,onSlideMove:a?void 0:j,onSlideEnd:a?void 0:I,onHomeKeyDown:()=>!a&&T(r,0,{commit:!0}),onEndKeyDown:()=>!a&&T(o,C.length-1,{commit:!0}),onStepKeyDown:({event:E,direction:D})=>{if(!a){const M=fhe.includes(E.key)||E.shiftKey&&hhe.includes(E.key)?10:1,L=y.current,$=C[L],z=s*M*D;T($+z,L,{commit:!0})}}})})})})});ghe.displayName=Qg;var[bhe,xhe]=phe(Qg,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Iwt=Q.forwardRef((e,t)=>{const{min:n,max:r,dir:o,inverted:s,onSlideStart:i,onSlideMove:a,onSlideEnd:c,onStepKeyDown:u,...d}=e,[f,h]=Q.useState(null),m=p.useComposedRefs(t,v=>h(v)),g=Q.useRef(void 0),b=p.useDirection(o),x=b==="ltr",y=x&&!s||!x&&s;function w(v){const C=g.current||f.getBoundingClientRect(),N=[0,C.width],k=r$(N,y?[n,r]:[r,n]);return g.current=C,k(v-C.left)}return l.jsx(bhe,{scope:e.__scopeSlider,startEdge:y?"left":"right",endEdge:y?"right":"left",direction:y?1:-1,size:"width",children:l.jsx(yhe,{dir:b,"data-orientation":"horizontal",...d,ref:m,style:{...d.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:v=>{const C=w(v.clientX);i==null||i(C)},onSlideMove:v=>{const C=w(v.clientX);a==null||a(C)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:v=>{const N=mhe[y?"from-left":"from-right"].includes(v.key);u==null||u({event:v,direction:N?-1:1})}})})}),Ewt=Q.forwardRef((e,t)=>{const{min:n,max:r,inverted:o,onSlideStart:s,onSlideMove:i,onSlideEnd:a,onStepKeyDown:c,...u}=e,d=Q.useRef(null),f=p.useComposedRefs(t,d),h=Q.useRef(void 0),m=!o;function g(b){const x=h.current||d.current.getBoundingClientRect(),y=[0,x.height],v=r$(y,m?[r,n]:[n,r]);return h.current=x,v(b-x.top)}return l.jsx(bhe,{scope:e.__scopeSlider,startEdge:m?"bottom":"top",endEdge:m?"top":"bottom",size:"height",direction:m?1:-1,children:l.jsx(yhe,{"data-orientation":"vertical",...u,ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:b=>{const x=g(b.clientY);s==null||s(x)},onSlideMove:b=>{const x=g(b.clientY);i==null||i(x)},onSlideEnd:()=>{h.current=void 0,a==null||a()},onStepKeyDown:b=>{const y=mhe[m?"from-bottom":"from-top"].includes(b.key);c==null||c({event:b,direction:y?-1:1})}})})}),yhe=Q.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:o,onSlideEnd:s,onHomeKeyDown:i,onEndKeyDown:a,onStepKeyDown:c,...u}=e,d=Zj(Qg,n);return l.jsx(p.Primitive.span,{...u,ref:t,onKeyDown:p.composeEventHandlers(e.onKeyDown,f=>{f.key==="Home"?(i(f),f.preventDefault()):f.key==="End"?(a(f),f.preventDefault()):fhe.concat(hhe).includes(f.key)&&(c(f),f.preventDefault())}),onPointerDown:p.composeEventHandlers(e.onPointerDown,f=>{const h=f.target;h.setPointerCapture(f.pointerId),f.preventDefault(),d.thumbs.has(h)?h.focus():r(f)}),onPointerMove:p.composeEventHandlers(e.onPointerMove,f=>{f.target.hasPointerCapture(f.pointerId)&&o(f)}),onPointerUp:p.composeEventHandlers(e.onPointerUp,f=>{const h=f.target;h.hasPointerCapture(f.pointerId)&&(h.releasePointerCapture(f.pointerId),s(f))})})}),vhe="SliderTrack",whe=Q.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,o=Zj(vhe,n);return l.jsx(p.Primitive.span,{"data-disabled":o.disabled?"":void 0,"data-orientation":o.orientation,...r,ref:t})});whe.displayName=vhe;var LR="SliderRange",She=Q.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,o=Zj(LR,n),s=xhe(LR,n),i=Q.useRef(null),a=p.useComposedRefs(t,i),c=o.values.length,u=o.values.map(h=>_he(h,o.min,o.max)),d=c>1?Math.min(...u):0,f=100-Math.max(...u);return l.jsx(p.Primitive.span,{"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,...r,ref:a,style:{...e.style,[s.startEdge]:d+"%",[s.endEdge]:f+"%"}})});She.displayName=LR;var $R="SliderThumb",Che=Q.forwardRef((e,t)=>{const n=kwt(e.__scopeSlider),[r,o]=Q.useState(null),s=p.useComposedRefs(t,a=>o(a)),i=Q.useMemo(()=>r?n().findIndex(a=>a.ref.current===r):-1,[n,r]);return l.jsx(Dwt,{...e,ref:s,index:i})}),Dwt=Q.forwardRef((e,t)=>{const{__scopeSlider:n,index:r,name:o,...s}=e,i=Zj($R,n),a=xhe($R,n),[c,u]=Q.useState(null),d=p.useComposedRefs(t,w=>u(w)),f=c?i.form||!!c.closest("form"):!0,h=p.useSize(c),m=i.values[r],g=m===void 0?0:_he(m,i.min,i.max),b=Rwt(r,i.values.length),x=h==null?void 0:h[a.size],y=x?Fwt(x,g,a.direction):0;return Q.useEffect(()=>{if(c)return i.thumbs.add(c),()=>{i.thumbs.delete(c)}},[c,i.thumbs]),l.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[a.startEdge]:`calc(${g}% + ${y}px)`},children:[l.jsx(OR.ItemSlot,{scope:e.__scopeSlider,children:l.jsx(p.Primitive.span,{role:"slider","aria-label":e["aria-label"]||b,"aria-valuemin":i.min,"aria-valuenow":m,"aria-valuemax":i.max,"aria-orientation":i.orientation,"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,tabIndex:i.disabled?void 0:0,...s,ref:d,style:m===void 0?{display:"none"}:e.style,onFocus:p.composeEventHandlers(e.onFocus,()=>{i.valueIndexToChangeRef.current=r})})}),f&&l.jsx(Nhe,{name:o??(i.name?i.name+(i.values.length>1?"[]":""):void 0),form:i.form,value:m},r)]})});Che.displayName=$R;var Mwt="RadioBubbleInput",Nhe=Q.forwardRef(({__scopeSlider:e,value:t,...n},r)=>{const o=Q.useRef(null),s=p.useComposedRefs(o,r),i=p.usePrevious(t);return Q.useEffect(()=>{const a=o.current;if(!a)return;const c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&d){const f=new Event("input",{bubbles:!0});d.call(a,t),a.dispatchEvent(f)}},[i,t]),l.jsx(p.Primitive.input,{style:{display:"none"},...n,ref:s,defaultValue:t})});Nhe.displayName=Mwt;function Awt(e=[],t,n){const r=[...e];return r[n]=t,r.sort((o,s)=>o-s)}function _he(e,t,n){const s=100/(n-t)*(e-t);return p.clamp(s,[0,100])}function Rwt(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function Pwt(e,t){if(e.length===1)return 0;const n=e.map(o=>Math.abs(o-t)),r=Math.min(...n);return n.indexOf(r)}function Fwt(e,t,n){const r=e/2,s=r$([0,50],[0,r]);return(r-s(t)*n)*n}function Owt(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function Lwt(e,t){if(t>0){const n=Owt(e);return Math.min(...n)>=t}return!0}function r$(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function $wt(e){return(String(e).split(".")[1]||"").length}function zwt(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var khe=ghe,Bwt=whe,Vwt=She,Hwt=Che;const jhe=Q.forwardRef(({className:e,...t},n)=>l.jsxs(khe,{ref:n,className:p.cn("relative flex w-full touch-none select-none items-center",e),...t,children:[l.jsx(Bwt,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:l.jsx(Vwt,{className:"absolute h-full bg-primary"})}),l.jsx(Hwt,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));jhe.displayName=khe.displayName;const The=["SUN","MON","TUE","WED","THU","FRI","SAT"],Uwt=The.reduce((e,t,n)=>({...e,[t]:n}),{}),$l={repeats:"weekly",hour:9,minute:0,weekdays:[1,2,3,4,5],isCustom:!1};function qwt(e){if(!e||!e.trim())return{...$l};const t=e.trim(),r=(t.startsWith("cron(")&&t.endsWith(")")?t.slice(5,-1):t).trim().split(/\s+/);if(r.length<5||r.length>6)return{...$l,isCustom:!0};const[o,s,i,a,c]=r,u=Number(o),d=Number(s);if(!Number.isInteger(u)||u<0||u>59||!Number.isInteger(d)||d<0||d>23)return{...$l,isCustom:!0};if(i==="*"&&(c==="?"||c==="*"))return{...$l,repeats:"daily",hour:d,minute:u};if(i==="?"&&c!=="?"&&c!=="*"){const h=c.split(",").map(m=>m.toUpperCase()).map(m=>Uwt[m]).filter(m=>typeof m=="number");if(h.length>0)return{...$l,repeats:"weekly",hour:d,minute:u,weekdays:h}}return i==="1,15"&&(c==="?"||c==="*")?{...$l,repeats:"biweekly",hour:d,minute:u}:i==="1"&&(c==="?"||c==="*")?{...$l,repeats:"monthly",hour:d,minute:u}:{...$l,hour:d,minute:u,isCustom:!0}}function Wwt(e){const t=e.minute,n=e.hour;switch(e.repeats){case"daily":return`cron(${t} ${n} * * ? *)`;case"weekly":{const r=e.weekdays.length>0?e.weekdays.slice().sort((o,s)=>o-s).map(o=>The[o]).join(","):"MON";return`cron(${t} ${n} ? * ${r} *)`}case"biweekly":return`cron(${t} ${n} 1,15 * ? *)`;case"monthly":return`cron(${t} ${n} 1 * ? *)`}}function Ihe(e,t){const n=e<12?"AM":"PM",r=e%12===0?12:e%12,o=t.toString().padStart(2,"0");return`${r}:${o} ${n}`}function Gwt(e){return!e||e==="UTC"?"UTC":(e.split("/").pop()??e).replace(/_/g," ")}function Ywt(e){if(e.length===7)return"every day";const t=e.slice().sort((o,s)=>o-s);if(t.length===5&&t.every(o=>o>=1&&o<=5))return"weekdays";const r=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];return t.map(o=>r[o]).join(", ")}function Kwt(e,t,n,r){const o=Ihe(e.hour,e.minute),s=Gwt(t);let i;if(e.isCustom)i=`Custom schedule · ${o} ${s}`;else switch(e.repeats){case"daily":i=`Daily at ${o} ${s}`;break;case"weekly":i=`Weekly · ${Ywt(e.weekdays)} at ${o} ${s}`;break;case"biweekly":i=`Every two weeks (1st and 15th) at ${o} ${s}`;break;case"monthly":i=`Monthly on the 1st at ${o} ${s}`;break}const a=[];return n&&n!=="Today"&&a.push(`from ${n}`),r&&a.push(`until ${r}`),a.length>0?`${i}, ${a.join(" ")}`:i}const Zwt=["UTC","America/New_York","America/Chicago","America/Denver","America/Los_Angeles","Europe/London","Europe/Berlin","Asia/Singapore","Asia/Tokyo","Australia/Sydney"];exports.Accordion=HL;exports.AccordionContent=c0;exports.AccordionItem=a0;exports.AccordionTrigger=l0;exports.AddDataPicker=D3;exports.AggregateTable=Sk;exports.Alert=wF;exports.AlertDescription=SF;exports.AlertDialog=jh;exports.AlertDialogAction=ld;exports.AlertDialogCancel=cd;exports.AlertDialogContent=rd;exports.AlertDialogDescription=ad;exports.AlertDialogFooter=sd;exports.AlertDialogHeader=od;exports.AlertDialogTitle=id;exports.AlertDialogTrigger=lye;exports.AlertTitle=JZ;exports.ArrowDown=bo;exports.ArrowDownIcon=Yqe;exports.ArrowLeft=R0;exports.ArrowRight=t_;exports.ArrowUp=Ro;exports.ArrowUpIcon=Zqe;exports.AssistantContextEntityControls=SR;exports.AssistantVirtualizedMessages=the;exports.AtSign=Qq;exports.AxisConfigurator=lg;exports.Badge=co;exports.Bell=e1;exports.BookType=eW;exports.BulletChartIcon=Gfe;exports.COMMON_TIMEZONES=Zwt;exports.CSS=bi;exports.CalculatedFieldEditor=ole;exports.Calculator=nW;exports.Calendar=ii;exports.Calendar$1=j1;exports.CalendarRange=rW;exports.Card=cy;exports.CardContent=JR;exports.CardHeader=QR;exports.CardSummary=WA;exports.CardTitle=Jp;exports.ChartArea=h2;exports.ChartColumnIncreasing=oW;exports.ChartColumnStacked=sW;exports.ChartJsVisual=vv;exports.ChartLine=iW;exports.ChartNoAxesGantt=lW;exports.ChartPie=cW;exports.ChartScatter=uW;exports.ChatInputWithContext=M3;exports.Checkbox=Tn;exports.ChevronLeft=Ch;exports.ChevronsUpDown=hW;exports.Circle=eP;exports.CircleAlert=Wf;exports.CircleCheck=mW;exports.CircleHelp=pW;exports.Clock=tP;exports.CodeHighlighter=Hf;exports.CodeXml=t1;exports.Collapsible=Cc;exports.CollapsibleContent=_c;exports.CollapsibleTrigger=Nc;exports.ColorField=Ri;exports.Command=hj;exports.CommandEmpty=pj;exports.CommandGroup=gj;exports.CommandInput=DL;exports.CommandItem=bj;exports.CommandList=mj;exports.CommandSeparator=Nae;exports.ComparisonMetadataBadge=Nee;exports.Container=_P;exports.ControlDefaultValueEditor=kle;exports.ControlDefinitionOptionsEditor=_le;exports.ControlIdInput=wle;exports.ControlVisibilitySettings=att;exports.Copy=Du;exports.CopyButton=Iu;exports.CopyPlus=p2;exports.Cross2Icon=eWe;exports.CustomFilterPopover=X5;exports.CustomScrollArea=Ea;exports.DEFAULT_HEATMAP_CUSTOM_RANGE=kJ;exports.DEFAULT_SCHEDULE_VM=$l;exports.Dashboard=che;exports.DashboardCard=Eie;exports.DashboardCreateDialogBase=lY;exports.DashboardExportDialog=nhe;exports.DashboardPlus=ewt;exports.DashboardWC=gwt;exports.DataTableConditionalFormattingSettings=mce;exports.DataTablePagination=dk;exports.Database=Bi;exports.DateRangePicker=D5;exports.DefaultChatTransport=C3;exports.Dialog=ks;exports.DialogContent=ls;exports.DialogDescription=Gs;exports.DialogFooter=Ic;exports.DialogHeader=Xi;exports.DialogTitle=cs;exports.DialogTrigger=sY;exports.DisplayPreferencesProvider=nj;exports.DndContext=zv;exports.Donut=gW;exports.Download=jc;exports.DownloadPdf=rhe;exports.DragOverlay=uae;exports.DropdownMenu=Bo;exports.DropdownMenuCheckboxItem=Zc;exports.DropdownMenuContent=ko;exports.DropdownMenuItem=Sn;exports.DropdownMenuLabel=fa;exports.DropdownMenuRadioGroup=pbe;exports.DropdownMenuRadioItem=DG;exports.DropdownMenuSeparator=qi;exports.DropdownMenuSub=gP;exports.DropdownMenuSubContent=c_;exports.DropdownMenuSubTrigger=l_;exports.DropdownMenuTrigger=Vo;exports.EMPTY_DATA_SOURCE=Zp;exports.Editable=mN;exports.EditableText=Hs;exports.EditorCustomVisual=Nwt;exports.Ellipsis=ui;exports.EllipsisVertical=Nh;exports.ErrorBoundary=ka;exports.ExportError=pg;exports.ExternalLink=xp;exports.EyeOff=n_;exports.Fallback=ej;exports.FallbackVisual=Jy;exports.FeedbackCategory=td;exports.FeedbackDialog=S0;exports.FieldsList=XL;exports.FieldsSection=bwt;exports.FileCode=bW;exports.FileSpreadsheet=xW;exports.FileText=di;exports.Filter=Gf;exports.FilterComponent=Gk;exports.FilterInfo=VA;exports.FilterableFieldsPanel=ile;exports.Globe=_h;exports.Grid3x3=g2;exports.GripVertical=Tc;exports.HEATMAP_PRESET_PALETTES=CM;exports.Hash=yW;exports.House=vW;exports.HoverCard=gg;exports.HoverCardContent=Vu;exports.HoverCardTrigger=bg;exports.INLINE_ALLOWED_READ_ONLY_TOOLS=dhe;exports.INLINE_ALLOWED_TOOL_LIST=ywt;exports.INLINE_BLOCKED_MUTATING_TOOLS=xwt;exports.IconButton=uc;exports.IconForFieldType=R1;exports.InfoHover=yL;exports.InlineFilterBar=vie;exports.KPICard=Ku;exports.KeyboardSensor=Lv;exports.Layers=P0;exports.LayoutDashboard=Yf;exports.Link=nP;exports.LoadingDots=Uu;exports.Lock=r_;exports.MAX_SELF_HEAL_ATTEMPTS=vwt;exports.Map=CW;exports.Markdown=cfe;exports.MatrixTableVisual=wk;exports.MdStackedLineChart=qfe;exports.MultiInputEmptyRenderer=_5;exports.PYTHON_DEFAULT_CODE=BR;exports.PanelResizeHandle=Rj;exports.Paperclip=NW;exports.PenLine=b2;exports.Pencil=x2;exports.PendingMessagesDisplay=Nde;exports.PersistedDynamicVisual=tj;exports.PiChartPolar=Bfe;exports.Pin=kW;exports.PinOff=_W;exports.PivotTableTanstack=Og;exports.Placeholders=Bce;exports.Play=jW;exports.Plus=kr;exports.PointerSensor=Hg;exports.Progress=I3;exports.RECOVERABLE_SQL_ERROR_CODES=Swt;exports.Radar=TW;exports.RadioGroup=Ca;exports.RadioGroupItem=Co;exports.RefreshCw=Kf;exports.ResizableHandle=bst;exports.ResizablePanel=uR;exports.ResizablePanelGroup=zce;exports.ResourceEditDialog=$Y;exports.ResourceType=Zr;exports.SELF_HEAL_TIMELINE_STEP=wwt;exports.SeedQuestions=cde;exports.SemaphorContext=D0;exports.SemaphorContextProvider=YR;exports.SemaphorQueryClient=Wq;exports.SemaphorReadyIndicator=n$;exports.SemaphorStyleWrapper=Lg;exports.Send=IW;exports.Settings=rP;exports.Settings2=F0;exports.Share2=EW;exports.ShareDialog=LY;exports.Sheet=fee;exports.SheetContent=SO;exports.SheetDescription=NO;exports.SheetHeader=mee;exports.SheetTitle=CO;exports.SheetTrigger=lFe;exports.Slider=jhe;exports.SortableContext=Bv;exports.Sparkles=Z1;exports.Square=sP;exports.SquarePen=oP;exports.Star=DW;exports.StructuralParticipantSelector=Sle;exports.SummaryCard=$A;exports.TABLE_PRESENTATION_DEFAULT_STYLE=ju;exports.TABLE_PRESENTATION_DEFAULT_TOTALS_STYLE=Oi;exports.TableBody=Bu;exports.TableCell=An;exports.TableColumnVisibilitySettings=nce;exports.TableHead=to;exports.TableHeader=Lh;exports.TablePresentationSettings=oce;exports.TableRow=Sr;exports.TableSkeleton=vL;exports.TableVisual=Hu;exports.TbChartBubble=Vfe;exports.TbChartFunnel=Hfe;exports.TbChartTreemap=Ufe;exports.TextCard=Hp;exports.Textarea=Ih;exports.TiSortNumerically=Wfe;exports.Toggle=Qk;exports.Tornado=MW;exports.Trash2=hl;exports.TreePalm=aP;exports.TrendingUp=AW;exports.TriangleAlert=Vi;exports.TypeGlyph=Av;exports.UXProvider=t$;exports.User=RW;exports.Users=s_;exports.applyFilterOverridesToDashboardInputSlots=vZ;exports.areContextEntitiesEqual=Jn;exports.areEntitiesJoined=DJ;exports.arrayMove=Ug;exports.buildCardControlUsageById=ctt;exports.buildCustomCardTheme=Tv;exports.buildDashboardCardExecutionSnapshot=yZ;exports.buildDashboardControlUsageById=ltt;exports.buildDashboardExecutionSnapshot=pF;exports.buildDashboardInputExecutionSnapshot=wu;exports.buildDashboardSheetsInputExecutionSnapshot=SZ;exports.buildDashboardStructuralParticipantIdsByControlId=Ile;exports.buildFilterFieldMeta=OL;exports.buildFilterSemanticContext=LL;exports.buildInlineFilterNodes=J5;exports.buildMultiInputCustomVisualProps=sL;exports.buildScheduleExpr=Wwt;exports.buildSchedulePreview=Kwt;exports.buildSlotOrderedCards=tL;exports.calculateContextAwareFilters=W0;exports.calculateFieldState=hO;exports.canUserAccessVisuals=m0e;exports.canUserCreateDashboards=VY;exports.canUserEdit=d0e;exports.canUserManageDashboards=h0e;exports.canUserManageGroups=p0e;exports.canUserUseFilters=f0e;exports.cancelExport=XRe;exports.chartSupportsDataLabels=CQ;exports.chartSupportsLegend=wQ;exports.chartTypes=Kj;exports.cleanupKpiMetricComparisonMode=Mae;exports.cloneDeep=$s;exports.cloneLinkedFrameWithSourceMapping=fYe;exports.closestCenter=Ov;exports.commitSharedCalculatedFields=Gd;exports.createAssistantConversationId=Am;exports.createAssistantRequestId=ade;exports.createCardsFromSlots=jWe;exports.createChartConfig=mg;exports.createDashboardControlInputFromControl=oot;exports.createDefaultGlobalDateFilter=k1e;exports.createExport=XJ;exports.createUniqueDashboardInputVariableNameFromName=Eu;exports.dedup=fdt;exports.doesStoredFilterMatchField=Yp;exports.downloadDocumentPdf=bF;exports.downloadPdf=IZ;exports.extractSqlParamReferences=Aoe;exports.extractTableMetadata=FL;exports.fieldAlreadyExists=AJ;exports.findCustomVisualConfigCard=rL;exports.findDashboardFrameById=h1e;exports.flexRender=Bs;exports.formatDisplayFormula=tJe;exports.formatFileSize=ePe;exports.formatFilterLine=tX;exports.formatTimeLabel=Ihe;exports.getAutoDetectedChartIcon=T0t;exports.getChartGridStyle=e_e;exports.getChartIconByType=I0t;exports.getColorForValue=z2;exports.getConfigSlotExpectedType=kWe;exports.getCoreRowModel=lk;exports.getCustomVisualInputCards=nL;exports.getDateFormatOptionsForGranularity=s0;exports.getDefaultAxisConfig=V2;exports.getDefaultChartColors=Ph;exports.getDefaultDataLabelsConfig=rv;exports.getDefaultExportFormat=xX;exports.getDefaultFilterSql=F5;exports.getDefaultLegendConfig=ZF;exports.getDefaultRunningTotalPartitionByFieldIds=ey;exports.getDocumentSectionEditorCard=zet;exports.getDocumentSheetDashboardInputs=Wv;exports.getDownloadUrl=ZRe;exports.getEffectiveCardTypeForSlot=Jm;exports.getEntityIcon=qN;exports.getErrorMessage=Kue;exports.getExportStatus=KRe;exports.getExports=YRe;exports.getExpressionFieldKind=Xu;exports.getFieldExpressionAnnotation=$L;exports.getFilterCount=yN;exports.getGlobalDateFilter=Ah;exports.getGlobalDateFilterCoverage=yi;exports.getGranularityOptionsForFieldType=r3;exports.getKeys=cr;exports.getMatrixVisualLoadingState=vk;exports.getMetricDisplayLabel=gRe;exports.getNewField=LJ;exports.getObjectDiff=kq;exports.getPaginationRowModel=ck;exports.getRoleBasedDisplayOverrides=BY;exports.getRunningTotalOrderByCandidates=NQe;exports.getSelectedDateFilterColumn=Poe;exports.getSheetScopedFilterValues=py;exports.getSlotDefinitionForIndex=eL;exports.getSlotExpectedChartType=Zk;exports.getSlotIndexForCard=Xy;exports.getSortedRowModel=uee;exports.getSupportedExportFormats=bX;exports.getTableConditionalFormattingColumnOptions=lce;exports.getTableOutputColumnOptions=cce;exports.getTablePageSizeOptions=YJ;exports.handleAggregationChange=HA;exports.handleAggregationLabelChange=xie;exports.hasFlatTableTotalsBehavior=NCe;exports.hasMatrixResultData=av;exports.horizontalListSortingStrategy=jL;exports.isCalculatedFilterField=i0;exports.isCardSummaryVisibleOnCard=iL;exports.isCustomVisualConfigCard=OA;exports.isDefaultColor=ACe;exports.isEligibleFlatTableTotalsCard=rg;exports.isExportComplete=JRe;exports.isExportInProgress=QRe;exports.isInAiScopeArray=ddt;exports.isManagedCalculatedExpressionField=ya;exports.isMetricTransformEnabled=SQe;exports.isPromiseLike=wR;exports.isSubtotalEnabledAggregateTable=PL;exports.isSupportedDocumentTableCardType=Bet;exports.lastAssistantMessageIsCompleteWithToolCalls=que;exports.merge=fl;exports.mergeAxisConfig=H2;exports.normalizeConditionalFormatting=lF;exports.normalizeContextFormatMode=aX;exports.normalizeDashboardInputVariableName=A0;exports.normalizeMultiInputPayload=oL;exports.parseScheduleExpr=qwt;exports.pivotData=Z0;exports.prepareFeedbackData=Yj;exports.purify=bA;exports.reindexSlotCards=_We;exports.remarkGfm=Ofe;exports.removeFromScopeArray=hdt;exports.resolveDashboardInputContext=_l;exports.resolveDomainCalculatedFieldForEdit=ZJe;exports.resolveMultiInputType=Iv;exports.resolveMultiInputTypeFromVisual=TWe;exports.resolveTablePageSize=sk;exports.resolveTablePresentationStyle=MO;exports.sanitizeAIScope=Yue;exports.saveCalculatedFieldToCardScope=tR;exports.saveCalculatedFieldToSharedScope=sle;exports.saveCalculatedFieldToSheetScope=nR;exports.seedSemanticMetricFormatDefaults=Rae;exports.setTableColumnVisibility=eee;exports.setupEditorWithCard=L_;exports.showAllTableColumns=oPe;exports.showJoinRequiredNotification=MJ;exports.sortByColumnsToSortState=Ree;exports.sortStateToSortByColumns=Pee;exports.sortableKeyboardCoordinates=IL;exports.supportsMetricTransformForMetric=Aae;exports.supportsTableConditionalFormatting=sce;exports.toEntityArray=xa;exports.ue=rt;exports.useActiveExports=C0e;exports.useActiveToolStatus=kde;exports.useAddFrameWithFreshSemanticExecutionPayload=xL;exports.useAddNewFrame=zie;exports.useAssistantContainer=qY;exports.useAssistantContextEntities=oj;exports.useAssistantLayoutStore=kf;exports.useAssistantPanel=HY;exports.useAssistantProfile=lde;exports.useAutoSubmitQueue=_de;exports.useBrandStudioPreview=Bvt;exports.useCard=TRe;exports.useCardFilterValues=zJ;exports.useCardSummary=aL;exports.useChat=Gue;exports.useColumns=ML;exports.useCreateVisualWithFrame=dxe;exports.useCurrentUserInfo=Zi;exports.useCustomVisual=Vh;exports.useCustomVisualsQuery=Z5;exports.useDashboardAppearance=Mc;exports.useDashboardById=zG;exports.useDashboardPreferences=eg;exports.useDashboardQuery=M0;exports.useDashboardStructuralParticipants=Ele;exports.useDashboardSummary=tie;exports.useDataColumns=Fae;exports.useDateFilterHook=i7e;exports.useDebounce=Yx;exports.useDefaultDashboardMutation=AG;exports.useDisplayPreferences=Nl;exports.useDroppable=cae;exports.useEditorAside=xj;exports.useEditorCardQuery=O_;exports.useEnsureReactGlobals=loe;exports.useExportActions=WY;exports.useExportStore=b_;exports.useFieldManagement=Pae;exports.useFilterableFields=Iae;exports.useFullscreenAssistant=UY;exports.useGroupMembers=hye;exports.useGroups=EY;exports.useHasDashboardId=GY;exports.useInProgressExportsCount=N0e;exports.useJoinabilityMap=RL;exports.useManagementActions=Sh;exports.useManagementStore=$o;exports.useMutation=ss;exports.usePivotTableConfig=Oh;exports.usePluginQuery=Bse;exports.useQuery=Rn;exports.useQueryClient=Xr;exports.useReactTable=uk;exports.useResolveExistingFrameSemanticExecutionPayload=gYe;exports.useResourceManagement=xP;exports.useResourceUpdateState=BG;exports.useScopedFields=Tae;exports.useSelectedVisual=epe;exports.useSemaphorContext=bt;exports.useSensor=Gp;exports.useSensors=lj;exports.useSortable=qg;exports.useStarredChartsStore=_wt;exports.useSurfaceAppearance=Dc;exports.useTableQueryState=_ee;exports.useTextFilterHook=b7e;exports.useTheme=VR;exports.useTopoJson=sv;exports.useUnifiedUsers=CP;exports.useUpdateResource=FG;exports.useUpdateVisualMutation=fxe;exports.useUserPreferences=cY;exports.useVisualById=d_;exports.useVisualManagement=uxe;exports.validateFieldForChartType=Dae;exports.verticalListSortingStrategy=TL;
|
|
1346
|
+
`).trim(),j=_.map((I,T)=>{var A,P;let E="",D;if((A=I.url)!=null&&A.startsWith("data:")){const M=I.url.match(/data:[^;]+;base64,(.+)/);M&&(E=M[1],(P=I.mediaType)!=null&&P.startsWith("image/")&&(D=I.url))}return{id:`${e.id||t}-file-${T}`,name:I.filename||`File ${T+1}`,size:0,type:I.mediaType||"application/octet-stream",data:E,preview:D}});return l.jsx(tvt,{text:k||void 0,files:j.length>0?j:void 0})}const f=((v=e.parts)==null?void 0:v.filter(N=>N.type==="reasoning"))||[],h=f.length>0,m=f.some(N=>N.state==="streaming"),g=f.filter(N=>N.text&&N.text.trim().length>0),b=h&&(g.length>0||m)?l.jsxs(Cc,{className:"space-y-2",defaultOpen:!1,children:[l.jsx(Nc,{asChild:!0,children:l.jsxs("button",{type:"button",className:"group inline-flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground",children:[l.jsx(Pt.ChevronRight,{className:"h-3 w-3 transition-transform duration-200 group-data-[state=open]:rotate-90"}),l.jsx("span",{className:m?"animate-pulse":"",children:m?"Reasoning":"Show reasoning"}),g.length>1&&l.jsxs("span",{className:"font-mono tabular-nums text-muted-foreground/70",children:["(",g.length," steps)"]})]})}),l.jsx(_c,{children:l.jsx("ol",{className:"space-y-2 border-l border-border/60 pl-3",children:g.map((N,_)=>l.jsxs("li",{className:"relative",children:[l.jsx("span",{className:"absolute -left-[15px] top-[3px] grid h-4 w-4 place-items-center rounded-full bg-muted font-mono text-[9px] text-muted-foreground",children:_+1}),l.jsx(YU,{className:"text-[12px] leading-[1.55] text-muted-foreground",text:N.text})]},`${e.id||t}-reasoning-${_}`))})})]},`${e.id||t}-reasoning`):null,x=(C=e.parts)==null?void 0:C.map((N,_)=>{var j;const k=`${e.id||t}-${_}`;switch(N.type){case"text":{const I=typeof N.text=="string"?N.text:JSON.stringify(N.text??"",null,2);if(e.role==="assistant"){const{cleanedText:T,quickReplies:E}=X0t(I),D=T.trim().length>0;return l.jsxs("div",{className:"space-y-2.5",children:[D&&l.jsx(YU,{text:T,handleRun:i,onAddToDashboard:o,messageId:e.id,messages:n}),E.length>0&&a&&d&&l.jsxs("div",{className:"space-y-1.5",children:[E.length>=3&&l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Suggested next steps"}),l.jsx("div",{className:"flex flex-wrap gap-1",children:E.map(({label:A,value:P},M)=>l.jsxs(p.Tooltip,{children:[l.jsx(p.TooltipTrigger,{asChild:!0,children:l.jsx(p.Button,{size:"sm",variant:"outline",className:"h-6 max-w-[220px] rounded-control border-border/60 bg-background px-2 text-[11px] font-normal text-foreground/85 transition-colors hover:border-border hover:bg-muted/40 hover:text-foreground disabled:opacity-50",disabled:c,onClick:()=>a(P),children:l.jsx("span",{className:"truncate",children:A})})}),l.jsx(p.TooltipContent,{side:"top",align:"center",children:l.jsx("p",{className:"max-w-xs text-xs",children:P})})]},`${k}-qr-${M}`))})]})]},k)}return e.role==="system"&&s?l.jsx(nvt,{text:I},k):null}case"error":{const I=N,T=I.errorText??I.error??I.message;return l.jsx("div",{className:"my-4",children:l.jsx(e$,{errorMessage:T})},k)}case"reasoning":return null;default:return((j=N.type)!=null&&j.startsWith("tool-")||N.type==="dynamic-tool")&&J3(N,r)?l.jsx(ka,{FallbackComponent:({error:I,resetErrorBoundary:T})=>l.jsx(evt,{error:I,resetErrorBoundary:T}),children:l.jsx(W0t,{part:N,idx:k,messageId:e.id,showTools:r,onAddToDashboard:o,messages:n})},k):null}});return e.role==="assistant"?ehe(e,r)?l.jsxs(Jfe,{who:"Assistant",className:"space-y-2",children:[b,x]}):null:l.jsxs("div",{className:"space-y-2",children:[b,x]})}const ivt=8,avt=24,lvt=20;function cvt(e,t,n,r){return e==="error"&&t?!0:r?!1:!!(n||e==="submitted"||e==="streaming")}function the({messages:e,showTools:t=!1,showSystemMessage:n=!1,handleRun:r,onAddToDashboard:o,onQuickReply:s,disableQuickReplies:i=!1,status:a,errorMessage:c,activeToolText:u,className:d,rowContentClassName:f,statusClassName:h,latestButtonClassName:m,scrollToEndSignal:g=0}){const b=S.useRef(null),x=S.useRef(null),y=S.useRef(e.length),w=S.useRef(!1),v=S.useRef(null),C=S.useRef(!1),N=S.useRef(g),[_,k]=S.useState(!0),[j,I]=S.useState(0),[T,E]=S.useState(avt);N.current!==g&&(N.current=g,C.current=!0);const D=e[e.length-1],A=ehe(D,t),P=cvt(a,c,u,A),M=gk({count:e.length,getScrollElement:()=>b.current,estimateSize:W=>{const F=e[W];return(F==null?void 0:F.role)==="user"?88:180},getItemKey:W=>{const F=e[W];return(F==null?void 0:F.id)||`message-${W}`},anchorTo:"end",followOnAppend:!0,scrollEndThreshold:ivt,overscan:6,gap:20,paddingEnd:P?T+lvt:0,useAnimationFrameWithResizeObserver:!0,onChange:W=>{const F=W.isAtEnd();k(X=>X===F?X:F),F&&I(0)}}),L=S.useCallback((W="smooth")=>{v.current!==null&&cancelAnimationFrame(v.current),v.current=requestAnimationFrame(()=>{v.current=null,M.scrollToEnd({behavior:W})}),I(0),k(!0)},[M]);S.useLayoutEffect(()=>{w.current||(w.current=!0,L("auto"))},[L]),S.useLayoutEffect(()=>{C.current&&(C.current=!1,L("auto"))},[e.length,g,L]),S.useEffect(()=>{const W=y.current;y.current=e.length,e.length>W&&!M.isAtEnd()&&I(F=>F+e.length-W),e.length===0&&(I(0),k(!0),w.current=!1,C.current=!1)},[e.length,M]);const $=M.getVirtualItems(),z=M.getTotalSize();return S.useEffect(()=>()=>{v.current!==null&&cancelAnimationFrame(v.current)},[]),S.useLayoutEffect(()=>{const W=x.current;if(!W||!P)return;const F=()=>{const Y=Math.ceil(W.getBoundingClientRect().height);Y>0&&E(R=>R===Y?R:Y)};if(F(),typeof ResizeObserver>"u")return;const X=new ResizeObserver(F);return X.observe(W),()=>X.disconnect()},[P,a,c,u]),l.jsxs(l.Fragment,{children:[l.jsx(Ea,{"data-role":"assistant-virtualized-scroll-area",ref:b,className:p.cn("min-h-0 min-w-0 flex-1 basis-0",d),children:l.jsxs("div",{className:"relative w-full",style:{height:z},children:[$.map(W=>{const F=e[W.index];return F?l.jsx("div",{ref:M.measureElement,"data-index":W.index,className:"absolute left-0 top-0 w-full",style:{transform:`translateY(${W.start}px)`},children:l.jsx("div",{className:p.cn("min-w-0",f),children:l.jsx(svt,{message:F,messageIndex:W.index,messages:e,showTools:t,showSystemMessage:n,handleRun:r,onAddToDashboard:o,onQuickReply:s,disableQuickReplies:i})})},W.key):null}),P&&l.jsx("div",{ref:x,className:p.cn("absolute left-0 top-0 w-full",h),style:{transform:`translateY(${Math.max(z-T,0)}px)`},children:l.jsx("div",{className:p.cn("min-w-0",f),children:l.jsx(rvt,{status:a,errorMessage:c,activeToolText:u})})})]})}),!_&&l.jsxs("button",{type:"button",onClick:()=>L("smooth"),"aria-label":"Scroll to latest",className:p.cn("absolute right-4 z-10 inline-flex h-7 items-center gap-1.5 rounded-full border border-border bg-background px-2.5 text-[11px] text-foreground shadow-[0_1px_2px_rgba(0,0,0,0.08)] transition-colors hover:bg-muted/40",m),children:[l.jsx(bo,{className:"h-3 w-3"}),"Latest",j>0&&l.jsx("span",{className:"grid h-4 min-w-[16px] place-items-center rounded-full bg-foreground px-1 font-mono text-[9px] tabular-nums text-background",children:j>9?"9+":j})]})]})}function uvt(e){if(typeof e=="string")return e;if(!e||typeof e!="object")return"";const t=e;return(typeof t.userSql=="string"?t.userSql:"")||(typeof t.sourceSql=="string"?t.sourceSql:"")||(typeof t.sql=="string"?t.sql:"")}const dvt=[{title:"Show top 3 insights",subtitle:"from this dataset"},{title:"Create a bar chart for",subtitle:"sales by product category"}];function fvt({open:e,setOpen:t,isFullscreen:n,onFullscreenChange:r,fullscreenContainer:o}){const[s,i]=S.useState(!1),[a,c]=S.useState(p.isDevEnv),[u,d]=S.useState(!1),[f,h]=S.useState("auto"),[m,g]=S.useState(!1),[b,x]=S.useState(!1),[y,w]=S.useState(0),v=n??b,{isLocalDev:C,isConsoleMode:N}=eg(),_=C||N||a,k=S.useRef(null);p.useDashboardStore(ae=>ae.dashboard.aiScopeTables),p.useDashboardStore(ae=>ae.isDashboardEditing);const j=p.useDashboardStore(ae=>ae.selectedSheetId),{setDataSource:I}=p.useEditorActions(),{setSelectedFrameId:T,setIsDashboardEditing:E}=p.useDashboardActions(),D=xL(),{clearAssistantMessageContexts:A}=p.useAIActions(),{clearQueue:P}=p.useQueueActions(),{clearFileAttachments:M,getFileAttachments:L}=p.useFileActions(),$=p.useFileAttachments("dashboard"),z=p.useEditorStore(ae=>ae.card.dataSource),{assistantProfile:W}=lde(),F=p.useDashboardStore(ae=>ae.handleOpenAssistantProfile),{selectedEntities:X,applyDashboardDefaultEntities:Y}=oj("dashboard"),{sendMessage:R,isLoading:K,messages:O,setMessages:U,status:V,stop:H,errorMessage:q,clearError:B}=Mdt({dynamicVisualMode:f}),G=S.useCallback(()=>{w(ae=>ae+1)},[]),Z=S.useCallback(ae=>{r==null||r(ae),n===void 0&&x(ae)},[n,r]),J=S.useCallback(()=>{Z(!v)},[v,Z]);S.useEffect(()=>{if(!v)return;function ae(Ne){Ne.key==="Escape"&&Z(!1)}return window.addEventListener("keydown",ae),()=>{window.removeEventListener("keydown",ae)}},[v,Z]);const[oe,ie]=S.useState(""),ue=ae=>{ie(ae.target.value)};async function xe({sql:ae,cardTitle:Ne,connectionId:Ee,cardType:Ve,python:ge,cardConfig:pe,dataSource:ze,customVisualPreferences:Le,visualizationMode:Be,dynamicCardPreferences:Ke}){if(!j)return;const Je=Be==="dynamic",Ce=p.hasValidCardConfig(pe),Qe=Ee||(ze==null?void 0:ze.connectionId)||"",He=ze?{...ze,connectionId:Qe||ze.connectionId,connectionType:ze.connectionType||"",mode:ze.mode||"database",selectedEntities:ze.selectedEntities||[]}:Qe?{connectionId:Qe,connectionType:"",mode:"database",selectedEntities:[]}:Zp,Me=!(Ce&&(!Je||(Ke==null?void 0:Ke.provenance)==="card-config"||(Ke==null?void 0:Ke.provenance)==="query_spec")),De=Me?uvt(ae):"",je=Me?ge:"",Ue={id:p.v4(),title:Ne||"Title",preferences:{onClickFilter:[{columnIndex:0,expression:""}],chartOptions:{indexAxis:Ve==="horizontalBar"?"y":"x"},...Je&&{displayOptions:{showChrome:!1,allowScroll:!1}}},type:Ve,sql:De,python:je,dataSource:He,config:pe,connectionId:Qe,visualizationMode:Be,dynamicCardPreferences:Ke,customCardPreferences:Le?{url:Le.url,componentName:Le.componentName,pluginChartType:Le.pluginChartType,settings:Le.settings,type:"component"}:void 0},mt={id:p.v4(),cards:[Ue],activeCardId:Ue.id};try{await D(j,mt,"end"),E(!0),T(mt.id)}catch(pt){console.error("Failed to add assistant visual to dashboard:",pt),rt.error(pt instanceof Error?pt.message:"Failed to prepare semantic metadata for the new visual")}}const te=ae=>{ae.preventDefault();const Ne=oe.trim();if(!Ne&&$.length===0)return;const Ee=[];Ne&&Ee.push({type:"text",text:Ne}),$.forEach(Ve=>{Ve.data&&Ee.push({type:"file",mediaType:Ve.type,filename:Ve.name,url:`data:${Ve.type};base64,${Ve.data}`})}),R({role:"user",parts:Ee}),ie(""),M("dashboard"),G()};S.useEffect(()=>{var ae;e&&((ae=k.current)==null||ae.focus())},[e]),_de({assistantType:"dashboard",status:V,isLoading:K,sendMessage:R});const{hasActiveTools:ye,activeToolText:se}=kde(O);function Ie(ae){const Ne={role:"user",parts:[{type:"text",text:ae.title+" "+ae.subtitle}]};R(Ne),G()}function fe(ae){R({role:"user",parts:[{type:"text",text:ae}]}),G()}function me(ae){R({role:"user",parts:[{type:"text",text:ae}]}),G()}const we=S.useCallback(async()=>{const ae=JSON.stringify(O??[],null,2);try{if(typeof navigator>"u"||!navigator.clipboard)throw new Error("Clipboard API unavailable");await navigator.clipboard.writeText(ae),rt.success("Conversation copied")}catch(Ne){console.error("Failed to copy conversation",Ne),rt.error("Unable to copy conversation")}},[O]),ee=(oe==null?void 0:oe.length)===0&&(O==null?void 0:O.filter(ae=>ae.role==="user").length)===0;function re(){return l.jsx("div",{"data-role":"header",className:"flex items-center gap-2",children:l.jsx("span",{className:"text-[13px] font-medium text-foreground",children:"Assistant"})})}function ne(){return l.jsxs(Bo,{children:[l.jsx(Vo,{asChild:!0,children:l.jsx(uc,{className:"h-7 p-2 text-muted-foreground hover:text-foreground",children:l.jsx(Nh,{className:"size-3.5"})})}),l.jsxs(ko,{align:"end",children:[l.jsx(fa,{children:"Options"}),l.jsx(qi,{}),l.jsx(Zc,{checked:s,onCheckedChange:i,children:"Token Usage"}),l.jsx(Zc,{checked:a,onCheckedChange:c,children:"Tool Invocations"}),l.jsx(Zc,{checked:u,onCheckedChange:d,children:"System Message"}),(C||N)&&l.jsxs(l.Fragment,{children:[l.jsx(qi,{}),l.jsx(fa,{children:"Dynamic Visuals"}),l.jsx(Zc,{checked:f==="auto",onCheckedChange:()=>h("auto"),children:"Auto"}),l.jsx(Zc,{checked:f==="force",onCheckedChange:()=>h("force"),children:"Force Dynamic"}),l.jsx(Zc,{checked:f==="off",onCheckedChange:()=>h("off"),children:"Disable Dynamic"})]})]})]})}const le=l.jsxs("div",{"data-role":"dashboard-assistant",className:p.cn("relative flex h-full grow flex-col break-words bg-background",v&&"rounded-card border border-border/60 shadow-xl"),children:[l.jsxs("header",{"data-role":"header-section",className:"flex h-10 shrink-0 items-center gap-2 border-b border-border/60 px-3",children:[re(),F&&l.jsxs("button",{type:"button",onClick:F,className:"inline-flex h-6 items-center gap-1 rounded-[4px] border border-border/60 bg-muted/40 px-1.5 text-[11px] text-muted-foreground transition-colors hover:border-border hover:text-foreground",title:"Edit assistant profile",children:[l.jsx("span",{className:"h-1 w-1 rounded-full bg-muted-foreground/60"}),l.jsx("span",{className:"max-w-[180px] truncate",children:(W==null?void 0:W.name)||"Default profile"})]}),l.jsxs("div",{"data-role":"header-actions",className:"ml-auto flex items-center gap-0.5",children:[N&&ne(),_&&l.jsx(p.Button,{variant:"ghost",size:"sm",className:"h-6 px-1.5 text-[11px] text-muted-foreground hover:text-foreground",onClick:we,children:"Copy Conversation"}),l.jsx(uc,{className:"grid h-6 w-6 place-items-center rounded-[4px] p-0 text-muted-foreground hover:bg-muted hover:text-foreground",tooltip:v?"Exit fullscreen":"Expand",onClick:J,children:v?l.jsx(Pt.Minimize2,{className:"h-3.5 w-3.5"}):l.jsx(Pt.Maximize2,{className:"h-3.5 w-3.5"})}),l.jsx(uc,{className:"grid h-6 w-6 place-items-center rounded-[4px] p-0 text-muted-foreground hover:bg-muted hover:text-foreground",tooltip:"New chat",onClick:()=>{const ae=O.filter(Ne=>Ne.role==="assistant").map(Ne=>Ne.id).filter(Ne=>!!Ne);U([]),P("dashboard"),B(),A(ae)},children:l.jsx(oP,{className:"h-3.5 w-3.5"})}),l.jsx(uc,{className:"grid h-6 w-6 place-items-center rounded-[4px] p-0 text-muted-foreground hover:bg-muted hover:text-foreground",tooltip:"Close",onClick:()=>{t(!1)},children:l.jsx(Te.X,{className:"h-3.5 w-3.5"})})]})]}),l.jsx(the,{messages:O,showTools:a,showSystemMessage:u,onAddToDashboard:xe,onQuickReply:me,disableQuickReplies:K,status:V,errorMessage:q,activeToolText:K&&ye?se:void 0,className:p.cn(v?"px-6 py-5":"px-3 py-3"),rowContentClassName:p.cn(v&&"mx-auto w-full max-w-[680px]"),latestButtonClassName:e?"bottom-[148px]":"hidden",scrollToEndSignal:y}),l.jsxs("div",{className:"shrink-0 space-y-2 border-t border-border/60 px-3 pb-3 pt-2",children:[!W&&ee&&l.jsx(Bce,{onClick:Ie,placeholders:dvt}),ee&&W&&l.jsx(cde,{seedQuestions:W.seedQuestions||[],handleSeedQuestionClick:fe}),l.jsx(Nde,{assistantType:"dashboard"}),l.jsx(M3,{ref:k,setInput:ie,stop:H,input:oe,handleInputChange:ue,handleSubmit:ae=>{te(ae)},isLoading:K,status:V,assistantType:"dashboard",onFocus:()=>{}})]}),l.jsx(D3,{incomingSelectedEntities:X,open:m,onOpenChange:g,dataSource:z||Zp,dialogMode:"aiContext",saveAsDashboardDefault:!0,onSaveSelectedEntities:ae=>Y()})]});return v&&o?br.createPortal(l.jsx(Lg,{className:"pointer-events-auto absolute inset-0 z-50 flex bg-background/95 px-4 pb-4 pt-[calc(var(--app-header-height,15px)+0.5rem)] backdrop-blur-sm",children:l.jsx("div",{className:"flex h-full w-full",children:le})}),o):le}function hvt(e){const t=e.current,{getSelectedFrame:n,setSelectedFrameId:r}=p.useDashboardActions(),o=gie(),s=p.useDashboardStore(d=>d.dashboard.sheets),a=p.useDashboardStore(d=>d.selectedSheetId)??(s==null?void 0:s[0].id),c=p.useDashboardStore(d=>d.isDashboardEditing),u=p.useDashboardStore(d=>d.isVisualEditing);S.useEffect(()=>{if(!c||u)return;async function d(m){if(mvt(m.target))return;const g=m.ctrlKey||m.metaKey;g&&m.key==="c"?(await f(),rt.success("Card copied to clipboard"),m.preventDefault()):g&&m.key==="v"&&(await h(),m.preventDefault())}async function f(){try{const m=n();m&&await navigator.clipboard.writeText(JSON.stringify(m))}catch(m){console.error("Failed to copy text:",m)}}async function h(){if(!a)return null;try{const m=await navigator.clipboard.readText(),g=pvt(m);if(g!=null&&g.id){const b=hie(g),x=b.cards.findIndex(y=>y.id===b.activeCardId);x!==-1&&(b.cards[x].title=`${b.cards[x].title} (Copy)`),await o(a,b),r(b.id),rt.success("Card pasted from clipboard")}return m}catch(m){return console.error("Failed to paste text:",m),null}}return t==null||t.addEventListener("keydown",d),()=>t==null?void 0:t.removeEventListener("keydown",d)},[o,n,r,a,c,u,t])}function mvt(e){if(!(e instanceof HTMLElement))return!1;if(e.isContentEditable)return!0;const t=e.closest("[contenteditable]");return t&&t.getAttribute("contenteditable")!=="false"?!0:!!e.closest('input, textarea, select, [role="textbox"]')}function pvt(e){try{const t=JSON.parse(e);return t&&typeof t=="object"&&typeof t.id=="string"&&Array.isArray(t.cards)?t:null}catch{return null}}function gvt(e,t){switch(e.interactionMode){case"drillToDetail":bvt(e,t);break;case"drillThrough":xvt(e,t);break;case"drillToURL":yvt(e);break;case"inlineDrill":console.warn("Inline drill execution not yet implemented");break;case"clickFilter":case"drillDown":case"dynamicDrill":break;default:console.warn("Unknown interaction mode:",e.interactionMode)}}function bvt(e,t){var c;const{targetInsightId:n,contextMode:r,displayMode:o,filterGroups:s}=e;if(!n){console.warn("drillToDetail event missing targetInsightId");return}const i=r||"full";let a=[];switch(i){case"interactionFilters":a=s.flatMap(u=>u.filters);break;case"full":{const u=((c=t.getCurrentFilters)==null?void 0:c.call(t))||[],d=s.flatMap(f=>f.filters);a=[...u,...d];break}case"none":default:a=[];break}o==="replace-card"?t.replaceCardContent({cardId:e.sourceCardId,insightId:n,filters:a,contextMode:r}):t.openInsightModal({insightId:n,filters:a,contextMode:r})}function xvt(e,t){var u,d;const{targetDashboardId:n,contextMode:r="interactionFilters",filterGroups:o,sourceCardId:s}=e;if(!n){console.warn("[DrillThrough] Event missing targetDashboardId. This interaction needs to be reconfigured with a target dashboard.",e);return}const i=o.flatMap(f=>f.filters),a=((u=t.getCurrentDashboardId)==null?void 0:u.call(t))||"",c=(d=t.getCurrentDashboardTitle)==null?void 0:d.call(t);t.setGlobalDrillContext&&t.setGlobalDrillContext({filters:i,contextMode:r,sourceDashboardId:a,sourceDashboardTitle:c,targetDashboardId:n}),t.setPendingDrillThrough&&t.setPendingDrillThrough({targetDashboardId:n,sourceDashboardId:a,sourceDashboardTitle:c,filters:i,contextMode:r})}function yvt(e){const{url:t}=e;if(!t){console.warn("drillToURL event missing url");return}try{new URL(t)}catch(n){console.error("Invalid URL:",t,n);return}window.open(t,"_blank","noopener,noreferrer")}function vvt({open:e,onOpenChange:t,insightId:n,filters:r,filterDefinitions:o,contextMode:s,cardTitle:i,cardDescription:a}){return l.jsx(ks,{open:e,onOpenChange:t,children:l.jsxs(ls,{className:"max-h-[90vh] max-w-[90vw] p-6",children:[l.jsxs(Xi,{children:[l.jsx(cs,{children:i||"Insight Detail"}),l.jsx(Gs,{children:a||"View detailed insight data with applied filters"})]}),l.jsx(yie,{filters:r,filterDefinitions:o,contextMode:s}),l.jsx("div",{className:"h-[400px] flex-1 overflow-auto",children:n?l.jsx(Aie,{insightId:n,filters:r,contextMode:s}):l.jsx("div",{className:"flex items-center justify-center p-12 text-muted-foreground",children:"No insight selected"})})]})})}function wvt(){const e=p.useInteractionStore(C=>C.interactionStates),t=p.useInteractionStore(C=>C.setInteractionState),n=p.useInteractionStore(C=>C.clearLastInteractionEvent),r=p.useInteractionStore(C=>C.replaceCardWithInsight),o=p.useInteractionStore(C=>C.setPendingDrillThrough),s=p.useInteractionStore(C=>C.pendingDrillThrough),i=p.useInteractionStore(C=>C.clearPendingDrillThrough),{setSelectedSheetId:a,navigateWithDrill:c}=p.useDashboardActions(),{selectDashboard:u}=Sh(),d=p.useDashboardStore(C=>C.dashboard),f=p.useDashboardStore(C=>C.filterValues),{data:h,isLoading:m}=zG((s==null?void 0:s.targetDashboardId)||"",{enabled:!!(s!=null&&s.targetDashboardId)}),[g,b]=S.useState({open:!1,insightId:""}),x=Rie(g.insightId,{enabled:g.open&&!!g.insightId}),y=S.useRef(new Set),w=S.useMemo(()=>({setSelectedSheetId:a,openInsightModal:({insightId:C,filters:N,contextMode:_})=>{b({open:!0,insightId:C,filters:N,filterDefinitions:(d==null?void 0:d.filters)||[],contextMode:_})},replaceCardContent:({cardId:C,insightId:N,filters:_,contextMode:k})=>{r(C,N,_,k)},getCurrentFilters:()=>f||[],navigateWithDrill:c,getCurrentDashboardId:()=>(d==null?void 0:d.id)||"",getCurrentDashboardTitle:()=>d==null?void 0:d.title,setPendingDrillThrough:o,setGlobalDrillContext:({filters:C,contextMode:N,sourceDashboardId:_,sourceDashboardTitle:k,targetDashboardId:j})=>{const I={filters:C},T={sourceCardId:p.DRILL_CONTEXT_CARD_ID,interactionMode:"clickFilter",filterGroups:[I]},E={...p.createInitialInteractionState(),appliedClickFilters:[T],contextMode:N,sourceDashboardId:_,sourceDashboardTitle:k,targetDashboardId:j};t(p.DRILL_CONTEXT_CARD_ID,E)}}),[a,r,f,c,d,o,t]);S.useEffect(()=>{Object.entries(e).forEach(([C,N])=>{if(N!=null&&N.lastInteractionEvent){const _=N.lastInteractionEvent,k=`${C}-${_.interactionMode}-${_.sourceCardId}-${Date.now()}`;if(y.current.has(k))return;y.current.add(k);try{gvt(_,w)}catch(j){console.error("Error executing interaction event:",j)}finally{n(C),setTimeout(()=>{y.current.delete(k)},5e3)}}})},[e,n,w]),S.useEffect(()=>{if(!(!s||!h||m))try{u(h),c(s.targetDashboardId,s.sourceDashboardId,s.sourceDashboardTitle,s.filters,s.contextMode),i()}catch(C){console.error("[DrillThrough] Error during automatic navigation:",C),i()}},[s,h,m,u,c,i]);const v=()=>{b({open:!1,insightId:""})};return l.jsxs(l.Fragment,{children:[l.jsx(vvt,{open:g.open,onOpenChange:v,insightId:g.insightId,filters:g.filters,filterDefinitions:g.filterDefinitions,contextMode:g.contextMode,cardTitle:x.title,cardDescription:x.description}),s&&m&&l.jsx("div",{className:"fixed inset-0 z-[51] flex items-center justify-center bg-background/80 backdrop-blur-sm",children:l.jsxs("div",{className:"flex flex-col items-center gap-2.5 rounded-[6px] border border-border/60 bg-background px-4 py-3 shadow-sm",children:[l.jsx(p.LoaderCircle,{className:"h-5 w-5 animate-spin text-muted-foreground/60"}),l.jsx("div",{className:"text-[12px] text-muted-foreground",children:"Loading dashboard..."})]})})]})}function Svt(e){return e.length===0?"":e.map(t=>{const n=t.field.label||t.field.name,r=t.operator,o=Cvt(t.value);return r==="="?`${n} = ${o}`:`${n} ${r} ${o}`}).join(", ")}function Cvt(e){return e==null?"null":Array.isArray(e)?e.join(", "):typeof e=="object"&&e.toString?e.toString():String(e)}function Nvt(e){return e?`Back to ${e}`:"Back"}function _vt(){var y,w,v,C,N;const e=p.useInteractionStore(_=>_.interactionStates[p.DRILL_CONTEXT_CARD_ID]),t=p.useDashboardStore(_=>_.actions.goBackFromDrill),n=p.useDashboardStore(_=>_.actions.clearDrillContext),{selectDashboard:r}=Sh(),[o,s]=S.useState({x:16,y:16}),[i,a]=S.useState(!1),c=S.useRef({x:0,y:0});S.useEffect(()=>{if(!i)return;const _=j=>{s({x:j.clientX-c.current.x,y:j.clientY-c.current.y})},k=()=>{a(!1)};return document.addEventListener("mousemove",_),document.addEventListener("mouseup",k),()=>{document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",k)}},[i]);const u=e==null?void 0:e.sourceDashboardId,d=e==null?void 0:e.sourceDashboardTitle,f=((C=(v=(w=(y=e==null?void 0:e.appliedClickFilters)==null?void 0:y[0])==null?void 0:w.filterGroups)==null?void 0:v[0])==null?void 0:C.filters)||[],h=u?{id:u,title:d||"Previous Dashboard",description:"",isPrivate:!1,isPublic:!1,version:"",createdBy:null,createdByTenantUser:"",tenantId:"",projectId:"",createdAt:"",updatedAt:"",lastModified:"",lastModifiedBy:"",createdByUser:null,createdByTenantUserRel:{name:"",email:""},permissions:{canEdit:!0,canShare:!0,canDelete:!0},ownership:{status:"private",isOwner:!0,sharedCount:0,createdBy:{type:"user",userId:"",name:"",email:""}}}:null;if(!e||!((N=e.appliedClickFilters)!=null&&N.length))return null;const m=()=>{if(!h){console.warn("[DrillBack] No source dashboard in context");return}try{t(),r(h)}catch(_){console.error("[DrillBack] Error during back navigation:",_)}},g=()=>{n()},b=_=>{_.target.closest("button")||(a(!0),c.current={x:_.clientX-o.x,y:_.clientY-o.y})};Svt(f);const x=Nvt(d);return l.jsx("div",{className:"fixed z-50 max-w-md",style:{left:0,top:0,transform:`translate(${o.x}px, ${o.y}px)`,transition:i?"none":void 0},children:l.jsxs("div",{className:"select-none rounded-lg border bg-background/95 p-3 shadow-lg backdrop-blur-sm",onMouseDown:b,style:{cursor:i?"grabbing":"grab"},children:[l.jsxs("div",{className:"mb-3 flex items-start justify-between gap-2",children:[l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Viewing:"}),l.jsx("div",{className:"flex flex-wrap gap-2",children:f.map((_,k)=>{const j=_.field.label||_.field.name,I=String(_.value);return l.jsxs(co,{variant:"secondary",className:"pointer-events-none text-xs",children:[j," = ",I]},k)})})]}),l.jsx(p.Button,{variant:"ghost",size:"sm",onClick:g,className:"h-6 w-6 cursor-pointer p-0",title:"Clear drill context",children:l.jsx(Te.X,{className:"h-3 w-3"})})]}),l.jsx("div",{className:"flex items-center gap-2 border-t pt-2",children:l.jsxs(p.Button,{variant:"secondary",size:"sm",onClick:m,disabled:!h,className:"w-full cursor-pointer",children:[l.jsx(R0,{className:"mr-2 h-4 w-4"}),x]})})]})})}function kvt(e,t){return typeof e=="boolean"?e:typeof t=="boolean"?t:!1}function jvt({filter:e,isEditing:t=!1,disabled:n=!1,storageOptions:r,settingsVariant:o,filterQueryContext:s,inputVariableName:i,reservedInputVariableNames:a,onUpdateFilter:c,onRemoveFilter:u}){const{attributes:d,listeners:f,setNodeRef:h,transform:m,transition:g,isDragging:b}=qg({id:`filter:${e.id}`,disabled:n||!t}),x={transform:bi.Translate.toString(m),transition:g,opacity:b?.5:1,zIndex:b?10:void 0};return l.jsx("div",{ref:h,style:x,...d,children:l.jsx(Q5,{filter:e,isEditing:t,dragListeners:t?f:void 0,storageOptions:r,settingsVariant:o,filterQueryContext:s,inputVariableName:i,reservedInputVariableNames:a,onUpdateFilter:c,onRemoveFilter:u})})}const rq="text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",Tvt=[];function nhe({open:e,onOpenChange:t}){var O,U,V;const[n,r]=S.useState(!1),[o,s]=S.useState(!1),[i,a]=S.useState({sheetSelection:"current",protectPdf:!1,password:""}),c=p.useDashboardStore(H=>{var q;return(q=H.dashboard)==null?void 0:q.sheets}),u=p.useDashboardStore(H=>H.dashboard),d=p.useDashboardStore(H=>H.dashboardInputValues),f=p.useDashboardStore(H=>H.filterValues),h=p.useDashboardStore(H=>H.controlValues),m=p.useDashboardStore(H=>H.inlineFilterValuesMap),g=p.useDashboardStore(H=>H.cardControlValuesMap),b=p.useDashboardStore(H=>H.selectedSheetId),x=p.useDashboardStore(H=>H.selectedSheetId?H.documentInputRuntimeBySheetId[H.selectedSheetId]:void 0),y=p.useDashboardStore(H=>H.isDownloadingPdf),{authToken:w,tokenProps:v}=bt(),C=c==null?void 0:c.find(H=>H.id===b),N=S.useMemo(()=>p.getDashboardExportSheets(c),[c]),_=p.isDocumentSheet(C),k=_&&C?C.document:void 0,j=S.useMemo(()=>_&&C?Wv(u,C.id):[],[C,_,u]),I=j.length>0,T=S.useMemo(()=>_&&C?gce(u,C.id):!1,[C,_,u]),E=S.useMemo(()=>I?j.map(Gv):(k==null?void 0:k.inputs)||Tvt,[k,j,I]),D=((U=(O=v==null?void 0:v.params)==null?void 0:O.calendarContext)==null?void 0:U.tz)||((V=v==null?void 0:v.params)==null?void 0:V.timezone)||(typeof Intl<"u"?Intl.DateTimeFormat().resolvedOptions().timeZone:void 0),A=S.useMemo(()=>gle(E),[E]),P=S.useMemo(()=>mle(E,D),[E,D]),M=S.useMemo(()=>ple(E),[E]),L=x?x.filterValuesByInputId:P,$=x?x.controlValuesByInputId:M,z=S.useMemo(()=>_?T&&C&&k?wZ({dashboard:u,sheetId:C.id,sheetKind:"document",sectionIds:k.sections.map(H=>H.id),mode:"document",runtimeValues:{dashboardInputValues:d,filterValues:f,controlValues:h,inlineFilterValuesMap:m,cardControlValuesMap:g},timezone:D}):yle(E,L,$,A,A):[],[k,E,C,_,u,g,h,f,m,d,$,L,A,D,T]),W=!!C,F=N.length>0,X=((c==null?void 0:c.length)||0)>1||_,Y=i.sheetSelection==="current"&&(!W||_&&z.length>0)||i.sheetSelection==="all"&&!F;S.useEffect(()=>{e&&i.sheetSelection==="all"&&!F&&a(H=>({...H,sheetSelection:"current"}))},[F,e,i.sheetSelection]);const R=()=>{a({sheetSelection:"current",protectPdf:!1,password:""}),r(!1),t(!1)};async function K(){if(y){rt.error("A PDF export is already in progress");return}if(i.protectPdf&&!i.password){rt.error("Please enter a password to protect the PDF");return}if(i.sheetSelection==="current"&&!W){rt.error("No sheet is selected to export");return}if(i.sheetSelection==="all"&&!F){rt.error("No dashboard sheets are available to export");return}s(!0);const H=i.sheetSelection==="current"&&_,q=H?i.protectPdf?"Generating protected document PDF... may take up to 60 seconds":"Generating document PDF... may take up to 60 seconds":i.sheetSelection==="all"?"Generating PDF for all dashboard sheets... This may take a while.":i.protectPdf?"Generating protected PDF... may take up to 60 seconds":"Generating PDF... may take up to 60 seconds",B=rt.loading(q);try{if(H){if(!k||!C)throw new Error("Selected document sheet is missing document data");if(z.length>0){rt.dismiss(B),rt.error(`Set ${z.join(", ")} before exporting`);return}const Z=new Date().toISOString(),J=T?CZ({dashboard:u,sheetId:C.id,sheetKind:"document",sectionIds:k.sections.map(oe=>oe.id),mode:"document",runtimeValues:{dashboardInputValues:d,filterValues:f,controlValues:h,inlineFilterValuesMap:m,cardControlValuesMap:g},generatedAt:Z,timezone:D}).snapshot:void 0;await bF(v.apiServiceUrl,w,{sheetId:C.id,title:C.title||"Document",pageSize:k.page.size,orientation:k.page.orientation,timezone:D,password:i.protectPdf?i.password:void 0,inputSnapshot:J,...J?{}:{inputValues:{sheetId:C.id,filterValuesByInputId:L,controlValuesByInputId:$,generatedAt:Z}}})}else{const Z=ZJ();await IZ(v.apiServiceUrl,w,i.protectPdf?i.password:void 0,i.sheetSelection,Z)}rt.dismiss(B);const G=H?i.protectPdf?"Protected document PDF downloaded successfully!":"Document PDF downloaded successfully!":i.sheetSelection==="all"?"Dashboard sheets PDF downloaded successfully!":i.protectPdf?"Protected PDF downloaded successfully!":"PDF downloaded successfully!";rt.success(G,{duration:2e3}),R()}catch(G){rt.dismiss(B),rt.error("Failed to download PDF",{description:z_(G,"Please try again or contact support."),descriptionClassName:$_,closeButton:!0,duration:1/0,richColors:!0}),console.error("PDF download error:",G)}finally{s(!1)}}return l.jsx(ks,{open:e,onOpenChange:H=>{if(!H){R();return}t(!0)},children:l.jsxs(ls,{className:"rounded-control border-border/60 sm:max-w-[440px] sm:rounded-control",children:[l.jsxs(Xi,{children:[l.jsx(cs,{className:"text-[15px]",children:_?"Export document":"Export dashboard"}),l.jsx(Gs,{className:"text-[13px] leading-5",children:_?"Export this document sheet as a PDF document.":"Export this dashboard as a PDF document."})]}),l.jsxs("div",{className:"space-y-4 py-1",children:[X&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(p.Label,{className:rq,children:"Export scope"}),l.jsxs(Ca,{value:i.sheetSelection,onValueChange:H=>a({...i,sheetSelection:H}),className:"gap-1.5",children:[l.jsxs(p.Label,{htmlFor:"scope-current",className:p.cn("flex cursor-pointer items-center gap-2 rounded-control px-1 py-1 text-[13px] font-normal hover:bg-muted/50",!W&&"cursor-not-allowed opacity-50 hover:bg-transparent"),children:[l.jsx(Co,{value:"current",id:"scope-current",disabled:!W}),_?"This document":"This sheet"," (",(C==null?void 0:C.title)||"Current",")"]}),l.jsxs(p.Label,{htmlFor:"scope-all",className:p.cn("flex cursor-pointer items-center gap-2 rounded-control px-1 py-1 text-[13px] font-normal hover:bg-muted/50",!F&&"cursor-not-allowed opacity-50 hover:bg-transparent"),children:[l.jsx(Co,{value:"all",id:"scope-all",disabled:!F}),"Dashboard sheets (",N.length," ",N.length===1?"sheet":"sheets",")"]})]}),_&&l.jsx("p",{className:"text-[12px] leading-5 text-muted-foreground",children:z.length>0?`Set ${z.join(", ")} before exporting this document.`:'"Dashboard sheets" includes dashboard sheets only. Choose "This document" to export the selected document.'})]}),l.jsx(p.Separator,{className:"bg-border/60"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs(p.Label,{htmlFor:"protect-pdf",className:"flex cursor-pointer items-center gap-2 text-[13px] font-normal",children:[l.jsx(Tn,{id:"protect-pdf",checked:i.protectPdf,onCheckedChange:H=>{a({...i,protectPdf:H,password:H?i.password:""}),H||r(!1)}}),l.jsx(r_,{className:"h-3.5 w-3.5 text-muted-foreground"}),"Password protect PDF"]}),i.protectPdf&&l.jsxs("div",{className:"ml-6 space-y-1.5",children:[l.jsx(p.Label,{htmlFor:"pdf-password",className:rq,children:"Password"}),l.jsxs("div",{className:"relative",children:[l.jsx(p.Input,{id:"pdf-password",size:"xs",type:n?"text":"password",value:i.password,onChange:H=>a({...i,password:H.target.value}),placeholder:"Enter password",className:"pr-8",onKeyDown:H=>{H.key==="Enter"&&i.password&&K()}}),l.jsx("button",{type:"button",className:"absolute right-1 top-1/2 flex h-5 w-5 -translate-y-1/2 items-center justify-center rounded-control text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>r(!n),"aria-label":n?"Hide password":"Show password",children:n?l.jsx(n_,{className:"h-3.5 w-3.5"}):l.jsx(Pt.Eye,{className:"h-3.5 w-3.5"})})]}),l.jsx("p",{className:"text-[12px] text-muted-foreground",children:"Recipients will need this password to open the PDF."})]})]})]}),l.jsxs(Ic,{children:[l.jsx(p.Button,{variant:"outline",size:"xs",onClick:R,disabled:o,children:"Cancel"}),l.jsx(p.Button,{size:"xs",onClick:K,disabled:o||y||Y,children:o?l.jsxs(l.Fragment,{children:[l.jsx(p.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Exporting…"]}):l.jsxs(l.Fragment,{children:[l.jsx(jc,{className:"h-3.5 w-3.5"}),"Export"]})})]})]})})}function rhe({iconClassName:e,open:t,onOpenChange:n}){const[r,o]=S.useState(!1),s=t!==void 0,i=s?t:r,a=u=>{s||o(u),n==null||n(u)},c=p.useDashboardStore(u=>u.isDownloadingPdf);return l.jsxs(l.Fragment,{children:[s?null:l.jsx(p.Button,{variant:"ghost",size:"sm",className:"h-7 p-2",disabled:c,onClick:()=>a(!0),children:l.jsx(jc,{className:p.cn("size-4",e)})}),l.jsx(nhe,{open:i,onOpenChange:a})]})}function oq(e,t,n){const r=new Set(t),o=[...n];return e.map(s=>r.has(s.id)?o.shift()??s.id:s.id)}function Ivt({control:e,value:t,isEditing:n=!1,onChange:r}){const{attributes:o,listeners:s,setNodeRef:i,transform:a,transition:c,isDragging:u}=qg({id:`control:${e.id}`,disabled:!n}),d={transform:bi.Translate.toString(a),transition:c,opacity:u?.5:1,zIndex:u?10:void 0};return l.jsx("div",{ref:i,style:d,...o,children:l.jsx(Ale,{control:e,value:t,isEditing:n,dragListeners:n?s:void 0,onChange:r})})}function sq(e){var t;return(((t=e.values)==null?void 0:t.length)??0)>0||e.operation==="is null"||e.operation==="is not null"}function iq(e,t){return[...e.map(n=>`filter:${n.id}`),...t.map(n=>`control:${n.id}`)]}function Evt(e,t,n){const r=new Set([...t.map(a=>`filter:${a.id}`),...n.map(a=>`control:${a.id}`)]);if(!(e!=null&&e.length))return iq(t,n);const o=e.filter(a=>r.has(a)),s=new Set(o),i=iq(t,n).filter(a=>!s.has(a));return[...o,...i]}function Dvt(e,t){return p.getDashboardCardEntries({sheets:e.sheets||[]}).filter(n=>n.sheet.id===t).map(n=>n.card.id)}function Mvt(e){return Cp(e.dashboardInput,{sheetId:e.selectedSheetId,sheetKind:"dashboard"})?!0:e.dashboardInput.scope.kind!=="cards"?!1:e.selectedSheetCardIds.some(t=>Cp(e.dashboardInput,{sheetId:e.selectedSheetId,cardId:t,sheetKind:"dashboard"}))}function aq(e){var t;return((t=e.compatibility)==null?void 0:t.source)!=="dashboardFilter"}function Avt(e){const t={sheetId:e.selectedSheetId},n=p.getDashboardInputRuntimeSlot(e.dashboardInputValues,e.dashboardInput,t);if(n)return n;const r=p.getDashboardInputRuntimeSlot(e.defaultInputValues,e.dashboardInput,t);return r||p.getBackingDefaultSlot(e.dashboardInput)}function Rvt(e){return ohe(e).filter(t=>{var n,r;return t.filter.hide||t.filter.location==="frame"?!1:((n=t.compatibility)==null?void 0:n.source)==="dashboardFilter"?!0:(((r=t.presentation)==null?void 0:r.placement)||"toolbar")==="toolbar"})}function ohe(e){if(!e.selectedSheetId)return[];const t=e.selectedSheetId,n=Dvt(e.dashboard,t);return FK(D_({dashboard:e.dashboard}).allInputs).filter(r=>!(r.kind!=="filter"||!Mvt({dashboardInput:r,selectedSheetId:t,selectedSheetCardIds:n})))}function Pvt(e,t){return"toolbar"}function Fvt(){const e=Dc("interactive"),t=p.useDashboardStore(U=>U.selectedSheetId),n=p.useDashboardStore(U=>U.dashboard.filters),r=p.useDashboardStore(U=>U.dashboard.filterLayout),o=p.useDashboardStore(U=>U.isDashboardEditing),s=p.useDashboardStore(U=>U.controlValues),i=p.useDashboardStore(U=>U.filterValues);p.useDashboardStore(U=>U.filteringCards);const a=p.useDashboardStore(U=>U.inlineFilterValuesMap),c=p.useDashboardStore(U=>U.dashboardInputValues),u=p.useInteractionStore(U=>U.clearAllClickFilters),d=p.useInteractionStore(U=>Object.entries(U.interactionStates).reduce((V,[H,q])=>{var B;return H===p.DRILL_CONTEXT_CARD_ID?V:V+(((B=q.appliedClickFilters)==null?void 0:B.length)??0)},0)),f=p.useDashboardStore(U=>U.actions.removeCardInlineFilterValue),{reorderFilters:h,clearDashboardInputSlot:m,reorderDashboardControls:g,removeDashboardInput:b,setControlValue:x,setFilterLayout:y,setFilterValues:w,setFilteringCards:v,upsertDashboardInput:C}=p.useDashboardActions(),N=lj(Gp(Hg,{activationConstraint:{distance:5}})),_=p.useDashboardStore(U=>U.dashboard),k=Rvt({dashboard:_,selectedSheetId:t}).filter(U=>Pvt(U.filter)==="toolbar"),j=ohe({dashboard:_,selectedSheetId:t}),I=k.map(U=>U.filter),T=new Map(k.map(U=>[`filter:${U.filter.id}`,U])),E=HYe(_),D=E.filter(U=>!U.hidden&&t0(U)==="toolbar"),A=E.filter(U=>!U.hidden&&t0(U)==="advanced"),P=Evt(r==null?void 0:r.toolbarItemOrder,I,D),M=new Map(I.map(U=>[`filter:${U.id}`,U])),L=new Map(D.map(U=>[`control:${U.id}`,U]));function $(U){const{active:V,over:H}=U;if(!H||V.id===H.id)return;const q=String(V.id),B=String(H.id),G=P.findIndex(ye=>ye===q),Z=P.findIndex(ye=>ye===B);if(G===-1||Z===-1)return;const J=Ug(P,G,Z);y({toolbarItemOrder:J});const oe=new Set((n||[]).map(ye=>ye.id)),ie=P.filter(ye=>ye.startsWith("filter:")).map(ye=>ye.replace("filter:","")).filter(ye=>oe.has(ye)),ue=J.filter(ye=>ye.startsWith("filter:")).map(ye=>ye.replace("filter:","")).filter(ye=>oe.has(ye)),xe=P.filter(ye=>ye.startsWith("control:")).map(ye=>ye.replace("control:","")),te=J.filter(ye=>ye.startsWith("control:")).map(ye=>ye.replace("control:",""));h(oq(n||[],ie,ue)),g(oq(_.controls||[],xe,te))}const z=(r==null?void 0:r.toolbarWrap)??!1,W=(r==null?void 0:r.showDownloadButton)??!1,F=(i==null?void 0:i.filter(U=>sq(U)).length)??0,X=j.filter(aq),Y=X.filter(U=>{const V=Avt({dashboardInput:U,dashboardInputValues:c,defaultInputValues:_.defaultInputValues,selectedSheetId:t});return(V==null?void 0:V.status)==="set"&&V.value.kind==="filter"&&sq(V.value.filterValue)}).length,R=a?Object.values(a).reduce((U,V)=>U+((V==null?void 0:V.length)??0),0):0,K=F+Y+R+d,O=()=>{w([]),X.forEach(U=>{m(U,{sheetId:t})}),v([]),u(),a&&Object.entries(a).forEach(([U,V])=>{V==null||V.forEach(H=>{f(U,H.filterId)})})};return!I.length&&!D.length&&!A.length&&!W&&K===0?null:l.jsx("div",{className:"z-20 border-b border-border/60 bg-background/95 px-3 py-2 backdrop-blur supports-[backdrop-filter]:bg-background/85",style:e.containerStyle,role:"toolbar","aria-label":"Dashboard filters and controls",children:l.jsx(zv,{sensors:N,collisionDetection:Ov,onDragEnd:$,children:l.jsxs("div",{className:p.cn("flex items-center",z?"flex-wrap":"w-0 min-w-full overflow-x-auto"),children:[l.jsx(Bv,{items:P,strategy:jL,children:l.jsx(sR,{className:"gap-3 pr-0",wrap:z,children:P.map(U=>{const V=M.get(U);if(V){const q=T.get(U),B=q&&aq(q);return l.jsx(jvt,{filter:V,isEditing:o,storageOptions:B?{storageTarget:"dashboardInput",dashboardInput:q,sheetId:t??void 0}:void 0,inputVariableName:B?q.variableName:void 0,onUpdateFilter:B?(G,Z)=>{C({...q,variableName:(Z==null?void 0:Z.variableName)||q.variableName,filter:G})}:void 0,onRemoveFilter:B?()=>{w((i||[]).filter(G=>G.filterId!==V.id)),b(q.id)}:void 0},U)}const H=L.get(U);return H?l.jsx(Ivt,{control:H,value:s==null?void 0:s[H.id],isEditing:o,onChange:q=>x(H.id,q)},U):null})})}),A.length>0&&l.jsx(Tie,{title:"",controls:A,values:s,onChange:(U,V)=>x(U.id,V),immediatePlacement:"toolbar",advancedLabel:"More controls"}),K>0&&l.jsxs("button",{type:"button",onClick:O,"aria-label":"Clear all filters",className:"ml-auto inline-flex h-7 shrink-0 items-center gap-1 rounded-control px-2 text-[12px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:[l.jsx(Te.X,{className:"h-3 w-3"}),"Clear all",l.jsx("span",{className:"rounded-[3px] bg-muted px-1 text-[10px] tabular-nums text-muted-foreground",children:K})]}),W&&l.jsx("div",{className:p.cn(K>0?"ml-1.5":"ml-auto"),children:l.jsx(rhe,{})})]})})})}function she(){var me,we;const{showAssistant:e,tokenProps:t,renderMode:n}=bt(),r=kvt((me=t.config)==null?void 0:me.showDashboardAssistant,e),{preferences:o}=eg(),s=(we=o==null?void 0:o.cardDisplay)==null?void 0:we.mode,i=Rh(s),a=sZ({displayMode:s,renderMode:n}),c=S.useRef(null),u=S.useRef(null),[d,f]=S.useState(!1),{handleDragStart:h,isDraggingRef:m,getStyle:g,getPositionClasses:b}=yst({initialPosition:"bottom-right"}),x=kf(ee=>ee.setFullscreen),y=kf(ee=>ee.setPanelOpen),w=kf(ee=>ee.setContainer),v=HY("dashboard"),C=UY(),N=qY("dashboard"),_=v.isOpen,k=C==="dashboard",j=p.useDashboardStore(ee=>ee.isVisualEditing),I=p.useDashboardStore(ee=>ee.themeStyle),T=Mc(),E=p.useDashboardStore(ee=>{var re;return(re=ee.dashboard)==null?void 0:re.sheets}),D=p.useDashboardStore(ee=>ee.showFilters),A=p.useDashboardStore(ee=>ee.isDashboardEditing),P=p.useDashboardStore(ee=>ee.selectedSheetId),M=E==null?void 0:E.find(ee=>ee.id===P),L=p.useDashboardStore(ee=>{var re,ne,le;return(le=(ne=(re=ee.dashboard)==null?void 0:re.sheets)==null?void 0:ne.find(ae=>ae.id===ee.selectedSheetId))==null?void 0:le.kind}),$=p.useDashboardStore(ee=>{var re,ne;return((ne=(re=ee.dashboard)==null?void 0:re.summary)==null?void 0:ne.position)||"top"}),z=L==="document",W=p.useDashboardStore(ee=>{var re;return(re=ee.dashboard)==null?void 0:re.id}),{getDefaultSheetId:F,setDefaultSheetId:X,clearDefaultSheetId:Y}=Gq(W),[R,K]=S.useState(null),{setSelectedSheetId:O,setSheetTitle:U,addSheet:V,setSheets:H}=p.useDashboardActions();hvt(u);const{setActiveAssistantType:q}=p.useAIActions();S.useEffect(()=>{if(W){const ee=F();K(ee)}},[W,F]),S.useEffect(()=>{_?q("dashboard"):C==="dashboard"&&x(null)},[_,q,C,x]),S.useEffect(()=>{var ee;_||(ee=c.current)==null||ee.resize(0)},[_]);function B(ee){var re,ne;ee?((re=c.current)==null||re.resize(40),y("dashboard",!0),x("dashboard"),q("dashboard")):(y("dashboard",!1),x(null),(ne=c.current)==null||ne.resize(0),q(null))}function G(ee="dashboard"){const re={id:p.v4(),title:ee==="document"?"New Document":"New Sheet",...ee==="document"?{kind:ee,document:p.createDefaultDocumentDefinition()}:{}};V(re),O(re.id)}function Z(ee,re){if(!W)return;R===ee?(Y(),K(null),rt.success("Default sheet cleared")):(X(ee),K(ee),rt.success(`"${re}" set as default sheet`))}function J(ee){var re;ee<1?(y("dashboard",!1),x(null),q(null),(re=c.current)==null||re.resize(0)):(_||y("dashboard",!0),q("dashboard"))}function oe(){return(I==null?void 0:I.canvasTheme)==="muted"||!(I!=null&&I.canvasTheme)?"hsl(var(--semaphor-muted))":(I==null?void 0:I.canvasTheme)==="clear"?"":I==null?void 0:I.canvasTheme}const ie=(ee,re)=>{ee.dataTransfer.setData("tabIndex",re.toString())},ue=ee=>{ee.preventDefault()},xe=(ee,re)=>{const ne=ee.dataTransfer.getData("tabIndex");if(ne===re.toString())return;const le=Array.from(E||[]),[ae]=le.splice(parseInt(ne),1);le.splice(re,0,ae),H(le)},te=r===!0&&!i&&!_&&!j&&!D;function ye(){if(E&&E.length>1||A)return l.jsx("div",{className:"relative flex w-full items-stretch border-b border-border",children:l.jsxs("div",{className:"relative min-w-0 flex-1",children:[l.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-0 left-0 z-10 w-4 bg-gradient-to-r from-background to-transparent"}),l.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-0 right-0 z-10 w-4 bg-gradient-to-l from-background to-transparent"}),l.jsxs(p.TabsList,{role:"tab-list",className:"flex w-0 min-w-full items-stretch justify-start overflow-x-auto rounded-none bg-transparent p-0 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[E==null?void 0:E.map((ee,re)=>{const ne=P===ee.id,le=R===ee.id;return l.jsxs(p.TabsTrigger,{draggable:!0,onDragStart:ae=>ie(ae,re),onDragOver:ue,onDrop:ae=>xe(ae,re),onClick:()=>O(ee.id),className:p.cn("group relative inline-flex h-9 shrink-0 items-center gap-1.5 rounded-none bg-transparent px-3 py-0 text-[12px] font-medium text-muted-foreground transition-colors hover:bg-transparent hover:text-foreground data-[state=active]:bg-transparent data-[state=active]:text-foreground data-[state=active]:shadow-none","after:pointer-events-none after:absolute after:inset-x-2 after:-bottom-px after:h-0.5 after:bg-transparent data-[state=active]:after:bg-foreground"),value:ee.id,children:[ee.kind==="document"&&l.jsx(di,{className:"h-3 w-3 text-muted-foreground"}),l.jsx(mN,{enabled:A&&ne,text:ee.title,onSave:ae=>U(ee.id,ae),children:ee.title},ee.id),l.jsx("span",{role:"button",tabIndex:0,"aria-label":le?"Clear default sheet":"Set as default sheet",title:le?"Clear default sheet":"Set as default sheet",onClick:ae=>{ae.stopPropagation(),Z(ee.id,ee.title||"Sheet")},onKeyDown:ae=>{(ae.key==="Enter"||ae.key===" ")&&(ae.preventDefault(),ae.stopPropagation(),Z(ee.id,ee.title||"Sheet"))},className:p.cn("inline-flex h-4 w-4 shrink-0 cursor-pointer items-center justify-center rounded-[3px] transition-opacity hover:bg-muted focus:outline-none focus-visible:ring-1 focus-visible:ring-foreground",ne||le?"opacity-100":"opacity-0 group-hover:opacity-100"),children:l.jsx(DW,{className:p.cn("h-3 w-3 transition-colors",le?"fill-current text-amber-500":"text-muted-foreground")})}),A&&ne&&E.length>1&&l.jsx("span",{role:"button",tabIndex:0,"aria-label":"Delete sheet",className:"inline-flex h-4 w-4 shrink-0 cursor-pointer items-center justify-center rounded-[3px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus:outline-none focus-visible:ring-1 focus-visible:ring-foreground",onClick:ae=>{ae.stopPropagation(),f(!0)},onKeyDown:ae=>{(ae.key==="Enter"||ae.key===" ")&&(ae.preventDefault(),ae.stopPropagation(),f(!0))},children:l.jsx(Te.X,{className:"h-3 w-3"})})]},ee.id)}),A&&l.jsxs(Bo,{children:[l.jsx(Vo,{asChild:!0,children:l.jsxs("button",{type:"button","aria-label":"Add sheet",className:"ml-1 inline-flex h-9 shrink-0 items-center gap-1 px-3 text-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground",children:[l.jsx(kr,{className:"h-3 w-3"}),"Sheet"]})}),l.jsxs(ko,{align:"start",className:"w-48",children:[l.jsxs(Sn,{onSelect:()=>G("dashboard"),children:[l.jsx(Yf,{className:"h-4 w-4 text-muted-foreground"}),"Dashboard sheet"]}),l.jsxs(Sn,{onSelect:()=>G("document"),children:[l.jsx(di,{className:"h-4 w-4 text-muted-foreground"}),"Document"]})]})]})]})]})})}function se(){return l.jsx("div",{ref:u,style:{},className:"h-full min-h-0 grow",children:E==null?void 0:E.map(ee=>l.jsx(p.TabsContent,{style:{backgroundColor:oe(),...T.dashboardCanvasStyle},className:p.cn("mt-0 h-full min-h-0",{}),value:ee.id,children:l.jsx(eH,{sheet:ee})},ee.id))})}function Ie(){return l.jsxs(p.Tabs,{"data-role":"dashboard-tabs-container",className:p.cn("relative flex h-full flex-col",I==null?void 0:I.dashboardTabsContainer),onValueChange:ee=>{O(ee)},value:P||void 0,children:[ye(),$==="top"&&!z&&l.jsx($A,{}),P&&!z&&l.jsx(Fvt,{}),z?l.jsx("div",{"data-role":"dashboard-tabs-content",className:"min-h-0 flex-1 grow basis-0 overflow-hidden",children:se()}):l.jsx(Ea,{"data-role":"dashboard-tabs-content",className:"flex-1 grow basis-0 overflow-y-auto",children:se()}),$==="bottom"&&!z&&l.jsx($A,{}),l.jsx(vst,{open:d,setOpen:f})]})}const fe=S.useCallback(ee=>{w("dashboard",ee)},[w]);return E?a&&P&&!z?l.jsxs("div",{"data-document-render-error":"true",className:"bg-white p-8 text-sm text-zinc-700",children:['Requested document sheet "',P,'" was not found or is not a document sheet in the loaded dashboard.']}):a&&z&&M?l.jsx("div",{"data-role":"dashboard-document-print-content",className:"min-h-0 overflow-visible bg-white",children:l.jsx(eH,{sheet:M})}):l.jsxs(l.Fragment,{children:[l.jsx(wvt,{}),l.jsx(_vt,{}),l.jsxs("div",{className:"relative flex-1 basis-0 overflow-hidden",children:[l.jsxs(zce,{className:p.cn("flex-1 basis-0 overflow-y-auto transition-opacity",k&&"pointer-events-none opacity-0"),direction:"horizontal",children:[l.jsx(uR,{children:Ie()}),r===!0&&l.jsxs(l.Fragment,{children:[l.jsx(xst,{open:_,onTabClick:B,withHandle:!0,disabled:!_}),l.jsx(uR,{className:"flex grow","data-role":"dashboard-assistant-panel",onResize:J,defaultSize:_?40:0,ref:c,children:l.jsx("div",{className:"grow overflow-y-auto",children:l.jsx(fvt,{open:_,setOpen:B,isFullscreen:k,onFullscreenChange:ee=>x(ee?"dashboard":null),fullscreenContainer:N})})})]})]}),l.jsx("div",{ref:fe,className:p.cn("absolute inset-0",!k&&"pointer-events-none")}),te&&l.jsx("div",{className:p.cn("absolute z-50 transition-all duration-300 ease-in-out",b().horizontal,b().vertical),style:g(),children:l.jsx(p.Button,{size:"sm",variant:"outline",className:"h-12 w-12 cursor-grab rounded-full border-border bg-background p-0 shadow-lg hover:bg-muted active:cursor-grabbing",onClick:()=>{m.current||B(!0)},onMouseDown:h,onTouchStart:h,title:"Open Assistant (drag to move)",children:l.jsx(Fpe,{className:"h-5 w-5"})})})]})]}):null}const ihe=S.forwardRef(({appearance:e,organizationAppearance:t,tokenAppearance:n,reactAppearance:r,resolvedAppearance:o,children:s,className:i,style:a,...c},u)=>{const d=S.useId(),f=S.useMemo(()=>Ovt(d),[d]),{theme:h}=VR(),m=Lvt(h),g=S.useMemo(()=>o??kc.resolveAppearance({organizationAppearance:t,tokenAppearance:n,reactAppearance:r??e}),[e,t,r,o,n]),b=S.useMemo(()=>p.compileAppearance({spec:g,systemMode:m}),[g,m]),x=S.useMemo(()=>p.createAppearanceContextValue(f,b),[b,f]);return l.jsx(p.AppearanceContext.Provider,{value:x,children:l.jsx(Lg,{...c,ref:u,className:i,style:a,children:s})})});ihe.displayName="AppearanceProvider";function Ovt(e){return`semaphor-appearance-${e.replace(/[^a-zA-Z0-9_-]/g,"")}`}function Lvt(e){const t=U1(e),[n,r]=S.useState(()=>$vt());return S.useEffect(()=>{var i,a;if(t!=="system"||typeof window>"u")return;const o=(i=window.matchMedia)==null?void 0:i.call(window,"(prefers-color-scheme: dark)");if(!o)return;const s=()=>{r(o.matches?"dark":"light")};return s(),typeof o.addEventListener=="function"?(o.addEventListener("change",s),()=>o.removeEventListener("change",s)):((a=o.addListener)==null||a.call(o,s),()=>{var c;return(c=o.removeListener)==null?void 0:c.call(o,s)})},[t]),t==="system"?n:t}function $vt(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}const ahe=S.createContext({openBrandStudioPreview:()=>{}}),zvt=ahe.Provider;function Bvt(){return S.useContext(ahe)}function Vvt({children:e,defaultTheme:t="system",storageKey:n="vite-ui-theme",...r}){const o=U1(t),[s,i]=S.useState(()=>Hvt(n)||o),a=S.useCallback(u=>{const d=U1(u);Uvt(n,d),i(d)},[n]),c=S.useMemo(()=>({theme:s,setTheme:a}),[s,a]);return l.jsx(_q.Provider,{...r,value:c,children:e})}function Hvt(e){if(typeof window>"u")return null;try{const t=window.localStorage.getItem(e);if(!t)return null;const n=U1(t,"system");return n===t?n:null}catch{return null}}function Uvt(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(e,t)}catch{}}const qvt=S.lazy(()=>Promise.resolve().then(()=>require("../brand-studio/index.cjs")).then(e=>({default:e.BrandStudioEditor})));function t$({appearance:e,children:t}){var E,D;const{authToken:n,id:r,tokenProps:o}=bt(),s=M0(),i=(E=s.data)==null?void 0:E.organizationAppearance,a=(D=o.config)==null?void 0:D.appearance,[c,u]=S.useState(!1),[d,f]=S.useState(null),[h,m]=S.useState(null),[g,b]=S.useState(null),[x,y]=S.useState(null),w=`${o.apiServiceUrl??""}:${(n==null?void 0:n.accessToken)??""}`,v=Rn({queryKey:PG({resourceType:Zr.DASHBOARD,apiServiceUrl:o.apiServiceUrl,accessToken:n==null?void 0:n.accessToken}),queryFn:async()=>p.getRequest(`${o.apiServiceUrl}/management/v1/dashboards`,(n==null?void 0:n.accessToken)||""),select:A=>(A==null?void 0:A.organizationAppearance)??null,enabled:!s.dashboardIdToFetch&&i===void 0&&!!(n!=null&&n.accessToken)});S.useEffect(()=>{i!==void 0&&y({scopeKey:w,appearance:i})},[i,w]),S.useEffect(()=>{v.data!==void 0&&y({scopeKey:w,appearance:v.data})},[v.data,w]);const C=(x==null?void 0:x.scopeKey)===w?x.appearance:null,N=i!==void 0?i:v.data!==void 0?v.data:C,_=S.useMemo(()=>kc.resolveAppearance({organizationAppearance:N,tokenAppearance:a,reactAppearance:e}),[e,N,a]),k=S.useCallback(()=>{f(g??h??_),u(!0)},[g,h,_]),j=S.useCallback(()=>{u(!1)},[]);S.useEffect(()=>{f(null),m(null),b(null),u(!1)},[r]);const I=S.useMemo(()=>({openBrandStudioPreview:k}),[k]),T=g??h??e;return l.jsx(Vvt,{defaultTheme:"system",storageKey:"vite-ui-theme",children:l.jsx(zvt,{value:I,children:l.jsx(ihe,{organizationAppearance:N,tokenAppearance:a,reactAppearance:T,style:{height:"100%",width:"100%"},children:l.jsxs(p.TooltipProvider,{delayDuration:0,children:[t,c&&l.jsx("aside",{"aria-label":"Brand Studio","aria-modal":"false",role:"dialog",className:"fixed bottom-0 right-0 top-0 z-50 flex w-[min(520px,100vw)] flex-col border-l border-border bg-background text-foreground shadow-sm",children:l.jsx(S.Suspense,{fallback:l.jsx("div",{className:"flex h-full items-center justify-center text-[12px] text-muted-foreground",children:"Loading Brand Studio..."}),children:l.jsx(qvt,{appearance:d,onDraftChange:b,onSave:A=>{m(A),b(A),f(A)},onCancel:j})})})]})})})})}function lhe({children:e,preferences:t}){const{currentUser:n}=Zi(),r=S.useMemo(()=>{var o,s;return{preferences:t||{},isLocalDev:((o=t==null?void 0:t.uiMode)==null?void 0:o.developer)||!1,isConsoleMode:((s=t==null?void 0:t.uiMode)==null?void 0:s.console)||!1}},[t]);return l.jsx(MG.Provider,{value:r,children:l.jsx(nj,{displayPreferences:t==null?void 0:t.cardDisplay,currentUser:n,children:e})})}function Wvt(e=2e3,t=500){const n=Xme(),[r,o]=S.useState(!1),[s,i]=S.useState(!1),a=S.useRef(null);return S.useEffect(()=>{const c=setTimeout(()=>o(!0),e);return()=>clearTimeout(c)},[e]),S.useEffect(()=>{if(r){if(n>0){i(!1),a.current&&(clearTimeout(a.current),a.current=null);return}return a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{i(!0)},t),()=>{a.current&&clearTimeout(a.current)}}},[r,n,t]),s}function n$({delayMs:e=2e3,quietMs:t=500,componentType:n,componentId:r}){const o=Wvt(e,t);return S.useEffect(()=>(o&&(window.__SEMAPHOR_READY__={ready:!0,type:n,componentId:r||null,timestamp:Date.now()}),()=>{window.__SEMAPHOR_READY__={ready:!1,type:n,componentId:r||null,timestamp:Date.now()}}),[o,n,r]),l.jsx("div",{id:"idle-check","aria-hidden":"true",style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0},children:o?"ready":""})}function che(e){if(typeof window>"u")return null;const{preferences:t}=e;return l.jsx(ka,{FallbackComponent:ej,children:l.jsxs(YR,{dashboardProps:e,children:[l.jsx(n$,{componentType:"dashboard",componentId:e.id}),l.jsx(t$,{appearance:e.appearance,children:l.jsx(lhe,{preferences:t,children:l.jsx("main",{className:"flex h-full flex-col",children:l.jsx(_P,{...e,type:"dashboard",children:l.jsx(she,{})})})})})]})})}function Gvt(e=[]){const t=S.useRef(null),n=S.useRef(null),r=S.useRef(null),[o,s]=S.useState(),i=S.useCallback(()=>{var m,g,b;const a=((m=t.current)==null?void 0:m.clientWidth)??0,c=((g=r.current)==null?void 0:g.offsetWidth)??0,u=((b=n.current)==null?void 0:b.offsetWidth)??0,f=a-c-u-8,h=Math.max(f,0);s(x=>x===h?x:h)},[]);return S.useEffect(()=>{const a=t.current;if(!a||typeof ResizeObserver>"u")return;const c=new ResizeObserver(()=>i());return c.observe(a),i(),()=>c.disconnect()},[i,...e]),{headerRef:t,leftActionsRef:n,rightActionsRef:r,titleMaxWidth:o,updateAvailableWidth:i}}function Yvt({filter:e}){var g;const t=p.useDashboardStore(b=>b.isDashboardEditing),{preferences:n}=eg(),r=Rh((g=n==null?void 0:n.cardDisplay)==null?void 0:g.mode),o=p.useDashboardStore(b=>b.filterValues),s=o==null?void 0:o.some(b=>b.filterId===e.id),{removeFilterValues:i,removeFilter:a,updateFilter:c}=p.useDashboardActions(),{headerRef:u,leftActionsRef:d,rightActionsRef:f,titleMaxWidth:h,updateAvailableWidth:m}=Gvt([t,s,r]);return S.useEffect(()=>{m()},[e.title,m]),l.jsxs("div",{ref:u,className:"group mb-1 flex h-5 items-center justify-between",children:[l.jsxs("div",{className:"flex grow items-center gap-2 min-w-0",children:[l.jsx("div",{className:"min-w-0 flex-1",style:h!==void 0?{maxWidth:h}:void 0,children:l.jsx(p.Label,{className:"my-1 block w-full text-sm",children:l.jsx(Hs,{value:e.title||e.column,onSave:b=>c({...e,title:b}),isEditable:t,placeholder:"Filter",displayClassName:"text-sm truncate",inputClassName:"text-sm"})})}),l.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",ref:d,children:[t&&l.jsx(X5,{filter:e,isEditing:t}),t&&l.jsx("button",{onClick:()=>{i(e.id),a(e.id)},className:"text-muted-foreground hover:text-foreground",children:l.jsx(Te.X,{className:"size-3.5"})})]})]}),l.jsx("div",{className:"hidden",ref:f})]})}function Kvt(){const e=p.useDashboardStore(r=>r.dashboard.filters),t=p.useDashboardStore(r=>r.theme),n=e==null?void 0:e.filter(r=>r.hide);return n!=null&&n.length?l.jsx("div",{className:p.cn("mb-1 flex items-center gap-2 border-y px-0.5 pb-0.5",{"bg-[repeating-linear-gradient(45deg,_#ffffff_0_3px,_#f3f3f3_3px_6px)]":t==="light","bg-[repeating-linear-gradient(45deg,_#18171d_0_3px,_#272729_3px_6px)]":t==="dark"}),children:n==null?void 0:n.map(r=>l.jsxs("div",{className:"flex min-w-[250px] max-w-fit flex-col gap-1 p-2",children:[l.jsx(Yvt,{filter:r}),l.jsx(Gk,{filter:r})]},r.id))}):null}function Zvt(){var i;const e=p.useDashboardStore(a=>a.dashboard),t=p.useDashboardStore(a=>a.selectedSheetId),n=p.useDashboardStore(a=>a.isVisualEditing),r=p.useDashboardStore(a=>a.isDashboardEditing),o=(i=e.sheets)==null?void 0:i.find(a=>a.id===t),s=p.isDocumentSheet(o);return l.jsx("div",{role:"dashboard-plus-main",className:p.cn("",{"max-h-0 overflow-hidden":n,"flex min-h-0 grow basis-0 overflow-hidden":!n}),children:l.jsxs("section",{className:"flex min-h-0 grow basis-0 flex-col overflow-hidden",children:[r&&!s&&l.jsx(Kvt,{}),l.jsx(she,{})]})})}const Xvt=S.lazy(()=>Promise.resolve().then(()=>require("./dashboard-controls-yMYyJeGD.js"))),Qvt=S.lazy(()=>Promise.resolve().then(()=>require("./edit-dashboard-visual-BWjU4Cq2.js"))),Jvt=S.lazy(()=>Promise.resolve().then(()=>require("./dashboard-json-BM0aC2mQ.js")));function ewt({showControls:e=!1,showFooter:t=!0,...n}){const r=p.useDashboardStore(a=>a.isVisualEditing),o=p.useDashboardStore(a=>a.showDashboardJSON),{appearance:s,preferences:i}=n;return l.jsx(ka,{FallbackComponent:ej,children:l.jsxs(YR,{dashboardProps:n,children:[l.jsx(n$,{componentType:"surfboard",componentId:n.id}),l.jsxs(t$,{appearance:s,children:[l.jsx(Vbe,{toastOptions:{classNames:{toast:"max-w-[calc(100vw-2rem)] overflow-x-hidden !items-start [--toast-close-button-end:0.5rem] [--toast-close-button-start:auto] [--toast-close-button-transform:translate(0,0)] sm:max-w-[44rem]",content:"min-w-0 flex-1",icon:"mt-0.5 shrink-0",title:"max-w-full break-words pr-8",description:"max-w-full break-words",closeButton:"!top-2 h-6 w-6 rounded-md border-border bg-background text-muted-foreground hover:bg-muted hover:text-foreground"}}}),l.jsxs(lhe,{preferences:i,children:[o&&l.jsx(S.Suspense,{fallback:null,children:l.jsx(Jvt,{})}),l.jsxs("main",{className:"relative flex h-full w-full flex-col overflow-hidden",children:[e&&l.jsx(S.Suspense,{fallback:null,children:l.jsx(Xvt,{})}),l.jsx("div",{className:"flex grow overflow-hidden",children:l.jsx("div",{className:"flex min-w-0 flex-1",children:l.jsxs(_P,{...n,type:"dashboard",children:[r&&l.jsx(S.Suspense,{fallback:null,children:l.jsx(Qvt,{})}),l.jsx(Zvt,{})]})})})]})]})]})]})})}var twt=Object.defineProperty,nwt=(e,t,n)=>t in e?twt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ZS=(e,t,n)=>nwt(e,typeof t!="symbol"?t+"":t,n);const rwt={stringify:e=>e?"true":"false",parse:e=>/^[ty1-9]/i.test(e)},owt={stringify:e=>e.name,parse:(e,t,n)=>{const r=(()=>{if(typeof window<"u"&&e in window)return window[e];if(typeof global<"u"&&e in global)return global[e]})();return typeof r=="function"?r.bind(n):void 0}},swt={stringify:e=>JSON.stringify(e),parse:e=>JSON.parse(e)};function iwt(e){return e.replace(/([a-z0-9])([A-Z])/g,(t,n,r)=>`${n}-${r.toLowerCase()}`)}function uhe(e){return e.replace(/[-:]([a-z])/g,(t,n)=>`${n.toUpperCase()}`)}const awt={stringify:e=>e.name,parse:(e,t,n)=>{const r=(()=>{const o=uhe(t);if(typeof n<"u"&&o in n.container)return n.container[o]})();return typeof r=="function"?r.bind(n):void 0}},lwt={stringify:e=>`${e}`,parse:e=>parseFloat(e)},cwt={stringify:e=>e,parse:e=>e},HD={string:cwt,number:lwt,boolean:rwt,function:owt,method:awt,json:swt},Gb=Symbol.for("r2wc.render"),XS=Symbol.for("r2wc.connected"),Ld=Symbol.for("r2wc.context"),Qs=Symbol.for("r2wc.props");function uwt(e,t,n){var r,o,s;t.props||(t.props=e.propTypes?Object.keys(e.propTypes):[]),t.events||(t.events=[]);const i=Array.isArray(t.props)?t.props.slice():Object.keys(t.props),a=Array.isArray(t.events)?t.events.slice():Object.keys(t.events),c={},u={},d={},f={};for(const m of i){c[m]=Array.isArray(t.props)?"string":t.props[m];const g=iwt(m);d[m]=g,f[g]=m}for(const m of a)u[m]=Array.isArray(t.events)?{}:t.events[m];class h extends HTMLElement{constructor(){super(),ZS(this,s,!0),ZS(this,o),ZS(this,r,{}),ZS(this,"container"),t.shadow?this.container=this.attachShadow({mode:t.shadow}):this.container=this,this[Qs].container=this.container;for(const g of i){const b=d[g],x=this.getAttribute(b),y=c[g],w=y?HD[y]:null;if(y==="method"){const v=uhe(b);Object.defineProperty(this[Qs].container,v,{enumerable:!0,configurable:!0,get(){return this[Qs][v]},set(C){this[Qs][v]=C,this[Gb]()}}),this[Qs][g]=w.parse(x,b,this)}w!=null&&w.parse&&x&&(this[Qs][g]=w.parse(x,b,this))}for(const g of a)this[Qs][g]=b=>{const x=g.replace(/^on/,"").toLowerCase();this.dispatchEvent(new CustomEvent(x,{detail:b,...u[g]}))}}static get observedAttributes(){return Object.keys(f)}connectedCallback(){this[XS]=!0,this[Gb]()}disconnectedCallback(){this[XS]=!1,this[Ld]&&n.unmount(this[Ld]),delete this[Ld]}attributeChangedCallback(g,b,x){const y=f[g],w=c[y],v=w?HD[w]:null;y in c&&v!=null&&v.parse&&x&&(this[Qs][y]=v.parse(x,g,this),this[Gb]())}[(s=XS,o=Ld,r=Qs,Gb)](){this[XS]&&(this[Ld]?n.update(this[Ld],this[Qs]):this[Ld]=n.mount(this.container,e,this[Qs]))}}for(const m of i){const g=d[m],b=c[m];Object.defineProperty(h.prototype,m,{enumerable:!0,configurable:!0,get(){return this[Qs][m]},set(x){this[Qs][m]=x;const y=b?HD[b]:null;if(y!=null&&y.stringify){const w=y.stringify(x,g,this);this.getAttribute(g)!==w&&this.setAttribute(g,w)}else this[Gb]()}})}return h}function dwt(e,t,n){const r=Ohe.createRoot(e),o=S.createElement(t,n);return r.render(o),{root:r,ReactComponent:t}}function fwt({root:e,ReactComponent:t},n){const r=S.createElement(t,n);e.render(r)}function hwt({root:e}){e.unmount()}function mwt(e,t={}){return uwt(e,t,{mount:dwt,update:fwt,unmount:hwt})}const pwt={id:"string",version:"string",authToken:"json",placeholders:"json",defaultFilterValues:"json",defaultControlValues:"json",controlContractOverrides:"json",documentInputValues:"json",dashboardInputExecutionSnapshot:"json",renderMode:"string",currentTheme:"string",customCards:"json",customStyle:"json",appearance:"json",onChartElementClicked:"function",onFilterValuesChange:"function",onEvent:"function",onSave:"function",LoadingComponent:"function",ErrorComponent:"function",showAssistant:"boolean",showBriefings:"boolean",selectedSheetId:"string",eventHandlers:"json",preferences:"json"},gwt=mwt(che,{props:pwt}),bwt=S.memo(function({context:t="editor"}={}){return l.jsxs("div",{"data-content":"fields-section",className:"flex h-full grow flex-col items-center overflow-hidden",children:[" ",l.jsx(XL,{context:t})," "]})}),dhe=new Set(["askForMoreInfo","getAvailableChartTypes","getChartSQLSyntax","getDomainRelationships","getTableColumns","getUserSql","validateCardConfigFormat"]),xwt=new Set(["createChartFromSql","createForecast","generateQueryConfig","getChartDataFromCardConfig","getChartDataFromSqlAndPython","getForecastDataFromSqlAndPython"]),ywt=Array.from(dhe).join(", "),vwt=3,wwt="Self-heal",Swt=new Set(["SQL_PARSE_ERROR","SQL_EXPLAIN_ERROR"]);function Cwt({card:e}){var W,F,X,Y,R;const[t,n]=S.useState({}),{authToken:r}=bt(),o=p.getTokenParams(r==null?void 0:r.accessToken),{compiledAppearance:s}=p.useAppearance(),i=S.useMemo(()=>Tv(s),[s]),a=p.useEditorStore(K=>K.frame),c=p.useEditorStore(K=>K.inlineFilterValuesMap[e.id]),u=p.useEditorStore(K=>K.actions.setCardInlineFilterValue),d=p.useEditorStore(K=>K.actions.removeCardInlineFilterValue),f=e,{getCard:h,manifest:m}=Vh(((W=f.customCardPreferences)==null?void 0:W.url)||""),g=(F=m==null?void 0:m.visuals)==null?void 0:F.find(K=>{var O;return K.name===((O=f.customCardPreferences)==null?void 0:O.componentName)}),b=Iv(f,g)??"single",x=S.useMemo(()=>nL({frame:a,configCard:f,isMultiInputVisual:b==="multiple"}),[a,f,b]),y=S.useMemo(()=>{const K=x.findIndex(O=>(O==null?void 0:O.id)===e.id);return K<0?-1:Xy(e,K)},[x,e]),w=S.useMemo(()=>b!=="multiple"||y<0?e.type:Jm(e,y,g==null?void 0:g.slots)??e.type,[b,y,e,g==null?void 0:g.slots]),v=S.useMemo(()=>b==="multiple"?{...e,connectionId:void 0,dataSource:void 0,sql:"",python:"",config:void 0,queryConfig:void 0}:w!==e.type?{...e,type:w}:e,[e,w,b]),{data:C}=O_(v),N=p.useInteractionStore(K=>K.interactionStates),_=p.useDashboardStore(K=>{var O;return(O=K.dashboard)==null?void 0:O.id}),k=p.useDashboardStore(K=>K.dashboard.filters),j=p.useDashboardStore(K=>K.filterValues),I=p.useDashboardStore(K=>K.selectedSheetId),T=S.useMemo(()=>J5({card:e,sheetId:I||"",inlineFilterValues:c,setInlineFilterValue:K=>u(e.id,K),removeInlineFilterValue:K=>d(e.id,K)}),[e,I,c,u,d]),{cardFilters:E,cardFilterValues:D}=S.useMemo(()=>W0({card:e,interactionStates:N,currentDashboardId:_,filters:k,filterValues:j,selectedSheetId:I}),[e,N,_,k,j,I]),A=S.useCallback((K,O)=>{const U=oL(O);n(V=>({...V,[K]:U}))},[]),P=(X=f.customCardPreferences)==null?void 0:X.componentName,M=P?h(P):null,L=fN((Y=f.customCardPreferences)==null?void 0:Y.settings,f),$=S.useMemo(()=>tL(x),[x]),z=S.useMemo(()=>$.map((K,O)=>Jm(K,O,g==null?void 0:g.slots)),[$,g==null?void 0:g.slots]);return P?l.jsx("div",{className:"semaphor-custom mb-3 flex grow basis-0 flex-col space-y-2 overflow-y-auto",children:l.jsxs(S.Suspense,{fallback:l.jsx(l.Fragment,{}),children:[M&&b==="single"&&l.jsx(M,{editing:!0,params:o,theme:i,settings:L,cardMetadata:Wse({card:e,dataMetadata:C==null?void 0:C.metadata}),onDataChange:A,data:(C==null?void 0:C.records)||[],filters:E,filterValues:[...D||[],...c||[]],inlineFilters:T}),M&&b==="multiple"&&l.jsxs(l.Fragment,{children:[x.map((K,O)=>{if(!K)return null;const U=Xy(K,O),V=Jm(K,U,g==null?void 0:g.slots);return l.jsx(_5,{onDataChange:A,card:K,effectiveCardType:V},`${K.id}-${U}`)}),l.jsx("div",{className:"flex flex-col gap-2",children:l.jsx(M,{editing:!0,onDataChange:A,...sL({configCard:f,slotOrderedCards:$,slotTypes:z,multiInputData:t,params:o,theme:i,chartSettings:L,filters:E,filterValues:[...D||[],...c||[]],inlineFilters:T})})})]})]},(R=f.customCardPreferences)==null?void 0:R.componentName)}):null}const Nwt=S.memo(Cwt,(e,t)=>{var n,r,o,s,i,a,c,u;return e.card.id===t.card.id&&e.card.inlineFilters===t.card.inlineFilters&&((n=e.card.customCardPreferences)==null?void 0:n.settings)===((r=t.card.customCardPreferences)==null?void 0:r.settings)&&((o=e.card.customCardPreferences)==null?void 0:o.slotSettings)===((s=t.card.customCardPreferences)==null?void 0:s.slotSettings)&&((i=e.card.customCardPreferences)==null?void 0:i.url)===((a=t.card.customCardPreferences)==null?void 0:a.url)&&((c=e.card.customCardPreferences)==null?void 0:c.componentName)===((u=t.card.customCardPreferences)==null?void 0:u.componentName)}),_wt=p.create()(p.persist((e,t)=>({starredCharts:[],isStarred:(n,r)=>t().starredCharts.some(o=>o.type===n&&o.id===r),toggleStar:n=>{e(r=>{const o=r.starredCharts.findIndex(s=>s.type===n.type&&s.id===n.id);return o>=0?{starredCharts:r.starredCharts.filter((s,i)=>i!==o)}:{starredCharts:[...r.starredCharts,n]}})},getStarredChart:(n,r)=>t().starredCharts.find(o=>o.type===n&&o.id===r)}),{name:"semaphor-starred-charts"}));var fhe=["PageUp","PageDown"],hhe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],mhe={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Qg="Slider",[OR,kwt,jwt]=p.createCollection(Qg),[phe]=p.createContextScope(Qg,[jwt]),[Twt,Zj]=phe(Qg),ghe=Q.forwardRef((e,t)=>{const{name:n,min:r=0,max:o=100,step:s=1,orientation:i="horizontal",disabled:a=!1,minStepsBetweenThumbs:c=0,defaultValue:u=[r],value:d,onValueChange:f=()=>{},onValueCommit:h=()=>{},inverted:m=!1,form:g,...b}=e,x=Q.useRef(new Set),y=Q.useRef(0),v=i==="horizontal"?Iwt:Ewt,[C=[],N]=p.useControllableState({prop:d,defaultProp:u,onChange:E=>{var A;(A=[...x.current][y.current])==null||A.focus(),f(E)}}),_=Q.useRef(C);function k(E){const D=Pwt(C,E);T(E,D)}function j(E){T(E,y.current)}function I(){const E=_.current[y.current];C[y.current]!==E&&h(C)}function T(E,D,{commit:A}={commit:!1}){const P=$wt(s),M=zwt(Math.round((E-r)/s)*s+r,P),L=p.clamp(M,[r,o]);N(($=[])=>{const z=Awt($,L,D);if(Lwt(z,c*s)){y.current=z.indexOf(L);const W=String(z)!==String($);return W&&A&&h(z),W?z:$}else return $})}return l.jsx(Twt,{scope:e.__scopeSlider,name:n,disabled:a,min:r,max:o,valueIndexToChangeRef:y,thumbs:x.current,values:C,orientation:i,form:g,children:l.jsx(OR.Provider,{scope:e.__scopeSlider,children:l.jsx(OR.Slot,{scope:e.__scopeSlider,children:l.jsx(v,{"aria-disabled":a,"data-disabled":a?"":void 0,...b,ref:t,onPointerDown:p.composeEventHandlers(b.onPointerDown,()=>{a||(_.current=C)}),min:r,max:o,inverted:m,onSlideStart:a?void 0:k,onSlideMove:a?void 0:j,onSlideEnd:a?void 0:I,onHomeKeyDown:()=>!a&&T(r,0,{commit:!0}),onEndKeyDown:()=>!a&&T(o,C.length-1,{commit:!0}),onStepKeyDown:({event:E,direction:D})=>{if(!a){const M=fhe.includes(E.key)||E.shiftKey&&hhe.includes(E.key)?10:1,L=y.current,$=C[L],z=s*M*D;T($+z,L,{commit:!0})}}})})})})});ghe.displayName=Qg;var[bhe,xhe]=phe(Qg,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Iwt=Q.forwardRef((e,t)=>{const{min:n,max:r,dir:o,inverted:s,onSlideStart:i,onSlideMove:a,onSlideEnd:c,onStepKeyDown:u,...d}=e,[f,h]=Q.useState(null),m=p.useComposedRefs(t,v=>h(v)),g=Q.useRef(void 0),b=p.useDirection(o),x=b==="ltr",y=x&&!s||!x&&s;function w(v){const C=g.current||f.getBoundingClientRect(),N=[0,C.width],k=r$(N,y?[n,r]:[r,n]);return g.current=C,k(v-C.left)}return l.jsx(bhe,{scope:e.__scopeSlider,startEdge:y?"left":"right",endEdge:y?"right":"left",direction:y?1:-1,size:"width",children:l.jsx(yhe,{dir:b,"data-orientation":"horizontal",...d,ref:m,style:{...d.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:v=>{const C=w(v.clientX);i==null||i(C)},onSlideMove:v=>{const C=w(v.clientX);a==null||a(C)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:v=>{const N=mhe[y?"from-left":"from-right"].includes(v.key);u==null||u({event:v,direction:N?-1:1})}})})}),Ewt=Q.forwardRef((e,t)=>{const{min:n,max:r,inverted:o,onSlideStart:s,onSlideMove:i,onSlideEnd:a,onStepKeyDown:c,...u}=e,d=Q.useRef(null),f=p.useComposedRefs(t,d),h=Q.useRef(void 0),m=!o;function g(b){const x=h.current||d.current.getBoundingClientRect(),y=[0,x.height],v=r$(y,m?[r,n]:[n,r]);return h.current=x,v(b-x.top)}return l.jsx(bhe,{scope:e.__scopeSlider,startEdge:m?"bottom":"top",endEdge:m?"top":"bottom",size:"height",direction:m?1:-1,children:l.jsx(yhe,{"data-orientation":"vertical",...u,ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:b=>{const x=g(b.clientY);s==null||s(x)},onSlideMove:b=>{const x=g(b.clientY);i==null||i(x)},onSlideEnd:()=>{h.current=void 0,a==null||a()},onStepKeyDown:b=>{const y=mhe[m?"from-bottom":"from-top"].includes(b.key);c==null||c({event:b,direction:y?-1:1})}})})}),yhe=Q.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:o,onSlideEnd:s,onHomeKeyDown:i,onEndKeyDown:a,onStepKeyDown:c,...u}=e,d=Zj(Qg,n);return l.jsx(p.Primitive.span,{...u,ref:t,onKeyDown:p.composeEventHandlers(e.onKeyDown,f=>{f.key==="Home"?(i(f),f.preventDefault()):f.key==="End"?(a(f),f.preventDefault()):fhe.concat(hhe).includes(f.key)&&(c(f),f.preventDefault())}),onPointerDown:p.composeEventHandlers(e.onPointerDown,f=>{const h=f.target;h.setPointerCapture(f.pointerId),f.preventDefault(),d.thumbs.has(h)?h.focus():r(f)}),onPointerMove:p.composeEventHandlers(e.onPointerMove,f=>{f.target.hasPointerCapture(f.pointerId)&&o(f)}),onPointerUp:p.composeEventHandlers(e.onPointerUp,f=>{const h=f.target;h.hasPointerCapture(f.pointerId)&&(h.releasePointerCapture(f.pointerId),s(f))})})}),vhe="SliderTrack",whe=Q.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,o=Zj(vhe,n);return l.jsx(p.Primitive.span,{"data-disabled":o.disabled?"":void 0,"data-orientation":o.orientation,...r,ref:t})});whe.displayName=vhe;var LR="SliderRange",She=Q.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,o=Zj(LR,n),s=xhe(LR,n),i=Q.useRef(null),a=p.useComposedRefs(t,i),c=o.values.length,u=o.values.map(h=>_he(h,o.min,o.max)),d=c>1?Math.min(...u):0,f=100-Math.max(...u);return l.jsx(p.Primitive.span,{"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,...r,ref:a,style:{...e.style,[s.startEdge]:d+"%",[s.endEdge]:f+"%"}})});She.displayName=LR;var $R="SliderThumb",Che=Q.forwardRef((e,t)=>{const n=kwt(e.__scopeSlider),[r,o]=Q.useState(null),s=p.useComposedRefs(t,a=>o(a)),i=Q.useMemo(()=>r?n().findIndex(a=>a.ref.current===r):-1,[n,r]);return l.jsx(Dwt,{...e,ref:s,index:i})}),Dwt=Q.forwardRef((e,t)=>{const{__scopeSlider:n,index:r,name:o,...s}=e,i=Zj($R,n),a=xhe($R,n),[c,u]=Q.useState(null),d=p.useComposedRefs(t,w=>u(w)),f=c?i.form||!!c.closest("form"):!0,h=p.useSize(c),m=i.values[r],g=m===void 0?0:_he(m,i.min,i.max),b=Rwt(r,i.values.length),x=h==null?void 0:h[a.size],y=x?Fwt(x,g,a.direction):0;return Q.useEffect(()=>{if(c)return i.thumbs.add(c),()=>{i.thumbs.delete(c)}},[c,i.thumbs]),l.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[a.startEdge]:`calc(${g}% + ${y}px)`},children:[l.jsx(OR.ItemSlot,{scope:e.__scopeSlider,children:l.jsx(p.Primitive.span,{role:"slider","aria-label":e["aria-label"]||b,"aria-valuemin":i.min,"aria-valuenow":m,"aria-valuemax":i.max,"aria-orientation":i.orientation,"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,tabIndex:i.disabled?void 0:0,...s,ref:d,style:m===void 0?{display:"none"}:e.style,onFocus:p.composeEventHandlers(e.onFocus,()=>{i.valueIndexToChangeRef.current=r})})}),f&&l.jsx(Nhe,{name:o??(i.name?i.name+(i.values.length>1?"[]":""):void 0),form:i.form,value:m},r)]})});Che.displayName=$R;var Mwt="RadioBubbleInput",Nhe=Q.forwardRef(({__scopeSlider:e,value:t,...n},r)=>{const o=Q.useRef(null),s=p.useComposedRefs(o,r),i=p.usePrevious(t);return Q.useEffect(()=>{const a=o.current;if(!a)return;const c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&d){const f=new Event("input",{bubbles:!0});d.call(a,t),a.dispatchEvent(f)}},[i,t]),l.jsx(p.Primitive.input,{style:{display:"none"},...n,ref:s,defaultValue:t})});Nhe.displayName=Mwt;function Awt(e=[],t,n){const r=[...e];return r[n]=t,r.sort((o,s)=>o-s)}function _he(e,t,n){const s=100/(n-t)*(e-t);return p.clamp(s,[0,100])}function Rwt(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function Pwt(e,t){if(e.length===1)return 0;const n=e.map(o=>Math.abs(o-t)),r=Math.min(...n);return n.indexOf(r)}function Fwt(e,t,n){const r=e/2,s=r$([0,50],[0,r]);return(r-s(t)*n)*n}function Owt(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function Lwt(e,t){if(t>0){const n=Owt(e);return Math.min(...n)>=t}return!0}function r$(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function $wt(e){return(String(e).split(".")[1]||"").length}function zwt(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var khe=ghe,Bwt=whe,Vwt=She,Hwt=Che;const jhe=Q.forwardRef(({className:e,...t},n)=>l.jsxs(khe,{ref:n,className:p.cn("relative flex w-full touch-none select-none items-center",e),...t,children:[l.jsx(Bwt,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:l.jsx(Vwt,{className:"absolute h-full bg-primary"})}),l.jsx(Hwt,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));jhe.displayName=khe.displayName;const The=["SUN","MON","TUE","WED","THU","FRI","SAT"],Uwt=The.reduce((e,t,n)=>({...e,[t]:n}),{}),$l={repeats:"weekly",hour:9,minute:0,weekdays:[1,2,3,4,5],isCustom:!1};function qwt(e){if(!e||!e.trim())return{...$l};const t=e.trim(),r=(t.startsWith("cron(")&&t.endsWith(")")?t.slice(5,-1):t).trim().split(/\s+/);if(r.length<5||r.length>6)return{...$l,isCustom:!0};const[o,s,i,a,c]=r,u=Number(o),d=Number(s);if(!Number.isInteger(u)||u<0||u>59||!Number.isInteger(d)||d<0||d>23)return{...$l,isCustom:!0};if(i==="*"&&(c==="?"||c==="*"))return{...$l,repeats:"daily",hour:d,minute:u};if(i==="?"&&c!=="?"&&c!=="*"){const h=c.split(",").map(m=>m.toUpperCase()).map(m=>Uwt[m]).filter(m=>typeof m=="number");if(h.length>0)return{...$l,repeats:"weekly",hour:d,minute:u,weekdays:h}}return i==="1,15"&&(c==="?"||c==="*")?{...$l,repeats:"biweekly",hour:d,minute:u}:i==="1"&&(c==="?"||c==="*")?{...$l,repeats:"monthly",hour:d,minute:u}:{...$l,hour:d,minute:u,isCustom:!0}}function Wwt(e){const t=e.minute,n=e.hour;switch(e.repeats){case"daily":return`cron(${t} ${n} * * ? *)`;case"weekly":{const r=e.weekdays.length>0?e.weekdays.slice().sort((o,s)=>o-s).map(o=>The[o]).join(","):"MON";return`cron(${t} ${n} ? * ${r} *)`}case"biweekly":return`cron(${t} ${n} 1,15 * ? *)`;case"monthly":return`cron(${t} ${n} 1 * ? *)`}}function Ihe(e,t){const n=e<12?"AM":"PM",r=e%12===0?12:e%12,o=t.toString().padStart(2,"0");return`${r}:${o} ${n}`}function Gwt(e){return!e||e==="UTC"?"UTC":(e.split("/").pop()??e).replace(/_/g," ")}function Ywt(e){if(e.length===7)return"every day";const t=e.slice().sort((o,s)=>o-s);if(t.length===5&&t.every(o=>o>=1&&o<=5))return"weekdays";const r=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];return t.map(o=>r[o]).join(", ")}function Kwt(e,t,n,r){const o=Ihe(e.hour,e.minute),s=Gwt(t);let i;if(e.isCustom)i=`Custom schedule · ${o} ${s}`;else switch(e.repeats){case"daily":i=`Daily at ${o} ${s}`;break;case"weekly":i=`Weekly · ${Ywt(e.weekdays)} at ${o} ${s}`;break;case"biweekly":i=`Every two weeks (1st and 15th) at ${o} ${s}`;break;case"monthly":i=`Monthly on the 1st at ${o} ${s}`;break}const a=[];return n&&n!=="Today"&&a.push(`from ${n}`),r&&a.push(`until ${r}`),a.length>0?`${i}, ${a.join(" ")}`:i}const Zwt=["UTC","America/New_York","America/Chicago","America/Denver","America/Los_Angeles","Europe/London","Europe/Berlin","Asia/Singapore","Asia/Tokyo","Australia/Sydney"];exports.Accordion=HL;exports.AccordionContent=c0;exports.AccordionItem=a0;exports.AccordionTrigger=l0;exports.AddDataPicker=D3;exports.AggregateTable=Sk;exports.Alert=wF;exports.AlertDescription=SF;exports.AlertDialog=jh;exports.AlertDialogAction=ld;exports.AlertDialogCancel=cd;exports.AlertDialogContent=rd;exports.AlertDialogDescription=ad;exports.AlertDialogFooter=sd;exports.AlertDialogHeader=od;exports.AlertDialogTitle=id;exports.AlertDialogTrigger=lye;exports.AlertTitle=JZ;exports.ArrowDown=bo;exports.ArrowDownIcon=Yqe;exports.ArrowLeft=R0;exports.ArrowRight=t_;exports.ArrowUp=Ro;exports.ArrowUpIcon=Zqe;exports.AssistantContextEntityControls=SR;exports.AssistantVirtualizedMessages=the;exports.AtSign=Qq;exports.AxisConfigurator=lg;exports.Badge=co;exports.Bell=e1;exports.BookType=eW;exports.BulletChartIcon=Gfe;exports.COMMON_TIMEZONES=Zwt;exports.CSS=bi;exports.CalculatedFieldEditor=ole;exports.Calculator=nW;exports.Calendar=ii;exports.Calendar$1=j1;exports.CalendarRange=rW;exports.Card=cy;exports.CardContent=JR;exports.CardHeader=QR;exports.CardSummary=WA;exports.CardTitle=Jp;exports.ChartArea=h2;exports.ChartColumnIncreasing=oW;exports.ChartColumnStacked=sW;exports.ChartJsVisual=vv;exports.ChartLine=iW;exports.ChartNoAxesGantt=lW;exports.ChartPie=cW;exports.ChartScatter=uW;exports.ChatInputWithContext=M3;exports.Checkbox=Tn;exports.ChevronLeft=Ch;exports.ChevronsUpDown=hW;exports.Circle=eP;exports.CircleAlert=Wf;exports.CircleCheck=mW;exports.CircleHelp=pW;exports.Clock=tP;exports.CodeHighlighter=Hf;exports.CodeXml=t1;exports.Collapsible=Cc;exports.CollapsibleContent=_c;exports.CollapsibleTrigger=Nc;exports.ColorField=Ri;exports.Command=hj;exports.CommandEmpty=pj;exports.CommandGroup=gj;exports.CommandInput=DL;exports.CommandItem=bj;exports.CommandList=mj;exports.CommandSeparator=Nae;exports.ComparisonMetadataBadge=Nee;exports.Container=_P;exports.ControlDefaultValueEditor=kle;exports.ControlDefinitionOptionsEditor=_le;exports.ControlIdInput=wle;exports.ControlVisibilitySettings=att;exports.Copy=Du;exports.CopyButton=Iu;exports.CopyPlus=p2;exports.Cross2Icon=eWe;exports.CustomFilterPopover=X5;exports.CustomScrollArea=Ea;exports.DEFAULT_HEATMAP_CUSTOM_RANGE=kJ;exports.DEFAULT_SCHEDULE_VM=$l;exports.Dashboard=che;exports.DashboardCard=Eie;exports.DashboardCreateDialogBase=lY;exports.DashboardExportDialog=nhe;exports.DashboardPlus=ewt;exports.DashboardWC=gwt;exports.DataTableConditionalFormattingSettings=mce;exports.DataTablePagination=dk;exports.Database=Bi;exports.DateRangePicker=D5;exports.DefaultChatTransport=C3;exports.Dialog=ks;exports.DialogContent=ls;exports.DialogDescription=Gs;exports.DialogFooter=Ic;exports.DialogHeader=Xi;exports.DialogTitle=cs;exports.DialogTrigger=sY;exports.DisplayPreferencesProvider=nj;exports.DndContext=zv;exports.Donut=gW;exports.Download=jc;exports.DownloadPdf=rhe;exports.DragOverlay=uae;exports.DropdownMenu=Bo;exports.DropdownMenuCheckboxItem=Zc;exports.DropdownMenuContent=ko;exports.DropdownMenuItem=Sn;exports.DropdownMenuLabel=fa;exports.DropdownMenuRadioGroup=pbe;exports.DropdownMenuRadioItem=DG;exports.DropdownMenuSeparator=qi;exports.DropdownMenuSub=gP;exports.DropdownMenuSubContent=c_;exports.DropdownMenuSubTrigger=l_;exports.DropdownMenuTrigger=Vo;exports.EMPTY_DATA_SOURCE=Zp;exports.Editable=mN;exports.EditableText=Hs;exports.EditorCustomVisual=Nwt;exports.Ellipsis=ui;exports.EllipsisVertical=Nh;exports.ErrorBoundary=ka;exports.ExportError=pg;exports.ExternalLink=xp;exports.EyeOff=n_;exports.Fallback=ej;exports.FallbackVisual=Jy;exports.FeedbackCategory=td;exports.FeedbackDialog=S0;exports.FieldsList=XL;exports.FieldsSection=bwt;exports.FileCode=bW;exports.FileSpreadsheet=xW;exports.FileText=di;exports.Filter=Gf;exports.FilterComponent=Gk;exports.FilterInfo=VA;exports.FilterableFieldsPanel=ile;exports.Globe=_h;exports.Grid3x3=g2;exports.GripVertical=Tc;exports.HEATMAP_PRESET_PALETTES=CM;exports.Hash=yW;exports.House=vW;exports.HoverCard=gg;exports.HoverCardContent=Vu;exports.HoverCardTrigger=bg;exports.INLINE_ALLOWED_READ_ONLY_TOOLS=dhe;exports.INLINE_ALLOWED_TOOL_LIST=ywt;exports.INLINE_BLOCKED_MUTATING_TOOLS=xwt;exports.IconButton=uc;exports.IconForFieldType=R1;exports.InfoHover=yL;exports.InlineFilterBar=vie;exports.KPICard=Ku;exports.KeyboardSensor=Lv;exports.Layers=P0;exports.LayoutDashboard=Yf;exports.Link=nP;exports.LoadingDots=Uu;exports.Lock=r_;exports.MAX_SELF_HEAL_ATTEMPTS=vwt;exports.Map=CW;exports.Markdown=cfe;exports.MatrixTableVisual=wk;exports.MdStackedLineChart=qfe;exports.MultiInputEmptyRenderer=_5;exports.PYTHON_DEFAULT_CODE=BR;exports.PanelResizeHandle=Rj;exports.Paperclip=NW;exports.PenLine=b2;exports.Pencil=x2;exports.PendingMessagesDisplay=Nde;exports.PersistedDynamicVisual=tj;exports.PiChartPolar=Bfe;exports.Pin=kW;exports.PinOff=_W;exports.PivotTableTanstack=Og;exports.Placeholders=Bce;exports.Play=jW;exports.Plus=kr;exports.PointerSensor=Hg;exports.Progress=I3;exports.RECOVERABLE_SQL_ERROR_CODES=Swt;exports.Radar=TW;exports.RadioGroup=Ca;exports.RadioGroupItem=Co;exports.RefreshCw=Kf;exports.ResizableHandle=bst;exports.ResizablePanel=uR;exports.ResizablePanelGroup=zce;exports.ResourceEditDialog=$Y;exports.ResourceType=Zr;exports.SELF_HEAL_TIMELINE_STEP=wwt;exports.SeedQuestions=cde;exports.SemaphorContext=D0;exports.SemaphorContextProvider=YR;exports.SemaphorQueryClient=Wq;exports.SemaphorReadyIndicator=n$;exports.SemaphorStyleWrapper=Lg;exports.Send=IW;exports.Settings=rP;exports.Settings2=F0;exports.Share2=EW;exports.ShareDialog=LY;exports.Sheet=fee;exports.SheetContent=SO;exports.SheetDescription=NO;exports.SheetHeader=mee;exports.SheetTitle=CO;exports.SheetTrigger=lFe;exports.Slider=jhe;exports.SortableContext=Bv;exports.Sparkles=Z1;exports.Square=sP;exports.SquarePen=oP;exports.Star=DW;exports.StructuralParticipantSelector=Sle;exports.SummaryCard=$A;exports.TABLE_PRESENTATION_DEFAULT_STYLE=ju;exports.TABLE_PRESENTATION_DEFAULT_TOTALS_STYLE=Oi;exports.TableBody=Bu;exports.TableCell=An;exports.TableColumnVisibilitySettings=nce;exports.TableHead=to;exports.TableHeader=Lh;exports.TablePresentationSettings=oce;exports.TableRow=Sr;exports.TableSkeleton=vL;exports.TableVisual=Hu;exports.TbChartBubble=Vfe;exports.TbChartFunnel=Hfe;exports.TbChartTreemap=Ufe;exports.TextCard=Hp;exports.Textarea=Ih;exports.TiSortNumerically=Wfe;exports.Toggle=Qk;exports.Tornado=MW;exports.Trash2=hl;exports.TreePalm=aP;exports.TrendingUp=AW;exports.TriangleAlert=Vi;exports.TypeGlyph=Av;exports.UXProvider=t$;exports.User=RW;exports.Users=s_;exports.applyFilterOverridesToDashboardInputSlots=vZ;exports.areContextEntitiesEqual=Jn;exports.areEntitiesJoined=DJ;exports.arrayMove=Ug;exports.buildCardControlUsageById=ctt;exports.buildCustomCardTheme=Tv;exports.buildDashboardCardExecutionSnapshot=yZ;exports.buildDashboardControlUsageById=ltt;exports.buildDashboardExecutionSnapshot=pF;exports.buildDashboardInputExecutionSnapshot=wu;exports.buildDashboardSheetsInputExecutionSnapshot=SZ;exports.buildDashboardStructuralParticipantIdsByControlId=Ile;exports.buildFilterFieldMeta=OL;exports.buildFilterSemanticContext=LL;exports.buildInlineFilterNodes=J5;exports.buildMultiInputCustomVisualProps=sL;exports.buildScheduleExpr=Wwt;exports.buildSchedulePreview=Kwt;exports.buildSlotOrderedCards=tL;exports.calculateContextAwareFilters=W0;exports.calculateFieldState=hO;exports.canUserAccessVisuals=m0e;exports.canUserCreateDashboards=VY;exports.canUserEdit=d0e;exports.canUserManageDashboards=h0e;exports.canUserManageGroups=p0e;exports.canUserUseFilters=f0e;exports.cancelExport=XRe;exports.chartSupportsDataLabels=CQ;exports.chartSupportsLegend=wQ;exports.chartTypes=Kj;exports.cleanupKpiMetricComparisonMode=Mae;exports.cloneDeep=$s;exports.cloneLinkedFrameWithSourceMapping=fYe;exports.closestCenter=Ov;exports.commitSharedCalculatedFields=Gd;exports.createAssistantConversationId=Am;exports.createAssistantRequestId=ade;exports.createCardsFromSlots=jWe;exports.createChartConfig=mg;exports.createDashboardControlInputFromControl=oot;exports.createDefaultGlobalDateFilter=k1e;exports.createExport=XJ;exports.createUniqueDashboardInputVariableNameFromName=Eu;exports.dedup=fdt;exports.doesStoredFilterMatchField=Yp;exports.downloadDocumentPdf=bF;exports.downloadPdf=IZ;exports.extractSqlParamReferences=Aoe;exports.extractTableMetadata=FL;exports.fieldAlreadyExists=AJ;exports.findCustomVisualConfigCard=rL;exports.findDashboardFrameById=h1e;exports.flexRender=Bs;exports.formatDisplayFormula=tJe;exports.formatFileSize=ePe;exports.formatFilterLine=tX;exports.formatTimeLabel=Ihe;exports.getAutoDetectedChartIcon=T0t;exports.getChartGridStyle=e_e;exports.getChartIconByType=I0t;exports.getColorForValue=z2;exports.getConfigSlotExpectedType=kWe;exports.getCoreRowModel=lk;exports.getCustomVisualInputCards=nL;exports.getDateFormatOptionsForGranularity=s0;exports.getDefaultAxisConfig=V2;exports.getDefaultChartColors=Ph;exports.getDefaultDataLabelsConfig=rv;exports.getDefaultExportFormat=xX;exports.getDefaultFilterSql=F5;exports.getDefaultLegendConfig=ZF;exports.getDefaultRunningTotalPartitionByFieldIds=ey;exports.getDocumentSectionEditorCard=zet;exports.getDocumentSheetDashboardInputs=Wv;exports.getDownloadUrl=ZRe;exports.getEffectiveCardTypeForSlot=Jm;exports.getEntityIcon=qN;exports.getErrorMessage=Kue;exports.getExportStatus=KRe;exports.getExports=YRe;exports.getExpressionFieldKind=Xu;exports.getFieldExpressionAnnotation=$L;exports.getFilterCount=yN;exports.getGlobalDateFilter=Ah;exports.getGlobalDateFilterCoverage=yi;exports.getGranularityOptionsForFieldType=r3;exports.getKeys=cr;exports.getMatrixVisualLoadingState=vk;exports.getMetricDisplayLabel=gRe;exports.getNewField=LJ;exports.getObjectDiff=kq;exports.getPaginationRowModel=ck;exports.getRoleBasedDisplayOverrides=BY;exports.getRunningTotalOrderByCandidates=NQe;exports.getSelectedDateFilterColumn=Poe;exports.getSheetScopedFilterValues=py;exports.getSlotDefinitionForIndex=eL;exports.getSlotExpectedChartType=Zk;exports.getSlotIndexForCard=Xy;exports.getSortedRowModel=uee;exports.getSupportedExportFormats=bX;exports.getTableConditionalFormattingColumnOptions=lce;exports.getTableOutputColumnOptions=cce;exports.getTablePageSizeOptions=YJ;exports.handleAggregationChange=HA;exports.handleAggregationLabelChange=xie;exports.hasFlatTableTotalsBehavior=NCe;exports.hasMatrixResultData=av;exports.horizontalListSortingStrategy=jL;exports.isCalculatedFilterField=i0;exports.isCardSummaryVisibleOnCard=iL;exports.isCustomVisualConfigCard=OA;exports.isDefaultColor=ACe;exports.isEligibleFlatTableTotalsCard=rg;exports.isExportComplete=JRe;exports.isExportInProgress=QRe;exports.isInAiScopeArray=ddt;exports.isManagedCalculatedExpressionField=ya;exports.isMetricTransformEnabled=SQe;exports.isPromiseLike=wR;exports.isSubtotalEnabledAggregateTable=PL;exports.isSupportedDocumentTableCardType=Bet;exports.lastAssistantMessageIsCompleteWithToolCalls=que;exports.merge=fl;exports.mergeAxisConfig=H2;exports.normalizeConditionalFormatting=lF;exports.normalizeContextFormatMode=aX;exports.normalizeDashboardInputVariableName=A0;exports.normalizeMultiInputPayload=oL;exports.parseScheduleExpr=qwt;exports.pivotData=Z0;exports.prepareFeedbackData=Yj;exports.purify=bA;exports.reindexSlotCards=_We;exports.remarkGfm=Ofe;exports.removeFromScopeArray=hdt;exports.resolveDashboardInputContext=_l;exports.resolveDomainCalculatedFieldForEdit=ZJe;exports.resolveMultiInputType=Iv;exports.resolveMultiInputTypeFromVisual=TWe;exports.resolveTablePageSize=sk;exports.resolveTablePresentationStyle=MO;exports.sanitizeAIScope=Yue;exports.saveCalculatedFieldToCardScope=tR;exports.saveCalculatedFieldToSharedScope=sle;exports.saveCalculatedFieldToSheetScope=nR;exports.seedSemanticMetricFormatDefaults=Rae;exports.setTableColumnVisibility=eee;exports.setupEditorWithCard=L_;exports.showAllTableColumns=oPe;exports.showJoinRequiredNotification=MJ;exports.sortByColumnsToSortState=Ree;exports.sortStateToSortByColumns=Pee;exports.sortableKeyboardCoordinates=IL;exports.supportsMetricTransformForMetric=Aae;exports.supportsTableConditionalFormatting=sce;exports.toEntityArray=xa;exports.ue=rt;exports.useActiveExports=C0e;exports.useActiveToolStatus=kde;exports.useAddFrameWithFreshSemanticExecutionPayload=xL;exports.useAddNewFrame=zie;exports.useAssistantContainer=qY;exports.useAssistantContextEntities=oj;exports.useAssistantLayoutStore=kf;exports.useAssistantPanel=HY;exports.useAssistantProfile=lde;exports.useAutoSubmitQueue=_de;exports.useBrandStudioPreview=Bvt;exports.useCard=TRe;exports.useCardFilterValues=zJ;exports.useCardSummary=aL;exports.useChat=Gue;exports.useColumns=ML;exports.useCreateVisualWithFrame=dxe;exports.useCurrentUserInfo=Zi;exports.useCustomVisual=Vh;exports.useCustomVisualsQuery=Z5;exports.useDashboardAppearance=Mc;exports.useDashboardById=zG;exports.useDashboardPreferences=eg;exports.useDashboardQuery=M0;exports.useDashboardStructuralParticipants=Ele;exports.useDashboardSummary=tie;exports.useDataColumns=Fae;exports.useDateFilterHook=i7e;exports.useDebounce=Yx;exports.useDefaultDashboardMutation=AG;exports.useDisplayPreferences=Nl;exports.useDroppable=cae;exports.useEditorAside=xj;exports.useEditorCardQuery=O_;exports.useEnsureReactGlobals=loe;exports.useExportActions=WY;exports.useExportStore=b_;exports.useFieldManagement=Pae;exports.useFilterableFields=Iae;exports.useFullscreenAssistant=UY;exports.useGroupMembers=hye;exports.useGroups=EY;exports.useHasDashboardId=GY;exports.useInProgressExportsCount=N0e;exports.useJoinabilityMap=RL;exports.useManagementActions=Sh;exports.useManagementStore=$o;exports.useMutation=ss;exports.usePivotTableConfig=Oh;exports.usePluginQuery=Bse;exports.useQuery=Rn;exports.useQueryClient=Xr;exports.useReactTable=uk;exports.useResolveExistingFrameSemanticExecutionPayload=gYe;exports.useResourceManagement=xP;exports.useResourceUpdateState=BG;exports.useScopedFields=Tae;exports.useSelectedVisual=epe;exports.useSemaphorContext=bt;exports.useSensor=Gp;exports.useSensors=lj;exports.useSortable=qg;exports.useStarredChartsStore=_wt;exports.useSurfaceAppearance=Dc;exports.useTableQueryState=_ee;exports.useTextFilterHook=b7e;exports.useTheme=VR;exports.useTopoJson=sv;exports.useUnifiedUsers=CP;exports.useUpdateResource=FG;exports.useUpdateVisualMutation=fxe;exports.useUserPreferences=cY;exports.useVisualById=d_;exports.useVisualManagement=uxe;exports.validateFieldForChartType=Dae;exports.verticalListSortingStrategy=TL;
|
|
@@ -8544,12 +8544,13 @@ function O1e({
|
|
|
8544
8544
|
onOpenChange: t,
|
|
8545
8545
|
onCreateBlank: n,
|
|
8546
8546
|
onAiCreateSuccess: r,
|
|
8547
|
-
isCreatingBlank: o
|
|
8547
|
+
isCreatingBlank: o,
|
|
8548
|
+
initialDomainId: i
|
|
8548
8549
|
}) {
|
|
8549
|
-
const
|
|
8550
|
-
suggestDashboards:
|
|
8551
|
-
planDashboard:
|
|
8552
|
-
createDashboardFromPlan:
|
|
8550
|
+
const a = T1e(e), {
|
|
8551
|
+
suggestDashboards: s,
|
|
8552
|
+
planDashboard: l,
|
|
8553
|
+
createDashboardFromPlan: c
|
|
8553
8554
|
} = E1e();
|
|
8554
8555
|
return /* @__PURE__ */ d(
|
|
8555
8556
|
F1e,
|
|
@@ -8559,11 +8560,12 @@ function O1e({
|
|
|
8559
8560
|
onCreateBlank: n,
|
|
8560
8561
|
onAiCreateSuccess: r,
|
|
8561
8562
|
isCreatingBlank: o,
|
|
8562
|
-
sources:
|
|
8563
|
-
sourcesLoading:
|
|
8564
|
-
suggestDashboards:
|
|
8565
|
-
planDashboard:
|
|
8566
|
-
createDashboardFromPlan:
|
|
8563
|
+
sources: a.data || [],
|
|
8564
|
+
sourcesLoading: a.isLoading,
|
|
8565
|
+
suggestDashboards: s.mutateAsync,
|
|
8566
|
+
planDashboard: l,
|
|
8567
|
+
createDashboardFromPlan: c,
|
|
8568
|
+
initialDomainId: i
|
|
8567
8569
|
}
|
|
8568
8570
|
);
|
|
8569
8571
|
}
|
|
@@ -143178,9 +143180,9 @@ function z_t() {
|
|
|
143178
143180
|
}
|
|
143179
143181
|
);
|
|
143180
143182
|
}
|
|
143181
|
-
const V_t = qk(() => import("./dashboard-controls-
|
|
143182
|
-
() => import("./edit-dashboard-visual-
|
|
143183
|
-
), j_t = qk(() => import("./dashboard-json-
|
|
143183
|
+
const V_t = qk(() => import("./dashboard-controls-D4jS0E-d.js")), B_t = qk(
|
|
143184
|
+
() => import("./edit-dashboard-visual-DlWURcWJ.js")
|
|
143185
|
+
), j_t = qk(() => import("./dashboard-json-Bt_MiK2h.js"));
|
|
143184
143186
|
function fTt({
|
|
143185
143187
|
showControls: e = !1,
|
|
143186
143188
|
showFooter: t = !0,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { c as ge, X as et, C as je } from "./x-CXDkqdur.js";
|
|
2
2
|
import { useState as K, useEffect as ie, useCallback as B, useMemo as P, useRef as Se, Fragment as bt } from "react";
|
|
3
3
|
import { F as de, A as Le, u as Z, E as M, a4 as yt, Q as vt, V as xt, W as Ct, c as fe, Y as kt, a5 as St, B as q, d as Nt, e as tt, a6 as wt, a7 as Dt, a8 as pe, a9 as Qe, aa as $e, ab as Ne, ac as we, ad as Et, ae as Pe, af as It, ag as Ft, ah as me, ai as Vt, aj as He, ak as at, al as rt, am as st, L as oe, Z as nt, _ as De, $ as Ee, a0 as Ie, a1 as Fe, a2 as Ve, an as ot, ao as Tt, ap as _t, aq as We, ar as Lt, as as Ke, at as At, au as Te } from "./switch-CXMExaSF.js";
|
|
4
|
-
import { aB as qt, u as Mt, aC as ce, aD as Ot, aE as Ae, aF as zt, aG as Ut, aH as Bt, p as R, aI as Rt, aJ as jt, aK as lt, aL as Qt, aM as $t, aN as Pt, aO as Ht, aP as Wt, y as Kt, aQ as Yt, aR as it, aS as dt, aT as Gt, aU as Jt, aV as Xt, aW as Zt, aX as ea, aY as ct, aZ as ut, a_ as ta, a$ as aa, b0 as ra, b1 as sa, b2 as na, ar as oa, b3 as la, b4 as ia } from "./index-
|
|
4
|
+
import { aB as qt, u as Mt, aC as ce, aD as Ot, aE as Ae, aF as zt, aG as Ut, aH as Bt, p as R, aI as Rt, aJ as jt, aK as lt, aL as Qt, aM as $t, aN as Pt, aO as Ht, aP as Wt, y as Kt, aQ as Yt, aR as it, aS as dt, aT as Gt, aU as Jt, aV as Xt, aW as Zt, aX as ea, aY as ct, aZ as ut, a_ as ta, a$ as aa, b0 as ra, b1 as sa, b2 as na, ar as oa, b3 as la, b4 as ia } from "./index-t_L3sxNY.js";
|
|
5
5
|
import { jsx as a, jsxs as m, Fragment as re } from "react/jsx-runtime";
|
|
6
6
|
import "./analyze-result-contract-BUgK3759.js";
|
|
7
7
|
import { S as pt } from "./save-DgMfP0j8.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const W=require("./x-B6ghREd2.js"),C=require("react"),s=require("./switch-oim6Xl36.js"),f=require("./index-
|
|
1
|
+
"use strict";const W=require("./x-B6ghREd2.js"),C=require("react"),s=require("./switch-oim6Xl36.js"),f=require("./index-DfV9K_Ke.js"),e=require("react/jsx-runtime");require("./analyze-result-contract-S8u7CcPL.js");const ke=require("./save-C__QggEE.js"),ye=require("./search-DNCejM7Z.js");/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
package/dist/dashboard/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../chunks/index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../chunks/index-DfV9K_Ke.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;
|
package/dist/dashboard/index.js
CHANGED
|
@@ -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/index-
|
|
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/index-DfV9K_Ke.js"),w=require("../chunks/switch-oim6Xl36.js"),Ze=require("../data-app-builder-browser-runtime/index.cjs"),Q=require("../chunks/x-B6ghREd2.js"),Cn=require("../chunks/save-C__QggEE.js"),tt=require("../chunks/search-DNCejM7Z.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 Yn from "react";
|
|
3
3
|
import { useContext as Zn, 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 { ae as ea, af as ta, ag as Ir, ah as jr, ai as zr, aj as ra, ak as Wr, al as Hr, am as Jr, an as Vr, ao as _r, ap as Ur, aq as Gr, ar as na, as as aa, at as oa, au as Ht, av as on, x as Kr, aw as sa, ax as Vt, ay as sn, az as ia, aA as la } from "../chunks/index-
|
|
5
|
+
import { ae as ea, af as ta, ag as Ir, ah as jr, ai as zr, aj as ra, ak as Wr, al as Hr, am as Jr, an as Vr, ao as _r, ap as Ur, aq as Gr, ar as na, as as aa, at as oa, au as Ht, av as on, x as Kr, aw as sa, ax as Vt, ay as sn, az as ia, aA as la } from "../chunks/index-t_L3sxNY.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, e as me, R as ma, d as _t } from "../chunks/switch-CXMExaSF.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/x-CXDkqdur.js";
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-CiqoOZXW.js"),d=require("./chunks/common-types-C73-Ud1-.js"),N=require("./chunks/calendar-preferences-dialog-CGTZM3U8.js"),t=require("react/jsx-runtime"),a=require("./chunks/switch-oim6Xl36.js"),C=require("react"),y=require("./types/index.cjs"),r=require("./chunks/dashboard-briefing-launcher-wngYnkEs.js"),P=require("./chunks/use-debounced-dirty-check-XHSwAefL.js");require("./chunks/analyze-result-contract-S8u7CcPL.js");require("react-dom");require("./chunks/index-DRlMUglg.js");const S=require("./chunks/normalize-dashboard-for-dirty-check-BXRUMVb2.js"),_=require("./chunks/x-B6ghREd2.js");function R(i){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const n in i)if(n!=="default"){const u=Object.getOwnPropertyDescriptor(i,n);Object.defineProperty(o,n,u.get?u:{enumerable:!0,get:()=>i[n]})}}return o.default=i,Object.freeze(o)}const h=R(C);function w(i){const{displayPreferences:o,cardId:n,...u}=i,s={...u,id:i.dashboardId};return t.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:t.jsxs(e.SemaphorContextProvider,{dashboardProps:s,children:[t.jsx(e.SemaphorReadyIndicator,{componentType:"visual",componentId:i.cardId}),t.jsx(e.UXProvider,{appearance:i.appearance,children:t.jsx(e.DisplayPreferencesProvider,{displayPreferences:o,children:t.jsx(e.Container,{type:"visual",cardId:n,...s,children:t.jsx(j,{cardId:n})})})})]})})}function j({cardId:i}){const o=a.useDashboardStore(s=>{var c;return(c=s.dashboard)==null?void 0:c.sheets}),{card:n,frame:u}=C.useMemo(()=>{const s=o==null?void 0:o.flatMap(l=>l.frames),c=s==null?void 0:s.flatMap(l=>l==null?void 0:l.cards),D=c==null?void 0:c.find(l=>(l==null?void 0:l.id)===i),E=s==null?void 0:s.find(l=>{var p;return(p=l==null?void 0:l.cards)==null?void 0:p.find(g=>(g==null?void 0:g.id)===i)});return{card:D,frame:E}},[o,i]);return!n||!u?t.jsx(e.FallbackVisual,{error:new Error("Card not found"),resetErrorBoundary:()=>{},customerFacingMessage:`Card not found with ID: ${i}`}):t.jsx("main",{className:"flex h-full grow flex-col",children:t.jsx(e.ErrorBoundary,{FallbackComponent:({error:s,resetErrorBoundary:c})=>t.jsx(e.FallbackVisual,{error:s,resetErrorBoundary:c,customerFacingMessage:"Error creating visual. Please try again."}),children:t.jsx(e.DashboardCard,{card:n,frame:u})})})}function L(i,o,n,u){C.useEffect(()=>{i&&!n&&o&&u(e.cloneDeep(o))},[i,n,o,u])}function M({name:i,items:o,value:n,onChange:u,isLoading:s,isError:c,refetch:D,className:E,icon:l,showNone:p=!1}){const g=h.useRef(null),[b,T]=h.useState(!1),[B,A]=h.useState("100%"),x=p?[...o||[],{id:"none",name:"None"}]:o;h.useLayoutEffect(()=>{g.current&&A(g.current.offsetWidth)},[]);function v(){var f;return s?"Loading...":c?"Error":n?(f=o==null?void 0:o.find(m=>m.id===n))==null?void 0:f.name:`Select ${i}`}function F(f,m){u(m),T(!1)}return t.jsxs(a.Popover,{open:b,onOpenChange:T,children:[t.jsx(a.PopoverTrigger,{asChild:!0,children:t.jsxs(a.Button,{ref:g,variant:"outline",role:"combobox","aria-expanded":b,className:a.cn("flex h-9 w-full justify-between",E),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[l&&t.jsx("div",{className:"mr-2",children:l}),t.jsx("span",{className:"max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:v()})]}),t.jsx(_.ChevronDown,{className:"size-4 opacity-50"})]})}),t.jsx(a.PopoverContent,{className:"w-full p-0",style:{minWidth:B},children:t.jsxs(e.Command,{children:[t.jsxs("div",{className:"flex h-9 items-center justify-between border-b pr-1",children:[t.jsx(e.CommandInput,{className:"h-9",placeholder:"Search..."}),t.jsx(e.IconButton,{className:"h-7",onClick:D,children:t.jsx(e.RefreshCw,{className:a.cn("size-3.5 opacity-50",s&&"animate-spin")})})]}),t.jsxs(e.CommandList,{children:[t.jsxs(e.CommandEmpty,{children:["No ",i==null?void 0:i.toLowerCase()," found."]}),t.jsx(e.CommandGroup,{children:x==null?void 0:x.map(f=>t.jsx(e.CommandItem,{className:"overflow-x-auto",value:f.name,onSelect:m=>F(m,f.id),children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(a.Check,{className:a.cn("size-4",n===f.id?"opacity-100":"opacity-0")}),t.jsx("div",{title:f.name,children:f.name})]})},f.id))})]})]})})]})}function I(i,o){C.useEffect(()=>(i&&o&&(window.__SEMAPHOR_PRINT_STATE__={...o}),()=>{i&&window.__SEMAPHOR_PRINT_STATE__&&delete window.__SEMAPHOR_PRINT_STATE__}),[i,o])}exports.CardSummary=e.CardSummary;exports.Dashboard=e.Dashboard;exports.DashboardCreateDialogBase=e.DashboardCreateDialogBase;exports.DashboardExportDialog=e.DashboardExportDialog;exports.DashboardWC=e.DashboardWC;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.cancelExport=e.cancelExport;exports.cloneDeep=e.cloneDeep;exports.createExport=e.createExport;exports.downloadDocumentPdf=e.downloadDocumentPdf;exports.downloadPdf=e.downloadPdf;exports.formatFileSize=e.formatFileSize;exports.getDownloadUrl=e.getDownloadUrl;exports.getExportStatus=e.getExportStatus;exports.getExports=e.getExports;exports.isExportComplete=e.isExportComplete;exports.isExportInProgress=e.isExportInProgress;exports.useActiveExports=e.useActiveExports;exports.useAddNewFrame=e.useAddNewFrame;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.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.CalendarPreferencesDialog=N.CalendarPreferencesDialog;exports.createEmptyKpiConfig=a.createEmptyKpiConfig;exports.createSqlGenConfig=a.createSqlGenConfig;exports.emitDashboardLoad=a.emitDashboardLoad;exports.emitDashboardUnload=a.emitDashboardUnload;exports.fmt=a.fmt;exports.getColumnDataType=a.getColumnDataType;exports.getFilterValueType=a.getFilterValueType;exports.getFormattedTableNameForQuery=a.getFormattedTableNameForQuery;exports.getQualifiedTableName=a.getQualifiedTableName;exports.getSql=a.getSql;exports.invalidateToken=a.invalidateToken;exports.isBooleanDataType=a.isBooleanDataType;exports.isColumnInSqlGen=a.isColumnInSqlGen;exports.isDateDataType=a.isDateDataType;exports.isNumberDataType=a.isNumberDataType;exports.isTextDataType=a.isTextDataType;exports.resolveDataType=a.resolveDataType;exports.resolveDatamodelName=a.resolveDatamodelName;exports.useCurrentActiveCard=a.useCurrentActiveCard;exports.useCurrentCardConfig=a.useCurrentCardConfig;exports.useCurrentSheetActiveCards=a.useCurrentSheetActiveCards;exports.useDashboardActions=a.useDashboardActions;exports.useDashboardStore=a.useDashboardStore;exports.useEditorActions=a.useEditorActions;exports.useEditorStore=a.useEditorStore;exports.DEFAULT_CALENDAR_CONTEXT=y.DEFAULT_CALENDAR_CONTEXT;exports.DEFAULT_SEMANTIC_DOMAIN_ACCESS=y.DEFAULT_SEMANTIC_DOMAIN_ACCESS;exports.AdvancedModeToggle=r.AdvancedModeToggle;exports.BriefingAuthor=r.BriefingAuthor;exports.BriefingsApiError=r.BriefingsApiError;exports.DashboardBriefingLauncher=r.DashboardBriefingLauncher;exports.DashboardControlsSettings=r.DashboardControlsSettings;exports.DashboardFilterControlsButton=r.DashboardFilterControlsButton;exports.DashboardFilterControlsLauncher=r.DashboardFilterControlsLauncher;exports.DocumentControlsSettings=r.DocumentControlsSettings;exports.ExportNotificationItem=r.ExportNotificationItem;exports.ExportNotificationList=r.ExportNotificationList;exports.NotificationBell=r.NotificationBell;exports.UnsavedChangesAlert=r.UnsavedChangesAlert;exports.VisualEditingControls=r.VisualEditingControls;exports.VisualsLibraryDialog=r.VisualsLibraryDialog;exports.WatchDashboardButton=r.WatchDashboardButton;exports.applyBriefingFormPatch=r.applyBriefingFormPatch;exports.briefingFormDraftToCreateRequest=r.briefingFormDraftToCreateRequest;exports.briefingFormDraftToUpdateRequest=r.briefingFormDraftToUpdateRequest;exports.briefingToFormDraft=r.briefingToFormDraft;exports.cancelBriefingPreviewRun=r.cancelBriefingPreviewRun;exports.cancelBriefingRun=r.cancelBriefingRun;exports.createBriefing=r.createBriefing;exports.createBriefingFormDraft=r.createBriefingFormDraft;exports.deleteBriefing=r.deleteBriefing;exports.deleteBriefingRun=r.deleteBriefingRun;exports.getBriefing=r.getBriefing;exports.getBriefingArtifact=r.getBriefingArtifact;exports.getBriefingEvidence=r.getBriefingEvidence;exports.getBriefingPreviewRun=r.getBriefingPreviewRun;exports.getBriefingRun=r.getBriefingRun;exports.listBriefingRuns=r.listBriefingRuns;exports.listBriefingTenantSummaries=r.listBriefingTenantSummaries;exports.listBriefings=r.listBriefings;exports.pauseBriefing=r.pauseBriefing;exports.polishBriefingText=r.polishBriefingText;exports.previewBriefingPlan=r.previewBriefingPlan;exports.resumeBriefing=r.resumeBriefing;exports.runBriefingNow=r.runBriefingNow;exports.runBriefingPreview=r.runBriefingPreview;exports.updateBriefing=r.updateBriefing;exports.useExportPolling=r.useExportPolling;exports.useExportRecovery=r.useExportRecovery;exports.validateBriefingFormDraft=r.validateBriefingFormDraft;exports.useDebouncedDirtyCheck=P.useDebouncedDirtyCheck;exports.normalizeDashboardForDirtyCheck=S.normalizeDashboardForDirtyCheck;exports.serializeDashboardForDirtyCheck=S.serializeDashboardForDirtyCheck;exports.Combobox=M;exports.Visual=w;exports.useExposePrintState=I;exports.usePristineSnapshotInitializer=L;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-DfV9K_Ke.js"),d=require("./chunks/common-types-C73-Ud1-.js"),N=require("./chunks/calendar-preferences-dialog-CuopKVbJ.js"),t=require("react/jsx-runtime"),a=require("./chunks/switch-oim6Xl36.js"),C=require("react"),y=require("./types/index.cjs"),r=require("./chunks/dashboard-briefing-launcher-5eLlNzsk.js"),P=require("./chunks/use-debounced-dirty-check-XHSwAefL.js");require("./chunks/analyze-result-contract-S8u7CcPL.js");require("react-dom");require("./chunks/index-DRlMUglg.js");const S=require("./chunks/normalize-dashboard-for-dirty-check-BXRUMVb2.js"),_=require("./chunks/x-B6ghREd2.js");function R(i){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const n in i)if(n!=="default"){const u=Object.getOwnPropertyDescriptor(i,n);Object.defineProperty(o,n,u.get?u:{enumerable:!0,get:()=>i[n]})}}return o.default=i,Object.freeze(o)}const h=R(C);function w(i){const{displayPreferences:o,cardId:n,...u}=i,s={...u,id:i.dashboardId};return t.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:t.jsxs(e.SemaphorContextProvider,{dashboardProps:s,children:[t.jsx(e.SemaphorReadyIndicator,{componentType:"visual",componentId:i.cardId}),t.jsx(e.UXProvider,{appearance:i.appearance,children:t.jsx(e.DisplayPreferencesProvider,{displayPreferences:o,children:t.jsx(e.Container,{type:"visual",cardId:n,...s,children:t.jsx(j,{cardId:n})})})})]})})}function j({cardId:i}){const o=a.useDashboardStore(s=>{var c;return(c=s.dashboard)==null?void 0:c.sheets}),{card:n,frame:u}=C.useMemo(()=>{const s=o==null?void 0:o.flatMap(l=>l.frames),c=s==null?void 0:s.flatMap(l=>l==null?void 0:l.cards),D=c==null?void 0:c.find(l=>(l==null?void 0:l.id)===i),E=s==null?void 0:s.find(l=>{var p;return(p=l==null?void 0:l.cards)==null?void 0:p.find(g=>(g==null?void 0:g.id)===i)});return{card:D,frame:E}},[o,i]);return!n||!u?t.jsx(e.FallbackVisual,{error:new Error("Card not found"),resetErrorBoundary:()=>{},customerFacingMessage:`Card not found with ID: ${i}`}):t.jsx("main",{className:"flex h-full grow flex-col",children:t.jsx(e.ErrorBoundary,{FallbackComponent:({error:s,resetErrorBoundary:c})=>t.jsx(e.FallbackVisual,{error:s,resetErrorBoundary:c,customerFacingMessage:"Error creating visual. Please try again."}),children:t.jsx(e.DashboardCard,{card:n,frame:u})})})}function L(i,o,n,u){C.useEffect(()=>{i&&!n&&o&&u(e.cloneDeep(o))},[i,n,o,u])}function M({name:i,items:o,value:n,onChange:u,isLoading:s,isError:c,refetch:D,className:E,icon:l,showNone:p=!1}){const g=h.useRef(null),[b,T]=h.useState(!1),[B,A]=h.useState("100%"),x=p?[...o||[],{id:"none",name:"None"}]:o;h.useLayoutEffect(()=>{g.current&&A(g.current.offsetWidth)},[]);function v(){var f;return s?"Loading...":c?"Error":n?(f=o==null?void 0:o.find(m=>m.id===n))==null?void 0:f.name:`Select ${i}`}function F(f,m){u(m),T(!1)}return t.jsxs(a.Popover,{open:b,onOpenChange:T,children:[t.jsx(a.PopoverTrigger,{asChild:!0,children:t.jsxs(a.Button,{ref:g,variant:"outline",role:"combobox","aria-expanded":b,className:a.cn("flex h-9 w-full justify-between",E),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[l&&t.jsx("div",{className:"mr-2",children:l}),t.jsx("span",{className:"max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:v()})]}),t.jsx(_.ChevronDown,{className:"size-4 opacity-50"})]})}),t.jsx(a.PopoverContent,{className:"w-full p-0",style:{minWidth:B},children:t.jsxs(e.Command,{children:[t.jsxs("div",{className:"flex h-9 items-center justify-between border-b pr-1",children:[t.jsx(e.CommandInput,{className:"h-9",placeholder:"Search..."}),t.jsx(e.IconButton,{className:"h-7",onClick:D,children:t.jsx(e.RefreshCw,{className:a.cn("size-3.5 opacity-50",s&&"animate-spin")})})]}),t.jsxs(e.CommandList,{children:[t.jsxs(e.CommandEmpty,{children:["No ",i==null?void 0:i.toLowerCase()," found."]}),t.jsx(e.CommandGroup,{children:x==null?void 0:x.map(f=>t.jsx(e.CommandItem,{className:"overflow-x-auto",value:f.name,onSelect:m=>F(m,f.id),children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(a.Check,{className:a.cn("size-4",n===f.id?"opacity-100":"opacity-0")}),t.jsx("div",{title:f.name,children:f.name})]})},f.id))})]})]})})]})}function I(i,o){C.useEffect(()=>(i&&o&&(window.__SEMAPHOR_PRINT_STATE__={...o}),()=>{i&&window.__SEMAPHOR_PRINT_STATE__&&delete window.__SEMAPHOR_PRINT_STATE__}),[i,o])}exports.CardSummary=e.CardSummary;exports.Dashboard=e.Dashboard;exports.DashboardCreateDialogBase=e.DashboardCreateDialogBase;exports.DashboardExportDialog=e.DashboardExportDialog;exports.DashboardWC=e.DashboardWC;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.cancelExport=e.cancelExport;exports.cloneDeep=e.cloneDeep;exports.createExport=e.createExport;exports.downloadDocumentPdf=e.downloadDocumentPdf;exports.downloadPdf=e.downloadPdf;exports.formatFileSize=e.formatFileSize;exports.getDownloadUrl=e.getDownloadUrl;exports.getExportStatus=e.getExportStatus;exports.getExports=e.getExports;exports.isExportComplete=e.isExportComplete;exports.isExportInProgress=e.isExportInProgress;exports.useActiveExports=e.useActiveExports;exports.useAddNewFrame=e.useAddNewFrame;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.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.CalendarPreferencesDialog=N.CalendarPreferencesDialog;exports.createEmptyKpiConfig=a.createEmptyKpiConfig;exports.createSqlGenConfig=a.createSqlGenConfig;exports.emitDashboardLoad=a.emitDashboardLoad;exports.emitDashboardUnload=a.emitDashboardUnload;exports.fmt=a.fmt;exports.getColumnDataType=a.getColumnDataType;exports.getFilterValueType=a.getFilterValueType;exports.getFormattedTableNameForQuery=a.getFormattedTableNameForQuery;exports.getQualifiedTableName=a.getQualifiedTableName;exports.getSql=a.getSql;exports.invalidateToken=a.invalidateToken;exports.isBooleanDataType=a.isBooleanDataType;exports.isColumnInSqlGen=a.isColumnInSqlGen;exports.isDateDataType=a.isDateDataType;exports.isNumberDataType=a.isNumberDataType;exports.isTextDataType=a.isTextDataType;exports.resolveDataType=a.resolveDataType;exports.resolveDatamodelName=a.resolveDatamodelName;exports.useCurrentActiveCard=a.useCurrentActiveCard;exports.useCurrentCardConfig=a.useCurrentCardConfig;exports.useCurrentSheetActiveCards=a.useCurrentSheetActiveCards;exports.useDashboardActions=a.useDashboardActions;exports.useDashboardStore=a.useDashboardStore;exports.useEditorActions=a.useEditorActions;exports.useEditorStore=a.useEditorStore;exports.DEFAULT_CALENDAR_CONTEXT=y.DEFAULT_CALENDAR_CONTEXT;exports.DEFAULT_SEMANTIC_DOMAIN_ACCESS=y.DEFAULT_SEMANTIC_DOMAIN_ACCESS;exports.AdvancedModeToggle=r.AdvancedModeToggle;exports.BriefingAuthor=r.BriefingAuthor;exports.BriefingsApiError=r.BriefingsApiError;exports.DashboardBriefingLauncher=r.DashboardBriefingLauncher;exports.DashboardControlsSettings=r.DashboardControlsSettings;exports.DashboardFilterControlsButton=r.DashboardFilterControlsButton;exports.DashboardFilterControlsLauncher=r.DashboardFilterControlsLauncher;exports.DocumentControlsSettings=r.DocumentControlsSettings;exports.ExportNotificationItem=r.ExportNotificationItem;exports.ExportNotificationList=r.ExportNotificationList;exports.NotificationBell=r.NotificationBell;exports.UnsavedChangesAlert=r.UnsavedChangesAlert;exports.VisualEditingControls=r.VisualEditingControls;exports.VisualsLibraryDialog=r.VisualsLibraryDialog;exports.WatchDashboardButton=r.WatchDashboardButton;exports.applyBriefingFormPatch=r.applyBriefingFormPatch;exports.briefingFormDraftToCreateRequest=r.briefingFormDraftToCreateRequest;exports.briefingFormDraftToUpdateRequest=r.briefingFormDraftToUpdateRequest;exports.briefingToFormDraft=r.briefingToFormDraft;exports.cancelBriefingPreviewRun=r.cancelBriefingPreviewRun;exports.cancelBriefingRun=r.cancelBriefingRun;exports.createBriefing=r.createBriefing;exports.createBriefingFormDraft=r.createBriefingFormDraft;exports.deleteBriefing=r.deleteBriefing;exports.deleteBriefingRun=r.deleteBriefingRun;exports.getBriefing=r.getBriefing;exports.getBriefingArtifact=r.getBriefingArtifact;exports.getBriefingEvidence=r.getBriefingEvidence;exports.getBriefingPreviewRun=r.getBriefingPreviewRun;exports.getBriefingRun=r.getBriefingRun;exports.listBriefingRuns=r.listBriefingRuns;exports.listBriefingTenantSummaries=r.listBriefingTenantSummaries;exports.listBriefings=r.listBriefings;exports.pauseBriefing=r.pauseBriefing;exports.polishBriefingText=r.polishBriefingText;exports.previewBriefingPlan=r.previewBriefingPlan;exports.resumeBriefing=r.resumeBriefing;exports.runBriefingNow=r.runBriefingNow;exports.runBriefingPreview=r.runBriefingPreview;exports.updateBriefing=r.updateBriefing;exports.useExportPolling=r.useExportPolling;exports.useExportRecovery=r.useExportRecovery;exports.validateBriefingFormDraft=r.validateBriefingFormDraft;exports.useDebouncedDirtyCheck=P.useDebouncedDirtyCheck;exports.normalizeDashboardForDirtyCheck=S.normalizeDashboardForDirtyCheck;exports.serializeDashboardForDirtyCheck=S.serializeDashboardForDirtyCheck;exports.Combobox=M;exports.Visual=w;exports.useExposePrintState=I;exports.usePristineSnapshotInitializer=L;
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { E as T, F as N, S, q as P, U as w, r as _, s as F, t as x, v as R, w as M, h as I, i as L, I as k, x as U, j as O, k as V, l as z, m as q } from "./chunks/index-
|
|
2
|
-
import { X as fa, D as ma, V as pa, T as ha, O as ga, aa as Ca, M as Da, A as Ea, H as xa, H as Ta, J as ba, W as ya, a as va, a9 as Ba, a5 as Aa, Q as Na, P as Sa, ad as Pa, a8 as wa, a7 as _a, a6 as Fa, ac as Ra, ab as Ma, a2 as Ia, $ as La, N as ka, Z as Ua, L as Oa, z as Va, Y as za, _ as qa, B as Ha, a4 as Wa, a1 as ja, a0 as Ga, a3 as Qa, y as Ka, K as Xa, G as Ya } from "./chunks/index-
|
|
1
|
+
import { E as T, F as N, S, q as P, U as w, r as _, s as F, t as x, v as R, w as M, h as I, i as L, I as k, x as U, j as O, k as V, l as z, m as q } from "./chunks/index-t_L3sxNY.js";
|
|
2
|
+
import { X as fa, D as ma, V as pa, T as ha, O as ga, aa as Ca, M as Da, A as Ea, H as xa, H as Ta, J as ba, W as ya, a as va, a9 as Ba, a5 as Aa, Q as Na, P as Sa, ad as Pa, a8 as wa, a7 as _a, a6 as Fa, ac as Ra, ab as Ma, a2 as Ia, $ as La, N as ka, Z as Ua, L as Oa, z as Va, Y as za, _ as qa, B as Ha, a4 as Wa, a1 as ja, a0 as Ga, a3 as Qa, y as Ka, K as Xa, G as Ya } from "./chunks/index-t_L3sxNY.js";
|
|
3
3
|
import { a as Ja, C as Za, D as ae, E as ee, P as se, g as re, d as oe, h as te, b as ie, c as ne, i as le } from "./chunks/common-types-4bjoIgvm.js";
|
|
4
|
-
import { C as ue } from "./chunks/calendar-preferences-dialog-
|
|
4
|
+
import { C as ue } from "./chunks/calendar-preferences-dialog-B1tgIEiO.js";
|
|
5
5
|
import { jsx as a, jsxs as d } from "react/jsx-runtime";
|
|
6
6
|
import { u as H, P as W, a as j, B as G, c as C, b as Q, d as K } from "./chunks/switch-CXMExaSF.js";
|
|
7
7
|
import { D as fe, o as me, f as pe, g as he, h as ge, q as Ce, p as De, t as Ee, v as xe, n as Te, i as be, m as ye, r as ve, l as Be, k as Ae, j as Ne, w as Se, s as Pe, x as we, z as _e, y as Fe, A as Re, F as Me, E as Ie } from "./chunks/switch-CXMExaSF.js";
|
|
8
8
|
import * as m from "react";
|
|
9
9
|
import { useMemo as X, useEffect as b } from "react";
|
|
10
10
|
import { DEFAULT_CALENDAR_CONTEXT as ke, DEFAULT_SEMANTIC_DOMAIN_ACCESS as Ue } from "./types/index.js";
|
|
11
|
-
import { A as Ve, L as ze, B as qe, M as He, D as We, e as je, f as Ge, d as Qe, b as Ke, E as Xe, N as Ye, U as $e, a as Je, V as Ze, W as as, G as es, I as ss, J as rs, H as os, s as ts, w as is, i as ns, F as ls, k as ds, x as us, h as cs, y as fs, z as ms, q as ps, v as hs, t as gs, g as Cs, l as Ds, p as Es, C as xs, n as Ts, r as bs, m as ys, o as vs, j as Bs, u as As, c as Ns, K as Ss } from "./chunks/dashboard-briefing-launcher-
|
|
11
|
+
import { A as Ve, L as ze, B as qe, M as He, D as We, e as je, f as Ge, d as Qe, b as Ke, E as Xe, N as Ye, U as $e, a as Je, V as Ze, W as as, G as es, I as ss, J as rs, H as os, s as ts, w as is, i as ns, F as ls, k as ds, x as us, h as cs, y as fs, z as ms, q as ps, v as hs, t as gs, g as Cs, l as Ds, p as Es, C as xs, n as Ts, r as bs, m as ys, o as vs, j as Bs, u as As, c as Ns, K as Ss } from "./chunks/dashboard-briefing-launcher-sjEVZFqF.js";
|
|
12
12
|
import { u as ws } from "./chunks/use-debounced-dirty-check-BwAbnX_5.js";
|
|
13
13
|
import "./chunks/analyze-result-contract-BUgK3759.js";
|
|
14
14
|
import "react-dom";
|
package/dist/surfboard/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chunks/index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chunks/index-DfV9K_Ke.js"),e=require("../chunks/common-types-C73-Ud1-.js"),a=require("../chunks/calendar-preferences-dialog-CuopKVbJ.js");exports.Surfboard=r.DashboardPlus;exports.CONTROL_CARD_DEFAULT_VALUE=e.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=e.EMPTY_SELECTION;exports.CalendarPreferencesDialog=a.CalendarPreferencesDialog;
|
package/dist/surfboard/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as e } from "../chunks/index-
|
|
1
|
+
import { a as e } from "../chunks/index-t_L3sxNY.js";
|
|
2
2
|
import { C, E } from "../chunks/common-types-4bjoIgvm.js";
|
|
3
|
-
import { C as s } from "../chunks/calendar-preferences-dialog-
|
|
3
|
+
import { C as s } from "../chunks/calendar-preferences-dialog-B1tgIEiO.js";
|
|
4
4
|
export {
|
|
5
5
|
C as CONTROL_CARD_DEFAULT_VALUE,
|
|
6
6
|
s as CalendarPreferencesDialog,
|