react-semaphor 0.1.378 → 0.1.380

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/chunks/{calendar-preferences-dialog-DZe8Nd-4.js → calendar-preferences-dialog-Dsgs8WDv.js} +1 -1
  2. package/dist/chunks/{calendar-preferences-dialog-CRvQz4TE.js → calendar-preferences-dialog-iZs8XqyH.js} +1 -1
  3. package/dist/chunks/dashboard-briefing-launcher-B5vPTl8P.js +80 -0
  4. package/dist/chunks/{dashboard-briefing-launcher-DURdx5Ox.js → dashboard-briefing-launcher-Coks66cV.js} +2102 -2151
  5. package/dist/chunks/{dashboard-controls-D5mjF67R.js → dashboard-controls-BfkcnIdy.js} +3 -3
  6. package/dist/chunks/{dashboard-controls-J71GLAxt.js → dashboard-controls-Dyqye6fh.js} +1 -1
  7. package/dist/chunks/{dashboard-json-Cv8jXh0X.js → dashboard-json-CV_LnO9x.js} +1 -1
  8. package/dist/chunks/{dashboard-json-BumvCRuk.js → dashboard-json-DjXi4cI6.js} +1 -1
  9. package/dist/chunks/{edit-dashboard-visual-eYJMy7aw.js → edit-dashboard-visual-DOW1Ap1N.js} +2 -2
  10. package/dist/chunks/{edit-dashboard-visual-dvhQzG_h.js → edit-dashboard-visual-yinO0yU-.js} +1 -1
  11. package/dist/chunks/{index-c_0nwsOM.js → index-CkoRCh3g.js} +1 -1
  12. package/dist/chunks/{index-hhH5F_tQ.js → index-DlprYjr6.js} +3 -3
  13. package/dist/chunks/{use-create-flow-overlay-state-D9UKBuCA.js → use-create-flow-overlay-state-NsqFPwdB.js} +1 -1
  14. package/dist/chunks/{use-create-flow-overlay-state-hlsTNh2b.js → use-create-flow-overlay-state-r5JKyXU8.js} +1 -1
  15. package/dist/dashboard/index.cjs +1 -1
  16. package/dist/dashboard/index.js +1 -1
  17. package/dist/data-app-builder/index.cjs +1 -1
  18. package/dist/data-app-builder/index.js +1 -1
  19. package/dist/data-app-sdk/index.cjs +1 -1
  20. package/dist/data-app-sdk/index.js +340 -294
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.js +53 -52
  23. package/dist/surfboard/index.cjs +1 -1
  24. package/dist/surfboard/index.js +2 -2
  25. package/dist/types/main.d.ts +7 -0
  26. package/dist/types/types.d.ts +4 -0
  27. package/package.json +1 -1
  28. package/dist/chunks/dashboard-briefing-launcher-BWyHpn2M.js +0 -111
@@ -1368,4 +1368,4 @@ prismjs/prism.js:
1368
1368
  More info: ${s.docs}`:"",a=typeof s.message=="string"&&s.message.trim()?s.message.trim():typeof s.error=="string"&&s.error.trim()?s.error.trim():null;if(a){const c=o?` (code: ${o})`:"",u=o==="insufficient_quota"||a.toLowerCase().includes("quota")?`
1369
1369
 
1370
1370
  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 s=JSON.parse(r),o=t(s);if(o)return o}catch{}return r}const n=t(e);if(n)return n;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function G3({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(Bi,{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:L0t(e)})]})}function $0t({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(G3,{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 z0t({text:e,files:t}){return l.jsxs(Hfe,{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(Ldt,{file:n},n.id))})]})}function B0t({text:e}){const t=e.split("|"),n=t[0],r=t[1]||"{}",s=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(nft,{children:JSON.stringify(s,null,2)})]})]})}function Ufe(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")?W3(r,t):!1}})}function KU(){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 V0t({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(KU,{}),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(KU,{}),l.jsx("span",{children:e==="submitted"?"Thinking":"Generating"})]}):e==="error"?l.jsx(G3,{errorMessage:t}):null}function H0t(e){var t;return e?(t=[...e].reverse().find(n=>{var r;return n.role==="assistant"&&((r=n.parts)==null?void 0:r.some(s=>s.type==="text"&&typeof s.text=="string"&&s.text.trim().length>0))}))==null?void 0:t.id:void 0}function U0t({message:e,messageIndex:t,messages:n,showTools:r=!1,onAddToDashboard:s,showSystemMessage:o=!1,handleRun:i,onQuickReply:a,disableQuickReplies:c=!1}){var y,w,v,C;const u=H0t(n),d=e.id===u;if(e.role==="user"){const N=((y=e.parts)==null?void 0:y.filter(E=>E.type==="text"))||[],k=((w=e.parts)==null?void 0:w.filter(E=>E.type==="file"))||[],_=N.map(E=>E.text).join(`
1371
- `).trim(),j=k.map((E,I)=>{var R,F;let T="",D;if((R=E.url)!=null&&R.startsWith("data:")){const A=E.url.match(/data:[^;]+;base64,(.+)/);A&&(T=A[1],(F=E.mediaType)!=null&&F.startsWith("image/")&&(D=E.url))}return{id:`${e.id||t}-file-${I}`,name:E.filename||`File ${I+1}`,size:0,type:E.mediaType||"application/octet-stream",data:T,preview:D}});return l.jsx(z0t,{text:_||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(Sc,{className:"space-y-2",defaultOpen:!1,children:[l.jsx(Cc,{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(Bn,{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(Nc,{children:l.jsx("ol",{className:"space-y-2 border-l border-border/60 pl-3",children:g.map((N,k)=>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:k+1}),l.jsx(BU,{className:"text-[12px] leading-[1.55] text-muted-foreground",text:N.text})]},`${e.id||t}-reasoning-${k}`))})})]},`${e.id||t}-reasoning`):null,x=(C=e.parts)==null?void 0:C.map((N,k)=>{var j;const _=`${e.id||t}-${k}`;switch(N.type){case"text":{const E=typeof N.text=="string"?N.text:JSON.stringify(N.text??"",null,2);if(e.role==="assistant"){const{cleanedText:I,quickReplies:T}=F0t(E),D=I.trim().length>0;return l.jsxs("div",{className:"space-y-2.5",children:[D&&l.jsx(BU,{text:I,handleRun:i,onAddToDashboard:s,messageId:e.id,messages:n}),T.length>0&&a&&d&&l.jsxs("div",{className:"space-y-1.5",children:[T.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:T.map(({label:R,value:F},A)=>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(F),children:l.jsx("span",{className:"truncate",children:R})})}),l.jsx(p.TooltipContent,{side:"top",align:"center",children:l.jsx("p",{className:"max-w-xs text-xs",children:F})})]},`${_}-qr-${A}`))})]})]},_)}return e.role==="system"&&o?l.jsx(B0t,{text:E},_):null}case"error":{const E=N,I=E.errorText??E.error??E.message;return l.jsx("div",{className:"my-4",children:l.jsx(G3,{errorMessage:I})},_)}case"reasoning":return null;default:return((j=N.type)!=null&&j.startsWith("tool-")||N.type==="dynamic-tool")&&W3(N,r)?l.jsx(ka,{FallbackComponent:({error:E,resetErrorBoundary:I})=>l.jsx($0t,{error:E,resetErrorBoundary:I}),children:l.jsx(D0t,{part:N,idx:_,messageId:e.id,showTools:r,onAddToDashboard:s,messages:n})},_):null}});return e.role==="assistant"?Ufe(e,r)?l.jsxs(Hfe,{who:"Assistant",className:"space-y-2",children:[b,x]}):null:l.jsxs("div",{className:"space-y-2",children:[b,x]})}const q0t=8,W0t=24,G0t=20;function Y0t(e,t,n,r){return e==="error"&&t?!0:r?!1:!!(n||e==="submitted"||e==="streaming")}function qfe({messages:e,showTools:t=!1,showSystemMessage:n=!1,handleRun:r,onAddToDashboard:s,onQuickReply:o,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,E]=S.useState(0),[I,T]=S.useState(W0t);N.current!==g&&(N.current=g,C.current=!0);const D=e[e.length-1],R=Ufe(D,t),F=Y0t(a,c,u,R),A=f_({count:e.length,getScrollElement:()=>b.current,estimateSize:W=>{const O=e[W];return(O==null?void 0:O.role)==="user"?88:180},getItemKey:W=>{const O=e[W];return(O==null?void 0:O.id)||`message-${W}`},anchorTo:"end",followOnAppend:!0,scrollEndThreshold:q0t,overscan:6,gap:20,paddingEnd:F?I+G0t:0,useAnimationFrameWithResizeObserver:!0,onChange:W=>{const O=W.isAtEnd();_(Z=>Z===O?Z:O),O&&E(0)}}),U=S.useCallback((W="smooth")=>{v.current!==null&&cancelAnimationFrame(v.current),v.current=requestAnimationFrame(()=>{v.current=null,A.scrollToEnd({behavior:W})}),E(0),_(!0)},[A]);S.useLayoutEffect(()=>{w.current||(w.current=!0,U("auto"))},[U]),S.useLayoutEffect(()=>{C.current&&(C.current=!1,U("auto"))},[e.length,g,U]),S.useEffect(()=>{const W=y.current;y.current=e.length,e.length>W&&!A.isAtEnd()&&E(O=>O+e.length-W),e.length===0&&(E(0),_(!0),w.current=!1,C.current=!1)},[e.length,A]);const $=A.getVirtualItems(),q=A.getTotalSize();return S.useEffect(()=>()=>{v.current!==null&&cancelAnimationFrame(v.current)},[]),S.useLayoutEffect(()=>{const W=x.current;if(!W||!F)return;const O=()=>{const Y=Math.ceil(W.getBoundingClientRect().height);Y>0&&T(M=>M===Y?M:Y)};if(O(),typeof ResizeObserver>"u")return;const Z=new ResizeObserver(O);return Z.observe(W),()=>Z.disconnect()},[F,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:q},children:[$.map(W=>{const O=e[W.index];return O?l.jsx("div",{ref:A.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(U0t,{message:O,messageIndex:W.index,messages:e,showTools:t,showSystemMessage:n,handleRun:r,onAddToDashboard:s,onQuickReply:o,disableQuickReplies:i})})},W.key):null}),F&&l.jsx("div",{ref:x,className:p.cn("absolute left-0 top-0 w-full",h),style:{transform:`translateY(${Math.max(q-I,0)}px)`},children:l.jsx("div",{className:p.cn("min-w-0",f),children:l.jsx(V0t,{status:a,errorMessage:c,activeToolText:u})})})]})}),!k&&l.jsxs("button",{type:"button",onClick:()=>U("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(ps,{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 K0t(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 Z0t=[{title:"Show top 3 insights",subtitle:"from this dataset"},{title:"Create a bar chart for",subtitle:"sales by product category"}];function X0t({open:e,setOpen:t,isFullscreen:n,onFullscreenChange:r,fullscreenContainer:s}){const[o,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}=Yp(),k=C||N||a,_=S.useRef(null);p.useDashboardStore(le=>le.dashboard.aiScopeTables),p.useDashboardStore(le=>le.isDashboardEditing);const j=p.useDashboardStore(le=>le.selectedSheetId),{setDataSource:E}=p.useEditorActions(),{setSelectedFrameId:I,setIsDashboardEditing:T}=p.useDashboardActions(),D=dL(),{clearAssistantMessageContexts:R}=p.useAIActions(),{clearQueue:F}=p.useQueueActions(),{clearFileAttachments:A,getFileAttachments:U}=p.useFileActions(),$=p.useFileAttachments("dashboard"),q=p.useEditorStore(le=>le.card.dataSource),{assistantProfile:W}=Que(),O=p.useDashboardStore(le=>le.handleOpenAssistantProfile),{selectedEntities:Z,applyDashboardDefaultEntities:Y}=ej("dashboard"),{sendMessage:M,isLoading:K,messages:L,setMessages:z,status:B,stop:V,errorMessage:P,clearError:H}=bdt({dynamicVisualMode:f}),G=S.useCallback(()=>{w(le=>le+1)},[]),X=S.useCallback(le=>{r==null||r(le),n===void 0&&x(le)},[n,r]),ne=S.useCallback(()=>{X(!v)},[v,X]);S.useEffect(()=>{if(!v)return;function le(ke){ke.key==="Escape"&&X(!1)}return window.addEventListener("keydown",le),()=>{window.removeEventListener("keydown",le)}},[v,X]);const[de,he]=S.useState(""),pe=le=>{he(le.target.value)};async function xe({sql:le,cardTitle:ke,connectionId:Se,cardType:oe,python:je,cardConfig:Ne,dataSource:Oe,customVisualPreferences:Ge,visualizationMode:Le,dynamicCardPreferences:Be}){if(!j)return;const Ke=Le==="dynamic",Ce=p.hasValidCardConfig(Ne),Je=Se||(Oe==null?void 0:Oe.connectionId)||"",Pe=Oe?{...Oe,connectionId:Je||Oe.connectionId,connectionType:Oe.connectionType||"",mode:Oe.mode||"database",selectedEntities:Oe.selectedEntities||[]}:Je?{connectionId:Je,connectionType:"",mode:"database",selectedEntities:[]}:Up,tt=!(Ce&&(!Ke||(Be==null?void 0:Be.provenance)==="card-config"||(Be==null?void 0:Be.provenance)==="query_spec")),Ae=tt?K0t(le):"",Ie=tt?je:"",We={id:p.v4(),title:ke||"Title",preferences:{onClickFilter:[{columnIndex:0,expression:""}],chartOptions:{indexAxis:oe==="horizontalBar"?"y":"x"},...Ke&&{displayOptions:{showChrome:!1,allowScroll:!1}}},type:oe,sql:Ae,python:Ie,dataSource:Pe,config:Ne,connectionId:Je,visualizationMode:Le,dynamicCardPreferences:Be,customCardPreferences:Ge?{url:Ge.url,componentName:Ge.componentName,pluginChartType:Ge.pluginChartType,settings:Ge.settings,type:"component"}:void 0},xt={id:p.v4(),cards:[We],activeCardId:We.id};try{await D(j,xt,"end"),T(!0),I(xt.id)}catch(bt){console.error("Failed to add assistant visual to dashboard:",bt),et.error(bt instanceof Error?bt.message:"Failed to prepare semantic metadata for the new visual")}}const se=le=>{le.preventDefault();const ke=de.trim();if(!ke&&$.length===0)return;const Se=[];ke&&Se.push({type:"text",text:ke}),$.forEach(oe=>{oe.data&&Se.push({type:"file",mediaType:oe.type,filename:oe.name,url:`data:${oe.type};base64,${oe.data}`})}),M({role:"user",parts:Se}),he(""),A("dashboard"),G()};S.useEffect(()=>{var le;e&&((le=_.current)==null||le.focus())},[e]),pde({assistantType:"dashboard",status:B,isLoading:K,sendMessage:M});const{hasActiveTools:ge,activeToolText:ie}=gde(L);function Te(le){const ke={role:"user",parts:[{type:"text",text:le.title+" "+le.subtitle}]};M(ke),G()}function re(le){M({role:"user",parts:[{type:"text",text:le}]}),G()}function me(le){M({role:"user",parts:[{type:"text",text:le}]}),G()}const ve=S.useCallback(async()=>{const le=JSON.stringify(L??[],null,2);try{if(typeof navigator>"u"||!navigator.clipboard)throw new Error("Clipboard API unavailable");await navigator.clipboard.writeText(le),et.success("Conversation copied")}catch(ke){console.error("Failed to copy conversation",ke),et.error("Unable to copy conversation")}},[L]),J=(de==null?void 0:de.length)===0&&(L==null?void 0:L.filter(le=>le.role==="user").length)===0;function ee(){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 te(){return l.jsxs(zs,{children:[l.jsx(Bs,{asChild:!0,children:l.jsx(cc,{className:"h-7 p-2 text-muted-foreground hover:text-foreground",children:l.jsx(Sh,{className:"size-3.5"})})}),l.jsxs(Ns,{align:"end",children:[l.jsx(da,{children:"Options"}),l.jsx(Ui,{}),l.jsx(Kc,{checked:o,onCheckedChange:i,children:"Token Usage"}),l.jsx(Kc,{checked:a,onCheckedChange:c,children:"Tool Invocations"}),l.jsx(Kc,{checked:u,onCheckedChange:d,children:"System Message"}),(C||N)&&l.jsxs(l.Fragment,{children:[l.jsx(Ui,{}),l.jsx(da,{children:"Dynamic Visuals"}),l.jsx(Kc,{checked:f==="auto",onCheckedChange:()=>h("auto"),children:"Auto"}),l.jsx(Kc,{checked:f==="force",onCheckedChange:()=>h("force"),children:"Force Dynamic"}),l.jsx(Kc,{checked:f==="off",onCheckedChange:()=>h("off"),children:"Disable Dynamic"})]})]})]})}const ue=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:[ee(),O&&l.jsxs("button",{type:"button",onClick:O,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&&te(),k&&l.jsx(p.Button,{variant:"ghost",size:"sm",className:"h-6 px-1.5 text-[11px] text-muted-foreground hover:text-foreground",onClick:ve,children:"Copy Conversation"}),l.jsx(cc,{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:ne,children:v?l.jsx(QR,{className:"h-3.5 w-3.5"}):l.jsx(ek,{className:"h-3.5 w-3.5"})}),l.jsx(cc,{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 le=L.filter(ke=>ke.role==="assistant").map(ke=>ke.id).filter(ke=>!!ke);z([]),F("dashboard"),H(),R(le)},children:l.jsx(eP,{className:"h-3.5 w-3.5"})}),l.jsx(cc,{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(p.X,{className:"h-3.5 w-3.5"})})]})]}),l.jsx(qfe,{messages:L,showTools:a,showSystemMessage:u,onAddToDashboard:xe,onQuickReply:me,disableQuickReplies:K,status:B,errorMessage:P,activeToolText:K&&ge?ie: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&&J&&l.jsx(Dce,{onClick:Te,placeholders:Z0t}),J&&W&&l.jsx(Jue,{seedQuestions:W.seedQuestions||[],handleSeedQuestionClick:re}),l.jsx(mde,{assistantType:"dashboard"}),l.jsx(k3,{ref:_,setInput:he,stop:V,input:de,handleInputChange:pe,handleSubmit:le=>{se(le)},isLoading:K,status:B,assistantType:"dashboard",onFocus:()=>{}})]}),l.jsx(N3,{incomingSelectedEntities:Z,open:m,onOpenChange:g,dataSource:q||Up,dialogMode:"aiContext",saveAsDashboardDefault:!0,onSaveSelectedEntities:le=>Y()})]});return v&&s?gr.createPortal(l.jsx(Ag,{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:ue})}),s):ue}function Q0t(e){const t=e.current,{getSelectedFrame:n,setSelectedFrameId:r}=p.useDashboardActions(),s=iie(),o=p.useDashboardStore(d=>d.dashboard.sheets),a=p.useDashboardStore(d=>d.selectedSheetId)??(o==null?void 0:o[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(J0t(m.target))return;const g=m.ctrlKey||m.metaKey;g&&m.key==="c"?(await f(),et.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=evt(m);if(g!=null&&g.id){const b=rie(g),x=b.cards.findIndex(y=>y.id===b.activeCardId);x!==-1&&(b.cards[x].title=`${b.cards[x].title} (Copy)`),await s(a,b),r(b.id),et.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)},[s,n,r,a,c,u,t])}function J0t(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 evt(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 tvt(e,t){switch(e.interactionMode){case"drillToDetail":nvt(e,t);break;case"drillThrough":rvt(e,t);break;case"drillToURL":svt(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 nvt(e,t){var c;const{targetInsightId:n,contextMode:r,displayMode:s,filterGroups:o}=e;if(!n){console.warn("drillToDetail event missing targetInsightId");return}const i=r||"full";let a=[];switch(i){case"interactionFilters":a=o.flatMap(u=>u.filters);break;case"full":{const u=((c=t.getCurrentFilters)==null?void 0:c.call(t))||[],d=o.flatMap(f=>f.filters);a=[...u,...d];break}case"none":default:a=[];break}s==="replace-card"?t.replaceCardContent({cardId:e.sourceCardId,insightId:n,filters:a,contextMode:r}):t.openInsightModal({insightId:n,filters:a,contextMode:r})}function rvt(e,t){var u,d;const{targetDashboardId:n,contextMode:r="interactionFilters",filterGroups:s,sourceCardId:o}=e;if(!n){console.warn("[DrillThrough] Event missing targetDashboardId. This interaction needs to be reconfigured with a target dashboard.",e);return}const i=s.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 svt(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 ovt({open:e,onOpenChange:t,insightId:n,filters:r,filterDefinitions:s,contextMode:o,cardTitle:i,cardDescription:a}){return l.jsx(_o,{open:e,onOpenChange:t,children:l.jsxs(ao,{className:"max-h-[90vh] max-w-[90vw] p-6",children:[l.jsxs(Zi,{children:[l.jsx(lo,{children:i||"Insight Detail"}),l.jsx(Go,{children:a||"View detailed insight data with applied filters"})]}),l.jsx(cie,{filters:r,filterDefinitions:s,contextMode:o}),l.jsx("div",{className:"h-[400px] flex-1 overflow-auto",children:n?l.jsx(Cie,{insightId:n,filters:r,contextMode:o}):l.jsx("div",{className:"flex items-center justify-center p-12 text-muted-foreground",children:"No insight selected"})})]})})}function ivt(){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),s=p.useInteractionStore(C=>C.setPendingDrillThrough),o=p.useInteractionStore(C=>C.pendingDrillThrough),i=p.useInteractionStore(C=>C.clearPendingDrillThrough),{setSelectedSheetId:a,navigateWithDrill:c}=p.useDashboardActions(),{selectDashboard:u}=vh(),d=p.useDashboardStore(C=>C.dashboard),f=p.useDashboardStore(C=>C.filterValues),{data:h,isLoading:m}=MG((o==null?void 0:o.targetDashboardId)||"",{enabled:!!(o!=null&&o.targetDashboardId)}),[g,b]=S.useState({open:!1,insightId:""}),x=Nie(g.insightId,{enabled:g.open&&!!g.insightId}),y=S.useRef(new Set),w=S.useMemo(()=>({setSelectedSheetId:a,openInsightModal:({insightId:C,filters:N,contextMode:k})=>{b({open:!0,insightId:C,filters:N,filterDefinitions:(d==null?void 0:d.filters)||[],contextMode:k})},replaceCardContent:({cardId:C,insightId:N,filters:k,contextMode:_})=>{r(C,N,k,_)},getCurrentFilters:()=>f||[],navigateWithDrill:c,getCurrentDashboardId:()=>(d==null?void 0:d.id)||"",getCurrentDashboardTitle:()=>d==null?void 0:d.title,setPendingDrillThrough:s,setGlobalDrillContext:({filters:C,contextMode:N,sourceDashboardId:k,sourceDashboardTitle:_,targetDashboardId:j})=>{const E={filters:C},I={sourceCardId:p.DRILL_CONTEXT_CARD_ID,interactionMode:"clickFilter",filterGroups:[E]},T={...p.createInitialInteractionState(),appliedClickFilters:[I],contextMode:N,sourceDashboardId:k,sourceDashboardTitle:_,targetDashboardId:j};t(p.DRILL_CONTEXT_CARD_ID,T)}}),[a,r,f,c,d,s,t]);S.useEffect(()=>{Object.entries(e).forEach(([C,N])=>{if(N!=null&&N.lastInteractionEvent){const k=N.lastInteractionEvent,_=`${C}-${k.interactionMode}-${k.sourceCardId}-${Date.now()}`;if(y.current.has(_))return;y.current.add(_);try{tvt(k,w)}catch(j){console.error("Error executing interaction event:",j)}finally{n(C),setTimeout(()=>{y.current.delete(_)},5e3)}}})},[e,n,w]),S.useEffect(()=>{if(!(!o||!h||m))try{u(h),c(o.targetDashboardId,o.sourceDashboardId,o.sourceDashboardTitle,o.filters,o.contextMode),i()}catch(C){console.error("[DrillThrough] Error during automatic navigation:",C),i()}},[o,h,m,u,c,i]);const v=()=>{b({open:!1,insightId:""})};return l.jsxs(l.Fragment,{children:[l.jsx(ovt,{open:g.open,onOpenChange:v,insightId:g.insightId,filters:g.filters,filterDefinitions:g.filterDefinitions,contextMode:g.contextMode,cardTitle:x.title,cardDescription:x.description}),o&&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 avt(e){return e.length===0?"":e.map(t=>{const n=t.field.label||t.field.name,r=t.operator,s=lvt(t.value);return r==="="?`${n} = ${s}`:`${n} ${r} ${s}`}).join(", ")}function lvt(e){return e==null?"null":Array.isArray(e)?e.join(", "):typeof e=="object"&&e.toString?e.toString():String(e)}function cvt(e){return e?`Back to ${e}`:"Back"}function uvt(){var y,w,v,C,N;const e=p.useInteractionStore(k=>k.interactionStates[p.DRILL_CONTEXT_CARD_ID]),t=p.useDashboardStore(k=>k.actions.goBackFromDrill),n=p.useDashboardStore(k=>k.actions.clearDrillContext),{selectDashboard:r}=vh(),[s,o]=S.useState({x:16,y:16}),[i,a]=S.useState(!1),c=S.useRef({x:0,y:0});S.useEffect(()=>{if(!i)return;const k=j=>{o({x:j.clientX-c.current.x,y:j.clientY-c.current.y})},_=()=>{a(!1)};return document.addEventListener("mousemove",k),document.addEventListener("mouseup",_),()=>{document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",_)}},[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(k){console.error("[DrillBack] Error during back navigation:",k)}},g=()=>{n()},b=k=>{k.target.closest("button")||(a(!0),c.current={x:k.clientX-s.x,y:k.clientY-s.y})};avt(f);const x=cvt(d);return l.jsx("div",{className:"fixed z-50 max-w-md",style:{left:0,top:0,transform:`translate(${s.x}px, ${s.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=k.field.label||k.field.name,E=String(k.value);return l.jsxs(ls,{variant:"secondary",className:"pointer-events-none text-xs",children:[j," = ",E]},_)})})]}),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(p.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(I0,{className:"mr-2 h-4 w-4"}),x]})})]})})}function dvt(e,t){return typeof e=="boolean"?e:typeof t=="boolean"?t:!1}function fvt({filter:e,isEditing:t=!1,disabled:n=!1,storageOptions:r,settingsVariant:s,filterQueryContext:o,inputVariableName:i,reservedInputVariableNames:a,onUpdateFilter:c,onRemoveFilter:u}){const{attributes:d,listeners:f,setNodeRef:h,transform:m,transition:g,isDragging:b}=zg({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:s,filterQueryContext:o,inputVariableName:i,reservedInputVariableNames:a,onUpdateFilter:c,onRemoveFilter:u})})}const ZU="text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",hvt=[];function Wfe({open:e,onOpenChange:t}){var L,z,B;const[n,r]=S.useState(!1),[s,o]=S.useState(!1),[i,a]=S.useState({sheetSelection:"current",protectPdf:!1,password:""}),c=p.useDashboardStore(V=>{var P;return(P=V.dashboard)==null?void 0:P.sheets}),u=p.useDashboardStore(V=>V.dashboard),d=p.useDashboardStore(V=>V.dashboardInputValues),f=p.useDashboardStore(V=>V.filterValues),h=p.useDashboardStore(V=>V.controlValues),m=p.useDashboardStore(V=>V.inlineFilterValuesMap),g=p.useDashboardStore(V=>V.cardControlValuesMap),b=p.useDashboardStore(V=>V.selectedSheetId),x=p.useDashboardStore(V=>V.selectedSheetId?V.documentInputRuntimeBySheetId[V.selectedSheetId]:void 0),y=p.useDashboardStore(V=>V.isDownloadingPdf),{authToken:w,tokenProps:v}=ht(),C=c==null?void 0:c.find(V=>V.id===b),N=S.useMemo(()=>p.getDashboardExportSheets(c),[c]),k=p.isDocumentSheet(C),_=k&&C?C.document:void 0,j=S.useMemo(()=>k&&C?Vv(u,C.id):[],[C,k,u]),E=j.length>0,I=S.useMemo(()=>k&&C?ice(u,C.id):!1,[C,k,u]),T=S.useMemo(()=>E?j.map(Hv):(_==null?void 0:_.inputs)||hvt,[_,j,E]),D=((z=(L=v==null?void 0:v.params)==null?void 0:L.calendarContext)==null?void 0:z.tz)||((B=v==null?void 0:v.params)==null?void 0:B.timezone)||(typeof Intl<"u"?Intl.DateTimeFormat().resolvedOptions().timeZone:void 0),R=S.useMemo(()=>ile(T),[T]),F=S.useMemo(()=>sle(T,D),[T,D]),A=S.useMemo(()=>ole(T),[T]),U=x?x.filterValuesByInputId:F,$=x?x.controlValuesByInputId:A,q=S.useMemo(()=>k?I&&C&&_?dZ({dashboard:u,sheetId:C.id,sheetKind:"document",sectionIds:_.sections.map(V=>V.id),mode:"document",runtimeValues:{dashboardInputValues:d,filterValues:f,controlValues:h,inlineFilterValuesMap:m,cardControlValuesMap:g},timezone:D}):cle(T,U,$,R,R):[],[_,T,C,k,u,g,h,f,m,d,$,U,R,D,I]),W=!!C,O=N.length>0,Z=((c==null?void 0:c.length)||0)>1||k,Y=i.sheetSelection==="current"&&(!W||k&&q.length>0)||i.sheetSelection==="all"&&!O;S.useEffect(()=>{e&&i.sheetSelection==="all"&&!O&&a(V=>({...V,sheetSelection:"current"}))},[O,e,i.sheetSelection]);const M=()=>{a({sheetSelection:"current",protectPdf:!1,password:""}),r(!1),t(!1)};async function K(){if(y){et.error("A PDF export is already in progress");return}if(i.protectPdf&&!i.password){et.error("Please enter a password to protect the PDF");return}if(i.sheetSelection==="current"&&!W){et.error("No sheet is selected to export");return}if(i.sheetSelection==="all"&&!O){et.error("No dashboard sheets are available to export");return}o(!0);const V=i.sheetSelection==="current"&&k,P=V?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",H=et.loading(P);try{if(V){if(!_||!C)throw new Error("Selected document sheet is missing document data");if(q.length>0){et.dismiss(H),et.error(`Set ${q.join(", ")} before exporting`);return}const X=new Date().toISOString(),ne=I?hZ({dashboard:u,sheetId:C.id,sheetKind:"document",sectionIds:_.sections.map(de=>de.id),mode:"document",runtimeValues:{dashboardInputValues:d,filterValues:f,controlValues:h,inlineFilterValuesMap:m,cardControlValuesMap:g},generatedAt:X,timezone:D}).snapshot:void 0;await uF(v.apiServiceUrl,w,{sheetId:C.id,title:C.title||"Document",pageSize:_.page.size,orientation:_.page.orientation,timezone:D,password:i.protectPdf?i.password:void 0,inputSnapshot:ne,...ne?{}:{inputValues:{sheetId:C.id,filterValuesByInputId:U,controlValuesByInputId:$,generatedAt:X}}})}else{const X=BJ();await vZ(v.apiServiceUrl,w,i.protectPdf?i.password:void 0,i.sheetSelection,X)}et.dismiss(H);const G=V?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!";et.success(G,{duration:2e3}),M()}catch(G){et.dismiss(H),et.error("Failed to download PDF",{description:Fk(G,"Please try again or contact support."),descriptionClassName:Pk,closeButton:!0,duration:1/0,richColors:!0}),console.error("PDF download error:",G)}finally{o(!1)}}return l.jsx(_o,{open:e,onOpenChange:V=>{if(!V){M();return}t(!0)},children:l.jsxs(ao,{className:"rounded-control border-border/60 sm:max-w-[440px] sm:rounded-control",children:[l.jsxs(Zi,{children:[l.jsx(lo,{className:"text-[15px]",children:k?"Export document":"Export dashboard"}),l.jsx(Go,{className:"text-[13px] leading-5",children:k?"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:[Z&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(p.Label,{className:ZU,children:"Export scope"}),l.jsxs(Sa,{value:i.sheetSelection,onValueChange:V=>a({...i,sheetSelection:V}),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(ws,{value:"current",id:"scope-current",disabled:!W}),k?"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",!O&&"cursor-not-allowed opacity-50 hover:bg-transparent"),children:[l.jsx(ws,{value:"all",id:"scope-all",disabled:!O}),"Dashboard sheets (",N.length," ",N.length===1?"sheet":"sheets",")"]})]}),k&&l.jsx("p",{className:"text-[12px] leading-5 text-muted-foreground",children:q.length>0?`Set ${q.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(Mn,{id:"protect-pdf",checked:i.protectPdf,onCheckedChange:V=>{a({...i,protectPdf:V,password:V?i.password:""}),V||r(!1)}}),l.jsx(JN,{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:ZU,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:V=>a({...i,password:V.target.value}),placeholder:"Enter password",className:"pr-8",onKeyDown:V=>{V.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(QN,{className:"h-3.5 w-3.5"}):l.jsx(E0,{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:M,disabled:s,children:"Cancel"}),l.jsx(p.Button,{size:"xs",onClick:K,disabled:s||y||Y,children:s?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(_c,{className:"h-3.5 w-3.5"}),"Export"]})})]})]})})}function Gfe({iconClassName:e,open:t,onOpenChange:n}){const[r,s]=S.useState(!1),o=t!==void 0,i=o?t:r,a=u=>{o||s(u),n==null||n(u)},c=p.useDashboardStore(u=>u.isDownloadingPdf);return l.jsxs(l.Fragment,{children:[o?null:l.jsx(p.Button,{variant:"ghost",size:"sm",className:"h-7 p-2",disabled:c,onClick:()=>a(!0),children:l.jsx(_c,{className:p.cn("size-4",e)})}),l.jsx(Wfe,{open:i,onOpenChange:a})]})}function XU(e,t,n){const r=new Set(t),s=[...n];return e.map(o=>r.has(o.id)?s.shift()??o.id:o.id)}function mvt({control:e,value:t,isEditing:n=!1,onChange:r}){const{attributes:s,listeners:o,setNodeRef:i,transform:a,transition:c,isDragging:u}=zg({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,...s,children:l.jsx(Cle,{control:e,value:t,isEditing:n,dragListeners:n?o:void 0,onChange:r})})}function QU(e){var t;return(((t=e.values)==null?void 0:t.length)??0)>0||e.operation==="is null"||e.operation==="is not null"}function JU(e,t){return[...e.map(n=>`filter:${n.id}`),...t.map(n=>`control:${n.id}`)]}function pvt(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 JU(t,n);const s=e.filter(a=>r.has(a)),o=new Set(s),i=JU(t,n).filter(a=>!o.has(a));return[...s,...i]}function gvt(e,t){return p.getDashboardCardEntries({sheets:e.sheets||[]}).filter(n=>n.sheet.id===t).map(n=>n.card.id)}function bvt(e){return xp(e.dashboardInput,{sheetId:e.selectedSheetId,sheetKind:"dashboard"})?!0:e.dashboardInput.scope.kind!=="cards"?!1:e.selectedSheetCardIds.some(t=>xp(e.dashboardInput,{sheetId:e.selectedSheetId,cardId:t,sheetKind:"dashboard"}))}function eq(e){var t;return((t=e.compatibility)==null?void 0:t.source)!=="dashboardFilter"}function xvt(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 yvt(e){return Yfe(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 Yfe(e){if(!e.selectedSheetId)return[];const t=e.selectedSheetId,n=gvt(e.dashboard,t);return IK(Ik({dashboard:e.dashboard}).allInputs).filter(r=>!(r.kind!=="filter"||!bvt({dashboardInput:r,selectedSheetId:t,selectedSheetCardIds:n})))}function vvt(e,t){return"toolbar"}function wvt(){const e=Tc("interactive"),t=p.useDashboardStore(z=>z.selectedSheetId),n=p.useDashboardStore(z=>z.dashboard.filters),r=p.useDashboardStore(z=>z.dashboard.filterLayout),s=p.useDashboardStore(z=>z.isDashboardEditing),o=p.useDashboardStore(z=>z.controlValues),i=p.useDashboardStore(z=>z.filterValues);p.useDashboardStore(z=>z.filteringCards);const a=p.useDashboardStore(z=>z.inlineFilterValuesMap),c=p.useDashboardStore(z=>z.dashboardInputValues),u=p.useInteractionStore(z=>z.clearAllClickFilters),d=p.useInteractionStore(z=>Object.entries(z.interactionStates).reduce((B,[V,P])=>{var H;return V===p.DRILL_CONTEXT_CARD_ID?B:B+(((H=P.appliedClickFilters)==null?void 0:H.length)??0)},0)),f=p.useDashboardStore(z=>z.actions.removeCardInlineFilterValue),{reorderFilters:h,clearDashboardInputSlot:m,reorderDashboardControls:g,removeDashboardInput:b,setControlValue:x,setFilterLayout:y,setFilterValues:w,setFilteringCards:v,upsertDashboardInput:C}=p.useDashboardActions(),N=sj(Bp(Lg,{activationConstraint:{distance:5}})),k=p.useDashboardStore(z=>z.dashboard),_=yvt({dashboard:k,selectedSheetId:t}).filter(z=>vvt(z.filter)==="toolbar"),j=Yfe({dashboard:k,selectedSheetId:t}),E=_.map(z=>z.filter),I=new Map(_.map(z=>[`filter:${z.filter.id}`,z])),T=IYe(k),D=T.filter(z=>!z.hidden&&Ky(z)==="toolbar"),R=T.filter(z=>!z.hidden&&Ky(z)==="advanced"),F=pvt(r==null?void 0:r.toolbarItemOrder,E,D),A=new Map(E.map(z=>[`filter:${z.id}`,z])),U=new Map(D.map(z=>[`control:${z.id}`,z]));function $(z){const{active:B,over:V}=z;if(!V||B.id===V.id)return;const P=String(B.id),H=String(V.id),G=F.findIndex(ge=>ge===P),X=F.findIndex(ge=>ge===H);if(G===-1||X===-1)return;const ne=$g(F,G,X);y({toolbarItemOrder:ne});const de=new Set((n||[]).map(ge=>ge.id)),he=F.filter(ge=>ge.startsWith("filter:")).map(ge=>ge.replace("filter:","")).filter(ge=>de.has(ge)),pe=ne.filter(ge=>ge.startsWith("filter:")).map(ge=>ge.replace("filter:","")).filter(ge=>de.has(ge)),xe=F.filter(ge=>ge.startsWith("control:")).map(ge=>ge.replace("control:","")),se=ne.filter(ge=>ge.startsWith("control:")).map(ge=>ge.replace("control:",""));h(XU(n||[],he,pe)),g(XU(k.controls||[],xe,se))}const q=(r==null?void 0:r.toolbarWrap)??!1,W=(r==null?void 0:r.showDownloadButton)??!1,O=(i==null?void 0:i.filter(z=>QU(z)).length)??0,Z=j.filter(eq),Y=Z.filter(z=>{const B=xvt({dashboardInput:z,dashboardInputValues:c,defaultInputValues:k.defaultInputValues,selectedSheetId:t});return(B==null?void 0:B.status)==="set"&&B.value.kind==="filter"&&QU(B.value.filterValue)}).length,M=a?Object.values(a).reduce((z,B)=>z+((B==null?void 0:B.length)??0),0):0,K=O+Y+M+d,L=()=>{w([]),Z.forEach(z=>{m(z,{sheetId:t})}),v([]),u(),a&&Object.entries(a).forEach(([z,B])=>{B==null||B.forEach(V=>{f(z,V.filterId)})})};return!E.length&&!D.length&&!R.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(Fv,{sensors:N,collisionDetection:Av,onDragEnd:$,children:l.jsxs("div",{className:p.cn("flex items-center",q?"flex-wrap":"w-0 min-w-full overflow-x-auto"),children:[l.jsx(Ov,{items:F,strategy:vL,children:l.jsx(eR,{className:"gap-3 pr-0",wrap:q,children:F.map(z=>{const B=A.get(z);if(B){const P=I.get(z),H=P&&eq(P);return l.jsx(fvt,{filter:B,isEditing:s,storageOptions:H?{storageTarget:"dashboardInput",dashboardInput:P,sheetId:t??void 0}:void 0,inputVariableName:H?P.variableName:void 0,onUpdateFilter:H?(G,X)=>{C({...P,variableName:(X==null?void 0:X.variableName)||P.variableName,filter:G})}:void 0,onRemoveFilter:H?()=>{w((i||[]).filter(G=>G.filterId!==B.id)),b(P.id)}:void 0},z)}const V=U.get(z);return V?l.jsx(mvt,{control:V,value:o==null?void 0:o[V.id],isEditing:s,onChange:P=>x(V.id,P)},z):null})})}),R.length>0&&l.jsx(xie,{title:"",controls:R,values:o,onChange:(z,B)=>x(z.id,B),immediatePlacement:"toolbar",advancedLabel:"More controls"}),K>0&&l.jsxs("button",{type:"button",onClick:L,"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(p.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(Gfe,{})})]})})})}function Kfe(){var me,ve;const{showAssistant:e,tokenProps:t,renderMode:n}=ht(),r=dvt((me=t.config)==null?void 0:me.showDashboardAssistant,e),{preferences:s}=Yp(),o=(ve=s==null?void 0:s.cardDisplay)==null?void 0:ve.mode,i=Dh(o),a=KK({displayMode:o,renderMode:n}),c=S.useRef(null),u=S.useRef(null),[d,f]=S.useState(!1),{handleDragStart:h,isDraggingRef:m,getStyle:g,getPositionClasses:b}=sot({initialPosition:"bottom-right"}),x=kf(J=>J.setFullscreen),y=kf(J=>J.setPanelOpen),w=kf(J=>J.setContainer),v=PY("dashboard"),C=FY(),N=OY("dashboard"),k=v.isOpen,_=C==="dashboard",j=p.useDashboardStore(J=>J.isVisualEditing),E=p.useDashboardStore(J=>J.themeStyle),I=Dc(),T=p.useDashboardStore(J=>{var ee;return(ee=J.dashboard)==null?void 0:ee.sheets}),D=p.useDashboardStore(J=>J.showFilters),R=p.useDashboardStore(J=>J.isDashboardEditing),F=p.useDashboardStore(J=>J.selectedSheetId),A=T==null?void 0:T.find(J=>J.id===F),U=p.useDashboardStore(J=>{var ee,te,ue;return(ue=(te=(ee=J.dashboard)==null?void 0:ee.sheets)==null?void 0:te.find(le=>le.id===J.selectedSheetId))==null?void 0:ue.kind}),$=p.useDashboardStore(J=>{var ee,te;return((te=(ee=J.dashboard)==null?void 0:ee.summary)==null?void 0:te.position)||"top"}),q=U==="document",W=p.useDashboardStore(J=>{var ee;return(ee=J.dashboard)==null?void 0:ee.id}),{getDefaultSheetId:O,setDefaultSheetId:Z,clearDefaultSheetId:Y}=$q(W),[M,K]=S.useState(null),{setSelectedSheetId:L,setSheetTitle:z,addSheet:B,setSheets:V}=p.useDashboardActions();Q0t(u);const{setActiveAssistantType:P}=p.useAIActions();S.useEffect(()=>{if(W){const J=O();K(J)}},[W,O]),S.useEffect(()=>{k?P("dashboard"):C==="dashboard"&&x(null)},[k,P,C,x]),S.useEffect(()=>{var J;k||(J=c.current)==null||J.resize(0)},[k]);function H(J){var ee,te;J?((ee=c.current)==null||ee.resize(40),y("dashboard",!0),x("dashboard"),P("dashboard")):(y("dashboard",!1),x(null),(te=c.current)==null||te.resize(0),P(null))}function G(J="dashboard"){const ee={id:p.v4(),title:J==="document"?"New Document":"New Sheet",...J==="document"?{kind:J,document:p.createDefaultDocumentDefinition()}:{}};B(ee),L(ee.id)}function X(J,ee){if(!W)return;M===J?(Y(),K(null),et.success("Default sheet cleared")):(Z(J),K(J),et.success(`"${ee}" set as default sheet`))}function ne(J){var ee;J<1?(y("dashboard",!1),x(null),P(null),(ee=c.current)==null||ee.resize(0)):(k||y("dashboard",!0),P("dashboard"))}function de(){return(E==null?void 0:E.canvasTheme)==="muted"||!(E!=null&&E.canvasTheme)?"hsl(var(--semaphor-muted))":(E==null?void 0:E.canvasTheme)==="clear"?"":E==null?void 0:E.canvasTheme}const he=(J,ee)=>{J.dataTransfer.setData("tabIndex",ee.toString())},pe=J=>{J.preventDefault()},xe=(J,ee)=>{const te=J.dataTransfer.getData("tabIndex");if(te===ee.toString())return;const ue=Array.from(T||[]),[le]=ue.splice(parseInt(te),1);ue.splice(ee,0,le),V(ue)},se=r===!0&&!i&&!k&&!j&&!D;function ge(){if(T&&T.length>1||R)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:[T==null?void 0:T.map((J,ee)=>{const te=F===J.id,ue=M===J.id;return l.jsxs(p.TabsTrigger,{draggable:!0,onDragStart:le=>he(le,ee),onDragOver:pe,onDrop:le=>xe(le,ee),onClick:()=>L(J.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:J.id,children:[J.kind==="document"&&l.jsx(di,{className:"h-3 w-3 text-muted-foreground"}),l.jsx(uN,{enabled:R&&te,text:J.title,onSave:le=>z(J.id,le),children:J.title},J.id),l.jsx("span",{role:"button",tabIndex:0,"aria-label":ue?"Clear default sheet":"Set as default sheet",title:ue?"Clear default sheet":"Set as default sheet",onClick:le=>{le.stopPropagation(),X(J.id,J.title||"Sheet")},onKeyDown:le=>{(le.key==="Enter"||le.key===" ")&&(le.preventDefault(),le.stopPropagation(),X(J.id,J.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",te||ue?"opacity-100":"opacity-0 group-hover:opacity-100"),children:l.jsx(CW,{className:p.cn("h-3 w-3 transition-colors",ue?"fill-current text-amber-500":"text-muted-foreground")})}),R&&te&&T.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:le=>{le.stopPropagation(),f(!0)},onKeyDown:le=>{(le.key==="Enter"||le.key===" ")&&(le.preventDefault(),le.stopPropagation(),f(!0))},children:l.jsx(p.X,{className:"h-3 w-3"})})]},J.id)}),R&&l.jsxs(zs,{children:[l.jsx(Bs,{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(Ns,{align:"start",className:"w-48",children:[l.jsxs(vn,{onSelect:()=>G("dashboard"),children:[l.jsx(Gf,{className:"h-4 w-4 text-muted-foreground"}),"Dashboard sheet"]}),l.jsxs(vn,{onSelect:()=>G("document"),children:[l.jsx(di,{className:"h-4 w-4 text-muted-foreground"}),"Document"]})]})]})]})]})})}function ie(){return l.jsx("div",{ref:u,style:{},className:"h-full min-h-0 grow",children:T==null?void 0:T.map(J=>l.jsx(p.TabsContent,{style:{backgroundColor:de(),...I.dashboardCanvasStyle},className:p.cn("mt-0 h-full min-h-0",{}),value:J.id,children:l.jsx(G7,{sheet:J})},J.id))})}function Te(){return l.jsxs(p.Tabs,{"data-role":"dashboard-tabs-container",className:p.cn("relative flex h-full flex-col",E==null?void 0:E.dashboardTabsContainer),onValueChange:J=>{L(J)},value:F||void 0,children:[ge(),$==="top"&&!q&&l.jsx(RA,{}),F&&!q&&l.jsx(wvt,{}),q?l.jsx("div",{"data-role":"dashboard-tabs-content",className:"min-h-0 flex-1 grow basis-0 overflow-hidden",children:ie()}):l.jsx(Ea,{"data-role":"dashboard-tabs-content",className:"flex-1 grow basis-0 overflow-y-auto",children:ie()}),$==="bottom"&&!q&&l.jsx(RA,{}),l.jsx(oot,{open:d,setOpen:f})]})}const re=S.useCallback(J=>{w("dashboard",J)},[w]);return T?a&&F&&!q?l.jsxs("div",{"data-document-render-error":"true",className:"bg-white p-8 text-sm text-zinc-700",children:['Requested document sheet "',F,'" was not found or is not a document sheet in the loaded dashboard.']}):a&&q&&A?l.jsx("div",{"data-role":"dashboard-document-print-content",className:"min-h-0 overflow-visible bg-white",children:l.jsx(G7,{sheet:A})}):l.jsxs(l.Fragment,{children:[l.jsx(ivt,{}),l.jsx(uvt,{}),l.jsxs("div",{className:"relative flex-1 basis-0 overflow-hidden",children:[l.jsxs(Tce,{className:p.cn("flex-1 basis-0 overflow-y-auto transition-opacity",_&&"pointer-events-none opacity-0"),direction:"horizontal",children:[l.jsx(oR,{children:Te()}),r===!0&&l.jsxs(l.Fragment,{children:[l.jsx(rot,{open:k,onTabClick:H,withHandle:!0,disabled:!k}),l.jsx(oR,{className:"flex grow","data-role":"dashboard-assistant-panel",onResize:ne,defaultSize:k?40:0,ref:c,children:l.jsx("div",{className:"grow overflow-y-auto",children:l.jsx(X0t,{open:k,setOpen:H,isFullscreen:_,onFullscreenChange:J=>x(J?"dashboard":null),fullscreenContainer:N})})})]})]}),l.jsx("div",{ref:re,className:p.cn("absolute inset-0",!_&&"pointer-events-none")}),se&&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||H(!0)},onMouseDown:h,onTouchStart:h,title:"Open Assistant (drag to move)",children:l.jsx(Epe,{className:"h-5 w-5"})})})]})]}):null}const Zfe=S.forwardRef(({appearance:e,organizationAppearance:t,tokenAppearance:n,reactAppearance:r,resolvedAppearance:s,children:o,className:i,style:a,...c},u)=>{const d=S.useId(),f=S.useMemo(()=>Svt(d),[d]),{theme:h}=OR(),m=Cvt(h),g=S.useMemo(()=>s??kc.resolveAppearance({organizationAppearance:t,tokenAppearance:n,reactAppearance:r??e}),[e,t,r,s,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(Ag,{...c,ref:u,className:i,style:a,children:o})})});Zfe.displayName="AppearanceProvider";function Svt(e){return`semaphor-appearance-${e.replace(/[^a-zA-Z0-9_-]/g,"")}`}function Cvt(e){const t=BS(e),[n,r]=S.useState(()=>Nvt());return S.useEffect(()=>{var i,a;if(t!=="system"||typeof window>"u")return;const s=(i=window.matchMedia)==null?void 0:i.call(window,"(prefers-color-scheme: dark)");if(!s)return;const o=()=>{r(s.matches?"dark":"light")};return o(),typeof s.addEventListener=="function"?(s.addEventListener("change",o),()=>s.removeEventListener("change",o)):((a=s.addListener)==null||a.call(s,o),()=>{var c;return(c=s.removeListener)==null?void 0:c.call(s,o)})},[t]),t==="system"?n:t}function Nvt(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}const Xfe=S.createContext({openBrandStudioPreview:()=>{}}),kvt=Xfe.Provider;function _vt(){return S.useContext(Xfe)}function jvt({children:e,defaultTheme:t="system",storageKey:n="vite-ui-theme",...r}){const s=BS(t),[o,i]=S.useState(()=>Ivt(n)||s),a=S.useCallback(u=>{const d=BS(u);Evt(n,d),i(d)},[n]),c=S.useMemo(()=>({theme:o,setTheme:a}),[o,a]);return l.jsx(bq.Provider,{...r,value:c,children:e})}function Ivt(e){if(typeof window>"u")return null;try{const t=window.localStorage.getItem(e);if(!t)return null;const n=BS(t,"system");return n===t?n:null}catch{return null}}function Evt(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(e,t)}catch{}}const Tvt=S.lazy(()=>Promise.resolve().then(()=>require("../brand-studio/index.cjs")).then(e=>({default:e.BrandStudioEditor})));function Y3({appearance:e,children:t}){var T,D;const{authToken:n,id:r,tokenProps:s}=ht(),o=_0(),i=(T=o.data)==null?void 0:T.organizationAppearance,a=(D=s.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=`${s.apiServiceUrl??""}:${(n==null?void 0:n.accessToken)??""}`,v=Dn({queryKey:jG({resourceType:Kr.DASHBOARD,apiServiceUrl:s.apiServiceUrl,accessToken:n==null?void 0:n.accessToken}),queryFn:async()=>p.getRequest(`${s.apiServiceUrl}/management/v1/dashboards`,(n==null?void 0:n.accessToken)||""),select:R=>(R==null?void 0:R.organizationAppearance)??null,enabled:!o.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,k=S.useMemo(()=>kc.resolveAppearance({organizationAppearance:N,tokenAppearance:a,reactAppearance:e}),[e,N,a]),_=S.useCallback(()=>{f(g??h??k),u(!0)},[g,h,k]),j=S.useCallback(()=>{u(!1)},[]);S.useEffect(()=>{f(null),m(null),b(null),u(!1)},[r]);const E=S.useMemo(()=>({openBrandStudioPreview:_}),[_]),I=g??h??e;return l.jsx(jvt,{defaultTheme:"system",storageKey:"vite-ui-theme",children:l.jsx(kvt,{value:E,children:l.jsx(Zfe,{organizationAppearance:N,tokenAppearance:a,reactAppearance:I,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(Tvt,{appearance:d,onDraftChange:b,onSave:R=>{m(R),b(R),f(R)},onCancel:j})})})]})})})})}function Qfe({children:e,preferences:t}){const{currentUser:n}=Ki(),r=S.useMemo(()=>{var s,o;return{preferences:t||{},isLocalDev:((s=t==null?void 0:t.uiMode)==null?void 0:s.developer)||!1,isConsoleMode:((o=t==null?void 0:t.uiMode)==null?void 0:o.console)||!1}},[t]);return l.jsx(NG.Provider,{value:r,children:l.jsx(Q_,{displayPreferences:t==null?void 0:t.cardDisplay,currentUser:n,children:e})})}function Dvt(e=2e3,t=500){const n=Ume(),[r,s]=S.useState(!1),[o,i]=S.useState(!1),a=S.useRef(null);return S.useEffect(()=>{const c=setTimeout(()=>s(!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]),o}function K3({delayMs:e=2e3,quietMs:t=500,componentType:n,componentId:r}){const s=Dvt(e,t);return S.useEffect(()=>(s&&(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()}}),[s,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:s?"ready":""})}function Jfe(e){if(typeof window>"u")return null;const{preferences:t}=e;return l.jsx(ka,{FallbackComponent:Z_,children:l.jsxs(HR,{dashboardProps:e,children:[l.jsx(K3,{componentType:"dashboard",componentId:e.id}),l.jsx(Y3,{appearance:e.appearance,children:l.jsx(Qfe,{preferences:t,children:l.jsx("main",{className:"flex h-full flex-col",children:l.jsx(wP,{...e,type:"dashboard",children:l.jsx(Kfe,{})})})})})]})})}function Mvt(e=[]){const t=S.useRef(null),n=S.useRef(null),r=S.useRef(null),[s,o]=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);o(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:s,updateAvailableWidth:i}}function Avt({filter:e}){var g;const t=p.useDashboardStore(b=>b.isDashboardEditing),{preferences:n}=Yp(),r=Dh((g=n==null?void 0:n.cardDisplay)==null?void 0:g.mode),s=p.useDashboardStore(b=>b.filterValues),o=s==null?void 0:s.some(b=>b.filterId===e.id),{removeFilterValues:i,removeFilter:a,updateFilter:c}=p.useDashboardActions(),{headerRef:u,leftActionsRef:d,rightActionsRef:f,titleMaxWidth:h,updateAvailableWidth:m}=Mvt([t,o,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(Ho,{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(U5,{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(p.X,{className:"size-3.5"})})]})]}),l.jsx("div",{className:"hidden",ref:f})]})}function Rvt(){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(Avt,{filter:r}),l.jsx(H_,{filter:r})]},r.id))}):null}function Pvt(){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),s=(i=e.sheets)==null?void 0:i.find(a=>a.id===t),o=p.isDocumentSheet(s);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&&!o&&l.jsx(Rvt,{}),l.jsx(Kfe,{})]})})}const Fvt=S.lazy(()=>Promise.resolve().then(()=>require("./dashboard-controls-J71GLAxt.js"))),Ovt=S.lazy(()=>Promise.resolve().then(()=>require("./edit-dashboard-visual-dvhQzG_h.js"))),Lvt=S.lazy(()=>Promise.resolve().then(()=>require("./dashboard-json-Cv8jXh0X.js")));function $vt({showControls:e=!1,showFooter:t=!0,...n}){const r=p.useDashboardStore(a=>a.isVisualEditing),s=p.useDashboardStore(a=>a.showDashboardJSON),{appearance:o,preferences:i}=n;return l.jsx(ka,{FallbackComponent:Z_,children:l.jsxs(HR,{dashboardProps:n,children:[l.jsx(K3,{componentType:"surfboard",componentId:n.id}),l.jsxs(Y3,{appearance:o,children:[l.jsx(Pbe,{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(Qfe,{preferences:i,children:[s&&l.jsx(S.Suspense,{fallback:null,children:l.jsx(Lvt,{})}),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(Fvt,{})}),l.jsx("div",{className:"flex grow overflow-hidden",children:l.jsx("div",{className:"flex min-w-0 flex-1",children:l.jsxs(wP,{...n,type:"dashboard",children:[r&&l.jsx(S.Suspense,{fallback:null,children:l.jsx(Ovt,{})}),l.jsx(Pvt,{})]})})})]})]})]})]})})}var zvt=Object.defineProperty,Bvt=(e,t,n)=>t in e?zvt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,W1=(e,t,n)=>Bvt(e,typeof t!="symbol"?t+"":t,n);const Vvt={stringify:e=>e?"true":"false",parse:e=>/^[ty1-9]/i.test(e)},Hvt={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}},Uvt={stringify:e=>JSON.stringify(e),parse:e=>JSON.parse(e)};function qvt(e){return e.replace(/([a-z0-9])([A-Z])/g,(t,n,r)=>`${n}-${r.toLowerCase()}`)}function ehe(e){return e.replace(/[-:]([a-z])/g,(t,n)=>`${n.toUpperCase()}`)}const Wvt={stringify:e=>e.name,parse:(e,t,n)=>{const r=(()=>{const s=ehe(t);if(typeof n<"u"&&s in n.container)return n.container[s]})();return typeof r=="function"?r.bind(n):void 0}},Gvt={stringify:e=>`${e}`,parse:e=>parseFloat(e)},Yvt={stringify:e=>e,parse:e=>e},$D={string:Yvt,number:Gvt,boolean:Vvt,function:Hvt,method:Wvt,json:Uvt},Bb=Symbol.for("r2wc.render"),G1=Symbol.for("r2wc.connected"),Od=Symbol.for("r2wc.context"),Qo=Symbol.for("r2wc.props");function Kvt(e,t,n){var r,s,o;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=qvt(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(),W1(this,o,!0),W1(this,s),W1(this,r,{}),W1(this,"container"),t.shadow?this.container=this.attachShadow({mode:t.shadow}):this.container=this,this[Qo].container=this.container;for(const g of i){const b=d[g],x=this.getAttribute(b),y=c[g],w=y?$D[y]:null;if(y==="method"){const v=ehe(b);Object.defineProperty(this[Qo].container,v,{enumerable:!0,configurable:!0,get(){return this[Qo][v]},set(C){this[Qo][v]=C,this[Bb]()}}),this[Qo][g]=w.parse(x,b,this)}w!=null&&w.parse&&x&&(this[Qo][g]=w.parse(x,b,this))}for(const g of a)this[Qo][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[G1]=!0,this[Bb]()}disconnectedCallback(){this[G1]=!1,this[Od]&&n.unmount(this[Od]),delete this[Od]}attributeChangedCallback(g,b,x){const y=f[g],w=c[y],v=w?$D[w]:null;y in c&&v!=null&&v.parse&&x&&(this[Qo][y]=v.parse(x,g,this),this[Bb]())}[(o=G1,s=Od,r=Qo,Bb)](){this[G1]&&(this[Od]?n.update(this[Od],this[Qo]):this[Od]=n.mount(this.container,e,this[Qo]))}}for(const m of i){const g=d[m],b=c[m];Object.defineProperty(h.prototype,m,{enumerable:!0,configurable:!0,get(){return this[Qo][m]},set(x){this[Qo][m]=x;const y=b?$D[b]:null;if(y!=null&&y.stringify){const w=y.stringify(x,g,this);this.getAttribute(g)!==w&&this.setAttribute(g,w)}else this[Bb]()}})}return h}function Zvt(e,t,n){const r=Ehe.createRoot(e),s=S.createElement(t,n);return r.render(s),{root:r,ReactComponent:t}}function Xvt({root:e,ReactComponent:t},n){const r=S.createElement(t,n);e.render(r)}function Qvt({root:e}){e.unmount()}function Jvt(e,t={}){return Kvt(e,t,{mount:Zvt,update:Xvt,unmount:Qvt})}const ewt={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"},twt=Jvt(Jfe,{props:ewt}),nwt=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(UL,{context:t})," "]})}),the=new Set(["askForMoreInfo","getAvailableChartTypes","getChartSQLSyntax","getDomainRelationships","getTableColumns","getUserSql","validateCardConfigFormat"]),rwt=new Set(["createChartFromSql","createForecast","generateQueryConfig","getChartDataFromCardConfig","getChartDataFromSqlAndPython","getForecastDataFromSqlAndPython"]),swt=Array.from(the).join(", "),owt=3,iwt="Self-heal",awt=new Set(["SQL_PARSE_ERROR","SQL_EXPLAIN_ERROR"]);function lwt({card:e}){var W,O,Z,Y,M;const[t,n]=S.useState({}),{authToken:r}=ht(),s=p.getTokenParams(r==null?void 0:r.accessToken),{compiledAppearance:o}=p.useAppearance(),i=S.useMemo(()=>Nv(o),[o]),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}=$h(((W=f.customCardPreferences)==null?void 0:W.url)||""),g=(O=m==null?void 0:m.visuals)==null?void 0:O.find(K=>{var L;return K.name===((L=f.customCardPreferences)==null?void 0:L.componentName)}),b=kv(f,g)??"single",x=S.useMemo(()=>K5({frame:a,configCard:f,isMultiInputVisual:b==="multiple"}),[a,f,b]),y=S.useMemo(()=>{const K=x.findIndex(L=>(L==null?void 0:L.id)===e.id);return K<0?-1:qy(e,K)},[x,e]),w=S.useMemo(()=>b!=="multiple"||y<0?e.type:Ym(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}=Ak(v),N=p.useInteractionStore(K=>K.interactionStates),k=p.useDashboardStore(K=>{var L;return(L=K.dashboard)==null?void 0:L.id}),_=p.useDashboardStore(K=>K.dashboard.filters),j=p.useDashboardStore(K=>K.filterValues),E=p.useDashboardStore(K=>K.selectedSheetId),I=S.useMemo(()=>W5({card:e,sheetId:E||"",inlineFilterValues:c,setInlineFilterValue:K=>u(e.id,K),removeInlineFilterValue:K=>d(e.id,K)}),[e,E,c,u,d]),{cardFilters:T,cardFilterValues:D}=S.useMemo(()=>B0({card:e,interactionStates:N,currentDashboardId:k,filters:_,filterValues:j,selectedSheetId:E}),[e,N,k,_,j,E]),R=S.useCallback((K,L)=>{const z=X5(L);n(B=>({...B,[K]:z}))},[]),F=(Z=f.customCardPreferences)==null?void 0:Z.componentName,A=F?h(F):null,U=lN((Y=f.customCardPreferences)==null?void 0:Y.settings,f),$=S.useMemo(()=>Y5(x),[x]),q=S.useMemo(()=>$.map((K,L)=>Ym(K,L,g==null?void 0:g.slots)),[$,g==null?void 0:g.slots]);return F?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:[A&&b==="single"&&l.jsx(A,{editing:!0,params:s,theme:i,settings:U,cardMetadata:Foe({card:e,dataMetadata:C==null?void 0:C.metadata}),onDataChange:R,data:(C==null?void 0:C.records)||[],filters:T,filterValues:[...D||[],...c||[]],inlineFilters:I}),A&&b==="multiple"&&l.jsxs(l.Fragment,{children:[x.map((K,L)=>{if(!K)return null;const z=qy(K,L),B=Ym(K,z,g==null?void 0:g.slots);return l.jsx(x5,{onDataChange:R,card:K,effectiveCardType:B},`${K.id}-${z}`)}),l.jsx("div",{className:"flex flex-col gap-2",children:l.jsx(A,{editing:!0,onDataChange:R,...Q5({configCard:f,slotOrderedCards:$,slotTypes:q,multiInputData:t,params:s,theme:i,chartSettings:U,filters:T,filterValues:[...D||[],...c||[]],inlineFilters:I})})})]})]},(M=f.customCardPreferences)==null?void 0:M.componentName)}):null}const cwt=S.memo(lwt,(e,t)=>{var n,r,s,o,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)&&((s=e.card.customCardPreferences)==null?void 0:s.slotSettings)===((o=t.card.customCardPreferences)==null?void 0:o.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)}),uwt=p.create()(p.persist((e,t)=>({starredCharts:[],isStarred:(n,r)=>t().starredCharts.some(s=>s.type===n&&s.id===r),toggleStar:n=>{e(r=>{const s=r.starredCharts.findIndex(o=>o.type===n.type&&o.id===n.id);return s>=0?{starredCharts:r.starredCharts.filter((o,i)=>i!==s)}:{starredCharts:[...r.starredCharts,n]}})},getStarredChart:(n,r)=>t().starredCharts.find(s=>s.type===n&&s.id===r)}),{name:"semaphor-starred-charts"}));var nhe=["PageUp","PageDown"],rhe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],she={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Gg="Slider",[MR,dwt,fwt]=p.createCollection(Gg),[ohe]=p.createContextScope(Gg,[fwt]),[hwt,Wj]=ohe(Gg),ihe=Q.forwardRef((e,t)=>{const{name:n,min:r=0,max:s=100,step:o=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"?mwt:pwt,[C=[],N]=p.useControllableState({prop:d,defaultProp:u,onChange:T=>{var R;(R=[...x.current][y.current])==null||R.focus(),f(T)}}),k=Q.useRef(C);function _(T){const D=vwt(C,T);I(T,D)}function j(T){I(T,y.current)}function E(){const T=k.current[y.current];C[y.current]!==T&&h(C)}function I(T,D,{commit:R}={commit:!1}){const F=Nwt(o),A=kwt(Math.round((T-r)/o)*o+r,F),U=p.clamp(A,[r,s]);N(($=[])=>{const q=xwt($,U,D);if(Cwt(q,c*o)){y.current=q.indexOf(U);const W=String(q)!==String($);return W&&R&&h(q),W?q:$}else return $})}return l.jsx(hwt,{scope:e.__scopeSlider,name:n,disabled:a,min:r,max:s,valueIndexToChangeRef:y,thumbs:x.current,values:C,orientation:i,form:g,children:l.jsx(MR.Provider,{scope:e.__scopeSlider,children:l.jsx(MR.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||(k.current=C)}),min:r,max:s,inverted:m,onSlideStart:a?void 0:_,onSlideMove:a?void 0:j,onSlideEnd:a?void 0:E,onHomeKeyDown:()=>!a&&I(r,0,{commit:!0}),onEndKeyDown:()=>!a&&I(s,C.length-1,{commit:!0}),onStepKeyDown:({event:T,direction:D})=>{if(!a){const A=nhe.includes(T.key)||T.shiftKey&&rhe.includes(T.key)?10:1,U=y.current,$=C[U],q=o*A*D;I($+q,U,{commit:!0})}}})})})})});ihe.displayName=Gg;var[ahe,lhe]=ohe(Gg,{startEdge:"left",endEdge:"right",size:"width",direction:1}),mwt=Q.forwardRef((e,t)=>{const{min:n,max:r,dir:s,inverted:o,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(s),x=b==="ltr",y=x&&!o||!x&&o;function w(v){const C=g.current||f.getBoundingClientRect(),N=[0,C.width],_=Z3(N,y?[n,r]:[r,n]);return g.current=C,_(v-C.left)}return l.jsx(ahe,{scope:e.__scopeSlider,startEdge:y?"left":"right",endEdge:y?"right":"left",direction:y?1:-1,size:"width",children:l.jsx(che,{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=she[y?"from-left":"from-right"].includes(v.key);u==null||u({event:v,direction:N?-1:1})}})})}),pwt=Q.forwardRef((e,t)=>{const{min:n,max:r,inverted:s,onSlideStart:o,onSlideMove:i,onSlideEnd:a,onStepKeyDown:c,...u}=e,d=Q.useRef(null),f=p.useComposedRefs(t,d),h=Q.useRef(void 0),m=!s;function g(b){const x=h.current||d.current.getBoundingClientRect(),y=[0,x.height],v=Z3(y,m?[r,n]:[n,r]);return h.current=x,v(b-x.top)}return l.jsx(ahe,{scope:e.__scopeSlider,startEdge:m?"bottom":"top",endEdge:m?"top":"bottom",size:"height",direction:m?1:-1,children:l.jsx(che,{"data-orientation":"vertical",...u,ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:b=>{const x=g(b.clientY);o==null||o(x)},onSlideMove:b=>{const x=g(b.clientY);i==null||i(x)},onSlideEnd:()=>{h.current=void 0,a==null||a()},onStepKeyDown:b=>{const y=she[m?"from-bottom":"from-top"].includes(b.key);c==null||c({event:b,direction:y?-1:1})}})})}),che=Q.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:s,onSlideEnd:o,onHomeKeyDown:i,onEndKeyDown:a,onStepKeyDown:c,...u}=e,d=Wj(Gg,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()):nhe.concat(rhe).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)&&s(f)}),onPointerUp:p.composeEventHandlers(e.onPointerUp,f=>{const h=f.target;h.hasPointerCapture(f.pointerId)&&(h.releasePointerCapture(f.pointerId),o(f))})})}),uhe="SliderTrack",dhe=Q.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,s=Wj(uhe,n);return l.jsx(p.Primitive.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:t})});dhe.displayName=uhe;var AR="SliderRange",fhe=Q.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,s=Wj(AR,n),o=lhe(AR,n),i=Q.useRef(null),a=p.useComposedRefs(t,i),c=s.values.length,u=s.values.map(h=>phe(h,s.min,s.max)),d=c>1?Math.min(...u):0,f=100-Math.max(...u);return l.jsx(p.Primitive.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:a,style:{...e.style,[o.startEdge]:d+"%",[o.endEdge]:f+"%"}})});fhe.displayName=AR;var RR="SliderThumb",hhe=Q.forwardRef((e,t)=>{const n=dwt(e.__scopeSlider),[r,s]=Q.useState(null),o=p.useComposedRefs(t,a=>s(a)),i=Q.useMemo(()=>r?n().findIndex(a=>a.ref.current===r):-1,[n,r]);return l.jsx(gwt,{...e,ref:o,index:i})}),gwt=Q.forwardRef((e,t)=>{const{__scopeSlider:n,index:r,name:s,...o}=e,i=Wj(RR,n),a=lhe(RR,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:phe(m,i.min,i.max),b=ywt(r,i.values.length),x=h==null?void 0:h[a.size],y=x?wwt(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(MR.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,...o,ref:d,style:m===void 0?{display:"none"}:e.style,onFocus:p.composeEventHandlers(e.onFocus,()=>{i.valueIndexToChangeRef.current=r})})}),f&&l.jsx(mhe,{name:s??(i.name?i.name+(i.values.length>1?"[]":""):void 0),form:i.form,value:m},r)]})});hhe.displayName=RR;var bwt="RadioBubbleInput",mhe=Q.forwardRef(({__scopeSlider:e,value:t,...n},r)=>{const s=Q.useRef(null),o=p.useComposedRefs(s,r),i=p.usePrevious(t);return Q.useEffect(()=>{const a=s.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:o,defaultValue:t})});mhe.displayName=bwt;function xwt(e=[],t,n){const r=[...e];return r[n]=t,r.sort((s,o)=>s-o)}function phe(e,t,n){const o=100/(n-t)*(e-t);return p.clamp(o,[0,100])}function ywt(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function vwt(e,t){if(e.length===1)return 0;const n=e.map(s=>Math.abs(s-t)),r=Math.min(...n);return n.indexOf(r)}function wwt(e,t,n){const r=e/2,o=Z3([0,50],[0,r]);return(r-o(t)*n)*n}function Swt(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function Cwt(e,t){if(t>0){const n=Swt(e);return Math.min(...n)>=t}return!0}function Z3(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 Nwt(e){return(String(e).split(".")[1]||"").length}function kwt(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var ghe=ihe,_wt=dhe,jwt=fhe,Iwt=hhe;const bhe=Q.forwardRef(({className:e,...t},n)=>l.jsxs(ghe,{ref:n,className:p.cn("relative flex w-full touch-none select-none items-center",e),...t,children:[l.jsx(_wt,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:l.jsx(jwt,{className:"absolute h-full bg-primary"})}),l.jsx(Iwt,{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"})]}));bhe.displayName=ghe.displayName;const xhe=["SUN","MON","TUE","WED","THU","FRI","SAT"],Ewt=xhe.reduce((e,t,n)=>({...e,[t]:n}),{}),Ll={repeats:"weekly",hour:9,minute:0,weekdays:[1,2,3,4,5],isCustom:!1};function Twt(e){if(!e||!e.trim())return{...Ll};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{...Ll,isCustom:!0};const[s,o,i,a,c]=r,u=Number(s),d=Number(o);if(!Number.isInteger(u)||u<0||u>59||!Number.isInteger(d)||d<0||d>23)return{...Ll,isCustom:!0};if(i==="*"&&(c==="?"||c==="*"))return{...Ll,repeats:"daily",hour:d,minute:u};if(i==="?"&&c!=="?"&&c!=="*"){const h=c.split(",").map(m=>m.toUpperCase()).map(m=>Ewt[m]).filter(m=>typeof m=="number");if(h.length>0)return{...Ll,repeats:"weekly",hour:d,minute:u,weekdays:h}}return i==="1,15"&&(c==="?"||c==="*")?{...Ll,repeats:"biweekly",hour:d,minute:u}:i==="1"&&(c==="?"||c==="*")?{...Ll,repeats:"monthly",hour:d,minute:u}:{...Ll,hour:d,minute:u,isCustom:!0}}function Dwt(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((s,o)=>s-o).map(s=>xhe[s]).join(","):"MON";return`cron(${t} ${n} ? * ${r} *)`}case"biweekly":return`cron(${t} ${n} 1,15 * ? *)`;case"monthly":return`cron(${t} ${n} 1 * ? *)`}}function yhe(e,t){const n=e<12?"AM":"PM",r=e%12===0?12:e%12,s=t.toString().padStart(2,"0");return`${r}:${s} ${n}`}function Mwt(e){return!e||e==="UTC"?"UTC":(e.split("/").pop()??e).replace(/_/g," ")}function Awt(e){if(e.length===7)return"every day";const t=e.slice().sort((s,o)=>s-o);if(t.length===5&&t.every(s=>s>=1&&s<=5))return"weekdays";const r=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];return t.map(s=>r[s]).join(", ")}function Rwt(e,t,n,r){const s=yhe(e.hour,e.minute),o=Mwt(t);let i;if(e.isCustom)i=`Custom schedule · ${s} ${o}`;else switch(e.repeats){case"daily":i=`Daily at ${s} ${o}`;break;case"weekly":i=`Weekly · ${Awt(e.weekdays)} at ${s} ${o}`;break;case"biweekly":i=`Every two weeks (1st and 15th) at ${s} ${o}`;break;case"monthly":i=`Monthly on the 1st at ${s} ${o}`;break}const a=[];return n&&n!=="Today"&&a.push(`from ${n}`),r&&a.push(`until ${r}`),a.length>0?`${i}, ${a.join(" ")}`:i}const Pwt=["UTC","America/New_York","America/Chicago","America/Denver","America/Los_Angeles","Europe/London","Europe/Berlin","Asia/Singapore","Asia/Tokyo","Australia/Sydney"];exports.Accordion=FL;exports.AccordionContent=r0;exports.AccordionItem=t0;exports.AccordionTrigger=n0;exports.AddDataPicker=N3;exports.AggregateTable=x_;exports.Alert=mF;exports.AlertDescription=pF;exports.AlertDialog=kh;exports.AlertDialogAction=ad;exports.AlertDialogCancel=ld;exports.AlertDialogContent=nd;exports.AlertDialogDescription=id;exports.AlertDialogFooter=sd;exports.AlertDialogHeader=rd;exports.AlertDialogTitle=od;exports.AlertDialogTrigger=tye;exports.AlertTitle=UZ;exports.ArrowDown=ps;exports.ArrowDownIcon=Aqe;exports.ArrowLeft=I0;exports.ArrowRight=XN;exports.ArrowUp=Ms;exports.ArrowUpIcon=Pqe;exports.AssistantContextEntityControls=bR;exports.AssistantVirtualizedMessages=qfe;exports.AtSign=Uq;exports.AxisConfigurator=rg;exports.Badge=ls;exports.Bell=Z1;exports.BookType=Wq;exports.BulletChartIcon=Ofe;exports.COMMON_TIMEZONES=Pwt;exports.CSS=bi;exports.CalculatedFieldEditor=Yae;exports.Calculator=Yq;exports.Calendar=ii;exports.Calendar$1=CS;exports.CalendarRange=Kq;exports.Card=ry;exports.CardContent=YR;exports.CardHeader=GR;exports.CardSummary=BA;exports.CardTitle=Gp;exports.ChartArea=c2;exports.ChartColumnIncreasing=Zq;exports.ChartColumnStacked=Xq;exports.ChartJsVisual=gv;exports.ChartLine=Qq;exports.ChartNoAxesGantt=eW;exports.ChartPie=tW;exports.ChartScatter=nW;exports.ChatInputWithContext=k3;exports.Checkbox=Mn;exports.ChevronLeft=wh;exports.ChevronRight=Bn;exports.ChevronsUpDown=oW;exports.Circle=KR;exports.CircleAlert=qf;exports.CircleCheck=iW;exports.CircleHelp=aW;exports.Clock=ZR;exports.CodeHighlighter=Vf;exports.CodeXml=X1;exports.Collapsible=Sc;exports.CollapsibleContent=Nc;exports.CollapsibleTrigger=Cc;exports.ColorField=Ai;exports.Command=cj;exports.CommandEmpty=dj;exports.CommandGroup=fj;exports.CommandInput=NL;exports.CommandItem=hj;exports.CommandList=uj;exports.CommandSeparator=mae;exports.ComparisonMetadataBadge=pee;exports.Container=wP;exports.ControlDefaultValueEditor=gle;exports.ControlDefinitionOptionsEditor=ple;exports.ControlIdInput=dle;exports.ControlVisibilitySettings=Wet;exports.Copy=Tu;exports.CopyButton=Iu;exports.CopyPlus=d2;exports.Cross2Icon=$qe;exports.CustomFilterPopover=U5;exports.CustomScrollArea=Ea;exports.DEFAULT_HEATMAP_CUSTOM_RANGE=bJ;exports.DEFAULT_SCHEDULE_VM=Ll;exports.Dashboard=Jfe;exports.DashboardCard=vie;exports.DashboardCreateDialogBase=eY;exports.DashboardExportDialog=Wfe;exports.DashboardPlus=$vt;exports.DashboardWC=twt;exports.DataTableConditionalFormattingSettings=sce;exports.DataTablePagination=a_;exports.Database=zi;exports.DateRangePicker=N5;exports.DefaultChatTransport=g3;exports.Dialog=_o;exports.DialogContent=ao;exports.DialogDescription=Go;exports.DialogFooter=Ic;exports.DialogHeader=Zi;exports.DialogTitle=lo;exports.DialogTrigger=XG;exports.DisplayPreferencesProvider=Q_;exports.DndContext=Fv;exports.Donut=lW;exports.Download=_c;exports.DownloadPdf=Gfe;exports.DragOverlay=eae;exports.DropdownMenu=zs;exports.DropdownMenuCheckboxItem=Kc;exports.DropdownMenuContent=Ns;exports.DropdownMenuItem=vn;exports.DropdownMenuLabel=da;exports.DropdownMenuRadioGroup=lbe;exports.DropdownMenuRadioItem=CG;exports.DropdownMenuSeparator=Ui;exports.DropdownMenuSub=fP;exports.DropdownMenuSubContent=ik;exports.DropdownMenuSubTrigger=ok;exports.DropdownMenuTrigger=Bs;exports.EMPTY_DATA_SOURCE=Up;exports.Editable=uN;exports.EditableText=Ho;exports.EditorCustomVisual=cwt;exports.Ellipsis=ui;exports.EllipsisVertical=Sh;exports.ErrorBoundary=ka;exports.ExportError=ug;exports.ExternalLink=hp;exports.Eye=E0;exports.EyeOff=QN;exports.Fallback=Z_;exports.FallbackVisual=Gy;exports.FeedbackCategory=ed;exports.FeedbackDialog=g0;exports.FieldsList=UL;exports.FieldsSection=nwt;exports.FileCode=cW;exports.FileSpreadsheet=uW;exports.FileText=di;exports.Filter=Wf;exports.FilterComponent=H_;exports.FilterInfo=OA;exports.FilterableFieldsPanel=Zae;exports.Globe=Ch;exports.Grid3x3=f2;exports.GripVertical=jc;exports.HEATMAP_PRESET_PALETTES=xM;exports.Hash=dW;exports.House=fW;exports.HoverCard=dg;exports.HoverCardContent=Bu;exports.HoverCardTrigger=fg;exports.INLINE_ALLOWED_READ_ONLY_TOOLS=the;exports.INLINE_ALLOWED_TOOL_LIST=swt;exports.INLINE_BLOCKED_MUTATING_TOOLS=rwt;exports.IconButton=cc;exports.IconForFieldType=TS;exports.InfoHover=fL;exports.InlineFilterBar=uie;exports.KPICard=Yu;exports.KeyboardSensor=Rv;exports.Layers=T0;exports.LayoutDashboard=Gf;exports.Link=XR;exports.LoadingDots=Hu;exports.Lock=JN;exports.MAX_SELF_HEAL_ATTEMPTS=owt;exports.Map=pW;exports.Markdown=Jde;exports.MatrixTableVisual=b_;exports.Maximize2=ek;exports.MdStackedLineChart=Pfe;exports.Minimize2=QR;exports.MultiInputEmptyRenderer=x5;exports.PYTHON_DEFAULT_CODE=FR;exports.PanelResizeHandle=Tj;exports.Paperclip=gW;exports.PenLine=h2;exports.Pencil=m2;exports.PendingMessagesDisplay=mde;exports.PersistedDynamicVisual=X_;exports.PiChartPolar=Dfe;exports.Pin=xW;exports.PinOff=bW;exports.PivotTableTanstack=Mg;exports.Placeholders=Dce;exports.Play=yW;exports.Plus=kr;exports.PointerSensor=Lg;exports.Progress=S3;exports.RECOVERABLE_SQL_ERROR_CODES=awt;exports.Radar=vW;exports.RadioGroup=Sa;exports.RadioGroupItem=ws;exports.RefreshCw=Yf;exports.ResizableHandle=not;exports.ResizablePanel=oR;exports.ResizablePanelGroup=Tce;exports.ResourceEditDialog=DY;exports.ResourceType=Kr;exports.SELF_HEAL_TIMELINE_STEP=iwt;exports.Search=$s;exports.SeedQuestions=Jue;exports.SemaphorContext=k0;exports.SemaphorContextProvider=HR;exports.SemaphorQueryClient=Lq;exports.SemaphorReadyIndicator=K3;exports.SemaphorStyleWrapper=Ag;exports.Send=wW;exports.Settings=JR;exports.Settings2=D0;exports.Share2=SW;exports.ShareDialog=TY;exports.Sheet=ree;exports.SheetContent=pO;exports.SheetDescription=bO;exports.SheetHeader=oee;exports.SheetTitle=gO;exports.SheetTrigger=GPe;exports.Slider=bhe;exports.SortableContext=Ov;exports.Sparkles=GS;exports.Square=tP;exports.SquarePen=eP;exports.Star=CW;exports.StructuralParticipantSelector=fle;exports.SummaryCard=RA;exports.TABLE_PRESENTATION_DEFAULT_STYLE=_u;exports.TABLE_PRESENTATION_DEFAULT_TOTALS_STYLE=Fi;exports.TableBody=zu;exports.TableCell=Tn;exports.TableColumnVisibilitySettings=Wle;exports.TableHead=es;exports.TableHeader=Ph;exports.TablePresentationSettings=Yle;exports.TableRow=wr;exports.TableSkeleton=hL;exports.TableVisual=Vu;exports.TbChartBubble=Mfe;exports.TbChartFunnel=Afe;exports.TbChartTreemap=Rfe;exports.TextCard=Op;exports.Textarea=jh;exports.TiSortNumerically=Ffe;exports.Toggle=Y_;exports.Tornado=NW;exports.Trash2=fl;exports.TreePalm=rP;exports.TrendingUp=kW;exports.TriangleAlert=Bi;exports.TypeGlyph=Ev;exports.UXProvider=Y3;exports.User=_W;exports.Users=nk;exports.applyFilterOverridesToDashboardInputSlots=uZ;exports.areContextEntitiesEqual=Qn;exports.areEntitiesJoined=SJ;exports.arrayMove=$g;exports.buildCardControlUsageById=Yet;exports.buildCustomCardTheme=Nv;exports.buildDashboardCardExecutionSnapshot=cZ;exports.buildDashboardControlUsageById=Get;exports.buildDashboardExecutionSnapshot=lF;exports.buildDashboardInputExecutionSnapshot=vu;exports.buildDashboardSheetsInputExecutionSnapshot=fZ;exports.buildDashboardStructuralParticipantIdsByControlId=yle;exports.buildFilterFieldMeta=TL;exports.buildFilterSemanticContext=DL;exports.buildInlineFilterNodes=W5;exports.buildMultiInputCustomVisualProps=Q5;exports.buildScheduleExpr=Dwt;exports.buildSchedulePreview=Rwt;exports.buildSlotOrderedCards=Y5;exports.calculateContextAwareFilters=B0;exports.calculateFieldState=iO;exports.canUserAccessVisuals=a0e;exports.canUserCreateDashboards=RY;exports.canUserEdit=s0e;exports.canUserManageDashboards=i0e;exports.canUserManageGroups=l0e;exports.canUserUseFilters=o0e;exports.cancelExport=FRe;exports.chartSupportsDataLabels=mQ;exports.chartSupportsLegend=fQ;exports.chartTypes=qj;exports.cleanupKpiMetricComparisonMode=Sae;exports.cloneDeep=$o;exports.cloneLinkedFrameWithSourceMapping=XGe;exports.closestCenter=Av;exports.commitSharedCalculatedFields=Wd;exports.createAssistantConversationId=Im;exports.createAssistantRequestId=Xue;exports.createCardsFromSlots=fWe;exports.createChartConfig=cg;exports.createDashboardControlInputFromControl=Hrt;exports.createDefaultGlobalDateFilter=pSe;exports.createExport=VJ;exports.createUniqueDashboardInputVariableNameFromName=Eu;exports.dedup=Xut;exports.doesStoredFilterMatchField=Vp;exports.downloadDocumentPdf=uF;exports.downloadPdf=vZ;exports.extractSqlParamReferences=Nse;exports.extractTableMetadata=EL;exports.fieldAlreadyExists=NJ;exports.findCustomVisualConfigCard=Z5;exports.findDashboardFrameById=iSe;exports.flexRender=Bo;exports.formatDisplayFormula=zQe;exports.formatFileSize=$Re;exports.formatFilterLine=WZ;exports.formatTimeLabel=yhe;exports.getAutoDetectedChartIcon=h0t;exports.getChartGridStyle=$Ne;exports.getChartIconByType=m0t;exports.getColorForValue=P2;exports.getConfigSlotExpectedType=dWe;exports.getCoreRowModel=s_;exports.getCustomVisualInputCards=K5;exports.getDateFormatOptionsForGranularity=Jy;exports.getDefaultAxisConfig=O2;exports.getDefaultChartColors=Mh;exports.getDefaultDataLabelsConfig=J0;exports.getDefaultExportFormat=cX;exports.getDefaultFilterSql=E5;exports.getDefaultLegendConfig=HF;exports.getDefaultRunningTotalPartitionByFieldIds=Yx;exports.getDocumentSectionEditorCard=ket;exports.getDocumentSheetDashboardInputs=Vv;exports.getDownloadUrl=PRe;exports.getEffectiveCardTypeForSlot=Ym;exports.getEntityIcon=BN;exports.getErrorMessage=$ue;exports.getExportStatus=RRe;exports.getExports=ARe;exports.getExpressionFieldKind=Zu;exports.getFieldExpressionAnnotation=ML;exports.getFilterCount=pN;exports.getGlobalDateFilter=Xp;exports.getGlobalDateFilterCoverage=gSe;exports.getGranularityOptionsForFieldType=ZL;exports.getKeys=lr;exports.getMatrixVisualLoadingState=g_;exports.getMetricDisplayLabel=tRe;exports.getNewField=EJ;exports.getObjectDiff=xq;exports.getPaginationRowModel=o_;exports.getRoleBasedDisplayOverrides=AY;exports.getRunningTotalOrderByCandidates=cQe;exports.getSelectedDateFilterColumn=_se;exports.getSheetScopedFilterValues=cy;exports.getSlotDefinitionForIndex=G5;exports.getSlotExpectedChartType=W_;exports.getSlotIndexForCard=qy;exports.getSortedRowModel=tee;exports.getSupportedExportFormats=lX;exports.getTableConditionalFormattingColumnOptions=Qle;exports.getTableOutputColumnOptions=Jle;exports.getTablePageSizeOptions=$J;exports.handleAggregationChange=LA;exports.handleAggregationLabelChange=lie;exports.hasFlatTableTotalsBehavior=uCe;exports.hasMatrixResultData=rv;exports.horizontalListSortingStrategy=vL;exports.isCalculatedFilterField=e0;exports.isCardSummaryVisibleOnCard=J5;exports.isCustomVisualConfigCard=MA;exports.isDefaultColor=yCe;exports.isEligibleFlatTableTotalsCard=Qp;exports.isExportComplete=LRe;exports.isExportInProgress=ORe;exports.isInAiScopeArray=Zut;exports.isManagedCalculatedExpressionField=xa;exports.isMetricTransformEnabled=aQe;exports.isPromiseLike=gR;exports.isSubtotalEnabledAggregateTable=IL;exports.isSupportedDocumentTableCardType=_et;exports.lastAssistantMessageIsCompleteWithToolCalls=Pue;exports.merge=dl;exports.mergeAxisConfig=L2;exports.normalizeConditionalFormatting=tF;exports.normalizeContextFormatMode=QZ;exports.normalizeDashboardInputVariableName=j0;exports.normalizeMultiInputPayload=X5;exports.parseScheduleExpr=Twt;exports.pivotData=W0;exports.prepareFeedbackData=Uj;exports.purify=fA;exports.reindexSlotCards=uWe;exports.remarkGfm=jfe;exports.removeFromScopeArray=Qut;exports.resolveDashboardInputContext=Nl;exports.resolveDomainCalculatedFieldForEdit=PJe;exports.resolveMultiInputType=kv;exports.resolveMultiInputTypeFromVisual=hWe;exports.resolveTablePageSize=t_;exports.resolveTablePresentationStyle=kO;exports.sanitizeAIScope=Lue;exports.saveCalculatedFieldToCardScope=ZA;exports.saveCalculatedFieldToSharedScope=Kae;exports.saveCalculatedFieldToSheetScope=XA;exports.seedSemanticMetricFormatDefaults=Nae;exports.setTableColumnVisibility=qJ;exports.setupEditorWithCard=Rk;exports.showAllTableColumns=HRe;exports.showJoinRequiredNotification=CJ;exports.sortByColumnsToSortState=kee;exports.sortStateToSortByColumns=_ee;exports.sortableKeyboardCoordinates=SL;exports.supportsMetricTransformForMetric=Cae;exports.supportsTableConditionalFormatting=Kle;exports.toEntityArray=ba;exports.ue=et;exports.useActiveExports=g0e;exports.useActiveToolStatus=gde;exports.useAddFrameWithFreshSemanticExecutionPayload=dL;exports.useAddNewFrame=Tie;exports.useAssistantContainer=OY;exports.useAssistantContextEntities=ej;exports.useAssistantLayoutStore=kf;exports.useAssistantPanel=PY;exports.useAssistantProfile=Que;exports.useAutoSubmitQueue=pde;exports.useBrandStudioPreview=_vt;exports.useCard=hRe;exports.useCardFilterValues=DJ;exports.useCardSummary=eL;exports.useChat=Oue;exports.useColumns=kL;exports.useCreateVisualWithFrame=sxe;exports.useCurrentUserInfo=Ki;exports.useCustomVisual=$h;exports.useCustomVisualsQuery=H5;exports.useDashboardAppearance=Dc;exports.useDashboardById=MG;exports.useDashboardPreferences=Yp;exports.useDashboardQuery=_0;exports.useDashboardStructuralParticipants=vle;exports.useDashboardSummary=qoe;exports.useDataColumns=_ae;exports.useDateFilterHook=U9e;exports.useDebounce=Vx;exports.useDefaultDashboardMutation=kG;exports.useDisplayPreferences=Cl;exports.useDroppable=Jie;exports.useEditorAside=mj;exports.useEditorCardQuery=Ak;exports.useEnsureReactGlobals=Jre;exports.useExportActions=LY;exports.useExportStore=mk;exports.useFieldManagement=kae;exports.useFilterableFields=yae;exports.useFullscreenAssistant=FY;exports.useGroupMembers=iye;exports.useGroups=SY;exports.useHasDashboardId=$Y;exports.useInProgressExportsCount=b0e;exports.useJoinabilityMap=jL;exports.useManagementActions=vh;exports.useManagementStore=Os;exports.useMutation=so;exports.usePivotTableConfig=Rh;exports.usePluginQuery=Doe;exports.useQuery=Dn;exports.useQueryClient=Zr;exports.useReactTable=i_;exports.useResolveExistingFrameSemanticExecutionPayload=tYe;exports.useResourceManagement=mP;exports.useResourceUpdateState=AG;exports.useScopedFields=xae;exports.useSelectedVisual=Gme;exports.useSemaphorContext=ht;exports.useSensor=Bp;exports.useSensors=sj;exports.useSortable=zg;exports.useStarredChartsStore=uwt;exports.useSurfaceAppearance=Tc;exports.useTableQueryState=gee;exports.useTextFilterHook=t7e;exports.useTheme=OR;exports.useTopoJson=tv;exports.useUnifiedUsers=yP;exports.useUpdateResource=IG;exports.useUpdateVisualMutation=oxe;exports.useUserPreferences=tY;exports.useVisualById=lk;exports.useVisualManagement=rxe;exports.validateFieldForChartType=wae;exports.verticalListSortingStrategy=wL;
1371
+ `).trim(),j=k.map((E,I)=>{var R,F;let T="",D;if((R=E.url)!=null&&R.startsWith("data:")){const A=E.url.match(/data:[^;]+;base64,(.+)/);A&&(T=A[1],(F=E.mediaType)!=null&&F.startsWith("image/")&&(D=E.url))}return{id:`${e.id||t}-file-${I}`,name:E.filename||`File ${I+1}`,size:0,type:E.mediaType||"application/octet-stream",data:T,preview:D}});return l.jsx(z0t,{text:_||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(Sc,{className:"space-y-2",defaultOpen:!1,children:[l.jsx(Cc,{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(Bn,{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(Nc,{children:l.jsx("ol",{className:"space-y-2 border-l border-border/60 pl-3",children:g.map((N,k)=>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:k+1}),l.jsx(BU,{className:"text-[12px] leading-[1.55] text-muted-foreground",text:N.text})]},`${e.id||t}-reasoning-${k}`))})})]},`${e.id||t}-reasoning`):null,x=(C=e.parts)==null?void 0:C.map((N,k)=>{var j;const _=`${e.id||t}-${k}`;switch(N.type){case"text":{const E=typeof N.text=="string"?N.text:JSON.stringify(N.text??"",null,2);if(e.role==="assistant"){const{cleanedText:I,quickReplies:T}=F0t(E),D=I.trim().length>0;return l.jsxs("div",{className:"space-y-2.5",children:[D&&l.jsx(BU,{text:I,handleRun:i,onAddToDashboard:s,messageId:e.id,messages:n}),T.length>0&&a&&d&&l.jsxs("div",{className:"space-y-1.5",children:[T.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:T.map(({label:R,value:F},A)=>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(F),children:l.jsx("span",{className:"truncate",children:R})})}),l.jsx(p.TooltipContent,{side:"top",align:"center",children:l.jsx("p",{className:"max-w-xs text-xs",children:F})})]},`${_}-qr-${A}`))})]})]},_)}return e.role==="system"&&o?l.jsx(B0t,{text:E},_):null}case"error":{const E=N,I=E.errorText??E.error??E.message;return l.jsx("div",{className:"my-4",children:l.jsx(G3,{errorMessage:I})},_)}case"reasoning":return null;default:return((j=N.type)!=null&&j.startsWith("tool-")||N.type==="dynamic-tool")&&W3(N,r)?l.jsx(ka,{FallbackComponent:({error:E,resetErrorBoundary:I})=>l.jsx($0t,{error:E,resetErrorBoundary:I}),children:l.jsx(D0t,{part:N,idx:_,messageId:e.id,showTools:r,onAddToDashboard:s,messages:n})},_):null}});return e.role==="assistant"?Ufe(e,r)?l.jsxs(Hfe,{who:"Assistant",className:"space-y-2",children:[b,x]}):null:l.jsxs("div",{className:"space-y-2",children:[b,x]})}const q0t=8,W0t=24,G0t=20;function Y0t(e,t,n,r){return e==="error"&&t?!0:r?!1:!!(n||e==="submitted"||e==="streaming")}function qfe({messages:e,showTools:t=!1,showSystemMessage:n=!1,handleRun:r,onAddToDashboard:s,onQuickReply:o,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,E]=S.useState(0),[I,T]=S.useState(W0t);N.current!==g&&(N.current=g,C.current=!0);const D=e[e.length-1],R=Ufe(D,t),F=Y0t(a,c,u,R),A=f_({count:e.length,getScrollElement:()=>b.current,estimateSize:W=>{const O=e[W];return(O==null?void 0:O.role)==="user"?88:180},getItemKey:W=>{const O=e[W];return(O==null?void 0:O.id)||`message-${W}`},anchorTo:"end",followOnAppend:!0,scrollEndThreshold:q0t,overscan:6,gap:20,paddingEnd:F?I+G0t:0,useAnimationFrameWithResizeObserver:!0,onChange:W=>{const O=W.isAtEnd();_(Z=>Z===O?Z:O),O&&E(0)}}),U=S.useCallback((W="smooth")=>{v.current!==null&&cancelAnimationFrame(v.current),v.current=requestAnimationFrame(()=>{v.current=null,A.scrollToEnd({behavior:W})}),E(0),_(!0)},[A]);S.useLayoutEffect(()=>{w.current||(w.current=!0,U("auto"))},[U]),S.useLayoutEffect(()=>{C.current&&(C.current=!1,U("auto"))},[e.length,g,U]),S.useEffect(()=>{const W=y.current;y.current=e.length,e.length>W&&!A.isAtEnd()&&E(O=>O+e.length-W),e.length===0&&(E(0),_(!0),w.current=!1,C.current=!1)},[e.length,A]);const $=A.getVirtualItems(),q=A.getTotalSize();return S.useEffect(()=>()=>{v.current!==null&&cancelAnimationFrame(v.current)},[]),S.useLayoutEffect(()=>{const W=x.current;if(!W||!F)return;const O=()=>{const Y=Math.ceil(W.getBoundingClientRect().height);Y>0&&T(M=>M===Y?M:Y)};if(O(),typeof ResizeObserver>"u")return;const Z=new ResizeObserver(O);return Z.observe(W),()=>Z.disconnect()},[F,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:q},children:[$.map(W=>{const O=e[W.index];return O?l.jsx("div",{ref:A.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(U0t,{message:O,messageIndex:W.index,messages:e,showTools:t,showSystemMessage:n,handleRun:r,onAddToDashboard:s,onQuickReply:o,disableQuickReplies:i})})},W.key):null}),F&&l.jsx("div",{ref:x,className:p.cn("absolute left-0 top-0 w-full",h),style:{transform:`translateY(${Math.max(q-I,0)}px)`},children:l.jsx("div",{className:p.cn("min-w-0",f),children:l.jsx(V0t,{status:a,errorMessage:c,activeToolText:u})})})]})}),!k&&l.jsxs("button",{type:"button",onClick:()=>U("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(ps,{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 K0t(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 Z0t=[{title:"Show top 3 insights",subtitle:"from this dataset"},{title:"Create a bar chart for",subtitle:"sales by product category"}];function X0t({open:e,setOpen:t,isFullscreen:n,onFullscreenChange:r,fullscreenContainer:s}){const[o,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}=Yp(),k=C||N||a,_=S.useRef(null);p.useDashboardStore(le=>le.dashboard.aiScopeTables),p.useDashboardStore(le=>le.isDashboardEditing);const j=p.useDashboardStore(le=>le.selectedSheetId),{setDataSource:E}=p.useEditorActions(),{setSelectedFrameId:I,setIsDashboardEditing:T}=p.useDashboardActions(),D=dL(),{clearAssistantMessageContexts:R}=p.useAIActions(),{clearQueue:F}=p.useQueueActions(),{clearFileAttachments:A,getFileAttachments:U}=p.useFileActions(),$=p.useFileAttachments("dashboard"),q=p.useEditorStore(le=>le.card.dataSource),{assistantProfile:W}=Que(),O=p.useDashboardStore(le=>le.handleOpenAssistantProfile),{selectedEntities:Z,applyDashboardDefaultEntities:Y}=ej("dashboard"),{sendMessage:M,isLoading:K,messages:L,setMessages:z,status:B,stop:V,errorMessage:P,clearError:H}=bdt({dynamicVisualMode:f}),G=S.useCallback(()=>{w(le=>le+1)},[]),X=S.useCallback(le=>{r==null||r(le),n===void 0&&x(le)},[n,r]),ne=S.useCallback(()=>{X(!v)},[v,X]);S.useEffect(()=>{if(!v)return;function le(ke){ke.key==="Escape"&&X(!1)}return window.addEventListener("keydown",le),()=>{window.removeEventListener("keydown",le)}},[v,X]);const[de,he]=S.useState(""),pe=le=>{he(le.target.value)};async function xe({sql:le,cardTitle:ke,connectionId:Se,cardType:oe,python:je,cardConfig:Ne,dataSource:Oe,customVisualPreferences:Ge,visualizationMode:Le,dynamicCardPreferences:Be}){if(!j)return;const Ke=Le==="dynamic",Ce=p.hasValidCardConfig(Ne),Je=Se||(Oe==null?void 0:Oe.connectionId)||"",Pe=Oe?{...Oe,connectionId:Je||Oe.connectionId,connectionType:Oe.connectionType||"",mode:Oe.mode||"database",selectedEntities:Oe.selectedEntities||[]}:Je?{connectionId:Je,connectionType:"",mode:"database",selectedEntities:[]}:Up,tt=!(Ce&&(!Ke||(Be==null?void 0:Be.provenance)==="card-config"||(Be==null?void 0:Be.provenance)==="query_spec")),Ae=tt?K0t(le):"",Ie=tt?je:"",We={id:p.v4(),title:ke||"Title",preferences:{onClickFilter:[{columnIndex:0,expression:""}],chartOptions:{indexAxis:oe==="horizontalBar"?"y":"x"},...Ke&&{displayOptions:{showChrome:!1,allowScroll:!1}}},type:oe,sql:Ae,python:Ie,dataSource:Pe,config:Ne,connectionId:Je,visualizationMode:Le,dynamicCardPreferences:Be,customCardPreferences:Ge?{url:Ge.url,componentName:Ge.componentName,pluginChartType:Ge.pluginChartType,settings:Ge.settings,type:"component"}:void 0},xt={id:p.v4(),cards:[We],activeCardId:We.id};try{await D(j,xt,"end"),T(!0),I(xt.id)}catch(bt){console.error("Failed to add assistant visual to dashboard:",bt),et.error(bt instanceof Error?bt.message:"Failed to prepare semantic metadata for the new visual")}}const se=le=>{le.preventDefault();const ke=de.trim();if(!ke&&$.length===0)return;const Se=[];ke&&Se.push({type:"text",text:ke}),$.forEach(oe=>{oe.data&&Se.push({type:"file",mediaType:oe.type,filename:oe.name,url:`data:${oe.type};base64,${oe.data}`})}),M({role:"user",parts:Se}),he(""),A("dashboard"),G()};S.useEffect(()=>{var le;e&&((le=_.current)==null||le.focus())},[e]),pde({assistantType:"dashboard",status:B,isLoading:K,sendMessage:M});const{hasActiveTools:ge,activeToolText:ie}=gde(L);function Te(le){const ke={role:"user",parts:[{type:"text",text:le.title+" "+le.subtitle}]};M(ke),G()}function re(le){M({role:"user",parts:[{type:"text",text:le}]}),G()}function me(le){M({role:"user",parts:[{type:"text",text:le}]}),G()}const ve=S.useCallback(async()=>{const le=JSON.stringify(L??[],null,2);try{if(typeof navigator>"u"||!navigator.clipboard)throw new Error("Clipboard API unavailable");await navigator.clipboard.writeText(le),et.success("Conversation copied")}catch(ke){console.error("Failed to copy conversation",ke),et.error("Unable to copy conversation")}},[L]),J=(de==null?void 0:de.length)===0&&(L==null?void 0:L.filter(le=>le.role==="user").length)===0;function ee(){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 te(){return l.jsxs(zs,{children:[l.jsx(Bs,{asChild:!0,children:l.jsx(cc,{className:"h-7 p-2 text-muted-foreground hover:text-foreground",children:l.jsx(Sh,{className:"size-3.5"})})}),l.jsxs(Ns,{align:"end",children:[l.jsx(da,{children:"Options"}),l.jsx(Ui,{}),l.jsx(Kc,{checked:o,onCheckedChange:i,children:"Token Usage"}),l.jsx(Kc,{checked:a,onCheckedChange:c,children:"Tool Invocations"}),l.jsx(Kc,{checked:u,onCheckedChange:d,children:"System Message"}),(C||N)&&l.jsxs(l.Fragment,{children:[l.jsx(Ui,{}),l.jsx(da,{children:"Dynamic Visuals"}),l.jsx(Kc,{checked:f==="auto",onCheckedChange:()=>h("auto"),children:"Auto"}),l.jsx(Kc,{checked:f==="force",onCheckedChange:()=>h("force"),children:"Force Dynamic"}),l.jsx(Kc,{checked:f==="off",onCheckedChange:()=>h("off"),children:"Disable Dynamic"})]})]})]})}const ue=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:[ee(),O&&l.jsxs("button",{type:"button",onClick:O,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&&te(),k&&l.jsx(p.Button,{variant:"ghost",size:"sm",className:"h-6 px-1.5 text-[11px] text-muted-foreground hover:text-foreground",onClick:ve,children:"Copy Conversation"}),l.jsx(cc,{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:ne,children:v?l.jsx(QR,{className:"h-3.5 w-3.5"}):l.jsx(ek,{className:"h-3.5 w-3.5"})}),l.jsx(cc,{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 le=L.filter(ke=>ke.role==="assistant").map(ke=>ke.id).filter(ke=>!!ke);z([]),F("dashboard"),H(),R(le)},children:l.jsx(eP,{className:"h-3.5 w-3.5"})}),l.jsx(cc,{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(p.X,{className:"h-3.5 w-3.5"})})]})]}),l.jsx(qfe,{messages:L,showTools:a,showSystemMessage:u,onAddToDashboard:xe,onQuickReply:me,disableQuickReplies:K,status:B,errorMessage:P,activeToolText:K&&ge?ie: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&&J&&l.jsx(Dce,{onClick:Te,placeholders:Z0t}),J&&W&&l.jsx(Jue,{seedQuestions:W.seedQuestions||[],handleSeedQuestionClick:re}),l.jsx(mde,{assistantType:"dashboard"}),l.jsx(k3,{ref:_,setInput:he,stop:V,input:de,handleInputChange:pe,handleSubmit:le=>{se(le)},isLoading:K,status:B,assistantType:"dashboard",onFocus:()=>{}})]}),l.jsx(N3,{incomingSelectedEntities:Z,open:m,onOpenChange:g,dataSource:q||Up,dialogMode:"aiContext",saveAsDashboardDefault:!0,onSaveSelectedEntities:le=>Y()})]});return v&&s?gr.createPortal(l.jsx(Ag,{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:ue})}),s):ue}function Q0t(e){const t=e.current,{getSelectedFrame:n,setSelectedFrameId:r}=p.useDashboardActions(),s=iie(),o=p.useDashboardStore(d=>d.dashboard.sheets),a=p.useDashboardStore(d=>d.selectedSheetId)??(o==null?void 0:o[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(J0t(m.target))return;const g=m.ctrlKey||m.metaKey;g&&m.key==="c"?(await f(),et.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=evt(m);if(g!=null&&g.id){const b=rie(g),x=b.cards.findIndex(y=>y.id===b.activeCardId);x!==-1&&(b.cards[x].title=`${b.cards[x].title} (Copy)`),await s(a,b),r(b.id),et.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)},[s,n,r,a,c,u,t])}function J0t(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 evt(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 tvt(e,t){switch(e.interactionMode){case"drillToDetail":nvt(e,t);break;case"drillThrough":rvt(e,t);break;case"drillToURL":svt(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 nvt(e,t){var c;const{targetInsightId:n,contextMode:r,displayMode:s,filterGroups:o}=e;if(!n){console.warn("drillToDetail event missing targetInsightId");return}const i=r||"full";let a=[];switch(i){case"interactionFilters":a=o.flatMap(u=>u.filters);break;case"full":{const u=((c=t.getCurrentFilters)==null?void 0:c.call(t))||[],d=o.flatMap(f=>f.filters);a=[...u,...d];break}case"none":default:a=[];break}s==="replace-card"?t.replaceCardContent({cardId:e.sourceCardId,insightId:n,filters:a,contextMode:r}):t.openInsightModal({insightId:n,filters:a,contextMode:r})}function rvt(e,t){var u,d;const{targetDashboardId:n,contextMode:r="interactionFilters",filterGroups:s,sourceCardId:o}=e;if(!n){console.warn("[DrillThrough] Event missing targetDashboardId. This interaction needs to be reconfigured with a target dashboard.",e);return}const i=s.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 svt(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 ovt({open:e,onOpenChange:t,insightId:n,filters:r,filterDefinitions:s,contextMode:o,cardTitle:i,cardDescription:a}){return l.jsx(_o,{open:e,onOpenChange:t,children:l.jsxs(ao,{className:"max-h-[90vh] max-w-[90vw] p-6",children:[l.jsxs(Zi,{children:[l.jsx(lo,{children:i||"Insight Detail"}),l.jsx(Go,{children:a||"View detailed insight data with applied filters"})]}),l.jsx(cie,{filters:r,filterDefinitions:s,contextMode:o}),l.jsx("div",{className:"h-[400px] flex-1 overflow-auto",children:n?l.jsx(Cie,{insightId:n,filters:r,contextMode:o}):l.jsx("div",{className:"flex items-center justify-center p-12 text-muted-foreground",children:"No insight selected"})})]})})}function ivt(){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),s=p.useInteractionStore(C=>C.setPendingDrillThrough),o=p.useInteractionStore(C=>C.pendingDrillThrough),i=p.useInteractionStore(C=>C.clearPendingDrillThrough),{setSelectedSheetId:a,navigateWithDrill:c}=p.useDashboardActions(),{selectDashboard:u}=vh(),d=p.useDashboardStore(C=>C.dashboard),f=p.useDashboardStore(C=>C.filterValues),{data:h,isLoading:m}=MG((o==null?void 0:o.targetDashboardId)||"",{enabled:!!(o!=null&&o.targetDashboardId)}),[g,b]=S.useState({open:!1,insightId:""}),x=Nie(g.insightId,{enabled:g.open&&!!g.insightId}),y=S.useRef(new Set),w=S.useMemo(()=>({setSelectedSheetId:a,openInsightModal:({insightId:C,filters:N,contextMode:k})=>{b({open:!0,insightId:C,filters:N,filterDefinitions:(d==null?void 0:d.filters)||[],contextMode:k})},replaceCardContent:({cardId:C,insightId:N,filters:k,contextMode:_})=>{r(C,N,k,_)},getCurrentFilters:()=>f||[],navigateWithDrill:c,getCurrentDashboardId:()=>(d==null?void 0:d.id)||"",getCurrentDashboardTitle:()=>d==null?void 0:d.title,setPendingDrillThrough:s,setGlobalDrillContext:({filters:C,contextMode:N,sourceDashboardId:k,sourceDashboardTitle:_,targetDashboardId:j})=>{const E={filters:C},I={sourceCardId:p.DRILL_CONTEXT_CARD_ID,interactionMode:"clickFilter",filterGroups:[E]},T={...p.createInitialInteractionState(),appliedClickFilters:[I],contextMode:N,sourceDashboardId:k,sourceDashboardTitle:_,targetDashboardId:j};t(p.DRILL_CONTEXT_CARD_ID,T)}}),[a,r,f,c,d,s,t]);S.useEffect(()=>{Object.entries(e).forEach(([C,N])=>{if(N!=null&&N.lastInteractionEvent){const k=N.lastInteractionEvent,_=`${C}-${k.interactionMode}-${k.sourceCardId}-${Date.now()}`;if(y.current.has(_))return;y.current.add(_);try{tvt(k,w)}catch(j){console.error("Error executing interaction event:",j)}finally{n(C),setTimeout(()=>{y.current.delete(_)},5e3)}}})},[e,n,w]),S.useEffect(()=>{if(!(!o||!h||m))try{u(h),c(o.targetDashboardId,o.sourceDashboardId,o.sourceDashboardTitle,o.filters,o.contextMode),i()}catch(C){console.error("[DrillThrough] Error during automatic navigation:",C),i()}},[o,h,m,u,c,i]);const v=()=>{b({open:!1,insightId:""})};return l.jsxs(l.Fragment,{children:[l.jsx(ovt,{open:g.open,onOpenChange:v,insightId:g.insightId,filters:g.filters,filterDefinitions:g.filterDefinitions,contextMode:g.contextMode,cardTitle:x.title,cardDescription:x.description}),o&&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 avt(e){return e.length===0?"":e.map(t=>{const n=t.field.label||t.field.name,r=t.operator,s=lvt(t.value);return r==="="?`${n} = ${s}`:`${n} ${r} ${s}`}).join(", ")}function lvt(e){return e==null?"null":Array.isArray(e)?e.join(", "):typeof e=="object"&&e.toString?e.toString():String(e)}function cvt(e){return e?`Back to ${e}`:"Back"}function uvt(){var y,w,v,C,N;const e=p.useInteractionStore(k=>k.interactionStates[p.DRILL_CONTEXT_CARD_ID]),t=p.useDashboardStore(k=>k.actions.goBackFromDrill),n=p.useDashboardStore(k=>k.actions.clearDrillContext),{selectDashboard:r}=vh(),[s,o]=S.useState({x:16,y:16}),[i,a]=S.useState(!1),c=S.useRef({x:0,y:0});S.useEffect(()=>{if(!i)return;const k=j=>{o({x:j.clientX-c.current.x,y:j.clientY-c.current.y})},_=()=>{a(!1)};return document.addEventListener("mousemove",k),document.addEventListener("mouseup",_),()=>{document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",_)}},[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(k){console.error("[DrillBack] Error during back navigation:",k)}},g=()=>{n()},b=k=>{k.target.closest("button")||(a(!0),c.current={x:k.clientX-s.x,y:k.clientY-s.y})};avt(f);const x=cvt(d);return l.jsx("div",{className:"fixed z-50 max-w-md",style:{left:0,top:0,transform:`translate(${s.x}px, ${s.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=k.field.label||k.field.name,E=String(k.value);return l.jsxs(ls,{variant:"secondary",className:"pointer-events-none text-xs",children:[j," = ",E]},_)})})]}),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(p.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(I0,{className:"mr-2 h-4 w-4"}),x]})})]})})}function dvt(e,t){return typeof e=="boolean"?e:typeof t=="boolean"?t:!1}function fvt({filter:e,isEditing:t=!1,disabled:n=!1,storageOptions:r,settingsVariant:s,filterQueryContext:o,inputVariableName:i,reservedInputVariableNames:a,onUpdateFilter:c,onRemoveFilter:u}){const{attributes:d,listeners:f,setNodeRef:h,transform:m,transition:g,isDragging:b}=zg({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:s,filterQueryContext:o,inputVariableName:i,reservedInputVariableNames:a,onUpdateFilter:c,onRemoveFilter:u})})}const ZU="text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",hvt=[];function Wfe({open:e,onOpenChange:t}){var L,z,B;const[n,r]=S.useState(!1),[s,o]=S.useState(!1),[i,a]=S.useState({sheetSelection:"current",protectPdf:!1,password:""}),c=p.useDashboardStore(V=>{var P;return(P=V.dashboard)==null?void 0:P.sheets}),u=p.useDashboardStore(V=>V.dashboard),d=p.useDashboardStore(V=>V.dashboardInputValues),f=p.useDashboardStore(V=>V.filterValues),h=p.useDashboardStore(V=>V.controlValues),m=p.useDashboardStore(V=>V.inlineFilterValuesMap),g=p.useDashboardStore(V=>V.cardControlValuesMap),b=p.useDashboardStore(V=>V.selectedSheetId),x=p.useDashboardStore(V=>V.selectedSheetId?V.documentInputRuntimeBySheetId[V.selectedSheetId]:void 0),y=p.useDashboardStore(V=>V.isDownloadingPdf),{authToken:w,tokenProps:v}=ht(),C=c==null?void 0:c.find(V=>V.id===b),N=S.useMemo(()=>p.getDashboardExportSheets(c),[c]),k=p.isDocumentSheet(C),_=k&&C?C.document:void 0,j=S.useMemo(()=>k&&C?Vv(u,C.id):[],[C,k,u]),E=j.length>0,I=S.useMemo(()=>k&&C?ice(u,C.id):!1,[C,k,u]),T=S.useMemo(()=>E?j.map(Hv):(_==null?void 0:_.inputs)||hvt,[_,j,E]),D=((z=(L=v==null?void 0:v.params)==null?void 0:L.calendarContext)==null?void 0:z.tz)||((B=v==null?void 0:v.params)==null?void 0:B.timezone)||(typeof Intl<"u"?Intl.DateTimeFormat().resolvedOptions().timeZone:void 0),R=S.useMemo(()=>ile(T),[T]),F=S.useMemo(()=>sle(T,D),[T,D]),A=S.useMemo(()=>ole(T),[T]),U=x?x.filterValuesByInputId:F,$=x?x.controlValuesByInputId:A,q=S.useMemo(()=>k?I&&C&&_?dZ({dashboard:u,sheetId:C.id,sheetKind:"document",sectionIds:_.sections.map(V=>V.id),mode:"document",runtimeValues:{dashboardInputValues:d,filterValues:f,controlValues:h,inlineFilterValuesMap:m,cardControlValuesMap:g},timezone:D}):cle(T,U,$,R,R):[],[_,T,C,k,u,g,h,f,m,d,$,U,R,D,I]),W=!!C,O=N.length>0,Z=((c==null?void 0:c.length)||0)>1||k,Y=i.sheetSelection==="current"&&(!W||k&&q.length>0)||i.sheetSelection==="all"&&!O;S.useEffect(()=>{e&&i.sheetSelection==="all"&&!O&&a(V=>({...V,sheetSelection:"current"}))},[O,e,i.sheetSelection]);const M=()=>{a({sheetSelection:"current",protectPdf:!1,password:""}),r(!1),t(!1)};async function K(){if(y){et.error("A PDF export is already in progress");return}if(i.protectPdf&&!i.password){et.error("Please enter a password to protect the PDF");return}if(i.sheetSelection==="current"&&!W){et.error("No sheet is selected to export");return}if(i.sheetSelection==="all"&&!O){et.error("No dashboard sheets are available to export");return}o(!0);const V=i.sheetSelection==="current"&&k,P=V?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",H=et.loading(P);try{if(V){if(!_||!C)throw new Error("Selected document sheet is missing document data");if(q.length>0){et.dismiss(H),et.error(`Set ${q.join(", ")} before exporting`);return}const X=new Date().toISOString(),ne=I?hZ({dashboard:u,sheetId:C.id,sheetKind:"document",sectionIds:_.sections.map(de=>de.id),mode:"document",runtimeValues:{dashboardInputValues:d,filterValues:f,controlValues:h,inlineFilterValuesMap:m,cardControlValuesMap:g},generatedAt:X,timezone:D}).snapshot:void 0;await uF(v.apiServiceUrl,w,{sheetId:C.id,title:C.title||"Document",pageSize:_.page.size,orientation:_.page.orientation,timezone:D,password:i.protectPdf?i.password:void 0,inputSnapshot:ne,...ne?{}:{inputValues:{sheetId:C.id,filterValuesByInputId:U,controlValuesByInputId:$,generatedAt:X}}})}else{const X=BJ();await vZ(v.apiServiceUrl,w,i.protectPdf?i.password:void 0,i.sheetSelection,X)}et.dismiss(H);const G=V?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!";et.success(G,{duration:2e3}),M()}catch(G){et.dismiss(H),et.error("Failed to download PDF",{description:Fk(G,"Please try again or contact support."),descriptionClassName:Pk,closeButton:!0,duration:1/0,richColors:!0}),console.error("PDF download error:",G)}finally{o(!1)}}return l.jsx(_o,{open:e,onOpenChange:V=>{if(!V){M();return}t(!0)},children:l.jsxs(ao,{className:"rounded-control border-border/60 sm:max-w-[440px] sm:rounded-control",children:[l.jsxs(Zi,{children:[l.jsx(lo,{className:"text-[15px]",children:k?"Export document":"Export dashboard"}),l.jsx(Go,{className:"text-[13px] leading-5",children:k?"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:[Z&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(p.Label,{className:ZU,children:"Export scope"}),l.jsxs(Sa,{value:i.sheetSelection,onValueChange:V=>a({...i,sheetSelection:V}),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(ws,{value:"current",id:"scope-current",disabled:!W}),k?"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",!O&&"cursor-not-allowed opacity-50 hover:bg-transparent"),children:[l.jsx(ws,{value:"all",id:"scope-all",disabled:!O}),"Dashboard sheets (",N.length," ",N.length===1?"sheet":"sheets",")"]})]}),k&&l.jsx("p",{className:"text-[12px] leading-5 text-muted-foreground",children:q.length>0?`Set ${q.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(Mn,{id:"protect-pdf",checked:i.protectPdf,onCheckedChange:V=>{a({...i,protectPdf:V,password:V?i.password:""}),V||r(!1)}}),l.jsx(JN,{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:ZU,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:V=>a({...i,password:V.target.value}),placeholder:"Enter password",className:"pr-8",onKeyDown:V=>{V.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(QN,{className:"h-3.5 w-3.5"}):l.jsx(E0,{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:M,disabled:s,children:"Cancel"}),l.jsx(p.Button,{size:"xs",onClick:K,disabled:s||y||Y,children:s?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(_c,{className:"h-3.5 w-3.5"}),"Export"]})})]})]})})}function Gfe({iconClassName:e,open:t,onOpenChange:n}){const[r,s]=S.useState(!1),o=t!==void 0,i=o?t:r,a=u=>{o||s(u),n==null||n(u)},c=p.useDashboardStore(u=>u.isDownloadingPdf);return l.jsxs(l.Fragment,{children:[o?null:l.jsx(p.Button,{variant:"ghost",size:"sm",className:"h-7 p-2",disabled:c,onClick:()=>a(!0),children:l.jsx(_c,{className:p.cn("size-4",e)})}),l.jsx(Wfe,{open:i,onOpenChange:a})]})}function XU(e,t,n){const r=new Set(t),s=[...n];return e.map(o=>r.has(o.id)?s.shift()??o.id:o.id)}function mvt({control:e,value:t,isEditing:n=!1,onChange:r}){const{attributes:s,listeners:o,setNodeRef:i,transform:a,transition:c,isDragging:u}=zg({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,...s,children:l.jsx(Cle,{control:e,value:t,isEditing:n,dragListeners:n?o:void 0,onChange:r})})}function QU(e){var t;return(((t=e.values)==null?void 0:t.length)??0)>0||e.operation==="is null"||e.operation==="is not null"}function JU(e,t){return[...e.map(n=>`filter:${n.id}`),...t.map(n=>`control:${n.id}`)]}function pvt(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 JU(t,n);const s=e.filter(a=>r.has(a)),o=new Set(s),i=JU(t,n).filter(a=>!o.has(a));return[...s,...i]}function gvt(e,t){return p.getDashboardCardEntries({sheets:e.sheets||[]}).filter(n=>n.sheet.id===t).map(n=>n.card.id)}function bvt(e){return xp(e.dashboardInput,{sheetId:e.selectedSheetId,sheetKind:"dashboard"})?!0:e.dashboardInput.scope.kind!=="cards"?!1:e.selectedSheetCardIds.some(t=>xp(e.dashboardInput,{sheetId:e.selectedSheetId,cardId:t,sheetKind:"dashboard"}))}function eq(e){var t;return((t=e.compatibility)==null?void 0:t.source)!=="dashboardFilter"}function xvt(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 yvt(e){return Yfe(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 Yfe(e){if(!e.selectedSheetId)return[];const t=e.selectedSheetId,n=gvt(e.dashboard,t);return IK(Ik({dashboard:e.dashboard}).allInputs).filter(r=>!(r.kind!=="filter"||!bvt({dashboardInput:r,selectedSheetId:t,selectedSheetCardIds:n})))}function vvt(e,t){return"toolbar"}function wvt(){const e=Tc("interactive"),t=p.useDashboardStore(z=>z.selectedSheetId),n=p.useDashboardStore(z=>z.dashboard.filters),r=p.useDashboardStore(z=>z.dashboard.filterLayout),s=p.useDashboardStore(z=>z.isDashboardEditing),o=p.useDashboardStore(z=>z.controlValues),i=p.useDashboardStore(z=>z.filterValues);p.useDashboardStore(z=>z.filteringCards);const a=p.useDashboardStore(z=>z.inlineFilterValuesMap),c=p.useDashboardStore(z=>z.dashboardInputValues),u=p.useInteractionStore(z=>z.clearAllClickFilters),d=p.useInteractionStore(z=>Object.entries(z.interactionStates).reduce((B,[V,P])=>{var H;return V===p.DRILL_CONTEXT_CARD_ID?B:B+(((H=P.appliedClickFilters)==null?void 0:H.length)??0)},0)),f=p.useDashboardStore(z=>z.actions.removeCardInlineFilterValue),{reorderFilters:h,clearDashboardInputSlot:m,reorderDashboardControls:g,removeDashboardInput:b,setControlValue:x,setFilterLayout:y,setFilterValues:w,setFilteringCards:v,upsertDashboardInput:C}=p.useDashboardActions(),N=sj(Bp(Lg,{activationConstraint:{distance:5}})),k=p.useDashboardStore(z=>z.dashboard),_=yvt({dashboard:k,selectedSheetId:t}).filter(z=>vvt(z.filter)==="toolbar"),j=Yfe({dashboard:k,selectedSheetId:t}),E=_.map(z=>z.filter),I=new Map(_.map(z=>[`filter:${z.filter.id}`,z])),T=IYe(k),D=T.filter(z=>!z.hidden&&Ky(z)==="toolbar"),R=T.filter(z=>!z.hidden&&Ky(z)==="advanced"),F=pvt(r==null?void 0:r.toolbarItemOrder,E,D),A=new Map(E.map(z=>[`filter:${z.id}`,z])),U=new Map(D.map(z=>[`control:${z.id}`,z]));function $(z){const{active:B,over:V}=z;if(!V||B.id===V.id)return;const P=String(B.id),H=String(V.id),G=F.findIndex(ge=>ge===P),X=F.findIndex(ge=>ge===H);if(G===-1||X===-1)return;const ne=$g(F,G,X);y({toolbarItemOrder:ne});const de=new Set((n||[]).map(ge=>ge.id)),he=F.filter(ge=>ge.startsWith("filter:")).map(ge=>ge.replace("filter:","")).filter(ge=>de.has(ge)),pe=ne.filter(ge=>ge.startsWith("filter:")).map(ge=>ge.replace("filter:","")).filter(ge=>de.has(ge)),xe=F.filter(ge=>ge.startsWith("control:")).map(ge=>ge.replace("control:","")),se=ne.filter(ge=>ge.startsWith("control:")).map(ge=>ge.replace("control:",""));h(XU(n||[],he,pe)),g(XU(k.controls||[],xe,se))}const q=(r==null?void 0:r.toolbarWrap)??!1,W=(r==null?void 0:r.showDownloadButton)??!1,O=(i==null?void 0:i.filter(z=>QU(z)).length)??0,Z=j.filter(eq),Y=Z.filter(z=>{const B=xvt({dashboardInput:z,dashboardInputValues:c,defaultInputValues:k.defaultInputValues,selectedSheetId:t});return(B==null?void 0:B.status)==="set"&&B.value.kind==="filter"&&QU(B.value.filterValue)}).length,M=a?Object.values(a).reduce((z,B)=>z+((B==null?void 0:B.length)??0),0):0,K=O+Y+M+d,L=()=>{w([]),Z.forEach(z=>{m(z,{sheetId:t})}),v([]),u(),a&&Object.entries(a).forEach(([z,B])=>{B==null||B.forEach(V=>{f(z,V.filterId)})})};return!E.length&&!D.length&&!R.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(Fv,{sensors:N,collisionDetection:Av,onDragEnd:$,children:l.jsxs("div",{className:p.cn("flex items-center",q?"flex-wrap":"w-0 min-w-full overflow-x-auto"),children:[l.jsx(Ov,{items:F,strategy:vL,children:l.jsx(eR,{className:"gap-3 pr-0",wrap:q,children:F.map(z=>{const B=A.get(z);if(B){const P=I.get(z),H=P&&eq(P);return l.jsx(fvt,{filter:B,isEditing:s,storageOptions:H?{storageTarget:"dashboardInput",dashboardInput:P,sheetId:t??void 0}:void 0,inputVariableName:H?P.variableName:void 0,onUpdateFilter:H?(G,X)=>{C({...P,variableName:(X==null?void 0:X.variableName)||P.variableName,filter:G})}:void 0,onRemoveFilter:H?()=>{w((i||[]).filter(G=>G.filterId!==B.id)),b(P.id)}:void 0},z)}const V=U.get(z);return V?l.jsx(mvt,{control:V,value:o==null?void 0:o[V.id],isEditing:s,onChange:P=>x(V.id,P)},z):null})})}),R.length>0&&l.jsx(xie,{title:"",controls:R,values:o,onChange:(z,B)=>x(z.id,B),immediatePlacement:"toolbar",advancedLabel:"More controls"}),K>0&&l.jsxs("button",{type:"button",onClick:L,"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(p.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(Gfe,{})})]})})})}function Kfe(){var me,ve;const{showAssistant:e,tokenProps:t,renderMode:n}=ht(),r=dvt((me=t.config)==null?void 0:me.showDashboardAssistant,e),{preferences:s}=Yp(),o=(ve=s==null?void 0:s.cardDisplay)==null?void 0:ve.mode,i=Dh(o),a=KK({displayMode:o,renderMode:n}),c=S.useRef(null),u=S.useRef(null),[d,f]=S.useState(!1),{handleDragStart:h,isDraggingRef:m,getStyle:g,getPositionClasses:b}=sot({initialPosition:"bottom-right"}),x=kf(J=>J.setFullscreen),y=kf(J=>J.setPanelOpen),w=kf(J=>J.setContainer),v=PY("dashboard"),C=FY(),N=OY("dashboard"),k=v.isOpen,_=C==="dashboard",j=p.useDashboardStore(J=>J.isVisualEditing),E=p.useDashboardStore(J=>J.themeStyle),I=Dc(),T=p.useDashboardStore(J=>{var ee;return(ee=J.dashboard)==null?void 0:ee.sheets}),D=p.useDashboardStore(J=>J.showFilters),R=p.useDashboardStore(J=>J.isDashboardEditing),F=p.useDashboardStore(J=>J.selectedSheetId),A=T==null?void 0:T.find(J=>J.id===F),U=p.useDashboardStore(J=>{var ee,te,ue;return(ue=(te=(ee=J.dashboard)==null?void 0:ee.sheets)==null?void 0:te.find(le=>le.id===J.selectedSheetId))==null?void 0:ue.kind}),$=p.useDashboardStore(J=>{var ee,te;return((te=(ee=J.dashboard)==null?void 0:ee.summary)==null?void 0:te.position)||"top"}),q=U==="document",W=p.useDashboardStore(J=>{var ee;return(ee=J.dashboard)==null?void 0:ee.id}),{getDefaultSheetId:O,setDefaultSheetId:Z,clearDefaultSheetId:Y}=$q(W),[M,K]=S.useState(null),{setSelectedSheetId:L,setSheetTitle:z,addSheet:B,setSheets:V}=p.useDashboardActions();Q0t(u);const{setActiveAssistantType:P}=p.useAIActions();S.useEffect(()=>{if(W){const J=O();K(J)}},[W,O]),S.useEffect(()=>{k?P("dashboard"):C==="dashboard"&&x(null)},[k,P,C,x]),S.useEffect(()=>{var J;k||(J=c.current)==null||J.resize(0)},[k]);function H(J){var ee,te;J?((ee=c.current)==null||ee.resize(40),y("dashboard",!0),x("dashboard"),P("dashboard")):(y("dashboard",!1),x(null),(te=c.current)==null||te.resize(0),P(null))}function G(J="dashboard"){const ee={id:p.v4(),title:J==="document"?"New Document":"New Sheet",...J==="document"?{kind:J,document:p.createDefaultDocumentDefinition()}:{}};B(ee),L(ee.id)}function X(J,ee){if(!W)return;M===J?(Y(),K(null),et.success("Default sheet cleared")):(Z(J),K(J),et.success(`"${ee}" set as default sheet`))}function ne(J){var ee;J<1?(y("dashboard",!1),x(null),P(null),(ee=c.current)==null||ee.resize(0)):(k||y("dashboard",!0),P("dashboard"))}function de(){return(E==null?void 0:E.canvasTheme)==="muted"||!(E!=null&&E.canvasTheme)?"hsl(var(--semaphor-muted))":(E==null?void 0:E.canvasTheme)==="clear"?"":E==null?void 0:E.canvasTheme}const he=(J,ee)=>{J.dataTransfer.setData("tabIndex",ee.toString())},pe=J=>{J.preventDefault()},xe=(J,ee)=>{const te=J.dataTransfer.getData("tabIndex");if(te===ee.toString())return;const ue=Array.from(T||[]),[le]=ue.splice(parseInt(te),1);ue.splice(ee,0,le),V(ue)},se=r===!0&&!i&&!k&&!j&&!D;function ge(){if(T&&T.length>1||R)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:[T==null?void 0:T.map((J,ee)=>{const te=F===J.id,ue=M===J.id;return l.jsxs(p.TabsTrigger,{draggable:!0,onDragStart:le=>he(le,ee),onDragOver:pe,onDrop:le=>xe(le,ee),onClick:()=>L(J.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:J.id,children:[J.kind==="document"&&l.jsx(di,{className:"h-3 w-3 text-muted-foreground"}),l.jsx(uN,{enabled:R&&te,text:J.title,onSave:le=>z(J.id,le),children:J.title},J.id),l.jsx("span",{role:"button",tabIndex:0,"aria-label":ue?"Clear default sheet":"Set as default sheet",title:ue?"Clear default sheet":"Set as default sheet",onClick:le=>{le.stopPropagation(),X(J.id,J.title||"Sheet")},onKeyDown:le=>{(le.key==="Enter"||le.key===" ")&&(le.preventDefault(),le.stopPropagation(),X(J.id,J.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",te||ue?"opacity-100":"opacity-0 group-hover:opacity-100"),children:l.jsx(CW,{className:p.cn("h-3 w-3 transition-colors",ue?"fill-current text-amber-500":"text-muted-foreground")})}),R&&te&&T.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:le=>{le.stopPropagation(),f(!0)},onKeyDown:le=>{(le.key==="Enter"||le.key===" ")&&(le.preventDefault(),le.stopPropagation(),f(!0))},children:l.jsx(p.X,{className:"h-3 w-3"})})]},J.id)}),R&&l.jsxs(zs,{children:[l.jsx(Bs,{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(Ns,{align:"start",className:"w-48",children:[l.jsxs(vn,{onSelect:()=>G("dashboard"),children:[l.jsx(Gf,{className:"h-4 w-4 text-muted-foreground"}),"Dashboard sheet"]}),l.jsxs(vn,{onSelect:()=>G("document"),children:[l.jsx(di,{className:"h-4 w-4 text-muted-foreground"}),"Document"]})]})]})]})]})})}function ie(){return l.jsx("div",{ref:u,style:{},className:"h-full min-h-0 grow",children:T==null?void 0:T.map(J=>l.jsx(p.TabsContent,{style:{backgroundColor:de(),...I.dashboardCanvasStyle},className:p.cn("mt-0 h-full min-h-0",{}),value:J.id,children:l.jsx(G7,{sheet:J})},J.id))})}function Te(){return l.jsxs(p.Tabs,{"data-role":"dashboard-tabs-container",className:p.cn("relative flex h-full flex-col",E==null?void 0:E.dashboardTabsContainer),onValueChange:J=>{L(J)},value:F||void 0,children:[ge(),$==="top"&&!q&&l.jsx(RA,{}),F&&!q&&l.jsx(wvt,{}),q?l.jsx("div",{"data-role":"dashboard-tabs-content",className:"min-h-0 flex-1 grow basis-0 overflow-hidden",children:ie()}):l.jsx(Ea,{"data-role":"dashboard-tabs-content",className:"flex-1 grow basis-0 overflow-y-auto",children:ie()}),$==="bottom"&&!q&&l.jsx(RA,{}),l.jsx(oot,{open:d,setOpen:f})]})}const re=S.useCallback(J=>{w("dashboard",J)},[w]);return T?a&&F&&!q?l.jsxs("div",{"data-document-render-error":"true",className:"bg-white p-8 text-sm text-zinc-700",children:['Requested document sheet "',F,'" was not found or is not a document sheet in the loaded dashboard.']}):a&&q&&A?l.jsx("div",{"data-role":"dashboard-document-print-content",className:"min-h-0 overflow-visible bg-white",children:l.jsx(G7,{sheet:A})}):l.jsxs(l.Fragment,{children:[l.jsx(ivt,{}),l.jsx(uvt,{}),l.jsxs("div",{className:"relative flex-1 basis-0 overflow-hidden",children:[l.jsxs(Tce,{className:p.cn("flex-1 basis-0 overflow-y-auto transition-opacity",_&&"pointer-events-none opacity-0"),direction:"horizontal",children:[l.jsx(oR,{children:Te()}),r===!0&&l.jsxs(l.Fragment,{children:[l.jsx(rot,{open:k,onTabClick:H,withHandle:!0,disabled:!k}),l.jsx(oR,{className:"flex grow","data-role":"dashboard-assistant-panel",onResize:ne,defaultSize:k?40:0,ref:c,children:l.jsx("div",{className:"grow overflow-y-auto",children:l.jsx(X0t,{open:k,setOpen:H,isFullscreen:_,onFullscreenChange:J=>x(J?"dashboard":null),fullscreenContainer:N})})})]})]}),l.jsx("div",{ref:re,className:p.cn("absolute inset-0",!_&&"pointer-events-none")}),se&&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||H(!0)},onMouseDown:h,onTouchStart:h,title:"Open Assistant (drag to move)",children:l.jsx(Epe,{className:"h-5 w-5"})})})]})]}):null}const Zfe=S.forwardRef(({appearance:e,organizationAppearance:t,tokenAppearance:n,reactAppearance:r,resolvedAppearance:s,children:o,className:i,style:a,...c},u)=>{const d=S.useId(),f=S.useMemo(()=>Svt(d),[d]),{theme:h}=OR(),m=Cvt(h),g=S.useMemo(()=>s??kc.resolveAppearance({organizationAppearance:t,tokenAppearance:n,reactAppearance:r??e}),[e,t,r,s,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(Ag,{...c,ref:u,className:i,style:a,children:o})})});Zfe.displayName="AppearanceProvider";function Svt(e){return`semaphor-appearance-${e.replace(/[^a-zA-Z0-9_-]/g,"")}`}function Cvt(e){const t=BS(e),[n,r]=S.useState(()=>Nvt());return S.useEffect(()=>{var i,a;if(t!=="system"||typeof window>"u")return;const s=(i=window.matchMedia)==null?void 0:i.call(window,"(prefers-color-scheme: dark)");if(!s)return;const o=()=>{r(s.matches?"dark":"light")};return o(),typeof s.addEventListener=="function"?(s.addEventListener("change",o),()=>s.removeEventListener("change",o)):((a=s.addListener)==null||a.call(s,o),()=>{var c;return(c=s.removeListener)==null?void 0:c.call(s,o)})},[t]),t==="system"?n:t}function Nvt(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}const Xfe=S.createContext({openBrandStudioPreview:()=>{}}),kvt=Xfe.Provider;function _vt(){return S.useContext(Xfe)}function jvt({children:e,defaultTheme:t="system",storageKey:n="vite-ui-theme",...r}){const s=BS(t),[o,i]=S.useState(()=>Ivt(n)||s),a=S.useCallback(u=>{const d=BS(u);Evt(n,d),i(d)},[n]),c=S.useMemo(()=>({theme:o,setTheme:a}),[o,a]);return l.jsx(bq.Provider,{...r,value:c,children:e})}function Ivt(e){if(typeof window>"u")return null;try{const t=window.localStorage.getItem(e);if(!t)return null;const n=BS(t,"system");return n===t?n:null}catch{return null}}function Evt(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(e,t)}catch{}}const Tvt=S.lazy(()=>Promise.resolve().then(()=>require("../brand-studio/index.cjs")).then(e=>({default:e.BrandStudioEditor})));function Y3({appearance:e,children:t}){var T,D;const{authToken:n,id:r,tokenProps:s}=ht(),o=_0(),i=(T=o.data)==null?void 0:T.organizationAppearance,a=(D=s.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=`${s.apiServiceUrl??""}:${(n==null?void 0:n.accessToken)??""}`,v=Dn({queryKey:jG({resourceType:Kr.DASHBOARD,apiServiceUrl:s.apiServiceUrl,accessToken:n==null?void 0:n.accessToken}),queryFn:async()=>p.getRequest(`${s.apiServiceUrl}/management/v1/dashboards`,(n==null?void 0:n.accessToken)||""),select:R=>(R==null?void 0:R.organizationAppearance)??null,enabled:!o.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,k=S.useMemo(()=>kc.resolveAppearance({organizationAppearance:N,tokenAppearance:a,reactAppearance:e}),[e,N,a]),_=S.useCallback(()=>{f(g??h??k),u(!0)},[g,h,k]),j=S.useCallback(()=>{u(!1)},[]);S.useEffect(()=>{f(null),m(null),b(null),u(!1)},[r]);const E=S.useMemo(()=>({openBrandStudioPreview:_}),[_]),I=g??h??e;return l.jsx(jvt,{defaultTheme:"system",storageKey:"vite-ui-theme",children:l.jsx(kvt,{value:E,children:l.jsx(Zfe,{organizationAppearance:N,tokenAppearance:a,reactAppearance:I,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(Tvt,{appearance:d,onDraftChange:b,onSave:R=>{m(R),b(R),f(R)},onCancel:j})})})]})})})})}function Qfe({children:e,preferences:t}){const{currentUser:n}=Ki(),r=S.useMemo(()=>{var s,o;return{preferences:t||{},isLocalDev:((s=t==null?void 0:t.uiMode)==null?void 0:s.developer)||!1,isConsoleMode:((o=t==null?void 0:t.uiMode)==null?void 0:o.console)||!1}},[t]);return l.jsx(NG.Provider,{value:r,children:l.jsx(Q_,{displayPreferences:t==null?void 0:t.cardDisplay,currentUser:n,children:e})})}function Dvt(e=2e3,t=500){const n=Ume(),[r,s]=S.useState(!1),[o,i]=S.useState(!1),a=S.useRef(null);return S.useEffect(()=>{const c=setTimeout(()=>s(!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]),o}function K3({delayMs:e=2e3,quietMs:t=500,componentType:n,componentId:r}){const s=Dvt(e,t);return S.useEffect(()=>(s&&(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()}}),[s,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:s?"ready":""})}function Jfe(e){if(typeof window>"u")return null;const{preferences:t}=e;return l.jsx(ka,{FallbackComponent:Z_,children:l.jsxs(HR,{dashboardProps:e,children:[l.jsx(K3,{componentType:"dashboard",componentId:e.id}),l.jsx(Y3,{appearance:e.appearance,children:l.jsx(Qfe,{preferences:t,children:l.jsx("main",{className:"flex h-full flex-col",children:l.jsx(wP,{...e,type:"dashboard",children:l.jsx(Kfe,{})})})})})]})})}function Mvt(e=[]){const t=S.useRef(null),n=S.useRef(null),r=S.useRef(null),[s,o]=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);o(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:s,updateAvailableWidth:i}}function Avt({filter:e}){var g;const t=p.useDashboardStore(b=>b.isDashboardEditing),{preferences:n}=Yp(),r=Dh((g=n==null?void 0:n.cardDisplay)==null?void 0:g.mode),s=p.useDashboardStore(b=>b.filterValues),o=s==null?void 0:s.some(b=>b.filterId===e.id),{removeFilterValues:i,removeFilter:a,updateFilter:c}=p.useDashboardActions(),{headerRef:u,leftActionsRef:d,rightActionsRef:f,titleMaxWidth:h,updateAvailableWidth:m}=Mvt([t,o,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(Ho,{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(U5,{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(p.X,{className:"size-3.5"})})]})]}),l.jsx("div",{className:"hidden",ref:f})]})}function Rvt(){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(Avt,{filter:r}),l.jsx(H_,{filter:r})]},r.id))}):null}function Pvt(){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),s=(i=e.sheets)==null?void 0:i.find(a=>a.id===t),o=p.isDocumentSheet(s);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&&!o&&l.jsx(Rvt,{}),l.jsx(Kfe,{})]})})}const Fvt=S.lazy(()=>Promise.resolve().then(()=>require("./dashboard-controls-Dyqye6fh.js"))),Ovt=S.lazy(()=>Promise.resolve().then(()=>require("./edit-dashboard-visual-yinO0yU-.js"))),Lvt=S.lazy(()=>Promise.resolve().then(()=>require("./dashboard-json-CV_LnO9x.js")));function $vt({showControls:e=!1,showFooter:t=!0,...n}){const r=p.useDashboardStore(a=>a.isVisualEditing),s=p.useDashboardStore(a=>a.showDashboardJSON),{appearance:o,preferences:i}=n;return l.jsx(ka,{FallbackComponent:Z_,children:l.jsxs(HR,{dashboardProps:n,children:[l.jsx(K3,{componentType:"surfboard",componentId:n.id}),l.jsxs(Y3,{appearance:o,children:[l.jsx(Pbe,{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(Qfe,{preferences:i,children:[s&&l.jsx(S.Suspense,{fallback:null,children:l.jsx(Lvt,{})}),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(Fvt,{})}),l.jsx("div",{className:"flex grow overflow-hidden",children:l.jsx("div",{className:"flex min-w-0 flex-1",children:l.jsxs(wP,{...n,type:"dashboard",children:[r&&l.jsx(S.Suspense,{fallback:null,children:l.jsx(Ovt,{})}),l.jsx(Pvt,{})]})})})]})]})]})]})})}var zvt=Object.defineProperty,Bvt=(e,t,n)=>t in e?zvt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,W1=(e,t,n)=>Bvt(e,typeof t!="symbol"?t+"":t,n);const Vvt={stringify:e=>e?"true":"false",parse:e=>/^[ty1-9]/i.test(e)},Hvt={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}},Uvt={stringify:e=>JSON.stringify(e),parse:e=>JSON.parse(e)};function qvt(e){return e.replace(/([a-z0-9])([A-Z])/g,(t,n,r)=>`${n}-${r.toLowerCase()}`)}function ehe(e){return e.replace(/[-:]([a-z])/g,(t,n)=>`${n.toUpperCase()}`)}const Wvt={stringify:e=>e.name,parse:(e,t,n)=>{const r=(()=>{const s=ehe(t);if(typeof n<"u"&&s in n.container)return n.container[s]})();return typeof r=="function"?r.bind(n):void 0}},Gvt={stringify:e=>`${e}`,parse:e=>parseFloat(e)},Yvt={stringify:e=>e,parse:e=>e},$D={string:Yvt,number:Gvt,boolean:Vvt,function:Hvt,method:Wvt,json:Uvt},Bb=Symbol.for("r2wc.render"),G1=Symbol.for("r2wc.connected"),Od=Symbol.for("r2wc.context"),Qo=Symbol.for("r2wc.props");function Kvt(e,t,n){var r,s,o;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=qvt(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(),W1(this,o,!0),W1(this,s),W1(this,r,{}),W1(this,"container"),t.shadow?this.container=this.attachShadow({mode:t.shadow}):this.container=this,this[Qo].container=this.container;for(const g of i){const b=d[g],x=this.getAttribute(b),y=c[g],w=y?$D[y]:null;if(y==="method"){const v=ehe(b);Object.defineProperty(this[Qo].container,v,{enumerable:!0,configurable:!0,get(){return this[Qo][v]},set(C){this[Qo][v]=C,this[Bb]()}}),this[Qo][g]=w.parse(x,b,this)}w!=null&&w.parse&&x&&(this[Qo][g]=w.parse(x,b,this))}for(const g of a)this[Qo][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[G1]=!0,this[Bb]()}disconnectedCallback(){this[G1]=!1,this[Od]&&n.unmount(this[Od]),delete this[Od]}attributeChangedCallback(g,b,x){const y=f[g],w=c[y],v=w?$D[w]:null;y in c&&v!=null&&v.parse&&x&&(this[Qo][y]=v.parse(x,g,this),this[Bb]())}[(o=G1,s=Od,r=Qo,Bb)](){this[G1]&&(this[Od]?n.update(this[Od],this[Qo]):this[Od]=n.mount(this.container,e,this[Qo]))}}for(const m of i){const g=d[m],b=c[m];Object.defineProperty(h.prototype,m,{enumerable:!0,configurable:!0,get(){return this[Qo][m]},set(x){this[Qo][m]=x;const y=b?$D[b]:null;if(y!=null&&y.stringify){const w=y.stringify(x,g,this);this.getAttribute(g)!==w&&this.setAttribute(g,w)}else this[Bb]()}})}return h}function Zvt(e,t,n){const r=Ehe.createRoot(e),s=S.createElement(t,n);return r.render(s),{root:r,ReactComponent:t}}function Xvt({root:e,ReactComponent:t},n){const r=S.createElement(t,n);e.render(r)}function Qvt({root:e}){e.unmount()}function Jvt(e,t={}){return Kvt(e,t,{mount:Zvt,update:Xvt,unmount:Qvt})}const ewt={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"},twt=Jvt(Jfe,{props:ewt}),nwt=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(UL,{context:t})," "]})}),the=new Set(["askForMoreInfo","getAvailableChartTypes","getChartSQLSyntax","getDomainRelationships","getTableColumns","getUserSql","validateCardConfigFormat"]),rwt=new Set(["createChartFromSql","createForecast","generateQueryConfig","getChartDataFromCardConfig","getChartDataFromSqlAndPython","getForecastDataFromSqlAndPython"]),swt=Array.from(the).join(", "),owt=3,iwt="Self-heal",awt=new Set(["SQL_PARSE_ERROR","SQL_EXPLAIN_ERROR"]);function lwt({card:e}){var W,O,Z,Y,M;const[t,n]=S.useState({}),{authToken:r}=ht(),s=p.getTokenParams(r==null?void 0:r.accessToken),{compiledAppearance:o}=p.useAppearance(),i=S.useMemo(()=>Nv(o),[o]),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}=$h(((W=f.customCardPreferences)==null?void 0:W.url)||""),g=(O=m==null?void 0:m.visuals)==null?void 0:O.find(K=>{var L;return K.name===((L=f.customCardPreferences)==null?void 0:L.componentName)}),b=kv(f,g)??"single",x=S.useMemo(()=>K5({frame:a,configCard:f,isMultiInputVisual:b==="multiple"}),[a,f,b]),y=S.useMemo(()=>{const K=x.findIndex(L=>(L==null?void 0:L.id)===e.id);return K<0?-1:qy(e,K)},[x,e]),w=S.useMemo(()=>b!=="multiple"||y<0?e.type:Ym(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}=Ak(v),N=p.useInteractionStore(K=>K.interactionStates),k=p.useDashboardStore(K=>{var L;return(L=K.dashboard)==null?void 0:L.id}),_=p.useDashboardStore(K=>K.dashboard.filters),j=p.useDashboardStore(K=>K.filterValues),E=p.useDashboardStore(K=>K.selectedSheetId),I=S.useMemo(()=>W5({card:e,sheetId:E||"",inlineFilterValues:c,setInlineFilterValue:K=>u(e.id,K),removeInlineFilterValue:K=>d(e.id,K)}),[e,E,c,u,d]),{cardFilters:T,cardFilterValues:D}=S.useMemo(()=>B0({card:e,interactionStates:N,currentDashboardId:k,filters:_,filterValues:j,selectedSheetId:E}),[e,N,k,_,j,E]),R=S.useCallback((K,L)=>{const z=X5(L);n(B=>({...B,[K]:z}))},[]),F=(Z=f.customCardPreferences)==null?void 0:Z.componentName,A=F?h(F):null,U=lN((Y=f.customCardPreferences)==null?void 0:Y.settings,f),$=S.useMemo(()=>Y5(x),[x]),q=S.useMemo(()=>$.map((K,L)=>Ym(K,L,g==null?void 0:g.slots)),[$,g==null?void 0:g.slots]);return F?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:[A&&b==="single"&&l.jsx(A,{editing:!0,params:s,theme:i,settings:U,cardMetadata:Foe({card:e,dataMetadata:C==null?void 0:C.metadata}),onDataChange:R,data:(C==null?void 0:C.records)||[],filters:T,filterValues:[...D||[],...c||[]],inlineFilters:I}),A&&b==="multiple"&&l.jsxs(l.Fragment,{children:[x.map((K,L)=>{if(!K)return null;const z=qy(K,L),B=Ym(K,z,g==null?void 0:g.slots);return l.jsx(x5,{onDataChange:R,card:K,effectiveCardType:B},`${K.id}-${z}`)}),l.jsx("div",{className:"flex flex-col gap-2",children:l.jsx(A,{editing:!0,onDataChange:R,...Q5({configCard:f,slotOrderedCards:$,slotTypes:q,multiInputData:t,params:s,theme:i,chartSettings:U,filters:T,filterValues:[...D||[],...c||[]],inlineFilters:I})})})]})]},(M=f.customCardPreferences)==null?void 0:M.componentName)}):null}const cwt=S.memo(lwt,(e,t)=>{var n,r,s,o,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)&&((s=e.card.customCardPreferences)==null?void 0:s.slotSettings)===((o=t.card.customCardPreferences)==null?void 0:o.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)}),uwt=p.create()(p.persist((e,t)=>({starredCharts:[],isStarred:(n,r)=>t().starredCharts.some(s=>s.type===n&&s.id===r),toggleStar:n=>{e(r=>{const s=r.starredCharts.findIndex(o=>o.type===n.type&&o.id===n.id);return s>=0?{starredCharts:r.starredCharts.filter((o,i)=>i!==s)}:{starredCharts:[...r.starredCharts,n]}})},getStarredChart:(n,r)=>t().starredCharts.find(s=>s.type===n&&s.id===r)}),{name:"semaphor-starred-charts"}));var nhe=["PageUp","PageDown"],rhe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],she={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Gg="Slider",[MR,dwt,fwt]=p.createCollection(Gg),[ohe]=p.createContextScope(Gg,[fwt]),[hwt,Wj]=ohe(Gg),ihe=Q.forwardRef((e,t)=>{const{name:n,min:r=0,max:s=100,step:o=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"?mwt:pwt,[C=[],N]=p.useControllableState({prop:d,defaultProp:u,onChange:T=>{var R;(R=[...x.current][y.current])==null||R.focus(),f(T)}}),k=Q.useRef(C);function _(T){const D=vwt(C,T);I(T,D)}function j(T){I(T,y.current)}function E(){const T=k.current[y.current];C[y.current]!==T&&h(C)}function I(T,D,{commit:R}={commit:!1}){const F=Nwt(o),A=kwt(Math.round((T-r)/o)*o+r,F),U=p.clamp(A,[r,s]);N(($=[])=>{const q=xwt($,U,D);if(Cwt(q,c*o)){y.current=q.indexOf(U);const W=String(q)!==String($);return W&&R&&h(q),W?q:$}else return $})}return l.jsx(hwt,{scope:e.__scopeSlider,name:n,disabled:a,min:r,max:s,valueIndexToChangeRef:y,thumbs:x.current,values:C,orientation:i,form:g,children:l.jsx(MR.Provider,{scope:e.__scopeSlider,children:l.jsx(MR.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||(k.current=C)}),min:r,max:s,inverted:m,onSlideStart:a?void 0:_,onSlideMove:a?void 0:j,onSlideEnd:a?void 0:E,onHomeKeyDown:()=>!a&&I(r,0,{commit:!0}),onEndKeyDown:()=>!a&&I(s,C.length-1,{commit:!0}),onStepKeyDown:({event:T,direction:D})=>{if(!a){const A=nhe.includes(T.key)||T.shiftKey&&rhe.includes(T.key)?10:1,U=y.current,$=C[U],q=o*A*D;I($+q,U,{commit:!0})}}})})})})});ihe.displayName=Gg;var[ahe,lhe]=ohe(Gg,{startEdge:"left",endEdge:"right",size:"width",direction:1}),mwt=Q.forwardRef((e,t)=>{const{min:n,max:r,dir:s,inverted:o,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(s),x=b==="ltr",y=x&&!o||!x&&o;function w(v){const C=g.current||f.getBoundingClientRect(),N=[0,C.width],_=Z3(N,y?[n,r]:[r,n]);return g.current=C,_(v-C.left)}return l.jsx(ahe,{scope:e.__scopeSlider,startEdge:y?"left":"right",endEdge:y?"right":"left",direction:y?1:-1,size:"width",children:l.jsx(che,{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=she[y?"from-left":"from-right"].includes(v.key);u==null||u({event:v,direction:N?-1:1})}})})}),pwt=Q.forwardRef((e,t)=>{const{min:n,max:r,inverted:s,onSlideStart:o,onSlideMove:i,onSlideEnd:a,onStepKeyDown:c,...u}=e,d=Q.useRef(null),f=p.useComposedRefs(t,d),h=Q.useRef(void 0),m=!s;function g(b){const x=h.current||d.current.getBoundingClientRect(),y=[0,x.height],v=Z3(y,m?[r,n]:[n,r]);return h.current=x,v(b-x.top)}return l.jsx(ahe,{scope:e.__scopeSlider,startEdge:m?"bottom":"top",endEdge:m?"top":"bottom",size:"height",direction:m?1:-1,children:l.jsx(che,{"data-orientation":"vertical",...u,ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:b=>{const x=g(b.clientY);o==null||o(x)},onSlideMove:b=>{const x=g(b.clientY);i==null||i(x)},onSlideEnd:()=>{h.current=void 0,a==null||a()},onStepKeyDown:b=>{const y=she[m?"from-bottom":"from-top"].includes(b.key);c==null||c({event:b,direction:y?-1:1})}})})}),che=Q.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:s,onSlideEnd:o,onHomeKeyDown:i,onEndKeyDown:a,onStepKeyDown:c,...u}=e,d=Wj(Gg,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()):nhe.concat(rhe).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)&&s(f)}),onPointerUp:p.composeEventHandlers(e.onPointerUp,f=>{const h=f.target;h.hasPointerCapture(f.pointerId)&&(h.releasePointerCapture(f.pointerId),o(f))})})}),uhe="SliderTrack",dhe=Q.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,s=Wj(uhe,n);return l.jsx(p.Primitive.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:t})});dhe.displayName=uhe;var AR="SliderRange",fhe=Q.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,s=Wj(AR,n),o=lhe(AR,n),i=Q.useRef(null),a=p.useComposedRefs(t,i),c=s.values.length,u=s.values.map(h=>phe(h,s.min,s.max)),d=c>1?Math.min(...u):0,f=100-Math.max(...u);return l.jsx(p.Primitive.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:a,style:{...e.style,[o.startEdge]:d+"%",[o.endEdge]:f+"%"}})});fhe.displayName=AR;var RR="SliderThumb",hhe=Q.forwardRef((e,t)=>{const n=dwt(e.__scopeSlider),[r,s]=Q.useState(null),o=p.useComposedRefs(t,a=>s(a)),i=Q.useMemo(()=>r?n().findIndex(a=>a.ref.current===r):-1,[n,r]);return l.jsx(gwt,{...e,ref:o,index:i})}),gwt=Q.forwardRef((e,t)=>{const{__scopeSlider:n,index:r,name:s,...o}=e,i=Wj(RR,n),a=lhe(RR,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:phe(m,i.min,i.max),b=ywt(r,i.values.length),x=h==null?void 0:h[a.size],y=x?wwt(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(MR.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,...o,ref:d,style:m===void 0?{display:"none"}:e.style,onFocus:p.composeEventHandlers(e.onFocus,()=>{i.valueIndexToChangeRef.current=r})})}),f&&l.jsx(mhe,{name:s??(i.name?i.name+(i.values.length>1?"[]":""):void 0),form:i.form,value:m},r)]})});hhe.displayName=RR;var bwt="RadioBubbleInput",mhe=Q.forwardRef(({__scopeSlider:e,value:t,...n},r)=>{const s=Q.useRef(null),o=p.useComposedRefs(s,r),i=p.usePrevious(t);return Q.useEffect(()=>{const a=s.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:o,defaultValue:t})});mhe.displayName=bwt;function xwt(e=[],t,n){const r=[...e];return r[n]=t,r.sort((s,o)=>s-o)}function phe(e,t,n){const o=100/(n-t)*(e-t);return p.clamp(o,[0,100])}function ywt(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function vwt(e,t){if(e.length===1)return 0;const n=e.map(s=>Math.abs(s-t)),r=Math.min(...n);return n.indexOf(r)}function wwt(e,t,n){const r=e/2,o=Z3([0,50],[0,r]);return(r-o(t)*n)*n}function Swt(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function Cwt(e,t){if(t>0){const n=Swt(e);return Math.min(...n)>=t}return!0}function Z3(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 Nwt(e){return(String(e).split(".")[1]||"").length}function kwt(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var ghe=ihe,_wt=dhe,jwt=fhe,Iwt=hhe;const bhe=Q.forwardRef(({className:e,...t},n)=>l.jsxs(ghe,{ref:n,className:p.cn("relative flex w-full touch-none select-none items-center",e),...t,children:[l.jsx(_wt,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:l.jsx(jwt,{className:"absolute h-full bg-primary"})}),l.jsx(Iwt,{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"})]}));bhe.displayName=ghe.displayName;const xhe=["SUN","MON","TUE","WED","THU","FRI","SAT"],Ewt=xhe.reduce((e,t,n)=>({...e,[t]:n}),{}),Ll={repeats:"weekly",hour:9,minute:0,weekdays:[1,2,3,4,5],isCustom:!1};function Twt(e){if(!e||!e.trim())return{...Ll};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{...Ll,isCustom:!0};const[s,o,i,a,c]=r,u=Number(s),d=Number(o);if(!Number.isInteger(u)||u<0||u>59||!Number.isInteger(d)||d<0||d>23)return{...Ll,isCustom:!0};if(i==="*"&&(c==="?"||c==="*"))return{...Ll,repeats:"daily",hour:d,minute:u};if(i==="?"&&c!=="?"&&c!=="*"){const h=c.split(",").map(m=>m.toUpperCase()).map(m=>Ewt[m]).filter(m=>typeof m=="number");if(h.length>0)return{...Ll,repeats:"weekly",hour:d,minute:u,weekdays:h}}return i==="1,15"&&(c==="?"||c==="*")?{...Ll,repeats:"biweekly",hour:d,minute:u}:i==="1"&&(c==="?"||c==="*")?{...Ll,repeats:"monthly",hour:d,minute:u}:{...Ll,hour:d,minute:u,isCustom:!0}}function Dwt(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((s,o)=>s-o).map(s=>xhe[s]).join(","):"MON";return`cron(${t} ${n} ? * ${r} *)`}case"biweekly":return`cron(${t} ${n} 1,15 * ? *)`;case"monthly":return`cron(${t} ${n} 1 * ? *)`}}function yhe(e,t){const n=e<12?"AM":"PM",r=e%12===0?12:e%12,s=t.toString().padStart(2,"0");return`${r}:${s} ${n}`}function Mwt(e){return!e||e==="UTC"?"UTC":(e.split("/").pop()??e).replace(/_/g," ")}function Awt(e){if(e.length===7)return"every day";const t=e.slice().sort((s,o)=>s-o);if(t.length===5&&t.every(s=>s>=1&&s<=5))return"weekdays";const r=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];return t.map(s=>r[s]).join(", ")}function Rwt(e,t,n,r){const s=yhe(e.hour,e.minute),o=Mwt(t);let i;if(e.isCustom)i=`Custom schedule · ${s} ${o}`;else switch(e.repeats){case"daily":i=`Daily at ${s} ${o}`;break;case"weekly":i=`Weekly · ${Awt(e.weekdays)} at ${s} ${o}`;break;case"biweekly":i=`Every two weeks (1st and 15th) at ${s} ${o}`;break;case"monthly":i=`Monthly on the 1st at ${s} ${o}`;break}const a=[];return n&&n!=="Today"&&a.push(`from ${n}`),r&&a.push(`until ${r}`),a.length>0?`${i}, ${a.join(" ")}`:i}const Pwt=["UTC","America/New_York","America/Chicago","America/Denver","America/Los_Angeles","Europe/London","Europe/Berlin","Asia/Singapore","Asia/Tokyo","Australia/Sydney"];exports.Accordion=FL;exports.AccordionContent=r0;exports.AccordionItem=t0;exports.AccordionTrigger=n0;exports.AddDataPicker=N3;exports.AggregateTable=x_;exports.Alert=mF;exports.AlertDescription=pF;exports.AlertDialog=kh;exports.AlertDialogAction=ad;exports.AlertDialogCancel=ld;exports.AlertDialogContent=nd;exports.AlertDialogDescription=id;exports.AlertDialogFooter=sd;exports.AlertDialogHeader=rd;exports.AlertDialogTitle=od;exports.AlertDialogTrigger=tye;exports.AlertTitle=UZ;exports.ArrowDown=ps;exports.ArrowDownIcon=Aqe;exports.ArrowLeft=I0;exports.ArrowRight=XN;exports.ArrowUp=Ms;exports.ArrowUpIcon=Pqe;exports.AssistantContextEntityControls=bR;exports.AssistantVirtualizedMessages=qfe;exports.AtSign=Uq;exports.AxisConfigurator=rg;exports.Badge=ls;exports.Bell=Z1;exports.BookType=Wq;exports.BulletChartIcon=Ofe;exports.COMMON_TIMEZONES=Pwt;exports.CSS=bi;exports.CalculatedFieldEditor=Yae;exports.Calculator=Yq;exports.Calendar=ii;exports.Calendar$1=CS;exports.CalendarRange=Kq;exports.Card=ry;exports.CardContent=YR;exports.CardHeader=GR;exports.CardSummary=BA;exports.CardTitle=Gp;exports.ChartArea=c2;exports.ChartColumnIncreasing=Zq;exports.ChartColumnStacked=Xq;exports.ChartJsVisual=gv;exports.ChartLine=Qq;exports.ChartNoAxesGantt=eW;exports.ChartPie=tW;exports.ChartScatter=nW;exports.ChatInputWithContext=k3;exports.Checkbox=Mn;exports.ChevronLeft=wh;exports.ChevronRight=Bn;exports.ChevronsUpDown=oW;exports.Circle=KR;exports.CircleAlert=qf;exports.CircleCheck=iW;exports.CircleHelp=aW;exports.Clock=ZR;exports.CodeHighlighter=Vf;exports.CodeXml=X1;exports.Collapsible=Sc;exports.CollapsibleContent=Nc;exports.CollapsibleTrigger=Cc;exports.ColorField=Ai;exports.Command=cj;exports.CommandEmpty=dj;exports.CommandGroup=fj;exports.CommandInput=NL;exports.CommandItem=hj;exports.CommandList=uj;exports.CommandSeparator=mae;exports.ComparisonMetadataBadge=pee;exports.Container=wP;exports.ControlDefaultValueEditor=gle;exports.ControlDefinitionOptionsEditor=ple;exports.ControlIdInput=dle;exports.ControlVisibilitySettings=Wet;exports.Copy=Tu;exports.CopyButton=Iu;exports.CopyPlus=d2;exports.Cross2Icon=$qe;exports.CustomFilterPopover=U5;exports.CustomScrollArea=Ea;exports.DEFAULT_HEATMAP_CUSTOM_RANGE=bJ;exports.DEFAULT_SCHEDULE_VM=Ll;exports.Dashboard=Jfe;exports.DashboardCard=vie;exports.DashboardCreateDialogBase=eY;exports.DashboardExportDialog=Wfe;exports.DashboardPlus=$vt;exports.DashboardWC=twt;exports.DataTableConditionalFormattingSettings=sce;exports.DataTablePagination=a_;exports.Database=zi;exports.DateRangePicker=N5;exports.DefaultChatTransport=g3;exports.Dialog=_o;exports.DialogContent=ao;exports.DialogDescription=Go;exports.DialogFooter=Ic;exports.DialogHeader=Zi;exports.DialogTitle=lo;exports.DialogTrigger=XG;exports.DisplayPreferencesProvider=Q_;exports.DndContext=Fv;exports.Donut=lW;exports.Download=_c;exports.DownloadPdf=Gfe;exports.DragOverlay=eae;exports.DropdownMenu=zs;exports.DropdownMenuCheckboxItem=Kc;exports.DropdownMenuContent=Ns;exports.DropdownMenuItem=vn;exports.DropdownMenuLabel=da;exports.DropdownMenuRadioGroup=lbe;exports.DropdownMenuRadioItem=CG;exports.DropdownMenuSeparator=Ui;exports.DropdownMenuSub=fP;exports.DropdownMenuSubContent=ik;exports.DropdownMenuSubTrigger=ok;exports.DropdownMenuTrigger=Bs;exports.EMPTY_DATA_SOURCE=Up;exports.Editable=uN;exports.EditableText=Ho;exports.EditorCustomVisual=cwt;exports.Ellipsis=ui;exports.EllipsisVertical=Sh;exports.ErrorBoundary=ka;exports.ExportError=ug;exports.ExternalLink=hp;exports.Eye=E0;exports.EyeOff=QN;exports.Fallback=Z_;exports.FallbackVisual=Gy;exports.FeedbackCategory=ed;exports.FeedbackDialog=g0;exports.FieldsList=UL;exports.FieldsSection=nwt;exports.FileCode=cW;exports.FileSpreadsheet=uW;exports.FileText=di;exports.Filter=Wf;exports.FilterComponent=H_;exports.FilterInfo=OA;exports.FilterableFieldsPanel=Zae;exports.Globe=Ch;exports.Grid3x3=f2;exports.GripVertical=jc;exports.HEATMAP_PRESET_PALETTES=xM;exports.Hash=dW;exports.House=fW;exports.HoverCard=dg;exports.HoverCardContent=Bu;exports.HoverCardTrigger=fg;exports.INLINE_ALLOWED_READ_ONLY_TOOLS=the;exports.INLINE_ALLOWED_TOOL_LIST=swt;exports.INLINE_BLOCKED_MUTATING_TOOLS=rwt;exports.IconButton=cc;exports.IconForFieldType=TS;exports.InfoHover=fL;exports.InlineFilterBar=uie;exports.KPICard=Yu;exports.KeyboardSensor=Rv;exports.Layers=T0;exports.LayoutDashboard=Gf;exports.Link=XR;exports.LoadingDots=Hu;exports.Lock=JN;exports.MAX_SELF_HEAL_ATTEMPTS=owt;exports.Map=pW;exports.Markdown=Jde;exports.MatrixTableVisual=b_;exports.Maximize2=ek;exports.MdStackedLineChart=Pfe;exports.Minimize2=QR;exports.MultiInputEmptyRenderer=x5;exports.PYTHON_DEFAULT_CODE=FR;exports.PanelResizeHandle=Tj;exports.Paperclip=gW;exports.PenLine=h2;exports.Pencil=m2;exports.PendingMessagesDisplay=mde;exports.PersistedDynamicVisual=X_;exports.PiChartPolar=Dfe;exports.Pin=xW;exports.PinOff=bW;exports.PivotTableTanstack=Mg;exports.Placeholders=Dce;exports.Play=yW;exports.Plus=kr;exports.PointerSensor=Lg;exports.Progress=S3;exports.RECOVERABLE_SQL_ERROR_CODES=awt;exports.Radar=vW;exports.RadioGroup=Sa;exports.RadioGroupItem=ws;exports.RefreshCw=Yf;exports.ResizableHandle=not;exports.ResizablePanel=oR;exports.ResizablePanelGroup=Tce;exports.ResourceEditDialog=DY;exports.ResourceType=Kr;exports.SELF_HEAL_TIMELINE_STEP=iwt;exports.Search=$s;exports.SeedQuestions=Jue;exports.SemaphorContext=k0;exports.SemaphorContextProvider=HR;exports.SemaphorQueryClient=Lq;exports.SemaphorReadyIndicator=K3;exports.SemaphorStyleWrapper=Ag;exports.Send=wW;exports.Settings=JR;exports.Settings2=D0;exports.Share2=SW;exports.ShareDialog=TY;exports.Sheet=ree;exports.SheetContent=pO;exports.SheetDescription=bO;exports.SheetHeader=oee;exports.SheetTitle=gO;exports.SheetTrigger=GPe;exports.Slider=bhe;exports.SortableContext=Ov;exports.Sparkles=GS;exports.Square=tP;exports.SquarePen=eP;exports.Star=CW;exports.StructuralParticipantSelector=fle;exports.SummaryCard=RA;exports.TABLE_PRESENTATION_DEFAULT_STYLE=_u;exports.TABLE_PRESENTATION_DEFAULT_TOTALS_STYLE=Fi;exports.TableBody=zu;exports.TableCell=Tn;exports.TableColumnVisibilitySettings=Wle;exports.TableHead=es;exports.TableHeader=Ph;exports.TablePresentationSettings=Yle;exports.TableRow=wr;exports.TableSkeleton=hL;exports.TableVisual=Vu;exports.TbChartBubble=Mfe;exports.TbChartFunnel=Afe;exports.TbChartTreemap=Rfe;exports.TextCard=Op;exports.Textarea=jh;exports.TiSortNumerically=Ffe;exports.Toggle=Y_;exports.Tornado=NW;exports.Trash2=fl;exports.TreePalm=rP;exports.TrendingUp=kW;exports.TriangleAlert=Bi;exports.TypeGlyph=Ev;exports.UXProvider=Y3;exports.User=_W;exports.Users=nk;exports.applyFilterOverridesToDashboardInputSlots=uZ;exports.areContextEntitiesEqual=Qn;exports.areEntitiesJoined=SJ;exports.arrayMove=$g;exports.buildCardControlUsageById=Yet;exports.buildCustomCardTheme=Nv;exports.buildDashboardCardExecutionSnapshot=cZ;exports.buildDashboardControlUsageById=Get;exports.buildDashboardExecutionSnapshot=lF;exports.buildDashboardInputExecutionSnapshot=vu;exports.buildDashboardSheetsInputExecutionSnapshot=fZ;exports.buildDashboardStructuralParticipantIdsByControlId=yle;exports.buildFilterFieldMeta=TL;exports.buildFilterSemanticContext=DL;exports.buildInlineFilterNodes=W5;exports.buildMultiInputCustomVisualProps=Q5;exports.buildScheduleExpr=Dwt;exports.buildSchedulePreview=Rwt;exports.buildSlotOrderedCards=Y5;exports.calculateContextAwareFilters=B0;exports.calculateFieldState=iO;exports.canUserAccessVisuals=a0e;exports.canUserCreateDashboards=RY;exports.canUserEdit=s0e;exports.canUserManageDashboards=i0e;exports.canUserManageGroups=l0e;exports.canUserUseFilters=o0e;exports.cancelExport=FRe;exports.chartSupportsDataLabels=mQ;exports.chartSupportsLegend=fQ;exports.chartTypes=qj;exports.cleanupKpiMetricComparisonMode=Sae;exports.cloneDeep=$o;exports.cloneLinkedFrameWithSourceMapping=XGe;exports.closestCenter=Av;exports.commitSharedCalculatedFields=Wd;exports.createAssistantConversationId=Im;exports.createAssistantRequestId=Xue;exports.createCardsFromSlots=fWe;exports.createChartConfig=cg;exports.createDashboardControlInputFromControl=Hrt;exports.createDefaultGlobalDateFilter=pSe;exports.createExport=VJ;exports.createUniqueDashboardInputVariableNameFromName=Eu;exports.dedup=Xut;exports.doesStoredFilterMatchField=Vp;exports.downloadDocumentPdf=uF;exports.downloadPdf=vZ;exports.extractSqlParamReferences=Nse;exports.extractTableMetadata=EL;exports.fieldAlreadyExists=NJ;exports.findCustomVisualConfigCard=Z5;exports.findDashboardFrameById=iSe;exports.flexRender=Bo;exports.formatDisplayFormula=zQe;exports.formatFileSize=$Re;exports.formatFilterLine=WZ;exports.formatTimeLabel=yhe;exports.getAutoDetectedChartIcon=h0t;exports.getChartGridStyle=$Ne;exports.getChartIconByType=m0t;exports.getColorForValue=P2;exports.getConfigSlotExpectedType=dWe;exports.getCoreRowModel=s_;exports.getCustomVisualInputCards=K5;exports.getDateFormatOptionsForGranularity=Jy;exports.getDefaultAxisConfig=O2;exports.getDefaultChartColors=Mh;exports.getDefaultDataLabelsConfig=J0;exports.getDefaultExportFormat=cX;exports.getDefaultFilterSql=E5;exports.getDefaultLegendConfig=HF;exports.getDefaultRunningTotalPartitionByFieldIds=Yx;exports.getDocumentSectionEditorCard=ket;exports.getDocumentSheetDashboardInputs=Vv;exports.getDownloadUrl=PRe;exports.getEffectiveCardTypeForSlot=Ym;exports.getEntityIcon=BN;exports.getErrorMessage=$ue;exports.getExportStatus=RRe;exports.getExports=ARe;exports.getExpressionFieldKind=Zu;exports.getFieldExpressionAnnotation=ML;exports.getFilterCount=pN;exports.getGlobalDateFilter=Xp;exports.getGlobalDateFilterCoverage=gSe;exports.getGranularityOptionsForFieldType=ZL;exports.getKeys=lr;exports.getMatrixVisualLoadingState=g_;exports.getMetricDisplayLabel=tRe;exports.getNewField=EJ;exports.getObjectDiff=xq;exports.getPaginationRowModel=o_;exports.getRoleBasedDisplayOverrides=AY;exports.getRunningTotalOrderByCandidates=cQe;exports.getSelectedDateFilterColumn=_se;exports.getSheetScopedFilterValues=cy;exports.getSlotDefinitionForIndex=G5;exports.getSlotExpectedChartType=W_;exports.getSlotIndexForCard=qy;exports.getSortedRowModel=tee;exports.getSupportedExportFormats=lX;exports.getTableConditionalFormattingColumnOptions=Qle;exports.getTableOutputColumnOptions=Jle;exports.getTablePageSizeOptions=$J;exports.handleAggregationChange=LA;exports.handleAggregationLabelChange=lie;exports.hasFlatTableTotalsBehavior=uCe;exports.hasMatrixResultData=rv;exports.horizontalListSortingStrategy=vL;exports.isCalculatedFilterField=e0;exports.isCardSummaryVisibleOnCard=J5;exports.isCustomVisualConfigCard=MA;exports.isDefaultColor=yCe;exports.isEligibleFlatTableTotalsCard=Qp;exports.isExportComplete=LRe;exports.isExportInProgress=ORe;exports.isInAiScopeArray=Zut;exports.isManagedCalculatedExpressionField=xa;exports.isMetricTransformEnabled=aQe;exports.isPromiseLike=gR;exports.isSubtotalEnabledAggregateTable=IL;exports.isSupportedDocumentTableCardType=_et;exports.lastAssistantMessageIsCompleteWithToolCalls=Pue;exports.merge=dl;exports.mergeAxisConfig=L2;exports.normalizeConditionalFormatting=tF;exports.normalizeContextFormatMode=QZ;exports.normalizeDashboardInputVariableName=j0;exports.normalizeMultiInputPayload=X5;exports.parseScheduleExpr=Twt;exports.pivotData=W0;exports.prepareFeedbackData=Uj;exports.purify=fA;exports.reindexSlotCards=uWe;exports.remarkGfm=jfe;exports.removeFromScopeArray=Qut;exports.resolveDashboardInputContext=Nl;exports.resolveDomainCalculatedFieldForEdit=PJe;exports.resolveMultiInputType=kv;exports.resolveMultiInputTypeFromVisual=hWe;exports.resolveTablePageSize=t_;exports.resolveTablePresentationStyle=kO;exports.sanitizeAIScope=Lue;exports.saveCalculatedFieldToCardScope=ZA;exports.saveCalculatedFieldToSharedScope=Kae;exports.saveCalculatedFieldToSheetScope=XA;exports.seedSemanticMetricFormatDefaults=Nae;exports.setTableColumnVisibility=qJ;exports.setupEditorWithCard=Rk;exports.showAllTableColumns=HRe;exports.showJoinRequiredNotification=CJ;exports.sortByColumnsToSortState=kee;exports.sortStateToSortByColumns=_ee;exports.sortableKeyboardCoordinates=SL;exports.supportsMetricTransformForMetric=Cae;exports.supportsTableConditionalFormatting=Kle;exports.toEntityArray=ba;exports.ue=et;exports.useActiveExports=g0e;exports.useActiveToolStatus=gde;exports.useAddFrameWithFreshSemanticExecutionPayload=dL;exports.useAddNewFrame=Tie;exports.useAssistantContainer=OY;exports.useAssistantContextEntities=ej;exports.useAssistantLayoutStore=kf;exports.useAssistantPanel=PY;exports.useAssistantProfile=Que;exports.useAutoSubmitQueue=pde;exports.useBrandStudioPreview=_vt;exports.useCard=hRe;exports.useCardFilterValues=DJ;exports.useCardSummary=eL;exports.useChat=Oue;exports.useColumns=kL;exports.useCreateVisualWithFrame=sxe;exports.useCurrentUserInfo=Ki;exports.useCustomVisual=$h;exports.useCustomVisualsQuery=H5;exports.useDashboardAppearance=Dc;exports.useDashboardById=MG;exports.useDashboardPreferences=Yp;exports.useDashboardQuery=_0;exports.useDashboardStructuralParticipants=vle;exports.useDashboardSummary=qoe;exports.useDataColumns=_ae;exports.useDateFilterHook=U9e;exports.useDebounce=Vx;exports.useDefaultDashboardMutation=kG;exports.useDisplayPreferences=Cl;exports.useDroppable=Jie;exports.useEditorAside=mj;exports.useEditorCardQuery=Ak;exports.useEnsureReactGlobals=Jre;exports.useExportActions=LY;exports.useExportStore=mk;exports.useFieldManagement=kae;exports.useFilterableFields=yae;exports.useFullscreenAssistant=FY;exports.useGroupMembers=iye;exports.useGroups=SY;exports.useHasDashboardId=$Y;exports.useInProgressExportsCount=b0e;exports.useJoinabilityMap=jL;exports.useManagementActions=vh;exports.useManagementStore=Os;exports.useMutation=so;exports.usePivotTableConfig=Rh;exports.usePluginQuery=Doe;exports.useQuery=Dn;exports.useQueryClient=Zr;exports.useReactTable=i_;exports.useResolveExistingFrameSemanticExecutionPayload=tYe;exports.useResourceManagement=mP;exports.useResourceUpdateState=AG;exports.useScopedFields=xae;exports.useSelectedVisual=Gme;exports.useSemaphorContext=ht;exports.useSensor=Bp;exports.useSensors=sj;exports.useSortable=zg;exports.useStarredChartsStore=uwt;exports.useSurfaceAppearance=Tc;exports.useTableQueryState=gee;exports.useTextFilterHook=t7e;exports.useTheme=OR;exports.useTopoJson=tv;exports.useUnifiedUsers=yP;exports.useUpdateResource=IG;exports.useUpdateVisualMutation=oxe;exports.useUserPreferences=tY;exports.useVisualById=lk;exports.useVisualManagement=rxe;exports.validateFieldForChartType=wae;exports.verticalListSortingStrategy=wL;
@@ -142653,9 +142653,9 @@ function p_t() {
142653
142653
  }
142654
142654
  );
142655
142655
  }
142656
- const g_t = Vk(() => import("./dashboard-controls-D5mjF67R.js")), b_t = Vk(
142657
- () => import("./edit-dashboard-visual-eYJMy7aw.js")
142658
- ), y_t = Vk(() => import("./dashboard-json-BumvCRuk.js"));
142656
+ const g_t = Vk(() => import("./dashboard-controls-BfkcnIdy.js")), b_t = Vk(
142657
+ () => import("./edit-dashboard-visual-DOW1Ap1N.js")
142658
+ ), y_t = Vk(() => import("./dashboard-json-DjXi4cI6.js"));
142659
142659
  function BIt({
142660
142660
  showControls: e = !1,
142661
142661
  showFooter: t = !0,
@@ -1,4 +1,4 @@
1
- "use strict";const s=require("./switch-Jhyl63RF.js"),C=require("react"),m=require("./index-c_0nwsOM.js"),e=require("react/jsx-runtime");require("./index-BxM99sFL.js");require("./catalog-field-grounding-8L9I0zdg.js");const Se=require("./save-D2O96E5A.js");/**
1
+ "use strict";const s=require("./switch-Jhyl63RF.js"),C=require("react"),m=require("./index-CkoRCh3g.js"),e=require("react/jsx-runtime");require("./index-BxM99sFL.js");require("./catalog-field-grounding-8L9I0zdg.js");const Se=require("./save-D2O96E5A.js");/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,6 +1,6 @@
1
1
  import { c as ge, H as ie, E as Le, u as Z, G as M, a7 as bt, W as yt, Y as vt, Z as xt, a as fe, $ as Ct, a8 as kt, B as q, e as St, X as et, f as tt, a9 as Nt, aa as wt, ab as pe, ac as je, ad as Qe, ae as Se, af as Ne, ag as Dt, ah as $e, ai as Et, aj as It, ak as me, al as Ft, am as Pe, g as He, an as at, ao as rt, ap as st, L as oe, a0 as nt, a1 as we, a2 as De, a3 as Ee, a4 as Ie, a5 as Fe, aq as ot, ar as Vt, as as Tt, at as We, au as _t, av as Ke, aw as Lt, ax as Ve } from "./switch-DMPsMpHW.js";
2
2
  import { useState as K, useEffect as de, useCallback as R, useMemo as P, useRef as Te, Fragment as At } from "react";
3
- import { aD as qt, u as Mt, aE as ce, aF as Ot, aG as Ae, aH as zt, aI as Ut, aJ as Rt, p as B, aK as Bt, aL as jt, aM as lt, aN as Qt, aO as $t, aP as Pt, aQ as Ht, aR as Wt, y as Kt, aS as Yt, aT as it, aU as dt, aV as Gt, aW as Jt, aX as Xt, ay as Ye, aY as Zt, aZ as ea, a_ as ct, a$ as ut, b0 as ta, b1 as aa, b2 as ra, b3 as sa, b4 as na, ar as oa, b5 as la, b6 as ia } from "./index-hhH5F_tQ.js";
3
+ import { aD as qt, u as Mt, aE as ce, aF as Ot, aG as Ae, aH as zt, aI as Ut, aJ as Rt, p as B, aK as Bt, aL as jt, aM as lt, aN as Qt, aO as $t, aP as Pt, aQ as Ht, aR as Wt, y as Kt, aS as Yt, aT as it, aU as dt, aV as Gt, aW as Jt, aX as Xt, ay as Ye, aY as Zt, aZ as ea, a_ as ct, a$ as ut, b0 as ta, b1 as aa, b2 as ra, b3 as sa, b4 as na, ar as oa, b5 as la, b6 as ia } from "./index-DlprYjr6.js";
4
4
  import { jsx as a, jsxs as m, Fragment as re } from "react/jsx-runtime";
5
5
  import "./index-CuHybtft.js";
6
6
  import "./catalog-field-grounding-BK4BX8sZ.js";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../chunks/index-c_0nwsOM.js"),e=require("../chunks/common-types-C73-Ud1-.js");exports.Dashboard=o.Dashboard;exports.CONTROL_CARD_DEFAULT_VALUE=e.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=e.EMPTY_SELECTION;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../chunks/index-CkoRCh3g.js"),e=require("../chunks/common-types-C73-Ud1-.js");exports.Dashboard=o.Dashboard;exports.CONTROL_CARD_DEFAULT_VALUE=e.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=e.EMPTY_SELECTION;
@@ -1,4 +1,4 @@
1
- import { D as o } from "../chunks/index-hhH5F_tQ.js";
1
+ import { D as o } from "../chunks/index-DlprYjr6.js";
2
2
  import { C as s, E as C } from "../chunks/common-types-4bjoIgvm.js";
3
3
  export {
4
4
  s as CONTROL_CARD_DEFAULT_VALUE,
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("react"),kn=require("react-dom/client"),v=require("../chunks/index-c_0nwsOM.js"),x=require("../chunks/switch-Jhyl63RF.js"),Ye=require("../data-app-builder-browser-runtime/index.cjs"),Nn=require("../chunks/save-D2O96E5A.js");function Fr(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 An=Fr(p),Cn=Fr(kn);/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("react"),kn=require("react-dom/client"),v=require("../chunks/index-CkoRCh3g.js"),x=require("../chunks/switch-Jhyl63RF.js"),Ye=require("../data-app-builder-browser-runtime/index.cjs"),Nn=require("../chunks/save-D2O96E5A.js");function Fr(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 An=Fr(p),Cn=Fr(kn);/**
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 _t, az as sn, aA as ia, aB as la, aC as da } from "../chunks/index-hhH5F_tQ.js";
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 _t, az as sn, aA as ia, aB as la, aC as da } from "../chunks/index-DlprYjr6.js";
6
6
  import { c as $e, B as H, P as it, b as lt, d as dt, a1 as ca, a2 as ua, a3 as pa, a4 as ha, a5 as ma, X as Je, f as me, R as fa, e as Ut } from "../chunks/switch-DMPsMpHW.js";
7
7
  import { loadSemaphorBrowserRuntime as ot } from "../data-app-builder-browser-runtime/index.js";
8
8
  import { S as ga } from "../chunks/save-zNVYH02T.js";