react-semaphor 0.1.448 → 0.1.449

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 (23) hide show
  1. package/dist/chunks/{dashboard-briefing-launcher-DHAgK6LQ.js → dashboard-briefing-launcher-DCHiEkLE.js} +2 -2
  2. package/dist/chunks/{dashboard-briefing-launcher-BbBD6r23.cjs → dashboard-briefing-launcher-DDgDr2s3.cjs} +1 -1
  3. package/dist/chunks/{dashboard-controls-Cq1L0Iaq.cjs → dashboard-controls-CaFioayc.cjs} +1 -1
  4. package/dist/chunks/{dashboard-controls-D83FAKol.js → dashboard-controls-DwRFCcHV.js} +3 -3
  5. package/dist/chunks/{dashboard-json-MQsd_x4u.cjs → dashboard-json-CYtvwtvj.cjs} +1 -1
  6. package/dist/chunks/{dashboard-json-BumpAIpV.js → dashboard-json-WoILbfTe.js} +1 -1
  7. package/dist/chunks/{edit-dashboard-visual-DDg6-670.cjs → edit-dashboard-visual-DwKcvlsF.cjs} +2 -2
  8. package/dist/chunks/{edit-dashboard-visual-BApnAJlf.js → edit-dashboard-visual-ciFhxqaI.js} +4 -4
  9. package/dist/chunks/{editor-action-buttons-B5I-BUky.js → editor-action-buttons-BPo_45pM.js} +1 -1
  10. package/dist/chunks/{editor-action-buttons-BW3qw_Og.cjs → editor-action-buttons-BVmsk0Aj.cjs} +1 -1
  11. package/dist/chunks/{index-CxnEYRCF.js → index-CPuawpXJ.js} +3 -3
  12. package/dist/chunks/{index-zREDXi6s.cjs → index-DPv8_Ild.cjs} +1 -1
  13. package/dist/chunks/{report-preferences-dialog-lyC6PCs9.js → report-preferences-dialog-D9ZCGh9l.js} +1 -1
  14. package/dist/chunks/{report-preferences-dialog-BRGOibDO.cjs → report-preferences-dialog-DaqTEcac.cjs} +1 -1
  15. package/dist/dashboard/index.cjs +1 -1
  16. package/dist/dashboard/index.js +1 -1
  17. package/dist/data-app-builder/index.cjs +1 -1
  18. package/dist/data-app-builder/index.js +1 -1
  19. package/dist/index.cjs +1 -1
  20. package/dist/index.js +4 -4
  21. package/dist/surfboard/index.cjs +1 -1
  22. package/dist/surfboard/index.js +2 -2
  23. package/package.json +1 -1
@@ -1392,4 +1392,4 @@ Defaulting to \`null\`.`}var Vbe=Lbe,bjt=zbe;const Y4=te.forwardRef(({className:
1392
1392
  More info: ${o.docs}`:"",a=typeof o.message=="string"&&o.message.trim()?o.message.trim():typeof o.error=="string"&&o.error.trim()?o.error.trim():null;if(a){const c=s?` (code: ${s})`:"",u=s==="insufficient_quota"||a.toLowerCase().includes("quota")?`
1393
1393
 
1394
1394
  Semaphor supports bring-your-own OpenAI API keys. Add yours in Settings or drop a note to support@semaphor.cloud and we’ll help you get set up.`:"";return`${a}${c}${i}${u}`}return null};if(typeof e=="string"){const r=e.trim();if(!r)return"Something went wrong.";try{const o=JSON.parse(r),s=t(o);if(s)return s}catch{}return r}const n=t(e);if(n)return n;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function tB({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(Ws,{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:Akt(e)})]})}function Pkt({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(tB,{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 Fkt({text:e,files:t}){return l.jsxs(dxe,{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(yjt,{file:n},n.id))})]})}function Okt({text:e}){const t=e.split("|"),n=t[0],r=t[1]||"{}",o=JSON.parse(r);return l.jsxs("div",{className:"space-y-1 text-xs",children:[l.jsxs("div",{children:[l.jsx("span",{className:"font-bold",children:"System Message:"})," ",n]}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("span",{className:"font-mono text-xs",children:"Scope:"}),l.jsx($jt,{children:JSON.stringify(o,null,2)})]})]})}function fxe(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")?eB(r,t):!1}})}function VG(){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 Lkt({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(VG,{}),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(VG,{}),l.jsx("span",{children:e==="submitted"?"Thinking":"Generating"})]}):e==="error"?l.jsx(tB,{errorMessage:t}):null}function $kt(e){var t;return e?(t=[...e].reverse().find(n=>{var r;return n.role==="assistant"&&((r=n.parts)==null?void 0:r.some(o=>o.type==="text"&&typeof o.text=="string"&&o.text.trim().length>0))}))==null?void 0:t.id:void 0}function zkt({message:e,messageIndex:t,messages:n,showTools:r=!1,onAddToDashboard:o,showSystemMessage:s=!1,handleRun:i,onQuickReply:a,disableQuickReplies:c=!1}){var y,w,C,S;const u=$kt(n),d=e.id===u;if(e.role==="user"){const N=((y=e.parts)==null?void 0:y.filter(T=>T.type==="text"))||[],j=((w=e.parts)==null?void 0:w.filter(T=>T.type==="file"))||[],k=N.map(T=>T.text).join(`
1395
- `).trim(),I=j.map((T,_)=>{var A,F;let E="",D;if((A=T.url)!=null&&A.startsWith("data:")){const P=T.url.match(/data:[^;]+;base64,(.+)/);P&&(E=P[1],(F=T.mediaType)!=null&&F.startsWith("image/")&&(D=T.url))}return{id:`${e.id||t}-file-${_}`,name:T.filename||`File ${_+1}`,size:0,type:T.mediaType||"application/octet-stream",data:E,preview:D}});return l.jsx(Fkt,{text:k||void 0,files:I.length>0?I:void 0})}const f=((C=e.parts)==null?void 0:C.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(du,{className:"space-y-2",defaultOpen:!1,children:[l.jsx(fu,{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(At.ChevronRight,{className:"h-3 w-3 transition-transform duration-200 group-data-[state=open]:rotate-90"}),l.jsx("span",{className:m?"animate-pulse":"",children:m?"Reasoning":"Show reasoning"}),g.length>1&&l.jsxs("span",{className:"font-mono tabular-nums text-muted-foreground/70",children:["(",g.length," steps)"]})]})}),l.jsx(hu,{children:l.jsx("ol",{className:"space-y-2 border-l border-border/60 pl-3",children:g.map((N,j)=>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:j+1}),l.jsx(AG,{className:"text-[12px] leading-[1.55] text-muted-foreground",text:N.text})]},`${e.id||t}-reasoning-${j}`))})})]},`${e.id||t}-reasoning`):null,x=(S=e.parts)==null?void 0:S.map((N,j)=>{var I;const k=`${e.id||t}-${j}`;switch(N.type){case"text":{const T=typeof N.text=="string"?N.text:JSON.stringify(N.text??"",null,2);if(e.role==="assistant"){const{cleanedText:_,quickReplies:E}=Mkt(T),D=_.trim().length>0;return l.jsxs("div",{className:"space-y-2.5",children:[D&&l.jsx(AG,{text:_,handleRun:i,onAddToDashboard:o,messageId:e.id,messages:n}),E.length>0&&a&&d&&l.jsxs("div",{className:"space-y-1.5",children:[E.length>=3&&l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Suggested next steps"}),l.jsx("div",{className:"flex flex-wrap gap-1",children:E.map(({label:A,value:F},P)=>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:A})})}),l.jsx(p.TooltipContent,{side:"top",align:"center",children:l.jsx("p",{className:"max-w-xs text-xs",children:F})})]},`${k}-qr-${P}`))})]})]},k)}return e.role==="system"&&s?l.jsx(Okt,{text:T},k):null}case"error":{const T=N,_=T.errorText??T.error??T.message;return l.jsx("div",{className:"my-4",children:l.jsx(tB,{errorMessage:_})},k)}case"reasoning":return null;default:return((I=N.type)!=null&&I.startsWith("tool-")||N.type==="dynamic-tool")&&eB(N,r)?l.jsx(Si,{FallbackComponent:({error:T,resetErrorBoundary:_})=>l.jsx(Pkt,{error:T,resetErrorBoundary:_}),children:l.jsx(Ikt,{part:N,idx:k,messageId:e.id,showTools:r,onAddToDashboard:o,messages:n})},k):null}});return e.role==="assistant"?fxe(e,r)?l.jsxs(dxe,{who:"Assistant",className:"space-y-2",children:[b,x]}):null:l.jsxs("div",{className:"space-y-2",children:[b,x]})}const Bkt=8,Vkt=24,Hkt=20;function qkt(e,t,n,r){return e==="error"&&t?!0:r?!1:!!(n||e==="submitted"||e==="streaming")}function hxe({messages:e,showTools:t=!1,showSystemMessage:n=!1,handleRun:r,onAddToDashboard:o,onQuickReply:s,disableQuickReplies:i=!1,status:a,errorMessage:c,activeToolText:u,className:d,rowContentClassName:f,statusClassName:h,latestButtonClassName:m,scrollToEndSignal:g=0}){const b=v.useRef(null),x=v.useRef(null),y=v.useRef(e.length),w=v.useRef(!1),C=v.useRef(null),S=v.useRef(!1),N=v.useRef(g),[j,k]=v.useState(!0),[I,T]=v.useState(0),[_,E]=v.useState(Vkt);N.current!==g&&(N.current=g,S.current=!0);const D=e[e.length-1],A=fxe(D,t),F=qkt(a,c,u,A),P=C_({count:e.length,getScrollElement:()=>b.current,estimateSize:U=>{const M=e[U];return(M==null?void 0:M.role)==="user"?88:180},getItemKey:U=>{const M=e[U];return(M==null?void 0:M.id)||`message-${U}`},anchorTo:"end",followOnAppend:!0,scrollEndThreshold:Bkt,overscan:6,gap:20,paddingEnd:F?_+Hkt:0,useAnimationFrameWithResizeObserver:!0,onChange:U=>{const M=U.isAtEnd();k(q=>q===M?q:M),M&&T(0)}}),O=v.useCallback((U="smooth")=>{C.current!==null&&cancelAnimationFrame(C.current),C.current=requestAnimationFrame(()=>{C.current=null,P.scrollToEnd({behavior:U})}),T(0),k(!0)},[P]);v.useLayoutEffect(()=>{w.current||(w.current=!0,O("auto"))},[O]),v.useLayoutEffect(()=>{S.current&&(S.current=!1,O("auto"))},[e.length,g,O]),v.useEffect(()=>{const U=y.current;y.current=e.length,e.length>U&&!P.isAtEnd()&&T(M=>M+e.length-U),e.length===0&&(T(0),k(!0),w.current=!1,S.current=!1)},[e.length,P]);const $=P.getVirtualItems(),B=P.getTotalSize();return v.useEffect(()=>()=>{C.current!==null&&cancelAnimationFrame(C.current)},[]),v.useLayoutEffect(()=>{const U=x.current;if(!U||!F)return;const M=()=>{const W=Math.ceil(U.getBoundingClientRect().height);W>0&&E(R=>R===W?R:W)};if(M(),typeof ResizeObserver>"u")return;const q=new ResizeObserver(M);return q.observe(U),()=>q.disconnect()},[F,a,c,u]),l.jsxs(l.Fragment,{children:[l.jsx(sl,{"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:B},children:[$.map(U=>{const M=e[U.index];return M?l.jsx("div",{ref:P.measureElement,"data-index":U.index,className:"absolute left-0 top-0 w-full",style:{transform:`translateY(${U.start}px)`},children:l.jsx("div",{className:p.cn("min-w-0",f),children:l.jsx(zkt,{message:M,messageIndex:U.index,messages:e,showTools:t,showSystemMessage:n,handleRun:r,onAddToDashboard:o,onQuickReply:s,disableQuickReplies:i})})},U.key):null}),F&&l.jsx("div",{ref:x,className:p.cn("absolute left-0 top-0 w-full",h),style:{transform:`translateY(${Math.max(B-_,0)}px)`},children:l.jsx("div",{className:p.cn("min-w-0",f),children:l.jsx(Lkt,{status:a,errorMessage:c,activeToolText:u})})})]})}),!j&&l.jsxs("button",{type:"button",onClick:()=>O("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(Yo,{className:"h-3 w-3"}),"Latest",I>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:I>9?"9+":I})]})]})}function Ukt(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 Wkt=[{title:"Show top 3 insights",subtitle:"from this dataset"},{title:"Create a bar chart for",subtitle:"sales by product category"}];function Kkt({open:e,setOpen:t,isFullscreen:n,onFullscreenChange:r,fullscreenContainer:o}){const[s,i]=v.useState(!1),[a,c]=v.useState(p.isDevEnv),[u,d]=v.useState(!1),[f,h]=v.useState("auto"),[m,g]=v.useState(!1),[b,x]=v.useState(!1),[y,w]=v.useState(0),C=n??b,{isLocalDev:S,isConsoleMode:N}=Dm(),j=S||N||a,k=v.useRef(null);p.useDashboardStore(se=>se.dashboard.aiScopeTables),p.useDashboardStore(se=>se.isDashboardEditing);const I=p.useDashboardStore(se=>se.selectedSheetId),{setDataSource:T}=p.useEditorActions(),{setSelectedFrameId:_,setIsDashboardEditing:E}=p.useDashboardActions(),D=cz(),{clearAssistantMessageContexts:A}=p.useAIActions(),{clearQueue:F}=p.useQueueActions(),{clearFileAttachments:P,getFileAttachments:O}=p.useFileActions(),$=p.useFileAttachments("dashboard"),B=p.useEditorStore(se=>se.card.dataSource),{assistantProfile:U}=Dbe(),M=p.useDashboardStore(se=>se.handleOpenAssistantProfile),{selectedEntities:q,applyDashboardDefaultEntities:W}=fT("dashboard"),{sendMessage:R,isLoading:Z,messages:X,setMessages:Y,status:G,stop:z,errorMessage:V,clearError:L}=QNt({dynamicVisualMode:f}),H=v.useCallback(()=>{w(se=>se+1)},[]),K=v.useCallback(se=>{r==null||r(se),n===void 0&&x(se)},[n,r]),Q=v.useCallback(()=>{K(!C)},[C,K]);v.useEffect(()=>{if(!C)return;function se(pe){pe.key==="Escape"&&K(!1)}return window.addEventListener("keydown",se),()=>{window.removeEventListener("keydown",se)}},[C,K]);const[ne,ae]=v.useState(""),ce=se=>{ae(se.target.value)};async function ie({sql:se,cardTitle:pe,connectionId:Fe,cardType:Le,python:$e,cardConfig:Me,dataSource:be,customVisualPreferences:ke,visualizationMode:Oe,dynamicCardPreferences:Ve}){if(!I)return;const Xe=Oe==="dynamic",ve=vi.hasValidCardConfig(Me),Ye=Fe||(be==null?void 0:be.connectionId)||"",_e=be?{...be,connectionId:Ye||be.connectionId,connectionType:be.connectionType||"",mode:be.mode||"database",selectedEntities:be.selectedEntities||[]}:Ye?{connectionId:Ye,connectionType:"",mode:"database",selectedEntities:[]}:ob,Ze=!(ve&&(!Xe||(Ve==null?void 0:Ve.provenance)==="card-config"||(Ve==null?void 0:Ve.provenance)==="query_spec")),Pe=Ze?Ukt(se):"",Je=Ze?$e:"",st={id:p.v4(),title:pe||"Title",preferences:{onClickFilter:[{columnIndex:0,expression:""}],chartOptions:{indexAxis:Le==="horizontalBar"?"y":"x"},...Xe&&{displayOptions:{showChrome:!1,allowScroll:!1}}},type:Le,sql:Pe,python:Je,dataSource:_e,config:Me,connectionId:Ye,visualizationMode:Oe,dynamicCardPreferences:Ve,customCardPreferences:ke?{url:ke.url,componentName:ke.componentName,pluginChartType:ke.pluginChartType,settings:ke.settings,type:"component"}:void 0},kt={id:p.v4(),cards:[st],activeCardId:st.id};try{await D(I,kt,"end"),E(!0),_(kt.id)}catch(yt){console.error("Failed to add assistant visual to dashboard:",yt),it.error(yt instanceof Error?yt.message:"Failed to prepare semantic metadata for the new visual")}}const oe=se=>{se.preventDefault();const pe=ne.trim();if(!pe&&$.length===0)return;const Fe=[];pe&&Fe.push({type:"text",text:pe}),$.forEach(Le=>{Le.data&&Fe.push({type:"file",mediaType:Le.type,filename:Le.name,url:`data:${Le.type};base64,${Le.data}`})}),R({role:"user",parts:Fe}),ae(""),P("dashboard"),H()};v.useEffect(()=>{var se;e&&((se=k.current)==null||se.focus())},[e]),Gbe({assistantType:"dashboard",status:G,isLoading:Z,sendMessage:R});const{hasActiveTools:le,activeToolText:fe}=Ybe(X);function he(se){const pe={role:"user",parts:[{type:"text",text:se.title+" "+se.subtitle}]};R(pe),H()}function Ce(se){R({role:"user",parts:[{type:"text",text:se}]}),H()}function xe(se){R({role:"user",parts:[{type:"text",text:se}]}),H()}const Se=v.useCallback(async()=>{const se=JSON.stringify(X??[],null,2);try{if(typeof navigator>"u"||!navigator.clipboard)throw new Error("Clipboard API unavailable");await navigator.clipboard.writeText(se),it.success("Conversation copied")}catch(pe){console.error("Failed to copy conversation",pe),it.error("Unable to copy conversation")}},[X]),de=(ne==null?void 0:ne.length)===0&&(X==null?void 0:X.filter(se=>se.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 J(){return l.jsxs(zo,{children:[l.jsx(Bo,{asChild:!0,children:l.jsx(Gc,{className:"h-7 p-2 text-muted-foreground hover:text-foreground",children:l.jsx(km,{className:"size-3.5"})})}),l.jsxs(Io,{align:"end",children:[l.jsx(La,{children:"Options"}),l.jsx(xa,{}),l.jsx(Wu,{checked:s,onCheckedChange:i,children:"Token Usage"}),l.jsx(Wu,{checked:a,onCheckedChange:c,children:"Tool Invocations"}),l.jsx(Wu,{checked:u,onCheckedChange:d,children:"System Message"}),(S||N)&&l.jsxs(l.Fragment,{children:[l.jsx(xa,{}),l.jsx(La,{children:"Dynamic Visuals"}),l.jsx(Wu,{checked:f==="auto",onCheckedChange:()=>h("auto"),children:"Auto"}),l.jsx(Wu,{checked:f==="force",onCheckedChange:()=>h("force"),children:"Force Dynamic"}),l.jsx(Wu,{checked:f==="off",onCheckedChange:()=>h("off"),children:"Disable Dynamic"})]})]})]})}const re=l.jsxs("div",{"data-role":"dashboard-assistant",className:p.cn("relative flex h-full grow flex-col break-words bg-background",C&&"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(),M&&l.jsxs("button",{type:"button",onClick:M,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:(U==null?void 0:U.name)||"Default profile"})]}),l.jsxs("div",{"data-role":"header-actions",className:"ml-auto flex items-center gap-0.5",children:[N&&J(),j&&l.jsx(p.Button,{variant:"ghost",size:"sm",className:"h-6 px-1.5 text-[11px] text-muted-foreground hover:text-foreground",onClick:Se,children:"Copy Conversation"}),l.jsx(Gc,{className:"grid h-6 w-6 place-items-center rounded-[4px] p-0 text-muted-foreground hover:bg-muted hover:text-foreground",tooltip:C?"Exit fullscreen":"Expand",onClick:Q,children:C?l.jsx(At.Minimize2,{className:"h-3.5 w-3.5"}):l.jsx(At.Maximize2,{className:"h-3.5 w-3.5"})}),l.jsx(Gc,{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 se=X.filter(pe=>pe.role==="assistant").map(pe=>pe.id).filter(pe=>!!pe);Y([]),F("dashboard"),L(),A(se)},children:l.jsx(BO,{className:"h-3.5 w-3.5"})}),l.jsx(Gc,{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(je.X,{className:"h-3.5 w-3.5"})})]})]}),l.jsx(hxe,{messages:X,showTools:a,showSystemMessage:u,onAddToDashboard:ie,onQuickReply:xe,disableQuickReplies:Z,status:G,errorMessage:V,activeToolText:Z&&le?fe:void 0,className:p.cn(C?"px-6 py-5":"px-3 py-3"),rowContentClassName:p.cn(C&&"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:[!U&&de&&l.jsx(lge,{onClick:he,placeholders:Wkt}),de&&U&&l.jsx(Mbe,{seedQuestions:U.seedQuestions||[],handleSeedQuestionClick:Ce}),l.jsx(Kbe,{assistantType:"dashboard"}),l.jsx(J4,{ref:k,setInput:ae,stop:z,input:ne,handleInputChange:ce,handleSubmit:se=>{oe(se)},isLoading:Z,status:G,assistantType:"dashboard",onFocus:()=>{}})]}),l.jsx(Q4,{incomingSelectedEntities:q,open:m,onOpenChange:g,dataSource:B||ob,dialogMode:"aiContext",saveAsDashboardDefault:!0,onSaveSelectedEntities:se=>W()})]});return C&&o?pr.createPortal(l.jsx(Wb,{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:re})}),o):re}function Gkt(e){const t=e.current,{getSelectedFrame:n,setSelectedFrameId:r}=p.useDashboardActions(),o=Lue(),s=p.useDashboardStore(d=>d.dashboard.sheets),a=p.useDashboardStore(d=>d.selectedSheetId)??(s==null?void 0:s[0].id),c=p.useDashboardStore(d=>d.isDashboardEditing),u=p.useDashboardStore(d=>d.isVisualEditing);v.useEffect(()=>{if(!c||u)return;async function d(m){if(Ykt(m.target))return;const g=m.ctrlKey||m.metaKey;g&&m.key==="c"?(await f(),it.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=Zkt(m);if(g!=null&&g.id){const b=Pue(g),x=b.cards.findIndex(y=>y.id===b.activeCardId);x!==-1&&(b.cards[x].title=`${b.cards[x].title} (Copy)`),await o(a,b),r(b.id),it.success("Card pasted from clipboard")}return m}catch(m){return console.error("Failed to paste text:",m),null}}return t==null||t.addEventListener("keydown",d),()=>t==null?void 0:t.removeEventListener("keydown",d)},[o,n,r,a,c,u,t])}function Ykt(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 Zkt(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 Xkt(e,t){switch(e.interactionMode){case"drillToDetail":Qkt(e,t);break;case"drillThrough":Jkt(e,t);break;case"drillToURL":eIt(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 Qkt(e,t){var c;const{targetInsightId:n,contextMode:r,displayMode:o,filterGroups:s}=e;if(!n){console.warn("drillToDetail event missing targetInsightId");return}const i=r||"full";let a=[];switch(i){case"interactionFilters":a=s.flatMap(u=>u.filters);break;case"full":{const u=((c=t.getCurrentFilters)==null?void 0:c.call(t))||[],d=s.flatMap(f=>f.filters);a=[...u,...d];break}case"none":default:a=[];break}o==="replace-card"?t.replaceCardContent({cardId:e.sourceCardId,insightId:n,filters:a,contextMode:r}):t.openInsightModal({insightId:n,filters:a,contextMode:r})}function Jkt(e,t){var u,d;const{targetDashboardId:n,contextMode:r="interactionFilters",filterGroups:o,sourceCardId:s}=e;if(!n){console.warn("[DrillThrough] Event missing targetDashboardId. This interaction needs to be reconfigured with a target dashboard.",e);return}const i=o.flatMap(f=>f.filters),a=((u=t.getCurrentDashboardId)==null?void 0:u.call(t))||"",c=(d=t.getCurrentDashboardTitle)==null?void 0:d.call(t);t.setGlobalDrillContext&&t.setGlobalDrillContext({filters:i,contextMode:r,sourceDashboardId:a,sourceDashboardTitle:c,targetDashboardId:n}),t.setPendingDrillThrough&&t.setPendingDrillThrough({targetDashboardId:n,sourceDashboardId:a,sourceDashboardTitle:c,filters:i,contextMode:r})}function eIt(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 tIt({open:e,onOpenChange:t,insightId:n,filters:r,filterDefinitions:o,contextMode:s,cardTitle:i,cardDescription:a}){return l.jsx(_o,{open:e,onOpenChange:t,children:l.jsxs(mo,{className:"flex max-h-[90vh] max-w-[90vw] flex-col gap-0 overflow-hidden p-0",children:[l.jsxs(Is,{className:"space-y-1 border-b border-border px-5 pb-3.5 pt-4 text-left",children:[l.jsx(po,{className:"text-[15px] font-semibold tracking-tight",children:i||"Insight detail"}),l.jsx(To,{className:"text-[12px] leading-[1.5] text-muted-foreground",children:a||"View detailed insight data with applied filters"})]}),l.jsx(Hue,{filters:r,filterDefinitions:o,contextMode:s}),l.jsx("div",{className:"h-[400px] min-h-0 flex-1 overflow-auto px-5 py-4",children:n?l.jsx(Qfe,{insightId:n,filters:r,contextMode:s}):l.jsx("div",{className:"flex items-center justify-center p-12 text-[13px] text-muted-foreground",children:"No insight selected"})})]})})}function nIt(){const e=p.useInteractionStore(S=>S.interactionStates),t=p.useInteractionStore(S=>S.setInteractionState),n=p.useInteractionStore(S=>S.clearLastInteractionEvent),r=p.useInteractionStore(S=>S.replaceCardWithInsight),o=p.useInteractionStore(S=>S.setPendingDrillThrough),s=p.useInteractionStore(S=>S.pendingDrillThrough),i=p.useInteractionStore(S=>S.clearPendingDrillThrough),{setSelectedSheetId:a,navigateWithDrill:c}=p.useDashboardActions(),{selectDashboard:u}=Nm(),d=p.useDashboardStore(S=>S.dashboard),f=p.useDashboardStore(S=>S.filterValues),{data:h,isLoading:m}=ZX((s==null?void 0:s.targetDashboardId)||"",{enabled:!!(s!=null&&s.targetDashboardId)}),[g,b]=v.useState({open:!1,insightId:""}),x=Jfe(g.insightId,{enabled:g.open&&!!g.insightId}),y=v.useRef(new Set),w=v.useMemo(()=>({setSelectedSheetId:a,openInsightModal:({insightId:S,filters:N,contextMode:j})=>{b({open:!0,insightId:S,filters:N,filterDefinitions:(d==null?void 0:d.filters)||[],contextMode:j})},replaceCardContent:({cardId:S,insightId:N,filters:j,contextMode:k})=>{r(S,N,j,k)},getCurrentFilters:()=>f||[],navigateWithDrill:c,getCurrentDashboardId:()=>(d==null?void 0:d.id)||"",getCurrentDashboardTitle:()=>d==null?void 0:d.title,setPendingDrillThrough:o,setGlobalDrillContext:({filters:S,contextMode:N,sourceDashboardId:j,sourceDashboardTitle:k,targetDashboardId:I})=>{const T={filters:S},_={sourceCardId:p.DRILL_CONTEXT_CARD_ID,interactionMode:"clickFilter",filterGroups:[T]},E={...p.createInitialInteractionState(),appliedClickFilters:[_],contextMode:N,sourceDashboardId:j,sourceDashboardTitle:k,targetDashboardId:I};t(p.DRILL_CONTEXT_CARD_ID,E)}}),[a,r,f,c,d,o,t]);v.useEffect(()=>{Object.entries(e).forEach(([S,N])=>{if(N!=null&&N.lastInteractionEvent){const j=N.lastInteractionEvent,k=`${S}-${j.interactionMode}-${j.sourceCardId}-${Date.now()}`;if(y.current.has(k))return;y.current.add(k);try{Xkt(j,w)}catch(I){console.error("Error executing interaction event:",I)}finally{n(S),setTimeout(()=>{y.current.delete(k)},5e3)}}})},[e,n,w]),v.useEffect(()=>{if(!(!s||!h||m))try{u(h),c(s.targetDashboardId,s.sourceDashboardId,s.sourceDashboardTitle,s.filters,s.contextMode),i()}catch(S){console.error("[DrillThrough] Error during automatic navigation:",S),i()}},[s,h,m,u,c,i]);const C=()=>{b({open:!1,insightId:""})};return l.jsxs(l.Fragment,{children:[l.jsx(tIt,{open:g.open,onOpenChange:C,insightId:g.insightId,filters:g.filters,filterDefinitions:g.filterDefinitions,contextMode:g.contextMode,cardTitle:x.title,cardDescription:x.description}),s&&m&&l.jsx("div",{className:"fixed inset-0 z-[51] flex items-center justify-center bg-background/80 backdrop-blur-sm",children:l.jsxs("div",{className:"flex flex-col items-center gap-2.5 rounded-[6px] border border-border/60 bg-background px-4 py-3 shadow-sm",children:[l.jsx(p.LoaderCircle,{className:"h-5 w-5 animate-spin text-muted-foreground/60"}),l.jsx("div",{className:"text-[12px] text-muted-foreground",children:"Loading dashboard..."})]})})]})}function rIt(e){return e.length===0?"":e.map(t=>{const n=t.field.label||t.field.name,r=t.operator,o=oIt(dz(t));return r==="="?`${n} = ${o}`:`${n} ${r} ${o}`}).join(", ")}function oIt(e){return e==null?"null":Array.isArray(e)?e.join(", "):typeof e=="object"&&e.toString?e.toString():String(e)}function sIt(e){return e?`Back to ${e}`:"Back"}function iIt(){var y,w,C,S,N;const e=p.useInteractionStore(j=>j.interactionStates[p.DRILL_CONTEXT_CARD_ID]),t=p.useDashboardStore(j=>j.actions.goBackFromDrill),n=p.useDashboardStore(j=>j.actions.clearDrillContext),{selectDashboard:r}=Nm(),[o,s]=v.useState({x:16,y:16}),[i,a]=v.useState(!1),c=v.useRef({x:0,y:0});v.useEffect(()=>{if(!i)return;const j=I=>{s({x:I.clientX-c.current.x,y:I.clientY-c.current.y})},k=()=>{a(!1)};return document.addEventListener("mousemove",j),document.addEventListener("mouseup",k),()=>{document.removeEventListener("mousemove",j),document.removeEventListener("mouseup",k)}},[i]);const u=e==null?void 0:e.sourceDashboardId,d=e==null?void 0:e.sourceDashboardTitle,f=((S=(C=(w=(y=e==null?void 0:e.appliedClickFilters)==null?void 0:y[0])==null?void 0:w.filterGroups)==null?void 0:C[0])==null?void 0:S.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(j){console.error("[DrillBack] Error during back navigation:",j)}},g=()=>{n()},b=j=>{j.target.closest("button")||(a(!0),c.current={x:j.clientX-o.x,y:j.clientY-o.y})};rIt(f);const x=sIt(d);return l.jsx("div",{className:"fixed z-50 max-w-md",style:{left:0,top:0,transform:`translate(${o.x}px, ${o.y}px)`,transition:i?"none":void 0},children:l.jsxs("div",{className:"select-none rounded-lg border bg-background/95 p-3 shadow-lg backdrop-blur-sm",onMouseDown:b,style:{cursor:i?"grabbing":"grab"},children:[l.jsxs("div",{className:"mb-3 flex items-start justify-between gap-2",children:[l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Viewing:"}),l.jsx("div",{className:"flex flex-wrap gap-2",children:f.map((j,k)=>{const I=j.field.label||j.field.name,T=String(j.value);return l.jsxs(fi,{variant:"secondary",className:"pointer-events-none text-xs",children:[I," = ",T]},k)})})]}),l.jsx(p.Button,{variant:"ghost",size:"sm",onClick:g,className:"h-6 w-6 cursor-pointer p-0",title:"Clear drill context",children:l.jsx(je.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(Wv,{className:"mr-2 h-4 w-4"}),x]})})]})})}function aIt(e,t){return typeof e=="boolean"?e:typeof t=="boolean"?t:!1}function lIt({filter:e,isEditing:t=!1,disabled:n=!1,storageOptions:r,settingsVariant:o,filterQueryContext:s,inputVariableName:i,reservedInputVariableNames:a,onUpdateFilter:c,onRemoveFilter:u}){const{attributes:d,listeners:f,setNodeRef:h,transform:m,transition:g,isDragging:b}=ex({id:`filter:${e.id}`,disabled:n||!t}),x={transform:qi.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(W$,{filter:e,isEditing:t,dragListeners:t?f:void 0,storageOptions:r,settingsVariant:o,filterQueryContext:s,inputVariableName:i,reservedInputVariableNames:a,onUpdateFilter:c,onRemoveFilter:u})})}const HG="text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",cIt=[];function mxe({open:e,onOpenChange:t}){const[n,r]=v.useState(!1),[o,s]=v.useState(!1),[i,a]=v.useState({sheetSelection:"current",protectPdf:!1,password:""}),c=p.useDashboardStore(Y=>{var G;return(G=Y.dashboard)==null?void 0:G.sheets}),u=p.useDashboardStore(Y=>Y.dashboard),d=p.useDashboardStore(Y=>Y.dashboardInputValues),f=p.useDashboardStore(Y=>Y.filterValues),h=p.useDashboardStore(Y=>Y.controlValues),m=p.useDashboardStore(Y=>Y.inlineFilterValuesMap),g=p.useDashboardStore(Y=>Y.cardControlValuesMap),b=p.useDashboardStore(Y=>Y.selectedSheetId),x=p.useDashboardStore(Y=>Y.selectedSheetId?Y.documentInputRuntimeBySheetId[Y.selectedSheetId]:void 0),y=p.useDashboardStore(Y=>Y.isDownloadingPdf),w=p.useDashboardStore(Y=>Y.reportContext),{authToken:C,tokenProps:S}=Tt(),N=c==null?void 0:c.find(Y=>Y.id===b),j=v.useMemo(()=>p.getDashboardExportSheets(c),[c]),k=p.isDocumentSheet(N),I=k&&N?N.document:void 0,T=v.useMemo(()=>k&&N?nx(u,N.id):[],[N,k,u]),_=T.length>0,E=v.useMemo(()=>k&&N?Ope(u,N.id):!1,[N,k,u]),D=v.useMemo(()=>_?T.map(yC):(I==null?void 0:I.inputs)||cIt,[I,T,_]),A=w==null?void 0:w.calendar.tz,F=v.useMemo(()=>Pme(D),[D]),P=v.useMemo(()=>Rme(D,A),[D,A]),O=v.useMemo(()=>Ame(D),[D]),$=x?x.filterValuesByInputId:P,B=x?x.controlValuesByInputId:O,U=v.useMemo(()=>k?E&&N&&I?tZ({dashboard:u,sheetId:N.id,sheetKind:"document",sectionIds:I.sections.map(Y=>Y.id),mode:"document",runtimeValues:{dashboardInputValues:d,filterValues:f,controlValues:h,inlineFilterValuesMap:m,cardControlValuesMap:g},timezone:A}):Lme(D,$,B,F,F):[],[I,D,N,k,u,g,h,f,m,d,B,$,F,A,E]),M=!!N,q=j.length>0,W=((c==null?void 0:c.length)||0)>1||k,R=i.sheetSelection==="current"&&(!M||k&&U.length>0)||i.sheetSelection==="all"&&!q;v.useEffect(()=>{e&&i.sheetSelection==="all"&&!q&&a(Y=>({...Y,sheetSelection:"current"}))},[q,e,i.sheetSelection]);const Z=()=>{a({sheetSelection:"current",protectPdf:!1,password:""}),r(!1),t(!1)};async function X(){if(y){it.error("A PDF export is already in progress");return}if(i.protectPdf&&!i.password){it.error("Please enter a password to protect the PDF");return}if(i.sheetSelection==="current"&&!M){it.error("No sheet is selected to export");return}if(i.sheetSelection==="all"&&!q){it.error("No dashboard sheets are available to export");return}s(!0);const Y=i.sheetSelection==="current"&&k,G=Y?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",z=it.loading(G);try{if(Y){if(!I||!N)throw new Error("Selected document sheet is missing document data");if(U.length>0){it.dismiss(z),it.error(`Set ${U.join(", ")} before exporting`);return}const L=new Date().toISOString(),H=E?nZ({dashboard:u,sheetId:N.id,sheetKind:"document",sectionIds:I.sections.map(K=>K.id),mode:"document",runtimeValues:{dashboardInputValues:d,filterValues:f,controlValues:h,inlineFilterValuesMap:m,cardControlValuesMap:g},generatedAt:L,timezone:A}).snapshot:void 0;await mL(S.apiServiceUrl,C,{sheetId:N.id,title:N.title||"Document",pageSize:I.page.size,orientation:I.page.orientation,timezone:A,password:i.protectPdf?i.password:void 0,inputSnapshot:H,...H?{}:{inputValues:{sheetId:N.id,filterValuesByInputId:$,controlValuesByInputId:B,generatedAt:L}}})}else{const L=hoe();await ote(S.apiServiceUrl,C,i.protectPdf?i.password:void 0,i.sheetSelection,L)}it.dismiss(z);const V=Y?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!";it.success(V,{duration:2e3}),Z()}catch(V){it.dismiss(z),it.error("Failed to download PDF",{description:OI(V,"Please try again or contact support."),descriptionClassName:FI,closeButton:!0,duration:1/0,richColors:!0}),console.error("PDF download error:",V)}finally{s(!1)}}return l.jsx(_o,{open:e,onOpenChange:Y=>{if(!Y){Z();return}t(!0)},children:l.jsxs(mo,{className:"rounded-control border-border/60 sm:max-w-[440px] sm:rounded-control",children:[l.jsxs(Is,{children:[l.jsx(po,{className:"text-[15px]",children:k?"Export document":"Export dashboard"}),l.jsx(To,{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:[W&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(p.Label,{className:HG,children:"Export scope"}),l.jsxs(Xa,{value:i.sheetSelection,onValueChange:Y=>a({...i,sheetSelection:Y}),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",!M&&"cursor-not-allowed opacity-50 hover:bg-transparent"),children:[l.jsx(ys,{value:"current",id:"scope-current",disabled:!M}),k?"This document":"This sheet"," (",(N==null?void 0:N.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",!q&&"cursor-not-allowed opacity-50 hover:bg-transparent"),children:[l.jsx(ys,{value:"all",id:"scope-all",disabled:!q}),"Dashboard sheets (",j.length," ",j.length===1?"sheet":"sheets",")"]})]}),k&&l.jsx("p",{className:"text-[12px] leading-5 text-muted-foreground",children:U.length>0?`Set ${U.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(In,{id:"protect-pdf",checked:i.protectPdf,onCheckedChange:Y=>{a({...i,protectPdf:Y,password:Y?i.password:""}),Y||r(!1)}}),l.jsx(Gv,{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:HG,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:Y=>a({...i,password:Y.target.value}),placeholder:"Enter password",className:"pr-8",onKeyDown:Y=>{Y.key==="Enter"&&i.password&&X()}}),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(qk,{className:"h-3.5 w-3.5"}):l.jsx(At.Eye,{className:"h-3.5 w-3.5"})})]}),l.jsx("p",{className:"text-[12px] text-muted-foreground",children:"Recipients will need this password to open the PDF."})]})]})]}),l.jsxs(Ya,{children:[l.jsx(p.Button,{variant:"outline",size:"xs",onClick:Z,disabled:o,children:"Cancel"}),l.jsx(p.Button,{size:"xs",onClick:X,disabled:o||y||R,children:o?l.jsxs(l.Fragment,{children:[l.jsx(p.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Exporting…"]}):l.jsxs(l.Fragment,{children:[l.jsx(gu,{className:"h-3.5 w-3.5"}),"Export"]})})]})]})})}function pxe({iconClassName:e,open:t,onOpenChange:n}){const[r,o]=v.useState(!1),s=t!==void 0,i=s?t:r,a=u=>{s||o(u),n==null||n(u)},c=p.useDashboardStore(u=>u.isDownloadingPdf);return l.jsxs(l.Fragment,{children:[s?null:l.jsx(p.Button,{variant:"ghost",size:"sm",className:"h-7 p-2",disabled:c,onClick:()=>a(!0),children:l.jsx(gu,{className:p.cn("size-4",e)})}),l.jsx(mxe,{open:i,onOpenChange:a})]})}function qG(e,t,n){const r=new Set(t),o=[...n];return e.map(s=>r.has(s.id)?o.shift()??s.id:s.id)}function uIt({control:e,value:t,isEditing:n=!1,onChange:r}){const{attributes:o,listeners:s,setNodeRef:i,transform:a,transition:c,isDragging:u}=ex({id:`control:${e.id}`,disabled:!n}),d={transform:qi.Translate.toString(a),transition:c,opacity:u?.5:1,zIndex:u?10:void 0};return l.jsx("div",{ref:i,style:d,...o,children:l.jsx(tpe,{control:e,value:t,isEditing:n,dragListeners:n?s:void 0,onChange:r})})}function UG(e){var t;return(((t=e.values)==null?void 0:t.length)??0)>0||e.operation==="is null"||e.operation==="is not null"}function WG(e,t){return[...e.map(n=>`filter:${n.id}`),...t.map(n=>`control:${n.id}`)]}function dIt(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 WG(t,n);const o=e.filter(a=>r.has(a)),s=new Set(o),i=WG(t,n).filter(a=>!s.has(a));return[...o,...i]}function fIt(e,t){return p.getDashboardCardEntries({sheets:e.sheets||[]}).filter(n=>n.sheet.id===t).map(n=>n.card.id)}function hIt(e){return Uh(e.dashboardInput,{sheetId:e.selectedSheetId,sheetKind:"dashboard"})?!0:e.dashboardInput.scope.kind!=="cards"?!1:e.selectedSheetCardIds.some(t=>Uh(e.dashboardInput,{sheetId:e.selectedSheetId,cardId:t,sheetKind:"dashboard"}))}function X2(e){var t;return((t=e.compatibility)==null?void 0:t.source)!=="dashboardFilter"}function mIt(e){return gxe(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 gxe(e){if(!e.selectedSheetId)return[];const t=e.selectedSheetId,n=fIt(e.dashboard,t);return Hk(ib({dashboard:e.dashboard}).allInputs).filter(r=>!(r.kind!=="filter"||!hIt({dashboardInput:r,selectedSheetId:t,selectedSheetCardIds:n})))}function pIt(e,t){return"toolbar"}function gIt(){const e=oc("interactive"),t=p.useDashboardStore(V=>V.selectedSheetId),n=p.useDashboardStore(V=>V.dashboard.filters),r=p.useDashboardStore(V=>V.dashboard.filterLayout),o=p.useDashboardStore(V=>V.isDashboardEditing),s=p.useDashboardStore(V=>V.controlValues),i=p.useDashboardStore(V=>V.filterValues);p.useDashboardStore(V=>V.filteringCards);const a=p.useDashboardStore(V=>V.inlineFilterValuesMap),c=p.useDashboardStore(V=>V.dashboardInputValues),u=p.useInteractionStore(V=>V.clearAllClickFilters),d=p.useInteractionStore(V=>Object.entries(V.interactionStates).reduce((L,[H,K])=>{var Q;return H===p.DRILL_CONTEXT_CARD_ID?L:L+(((Q=K.appliedClickFilters)==null?void 0:Q.length)??0)},0)),f=p.useDashboardStore(V=>V.actions.removeCardInlineFilterValue),{reorderFilters:h,clearDashboardInputSlot:m,reorderDashboardControls:g,removeDashboardInput:b,setControlValue:x,setFilterLayout:y,setFilterValues:w,setFilteringCards:C,upsertDashboardInput:S}=p.useDashboardActions(),N=gT(tb(Qb,{activationConstraint:{distance:5}})),j=p.useDashboardStore(V=>V.dashboard),k=mIt({dashboard:j,selectedSheetId:t}).filter(V=>pIt(V.filter)==="toolbar"),I=gxe({dashboard:j,selectedSheetId:t}),T=k.map(V=>V.filter),_=new Map(k.map(V=>[`filter:${V.filter.id}`,V])),E=btt(j),D=E.filter(V=>!V.hidden&&av(V)==="toolbar"),A=E.filter(V=>!V.hidden&&av(V)==="advanced"),F=dIt(r==null?void 0:r.toolbarItemOrder,T,D),P=new Map(T.map(V=>[`filter:${V.id}`,V])),O=new Map(D.map(V=>[`control:${V.id}`,V]));function $(V){const{active:L,over:H}=V;if(!H||L.id===H.id)return;const K=String(L.id),Q=String(H.id),ne=F.findIndex(Ce=>Ce===K),ae=F.findIndex(Ce=>Ce===Q);if(ne===-1||ae===-1)return;const ce=Jb(F,ne,ae);y({toolbarItemOrder:ce});const ie=new Set((n||[]).map(Ce=>Ce.id)),oe=F.filter(Ce=>Ce.startsWith("filter:")).map(Ce=>Ce.replace("filter:","")).filter(Ce=>ie.has(Ce)),le=ce.filter(Ce=>Ce.startsWith("filter:")).map(Ce=>Ce.replace("filter:","")).filter(Ce=>ie.has(Ce)),fe=F.filter(Ce=>Ce.startsWith("control:")).map(Ce=>Ce.replace("control:","")),he=ce.filter(Ce=>Ce.startsWith("control:")).map(Ce=>Ce.replace("control:",""));h(qG(n||[],oe,le)),g(qG(j.controls||[],fe,he))}const B=(r==null?void 0:r.toolbarWrap)??!1,U=(r==null?void 0:r.showDownloadButton)??!1,M=I.filter(X2),q=I.filter(V=>{if(X2(V))return!1;const L=p.getDashboardInputRuntimeSlot(c,V,{sheetId:t});return(L==null?void 0:L.status)==="set"||(L==null?void 0:L.status)==="cleared"}),W=new Set([...M,...q].map(V=>V.filter.id)),R=(i==null?void 0:i.filter(V=>!W.has(V.filterId)&&UG(V)).length)??0,Z=[...M,...q],X=Z.filter(V=>{const L=p.hydrateAuthoredDashboardInputSlot({dashboard:j,input:V,runtimeValues:c,target:{sheetId:t}});return(L==null?void 0:L.status)==="set"&&L.value.kind==="filter"&&UG(L.value.filterValue)}).length,Y=a?Object.values(a).reduce((V,L)=>V+((L==null?void 0:L.length)??0),0):0,G=R+X+Y+d,z=()=>{w([]),Z.forEach(V=>{m(V,{sheetId:t})}),C([]),u(),a&&Object.entries(a).forEach(([V,L])=>{L==null||L.forEach(H=>{f(V,H.filterId)})})};return!T.length&&!D.length&&!A.length&&!U&&G===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(hC,{sensors:N,collisionDetection:uC,onDragEnd:$,children:l.jsxs("div",{className:p.cn("flex items-center",B?"flex-wrap":"w-0 min-w-full overflow-x-auto"),children:[l.jsx(mC,{items:F,strategy:Gz,children:l.jsx(BF,{className:"gap-3 pr-0",wrap:B,children:F.map(V=>{const L=P.get(V);if(L){const K=_.get(V),Q=K&&X2(K);return l.jsx(lIt,{filter:L,isEditing:o,storageOptions:Q?{storageTarget:"dashboardInput",dashboardInput:K,sheetId:t??void 0}:void 0,inputVariableName:Q?K.variableName:void 0,onUpdateFilter:Q?(ne,ae)=>{S({...K,variableName:(ae==null?void 0:ae.variableName)||K.variableName,filter:ne})}:void 0,onRemoveFilter:Q?()=>{w((i||[]).filter(ne=>ne.filterId!==L.id)),b(K.id)}:void 0},V)}const H=O.get(V);return H?l.jsx(uIt,{control:H,value:s==null?void 0:s[H.id],isEditing:o,onChange:K=>x(H.id,K)},V):null})})}),A.length>0&&l.jsx(Xue,{title:"",controls:A,values:s,onChange:(V,L)=>x(V.id,L),immediatePlacement:"toolbar",advancedLabel:"More controls"}),G>0&&l.jsxs("button",{type:"button",onClick:z,"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(je.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:G})]}),U&&l.jsx("div",{className:p.cn(G>0?"ml-1.5":"ml-auto"),children:l.jsx(pxe,{})})]})})})}function bxe(){var xe,Se;const{showAssistant:e,tokenProps:t,renderMode:n}=Tt(),r=aIt((xe=t.config)==null?void 0:xe.showDashboardAssistant,e),{preferences:o}=Dm(),s=(Se=o==null?void 0:o.cardDisplay)==null?void 0:Se.mode,i=rf(s),a=see({displayMode:s,renderMode:n}),c=v.useRef(null),u=v.useRef(null),[d,f]=v.useState(!1),{handleDragStart:h,isDraggingRef:m,getStyle:g,getPositionClasses:b}=z0t({initialPosition:"bottom-right"}),x=Ch(de=>de.setFullscreen),y=Ch(de=>de.setPanelOpen),w=Ch(de=>de.setContainer),C=JQ("dashboard"),S=eJ(),N=tJ("dashboard"),j=C.isOpen,k=S==="dashboard",I=p.useDashboardStore(de=>de.isVisualEditing),T=p.useDashboardStore(de=>de.themeStyle),_=ku(),E=p.useDashboardStore(de=>{var ee;return(ee=de.dashboard)==null?void 0:ee.sheets}),D=p.useDashboardStore(de=>de.showFilters),A=p.useDashboardStore(de=>de.isDashboardEditing),F=p.useDashboardStore(de=>de.selectedSheetId),P=E==null?void 0:E.find(de=>de.id===F),O=p.useDashboardStore(de=>{var ee,J,re;return(re=(J=(ee=de.dashboard)==null?void 0:ee.sheets)==null?void 0:J.find(se=>se.id===de.selectedSheetId))==null?void 0:re.kind}),$=p.useDashboardStore(de=>{var ee,J;return((J=(ee=de.dashboard)==null?void 0:ee.summary)==null?void 0:J.position)||"top"}),B=O==="document",U=p.useDashboardStore(de=>{var ee;return(ee=de.dashboard)==null?void 0:ee.id}),{getDefaultSheetId:M,setDefaultSheetId:q,clearDefaultSheetId:W}=RY(U),[R,Z]=v.useState(null),{setSelectedSheetId:X,setSheetTitle:Y,addSheet:G,setSheets:z}=p.useDashboardActions();Gkt(u);const{setActiveAssistantType:V}=p.useAIActions();v.useEffect(()=>{if(U){const de=M();Z(de)}},[U,M]),v.useEffect(()=>{j?V("dashboard"):S==="dashboard"&&x(null)},[j,V,S,x]),v.useEffect(()=>{var de;j||(de=c.current)==null||de.resize(0)},[j]);function L(de){var ee,J;de?((ee=c.current)==null||ee.resize(40),y("dashboard",!0),x("dashboard"),V("dashboard")):(y("dashboard",!1),x(null),(J=c.current)==null||J.resize(0),V(null))}function H(de="dashboard"){const ee={id:p.v4(),title:de==="document"?"New Document":"New Sheet",...de==="document"?{kind:de,document:p.createDefaultDocumentDefinition()}:{}};G(ee),X(ee.id)}function K(de,ee){if(!U)return;R===de?(W(),Z(null),it.success("Default sheet cleared")):(q(de),Z(de),it.success(`"${ee}" set as default sheet`))}function Q(de){var ee;de<1?(y("dashboard",!1),x(null),V(null),(ee=c.current)==null||ee.resize(0)):(j||y("dashboard",!0),V("dashboard"))}function ne(){return(T==null?void 0:T.canvasTheme)==="muted"||!(T!=null&&T.canvasTheme)?"hsl(var(--semaphor-muted))":(T==null?void 0:T.canvasTheme)==="clear"?"":T==null?void 0:T.canvasTheme}const ae=(de,ee)=>{de.dataTransfer.setData("tabIndex",ee.toString())},ce=de=>{de.preventDefault()},ie=(de,ee)=>{const J=de.dataTransfer.getData("tabIndex");if(J===ee.toString())return;const re=Array.from(E||[]),[se]=re.splice(parseInt(J),1);re.splice(ee,0,se),z(re)},oe=r===!0&&!i&&!j&&!I&&!D;function le(){if(E&&E.length>1||A)return l.jsx("div",{className:"relative flex w-full items-stretch border-b border-border",children:l.jsxs("div",{className:"relative min-w-0 flex-1",children:[l.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-0 left-0 z-10 w-4 bg-gradient-to-r from-background to-transparent"}),l.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-0 right-0 z-10 w-4 bg-gradient-to-l from-background to-transparent"}),l.jsxs(p.TabsList,{role:"tab-list",className:"flex w-0 min-w-full items-stretch justify-start overflow-x-auto rounded-none bg-transparent p-0 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[E==null?void 0:E.map((de,ee)=>{const J=F===de.id,re=R===de.id;return l.jsxs(p.TabsTrigger,{draggable:!0,onDragStart:se=>ae(se,ee),onDragOver:ce,onDrop:se=>ie(se,ee),onClick:()=>X(de.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:de.id,children:[de.kind==="document"&&l.jsx(Gs,{className:"h-3 w-3 text-muted-foreground"}),l.jsx(Wj,{enabled:A&&J,text:de.title,onSave:se=>Y(de.id,se),children:de.title},de.id),l.jsx("span",{role:"button",tabIndex:0,"aria-label":re?"Clear default sheet":"Set as default sheet",title:re?"Clear default sheet":"Set as default sheet",onClick:se=>{se.stopPropagation(),K(de.id,de.title||"Sheet")},onKeyDown:se=>{(se.key==="Enter"||se.key===" ")&&(se.preventDefault(),se.stopPropagation(),K(de.id,de.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",J||re?"opacity-100":"opacity-0 group-hover:opacity-100"),children:l.jsx(BZ,{className:p.cn("h-3 w-3 transition-colors",re?"fill-current text-amber-500":"text-muted-foreground")})}),A&&J&&E.length>1&&l.jsx("span",{role:"button",tabIndex:0,"aria-label":"Delete sheet",className:"inline-flex h-4 w-4 shrink-0 cursor-pointer items-center justify-center rounded-[3px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus:outline-none focus-visible:ring-1 focus-visible:ring-foreground",onClick:se=>{se.stopPropagation(),f(!0)},onKeyDown:se=>{(se.key==="Enter"||se.key===" ")&&(se.preventDefault(),se.stopPropagation(),f(!0))},children:l.jsx(je.X,{className:"h-3 w-3"})})]},de.id)}),A&&l.jsxs(zo,{children:[l.jsx(Bo,{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(_r,{className:"h-3 w-3"}),"Sheet"]})}),l.jsxs(Io,{align:"start",className:"w-48",children:[l.jsxs(Sn,{onSelect:()=>H("dashboard"),children:[l.jsx(Kh,{className:"h-4 w-4 text-muted-foreground"}),"Dashboard sheet"]}),l.jsxs(Sn,{onSelect:()=>H("document"),children:[l.jsx(Gs,{className:"h-4 w-4 text-muted-foreground"}),"Document"]})]})]})]})]})})}function fe(){return l.jsx("div",{ref:u,style:{},className:"h-full min-h-0 grow",children:E==null?void 0:E.map(de=>l.jsx(p.TabsContent,{style:{backgroundColor:ne(),..._.dashboardCanvasStyle},className:p.cn("mt-0 h-full min-h-0",{}),value:de.id,children:l.jsx($K,{sheet:de})},de.id))})}function he(){return l.jsxs(p.Tabs,{"data-role":"dashboard-tabs-container",className:p.cn("relative flex h-full flex-col",T==null?void 0:T.dashboardTabsContainer),onValueChange:de=>{X(de)},value:F||void 0,children:[le(),$==="top"&&!B&&l.jsx(rF,{}),F&&!B&&l.jsx(gIt,{}),B?l.jsx("div",{"data-role":"dashboard-tabs-content",className:"min-h-0 flex-1 grow basis-0 overflow-hidden",children:fe()}):l.jsx(sl,{"data-role":"dashboard-tabs-content",className:"flex-1 grow basis-0 overflow-y-auto",children:fe()}),$==="bottom"&&!B&&l.jsx(rF,{}),l.jsx(B0t,{open:d,setOpen:f})]})}const Ce=v.useCallback(de=>{w("dashboard",de)},[w]);return E?a&&F&&!B?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&&B&&P?l.jsx("div",{"data-role":"dashboard-document-print-content",className:"min-h-0 overflow-visible bg-white",children:l.jsx($K,{sheet:P})}):l.jsxs(l.Fragment,{children:[l.jsx(nIt,{}),l.jsx(iIt,{}),l.jsxs("div",{className:"relative flex-1 basis-0 overflow-hidden",children:[l.jsxs(age,{className:p.cn("flex-1 basis-0 overflow-y-auto transition-opacity",k&&"pointer-events-none opacity-0"),direction:"horizontal",children:[l.jsx(WF,{children:he()}),r===!0&&l.jsxs(l.Fragment,{children:[l.jsx($0t,{open:j,onTabClick:L,withHandle:!0,disabled:!j}),l.jsx(WF,{className:"flex grow","data-role":"dashboard-assistant-panel",onResize:Q,defaultSize:j?40:0,ref:c,children:l.jsx("div",{className:"grow overflow-y-auto",children:l.jsx(Kkt,{open:j,setOpen:L,isFullscreen:k,onFullscreenChange:de=>x(de?"dashboard":null),fullscreenContainer:N})})})]})]}),l.jsx("div",{ref:Ce,className:p.cn("absolute inset-0",!k&&"pointer-events-none")}),oe&&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||L(!0)},onMouseDown:h,onTouchStart:h,title:"Open Assistant (drag to move)",children:l.jsx(Ove,{className:"h-5 w-5"})})})]})]}):null}const xxe=v.forwardRef(({appearance:e,organizationAppearance:t,tokenAppearance:n,reactAppearance:r,resolvedAppearance:o,children:s,className:i,style:a,...c},u)=>{const d=v.useId(),f=v.useMemo(()=>bIt(d),[d]),{theme:h}=hO(),m=xIt(h),g=v.useMemo(()=>o??mu.resolveAppearance({organizationAppearance:t,tokenAppearance:n,reactAppearance:r??e}),[e,t,r,o,n]),b=v.useMemo(()=>p.compileAppearance({spec:g,systemMode:m}),[g,m]),x=v.useMemo(()=>p.createAppearanceContextValue(f,b),[b,f]);return l.jsx(p.AppearanceContext.Provider,{value:x,children:l.jsx(Wb,{...c,ref:u,className:i,style:a,children:s})})});xxe.displayName="AppearanceProvider";function bIt(e){return`semaphor-appearance-${e.replace(/[^a-zA-Z0-9_-]/g,"")}`}function xIt(e){const t=xN(e),[n,r]=v.useState(()=>yIt());return v.useEffect(()=>{var i,a;if(t!=="system"||typeof window>"u")return;const o=(i=window.matchMedia)==null?void 0:i.call(window,"(prefers-color-scheme: dark)");if(!o)return;const s=()=>{r(o.matches?"dark":"light")};return s(),typeof o.addEventListener=="function"?(o.addEventListener("change",s),()=>o.removeEventListener("change",s)):((a=o.addListener)==null||a.call(o,s),()=>{var c;return(c=o.removeListener)==null?void 0:c.call(o,s)})},[t]),t==="system"?n:t}function yIt(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}const yxe=v.createContext({openBrandStudioPreview:()=>{}}),vIt=yxe.Provider;function wIt(){return v.useContext(yxe)}function CIt({children:e,defaultTheme:t="system",storageKey:n="vite-ui-theme",...r}){const o=xN(t),[s,i]=v.useState(()=>SIt(n)||o),a=v.useCallback(u=>{const d=xN(u);NIt(n,d),i(d)},[n]),c=v.useMemo(()=>({theme:s,setTheme:a}),[s,a]);return l.jsx(dY.Provider,{...r,value:c,children:e})}function SIt(e){if(typeof window>"u")return null;try{const t=window.localStorage.getItem(e);if(!t)return null;const n=xN(t,"system");return n===t?n:null}catch{return null}}function NIt(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(e,t)}catch{}}const jIt=v.lazy(()=>Promise.resolve().then(()=>require("../brand-studio/index.cjs")).then(e=>({default:e.BrandStudioEditor})));function nB({appearance:e,children:t}){var E,D;const{authToken:n,id:r,tokenProps:o}=Tt(),s=zv(),i=(E=s.data)==null?void 0:E.organizationAppearance,a=(D=o.config)==null?void 0:D.appearance,[c,u]=v.useState(!1),[d,f]=v.useState(null),[h,m]=v.useState(null),[g,b]=v.useState(null),[x,y]=v.useState(null),w=`${o.apiServiceUrl??""}:${(n==null?void 0:n.accessToken)??""}`,C=Vn({queryKey:UX({resourceType:io.DASHBOARD,apiServiceUrl:o.apiServiceUrl,accessToken:n==null?void 0:n.accessToken}),queryFn:async()=>p.getRequest(`${o.apiServiceUrl}/management/v1/dashboards`,(n==null?void 0:n.accessToken)||""),select:A=>(A==null?void 0:A.organizationAppearance)??null,enabled:!s.dashboardIdToFetch&&i===void 0&&!!(n!=null&&n.accessToken)});v.useEffect(()=>{i!==void 0&&y({scopeKey:w,appearance:i})},[i,w]),v.useEffect(()=>{C.data!==void 0&&y({scopeKey:w,appearance:C.data})},[C.data,w]);const S=(x==null?void 0:x.scopeKey)===w?x.appearance:null,N=i!==void 0?i:C.data!==void 0?C.data:S,j=v.useMemo(()=>mu.resolveAppearance({organizationAppearance:N,tokenAppearance:a,reactAppearance:e}),[e,N,a]),k=v.useCallback(()=>{f(g??h??j),u(!0)},[g,h,j]),I=v.useCallback(()=>{u(!1)},[]);v.useEffect(()=>{f(null),m(null),b(null),u(!1)},[r]);const T=v.useMemo(()=>({openBrandStudioPreview:k}),[k]),_=g??h??e;return l.jsx(CIt,{defaultTheme:"system",storageKey:"vite-ui-theme",children:l.jsx(vIt,{value:T,children:l.jsx(xxe,{organizationAppearance:N,tokenAppearance:a,reactAppearance:_,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(v.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(jIt,{appearance:d,onDraftChange:b,onSave:A=>{m(A),b(A),f(A)},onCancel:I})})})]})})})})}function vxe({children:e,preferences:t}){const{currentUser:n}=Xs(),r=v.useMemo(()=>{var o,s;return{preferences:t||{},isLocalDev:((o=t==null?void 0:t.uiMode)==null?void 0:o.developer)||!1,isConsoleMode:((s=t==null?void 0:t.uiMode)==null?void 0:s.console)||!1}},[t]);return l.jsx(VX.Provider,{value:r,children:l.jsx(tT,{displayPreferences:t==null?void 0:t.cardDisplay,currentUser:n,children:e})})}function kIt(e=2e3,t=500){const n=c0e(),[r,o]=v.useState(!1),[s,i]=v.useState(!1),a=v.useRef(null);return v.useEffect(()=>{const c=setTimeout(()=>o(!0),e);return()=>clearTimeout(c)},[e]),v.useEffect(()=>{if(r){if(n>0){i(!1),a.current&&(clearTimeout(a.current),a.current=null);return}return a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{i(!0)},t),()=>{a.current&&clearTimeout(a.current)}}},[r,n,t]),s}function rB({delayMs:e=2e3,quietMs:t=500,componentType:n,componentId:r}){const o=kIt(e,t);return v.useEffect(()=>(o&&(window.__SEMAPHOR_READY__={ready:!0,type:n,componentId:r||null,timestamp:Date.now()}),()=>{window.__SEMAPHOR_READY__={ready:!1,type:n,componentId:r||null,timestamp:Date.now()}}),[o,n,r]),l.jsx("div",{id:"idle-check","aria-hidden":"true",style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0},children:o?"ready":""})}function wxe(e){if(typeof window>"u")return null;const{preferences:t}=e;return l.jsx(Si,{FallbackComponent:J_,children:l.jsx(yO,{dashboardProps:e,children:l.jsxs(dT,{children:[l.jsx(rB,{componentType:"dashboard",componentId:e.id}),l.jsx(nB,{appearance:e.appearance,children:l.jsx(vxe,{preferences:t,children:l.jsx("main",{className:"flex h-full flex-col",children:l.jsx(c5,{...e,type:"dashboard",children:l.jsx(bxe,{})})})})})]})})})}function IIt(e=[]){const t=v.useRef(null),n=v.useRef(null),r=v.useRef(null),[o,s]=v.useState(),i=v.useCallback(()=>{var m,g,b;const a=((m=t.current)==null?void 0:m.clientWidth)??0,c=((g=r.current)==null?void 0:g.offsetWidth)??0,u=((b=n.current)==null?void 0:b.offsetWidth)??0,f=a-c-u-8,h=Math.max(f,0);s(x=>x===h?x:h)},[]);return v.useEffect(()=>{const a=t.current;if(!a||typeof ResizeObserver>"u")return;const c=new ResizeObserver(()=>i());return c.observe(a),i(),()=>c.disconnect()},[i,...e]),{headerRef:t,leftActionsRef:n,rightActionsRef:r,titleMaxWidth:o,updateAvailableWidth:i}}function _It({filter:e}){var g;const t=p.useDashboardStore(b=>b.isDashboardEditing),{preferences:n}=Dm(),r=rf((g=n==null?void 0:n.cardDisplay)==null?void 0:g.mode),o=p.useDashboardStore(b=>b.filterValues),s=o==null?void 0:o.some(b=>b.filterId===e.id),{removeFilterValues:i,removeFilter:a,updateFilter:c}=p.useDashboardActions(),{headerRef:u,leftActionsRef:d,rightActionsRef:f,titleMaxWidth:h,updateAvailableWidth:m}=IIt([t,s,r]);return v.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(gi,{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(U$,{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(je.X,{className:"size-3.5"})})]})]}),l.jsx("div",{className:"hidden",ref:f})]})}function TIt(){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(_It,{filter:r}),l.jsx(G_,{filter:r})]},r.id))}):null}function EIt(){var s;const e=p.useDashboardStore(i=>i.dashboard),t=p.useDashboardStore(i=>i.selectedSheetId),n=p.useDashboardStore(i=>i.isDashboardEditing),r=(s=e.sheets)==null?void 0:s.find(i=>i.id===t),o=p.isDocumentSheet(r);return l.jsx("div",{role:"dashboard-plus-main",className:"flex min-h-0 grow basis-0 overflow-hidden",children:l.jsxs("section",{className:"flex min-h-0 grow basis-0 flex-col overflow-hidden",children:[n&&!o&&l.jsx(TIt,{}),l.jsx(bxe,{})]})})}const DIt=v.lazy(()=>Promise.resolve().then(()=>require("./dashboard-controls-Cq1L0Iaq.cjs"))),MIt=v.lazy(()=>Promise.resolve().then(()=>require("./edit-dashboard-visual-DDg6-670.cjs"))),RIt=v.lazy(()=>Promise.resolve().then(()=>require("./dashboard-json-MQsd_x4u.cjs")));function AIt({showControls:e=!1,showFooter:t=!0,...n}){const r=p.useDashboardStore(a=>a.isVisualEditing),o=p.useDashboardStore(a=>a.showDashboardJSON),{appearance:s,preferences:i}=n;return l.jsx(Si,{FallbackComponent:J_,children:l.jsx(yO,{dashboardProps:n,children:l.jsxs(dT,{children:[l.jsx(rB,{componentType:"surfboard",componentId:n.id}),l.jsxs(nB,{appearance:s,children:[l.jsx(HCe,{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(vxe,{preferences:i,children:[o&&l.jsx(v.Suspense,{fallback:null,children:l.jsx(RIt,{})}),l.jsxs("main",{className:"relative flex h-full w-full flex-col overflow-hidden",children:[e&&l.jsx(v.Suspense,{fallback:null,children:l.jsx(DIt,{})}),l.jsx("div",{className:"flex grow overflow-hidden",children:l.jsx("div",{className:"flex min-w-0 flex-1",children:l.jsxs(c5,{...n,type:"dashboard",children:[r&&l.jsx(v.Suspense,{fallback:null,children:l.jsx(MIt,{})}),l.jsx(v.Activity,{mode:r?"hidden":"visible",children:l.jsx(EIt,{})})]})})})]})]})]})]})})})}const KG=[{value:"en-US",label:"English (United States)"},{value:"en-GB",label:"English (United Kingdom)"},{value:"de-DE",label:"German (Germany)"},{value:"fr-FR",label:"French (France)"},{value:"es-ES",label:"Spanish (Spain)"},{value:"it-IT",label:"Italian (Italy)"},{value:"nl-NL",label:"Dutch (Netherlands)"},{value:"pt-BR",label:"Portuguese (Brazil)"},{value:"ja-JP",label:"Japanese (Japan)"},{value:"en-IN",label:"English (India)"},{value:"en-NZ",label:"English (New Zealand)"},{value:"mi-NZ",label:"Māori (New Zealand)"}],Cxe=new Set(["USD","EUR","GBP","CAD","AUD","JPY","CHF","INR","BRL","KWD"]),PIt=su.getSupportedCurrencyCodes(),FIt=PIt.filter(e=>!Cxe.has(e));function GG(e){switch(e){case"viewer_tenant":return"tenant";case"viewer_organization":return"organization";case"session_initial":return"embedded";case"system_default":return"system";default:return"inherited"}}function OIt({value:e,inherited:t,inheritedSources:n,onChange:r,disabled:o}){const s=v.useId(),a=(e.locale===void 0?void 0:su.canonicalizeSupportedLocale(e.locale))??t.locale,c=e.defaultCurrency??t.defaultCurrency,u=new Intl.NumberFormat(a,{style:"currency",currency:c}).format(1e3);return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsx(p.Label,{htmlFor:s,className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Locale"}),l.jsxs(p.Select,{value:e.locale??"inherit",disabled:o,onValueChange:d=>r({...e,locale:d==="inherit"?void 0:d}),children:[l.jsx(p.SelectTrigger,{id:s,size:"xs",children:l.jsx(p.SelectValue,{})}),l.jsxs(p.SelectContent,{children:[l.jsxs(p.SelectItem,{value:"inherit",children:["Use ",GG(n.locale)," default —"," ",t.locale]}),e.locale&&!KG.some(d=>d.value===e.locale)&&l.jsx(p.SelectItem,{value:e.locale,children:e.locale}),KG.map(d=>l.jsxs(p.SelectItem,{value:d.value,children:[d.label," — ",d.value]},d.value))]})]})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx(p.Label,{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Default currency"}),l.jsxs(p.Select,{value:e.defaultCurrency??"inherit",disabled:o,onValueChange:d=>r({...e,defaultCurrency:d==="inherit"?void 0:d}),children:[l.jsx(p.SelectTrigger,{size:"xs",children:l.jsx(p.SelectValue,{})}),l.jsxs(p.SelectContent,{children:[l.jsxs(p.SelectItem,{value:"inherit",children:["Use ",GG(n.defaultCurrency)," default —"," ",t.defaultCurrency]}),[...Cxe].map(d=>l.jsx(p.SelectItem,{value:d,children:d},d)),FIt.map(d=>l.jsx(p.SelectItem,{value:d,children:d},d))]})]})]}),l.jsxs("div",{className:"rounded-control border border-border/60 bg-muted/30 px-3 py-2",children:[l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Preview"}),l.jsx("p",{className:"mt-1 text-[14px] font-medium text-foreground",children:u}),l.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Currency display only; values are not converted."})]})]})}const iO=new Set;function Sxe(e){return iO.add(e),()=>{iO.delete(e)}}function oB(){iO.forEach(e=>{e()})}var LIt=Object.defineProperty,$It=(e,t,n)=>t in e?LIt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,v1=(e,t,n)=>$It(e,typeof t!="symbol"?t+"":t,n);const zIt={stringify:e=>e?"true":"false",parse:e=>/^[ty1-9]/i.test(e)},BIt={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}},VIt={stringify:e=>JSON.stringify(e),parse:e=>JSON.parse(e)};function HIt(e){return e.replace(/([a-z0-9])([A-Z])/g,(t,n,r)=>`${n}-${r.toLowerCase()}`)}function Nxe(e){return e.replace(/[-:]([a-z])/g,(t,n)=>`${n.toUpperCase()}`)}const qIt={stringify:e=>e.name,parse:(e,t,n)=>{const r=(()=>{const o=Nxe(t);if(typeof n<"u"&&o in n.container)return n.container[o]})();return typeof r=="function"?r.bind(n):void 0}},UIt={stringify:e=>`${e}`,parse:e=>parseFloat(e)},WIt={stringify:e=>e,parse:e=>e},Q2={string:WIt,number:UIt,boolean:zIt,function:BIt,method:qIt,json:VIt},Xx=Symbol.for("r2wc.render"),w1=Symbol.for("r2wc.connected"),Af=Symbol.for("r2wc.context"),Ii=Symbol.for("r2wc.props");function KIt(e,t,n){var r,o,s;t.props||(t.props=e.propTypes?Object.keys(e.propTypes):[]),t.events||(t.events=[]);const i=Array.isArray(t.props)?t.props.slice():Object.keys(t.props),a=Array.isArray(t.events)?t.events.slice():Object.keys(t.events),c={},u={},d={},f={};for(const m of i){c[m]=Array.isArray(t.props)?"string":t.props[m];const g=HIt(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(),v1(this,s,!0),v1(this,o),v1(this,r,{}),v1(this,"container"),t.shadow?this.container=this.attachShadow({mode:t.shadow}):this.container=this,this[Ii].container=this.container;for(const g of i){const b=d[g],x=this.getAttribute(b),y=c[g],w=y?Q2[y]:null;if(y==="method"){const C=Nxe(b);Object.defineProperty(this[Ii].container,C,{enumerable:!0,configurable:!0,get(){return this[Ii][C]},set(S){this[Ii][C]=S,this[Xx]()}}),this[Ii][g]=w.parse(x,b,this)}w!=null&&w.parse&&x&&(this[Ii][g]=w.parse(x,b,this))}for(const g of a)this[Ii][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[w1]=!0,this[Xx]()}disconnectedCallback(){this[w1]=!1,this[Af]&&n.unmount(this[Af]),delete this[Af]}attributeChangedCallback(g,b,x){const y=f[g],w=c[y],C=w?Q2[w]:null;y in c&&C!=null&&C.parse&&x&&(this[Ii][y]=C.parse(x,g,this),this[Xx]())}[(s=w1,o=Af,r=Ii,Xx)](){this[w1]&&(this[Af]?n.update(this[Af],this[Ii]):this[Af]=n.mount(this.container,e,this[Ii]))}}for(const m of i){const g=d[m],b=c[m];Object.defineProperty(h.prototype,m,{enumerable:!0,configurable:!0,get(){return this[Ii][m]},set(x){this[Ii][m]=x;const y=b?Q2[b]:null;if(y!=null&&y.stringify){const w=y.stringify(x,g,this);this.getAttribute(g)!==w&&this.setAttribute(g,w)}else this[Xx]()}})}return h}function GIt(e,t,n){const r=Qxe.createRoot(e),o=v.createElement(t,n);return r.render(o),{root:r,ReactComponent:t}}function YIt({root:e,ReactComponent:t},n){const r=v.createElement(t,n);e.render(r)}function ZIt({root:e}){e.unmount()}function XIt(e,t={}){return KIt(e,t,{mount:GIt,update:YIt,unmount:ZIt})}const QIt={id:"string",version:"string",authToken:"json",placeholders:"json",defaultFilterValues:"json",defaultControlValues:"json",controlContractOverrides:"json",documentInputValues:"json",dashboardInputExecutionSnapshot:"json",interactionExecutionSnapshot:"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"},JIt=XIt(wxe,{props:QIt}),e_t=v.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(x4,{context:t})," "]})});var jxe="Toggle",kxe=te.forwardRef((e,t)=>{const{pressed:n,defaultPressed:r,onPressedChange:o,...s}=e,[i,a]=p.useControllableState({prop:n,onChange:o,defaultProp:r??!1,caller:jxe});return l.jsx(p.Primitive.button,{type:"button","aria-pressed":i,"data-state":i?"on":"off","data-disabled":e.disabled?"":void 0,...s,ref:t,onClick:p.composeEventHandlers(e.onClick,()=>{e.disabled||a(!i)})})});kxe.displayName=jxe;var Ixe=kxe;const t_t=p.cva("inline-flex items-center justify-center rounded-control text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-3",sm:"h-9 px-2.5",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),_xe=te.forwardRef(({className:e,variant:t,size:n,...r},o)=>l.jsx(Ixe,{ref:o,className:p.cn(t_t({variant:t,size:n,className:e})),...r}));_xe.displayName=Ixe.displayName;function sB(){var c,u;const e=p.useEditorStore(d=>d.card),t=p.useEditorStore(d=>d.frame),n=v.useMemo(()=>gw(t,e),[t,e]),{manifest:r}=mf(((c=n==null?void 0:n.customCardPreferences)==null?void 0:c.url)||""),o=v.useMemo(()=>{var d;return(d=r==null?void 0:r.visuals)==null?void 0:d.find(f=>{var h;return f.name===((h=n==null?void 0:n.customCardPreferences)==null?void 0:h.componentName)})},[r,(u=n==null?void 0:n.customCardPreferences)==null?void 0:u.componentName]),s=$m(n,o),i=v.useMemo(()=>pw({frame:t,configCard:n,isMultiInputVisual:s==="multiple"}),[t,n,s]),a=v.useMemo(()=>{const d=i.findIndex(f=>(f==null?void 0:f.id)===e.id);return d<0?-1:Og(e,d)},[i,e]);return v.useMemo(()=>!n||s!=="multiple"||a<0?e.type:jh(e,a,o==null?void 0:o.slots)??e.type,[n,s,a,e,o==null?void 0:o.slots])}function Txe({storeValue:e,defaultValue:t="",onStoreUpdate:n,delay:r=300}){const[o,s]=v.useState(e??t),i=v.useRef(null),a=v.useRef(o),c=v.useRef(e),u=v.useRef(!1),d=v.useCallback(()=>{i.current&&(clearTimeout(i.current),i.current=null),u.current&&a.current!==(c.current??t)&&(n(a.current),c.current=a.current)},[t,n]);v.useEffect(()=>{if(e!==c.current){i.current&&(clearTimeout(i.current),i.current=null);const h=e??t;s(h),a.current=h,c.current=e,u.current=!1}},[e,t]),v.useEffect(()=>{if(u.current)return i.current=setTimeout(()=>{d()},r),()=>{i.current&&(clearTimeout(i.current),i.current=null)}},[r,d,o]),v.useEffect(()=>()=>{i.current&&clearTimeout(i.current)},[]);const f=v.useCallback(h=>{const m=h??t;u.current=!0,a.current=m,s(m)},[t]);return{value:o,onChange:f,flush:d}}const n_t=300;function r_t({onExpand:e},t){const n=p.useEditorStore(C=>C.card.sql),r=p.useEditorStore(C=>C.sqlGen),o=p.useEditorStore(C=>C.card),s=sB(),{setCardSql:i,setSqlGen:a,setRunSql:c}=p.useEditorActions(),u=v.useMemo(()=>s!==o.type?{...o,type:s}:o,[o,s]),{queryKey:d}=mb(u),f=Vr(),h=v.useRef(d);h.current=d;const m=v.useRef(r);m.current=r;const g=v.useCallback(C=>{i(C)},[i]),{value:b,onChange:x,flush:y}=Txe({storeValue:n,defaultValue:"",onStoreUpdate:g,delay:n_t});v.useEffect(()=>Sxe(y),[y]);function w(C){x(C),p.isObjectEmpty(m.current)||a({})}return l.jsxs("div",{className:"relative h-full w-full",children:[l.jsx(p.CodeEditor,{ref:t,value:b??"",onValueChange:w,language:"sql-jinja",embedded:!0,hideLineNumbers:!0,wrapLines:!0,placeholder:"Write your SQL here",onKeyDown:C=>{C.key==="Enter"&&C.shiftKey&&(C.preventDefault(),oB(),setTimeout(()=>{f.removeQueries({queryKey:h.current,exact:!0}),c(!0)},0))}}),e?l.jsx(p.Button,{type:"button",variant:"ghost",size:"icon",className:"absolute right-2.5 top-2 z-20 h-7 w-7 bg-background/80 p-0 text-muted-foreground backdrop-blur-sm transition-colors hover:bg-accent hover:text-foreground focus-visible:text-foreground",onClick:e,"aria-label":"Expand SQL editor",title:"Expand SQL editor",children:l.jsx(At.Maximize2,{className:"h-3.5 w-3.5",strokeWidth:1.75})}):null]})}const o_t=v.forwardRef(r_t),s_t=300;function i_t(e,t){const n=p.useEditorStore(g=>g.card.python),r=p.useEditorStore(g=>g.card),o=sB(),{setCardPython:s,setRunSql:i}=p.useEditorActions(),a=v.useMemo(()=>o!==r.type?{...r,type:o}:r,[r,o]),{queryKey:c}=mb(a),u=Vr(),d=v.useRef(c);d.current=c;const{value:f,onChange:h,flush:m}=Txe({storeValue:n,defaultValue:fO,onStoreUpdate:s,delay:s_t});return v.useEffect(()=>Sxe(m),[m]),l.jsx(p.CodeEditor,{ref:t,value:f??"",onValueChange:h,language:"python",embedded:!0,hideLineNumbers:!0,wrapLines:!0,className:"[&_.code-editor-pre]:!pt-2 [&_.code-editor-textarea]:!pt-2",onKeyDown:g=>{g.key==="Enter"&&g.shiftKey&&(g.preventDefault(),oB(),setTimeout(()=>{u.removeQueries({queryKey:d.current,exact:!0}),i(!0)},0))}})}const a_t=v.forwardRef(i_t),Exe=new Set(["askForMoreInfo","getAvailableChartTypes","getChartSQLSyntax","getDomainRelationships","getTableColumns","getUserSql","validateCardConfigFormat"]),l_t=new Set(["createChartFromSql","createForecast","generateQueryConfig","getChartDataFromCardConfig","getChartDataFromSqlAndPython","getForecastDataFromSqlAndPython"]),c_t=Array.from(Exe).join(", "),u_t=3,d_t="Self-heal",f_t=new Set(["SQL_PARSE_ERROR","SQL_EXPLAIN_ERROR"]);function h_t({card:e}){var q,W,R,Z,X;const[t,n]=v.useState({}),{authToken:r}=Tt(),o=p.getTokenParams(r==null?void 0:r.accessToken),{compiledAppearance:s}=p.useAppearance(),i=v.useMemo(()=>Uw(s),[s]),a=p.useEditorStore(Y=>Y.frame),c=p.useEditorStore(Y=>Y.inlineFilterValuesMap[e.id]),u=p.useEditorStore(Y=>Y.actions.setCardInlineFilterValue),d=p.useEditorStore(Y=>Y.actions.removeCardInlineFilterValue),f=e,{getCard:h,manifest:m}=mf(((q=f.customCardPreferences)==null?void 0:q.url)||""),g=(W=m==null?void 0:m.visuals)==null?void 0:W.find(Y=>{var G;return Y.name===((G=f.customCardPreferences)==null?void 0:G.componentName)}),b=$m(f,g)??"single",x=v.useMemo(()=>pw({frame:a,configCard:f,isMultiInputVisual:b==="multiple"}),[a,f,b]),y=v.useMemo(()=>{const Y=x.findIndex(G=>(G==null?void 0:G.id)===e.id);return Y<0?-1:Og(e,Y)},[x,e]),w=v.useMemo(()=>b!=="multiple"||y<0?e.type:jh(e,y,g==null?void 0:g.slots)??e.type,[b,y,e,g==null?void 0:g.slots]),C=v.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:S,effectiveCardConfig:N}=mb(C),j=p.useInteractionStore(Y=>Y.interactionStates),k=p.useDashboardStore(Y=>{var G;return(G=Y.dashboard)==null?void 0:G.id}),I=p.useDashboardStore(Y=>Y.dashboard.filters),T=p.useDashboardStore(Y=>Y.filterValues),_=p.useDashboardStore(Y=>Y.selectedSheetId),E=v.useMemo(()=>K$({card:e,sheetId:_||"",inlineFilterValues:c,setInlineFilterValue:Y=>u(e.id,Y),removeInlineFilterValue:Y=>d(e.id,Y)}),[e,_,c,u,d]),{cardFilters:D,cardFilterValues:A}=v.useMemo(()=>ow({card:e,interactionStates:j,currentDashboardId:k,filters:I,filterValues:T,selectedSheetId:_}),[e,j,k,I,T,_]),F=v.useCallback((Y,G)=>{const z=dL(G);n(V=>({...V,[Y]:z}))},[]),P=(R=f.customCardPreferences)==null?void 0:R.componentName,O=P?h(P):null,$=qj((Z=f.customCardPreferences)==null?void 0:Z.settings,f),B=v.useMemo(()=>PI(x),[x]),U=v.useMemo(()=>B.map((Y,G)=>jh(Y,G,g==null?void 0:g.slots)),[B,g==null?void 0:g.slots]),M=v.useMemo(()=>Z$(b==="multiple"?Y$({slotOrderedCards:B,multiInputData:t}):[{card:e,cardConfig:N,columns:S==null?void 0:S.columns,columnKeyMap:S==null?void 0:S.columnKeyMap}]),[e,S==null?void 0:S.columnKeyMap,S==null?void 0:S.columns,N,t,B,b]);return P?l.jsx("div",{className:"semaphor-custom mb-3 flex grow basis-0 flex-col space-y-2 overflow-y-auto",children:l.jsxs(v.Suspense,{fallback:l.jsx(l.Fragment,{}),children:[O&&b==="single"&&l.jsx(O,{editing:!0,params:o,theme:i,settings:$,cardMetadata:pue({card:e,dataMetadata:S==null?void 0:S.metadata}),onDataChange:F,data:(S==null?void 0:S.records)||[],columns:(S==null?void 0:S.columns)||[],formatTemporalBucketValue:M,filters:D,filterValues:[...A||[],...c||[]],inlineFilters:E}),O&&b==="multiple"&&l.jsxs(l.Fragment,{children:[x.map((Y,G)=>{if(!Y)return null;const z=Og(Y,G),V=jh(Y,z,g==null?void 0:g.slots);return l.jsx(x$,{onDataChange:F,card:Y,effectiveCardType:V},`${Y.id}-${z}`)}),l.jsx("div",{className:"flex flex-col gap-2",children:l.jsx(O,{editing:!0,onDataChange:F,...G$({configCard:f,slotOrderedCards:B,slotTypes:U,multiInputData:t,params:o,theme:i,chartSettings:$,filters:D,filterValues:[...A||[],...c||[]],inlineFilters:E,formatTemporalBucketValue:M})})})]})]},(X=f.customCardPreferences)==null?void 0:X.componentName)}):null}const m_t=v.memo(h_t),p_t=p.create()(p.persist((e,t)=>({starredCharts:[],isStarred:(n,r)=>t().starredCharts.some(o=>o.type===n&&o.id===r),toggleStar:n=>{e(r=>{const o=r.starredCharts.findIndex(s=>s.type===n.type&&s.id===n.id);return o>=0?{starredCharts:r.starredCharts.filter((s,i)=>i!==o)}:{starredCharts:[...r.starredCharts,n]}})},getStarredChart:(n,r)=>t().starredCharts.find(o=>o.type===n&&o.id===r)}),{name:"semaphor-starred-charts"}));var Dxe=["PageUp","PageDown"],Mxe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Rxe={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},ix="Slider",[aO,g_t,b_t]=p.createCollection(ix),[Axe]=p.createContextScope(ix,[b_t]),[x_t,ZT]=Axe(ix),Pxe=te.forwardRef((e,t)=>{const{name:n,min:r=0,max:o=100,step:s=1,orientation:i="horizontal",disabled:a=!1,minStepsBetweenThumbs:c=0,defaultValue:u=[r],value:d,onValueChange:f=()=>{},onValueCommit:h=()=>{},inverted:m=!1,form:g,...b}=e,x=te.useRef(new Set),y=te.useRef(0),C=i==="horizontal"?y_t:v_t,[S=[],N]=p.useControllableState({prop:d,defaultProp:u,onChange:E=>{var A;(A=[...x.current][y.current])==null||A.focus(),f(E)}}),j=te.useRef(S);function k(E){const D=j_t(S,E);_(E,D)}function I(E){_(E,y.current)}function T(){const E=j.current[y.current];S[y.current]!==E&&h(S)}function _(E,D,{commit:A}={commit:!1}){const F=T_t(s),P=E_t(Math.round((E-r)/s)*s+r,F),O=p.clamp(P,[r,o]);N(($=[])=>{const B=S_t($,O,D);if(__t(B,c*s)){y.current=B.indexOf(O);const U=String(B)!==String($);return U&&A&&h(B),U?B:$}else return $})}return l.jsx(x_t,{scope:e.__scopeSlider,name:n,disabled:a,min:r,max:o,valueIndexToChangeRef:y,thumbs:x.current,values:S,orientation:i,form:g,children:l.jsx(aO.Provider,{scope:e.__scopeSlider,children:l.jsx(aO.Slot,{scope:e.__scopeSlider,children:l.jsx(C,{"aria-disabled":a,"data-disabled":a?"":void 0,...b,ref:t,onPointerDown:p.composeEventHandlers(b.onPointerDown,()=>{a||(j.current=S)}),min:r,max:o,inverted:m,onSlideStart:a?void 0:k,onSlideMove:a?void 0:I,onSlideEnd:a?void 0:T,onHomeKeyDown:()=>!a&&_(r,0,{commit:!0}),onEndKeyDown:()=>!a&&_(o,S.length-1,{commit:!0}),onStepKeyDown:({event:E,direction:D})=>{if(!a){const P=Dxe.includes(E.key)||E.shiftKey&&Mxe.includes(E.key)?10:1,O=y.current,$=S[O],B=s*P*D;_($+B,O,{commit:!0})}}})})})})});Pxe.displayName=ix;var[Fxe,Oxe]=Axe(ix,{startEdge:"left",endEdge:"right",size:"width",direction:1}),y_t=te.forwardRef((e,t)=>{const{min:n,max:r,dir:o,inverted:s,onSlideStart:i,onSlideMove:a,onSlideEnd:c,onStepKeyDown:u,...d}=e,[f,h]=te.useState(null),m=p.useComposedRefs(t,C=>h(C)),g=te.useRef(void 0),b=p.useDirection(o),x=b==="ltr",y=x&&!s||!x&&s;function w(C){const S=g.current||f.getBoundingClientRect(),N=[0,S.width],k=iB(N,y?[n,r]:[r,n]);return g.current=S,k(C-S.left)}return l.jsx(Fxe,{scope:e.__scopeSlider,startEdge:y?"left":"right",endEdge:y?"right":"left",direction:y?1:-1,size:"width",children:l.jsx(Lxe,{dir:b,"data-orientation":"horizontal",...d,ref:m,style:{...d.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:C=>{const S=w(C.clientX);i==null||i(S)},onSlideMove:C=>{const S=w(C.clientX);a==null||a(S)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:C=>{const N=Rxe[y?"from-left":"from-right"].includes(C.key);u==null||u({event:C,direction:N?-1:1})}})})}),v_t=te.forwardRef((e,t)=>{const{min:n,max:r,inverted:o,onSlideStart:s,onSlideMove:i,onSlideEnd:a,onStepKeyDown:c,...u}=e,d=te.useRef(null),f=p.useComposedRefs(t,d),h=te.useRef(void 0),m=!o;function g(b){const x=h.current||d.current.getBoundingClientRect(),y=[0,x.height],C=iB(y,m?[r,n]:[n,r]);return h.current=x,C(b-x.top)}return l.jsx(Fxe,{scope:e.__scopeSlider,startEdge:m?"bottom":"top",endEdge:m?"top":"bottom",size:"height",direction:m?1:-1,children:l.jsx(Lxe,{"data-orientation":"vertical",...u,ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:b=>{const x=g(b.clientY);s==null||s(x)},onSlideMove:b=>{const x=g(b.clientY);i==null||i(x)},onSlideEnd:()=>{h.current=void 0,a==null||a()},onStepKeyDown:b=>{const y=Rxe[m?"from-bottom":"from-top"].includes(b.key);c==null||c({event:b,direction:y?-1:1})}})})}),Lxe=te.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:o,onSlideEnd:s,onHomeKeyDown:i,onEndKeyDown:a,onStepKeyDown:c,...u}=e,d=ZT(ix,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()):Dxe.concat(Mxe).includes(f.key)&&(c(f),f.preventDefault())}),onPointerDown:p.composeEventHandlers(e.onPointerDown,f=>{const h=f.target;h.setPointerCapture(f.pointerId),f.preventDefault(),d.thumbs.has(h)?h.focus():r(f)}),onPointerMove:p.composeEventHandlers(e.onPointerMove,f=>{f.target.hasPointerCapture(f.pointerId)&&o(f)}),onPointerUp:p.composeEventHandlers(e.onPointerUp,f=>{const h=f.target;h.hasPointerCapture(f.pointerId)&&(h.releasePointerCapture(f.pointerId),s(f))})})}),$xe="SliderTrack",zxe=te.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,o=ZT($xe,n);return l.jsx(p.Primitive.span,{"data-disabled":o.disabled?"":void 0,"data-orientation":o.orientation,...r,ref:t})});zxe.displayName=$xe;var lO="SliderRange",Bxe=te.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,o=ZT(lO,n),s=Oxe(lO,n),i=te.useRef(null),a=p.useComposedRefs(t,i),c=o.values.length,u=o.values.map(h=>qxe(h,o.min,o.max)),d=c>1?Math.min(...u):0,f=100-Math.max(...u);return l.jsx(p.Primitive.span,{"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,...r,ref:a,style:{...e.style,[s.startEdge]:d+"%",[s.endEdge]:f+"%"}})});Bxe.displayName=lO;var cO="SliderThumb",Vxe=te.forwardRef((e,t)=>{const n=g_t(e.__scopeSlider),[r,o]=te.useState(null),s=p.useComposedRefs(t,a=>o(a)),i=te.useMemo(()=>r?n().findIndex(a=>a.ref.current===r):-1,[n,r]);return l.jsx(w_t,{...e,ref:s,index:i})}),w_t=te.forwardRef((e,t)=>{const{__scopeSlider:n,index:r,name:o,...s}=e,i=ZT(cO,n),a=Oxe(cO,n),[c,u]=te.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:qxe(m,i.min,i.max),b=N_t(r,i.values.length),x=h==null?void 0:h[a.size],y=x?k_t(x,g,a.direction):0;return te.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(aO.ItemSlot,{scope:e.__scopeSlider,children:l.jsx(p.Primitive.span,{role:"slider","aria-label":e["aria-label"]||b,"aria-valuemin":i.min,"aria-valuenow":m,"aria-valuemax":i.max,"aria-orientation":i.orientation,"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,tabIndex:i.disabled?void 0:0,...s,ref:d,style:m===void 0?{display:"none"}:e.style,onFocus:p.composeEventHandlers(e.onFocus,()=>{i.valueIndexToChangeRef.current=r})})}),f&&l.jsx(Hxe,{name:o??(i.name?i.name+(i.values.length>1?"[]":""):void 0),form:i.form,value:m},r)]})});Vxe.displayName=cO;var C_t="RadioBubbleInput",Hxe=te.forwardRef(({__scopeSlider:e,value:t,...n},r)=>{const o=te.useRef(null),s=p.useComposedRefs(o,r),i=p.usePrevious(t);return te.useEffect(()=>{const a=o.current;if(!a)return;const c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&d){const f=new Event("input",{bubbles:!0});d.call(a,t),a.dispatchEvent(f)}},[i,t]),l.jsx(p.Primitive.input,{style:{display:"none"},...n,ref:s,defaultValue:t})});Hxe.displayName=C_t;function S_t(e=[],t,n){const r=[...e];return r[n]=t,r.sort((o,s)=>o-s)}function qxe(e,t,n){const s=100/(n-t)*(e-t);return p.clamp(s,[0,100])}function N_t(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function j_t(e,t){if(e.length===1)return 0;const n=e.map(o=>Math.abs(o-t)),r=Math.min(...n);return n.indexOf(r)}function k_t(e,t,n){const r=e/2,s=iB([0,50],[0,r]);return(r-s(t)*n)*n}function I_t(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function __t(e,t){if(t>0){const n=I_t(e);return Math.min(...n)>=t}return!0}function iB(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 T_t(e){return(String(e).split(".")[1]||"").length}function E_t(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var Uxe=Pxe,D_t=zxe,M_t=Bxe,R_t=Vxe;const Wxe=te.forwardRef(({className:e,...t},n)=>l.jsxs(Uxe,{ref:n,className:p.cn("relative flex w-full touch-none select-none items-center",e),...t,children:[l.jsx(D_t,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:l.jsx(M_t,{className:"absolute h-full bg-primary"})}),l.jsx(R_t,{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"})]}));Wxe.displayName=Uxe.displayName;exports.Accordion=u4;exports.AccordionContent=yv;exports.AccordionItem=bv;exports.AccordionTrigger=xv;exports.AddDataPicker=Q4;exports.AggregateTable=j_;exports.Alert=xL;exports.AlertDescription=yL;exports.AlertDialog=tf;exports.AlertDialogAction=Nu;exports.AlertDialogCancel=ju;exports.AlertDialogContent=yu;exports.AlertDialogDescription=Su;exports.AlertDialogFooter=wu;exports.AlertDialogHeader=vu;exports.AlertDialogTitle=Cu;exports.AlertDialogTrigger=c1e;exports.AlertTitle=_te;exports.ArrowDown=Yo;exports.ArrowDownIcon=SQe;exports.ArrowLeft=Wv;exports.ArrowRight=Kv;exports.ArrowUp=ps;exports.ArrowUpIcon=jQe;exports.AssistantContextEntityControls=oO;exports.AssistantVirtualizedMessages=hxe;exports.AxisConfigurator=zm;exports.BackgroundRunPill=Lct;exports.Badge=fi;exports.Bell=j1;exports.BookType=cZ;exports.BriefingAuthor=Wfe;exports.BriefingAuthorDialog=Kfe;exports.BriefingUiCapabilitiesBoundary=iut;exports.BriefingUiCapabilitiesProvider=dT;exports.BriefingsApiError=nC;exports.BulletChartIcon=sxe;exports.CSS=qi;exports.CalculatedFieldEditor=Sme;exports.Calculator=dZ;exports.Calendar=Aa;exports.CalendarClock=RO;exports.Card=jN;exports.CardContent=MO;exports.CardHeader=DO;exports.CardSummary=uF;exports.CardTitle=ab;exports.ChartArea=SR;exports.ChartColumnIncreasing=hZ;exports.ChartColumnStacked=mZ;exports.ChartJsVisual=zw;exports.ChartLine=pZ;exports.ChartNoAxesGantt=bZ;exports.ChartPie=xZ;exports.ChartScatter=yZ;exports.ChatInputWithContext=J4;exports.Checkbox=In;exports.ChevronLeft=jm;exports.ChevronsUpDown=CZ;exports.Circle=AO;exports.CircleAlert=ba;exports.CircleCheck=SZ;exports.CircleHelp=NZ;exports.Clock=jZ;exports.CodeHighlighter=kd;exports.CodeXml=k1;exports.Collapsible=du;exports.CollapsibleContent=hu;exports.CollapsibleTrigger=fu;exports.ColorField=la;exports.Command=wT;exports.CommandEmpty=ST;exports.CommandGroup=NT;exports.CommandInput=Qz;exports.CommandItem=jT;exports.CommandList=CT;exports.CommandSeparator=Vhe;exports.ComparisonMetadataBadge=Koe;exports.Container=c5;exports.ControlDefaultValueEditor=Wme;exports.ControlDefinitionOptionsEditor=Ume;exports.ControlIdInput=Bme;exports.ControlVisibilitySettings=Ngt;exports.Copy=Wh;exports.CopyButton=jd;exports.CopyPlus=jR;exports.Cross2Icon=TQe;exports.CustomFilterPopover=U$;exports.CustomScrollArea=sl;exports.DEFAULT_HEATMAP_CUSTOM_RANGE=Gre;exports.Dashboard=wxe;exports.DashboardCard=Xfe;exports.DashboardCreateDialogBase=xQ;exports.DashboardExportDialog=mxe;exports.DashboardPlus=AIt;exports.DashboardWC=JIt;exports.DataTableConditionalFormattingSettings=Ppe;exports.DataTablePagination=p_;exports.Database=ts;exports.DateRangePicker=B$;exports.DefaultChatTransport=H4;exports.Dialog=_o;exports.DialogContent=mo;exports.DialogDescription=To;exports.DialogFooter=Ya;exports.DialogHeader=Is;exports.DialogTitle=po;exports.DialogTrigger=pQ;exports.DisplayFormatPreferencesFields=OIt;exports.DisplayPreferencesProvider=tT;exports.DndContext=hC;exports.Donut=kZ;exports.Download=gu;exports.DownloadPdf=pxe;exports.DragOverlay=_he;exports.DropdownMenu=zo;exports.DropdownMenuCheckboxItem=Wu;exports.DropdownMenuContent=Io;exports.DropdownMenuItem=Sn;exports.DropdownMenuLabel=La;exports.DropdownMenuRadioGroup=gCe;exports.DropdownMenuRadioItem=BX;exports.DropdownMenuSeparator=xa;exports.DropdownMenuSub=e5;exports.DropdownMenuSubContent=Yk;exports.DropdownMenuSubTrigger=Gk;exports.DropdownMenuTrigger=Bo;exports.EMPTY_DATA_SOURCE=ob;exports.Editable=Wj;exports.EditableText=gi;exports.EditorCustomVisual=m_t;exports.Ellipsis=wi;exports.EllipsisVertical=km;exports.ErrorBoundary=Si;exports.ExportError=jb;exports.ExternalLink=_d;exports.EyeOff=qk;exports.Fallback=J_;exports.FallbackVisual=Jw;exports.FeedbackCategory=Qd;exports.FeedbackDialog=Ev;exports.FieldsList=x4;exports.FieldsSection=e_t;exports.FileCode=IZ;exports.FileText=Gs;exports.Filter=Td;exports.FilterComponent=G_;exports.FilterInfo=iF;exports.FilterableFieldsPanel=jme;exports.Grid3x3=kR;exports.GripVertical=bu;exports.HEATMAP_PRESET_PALETTES=LA;exports.Hash=lb;exports.House=_Z;exports.HoverCard=Um;exports.HoverCardContent=cu;exports.HoverCardTrigger=$d;exports.INLINE_ALLOWED_READ_ONLY_TOOLS=Exe;exports.INLINE_ALLOWED_TOOL_LIST=c_t;exports.INLINE_BLOCKED_MUTATING_TOOLS=l_t;exports.IconButton=Gc;exports.IconForFieldType=uN;exports.Inbox=FO;exports.InfoHover=uz;exports.InlineFilterBar=que;exports.KPICard=Wd;exports.KeyboardSensor=dC;exports.Layers=_m;exports.Link=OO;exports.LoadingDots=Bd;exports.MAX_SELF_HEAL_ATTEMPTS=u_t;exports.Map=MZ;exports.Markdown=Az;exports.MatrixTableVisual=N_;exports.MdStackedLineChart=rxe;exports.MultiInputEmptyRenderer=x$;exports.PanelResizeHandle=VT;exports.Pause=RZ;exports.PenLine=TR;exports.Pencil=ER;exports.PendingMessagesDisplay=Kbe;exports.PersistedDynamicVisual=eT;exports.PiChartPolar=Jbe;exports.Pin=PZ;exports.PinOff=AZ;exports.PivotTableTanstack=Ub;exports.Placeholders=lge;exports.Play=FZ;exports.Plus=_r;exports.PointerSensor=Qb;exports.Progress=Y4;exports.PythonEditor=a_t;exports.RECOVERABLE_SQL_ERROR_CODES=f_t;exports.Radar=OZ;exports.RadioGroup=Xa;exports.RadioGroupItem=ys;exports.RefreshCw=Gl;exports.ResizableHandle=L0t;exports.ResizablePanel=WF;exports.ResizablePanelGroup=age;exports.ResourceEditDialog=GQ;exports.ResourceType=io;exports.Rows3=LZ;exports.RunCompletionBanner=$ct;exports.SELF_HEAL_TIMELINE_STEP=d_t;exports.SeedQuestions=Mbe;exports.SemaphorContext=$v;exports.SemaphorContextProvider=yO;exports.SemaphorQueryClient=MY;exports.SemaphorReadyIndicator=rB;exports.SemaphorStyleWrapper=Wb;exports.Send=$O;exports.SendHorizontal=$Z;exports.Settings=zO;exports.Settings2=Tm;exports.Share2=zZ;exports.ShareDialog=KQ;exports.Sheet=x3;exports.SheetContent=g_;exports.SheetDescription=x_;exports.SheetHeader=Foe;exports.SheetTitle=b_;exports.SheetTrigger=n4e;exports.Slider=Wxe;exports.SortableContext=mC;exports.Sparkles=y0;exports.SqlEditor=o_t;exports.Square=VO;exports.SquarePen=BO;exports.Star=BZ;exports.StructuralParticipantSelector=Vme;exports.SummaryCard=rF;exports.TABLE_PRESENTATION_DEFAULT_STYLE=Sd;exports.TABLE_PRESENTATION_DEFAULT_TOTALS_STYLE=ua;exports.TableBody=Ld;exports.TableCell=Bn;exports.TableColumnVisibilitySettings=Spe;exports.TableHead=uo;exports.TableHeader=qm;exports.TablePresentationSettings=jpe;exports.TableRow=Mr;exports.TableSkeleton=fz;exports.TableVisual=zd;exports.Tag=VZ;exports.TbChartBubble=exe;exports.TbChartFunnel=txe;exports.TbChartTreemap=nxe;exports.TextCard=Zg;exports.Textarea=Rm;exports.TiSortNumerically=oxe;exports.Toggle=_xe;exports.Tornado=HZ;exports.Trash2=Ga;exports.TriangleAlert=Ws;exports.TypeGlyph=iC;exports.UXProvider=nB;exports.Undo2=qZ;exports.User=qO;exports.Users=Uk;exports.UsersRound=UO;exports.VisualErrorState=Eue;exports.Zap=DR;exports.applyBriefingFormPatch=lv;exports.areContextEntitiesEqual=ir;exports.areEntitiesJoined=Qre;exports.arrayMove=Jb;exports.briefingFormDraftToCreateRequest=fF;exports.briefingFormDraftToUpdateRequest=kde;exports.briefingToFormDraft=Zp;exports.briefingTone=kr;exports.buildCardControlUsageById=kgt;exports.buildCustomCardTheme=Uw;exports.buildDashboardControlUsageById=jgt;exports.buildDashboardSheetsInputExecutionSnapshot=TO;exports.buildDashboardStructuralParticipantIdsByControlId=Yme;exports.buildFilterFieldMeta=o4;exports.buildFilterSemanticContext=s4;exports.buildInlineFilterNodes=K$;exports.buildMultiInputCustomVisualProps=G$;exports.buildMultiInputTemporalPresentationInputs=Y$;exports.buildSlotOrderedCards=PI;exports.calculateCardFilterValues=R5;exports.calculateContextAwareFilters=ow;exports.calculateFieldState=c3;exports.canUserAccessVisuals=pNe;exports.canUserCreateDashboards=XQ;exports.canUserEdit=fNe;exports.canUserManageDashboards=mNe;exports.canUserManageGroups=gNe;exports.canUserUseFilters=hNe;exports.cancelBriefingPreviewRun=mde;exports.cancelBriefingRun=gde;exports.cancelExport=N$e;exports.chartSupportsDataLabels=Une;exports.chartSupportsLegend=Hne;exports.chartTypes=YT;exports.cleanupKpiMetricComparisonMode=Xhe;exports.cloneDeep=Hs;exports.cloneLinkedFrameWithSourceMapping=zet;exports.closestCenter=uC;exports.commitSharedCalculatedFields=Hf;exports.createAssistantConversationId=Bp;exports.createAssistantRequestId=Ebe;exports.createBriefing=ide;exports.createBriefingFormDraft=dF;exports.createCardsFromSlots=cEe;exports.createChartConfig=Sb;exports.createCustomVisualTemporalBucketFormatter=Z$;exports.createDashboardControlInputFromControl=jyt;exports.createExport=moe;exports.createUniqueDashboardInputVariableNameFromName=Id;exports.currencyPresentationTargetKey=ma;exports.dedup=RNt;exports.dedupeContextEntities=Vz;exports.deleteBriefing=cde;exports.deleteBriefingRun=bde;exports.diagnoseCurrencyPresentationBindings=T0e;exports.doesStoredFilterMatchField=nb;exports.downloadDocumentPdf=mL;exports.downloadPdf=ote;exports.extractSqlParamReferences=AY;exports.extractTableMetadata=r4;exports.fieldAlreadyExists=eoe;exports.findCustomVisualConfigCard=gw;exports.flexRender=mi;exports.flushPendingEditorDrafts=oB;exports.formatDisplayFormula=wmt;exports.formatFileSize=I$e;exports.getAutoDetectedChartIcon=ckt;exports.getBriefing=sde;exports.getBriefingArtifact=Btt;exports.getBriefingEvidence=Vtt;exports.getBriefingPreviewRun=hde;exports.getBriefingRun=pde;exports.getCardCurrencyPresentationFields=NO;exports.getCardCurrencyPresentationTargets=jO;exports.getChartGridStyle=jDe;exports.getChartIconByType=ukt;exports.getColorForValue=QR;exports.getConfigSlotExpectedType=lEe;exports.getCoreRowModel=f_;exports.getCustomVisualInputCards=pw;exports.getDefaultAxisConfig=rA;exports.getDefaultChartColors=Lm;exports.getDefaultDataLabelsConfig=Cw;exports.getDefaultLegendConfig=UL;exports.getDefaultRunningTotalPartitionByFieldIds=d0;exports.getDisplayedKpiResultColumnKeys=jw;exports.getDocumentSectionEditorCard=ogt;exports.getDocumentSheetDashboardInputs=nx;exports.getDownloadUrl=S$e;exports.getEffectiveCardTypeForSlot=jh;exports.getEntityIcon=Pk;exports.getErrorMessage=gbe;exports.getExportStatus=C$e;exports.getExports=w$e;exports.getExpressionFieldKind=Gd;exports.getFieldExpressionAnnotation=i4;exports.getFilterCount=Xj;exports.getGranularityOptionsForFieldType=zme;exports.getKeys=br;exports.getMatrixVisualLoadingState=c_;exports.getMetricDisplayLabel=B3e;exports.getNewField=soe;exports.getObjectDiff=fY;exports.getPaginationRowModel=h_;exports.getRoleBasedDisplayOverrides=ZQ;exports.getRunningTotalOrderByCandidates=qht;exports.getSelectedDateFilterColumn=nue;exports.getSlotDefinitionForIndex=uL;exports.getSlotExpectedChartType=AI;exports.getSlotIndexForCard=Og;exports.getSortedRowModel=Roe;exports.getTableConditionalFormattingColumnOptions=Tpe;exports.getTableOutputColumnOptions=Epe;exports.getTablePageSizeOptions=foe;exports.handleAggregationChange=aF;exports.handleAggregationLabelChange=Vue;exports.hasFlatTableTotalsBehavior=Om;exports.hasMatrixResultData=Iw;exports.horizontalListSortingStrategy=Gz;exports.inferSemanticDomainIdFromSelectedEntities=Ak;exports.isActiveBriefingRunStatus=rk;exports.isCardSummaryVisibleOnCard=X$;exports.isCurrencyPresentationControl=I0e;exports.isCustomVisualConfigCard=eA;exports.isDefaultColor=ATe;exports.isEligibleFlatTableTotalsCard=uw;exports.isExportComplete=k$e;exports.isExportInProgress=j$e;exports.isInAiScopeArray=MNt;exports.isManagedCalculatedExpressionField=Wa;exports.isMetricTransformEnabled=Vht;exports.isPresentationCurrencyBinding=Vv;exports.isPromiseLike=rO;exports.isSqlBackedKpi=ioe;exports.isStructuralControlBinding=k0e;exports.isSubtotalEnabledAggregateTable=n4;exports.isSupportedDocumentTableCardType=sgt;exports.isTableType=dDe;exports.isTerminalBriefingRunStatus=nk;exports.lastAssistantMessageIsCompleteWithToolCalls=fbe;exports.listBriefingRuns=ztt;exports.listBriefingTenantSummaries=$tt;exports.listBriefings=Ltt;exports.merge=Wl;exports.mergeAxisConfig=oA;exports.normalizeConditionalFormatting=U5;exports.normalizeContextFormatMode=Nee;exports.normalizeDashboardCardPythonCode=db;exports.normalizeDashboardInputVariableName=Hv;exports.normalizeMultiInputPayload=dL;exports.pauseBriefing=ade;exports.pivotData=hw;exports.polishBriefingText=xde;exports.prepareFeedbackData=GT;exports.previewBriefingPlan=dde;exports.reindexSlotCards=aEe;exports.remarkGfm=Lz;exports.removeFromScopeArray=ANt;exports.requiresDashboardInputResolution=Jd;exports.resolveCurrencyPresentationTargetFormat=_ee;exports.resolveDashboardBriefingsVisibility=Gfe;exports.resolveDashboardControlsVisibility=vNe;exports.resolveDashboardInputContext=Wi;exports.resolveDashboardTitleEditability=yNe;exports.resolveDomainCalculatedFieldForEdit=gpt;exports.resolveMatrixCardMeasureInstances=Vk;exports.resolveMultiInputType=$m;exports.resolveMultiInputTypeFromVisual=uEe;exports.resolvePendingPivotTableResultState=d$e;exports.resolveTablePageSize=i_;exports.resolveTablePresentationStyle=k3;exports.resumeBriefing=lde;exports.runBriefingNow=ude;exports.runBriefingPreview=fde;exports.sanitizeAIScope=pbe;exports.saveCalculatedFieldToCardScope=OF;exports.saveCalculatedFieldToSharedScope=Nme;exports.saveCalculatedFieldToSheetScope=LF;exports.seedSemanticMetricFormatDefaults=Jhe;exports.setTableColumnVisibility=boe;exports.setupEditorWithCard=RI;exports.showAllTableColumns=M$e;exports.showJoinRequiredNotification=Jre;exports.sortByColumnsToSortState=rse;exports.sortStateToSortByColumns=ose;exports.sortableKeyboardCoordinates=Zz;exports.supportsLiveNumericPresentation=Bv;exports.supportsMetricTransformForMetric=Qhe;exports.supportsTableConditionalFormatting=kpe;exports.toEntityArray=Ua;exports.ue=it;exports.updateBriefing=rT;exports.useActiveExports=kNe;exports.useActiveToolStatus=Ybe;exports.useAddFrameWithFreshSemanticExecutionPayload=cz;exports.useAddNewFrame=ohe;exports.useAssistantContainer=tJ;exports.useAssistantContextEntities=fT;exports.useAssistantLayoutStore=Ch;exports.useAssistantPanel=JQ;exports.useAssistantProfile=Dbe;exports.useAutoSubmitQueue=Gbe;exports.useBrandStudioPreview=wIt;exports.useBriefingRunPolling=mF;exports.useBriefingUiCapabilities=Yfe;exports.useCalendarContext=s4e;exports.useCard=t$e;exports.useCardNumericPresentation=Na;exports.useCardSummary=Q$;exports.useChartNumericPresentation=Nb;exports.useChat=mbe;exports.useColumns=Jz;exports.useCreateVisualWithFrame=fSe;exports.useCurrentUserInfo=Xs;exports.useCustomVisual=mf;exports.useCustomVisualsQuery=q$;exports.useDashboardAppearance=ku;exports.useDashboardById=ZX;exports.useDashboardInteractionMode=$ue;exports.useDashboardPreferences=Dm;exports.useDashboardQuery=zv;exports.useDashboardStructuralParticipants=Zme;exports.useDashboardSummary=Cue;exports.useDataColumns=tme;exports.useDateFilterHook=eYe;exports.useDefaultDashboardMutation=HX;exports.useDisplayPreferences=rl;exports.useDroppable=Ihe;exports.useEditorAside=kT;exports.useEditorCardQuery=mb;exports.useEffectiveEditorCardType=sB;exports.useEnsureReactGlobals=_le;exports.useExportActions=nJ;exports.useExportStore=oI;exports.useFieldManagement=eme;exports.useFilterableFields=Ghe;exports.useFullscreenAssistant=eJ;exports.useGroupMembers=m1e;exports.useGroups=a5;exports.useHasDashboardId=rJ;exports.useInProgressExportsCount=INe;exports.useJoinabilityMap=t4;exports.useManagementActions=Nm;exports.useManagementStore=ks;exports.useMutation=js;exports.usePivotTableConfig=Vm;exports.usePluginQuery=uue;exports.useQuery=Vn;exports.useQueryClient=Vr;exports.useReactTable=m_;exports.useResolveExistingFrameSemanticExecutionPayload=qet;exports.useResolvedValueFormatPreferences=i4e;exports.useResourceManagement=n5;exports.useResourceUpdateState=XX;exports.useScopedFields=Khe;exports.useSelectedVisual=f0e;exports.useSemaphorContext=Tt;exports.useSensor=tb;exports.useSensors=gT;exports.useSortable=ex;exports.useStarredChartsStore=p_t;exports.useSurfaceAppearance=oc;exports.useTableQueryState=Goe;exports.useTextFilterHook=TUe;exports.useTheme=hO;exports.useTimezone=il;exports.useTopoJson=Nw;exports.useUnifiedUsers=nI;exports.useUpdateResource=WX;exports.useUpdateVisualMutation=hSe;exports.useUserPreferences=yQ;exports.useVisualById=Xk;exports.useVisualManagement=dSe;exports.validateBriefingFormDraft=hF;exports.validateFieldForChartType=Zhe;exports.verticalListSortingStrategy=Yz;
1395
+ `).trim(),I=j.map((T,_)=>{var A,F;let E="",D;if((A=T.url)!=null&&A.startsWith("data:")){const P=T.url.match(/data:[^;]+;base64,(.+)/);P&&(E=P[1],(F=T.mediaType)!=null&&F.startsWith("image/")&&(D=T.url))}return{id:`${e.id||t}-file-${_}`,name:T.filename||`File ${_+1}`,size:0,type:T.mediaType||"application/octet-stream",data:E,preview:D}});return l.jsx(Fkt,{text:k||void 0,files:I.length>0?I:void 0})}const f=((C=e.parts)==null?void 0:C.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(du,{className:"space-y-2",defaultOpen:!1,children:[l.jsx(fu,{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(At.ChevronRight,{className:"h-3 w-3 transition-transform duration-200 group-data-[state=open]:rotate-90"}),l.jsx("span",{className:m?"animate-pulse":"",children:m?"Reasoning":"Show reasoning"}),g.length>1&&l.jsxs("span",{className:"font-mono tabular-nums text-muted-foreground/70",children:["(",g.length," steps)"]})]})}),l.jsx(hu,{children:l.jsx("ol",{className:"space-y-2 border-l border-border/60 pl-3",children:g.map((N,j)=>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:j+1}),l.jsx(AG,{className:"text-[12px] leading-[1.55] text-muted-foreground",text:N.text})]},`${e.id||t}-reasoning-${j}`))})})]},`${e.id||t}-reasoning`):null,x=(S=e.parts)==null?void 0:S.map((N,j)=>{var I;const k=`${e.id||t}-${j}`;switch(N.type){case"text":{const T=typeof N.text=="string"?N.text:JSON.stringify(N.text??"",null,2);if(e.role==="assistant"){const{cleanedText:_,quickReplies:E}=Mkt(T),D=_.trim().length>0;return l.jsxs("div",{className:"space-y-2.5",children:[D&&l.jsx(AG,{text:_,handleRun:i,onAddToDashboard:o,messageId:e.id,messages:n}),E.length>0&&a&&d&&l.jsxs("div",{className:"space-y-1.5",children:[E.length>=3&&l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Suggested next steps"}),l.jsx("div",{className:"flex flex-wrap gap-1",children:E.map(({label:A,value:F},P)=>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:A})})}),l.jsx(p.TooltipContent,{side:"top",align:"center",children:l.jsx("p",{className:"max-w-xs text-xs",children:F})})]},`${k}-qr-${P}`))})]})]},k)}return e.role==="system"&&s?l.jsx(Okt,{text:T},k):null}case"error":{const T=N,_=T.errorText??T.error??T.message;return l.jsx("div",{className:"my-4",children:l.jsx(tB,{errorMessage:_})},k)}case"reasoning":return null;default:return((I=N.type)!=null&&I.startsWith("tool-")||N.type==="dynamic-tool")&&eB(N,r)?l.jsx(Si,{FallbackComponent:({error:T,resetErrorBoundary:_})=>l.jsx(Pkt,{error:T,resetErrorBoundary:_}),children:l.jsx(Ikt,{part:N,idx:k,messageId:e.id,showTools:r,onAddToDashboard:o,messages:n})},k):null}});return e.role==="assistant"?fxe(e,r)?l.jsxs(dxe,{who:"Assistant",className:"space-y-2",children:[b,x]}):null:l.jsxs("div",{className:"space-y-2",children:[b,x]})}const Bkt=8,Vkt=24,Hkt=20;function qkt(e,t,n,r){return e==="error"&&t?!0:r?!1:!!(n||e==="submitted"||e==="streaming")}function hxe({messages:e,showTools:t=!1,showSystemMessage:n=!1,handleRun:r,onAddToDashboard:o,onQuickReply:s,disableQuickReplies:i=!1,status:a,errorMessage:c,activeToolText:u,className:d,rowContentClassName:f,statusClassName:h,latestButtonClassName:m,scrollToEndSignal:g=0}){const b=v.useRef(null),x=v.useRef(null),y=v.useRef(e.length),w=v.useRef(!1),C=v.useRef(null),S=v.useRef(!1),N=v.useRef(g),[j,k]=v.useState(!0),[I,T]=v.useState(0),[_,E]=v.useState(Vkt);N.current!==g&&(N.current=g,S.current=!0);const D=e[e.length-1],A=fxe(D,t),F=qkt(a,c,u,A),P=C_({count:e.length,getScrollElement:()=>b.current,estimateSize:U=>{const M=e[U];return(M==null?void 0:M.role)==="user"?88:180},getItemKey:U=>{const M=e[U];return(M==null?void 0:M.id)||`message-${U}`},anchorTo:"end",followOnAppend:!0,scrollEndThreshold:Bkt,overscan:6,gap:20,paddingEnd:F?_+Hkt:0,useAnimationFrameWithResizeObserver:!0,onChange:U=>{const M=U.isAtEnd();k(q=>q===M?q:M),M&&T(0)}}),O=v.useCallback((U="smooth")=>{C.current!==null&&cancelAnimationFrame(C.current),C.current=requestAnimationFrame(()=>{C.current=null,P.scrollToEnd({behavior:U})}),T(0),k(!0)},[P]);v.useLayoutEffect(()=>{w.current||(w.current=!0,O("auto"))},[O]),v.useLayoutEffect(()=>{S.current&&(S.current=!1,O("auto"))},[e.length,g,O]),v.useEffect(()=>{const U=y.current;y.current=e.length,e.length>U&&!P.isAtEnd()&&T(M=>M+e.length-U),e.length===0&&(T(0),k(!0),w.current=!1,S.current=!1)},[e.length,P]);const $=P.getVirtualItems(),B=P.getTotalSize();return v.useEffect(()=>()=>{C.current!==null&&cancelAnimationFrame(C.current)},[]),v.useLayoutEffect(()=>{const U=x.current;if(!U||!F)return;const M=()=>{const W=Math.ceil(U.getBoundingClientRect().height);W>0&&E(R=>R===W?R:W)};if(M(),typeof ResizeObserver>"u")return;const q=new ResizeObserver(M);return q.observe(U),()=>q.disconnect()},[F,a,c,u]),l.jsxs(l.Fragment,{children:[l.jsx(sl,{"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:B},children:[$.map(U=>{const M=e[U.index];return M?l.jsx("div",{ref:P.measureElement,"data-index":U.index,className:"absolute left-0 top-0 w-full",style:{transform:`translateY(${U.start}px)`},children:l.jsx("div",{className:p.cn("min-w-0",f),children:l.jsx(zkt,{message:M,messageIndex:U.index,messages:e,showTools:t,showSystemMessage:n,handleRun:r,onAddToDashboard:o,onQuickReply:s,disableQuickReplies:i})})},U.key):null}),F&&l.jsx("div",{ref:x,className:p.cn("absolute left-0 top-0 w-full",h),style:{transform:`translateY(${Math.max(B-_,0)}px)`},children:l.jsx("div",{className:p.cn("min-w-0",f),children:l.jsx(Lkt,{status:a,errorMessage:c,activeToolText:u})})})]})}),!j&&l.jsxs("button",{type:"button",onClick:()=>O("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(Yo,{className:"h-3 w-3"}),"Latest",I>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:I>9?"9+":I})]})]})}function Ukt(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 Wkt=[{title:"Show top 3 insights",subtitle:"from this dataset"},{title:"Create a bar chart for",subtitle:"sales by product category"}];function Kkt({open:e,setOpen:t,isFullscreen:n,onFullscreenChange:r,fullscreenContainer:o}){const[s,i]=v.useState(!1),[a,c]=v.useState(p.isDevEnv),[u,d]=v.useState(!1),[f,h]=v.useState("auto"),[m,g]=v.useState(!1),[b,x]=v.useState(!1),[y,w]=v.useState(0),C=n??b,{isLocalDev:S,isConsoleMode:N}=Dm(),j=S||N||a,k=v.useRef(null);p.useDashboardStore(se=>se.dashboard.aiScopeTables),p.useDashboardStore(se=>se.isDashboardEditing);const I=p.useDashboardStore(se=>se.selectedSheetId),{setDataSource:T}=p.useEditorActions(),{setSelectedFrameId:_,setIsDashboardEditing:E}=p.useDashboardActions(),D=cz(),{clearAssistantMessageContexts:A}=p.useAIActions(),{clearQueue:F}=p.useQueueActions(),{clearFileAttachments:P,getFileAttachments:O}=p.useFileActions(),$=p.useFileAttachments("dashboard"),B=p.useEditorStore(se=>se.card.dataSource),{assistantProfile:U}=Dbe(),M=p.useDashboardStore(se=>se.handleOpenAssistantProfile),{selectedEntities:q,applyDashboardDefaultEntities:W}=fT("dashboard"),{sendMessage:R,isLoading:Z,messages:X,setMessages:Y,status:G,stop:z,errorMessage:V,clearError:L}=QNt({dynamicVisualMode:f}),H=v.useCallback(()=>{w(se=>se+1)},[]),K=v.useCallback(se=>{r==null||r(se),n===void 0&&x(se)},[n,r]),Q=v.useCallback(()=>{K(!C)},[C,K]);v.useEffect(()=>{if(!C)return;function se(pe){pe.key==="Escape"&&K(!1)}return window.addEventListener("keydown",se),()=>{window.removeEventListener("keydown",se)}},[C,K]);const[ne,ae]=v.useState(""),ce=se=>{ae(se.target.value)};async function ie({sql:se,cardTitle:pe,connectionId:Fe,cardType:Le,python:$e,cardConfig:Me,dataSource:be,customVisualPreferences:ke,visualizationMode:Oe,dynamicCardPreferences:Ve}){if(!I)return;const Xe=Oe==="dynamic",ve=vi.hasValidCardConfig(Me),Ye=Fe||(be==null?void 0:be.connectionId)||"",_e=be?{...be,connectionId:Ye||be.connectionId,connectionType:be.connectionType||"",mode:be.mode||"database",selectedEntities:be.selectedEntities||[]}:Ye?{connectionId:Ye,connectionType:"",mode:"database",selectedEntities:[]}:ob,Ze=!(ve&&(!Xe||(Ve==null?void 0:Ve.provenance)==="card-config"||(Ve==null?void 0:Ve.provenance)==="query_spec")),Pe=Ze?Ukt(se):"",Je=Ze?$e:"",st={id:p.v4(),title:pe||"Title",preferences:{onClickFilter:[{columnIndex:0,expression:""}],chartOptions:{indexAxis:Le==="horizontalBar"?"y":"x"},...Xe&&{displayOptions:{showChrome:!1,allowScroll:!1}}},type:Le,sql:Pe,python:Je,dataSource:_e,config:Me,connectionId:Ye,visualizationMode:Oe,dynamicCardPreferences:Ve,customCardPreferences:ke?{url:ke.url,componentName:ke.componentName,pluginChartType:ke.pluginChartType,settings:ke.settings,type:"component"}:void 0},kt={id:p.v4(),cards:[st],activeCardId:st.id};try{await D(I,kt,"end"),E(!0),_(kt.id)}catch(yt){console.error("Failed to add assistant visual to dashboard:",yt),it.error(yt instanceof Error?yt.message:"Failed to prepare semantic metadata for the new visual")}}const oe=se=>{se.preventDefault();const pe=ne.trim();if(!pe&&$.length===0)return;const Fe=[];pe&&Fe.push({type:"text",text:pe}),$.forEach(Le=>{Le.data&&Fe.push({type:"file",mediaType:Le.type,filename:Le.name,url:`data:${Le.type};base64,${Le.data}`})}),R({role:"user",parts:Fe}),ae(""),P("dashboard"),H()};v.useEffect(()=>{var se;e&&((se=k.current)==null||se.focus())},[e]),Gbe({assistantType:"dashboard",status:G,isLoading:Z,sendMessage:R});const{hasActiveTools:le,activeToolText:fe}=Ybe(X);function he(se){const pe={role:"user",parts:[{type:"text",text:se.title+" "+se.subtitle}]};R(pe),H()}function Ce(se){R({role:"user",parts:[{type:"text",text:se}]}),H()}function xe(se){R({role:"user",parts:[{type:"text",text:se}]}),H()}const Se=v.useCallback(async()=>{const se=JSON.stringify(X??[],null,2);try{if(typeof navigator>"u"||!navigator.clipboard)throw new Error("Clipboard API unavailable");await navigator.clipboard.writeText(se),it.success("Conversation copied")}catch(pe){console.error("Failed to copy conversation",pe),it.error("Unable to copy conversation")}},[X]),de=(ne==null?void 0:ne.length)===0&&(X==null?void 0:X.filter(se=>se.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 J(){return l.jsxs(zo,{children:[l.jsx(Bo,{asChild:!0,children:l.jsx(Gc,{className:"h-7 p-2 text-muted-foreground hover:text-foreground",children:l.jsx(km,{className:"size-3.5"})})}),l.jsxs(Io,{align:"end",children:[l.jsx(La,{children:"Options"}),l.jsx(xa,{}),l.jsx(Wu,{checked:s,onCheckedChange:i,children:"Token Usage"}),l.jsx(Wu,{checked:a,onCheckedChange:c,children:"Tool Invocations"}),l.jsx(Wu,{checked:u,onCheckedChange:d,children:"System Message"}),(S||N)&&l.jsxs(l.Fragment,{children:[l.jsx(xa,{}),l.jsx(La,{children:"Dynamic Visuals"}),l.jsx(Wu,{checked:f==="auto",onCheckedChange:()=>h("auto"),children:"Auto"}),l.jsx(Wu,{checked:f==="force",onCheckedChange:()=>h("force"),children:"Force Dynamic"}),l.jsx(Wu,{checked:f==="off",onCheckedChange:()=>h("off"),children:"Disable Dynamic"})]})]})]})}const re=l.jsxs("div",{"data-role":"dashboard-assistant",className:p.cn("relative flex h-full grow flex-col break-words bg-background",C&&"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(),M&&l.jsxs("button",{type:"button",onClick:M,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:(U==null?void 0:U.name)||"Default profile"})]}),l.jsxs("div",{"data-role":"header-actions",className:"ml-auto flex items-center gap-0.5",children:[N&&J(),j&&l.jsx(p.Button,{variant:"ghost",size:"sm",className:"h-6 px-1.5 text-[11px] text-muted-foreground hover:text-foreground",onClick:Se,children:"Copy Conversation"}),l.jsx(Gc,{className:"grid h-6 w-6 place-items-center rounded-[4px] p-0 text-muted-foreground hover:bg-muted hover:text-foreground",tooltip:C?"Exit fullscreen":"Expand",onClick:Q,children:C?l.jsx(At.Minimize2,{className:"h-3.5 w-3.5"}):l.jsx(At.Maximize2,{className:"h-3.5 w-3.5"})}),l.jsx(Gc,{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 se=X.filter(pe=>pe.role==="assistant").map(pe=>pe.id).filter(pe=>!!pe);Y([]),F("dashboard"),L(),A(se)},children:l.jsx(BO,{className:"h-3.5 w-3.5"})}),l.jsx(Gc,{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(je.X,{className:"h-3.5 w-3.5"})})]})]}),l.jsx(hxe,{messages:X,showTools:a,showSystemMessage:u,onAddToDashboard:ie,onQuickReply:xe,disableQuickReplies:Z,status:G,errorMessage:V,activeToolText:Z&&le?fe:void 0,className:p.cn(C?"px-6 py-5":"px-3 py-3"),rowContentClassName:p.cn(C&&"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:[!U&&de&&l.jsx(lge,{onClick:he,placeholders:Wkt}),de&&U&&l.jsx(Mbe,{seedQuestions:U.seedQuestions||[],handleSeedQuestionClick:Ce}),l.jsx(Kbe,{assistantType:"dashboard"}),l.jsx(J4,{ref:k,setInput:ae,stop:z,input:ne,handleInputChange:ce,handleSubmit:se=>{oe(se)},isLoading:Z,status:G,assistantType:"dashboard",onFocus:()=>{}})]}),l.jsx(Q4,{incomingSelectedEntities:q,open:m,onOpenChange:g,dataSource:B||ob,dialogMode:"aiContext",saveAsDashboardDefault:!0,onSaveSelectedEntities:se=>W()})]});return C&&o?pr.createPortal(l.jsx(Wb,{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:re})}),o):re}function Gkt(e){const t=e.current,{getSelectedFrame:n,setSelectedFrameId:r}=p.useDashboardActions(),o=Lue(),s=p.useDashboardStore(d=>d.dashboard.sheets),a=p.useDashboardStore(d=>d.selectedSheetId)??(s==null?void 0:s[0].id),c=p.useDashboardStore(d=>d.isDashboardEditing),u=p.useDashboardStore(d=>d.isVisualEditing);v.useEffect(()=>{if(!c||u)return;async function d(m){if(Ykt(m.target))return;const g=m.ctrlKey||m.metaKey;g&&m.key==="c"?(await f(),it.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=Zkt(m);if(g!=null&&g.id){const b=Pue(g),x=b.cards.findIndex(y=>y.id===b.activeCardId);x!==-1&&(b.cards[x].title=`${b.cards[x].title} (Copy)`),await o(a,b),r(b.id),it.success("Card pasted from clipboard")}return m}catch(m){return console.error("Failed to paste text:",m),null}}return t==null||t.addEventListener("keydown",d),()=>t==null?void 0:t.removeEventListener("keydown",d)},[o,n,r,a,c,u,t])}function Ykt(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 Zkt(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 Xkt(e,t){switch(e.interactionMode){case"drillToDetail":Qkt(e,t);break;case"drillThrough":Jkt(e,t);break;case"drillToURL":eIt(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 Qkt(e,t){var c;const{targetInsightId:n,contextMode:r,displayMode:o,filterGroups:s}=e;if(!n){console.warn("drillToDetail event missing targetInsightId");return}const i=r||"full";let a=[];switch(i){case"interactionFilters":a=s.flatMap(u=>u.filters);break;case"full":{const u=((c=t.getCurrentFilters)==null?void 0:c.call(t))||[],d=s.flatMap(f=>f.filters);a=[...u,...d];break}case"none":default:a=[];break}o==="replace-card"?t.replaceCardContent({cardId:e.sourceCardId,insightId:n,filters:a,contextMode:r}):t.openInsightModal({insightId:n,filters:a,contextMode:r})}function Jkt(e,t){var u,d;const{targetDashboardId:n,contextMode:r="interactionFilters",filterGroups:o,sourceCardId:s}=e;if(!n){console.warn("[DrillThrough] Event missing targetDashboardId. This interaction needs to be reconfigured with a target dashboard.",e);return}const i=o.flatMap(f=>f.filters),a=((u=t.getCurrentDashboardId)==null?void 0:u.call(t))||"",c=(d=t.getCurrentDashboardTitle)==null?void 0:d.call(t);t.setGlobalDrillContext&&t.setGlobalDrillContext({filters:i,contextMode:r,sourceDashboardId:a,sourceDashboardTitle:c,targetDashboardId:n}),t.setPendingDrillThrough&&t.setPendingDrillThrough({targetDashboardId:n,sourceDashboardId:a,sourceDashboardTitle:c,filters:i,contextMode:r})}function eIt(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 tIt({open:e,onOpenChange:t,insightId:n,filters:r,filterDefinitions:o,contextMode:s,cardTitle:i,cardDescription:a}){return l.jsx(_o,{open:e,onOpenChange:t,children:l.jsxs(mo,{className:"flex max-h-[90vh] max-w-[90vw] flex-col gap-0 overflow-hidden p-0",children:[l.jsxs(Is,{className:"space-y-1 border-b border-border px-5 pb-3.5 pt-4 text-left",children:[l.jsx(po,{className:"text-[15px] font-semibold tracking-tight",children:i||"Insight detail"}),l.jsx(To,{className:"text-[12px] leading-[1.5] text-muted-foreground",children:a||"View detailed insight data with applied filters"})]}),l.jsx(Hue,{filters:r,filterDefinitions:o,contextMode:s}),l.jsx("div",{className:"h-[400px] min-h-0 flex-1 overflow-auto px-5 py-4",children:n?l.jsx(Qfe,{insightId:n,filters:r,contextMode:s}):l.jsx("div",{className:"flex items-center justify-center p-12 text-[13px] text-muted-foreground",children:"No insight selected"})})]})})}function nIt(){const e=p.useInteractionStore(S=>S.interactionStates),t=p.useInteractionStore(S=>S.setInteractionState),n=p.useInteractionStore(S=>S.clearLastInteractionEvent),r=p.useInteractionStore(S=>S.replaceCardWithInsight),o=p.useInteractionStore(S=>S.setPendingDrillThrough),s=p.useInteractionStore(S=>S.pendingDrillThrough),i=p.useInteractionStore(S=>S.clearPendingDrillThrough),{setSelectedSheetId:a,navigateWithDrill:c}=p.useDashboardActions(),{selectDashboard:u}=Nm(),d=p.useDashboardStore(S=>S.dashboard),f=p.useDashboardStore(S=>S.filterValues),{data:h,isLoading:m}=ZX((s==null?void 0:s.targetDashboardId)||"",{enabled:!!(s!=null&&s.targetDashboardId)}),[g,b]=v.useState({open:!1,insightId:""}),x=Jfe(g.insightId,{enabled:g.open&&!!g.insightId}),y=v.useRef(new Set),w=v.useMemo(()=>({setSelectedSheetId:a,openInsightModal:({insightId:S,filters:N,contextMode:j})=>{b({open:!0,insightId:S,filters:N,filterDefinitions:(d==null?void 0:d.filters)||[],contextMode:j})},replaceCardContent:({cardId:S,insightId:N,filters:j,contextMode:k})=>{r(S,N,j,k)},getCurrentFilters:()=>f||[],navigateWithDrill:c,getCurrentDashboardId:()=>(d==null?void 0:d.id)||"",getCurrentDashboardTitle:()=>d==null?void 0:d.title,setPendingDrillThrough:o,setGlobalDrillContext:({filters:S,contextMode:N,sourceDashboardId:j,sourceDashboardTitle:k,targetDashboardId:I})=>{const T={filters:S},_={sourceCardId:p.DRILL_CONTEXT_CARD_ID,interactionMode:"clickFilter",filterGroups:[T]},E={...p.createInitialInteractionState(),appliedClickFilters:[_],contextMode:N,sourceDashboardId:j,sourceDashboardTitle:k,targetDashboardId:I};t(p.DRILL_CONTEXT_CARD_ID,E)}}),[a,r,f,c,d,o,t]);v.useEffect(()=>{Object.entries(e).forEach(([S,N])=>{if(N!=null&&N.lastInteractionEvent){const j=N.lastInteractionEvent,k=`${S}-${j.interactionMode}-${j.sourceCardId}-${Date.now()}`;if(y.current.has(k))return;y.current.add(k);try{Xkt(j,w)}catch(I){console.error("Error executing interaction event:",I)}finally{n(S),setTimeout(()=>{y.current.delete(k)},5e3)}}})},[e,n,w]),v.useEffect(()=>{if(!(!s||!h||m))try{u(h),c(s.targetDashboardId,s.sourceDashboardId,s.sourceDashboardTitle,s.filters,s.contextMode),i()}catch(S){console.error("[DrillThrough] Error during automatic navigation:",S),i()}},[s,h,m,u,c,i]);const C=()=>{b({open:!1,insightId:""})};return l.jsxs(l.Fragment,{children:[l.jsx(tIt,{open:g.open,onOpenChange:C,insightId:g.insightId,filters:g.filters,filterDefinitions:g.filterDefinitions,contextMode:g.contextMode,cardTitle:x.title,cardDescription:x.description}),s&&m&&l.jsx("div",{className:"fixed inset-0 z-[51] flex items-center justify-center bg-background/80 backdrop-blur-sm",children:l.jsxs("div",{className:"flex flex-col items-center gap-2.5 rounded-[6px] border border-border/60 bg-background px-4 py-3 shadow-sm",children:[l.jsx(p.LoaderCircle,{className:"h-5 w-5 animate-spin text-muted-foreground/60"}),l.jsx("div",{className:"text-[12px] text-muted-foreground",children:"Loading dashboard..."})]})})]})}function rIt(e){return e.length===0?"":e.map(t=>{const n=t.field.label||t.field.name,r=t.operator,o=oIt(dz(t));return r==="="?`${n} = ${o}`:`${n} ${r} ${o}`}).join(", ")}function oIt(e){return e==null?"null":Array.isArray(e)?e.join(", "):typeof e=="object"&&e.toString?e.toString():String(e)}function sIt(e){return e?`Back to ${e}`:"Back"}function iIt(){var y,w,C,S,N;const e=p.useInteractionStore(j=>j.interactionStates[p.DRILL_CONTEXT_CARD_ID]),t=p.useDashboardStore(j=>j.actions.goBackFromDrill),n=p.useDashboardStore(j=>j.actions.clearDrillContext),{selectDashboard:r}=Nm(),[o,s]=v.useState({x:16,y:16}),[i,a]=v.useState(!1),c=v.useRef({x:0,y:0});v.useEffect(()=>{if(!i)return;const j=I=>{s({x:I.clientX-c.current.x,y:I.clientY-c.current.y})},k=()=>{a(!1)};return document.addEventListener("mousemove",j),document.addEventListener("mouseup",k),()=>{document.removeEventListener("mousemove",j),document.removeEventListener("mouseup",k)}},[i]);const u=e==null?void 0:e.sourceDashboardId,d=e==null?void 0:e.sourceDashboardTitle,f=((S=(C=(w=(y=e==null?void 0:e.appliedClickFilters)==null?void 0:y[0])==null?void 0:w.filterGroups)==null?void 0:C[0])==null?void 0:S.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(j){console.error("[DrillBack] Error during back navigation:",j)}},g=()=>{n()},b=j=>{j.target.closest("button")||(a(!0),c.current={x:j.clientX-o.x,y:j.clientY-o.y})};rIt(f);const x=sIt(d);return l.jsx("div",{className:"fixed z-50 max-w-md",style:{left:0,top:0,transform:`translate(${o.x}px, ${o.y}px)`,transition:i?"none":void 0},children:l.jsxs("div",{className:"select-none rounded-lg border bg-background/95 p-3 shadow-lg backdrop-blur-sm",onMouseDown:b,style:{cursor:i?"grabbing":"grab"},children:[l.jsxs("div",{className:"mb-3 flex items-start justify-between gap-2",children:[l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Viewing:"}),l.jsx("div",{className:"flex flex-wrap gap-2",children:f.map((j,k)=>{const I=j.field.label||j.field.name,T=String(j.value);return l.jsxs(fi,{variant:"secondary",className:"pointer-events-none text-xs",children:[I," = ",T]},k)})})]}),l.jsx(p.Button,{variant:"ghost",size:"sm",onClick:g,className:"h-6 w-6 cursor-pointer p-0",title:"Clear drill context",children:l.jsx(je.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(Wv,{className:"mr-2 h-4 w-4"}),x]})})]})})}function aIt(e,t){return typeof e=="boolean"?e:typeof t=="boolean"?t:!1}function lIt({filter:e,isEditing:t=!1,disabled:n=!1,storageOptions:r,settingsVariant:o,filterQueryContext:s,inputVariableName:i,reservedInputVariableNames:a,onUpdateFilter:c,onRemoveFilter:u}){const{attributes:d,listeners:f,setNodeRef:h,transform:m,transition:g,isDragging:b}=ex({id:`filter:${e.id}`,disabled:n||!t}),x={transform:qi.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(W$,{filter:e,isEditing:t,dragListeners:t?f:void 0,storageOptions:r,settingsVariant:o,filterQueryContext:s,inputVariableName:i,reservedInputVariableNames:a,onUpdateFilter:c,onRemoveFilter:u})})}const HG="text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",cIt=[];function mxe({open:e,onOpenChange:t}){const[n,r]=v.useState(!1),[o,s]=v.useState(!1),[i,a]=v.useState({sheetSelection:"current",protectPdf:!1,password:""}),c=p.useDashboardStore(Y=>{var G;return(G=Y.dashboard)==null?void 0:G.sheets}),u=p.useDashboardStore(Y=>Y.dashboard),d=p.useDashboardStore(Y=>Y.dashboardInputValues),f=p.useDashboardStore(Y=>Y.filterValues),h=p.useDashboardStore(Y=>Y.controlValues),m=p.useDashboardStore(Y=>Y.inlineFilterValuesMap),g=p.useDashboardStore(Y=>Y.cardControlValuesMap),b=p.useDashboardStore(Y=>Y.selectedSheetId),x=p.useDashboardStore(Y=>Y.selectedSheetId?Y.documentInputRuntimeBySheetId[Y.selectedSheetId]:void 0),y=p.useDashboardStore(Y=>Y.isDownloadingPdf),w=p.useDashboardStore(Y=>Y.reportContext),{authToken:C,tokenProps:S}=Tt(),N=c==null?void 0:c.find(Y=>Y.id===b),j=v.useMemo(()=>p.getDashboardExportSheets(c),[c]),k=p.isDocumentSheet(N),I=k&&N?N.document:void 0,T=v.useMemo(()=>k&&N?nx(u,N.id):[],[N,k,u]),_=T.length>0,E=v.useMemo(()=>k&&N?Ope(u,N.id):!1,[N,k,u]),D=v.useMemo(()=>_?T.map(yC):(I==null?void 0:I.inputs)||cIt,[I,T,_]),A=w==null?void 0:w.calendar.tz,F=v.useMemo(()=>Pme(D),[D]),P=v.useMemo(()=>Rme(D,A),[D,A]),O=v.useMemo(()=>Ame(D),[D]),$=x?x.filterValuesByInputId:P,B=x?x.controlValuesByInputId:O,U=v.useMemo(()=>k?E&&N&&I?tZ({dashboard:u,sheetId:N.id,sheetKind:"document",sectionIds:I.sections.map(Y=>Y.id),mode:"document",runtimeValues:{dashboardInputValues:d,filterValues:f,controlValues:h,inlineFilterValuesMap:m,cardControlValuesMap:g},timezone:A}):Lme(D,$,B,F,F):[],[I,D,N,k,u,g,h,f,m,d,B,$,F,A,E]),M=!!N,q=j.length>0,W=((c==null?void 0:c.length)||0)>1||k,R=i.sheetSelection==="current"&&(!M||k&&U.length>0)||i.sheetSelection==="all"&&!q;v.useEffect(()=>{e&&i.sheetSelection==="all"&&!q&&a(Y=>({...Y,sheetSelection:"current"}))},[q,e,i.sheetSelection]);const Z=()=>{a({sheetSelection:"current",protectPdf:!1,password:""}),r(!1),t(!1)};async function X(){if(y){it.error("A PDF export is already in progress");return}if(i.protectPdf&&!i.password){it.error("Please enter a password to protect the PDF");return}if(i.sheetSelection==="current"&&!M){it.error("No sheet is selected to export");return}if(i.sheetSelection==="all"&&!q){it.error("No dashboard sheets are available to export");return}s(!0);const Y=i.sheetSelection==="current"&&k,G=Y?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",z=it.loading(G);try{if(Y){if(!I||!N)throw new Error("Selected document sheet is missing document data");if(U.length>0){it.dismiss(z),it.error(`Set ${U.join(", ")} before exporting`);return}const L=new Date().toISOString(),H=E?nZ({dashboard:u,sheetId:N.id,sheetKind:"document",sectionIds:I.sections.map(K=>K.id),mode:"document",runtimeValues:{dashboardInputValues:d,filterValues:f,controlValues:h,inlineFilterValuesMap:m,cardControlValuesMap:g},generatedAt:L,timezone:A}).snapshot:void 0;await mL(S.apiServiceUrl,C,{sheetId:N.id,title:N.title||"Document",pageSize:I.page.size,orientation:I.page.orientation,timezone:A,password:i.protectPdf?i.password:void 0,inputSnapshot:H,...H?{}:{inputValues:{sheetId:N.id,filterValuesByInputId:$,controlValuesByInputId:B,generatedAt:L}}})}else{const L=hoe();await ote(S.apiServiceUrl,C,i.protectPdf?i.password:void 0,i.sheetSelection,L)}it.dismiss(z);const V=Y?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!";it.success(V,{duration:2e3}),Z()}catch(V){it.dismiss(z),it.error("Failed to download PDF",{description:OI(V,"Please try again or contact support."),descriptionClassName:FI,closeButton:!0,duration:1/0,richColors:!0}),console.error("PDF download error:",V)}finally{s(!1)}}return l.jsx(_o,{open:e,onOpenChange:Y=>{if(!Y){Z();return}t(!0)},children:l.jsxs(mo,{className:"rounded-control border-border/60 sm:max-w-[440px] sm:rounded-control",children:[l.jsxs(Is,{children:[l.jsx(po,{className:"text-[15px]",children:k?"Export document":"Export dashboard"}),l.jsx(To,{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:[W&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(p.Label,{className:HG,children:"Export scope"}),l.jsxs(Xa,{value:i.sheetSelection,onValueChange:Y=>a({...i,sheetSelection:Y}),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",!M&&"cursor-not-allowed opacity-50 hover:bg-transparent"),children:[l.jsx(ys,{value:"current",id:"scope-current",disabled:!M}),k?"This document":"This sheet"," (",(N==null?void 0:N.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",!q&&"cursor-not-allowed opacity-50 hover:bg-transparent"),children:[l.jsx(ys,{value:"all",id:"scope-all",disabled:!q}),"Dashboard sheets (",j.length," ",j.length===1?"sheet":"sheets",")"]})]}),k&&l.jsx("p",{className:"text-[12px] leading-5 text-muted-foreground",children:U.length>0?`Set ${U.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(In,{id:"protect-pdf",checked:i.protectPdf,onCheckedChange:Y=>{a({...i,protectPdf:Y,password:Y?i.password:""}),Y||r(!1)}}),l.jsx(Gv,{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:HG,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:Y=>a({...i,password:Y.target.value}),placeholder:"Enter password",className:"pr-8",onKeyDown:Y=>{Y.key==="Enter"&&i.password&&X()}}),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(qk,{className:"h-3.5 w-3.5"}):l.jsx(At.Eye,{className:"h-3.5 w-3.5"})})]}),l.jsx("p",{className:"text-[12px] text-muted-foreground",children:"Recipients will need this password to open the PDF."})]})]})]}),l.jsxs(Ya,{children:[l.jsx(p.Button,{variant:"outline",size:"xs",onClick:Z,disabled:o,children:"Cancel"}),l.jsx(p.Button,{size:"xs",onClick:X,disabled:o||y||R,children:o?l.jsxs(l.Fragment,{children:[l.jsx(p.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Exporting…"]}):l.jsxs(l.Fragment,{children:[l.jsx(gu,{className:"h-3.5 w-3.5"}),"Export"]})})]})]})})}function pxe({iconClassName:e,open:t,onOpenChange:n}){const[r,o]=v.useState(!1),s=t!==void 0,i=s?t:r,a=u=>{s||o(u),n==null||n(u)},c=p.useDashboardStore(u=>u.isDownloadingPdf);return l.jsxs(l.Fragment,{children:[s?null:l.jsx(p.Button,{variant:"ghost",size:"sm",className:"h-7 p-2",disabled:c,onClick:()=>a(!0),children:l.jsx(gu,{className:p.cn("size-4",e)})}),l.jsx(mxe,{open:i,onOpenChange:a})]})}function qG(e,t,n){const r=new Set(t),o=[...n];return e.map(s=>r.has(s.id)?o.shift()??s.id:s.id)}function uIt({control:e,value:t,isEditing:n=!1,onChange:r}){const{attributes:o,listeners:s,setNodeRef:i,transform:a,transition:c,isDragging:u}=ex({id:`control:${e.id}`,disabled:!n}),d={transform:qi.Translate.toString(a),transition:c,opacity:u?.5:1,zIndex:u?10:void 0};return l.jsx("div",{ref:i,style:d,...o,children:l.jsx(tpe,{control:e,value:t,isEditing:n,dragListeners:n?s:void 0,onChange:r})})}function UG(e){var t;return(((t=e.values)==null?void 0:t.length)??0)>0||e.operation==="is null"||e.operation==="is not null"}function WG(e,t){return[...e.map(n=>`filter:${n.id}`),...t.map(n=>`control:${n.id}`)]}function dIt(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 WG(t,n);const o=e.filter(a=>r.has(a)),s=new Set(o),i=WG(t,n).filter(a=>!s.has(a));return[...o,...i]}function fIt(e,t){return p.getDashboardCardEntries({sheets:e.sheets||[]}).filter(n=>n.sheet.id===t).map(n=>n.card.id)}function hIt(e){return Uh(e.dashboardInput,{sheetId:e.selectedSheetId,sheetKind:"dashboard"})?!0:e.dashboardInput.scope.kind!=="cards"?!1:e.selectedSheetCardIds.some(t=>Uh(e.dashboardInput,{sheetId:e.selectedSheetId,cardId:t,sheetKind:"dashboard"}))}function X2(e){var t;return((t=e.compatibility)==null?void 0:t.source)!=="dashboardFilter"}function mIt(e){return gxe(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 gxe(e){if(!e.selectedSheetId)return[];const t=e.selectedSheetId,n=fIt(e.dashboard,t);return Hk(ib({dashboard:e.dashboard}).allInputs).filter(r=>!(r.kind!=="filter"||!hIt({dashboardInput:r,selectedSheetId:t,selectedSheetCardIds:n})))}function pIt(e,t){return"toolbar"}function gIt(){const e=oc("interactive"),t=p.useDashboardStore(V=>V.selectedSheetId),n=p.useDashboardStore(V=>V.dashboard.filters),r=p.useDashboardStore(V=>V.dashboard.filterLayout),o=p.useDashboardStore(V=>V.isDashboardEditing),s=p.useDashboardStore(V=>V.controlValues),i=p.useDashboardStore(V=>V.filterValues);p.useDashboardStore(V=>V.filteringCards);const a=p.useDashboardStore(V=>V.inlineFilterValuesMap),c=p.useDashboardStore(V=>V.dashboardInputValues),u=p.useInteractionStore(V=>V.clearAllClickFilters),d=p.useInteractionStore(V=>Object.entries(V.interactionStates).reduce((L,[H,K])=>{var Q;return H===p.DRILL_CONTEXT_CARD_ID?L:L+(((Q=K.appliedClickFilters)==null?void 0:Q.length)??0)},0)),f=p.useDashboardStore(V=>V.actions.removeCardInlineFilterValue),{reorderFilters:h,clearDashboardInputSlot:m,reorderDashboardControls:g,removeDashboardInput:b,setControlValue:x,setFilterLayout:y,setFilterValues:w,setFilteringCards:C,upsertDashboardInput:S}=p.useDashboardActions(),N=gT(tb(Qb,{activationConstraint:{distance:5}})),j=p.useDashboardStore(V=>V.dashboard),k=mIt({dashboard:j,selectedSheetId:t}).filter(V=>pIt(V.filter)==="toolbar"),I=gxe({dashboard:j,selectedSheetId:t}),T=k.map(V=>V.filter),_=new Map(k.map(V=>[`filter:${V.filter.id}`,V])),E=btt(j),D=E.filter(V=>!V.hidden&&av(V)==="toolbar"),A=E.filter(V=>!V.hidden&&av(V)==="advanced"),F=dIt(r==null?void 0:r.toolbarItemOrder,T,D),P=new Map(T.map(V=>[`filter:${V.id}`,V])),O=new Map(D.map(V=>[`control:${V.id}`,V]));function $(V){const{active:L,over:H}=V;if(!H||L.id===H.id)return;const K=String(L.id),Q=String(H.id),ne=F.findIndex(Ce=>Ce===K),ae=F.findIndex(Ce=>Ce===Q);if(ne===-1||ae===-1)return;const ce=Jb(F,ne,ae);y({toolbarItemOrder:ce});const ie=new Set((n||[]).map(Ce=>Ce.id)),oe=F.filter(Ce=>Ce.startsWith("filter:")).map(Ce=>Ce.replace("filter:","")).filter(Ce=>ie.has(Ce)),le=ce.filter(Ce=>Ce.startsWith("filter:")).map(Ce=>Ce.replace("filter:","")).filter(Ce=>ie.has(Ce)),fe=F.filter(Ce=>Ce.startsWith("control:")).map(Ce=>Ce.replace("control:","")),he=ce.filter(Ce=>Ce.startsWith("control:")).map(Ce=>Ce.replace("control:",""));h(qG(n||[],oe,le)),g(qG(j.controls||[],fe,he))}const B=(r==null?void 0:r.toolbarWrap)??!1,U=(r==null?void 0:r.showDownloadButton)??!1,M=I.filter(X2),q=I.filter(V=>{if(X2(V))return!1;const L=p.getDashboardInputRuntimeSlot(c,V,{sheetId:t});return(L==null?void 0:L.status)==="set"||(L==null?void 0:L.status)==="cleared"}),W=new Set([...M,...q].map(V=>V.filter.id)),R=(i==null?void 0:i.filter(V=>!W.has(V.filterId)&&UG(V)).length)??0,Z=[...M,...q],X=Z.filter(V=>{const L=p.hydrateAuthoredDashboardInputSlot({dashboard:j,input:V,runtimeValues:c,target:{sheetId:t}});return(L==null?void 0:L.status)==="set"&&L.value.kind==="filter"&&UG(L.value.filterValue)}).length,Y=a?Object.values(a).reduce((V,L)=>V+((L==null?void 0:L.length)??0),0):0,G=R+X+Y+d,z=()=>{w([]),Z.forEach(V=>{m(V,{sheetId:t})}),C([]),u(),a&&Object.entries(a).forEach(([V,L])=>{L==null||L.forEach(H=>{f(V,H.filterId)})})};return!T.length&&!D.length&&!A.length&&!U&&G===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(hC,{sensors:N,collisionDetection:uC,onDragEnd:$,children:l.jsxs("div",{className:p.cn("flex items-center",B?"flex-wrap":"w-0 min-w-full overflow-x-auto"),children:[l.jsx(mC,{items:F,strategy:Gz,children:l.jsx(BF,{className:"gap-3 pr-0",wrap:B,children:F.map(V=>{const L=P.get(V);if(L){const K=_.get(V),Q=K&&X2(K);return l.jsx(lIt,{filter:L,isEditing:o,storageOptions:Q?{storageTarget:"dashboardInput",dashboardInput:K,sheetId:t??void 0}:void 0,inputVariableName:Q?K.variableName:void 0,onUpdateFilter:Q?(ne,ae)=>{S({...K,variableName:(ae==null?void 0:ae.variableName)||K.variableName,filter:ne})}:void 0,onRemoveFilter:Q?()=>{w((i||[]).filter(ne=>ne.filterId!==L.id)),b(K.id)}:void 0},V)}const H=O.get(V);return H?l.jsx(uIt,{control:H,value:s==null?void 0:s[H.id],isEditing:o,onChange:K=>x(H.id,K)},V):null})})}),A.length>0&&l.jsx(Xue,{title:"",controls:A,values:s,onChange:(V,L)=>x(V.id,L),immediatePlacement:"toolbar",advancedLabel:"More controls"}),G>0&&l.jsxs("button",{type:"button",onClick:z,"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(je.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:G})]}),U&&l.jsx("div",{className:p.cn(G>0?"ml-1.5":"ml-auto"),children:l.jsx(pxe,{})})]})})})}function bxe(){var xe,Se;const{showAssistant:e,tokenProps:t,renderMode:n}=Tt(),r=aIt((xe=t.config)==null?void 0:xe.showDashboardAssistant,e),{preferences:o}=Dm(),s=(Se=o==null?void 0:o.cardDisplay)==null?void 0:Se.mode,i=rf(s),a=see({displayMode:s,renderMode:n}),c=v.useRef(null),u=v.useRef(null),[d,f]=v.useState(!1),{handleDragStart:h,isDraggingRef:m,getStyle:g,getPositionClasses:b}=z0t({initialPosition:"bottom-right"}),x=Ch(de=>de.setFullscreen),y=Ch(de=>de.setPanelOpen),w=Ch(de=>de.setContainer),C=JQ("dashboard"),S=eJ(),N=tJ("dashboard"),j=C.isOpen,k=S==="dashboard",I=p.useDashboardStore(de=>de.isVisualEditing),T=p.useDashboardStore(de=>de.themeStyle),_=ku(),E=p.useDashboardStore(de=>{var ee;return(ee=de.dashboard)==null?void 0:ee.sheets}),D=p.useDashboardStore(de=>de.showFilters),A=p.useDashboardStore(de=>de.isDashboardEditing),F=p.useDashboardStore(de=>de.selectedSheetId),P=E==null?void 0:E.find(de=>de.id===F),O=p.useDashboardStore(de=>{var ee,J,re;return(re=(J=(ee=de.dashboard)==null?void 0:ee.sheets)==null?void 0:J.find(se=>se.id===de.selectedSheetId))==null?void 0:re.kind}),$=p.useDashboardStore(de=>{var ee,J;return((J=(ee=de.dashboard)==null?void 0:ee.summary)==null?void 0:J.position)||"top"}),B=O==="document",U=p.useDashboardStore(de=>{var ee;return(ee=de.dashboard)==null?void 0:ee.id}),{getDefaultSheetId:M,setDefaultSheetId:q,clearDefaultSheetId:W}=RY(U),[R,Z]=v.useState(null),{setSelectedSheetId:X,setSheetTitle:Y,addSheet:G,setSheets:z}=p.useDashboardActions();Gkt(u);const{setActiveAssistantType:V}=p.useAIActions();v.useEffect(()=>{if(U){const de=M();Z(de)}},[U,M]),v.useEffect(()=>{j?V("dashboard"):S==="dashboard"&&x(null)},[j,V,S,x]),v.useEffect(()=>{var de;j||(de=c.current)==null||de.resize(0)},[j]);function L(de){var ee,J;de?((ee=c.current)==null||ee.resize(40),y("dashboard",!0),x("dashboard"),V("dashboard")):(y("dashboard",!1),x(null),(J=c.current)==null||J.resize(0),V(null))}function H(de="dashboard"){const ee={id:p.v4(),title:de==="document"?"New Document":"New Sheet",...de==="document"?{kind:de,document:p.createDefaultDocumentDefinition()}:{}};G(ee),X(ee.id)}function K(de,ee){if(!U)return;R===de?(W(),Z(null),it.success("Default sheet cleared")):(q(de),Z(de),it.success(`"${ee}" set as default sheet`))}function Q(de){var ee;de<1?(y("dashboard",!1),x(null),V(null),(ee=c.current)==null||ee.resize(0)):(j||y("dashboard",!0),V("dashboard"))}function ne(){return(T==null?void 0:T.canvasTheme)==="muted"||!(T!=null&&T.canvasTheme)?"hsl(var(--semaphor-muted))":(T==null?void 0:T.canvasTheme)==="clear"?"":T==null?void 0:T.canvasTheme}const ae=(de,ee)=>{de.dataTransfer.setData("tabIndex",ee.toString())},ce=de=>{de.preventDefault()},ie=(de,ee)=>{const J=de.dataTransfer.getData("tabIndex");if(J===ee.toString())return;const re=Array.from(E||[]),[se]=re.splice(parseInt(J),1);re.splice(ee,0,se),z(re)},oe=r===!0&&!i&&!j&&!I&&!D;function le(){if(E&&E.length>1||A)return l.jsx("div",{className:"relative flex w-full items-stretch border-b border-border",children:l.jsxs("div",{className:"relative min-w-0 flex-1",children:[l.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-0 left-0 z-10 w-4 bg-gradient-to-r from-background to-transparent"}),l.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-0 right-0 z-10 w-4 bg-gradient-to-l from-background to-transparent"}),l.jsxs(p.TabsList,{role:"tab-list",className:"flex w-0 min-w-full items-stretch justify-start overflow-x-auto rounded-none bg-transparent p-0 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[E==null?void 0:E.map((de,ee)=>{const J=F===de.id,re=R===de.id;return l.jsxs(p.TabsTrigger,{draggable:!0,onDragStart:se=>ae(se,ee),onDragOver:ce,onDrop:se=>ie(se,ee),onClick:()=>X(de.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:de.id,children:[de.kind==="document"&&l.jsx(Gs,{className:"h-3 w-3 text-muted-foreground"}),l.jsx(Wj,{enabled:A&&J,text:de.title,onSave:se=>Y(de.id,se),children:de.title},de.id),l.jsx("span",{role:"button",tabIndex:0,"aria-label":re?"Clear default sheet":"Set as default sheet",title:re?"Clear default sheet":"Set as default sheet",onClick:se=>{se.stopPropagation(),K(de.id,de.title||"Sheet")},onKeyDown:se=>{(se.key==="Enter"||se.key===" ")&&(se.preventDefault(),se.stopPropagation(),K(de.id,de.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",J||re?"opacity-100":"opacity-0 group-hover:opacity-100"),children:l.jsx(BZ,{className:p.cn("h-3 w-3 transition-colors",re?"fill-current text-amber-500":"text-muted-foreground")})}),A&&J&&E.length>1&&l.jsx("span",{role:"button",tabIndex:0,"aria-label":"Delete sheet",className:"inline-flex h-4 w-4 shrink-0 cursor-pointer items-center justify-center rounded-[3px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus:outline-none focus-visible:ring-1 focus-visible:ring-foreground",onClick:se=>{se.stopPropagation(),f(!0)},onKeyDown:se=>{(se.key==="Enter"||se.key===" ")&&(se.preventDefault(),se.stopPropagation(),f(!0))},children:l.jsx(je.X,{className:"h-3 w-3"})})]},de.id)}),A&&l.jsxs(zo,{children:[l.jsx(Bo,{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(_r,{className:"h-3 w-3"}),"Sheet"]})}),l.jsxs(Io,{align:"start",className:"w-48",children:[l.jsxs(Sn,{onSelect:()=>H("dashboard"),children:[l.jsx(Kh,{className:"h-4 w-4 text-muted-foreground"}),"Dashboard sheet"]}),l.jsxs(Sn,{onSelect:()=>H("document"),children:[l.jsx(Gs,{className:"h-4 w-4 text-muted-foreground"}),"Document"]})]})]})]})]})})}function fe(){return l.jsx("div",{ref:u,style:{},className:"h-full min-h-0 grow",children:E==null?void 0:E.map(de=>l.jsx(p.TabsContent,{style:{backgroundColor:ne(),..._.dashboardCanvasStyle},className:p.cn("mt-0 h-full min-h-0",{}),value:de.id,children:l.jsx($K,{sheet:de})},de.id))})}function he(){return l.jsxs(p.Tabs,{"data-role":"dashboard-tabs-container",className:p.cn("relative flex h-full flex-col",T==null?void 0:T.dashboardTabsContainer),onValueChange:de=>{X(de)},value:F||void 0,children:[le(),$==="top"&&!B&&l.jsx(rF,{}),F&&!B&&l.jsx(gIt,{}),B?l.jsx("div",{"data-role":"dashboard-tabs-content",className:"min-h-0 flex-1 grow basis-0 overflow-hidden",children:fe()}):l.jsx(sl,{"data-role":"dashboard-tabs-content",className:"flex-1 grow basis-0 overflow-y-auto",children:fe()}),$==="bottom"&&!B&&l.jsx(rF,{}),l.jsx(B0t,{open:d,setOpen:f})]})}const Ce=v.useCallback(de=>{w("dashboard",de)},[w]);return E?a&&F&&!B?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&&B&&P?l.jsx("div",{"data-role":"dashboard-document-print-content",className:"min-h-0 overflow-visible bg-white",children:l.jsx($K,{sheet:P})}):l.jsxs(l.Fragment,{children:[l.jsx(nIt,{}),l.jsx(iIt,{}),l.jsxs("div",{className:"relative flex-1 basis-0 overflow-hidden",children:[l.jsxs(age,{className:p.cn("flex-1 basis-0 overflow-y-auto transition-opacity",k&&"pointer-events-none opacity-0"),direction:"horizontal",children:[l.jsx(WF,{children:he()}),r===!0&&l.jsxs(l.Fragment,{children:[l.jsx($0t,{open:j,onTabClick:L,withHandle:!0,disabled:!j}),l.jsx(WF,{className:"flex grow","data-role":"dashboard-assistant-panel",onResize:Q,defaultSize:j?40:0,ref:c,children:l.jsx("div",{className:"grow overflow-y-auto",children:l.jsx(Kkt,{open:j,setOpen:L,isFullscreen:k,onFullscreenChange:de=>x(de?"dashboard":null),fullscreenContainer:N})})})]})]}),l.jsx("div",{ref:Ce,className:p.cn("absolute inset-0",!k&&"pointer-events-none")}),oe&&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||L(!0)},onMouseDown:h,onTouchStart:h,title:"Open Assistant (drag to move)",children:l.jsx(Ove,{className:"h-5 w-5"})})})]})]}):null}const xxe=v.forwardRef(({appearance:e,organizationAppearance:t,tokenAppearance:n,reactAppearance:r,resolvedAppearance:o,children:s,className:i,style:a,...c},u)=>{const d=v.useId(),f=v.useMemo(()=>bIt(d),[d]),{theme:h}=hO(),m=xIt(h),g=v.useMemo(()=>o??mu.resolveAppearance({organizationAppearance:t,tokenAppearance:n,reactAppearance:r??e}),[e,t,r,o,n]),b=v.useMemo(()=>p.compileAppearance({spec:g,systemMode:m}),[g,m]),x=v.useMemo(()=>p.createAppearanceContextValue(f,b),[b,f]);return l.jsx(p.AppearanceContext.Provider,{value:x,children:l.jsx(Wb,{...c,ref:u,className:i,style:a,children:s})})});xxe.displayName="AppearanceProvider";function bIt(e){return`semaphor-appearance-${e.replace(/[^a-zA-Z0-9_-]/g,"")}`}function xIt(e){const t=xN(e),[n,r]=v.useState(()=>yIt());return v.useEffect(()=>{var i,a;if(t!=="system"||typeof window>"u")return;const o=(i=window.matchMedia)==null?void 0:i.call(window,"(prefers-color-scheme: dark)");if(!o)return;const s=()=>{r(o.matches?"dark":"light")};return s(),typeof o.addEventListener=="function"?(o.addEventListener("change",s),()=>o.removeEventListener("change",s)):((a=o.addListener)==null||a.call(o,s),()=>{var c;return(c=o.removeListener)==null?void 0:c.call(o,s)})},[t]),t==="system"?n:t}function yIt(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}const yxe=v.createContext({openBrandStudioPreview:()=>{}}),vIt=yxe.Provider;function wIt(){return v.useContext(yxe)}function CIt({children:e,defaultTheme:t="system",storageKey:n="vite-ui-theme",...r}){const o=xN(t),[s,i]=v.useState(()=>SIt(n)||o),a=v.useCallback(u=>{const d=xN(u);NIt(n,d),i(d)},[n]),c=v.useMemo(()=>({theme:s,setTheme:a}),[s,a]);return l.jsx(dY.Provider,{...r,value:c,children:e})}function SIt(e){if(typeof window>"u")return null;try{const t=window.localStorage.getItem(e);if(!t)return null;const n=xN(t,"system");return n===t?n:null}catch{return null}}function NIt(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(e,t)}catch{}}const jIt=v.lazy(()=>Promise.resolve().then(()=>require("../brand-studio/index.cjs")).then(e=>({default:e.BrandStudioEditor})));function nB({appearance:e,children:t}){var E,D;const{authToken:n,id:r,tokenProps:o}=Tt(),s=zv(),i=(E=s.data)==null?void 0:E.organizationAppearance,a=(D=o.config)==null?void 0:D.appearance,[c,u]=v.useState(!1),[d,f]=v.useState(null),[h,m]=v.useState(null),[g,b]=v.useState(null),[x,y]=v.useState(null),w=`${o.apiServiceUrl??""}:${(n==null?void 0:n.accessToken)??""}`,C=Vn({queryKey:UX({resourceType:io.DASHBOARD,apiServiceUrl:o.apiServiceUrl,accessToken:n==null?void 0:n.accessToken}),queryFn:async()=>p.getRequest(`${o.apiServiceUrl}/management/v1/dashboards`,(n==null?void 0:n.accessToken)||""),select:A=>(A==null?void 0:A.organizationAppearance)??null,enabled:!s.dashboardIdToFetch&&i===void 0&&!!(n!=null&&n.accessToken)});v.useEffect(()=>{i!==void 0&&y({scopeKey:w,appearance:i})},[i,w]),v.useEffect(()=>{C.data!==void 0&&y({scopeKey:w,appearance:C.data})},[C.data,w]);const S=(x==null?void 0:x.scopeKey)===w?x.appearance:null,N=i!==void 0?i:C.data!==void 0?C.data:S,j=v.useMemo(()=>mu.resolveAppearance({organizationAppearance:N,tokenAppearance:a,reactAppearance:e}),[e,N,a]),k=v.useCallback(()=>{f(g??h??j),u(!0)},[g,h,j]),I=v.useCallback(()=>{u(!1)},[]);v.useEffect(()=>{f(null),m(null),b(null),u(!1)},[r]);const T=v.useMemo(()=>({openBrandStudioPreview:k}),[k]),_=g??h??e;return l.jsx(CIt,{defaultTheme:"system",storageKey:"vite-ui-theme",children:l.jsx(vIt,{value:T,children:l.jsx(xxe,{organizationAppearance:N,tokenAppearance:a,reactAppearance:_,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(v.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(jIt,{appearance:d,onDraftChange:b,onSave:A=>{m(A),b(A),f(A)},onCancel:I})})})]})})})})}function vxe({children:e,preferences:t}){const{currentUser:n}=Xs(),r=v.useMemo(()=>{var o,s;return{preferences:t||{},isLocalDev:((o=t==null?void 0:t.uiMode)==null?void 0:o.developer)||!1,isConsoleMode:((s=t==null?void 0:t.uiMode)==null?void 0:s.console)||!1}},[t]);return l.jsx(VX.Provider,{value:r,children:l.jsx(tT,{displayPreferences:t==null?void 0:t.cardDisplay,currentUser:n,children:e})})}function kIt(e=2e3,t=500){const n=c0e(),[r,o]=v.useState(!1),[s,i]=v.useState(!1),a=v.useRef(null);return v.useEffect(()=>{const c=setTimeout(()=>o(!0),e);return()=>clearTimeout(c)},[e]),v.useEffect(()=>{if(r){if(n>0){i(!1),a.current&&(clearTimeout(a.current),a.current=null);return}return a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{i(!0)},t),()=>{a.current&&clearTimeout(a.current)}}},[r,n,t]),s}function rB({delayMs:e=2e3,quietMs:t=500,componentType:n,componentId:r}){const o=kIt(e,t);return v.useEffect(()=>(o&&(window.__SEMAPHOR_READY__={ready:!0,type:n,componentId:r||null,timestamp:Date.now()}),()=>{window.__SEMAPHOR_READY__={ready:!1,type:n,componentId:r||null,timestamp:Date.now()}}),[o,n,r]),l.jsx("div",{id:"idle-check","aria-hidden":"true",style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0},children:o?"ready":""})}function wxe(e){if(typeof window>"u")return null;const{preferences:t}=e;return l.jsx(Si,{FallbackComponent:J_,children:l.jsx(yO,{dashboardProps:e,children:l.jsxs(dT,{children:[l.jsx(rB,{componentType:"dashboard",componentId:e.id}),l.jsx(nB,{appearance:e.appearance,children:l.jsx(vxe,{preferences:t,children:l.jsx("main",{className:"flex h-full flex-col",children:l.jsx(c5,{...e,type:"dashboard",children:l.jsx(bxe,{})})})})})]})})})}function IIt(e=[]){const t=v.useRef(null),n=v.useRef(null),r=v.useRef(null),[o,s]=v.useState(),i=v.useCallback(()=>{var m,g,b;const a=((m=t.current)==null?void 0:m.clientWidth)??0,c=((g=r.current)==null?void 0:g.offsetWidth)??0,u=((b=n.current)==null?void 0:b.offsetWidth)??0,f=a-c-u-8,h=Math.max(f,0);s(x=>x===h?x:h)},[]);return v.useEffect(()=>{const a=t.current;if(!a||typeof ResizeObserver>"u")return;const c=new ResizeObserver(()=>i());return c.observe(a),i(),()=>c.disconnect()},[i,...e]),{headerRef:t,leftActionsRef:n,rightActionsRef:r,titleMaxWidth:o,updateAvailableWidth:i}}function _It({filter:e}){var g;const t=p.useDashboardStore(b=>b.isDashboardEditing),{preferences:n}=Dm(),r=rf((g=n==null?void 0:n.cardDisplay)==null?void 0:g.mode),o=p.useDashboardStore(b=>b.filterValues),s=o==null?void 0:o.some(b=>b.filterId===e.id),{removeFilterValues:i,removeFilter:a,updateFilter:c}=p.useDashboardActions(),{headerRef:u,leftActionsRef:d,rightActionsRef:f,titleMaxWidth:h,updateAvailableWidth:m}=IIt([t,s,r]);return v.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(gi,{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(U$,{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(je.X,{className:"size-3.5"})})]})]}),l.jsx("div",{className:"hidden",ref:f})]})}function TIt(){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(_It,{filter:r}),l.jsx(G_,{filter:r})]},r.id))}):null}function EIt(){var s;const e=p.useDashboardStore(i=>i.dashboard),t=p.useDashboardStore(i=>i.selectedSheetId),n=p.useDashboardStore(i=>i.isDashboardEditing),r=(s=e.sheets)==null?void 0:s.find(i=>i.id===t),o=p.isDocumentSheet(r);return l.jsx("div",{role:"dashboard-plus-main",className:"flex min-h-0 grow basis-0 overflow-hidden",children:l.jsxs("section",{className:"flex min-h-0 grow basis-0 flex-col overflow-hidden",children:[n&&!o&&l.jsx(TIt,{}),l.jsx(bxe,{})]})})}const DIt=v.lazy(()=>Promise.resolve().then(()=>require("./dashboard-controls-CaFioayc.cjs"))),MIt=v.lazy(()=>Promise.resolve().then(()=>require("./edit-dashboard-visual-DwKcvlsF.cjs"))),RIt=v.lazy(()=>Promise.resolve().then(()=>require("./dashboard-json-CYtvwtvj.cjs")));function AIt({showControls:e=!1,showFooter:t=!0,...n}){const r=p.useDashboardStore(a=>a.isVisualEditing),o=p.useDashboardStore(a=>a.showDashboardJSON),{appearance:s,preferences:i}=n;return l.jsx(Si,{FallbackComponent:J_,children:l.jsx(yO,{dashboardProps:n,children:l.jsxs(dT,{children:[l.jsx(rB,{componentType:"surfboard",componentId:n.id}),l.jsxs(nB,{appearance:s,children:[l.jsx(HCe,{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(vxe,{preferences:i,children:[o&&l.jsx(v.Suspense,{fallback:null,children:l.jsx(RIt,{})}),l.jsxs("main",{className:"relative flex h-full w-full flex-col overflow-hidden",children:[e&&l.jsx(v.Suspense,{fallback:null,children:l.jsx(DIt,{})}),l.jsx("div",{className:"flex grow overflow-hidden",children:l.jsx("div",{className:"flex min-w-0 flex-1",children:l.jsxs(c5,{...n,type:"dashboard",children:[r&&l.jsx(v.Suspense,{fallback:null,children:l.jsx(MIt,{})}),l.jsx(v.Activity,{mode:r?"hidden":"visible",children:l.jsx(EIt,{})})]})})})]})]})]})]})})})}const KG=[{value:"en-US",label:"English (United States)"},{value:"en-GB",label:"English (United Kingdom)"},{value:"de-DE",label:"German (Germany)"},{value:"fr-FR",label:"French (France)"},{value:"es-ES",label:"Spanish (Spain)"},{value:"it-IT",label:"Italian (Italy)"},{value:"nl-NL",label:"Dutch (Netherlands)"},{value:"pt-BR",label:"Portuguese (Brazil)"},{value:"ja-JP",label:"Japanese (Japan)"},{value:"en-IN",label:"English (India)"},{value:"en-NZ",label:"English (New Zealand)"},{value:"mi-NZ",label:"Māori (New Zealand)"}],Cxe=new Set(["USD","EUR","GBP","CAD","AUD","JPY","CHF","INR","BRL","KWD"]),PIt=su.getSupportedCurrencyCodes(),FIt=PIt.filter(e=>!Cxe.has(e));function GG(e){switch(e){case"viewer_tenant":return"tenant";case"viewer_organization":return"organization";case"session_initial":return"embedded";case"system_default":return"system";default:return"inherited"}}function OIt({value:e,inherited:t,inheritedSources:n,onChange:r,disabled:o}){const s=v.useId(),a=(e.locale===void 0?void 0:su.canonicalizeSupportedLocale(e.locale))??t.locale,c=e.defaultCurrency??t.defaultCurrency,u=new Intl.NumberFormat(a,{style:"currency",currency:c}).format(1e3);return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsx(p.Label,{htmlFor:s,className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Locale"}),l.jsxs(p.Select,{value:e.locale??"inherit",disabled:o,onValueChange:d=>r({...e,locale:d==="inherit"?void 0:d}),children:[l.jsx(p.SelectTrigger,{id:s,size:"xs",children:l.jsx(p.SelectValue,{})}),l.jsxs(p.SelectContent,{children:[l.jsxs(p.SelectItem,{value:"inherit",children:["Use ",GG(n.locale)," default —"," ",t.locale]}),e.locale&&!KG.some(d=>d.value===e.locale)&&l.jsx(p.SelectItem,{value:e.locale,children:e.locale}),KG.map(d=>l.jsxs(p.SelectItem,{value:d.value,children:[d.label," — ",d.value]},d.value))]})]})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx(p.Label,{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Default currency"}),l.jsxs(p.Select,{value:e.defaultCurrency??"inherit",disabled:o,onValueChange:d=>r({...e,defaultCurrency:d==="inherit"?void 0:d}),children:[l.jsx(p.SelectTrigger,{size:"xs",children:l.jsx(p.SelectValue,{})}),l.jsxs(p.SelectContent,{children:[l.jsxs(p.SelectItem,{value:"inherit",children:["Use ",GG(n.defaultCurrency)," default —"," ",t.defaultCurrency]}),[...Cxe].map(d=>l.jsx(p.SelectItem,{value:d,children:d},d)),FIt.map(d=>l.jsx(p.SelectItem,{value:d,children:d},d))]})]})]}),l.jsxs("div",{className:"rounded-control border border-border/60 bg-muted/30 px-3 py-2",children:[l.jsx("p",{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Preview"}),l.jsx("p",{className:"mt-1 text-[14px] font-medium text-foreground",children:u}),l.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Currency display only; values are not converted."})]})]})}const iO=new Set;function Sxe(e){return iO.add(e),()=>{iO.delete(e)}}function oB(){iO.forEach(e=>{e()})}var LIt=Object.defineProperty,$It=(e,t,n)=>t in e?LIt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,v1=(e,t,n)=>$It(e,typeof t!="symbol"?t+"":t,n);const zIt={stringify:e=>e?"true":"false",parse:e=>/^[ty1-9]/i.test(e)},BIt={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}},VIt={stringify:e=>JSON.stringify(e),parse:e=>JSON.parse(e)};function HIt(e){return e.replace(/([a-z0-9])([A-Z])/g,(t,n,r)=>`${n}-${r.toLowerCase()}`)}function Nxe(e){return e.replace(/[-:]([a-z])/g,(t,n)=>`${n.toUpperCase()}`)}const qIt={stringify:e=>e.name,parse:(e,t,n)=>{const r=(()=>{const o=Nxe(t);if(typeof n<"u"&&o in n.container)return n.container[o]})();return typeof r=="function"?r.bind(n):void 0}},UIt={stringify:e=>`${e}`,parse:e=>parseFloat(e)},WIt={stringify:e=>e,parse:e=>e},Q2={string:WIt,number:UIt,boolean:zIt,function:BIt,method:qIt,json:VIt},Xx=Symbol.for("r2wc.render"),w1=Symbol.for("r2wc.connected"),Af=Symbol.for("r2wc.context"),Ii=Symbol.for("r2wc.props");function KIt(e,t,n){var r,o,s;t.props||(t.props=e.propTypes?Object.keys(e.propTypes):[]),t.events||(t.events=[]);const i=Array.isArray(t.props)?t.props.slice():Object.keys(t.props),a=Array.isArray(t.events)?t.events.slice():Object.keys(t.events),c={},u={},d={},f={};for(const m of i){c[m]=Array.isArray(t.props)?"string":t.props[m];const g=HIt(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(),v1(this,s,!0),v1(this,o),v1(this,r,{}),v1(this,"container"),t.shadow?this.container=this.attachShadow({mode:t.shadow}):this.container=this,this[Ii].container=this.container;for(const g of i){const b=d[g],x=this.getAttribute(b),y=c[g],w=y?Q2[y]:null;if(y==="method"){const C=Nxe(b);Object.defineProperty(this[Ii].container,C,{enumerable:!0,configurable:!0,get(){return this[Ii][C]},set(S){this[Ii][C]=S,this[Xx]()}}),this[Ii][g]=w.parse(x,b,this)}w!=null&&w.parse&&x&&(this[Ii][g]=w.parse(x,b,this))}for(const g of a)this[Ii][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[w1]=!0,this[Xx]()}disconnectedCallback(){this[w1]=!1,this[Af]&&n.unmount(this[Af]),delete this[Af]}attributeChangedCallback(g,b,x){const y=f[g],w=c[y],C=w?Q2[w]:null;y in c&&C!=null&&C.parse&&x&&(this[Ii][y]=C.parse(x,g,this),this[Xx]())}[(s=w1,o=Af,r=Ii,Xx)](){this[w1]&&(this[Af]?n.update(this[Af],this[Ii]):this[Af]=n.mount(this.container,e,this[Ii]))}}for(const m of i){const g=d[m],b=c[m];Object.defineProperty(h.prototype,m,{enumerable:!0,configurable:!0,get(){return this[Ii][m]},set(x){this[Ii][m]=x;const y=b?Q2[b]:null;if(y!=null&&y.stringify){const w=y.stringify(x,g,this);this.getAttribute(g)!==w&&this.setAttribute(g,w)}else this[Xx]()}})}return h}function GIt(e,t,n){const r=Qxe.createRoot(e),o=v.createElement(t,n);return r.render(o),{root:r,ReactComponent:t}}function YIt({root:e,ReactComponent:t},n){const r=v.createElement(t,n);e.render(r)}function ZIt({root:e}){e.unmount()}function XIt(e,t={}){return KIt(e,t,{mount:GIt,update:YIt,unmount:ZIt})}const QIt={id:"string",version:"string",authToken:"json",placeholders:"json",defaultFilterValues:"json",defaultControlValues:"json",controlContractOverrides:"json",documentInputValues:"json",dashboardInputExecutionSnapshot:"json",interactionExecutionSnapshot:"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"},JIt=XIt(wxe,{props:QIt}),e_t=v.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(x4,{context:t})," "]})});var jxe="Toggle",kxe=te.forwardRef((e,t)=>{const{pressed:n,defaultPressed:r,onPressedChange:o,...s}=e,[i,a]=p.useControllableState({prop:n,onChange:o,defaultProp:r??!1,caller:jxe});return l.jsx(p.Primitive.button,{type:"button","aria-pressed":i,"data-state":i?"on":"off","data-disabled":e.disabled?"":void 0,...s,ref:t,onClick:p.composeEventHandlers(e.onClick,()=>{e.disabled||a(!i)})})});kxe.displayName=jxe;var Ixe=kxe;const t_t=p.cva("inline-flex items-center justify-center rounded-control text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-3",sm:"h-9 px-2.5",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),_xe=te.forwardRef(({className:e,variant:t,size:n,...r},o)=>l.jsx(Ixe,{ref:o,className:p.cn(t_t({variant:t,size:n,className:e})),...r}));_xe.displayName=Ixe.displayName;function sB(){var c,u;const e=p.useEditorStore(d=>d.card),t=p.useEditorStore(d=>d.frame),n=v.useMemo(()=>gw(t,e),[t,e]),{manifest:r}=mf(((c=n==null?void 0:n.customCardPreferences)==null?void 0:c.url)||""),o=v.useMemo(()=>{var d;return(d=r==null?void 0:r.visuals)==null?void 0:d.find(f=>{var h;return f.name===((h=n==null?void 0:n.customCardPreferences)==null?void 0:h.componentName)})},[r,(u=n==null?void 0:n.customCardPreferences)==null?void 0:u.componentName]),s=$m(n,o),i=v.useMemo(()=>pw({frame:t,configCard:n,isMultiInputVisual:s==="multiple"}),[t,n,s]),a=v.useMemo(()=>{const d=i.findIndex(f=>(f==null?void 0:f.id)===e.id);return d<0?-1:Og(e,d)},[i,e]);return v.useMemo(()=>!n||s!=="multiple"||a<0?e.type:jh(e,a,o==null?void 0:o.slots)??e.type,[n,s,a,e,o==null?void 0:o.slots])}function Txe({storeValue:e,defaultValue:t="",onStoreUpdate:n,delay:r=300}){const[o,s]=v.useState(e??t),i=v.useRef(null),a=v.useRef(o),c=v.useRef(e),u=v.useRef(!1),d=v.useCallback(()=>{i.current&&(clearTimeout(i.current),i.current=null),u.current&&a.current!==(c.current??t)&&(n(a.current),c.current=a.current)},[t,n]);v.useEffect(()=>{if(e!==c.current){i.current&&(clearTimeout(i.current),i.current=null);const h=e??t;s(h),a.current=h,c.current=e,u.current=!1}},[e,t]),v.useEffect(()=>{if(u.current)return i.current=setTimeout(()=>{d()},r),()=>{i.current&&(clearTimeout(i.current),i.current=null)}},[r,d,o]),v.useEffect(()=>()=>{i.current&&clearTimeout(i.current)},[]);const f=v.useCallback(h=>{const m=h??t;u.current=!0,a.current=m,s(m)},[t]);return{value:o,onChange:f,flush:d}}const n_t=300;function r_t({onExpand:e},t){const n=p.useEditorStore(C=>C.card.sql),r=p.useEditorStore(C=>C.sqlGen),o=p.useEditorStore(C=>C.card),s=sB(),{setCardSql:i,setSqlGen:a,setRunSql:c}=p.useEditorActions(),u=v.useMemo(()=>s!==o.type?{...o,type:s}:o,[o,s]),{queryKey:d}=mb(u),f=Vr(),h=v.useRef(d);h.current=d;const m=v.useRef(r);m.current=r;const g=v.useCallback(C=>{i(C)},[i]),{value:b,onChange:x,flush:y}=Txe({storeValue:n,defaultValue:"",onStoreUpdate:g,delay:n_t});v.useEffect(()=>Sxe(y),[y]);function w(C){x(C),p.isObjectEmpty(m.current)||a({})}return l.jsxs("div",{className:"relative h-full w-full",children:[l.jsx(p.CodeEditor,{ref:t,value:b??"",onValueChange:w,language:"sql-jinja",embedded:!0,hideLineNumbers:!0,wrapLines:!0,placeholder:"Write your SQL here",onKeyDown:C=>{C.key==="Enter"&&C.shiftKey&&(C.preventDefault(),oB(),setTimeout(()=>{f.removeQueries({queryKey:h.current,exact:!0}),c(!0)},0))}}),e?l.jsx(p.Button,{type:"button",variant:"ghost",size:"icon",className:"absolute right-2.5 top-2 z-20 h-7 w-7 bg-background/80 p-0 text-muted-foreground backdrop-blur-sm transition-colors hover:bg-accent hover:text-foreground focus-visible:text-foreground",onClick:e,"aria-label":"Expand SQL editor",title:"Expand SQL editor",children:l.jsx(At.Maximize2,{className:"h-3.5 w-3.5",strokeWidth:1.75})}):null]})}const o_t=v.forwardRef(r_t),s_t=300;function i_t(e,t){const n=p.useEditorStore(g=>g.card.python),r=p.useEditorStore(g=>g.card),o=sB(),{setCardPython:s,setRunSql:i}=p.useEditorActions(),a=v.useMemo(()=>o!==r.type?{...r,type:o}:r,[r,o]),{queryKey:c}=mb(a),u=Vr(),d=v.useRef(c);d.current=c;const{value:f,onChange:h,flush:m}=Txe({storeValue:n,defaultValue:fO,onStoreUpdate:s,delay:s_t});return v.useEffect(()=>Sxe(m),[m]),l.jsx(p.CodeEditor,{ref:t,value:f??"",onValueChange:h,language:"python",embedded:!0,hideLineNumbers:!0,wrapLines:!0,className:"[&_.code-editor-pre]:!pt-2 [&_.code-editor-textarea]:!pt-2",onKeyDown:g=>{g.key==="Enter"&&g.shiftKey&&(g.preventDefault(),oB(),setTimeout(()=>{u.removeQueries({queryKey:d.current,exact:!0}),i(!0)},0))}})}const a_t=v.forwardRef(i_t),Exe=new Set(["askForMoreInfo","getAvailableChartTypes","getChartSQLSyntax","getDomainRelationships","getTableColumns","getUserSql","validateCardConfigFormat"]),l_t=new Set(["createChartFromSql","createForecast","generateQueryConfig","getChartDataFromCardConfig","getChartDataFromSqlAndPython","getForecastDataFromSqlAndPython"]),c_t=Array.from(Exe).join(", "),u_t=3,d_t="Self-heal",f_t=new Set(["SQL_PARSE_ERROR","SQL_EXPLAIN_ERROR"]);function h_t({card:e}){var q,W,R,Z,X;const[t,n]=v.useState({}),{authToken:r}=Tt(),o=p.getTokenParams(r==null?void 0:r.accessToken),{compiledAppearance:s}=p.useAppearance(),i=v.useMemo(()=>Uw(s),[s]),a=p.useEditorStore(Y=>Y.frame),c=p.useEditorStore(Y=>Y.inlineFilterValuesMap[e.id]),u=p.useEditorStore(Y=>Y.actions.setCardInlineFilterValue),d=p.useEditorStore(Y=>Y.actions.removeCardInlineFilterValue),f=e,{getCard:h,manifest:m}=mf(((q=f.customCardPreferences)==null?void 0:q.url)||""),g=(W=m==null?void 0:m.visuals)==null?void 0:W.find(Y=>{var G;return Y.name===((G=f.customCardPreferences)==null?void 0:G.componentName)}),b=$m(f,g)??"single",x=v.useMemo(()=>pw({frame:a,configCard:f,isMultiInputVisual:b==="multiple"}),[a,f,b]),y=v.useMemo(()=>{const Y=x.findIndex(G=>(G==null?void 0:G.id)===e.id);return Y<0?-1:Og(e,Y)},[x,e]),w=v.useMemo(()=>b!=="multiple"||y<0?e.type:jh(e,y,g==null?void 0:g.slots)??e.type,[b,y,e,g==null?void 0:g.slots]),C=v.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:S,effectiveCardConfig:N}=mb(C),j=p.useInteractionStore(Y=>Y.interactionStates),k=p.useDashboardStore(Y=>{var G;return(G=Y.dashboard)==null?void 0:G.id}),I=p.useDashboardStore(Y=>Y.dashboard.filters),T=p.useDashboardStore(Y=>Y.filterValues),_=p.useDashboardStore(Y=>Y.selectedSheetId),E=v.useMemo(()=>K$({card:e,sheetId:_||"",inlineFilterValues:c,setInlineFilterValue:Y=>u(e.id,Y),removeInlineFilterValue:Y=>d(e.id,Y)}),[e,_,c,u,d]),{cardFilters:D,cardFilterValues:A}=v.useMemo(()=>ow({card:e,interactionStates:j,currentDashboardId:k,filters:I,filterValues:T,selectedSheetId:_}),[e,j,k,I,T,_]),F=v.useCallback((Y,G)=>{const z=dL(G);n(V=>({...V,[Y]:z}))},[]),P=(R=f.customCardPreferences)==null?void 0:R.componentName,O=P?h(P):null,$=qj((Z=f.customCardPreferences)==null?void 0:Z.settings,f),B=v.useMemo(()=>PI(x),[x]),U=v.useMemo(()=>B.map((Y,G)=>jh(Y,G,g==null?void 0:g.slots)),[B,g==null?void 0:g.slots]),M=v.useMemo(()=>Z$(b==="multiple"?Y$({slotOrderedCards:B,multiInputData:t}):[{card:e,cardConfig:N,columns:S==null?void 0:S.columns,columnKeyMap:S==null?void 0:S.columnKeyMap}]),[e,S==null?void 0:S.columnKeyMap,S==null?void 0:S.columns,N,t,B,b]);return P?l.jsx("div",{className:"semaphor-custom mb-3 flex grow basis-0 flex-col space-y-2 overflow-y-auto",children:l.jsxs(v.Suspense,{fallback:l.jsx(l.Fragment,{}),children:[O&&b==="single"&&l.jsx(O,{editing:!0,params:o,theme:i,settings:$,cardMetadata:pue({card:e,dataMetadata:S==null?void 0:S.metadata}),onDataChange:F,data:(S==null?void 0:S.records)||[],columns:(S==null?void 0:S.columns)||[],formatTemporalBucketValue:M,filters:D,filterValues:[...A||[],...c||[]],inlineFilters:E}),O&&b==="multiple"&&l.jsxs(l.Fragment,{children:[x.map((Y,G)=>{if(!Y)return null;const z=Og(Y,G),V=jh(Y,z,g==null?void 0:g.slots);return l.jsx(x$,{onDataChange:F,card:Y,effectiveCardType:V},`${Y.id}-${z}`)}),l.jsx("div",{className:"flex flex-col gap-2",children:l.jsx(O,{editing:!0,onDataChange:F,...G$({configCard:f,slotOrderedCards:B,slotTypes:U,multiInputData:t,params:o,theme:i,chartSettings:$,filters:D,filterValues:[...A||[],...c||[]],inlineFilters:E,formatTemporalBucketValue:M})})})]})]},(X=f.customCardPreferences)==null?void 0:X.componentName)}):null}const m_t=v.memo(h_t),p_t=p.create()(p.persist((e,t)=>({starredCharts:[],isStarred:(n,r)=>t().starredCharts.some(o=>o.type===n&&o.id===r),toggleStar:n=>{e(r=>{const o=r.starredCharts.findIndex(s=>s.type===n.type&&s.id===n.id);return o>=0?{starredCharts:r.starredCharts.filter((s,i)=>i!==o)}:{starredCharts:[...r.starredCharts,n]}})},getStarredChart:(n,r)=>t().starredCharts.find(o=>o.type===n&&o.id===r)}),{name:"semaphor-starred-charts"}));var Dxe=["PageUp","PageDown"],Mxe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Rxe={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},ix="Slider",[aO,g_t,b_t]=p.createCollection(ix),[Axe]=p.createContextScope(ix,[b_t]),[x_t,ZT]=Axe(ix),Pxe=te.forwardRef((e,t)=>{const{name:n,min:r=0,max:o=100,step:s=1,orientation:i="horizontal",disabled:a=!1,minStepsBetweenThumbs:c=0,defaultValue:u=[r],value:d,onValueChange:f=()=>{},onValueCommit:h=()=>{},inverted:m=!1,form:g,...b}=e,x=te.useRef(new Set),y=te.useRef(0),C=i==="horizontal"?y_t:v_t,[S=[],N]=p.useControllableState({prop:d,defaultProp:u,onChange:E=>{var A;(A=[...x.current][y.current])==null||A.focus(),f(E)}}),j=te.useRef(S);function k(E){const D=j_t(S,E);_(E,D)}function I(E){_(E,y.current)}function T(){const E=j.current[y.current];S[y.current]!==E&&h(S)}function _(E,D,{commit:A}={commit:!1}){const F=T_t(s),P=E_t(Math.round((E-r)/s)*s+r,F),O=p.clamp(P,[r,o]);N(($=[])=>{const B=S_t($,O,D);if(__t(B,c*s)){y.current=B.indexOf(O);const U=String(B)!==String($);return U&&A&&h(B),U?B:$}else return $})}return l.jsx(x_t,{scope:e.__scopeSlider,name:n,disabled:a,min:r,max:o,valueIndexToChangeRef:y,thumbs:x.current,values:S,orientation:i,form:g,children:l.jsx(aO.Provider,{scope:e.__scopeSlider,children:l.jsx(aO.Slot,{scope:e.__scopeSlider,children:l.jsx(C,{"aria-disabled":a,"data-disabled":a?"":void 0,...b,ref:t,onPointerDown:p.composeEventHandlers(b.onPointerDown,()=>{a||(j.current=S)}),min:r,max:o,inverted:m,onSlideStart:a?void 0:k,onSlideMove:a?void 0:I,onSlideEnd:a?void 0:T,onHomeKeyDown:()=>!a&&_(r,0,{commit:!0}),onEndKeyDown:()=>!a&&_(o,S.length-1,{commit:!0}),onStepKeyDown:({event:E,direction:D})=>{if(!a){const P=Dxe.includes(E.key)||E.shiftKey&&Mxe.includes(E.key)?10:1,O=y.current,$=S[O],B=s*P*D;_($+B,O,{commit:!0})}}})})})})});Pxe.displayName=ix;var[Fxe,Oxe]=Axe(ix,{startEdge:"left",endEdge:"right",size:"width",direction:1}),y_t=te.forwardRef((e,t)=>{const{min:n,max:r,dir:o,inverted:s,onSlideStart:i,onSlideMove:a,onSlideEnd:c,onStepKeyDown:u,...d}=e,[f,h]=te.useState(null),m=p.useComposedRefs(t,C=>h(C)),g=te.useRef(void 0),b=p.useDirection(o),x=b==="ltr",y=x&&!s||!x&&s;function w(C){const S=g.current||f.getBoundingClientRect(),N=[0,S.width],k=iB(N,y?[n,r]:[r,n]);return g.current=S,k(C-S.left)}return l.jsx(Fxe,{scope:e.__scopeSlider,startEdge:y?"left":"right",endEdge:y?"right":"left",direction:y?1:-1,size:"width",children:l.jsx(Lxe,{dir:b,"data-orientation":"horizontal",...d,ref:m,style:{...d.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:C=>{const S=w(C.clientX);i==null||i(S)},onSlideMove:C=>{const S=w(C.clientX);a==null||a(S)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:C=>{const N=Rxe[y?"from-left":"from-right"].includes(C.key);u==null||u({event:C,direction:N?-1:1})}})})}),v_t=te.forwardRef((e,t)=>{const{min:n,max:r,inverted:o,onSlideStart:s,onSlideMove:i,onSlideEnd:a,onStepKeyDown:c,...u}=e,d=te.useRef(null),f=p.useComposedRefs(t,d),h=te.useRef(void 0),m=!o;function g(b){const x=h.current||d.current.getBoundingClientRect(),y=[0,x.height],C=iB(y,m?[r,n]:[n,r]);return h.current=x,C(b-x.top)}return l.jsx(Fxe,{scope:e.__scopeSlider,startEdge:m?"bottom":"top",endEdge:m?"top":"bottom",size:"height",direction:m?1:-1,children:l.jsx(Lxe,{"data-orientation":"vertical",...u,ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:b=>{const x=g(b.clientY);s==null||s(x)},onSlideMove:b=>{const x=g(b.clientY);i==null||i(x)},onSlideEnd:()=>{h.current=void 0,a==null||a()},onStepKeyDown:b=>{const y=Rxe[m?"from-bottom":"from-top"].includes(b.key);c==null||c({event:b,direction:y?-1:1})}})})}),Lxe=te.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:o,onSlideEnd:s,onHomeKeyDown:i,onEndKeyDown:a,onStepKeyDown:c,...u}=e,d=ZT(ix,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()):Dxe.concat(Mxe).includes(f.key)&&(c(f),f.preventDefault())}),onPointerDown:p.composeEventHandlers(e.onPointerDown,f=>{const h=f.target;h.setPointerCapture(f.pointerId),f.preventDefault(),d.thumbs.has(h)?h.focus():r(f)}),onPointerMove:p.composeEventHandlers(e.onPointerMove,f=>{f.target.hasPointerCapture(f.pointerId)&&o(f)}),onPointerUp:p.composeEventHandlers(e.onPointerUp,f=>{const h=f.target;h.hasPointerCapture(f.pointerId)&&(h.releasePointerCapture(f.pointerId),s(f))})})}),$xe="SliderTrack",zxe=te.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,o=ZT($xe,n);return l.jsx(p.Primitive.span,{"data-disabled":o.disabled?"":void 0,"data-orientation":o.orientation,...r,ref:t})});zxe.displayName=$xe;var lO="SliderRange",Bxe=te.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,o=ZT(lO,n),s=Oxe(lO,n),i=te.useRef(null),a=p.useComposedRefs(t,i),c=o.values.length,u=o.values.map(h=>qxe(h,o.min,o.max)),d=c>1?Math.min(...u):0,f=100-Math.max(...u);return l.jsx(p.Primitive.span,{"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,...r,ref:a,style:{...e.style,[s.startEdge]:d+"%",[s.endEdge]:f+"%"}})});Bxe.displayName=lO;var cO="SliderThumb",Vxe=te.forwardRef((e,t)=>{const n=g_t(e.__scopeSlider),[r,o]=te.useState(null),s=p.useComposedRefs(t,a=>o(a)),i=te.useMemo(()=>r?n().findIndex(a=>a.ref.current===r):-1,[n,r]);return l.jsx(w_t,{...e,ref:s,index:i})}),w_t=te.forwardRef((e,t)=>{const{__scopeSlider:n,index:r,name:o,...s}=e,i=ZT(cO,n),a=Oxe(cO,n),[c,u]=te.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:qxe(m,i.min,i.max),b=N_t(r,i.values.length),x=h==null?void 0:h[a.size],y=x?k_t(x,g,a.direction):0;return te.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(aO.ItemSlot,{scope:e.__scopeSlider,children:l.jsx(p.Primitive.span,{role:"slider","aria-label":e["aria-label"]||b,"aria-valuemin":i.min,"aria-valuenow":m,"aria-valuemax":i.max,"aria-orientation":i.orientation,"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,tabIndex:i.disabled?void 0:0,...s,ref:d,style:m===void 0?{display:"none"}:e.style,onFocus:p.composeEventHandlers(e.onFocus,()=>{i.valueIndexToChangeRef.current=r})})}),f&&l.jsx(Hxe,{name:o??(i.name?i.name+(i.values.length>1?"[]":""):void 0),form:i.form,value:m},r)]})});Vxe.displayName=cO;var C_t="RadioBubbleInput",Hxe=te.forwardRef(({__scopeSlider:e,value:t,...n},r)=>{const o=te.useRef(null),s=p.useComposedRefs(o,r),i=p.usePrevious(t);return te.useEffect(()=>{const a=o.current;if(!a)return;const c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&d){const f=new Event("input",{bubbles:!0});d.call(a,t),a.dispatchEvent(f)}},[i,t]),l.jsx(p.Primitive.input,{style:{display:"none"},...n,ref:s,defaultValue:t})});Hxe.displayName=C_t;function S_t(e=[],t,n){const r=[...e];return r[n]=t,r.sort((o,s)=>o-s)}function qxe(e,t,n){const s=100/(n-t)*(e-t);return p.clamp(s,[0,100])}function N_t(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function j_t(e,t){if(e.length===1)return 0;const n=e.map(o=>Math.abs(o-t)),r=Math.min(...n);return n.indexOf(r)}function k_t(e,t,n){const r=e/2,s=iB([0,50],[0,r]);return(r-s(t)*n)*n}function I_t(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function __t(e,t){if(t>0){const n=I_t(e);return Math.min(...n)>=t}return!0}function iB(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 T_t(e){return(String(e).split(".")[1]||"").length}function E_t(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var Uxe=Pxe,D_t=zxe,M_t=Bxe,R_t=Vxe;const Wxe=te.forwardRef(({className:e,...t},n)=>l.jsxs(Uxe,{ref:n,className:p.cn("relative flex w-full touch-none select-none items-center",e),...t,children:[l.jsx(D_t,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:l.jsx(M_t,{className:"absolute h-full bg-primary"})}),l.jsx(R_t,{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"})]}));Wxe.displayName=Uxe.displayName;exports.Accordion=u4;exports.AccordionContent=yv;exports.AccordionItem=bv;exports.AccordionTrigger=xv;exports.AddDataPicker=Q4;exports.AggregateTable=j_;exports.Alert=xL;exports.AlertDescription=yL;exports.AlertDialog=tf;exports.AlertDialogAction=Nu;exports.AlertDialogCancel=ju;exports.AlertDialogContent=yu;exports.AlertDialogDescription=Su;exports.AlertDialogFooter=wu;exports.AlertDialogHeader=vu;exports.AlertDialogTitle=Cu;exports.AlertDialogTrigger=c1e;exports.AlertTitle=_te;exports.ArrowDown=Yo;exports.ArrowDownIcon=SQe;exports.ArrowLeft=Wv;exports.ArrowRight=Kv;exports.ArrowUp=ps;exports.ArrowUpIcon=jQe;exports.AssistantContextEntityControls=oO;exports.AssistantVirtualizedMessages=hxe;exports.AxisConfigurator=zm;exports.BackgroundRunPill=Lct;exports.Badge=fi;exports.Bell=j1;exports.BookType=cZ;exports.BriefingAuthor=Wfe;exports.BriefingAuthorDialog=Kfe;exports.BriefingUiCapabilitiesBoundary=iut;exports.BriefingUiCapabilitiesProvider=dT;exports.BriefingsApiError=nC;exports.BulletChartIcon=sxe;exports.CSS=qi;exports.CalculatedFieldEditor=Sme;exports.Calculator=dZ;exports.Calendar=Aa;exports.CalendarClock=RO;exports.Card=jN;exports.CardContent=MO;exports.CardHeader=DO;exports.CardSummary=uF;exports.CardTitle=ab;exports.ChartArea=SR;exports.ChartColumnIncreasing=hZ;exports.ChartColumnStacked=mZ;exports.ChartJsVisual=zw;exports.ChartLine=pZ;exports.ChartNoAxesGantt=bZ;exports.ChartPie=xZ;exports.ChartScatter=yZ;exports.ChatInputWithContext=J4;exports.Checkbox=In;exports.ChevronLeft=jm;exports.ChevronsUpDown=CZ;exports.Circle=AO;exports.CircleAlert=ba;exports.CircleCheck=SZ;exports.CircleHelp=NZ;exports.Clock=jZ;exports.CodeHighlighter=kd;exports.CodeXml=k1;exports.Collapsible=du;exports.CollapsibleContent=hu;exports.CollapsibleTrigger=fu;exports.ColorField=la;exports.Command=wT;exports.CommandEmpty=ST;exports.CommandGroup=NT;exports.CommandInput=Qz;exports.CommandItem=jT;exports.CommandList=CT;exports.CommandSeparator=Vhe;exports.ComparisonMetadataBadge=Koe;exports.Container=c5;exports.ControlDefaultValueEditor=Wme;exports.ControlDefinitionOptionsEditor=Ume;exports.ControlIdInput=Bme;exports.ControlVisibilitySettings=Ngt;exports.Copy=Wh;exports.CopyButton=jd;exports.CopyPlus=jR;exports.Cross2Icon=TQe;exports.CustomFilterPopover=U$;exports.CustomScrollArea=sl;exports.DEFAULT_HEATMAP_CUSTOM_RANGE=Gre;exports.Dashboard=wxe;exports.DashboardCard=Xfe;exports.DashboardCreateDialogBase=xQ;exports.DashboardExportDialog=mxe;exports.DashboardPlus=AIt;exports.DashboardWC=JIt;exports.DataTableConditionalFormattingSettings=Ppe;exports.DataTablePagination=p_;exports.Database=ts;exports.DateRangePicker=B$;exports.DefaultChatTransport=H4;exports.Dialog=_o;exports.DialogContent=mo;exports.DialogDescription=To;exports.DialogFooter=Ya;exports.DialogHeader=Is;exports.DialogTitle=po;exports.DialogTrigger=pQ;exports.DisplayFormatPreferencesFields=OIt;exports.DisplayPreferencesProvider=tT;exports.DndContext=hC;exports.Donut=kZ;exports.Download=gu;exports.DownloadPdf=pxe;exports.DragOverlay=_he;exports.DropdownMenu=zo;exports.DropdownMenuCheckboxItem=Wu;exports.DropdownMenuContent=Io;exports.DropdownMenuItem=Sn;exports.DropdownMenuLabel=La;exports.DropdownMenuRadioGroup=gCe;exports.DropdownMenuRadioItem=BX;exports.DropdownMenuSeparator=xa;exports.DropdownMenuSub=e5;exports.DropdownMenuSubContent=Yk;exports.DropdownMenuSubTrigger=Gk;exports.DropdownMenuTrigger=Bo;exports.EMPTY_DATA_SOURCE=ob;exports.Editable=Wj;exports.EditableText=gi;exports.EditorCustomVisual=m_t;exports.Ellipsis=wi;exports.EllipsisVertical=km;exports.ErrorBoundary=Si;exports.ExportError=jb;exports.ExternalLink=_d;exports.EyeOff=qk;exports.Fallback=J_;exports.FallbackVisual=Jw;exports.FeedbackCategory=Qd;exports.FeedbackDialog=Ev;exports.FieldsList=x4;exports.FieldsSection=e_t;exports.FileCode=IZ;exports.FileText=Gs;exports.Filter=Td;exports.FilterComponent=G_;exports.FilterInfo=iF;exports.FilterableFieldsPanel=jme;exports.Grid3x3=kR;exports.GripVertical=bu;exports.HEATMAP_PRESET_PALETTES=LA;exports.Hash=lb;exports.House=_Z;exports.HoverCard=Um;exports.HoverCardContent=cu;exports.HoverCardTrigger=$d;exports.INLINE_ALLOWED_READ_ONLY_TOOLS=Exe;exports.INLINE_ALLOWED_TOOL_LIST=c_t;exports.INLINE_BLOCKED_MUTATING_TOOLS=l_t;exports.IconButton=Gc;exports.IconForFieldType=uN;exports.Inbox=FO;exports.InfoHover=uz;exports.InlineFilterBar=que;exports.KPICard=Wd;exports.KeyboardSensor=dC;exports.Layers=_m;exports.Link=OO;exports.LoadingDots=Bd;exports.MAX_SELF_HEAL_ATTEMPTS=u_t;exports.Map=MZ;exports.Markdown=Az;exports.MatrixTableVisual=N_;exports.MdStackedLineChart=rxe;exports.MultiInputEmptyRenderer=x$;exports.PanelResizeHandle=VT;exports.Pause=RZ;exports.PenLine=TR;exports.Pencil=ER;exports.PendingMessagesDisplay=Kbe;exports.PersistedDynamicVisual=eT;exports.PiChartPolar=Jbe;exports.Pin=PZ;exports.PinOff=AZ;exports.PivotTableTanstack=Ub;exports.Placeholders=lge;exports.Play=FZ;exports.Plus=_r;exports.PointerSensor=Qb;exports.Progress=Y4;exports.PythonEditor=a_t;exports.RECOVERABLE_SQL_ERROR_CODES=f_t;exports.Radar=OZ;exports.RadioGroup=Xa;exports.RadioGroupItem=ys;exports.RefreshCw=Gl;exports.ResizableHandle=L0t;exports.ResizablePanel=WF;exports.ResizablePanelGroup=age;exports.ResourceEditDialog=GQ;exports.ResourceType=io;exports.Rows3=LZ;exports.RunCompletionBanner=$ct;exports.SELF_HEAL_TIMELINE_STEP=d_t;exports.SeedQuestions=Mbe;exports.SemaphorContext=$v;exports.SemaphorContextProvider=yO;exports.SemaphorQueryClient=MY;exports.SemaphorReadyIndicator=rB;exports.SemaphorStyleWrapper=Wb;exports.Send=$O;exports.SendHorizontal=$Z;exports.Settings=zO;exports.Settings2=Tm;exports.Share2=zZ;exports.ShareDialog=KQ;exports.Sheet=x3;exports.SheetContent=g_;exports.SheetDescription=x_;exports.SheetHeader=Foe;exports.SheetTitle=b_;exports.SheetTrigger=n4e;exports.Slider=Wxe;exports.SortableContext=mC;exports.Sparkles=y0;exports.SqlEditor=o_t;exports.Square=VO;exports.SquarePen=BO;exports.Star=BZ;exports.StructuralParticipantSelector=Vme;exports.SummaryCard=rF;exports.TABLE_PRESENTATION_DEFAULT_STYLE=Sd;exports.TABLE_PRESENTATION_DEFAULT_TOTALS_STYLE=ua;exports.TableBody=Ld;exports.TableCell=Bn;exports.TableColumnVisibilitySettings=Spe;exports.TableHead=uo;exports.TableHeader=qm;exports.TablePresentationSettings=jpe;exports.TableRow=Mr;exports.TableSkeleton=fz;exports.TableVisual=zd;exports.Tag=VZ;exports.TbChartBubble=exe;exports.TbChartFunnel=txe;exports.TbChartTreemap=nxe;exports.TextCard=Zg;exports.Textarea=Rm;exports.TiSortNumerically=oxe;exports.Toggle=_xe;exports.Tornado=HZ;exports.Trash2=Ga;exports.TriangleAlert=Ws;exports.TypeGlyph=iC;exports.UXProvider=nB;exports.Undo2=qZ;exports.User=qO;exports.Users=Uk;exports.UsersRound=UO;exports.VisualErrorState=Eue;exports.Zap=DR;exports.applyBriefingFormPatch=lv;exports.areContextEntitiesEqual=ir;exports.areEntitiesJoined=Qre;exports.arrayMove=Jb;exports.briefingFormDraftToCreateRequest=fF;exports.briefingFormDraftToUpdateRequest=kde;exports.briefingToFormDraft=Zp;exports.briefingTone=kr;exports.buildCardControlUsageById=kgt;exports.buildCustomCardTheme=Uw;exports.buildDashboardControlUsageById=jgt;exports.buildDashboardSheetsInputExecutionSnapshot=TO;exports.buildDashboardStructuralParticipantIdsByControlId=Yme;exports.buildFilterFieldMeta=o4;exports.buildFilterSemanticContext=s4;exports.buildInlineFilterNodes=K$;exports.buildMultiInputCustomVisualProps=G$;exports.buildMultiInputTemporalPresentationInputs=Y$;exports.buildSlotOrderedCards=PI;exports.calculateCardFilterValues=R5;exports.calculateContextAwareFilters=ow;exports.calculateFieldState=c3;exports.canUserAccessVisuals=pNe;exports.canUserCreateDashboards=XQ;exports.canUserEdit=fNe;exports.canUserManageDashboards=mNe;exports.canUserManageGroups=gNe;exports.canUserUseFilters=hNe;exports.cancelBriefingPreviewRun=mde;exports.cancelBriefingRun=gde;exports.cancelExport=N$e;exports.chartSupportsDataLabels=Une;exports.chartSupportsLegend=Hne;exports.chartTypes=YT;exports.cleanupKpiMetricComparisonMode=Xhe;exports.cloneDeep=Hs;exports.cloneLinkedFrameWithSourceMapping=zet;exports.closestCenter=uC;exports.commitSharedCalculatedFields=Hf;exports.createAssistantConversationId=Bp;exports.createAssistantRequestId=Ebe;exports.createBriefing=ide;exports.createBriefingFormDraft=dF;exports.createCardsFromSlots=cEe;exports.createChartConfig=Sb;exports.createCustomVisualTemporalBucketFormatter=Z$;exports.createDashboardControlInputFromControl=jyt;exports.createExport=moe;exports.createUniqueDashboardInputVariableNameFromName=Id;exports.currencyPresentationTargetKey=ma;exports.dedup=RNt;exports.dedupeContextEntities=Vz;exports.deleteBriefing=cde;exports.deleteBriefingRun=bde;exports.diagnoseCurrencyPresentationBindings=T0e;exports.doesStoredFilterMatchField=nb;exports.downloadDocumentPdf=mL;exports.downloadPdf=ote;exports.extractSqlParamReferences=AY;exports.extractTableMetadata=r4;exports.fieldAlreadyExists=eoe;exports.findCustomVisualConfigCard=gw;exports.flexRender=mi;exports.flushPendingEditorDrafts=oB;exports.formatDisplayFormula=wmt;exports.formatFileSize=I$e;exports.getAutoDetectedChartIcon=ckt;exports.getBriefing=sde;exports.getBriefingArtifact=Btt;exports.getBriefingEvidence=Vtt;exports.getBriefingPreviewRun=hde;exports.getBriefingRun=pde;exports.getCardCurrencyPresentationFields=NO;exports.getCardCurrencyPresentationTargets=jO;exports.getChartGridStyle=jDe;exports.getChartIconByType=ukt;exports.getColorForValue=QR;exports.getConfigSlotExpectedType=lEe;exports.getCoreRowModel=f_;exports.getCustomVisualInputCards=pw;exports.getDefaultAxisConfig=rA;exports.getDefaultChartColors=Lm;exports.getDefaultDataLabelsConfig=Cw;exports.getDefaultLegendConfig=UL;exports.getDefaultRunningTotalPartitionByFieldIds=d0;exports.getDisplayedKpiResultColumnKeys=jw;exports.getDocumentSectionEditorCard=ogt;exports.getDocumentSheetDashboardInputs=nx;exports.getDownloadUrl=S$e;exports.getEffectiveCardTypeForSlot=jh;exports.getEntityIcon=Pk;exports.getErrorMessage=gbe;exports.getExportStatus=C$e;exports.getExports=w$e;exports.getExpressionFieldKind=Gd;exports.getFieldExpressionAnnotation=i4;exports.getFilterCount=Xj;exports.getGranularityOptionsForFieldType=zme;exports.getKeys=br;exports.getMatrixVisualLoadingState=c_;exports.getMetricDisplayLabel=B3e;exports.getNewField=soe;exports.getObjectDiff=fY;exports.getPaginationRowModel=h_;exports.getRoleBasedDisplayOverrides=ZQ;exports.getRunningTotalOrderByCandidates=qht;exports.getSelectedDateFilterColumn=nue;exports.getSlotDefinitionForIndex=uL;exports.getSlotExpectedChartType=AI;exports.getSlotIndexForCard=Og;exports.getSortedRowModel=Roe;exports.getTableConditionalFormattingColumnOptions=Tpe;exports.getTableOutputColumnOptions=Epe;exports.getTablePageSizeOptions=foe;exports.handleAggregationChange=aF;exports.handleAggregationLabelChange=Vue;exports.hasFlatTableTotalsBehavior=Om;exports.hasMatrixResultData=Iw;exports.horizontalListSortingStrategy=Gz;exports.inferSemanticDomainIdFromSelectedEntities=Ak;exports.isActiveBriefingRunStatus=rk;exports.isCardSummaryVisibleOnCard=X$;exports.isCurrencyPresentationControl=I0e;exports.isCustomVisualConfigCard=eA;exports.isDefaultColor=ATe;exports.isEligibleFlatTableTotalsCard=uw;exports.isExportComplete=k$e;exports.isExportInProgress=j$e;exports.isInAiScopeArray=MNt;exports.isManagedCalculatedExpressionField=Wa;exports.isMetricTransformEnabled=Vht;exports.isPresentationCurrencyBinding=Vv;exports.isPromiseLike=rO;exports.isSqlBackedKpi=ioe;exports.isStructuralControlBinding=k0e;exports.isSubtotalEnabledAggregateTable=n4;exports.isSupportedDocumentTableCardType=sgt;exports.isTableType=dDe;exports.isTerminalBriefingRunStatus=nk;exports.lastAssistantMessageIsCompleteWithToolCalls=fbe;exports.listBriefingRuns=ztt;exports.listBriefingTenantSummaries=$tt;exports.listBriefings=Ltt;exports.merge=Wl;exports.mergeAxisConfig=oA;exports.normalizeConditionalFormatting=U5;exports.normalizeContextFormatMode=Nee;exports.normalizeDashboardCardPythonCode=db;exports.normalizeDashboardInputVariableName=Hv;exports.normalizeMultiInputPayload=dL;exports.pauseBriefing=ade;exports.pivotData=hw;exports.polishBriefingText=xde;exports.prepareFeedbackData=GT;exports.previewBriefingPlan=dde;exports.reindexSlotCards=aEe;exports.remarkGfm=Lz;exports.removeFromScopeArray=ANt;exports.requiresDashboardInputResolution=Jd;exports.resolveCurrencyPresentationTargetFormat=_ee;exports.resolveDashboardBriefingsVisibility=Gfe;exports.resolveDashboardControlsVisibility=vNe;exports.resolveDashboardInputContext=Wi;exports.resolveDashboardTitleEditability=yNe;exports.resolveDomainCalculatedFieldForEdit=gpt;exports.resolveMatrixCardMeasureInstances=Vk;exports.resolveMultiInputType=$m;exports.resolveMultiInputTypeFromVisual=uEe;exports.resolvePendingPivotTableResultState=d$e;exports.resolveTablePageSize=i_;exports.resolveTablePresentationStyle=k3;exports.resumeBriefing=lde;exports.runBriefingNow=ude;exports.runBriefingPreview=fde;exports.sanitizeAIScope=pbe;exports.saveCalculatedFieldToCardScope=OF;exports.saveCalculatedFieldToSharedScope=Nme;exports.saveCalculatedFieldToSheetScope=LF;exports.seedSemanticMetricFormatDefaults=Jhe;exports.setTableColumnVisibility=boe;exports.setupEditorWithCard=RI;exports.showAllTableColumns=M$e;exports.showJoinRequiredNotification=Jre;exports.sortByColumnsToSortState=rse;exports.sortStateToSortByColumns=ose;exports.sortableKeyboardCoordinates=Zz;exports.supportsLiveNumericPresentation=Bv;exports.supportsMetricTransformForMetric=Qhe;exports.supportsTableConditionalFormatting=kpe;exports.toEntityArray=Ua;exports.ue=it;exports.updateBriefing=rT;exports.useActiveExports=kNe;exports.useActiveToolStatus=Ybe;exports.useAddFrameWithFreshSemanticExecutionPayload=cz;exports.useAddNewFrame=ohe;exports.useAssistantContainer=tJ;exports.useAssistantContextEntities=fT;exports.useAssistantLayoutStore=Ch;exports.useAssistantPanel=JQ;exports.useAssistantProfile=Dbe;exports.useAutoSubmitQueue=Gbe;exports.useBrandStudioPreview=wIt;exports.useBriefingRunPolling=mF;exports.useBriefingUiCapabilities=Yfe;exports.useCalendarContext=s4e;exports.useCard=t$e;exports.useCardNumericPresentation=Na;exports.useCardSummary=Q$;exports.useChartNumericPresentation=Nb;exports.useChat=mbe;exports.useColumns=Jz;exports.useCreateVisualWithFrame=fSe;exports.useCurrentUserInfo=Xs;exports.useCustomVisual=mf;exports.useCustomVisualsQuery=q$;exports.useDashboardAppearance=ku;exports.useDashboardById=ZX;exports.useDashboardInteractionMode=$ue;exports.useDashboardPreferences=Dm;exports.useDashboardQuery=zv;exports.useDashboardStructuralParticipants=Zme;exports.useDashboardSummary=Cue;exports.useDataColumns=tme;exports.useDateFilterHook=eYe;exports.useDefaultDashboardMutation=HX;exports.useDisplayPreferences=rl;exports.useDroppable=Ihe;exports.useEditorAside=kT;exports.useEditorCardQuery=mb;exports.useEffectiveEditorCardType=sB;exports.useEnsureReactGlobals=_le;exports.useExportActions=nJ;exports.useExportStore=oI;exports.useFieldManagement=eme;exports.useFilterableFields=Ghe;exports.useFullscreenAssistant=eJ;exports.useGroupMembers=m1e;exports.useGroups=a5;exports.useHasDashboardId=rJ;exports.useInProgressExportsCount=INe;exports.useJoinabilityMap=t4;exports.useManagementActions=Nm;exports.useManagementStore=ks;exports.useMutation=js;exports.usePivotTableConfig=Vm;exports.usePluginQuery=uue;exports.useQuery=Vn;exports.useQueryClient=Vr;exports.useReactTable=m_;exports.useResolveExistingFrameSemanticExecutionPayload=qet;exports.useResolvedValueFormatPreferences=i4e;exports.useResourceManagement=n5;exports.useResourceUpdateState=XX;exports.useScopedFields=Khe;exports.useSelectedVisual=f0e;exports.useSemaphorContext=Tt;exports.useSensor=tb;exports.useSensors=gT;exports.useSortable=ex;exports.useStarredChartsStore=p_t;exports.useSurfaceAppearance=oc;exports.useTableQueryState=Goe;exports.useTextFilterHook=TUe;exports.useTheme=hO;exports.useTimezone=il;exports.useTopoJson=Nw;exports.useUnifiedUsers=nI;exports.useUpdateResource=WX;exports.useUpdateVisualMutation=hSe;exports.useUserPreferences=yQ;exports.useVisualById=Xk;exports.useVisualManagement=dSe;exports.validateBriefingFormDraft=hF;exports.validateFieldForChartType=Zhe;exports.verticalListSortingStrategy=Yz;
@@ -1,6 +1,6 @@
1
1
  import { jsxs as l, Fragment as R, jsx as a } from "react/jsx-runtime";
2
2
  import le, { useState as C, useRef as Y, useEffect as U, useCallback as A, useMemo as _ } from "react";
3
- import { az as Q, aA as ce, aB as B, aC as $, aD as oe, h as ie, i as ue, j as de, k as fe, l as M, m as W, aE as me, aF as V, aG as z, b as he, aH as pe, aI as ve, aJ as ye, aK as ge, aL as be } from "./index-CxnEYRCF.js";
3
+ import { az as Q, aA as ce, aB as B, aC as $, aD as oe, h as ie, i as ue, j as de, k as fe, l as M, m as W, aE as me, aF as V, aG as z, b as he, aH as pe, aI as ve, aJ as ye, aK as ge, aL as be } from "./index-CPuawpXJ.js";
4
4
  import { u as X, c as F, O as q, P as we, a as Ce, B as L, b as Se, d as G, L as ee, T as ke, F as Te, G as H, I as K } from "./switch-BXet-Sno.js";
5
5
  import { a as xe } from "./report-runtime-context-bCy3CVzK.js";
6
6
  import "./x-CXDkqdur.js";