semaphor 0.0.53 → 0.0.54

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.
@@ -250,7 +250,7 @@ Valid keys: `+JSON.stringify(Object.keys($),null," "));var G=ye(pe,ae,ce,le,de+
250
250
  * This source code is licensed under the ISC license.
251
251
  * See the LICENSE file in the root directory of this source tree.
252
252
  */const Tm=Dn("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),oQ=({data:e,filename:t="output.csv"})=>{const n=()=>{if(e.length===0)return;const r=[],o=Object.keys(e[0]);r.push(o.join(","));for(const c of e){const u=o.map(f=>`"${(""+c[f]).replace(/"/g,'""')}"`);r.push(u.join(","))}const i=r.join(`
253
- `),s=new Blob([i],{type:"text/csv"}),a=window.URL.createObjectURL(s),l=document.createElement("a");l.setAttribute("hidden",""),l.setAttribute("href",a),l.setAttribute("download",t),document.body.appendChild(l),l.click(),document.body.removeChild(l)};return O.jsx(QX,{onClick:n,className:"h-[14px] w-[14px] text-foreground/30 hover:cursor-pointer hover:text-foreground/50"})};function iQ({frame:e}){var _;const t=ke(S=>S.isDashboardEditing),n=ke(S=>S.filterValues),r=ke(S=>S.isVisualEditing),o=ke(S=>S.selectedSheetId);ke(S=>S.currentBreakpoint);const{removeFrame:i}=ke(S=>S.actions),s=ke(S=>S.actions.setIsVisualEditing),a=Ar(S=>S.actions.setFilterValues),l=Ar(S=>S.actions.setApplyFilters),{setCard:c,setFrame:u,setQueryResultColumns:f}=Ar(S=>S.actions),h=Ar(S=>S.actions.setSelectedConnectionId),g=Ar(S=>S.actions.setSelectedDatabaseName),v=Ar(S=>S.actions.setSelectedSchemaName),b=Ar(S=>S.actions.setSelectedTableName),x=e.cards.find(S=>S.id===e.activeCardId);function w(){s(!r),c(x);const{dimensionKeys:S}=ar((x==null?void 0:x.data)||[]);f(S),u(e),x!=null&&x.connectionId&&h(x==null?void 0:x.connectionId),x!=null&&x.lastSelectedDatabase&&g(x==null?void 0:x.lastSelectedDatabase),x!=null&&x.lastSelectedSchema&&v(x==null?void 0:x.lastSelectedSchema),x!=null&&x.lastSelectedTable&&b(x==null?void 0:x.lastSelectedTable),n&&(a(n),l(!0))}return O.jsx("section",{className:"absolute right-2 top-2 z-10",children:O.jsxs("div",{className:"flex items-center gap-2",children:[t&&(r?O.jsx(SX,{onClick:()=>{s(!r)},className:"h-[14px] w-[14px] text-foreground/30 hover:cursor-pointer hover:text-foreground/50"}):O.jsx(EX,{role:"edit-visual",onClick:w,className:"h-[14px] w-[14px] text-foreground/30 hover:cursor-pointer hover:text-foreground/50"})),t&&O.jsx(DA,{onClick:()=>i(o,e.id),className:"h-[14px] w-[14px] text-foreground/30 hover:cursor-pointer hover:text-foreground/50"}),((_=x.preferences)==null?void 0:_.allowDownload)===!0&&O.jsx(oQ,{data:(x==null?void 0:x.data)||[],filename:x.title})]})})}function sQ(e,t=globalThis==null?void 0:globalThis.document){const n=Ln(e);m.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r),()=>t.removeEventListener("keydown",r)},[n,t])}const gx="dismissableLayer.update",aQ="dismissableLayer.pointerDownOutside",lQ="dismissableLayer.focusOutside";let aP;const cQ=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),jf=m.forwardRef((e,t)=>{var n;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:a,onDismiss:l,...c}=e,u=m.useContext(cQ),[f,h]=m.useState(null),g=(n=f==null?void 0:f.ownerDocument)!==null&&n!==void 0?n:globalThis==null?void 0:globalThis.document,[,v]=m.useState({}),b=_t(t,k=>h(k)),x=Array.from(u.layers),[w]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),_=x.indexOf(w),S=f?x.indexOf(f):-1,R=u.layersWithOutsidePointerEventsDisabled.size>0,C=S>=_,P=uQ(k=>{const D=k.target,I=[...u.branches].some(F=>F.contains(D));!C||I||(i==null||i(k),a==null||a(k),k.defaultPrevented||l==null||l())},g),A=dQ(k=>{const D=k.target;[...u.branches].some(F=>F.contains(D))||(s==null||s(k),a==null||a(k),k.defaultPrevented||l==null||l())},g);return sQ(k=>{S===u.layers.size-1&&(o==null||o(k),!k.defaultPrevented&&l&&(k.preventDefault(),l()))},g),m.useEffect(()=>{if(f)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(aP=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),lP(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=aP)}},[f,g,r,u]),m.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),lP())},[f,u]),m.useEffect(()=>{const k=()=>v({});return document.addEventListener(gx,k),()=>document.removeEventListener(gx,k)},[]),m.createElement(Qe.div,he({},c,{ref:b,style:{pointerEvents:R?C?"auto":"none":void 0,...e.style},onFocusCapture:Me(e.onFocusCapture,A.onFocusCapture),onBlurCapture:Me(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:Me(e.onPointerDownCapture,P.onPointerDownCapture)}))});function uQ(e,t=globalThis==null?void 0:globalThis.document){const n=Ln(e),r=m.useRef(!1),o=m.useRef(()=>{});return m.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let c=function(){LA(aQ,n,l,{discrete:!0})};const l={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function dQ(e,t=globalThis==null?void 0:globalThis.document){const n=Ln(e),r=m.useRef(!1);return m.useEffect(()=>{const o=i=>{i.target&&!r.current&&LA(lQ,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function lP(){const e=new CustomEvent(gx);document.dispatchEvent(e)}function LA(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?ED(o,i):o.dispatchEvent(i)}const fQ=["top","right","bottom","left"],ca=Math.min,no=Math.max,Dg=Math.round,vp=Math.floor,ua=e=>({x:e,y:e}),hQ={left:"right",right:"left",bottom:"top",top:"bottom"},pQ={start:"end",end:"start"};function mx(e,t,n){return no(e,ca(t,n))}function ss(e,t){return typeof e=="function"?e(t):e}function as(e){return e.split("-")[0]}function iu(e){return e.split("-")[1]}function O1(e){return e==="x"?"y":"x"}function P1(e){return e==="y"?"height":"width"}function su(e){return["top","bottom"].includes(as(e))?"y":"x"}function T1(e){return O1(su(e))}function gQ(e,t,n){n===void 0&&(n=!1);const r=iu(e),o=T1(e),i=P1(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=$g(s)),[s,$g(s)]}function mQ(e){const t=$g(e);return[vx(e),t,vx(t)]}function vx(e){return e.replace(/start|end/g,t=>pQ[t])}function vQ(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:s;default:return[]}}function bQ(e,t,n,r){const o=iu(e);let i=vQ(as(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(vx)))),i}function $g(e){return e.replace(/left|right|bottom|top/g,t=>hQ[t])}function yQ(e){return{top:0,right:0,bottom:0,left:0,...e}}function FA(e){return typeof e!="number"?yQ(e):{top:e,right:e,bottom:e,left:e}}function Ag(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function cP(e,t,n){let{reference:r,floating:o}=e;const i=su(t),s=T1(t),a=P1(s),l=as(t),c=i==="y",u=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,h=r[a]/2-o[a]/2;let g;switch(l){case"top":g={x:u,y:r.y-o.height};break;case"bottom":g={x:u,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:f};break;case"left":g={x:r.x-o.width,y:f};break;default:g={x:r.x,y:r.y}}switch(iu(t)){case"start":g[s]-=h*(n&&c?-1:1);break;case"end":g[s]+=h*(n&&c?-1:1);break}return g}const xQ=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=cP(c,r,l),h=r,g={},v=0;for(let b=0;b<a.length;b++){const{name:x,fn:w}=a[b],{x:_,y:S,data:R,reset:C}=await w({x:u,y:f,initialPlacement:r,placement:h,strategy:o,middlewareData:g,rects:c,platform:s,elements:{reference:e,floating:t}});if(u=_??u,f=S??f,g={...g,[x]:{...g[x],...R}},C&&v<=50){v++,typeof C=="object"&&(C.placement&&(h=C.placement),C.rects&&(c=C.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:u,y:f}=cP(c,h,l)),b=-1;continue}}return{x:u,y:f,placement:h,strategy:o,middlewareData:g}};async function jd(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:g=0}=ss(t,e),v=FA(g),x=a[h?f==="floating"?"reference":"floating":f],w=Ag(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(x)))==null||n?x:x.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),_=f==="floating"?{...s.floating,x:r,y:o}:s.reference,S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),R=await(i.isElement==null?void 0:i.isElement(S))?await(i.getScale==null?void 0:i.getScale(S))||{x:1,y:1}:{x:1,y:1},C=Ag(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:_,offsetParent:S,strategy:l}):_);return{top:(w.top-C.top+v.top)/R.y,bottom:(C.bottom-w.bottom+v.bottom)/R.y,left:(w.left-C.left+v.left)/R.x,right:(C.right-w.right+v.right)/R.x}}const uP=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=ss(e,t)||{};if(c==null)return{};const f=FA(u),h={x:n,y:r},g=T1(o),v=P1(g),b=await s.getDimensions(c),x=g==="y",w=x?"top":"left",_=x?"bottom":"right",S=x?"clientHeight":"clientWidth",R=i.reference[v]+i.reference[g]-h[g]-i.floating[v],C=h[g]-i.reference[g],P=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let A=P?P[S]:0;(!A||!await(s.isElement==null?void 0:s.isElement(P)))&&(A=a.floating[S]||i.floating[v]);const k=R/2-C/2,D=A/2-b[v]/2-1,I=ca(f[w],D),F=ca(f[_],D),B=I,K=A-b[v]-F,Z=A/2-b[v]/2+k,z=mx(B,Z,K),Q=!l.arrow&&iu(o)!=null&&Z!=z&&i.reference[v]/2-(Z<B?I:F)-b[v]/2<0,W=Q?Z<B?Z-B:Z-K:0;return{[g]:h[g]+W,data:{[g]:z,centerOffset:Z-z-W,...Q&&{alignmentOffset:W}},reset:Q}}}),wQ=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:b=!0,...x}=ss(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const w=as(o),_=as(a)===a,S=await(l.isRTL==null?void 0:l.isRTL(c.floating)),R=h||(_||!b?[$g(a)]:mQ(a));!h&&v!=="none"&&R.push(...bQ(a,b,v,S));const C=[a,...R],P=await jd(t,x),A=[];let k=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&A.push(P[w]),f){const B=gQ(o,s,S);A.push(P[B[0]],P[B[1]])}if(k=[...k,{placement:o,overflows:A}],!A.every(B=>B<=0)){var D,I;const B=(((D=i.flip)==null?void 0:D.index)||0)+1,K=C[B];if(K)return{data:{index:B,overflows:k},reset:{placement:K}};let Z=(I=k.filter(z=>z.overflows[0]<=0).sort((z,Q)=>z.overflows[1]-Q.overflows[1])[0])==null?void 0:I.placement;if(!Z)switch(g){case"bestFit":{var F;const z=(F=k.map(Q=>[Q.placement,Q.overflows.filter(W=>W>0).reduce((W,Y)=>W+Y,0)]).sort((Q,W)=>Q[1]-W[1])[0])==null?void 0:F[0];z&&(Z=z);break}case"initialPlacement":Z=a;break}if(o!==Z)return{reset:{placement:Z}}}return{}}}};function dP(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function fP(e){return fQ.some(t=>e[t]>=0)}const _Q=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=ss(e,t);switch(r){case"referenceHidden":{const i=await jd(t,{...o,elementContext:"reference"}),s=dP(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:fP(s)}}}case"escaped":{const i=await jd(t,{...o,altBoundary:!0}),s=dP(i,n.floating);return{data:{escapedOffsets:s,escaped:fP(s)}}}default:return{}}}}};async function SQ(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=as(n),a=iu(n),l=su(n)==="y",c=["left","top"].includes(s)?-1:1,u=i&&l?-1:1,f=ss(t,e);let{mainAxis:h,crossAxis:g,alignmentAxis:v}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return a&&typeof v=="number"&&(g=a==="end"?v*-1:v),l?{x:g*u,y:h*c}:{x:h*c,y:g*u}}const CQ=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,l=await SQ(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},EQ=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:x=>{let{x:w,y:_}=x;return{x:w,y:_}}},...l}=ss(e,t),c={x:n,y:r},u=await jd(t,l),f=su(as(o)),h=O1(f);let g=c[h],v=c[f];if(i){const x=h==="y"?"top":"left",w=h==="y"?"bottom":"right",_=g+u[x],S=g-u[w];g=mx(_,g,S)}if(s){const x=f==="y"?"top":"left",w=f==="y"?"bottom":"right",_=v+u[x],S=v-u[w];v=mx(_,v,S)}const b=a.fn({...t,[h]:g,[f]:v});return{...b,data:{x:b.x-n,y:b.y-r}}}}},RQ=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:s}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=ss(e,t),u={x:n,y:r},f=su(o),h=O1(f);let g=u[h],v=u[f];const b=ss(a,t),x=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(l){const S=h==="y"?"height":"width",R=i.reference[h]-i.floating[S]+x.mainAxis,C=i.reference[h]+i.reference[S]-x.mainAxis;g<R?g=R:g>C&&(g=C)}if(c){var w,_;const S=h==="y"?"width":"height",R=["top","left"].includes(as(o)),C=i.reference[f]-i.floating[S]+(R&&((w=s.offset)==null?void 0:w[f])||0)+(R?0:x.crossAxis),P=i.reference[f]+i.reference[S]+(R?0:((_=s.offset)==null?void 0:_[f])||0)-(R?x.crossAxis:0);v<C?v=C:v>P&&(v=P)}return{[h]:g,[f]:v}}}},OQ=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:i}=t,{apply:s=()=>{},...a}=ss(e,t),l=await jd(t,a),c=as(n),u=iu(n),f=su(n)==="y",{width:h,height:g}=r.floating;let v,b;c==="top"||c==="bottom"?(v=c,b=u===(await(o.isRTL==null?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(b=c,v=u==="end"?"top":"bottom");const x=g-l[v],w=h-l[b],_=!t.middlewareData.shift;let S=x,R=w;if(f){const P=h-l.left-l.right;R=u||_?ca(w,P):P}else{const P=g-l.top-l.bottom;S=u||_?ca(x,P):P}if(_&&!u){const P=no(l.left,0),A=no(l.right,0),k=no(l.top,0),D=no(l.bottom,0);f?R=h-2*(P!==0||A!==0?P+A:no(l.left,l.right)):S=g-2*(k!==0||D!==0?k+D:no(l.top,l.bottom))}await s({...t,availableWidth:R,availableHeight:S});const C=await o.getDimensions(i.floating);return h!==C.width||g!==C.height?{reset:{rects:!0}}:{}}}};function da(e){return jA(e)?(e.nodeName||"").toLowerCase():"#document"}function so(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ds(e){var t;return(t=(jA(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function jA(e){return e instanceof Node||e instanceof so(e).Node}function ls(e){return e instanceof Element||e instanceof so(e).Element}function Si(e){return e instanceof HTMLElement||e instanceof so(e).HTMLElement}function hP(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof so(e).ShadowRoot}function zf(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=$o(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function PQ(e){return["table","td","th"].includes(da(e))}function D1(e){const t=$1(),n=$o(e);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function TQ(e){let t=Yc(e);for(;Si(t)&&!Dm(t);){if(D1(t))return t;t=Yc(t)}return null}function $1(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Dm(e){return["html","body","#document"].includes(da(e))}function $o(e){return so(e).getComputedStyle(e)}function $m(e){return ls(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Yc(e){if(da(e)==="html")return e;const t=e.assignedSlot||e.parentNode||hP(e)&&e.host||ds(e);return hP(t)?t.host:t}function zA(e){const t=Yc(e);return Dm(t)?e.ownerDocument?e.ownerDocument.body:e.body:Si(t)&&zf(t)?t:zA(t)}function zd(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=zA(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=so(o);return i?t.concat(s,s.visualViewport||[],zf(o)?o:[],s.frameElement&&n?zd(s.frameElement):[]):t.concat(o,zd(o,[],n))}function BA(e){const t=$o(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Si(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=Dg(n)!==i||Dg(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function A1(e){return ls(e)?e:e.contextElement}function yc(e){const t=A1(e);if(!Si(t))return ua(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=BA(t);let s=(i?Dg(n.width):n.width)/r,a=(i?Dg(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const DQ=ua(0);function VA(e){const t=so(e);return!$1()||!t.visualViewport?DQ:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function $Q(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==so(e)?!1:t}function ml(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=A1(e);let s=ua(1);t&&(r?ls(r)&&(s=yc(r)):s=yc(e));const a=$Q(i,n,r)?VA(i):ua(0);let l=(o.left+a.x)/s.x,c=(o.top+a.y)/s.y,u=o.width/s.x,f=o.height/s.y;if(i){const h=so(i),g=r&&ls(r)?so(r):r;let v=h.frameElement;for(;v&&r&&g!==h;){const b=yc(v),x=v.getBoundingClientRect(),w=$o(v),_=x.left+(v.clientLeft+parseFloat(w.paddingLeft))*b.x,S=x.top+(v.clientTop+parseFloat(w.paddingTop))*b.y;l*=b.x,c*=b.y,u*=b.x,f*=b.y,l+=_,c+=S,v=so(v).frameElement}}return Ag({width:u,height:f,x:l,y:c})}function AQ(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=Si(n),i=ds(n);if(n===i)return t;let s={scrollLeft:0,scrollTop:0},a=ua(1);const l=ua(0);if((o||!o&&r!=="fixed")&&((da(n)!=="body"||zf(i))&&(s=$m(n)),Si(n))){const c=ml(n);a=yc(n),l.x=c.x+n.clientLeft,l.y=c.y+n.clientTop}return{width:t.width*a.x,height:t.height*a.y,x:t.x*a.x-s.scrollLeft*a.x+l.x,y:t.y*a.y-s.scrollTop*a.y+l.y}}function kQ(e){return Array.from(e.getClientRects())}function HA(e){return ml(ds(e)).left+$m(e).scrollLeft}function MQ(e){const t=ds(e),n=$m(e),r=e.ownerDocument.body,o=no(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=no(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+HA(e);const a=-n.scrollTop;return $o(r).direction==="rtl"&&(s+=no(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function IQ(e,t){const n=so(e),r=ds(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;const c=$1();(!c||c&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:i,height:s,x:a,y:l}}function NQ(e,t){const n=ml(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Si(e)?yc(e):ua(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,l=o*i.x,c=r*i.y;return{width:s,height:a,x:l,y:c}}function pP(e,t,n){let r;if(t==="viewport")r=IQ(e,n);else if(t==="document")r=MQ(ds(e));else if(ls(t))r=NQ(t,n);else{const o=VA(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return Ag(r)}function WA(e,t){const n=Yc(e);return n===t||!ls(n)||Dm(n)?!1:$o(n).position==="fixed"||WA(n,t)}function LQ(e,t){const n=t.get(e);if(n)return n;let r=zd(e,[],!1).filter(a=>ls(a)&&da(a)!=="body"),o=null;const i=$o(e).position==="fixed";let s=i?Yc(e):e;for(;ls(s)&&!Dm(s);){const a=$o(s),l=D1(s);!l&&a.position==="fixed"&&(o=null),(i?!l&&!o:!l&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||zf(s)&&!l&&WA(e,s))?r=r.filter(u=>u!==s):o=a,s=Yc(s)}return t.set(e,r),r}function FQ(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?LQ(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,u)=>{const f=pP(t,u,o);return c.top=no(f.top,c.top),c.right=ca(f.right,c.right),c.bottom=ca(f.bottom,c.bottom),c.left=no(f.left,c.left),c},pP(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function jQ(e){return BA(e)}function zQ(e,t,n){const r=Si(t),o=ds(t),i=n==="fixed",s=ml(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=ua(0);if(r||!r&&!i)if((da(t)!=="body"||zf(o))&&(a=$m(t)),r){const c=ml(t,!0,i,t);l.x=c.x+t.clientLeft,l.y=c.y+t.clientTop}else o&&(l.x=HA(o));return{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}function gP(e,t){return!Si(e)||$o(e).position==="fixed"?null:t?t(e):e.offsetParent}function UA(e,t){const n=so(e);if(!Si(e))return n;let r=gP(e,t);for(;r&&PQ(r)&&$o(r).position==="static";)r=gP(r,t);return r&&(da(r)==="html"||da(r)==="body"&&$o(r).position==="static"&&!D1(r))?n:r||TQ(e)||n}const BQ=async function(e){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||UA,i=this.getDimensions;return{reference:zQ(t,await o(n),r),floating:{x:0,y:0,...await i(n)}}};function VQ(e){return $o(e).direction==="rtl"}const HQ={convertOffsetParentRelativeRectToViewportRelativeRect:AQ,getDocumentElement:ds,getClippingRect:FQ,getOffsetParent:UA,getElementRects:BQ,getClientRects:kQ,getDimensions:jQ,getScale:yc,isElement:ls,isRTL:VQ};function WQ(e,t){let n=null,r;const o=ds(e);function i(){clearTimeout(r),n&&n.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const{left:c,top:u,width:f,height:h}=e.getBoundingClientRect();if(a||t(),!f||!h)return;const g=vp(u),v=vp(o.clientWidth-(c+f)),b=vp(o.clientHeight-(u+h)),x=vp(c),_={rootMargin:-g+"px "+-v+"px "+-b+"px "+-x+"px",threshold:no(0,ca(1,l))||1};let S=!0;function R(C){const P=C[0].intersectionRatio;if(P!==l){if(!S)return s();P?s(!1,P):r=setTimeout(()=>{s(!1,1e-7)},100)}S=!1}try{n=new IntersectionObserver(R,{..._,root:o.ownerDocument})}catch{n=new IntersectionObserver(R,_)}n.observe(e)}return s(!0),i}function UQ(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=A1(e),u=o||i?[...c?zd(c):[],...zd(t)]:[];u.forEach(w=>{o&&w.addEventListener("scroll",n,{passive:!0}),i&&w.addEventListener("resize",n)});const f=c&&a?WQ(c,n):null;let h=-1,g=null;s&&(g=new ResizeObserver(w=>{let[_]=w;_&&_.target===c&&g&&(g.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{g&&g.observe(t)})),n()}),c&&!l&&g.observe(c),g.observe(t));let v,b=l?ml(e):null;l&&x();function x(){const w=ml(e);b&&(w.x!==b.x||w.y!==b.y||w.width!==b.width||w.height!==b.height)&&n(),b=w,v=requestAnimationFrame(x)}return n(),()=>{u.forEach(w=>{o&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),f&&f(),g&&g.disconnect(),g=null,l&&cancelAnimationFrame(v)}}const qQ=(e,t,n)=>{const r=new Map,o={platform:HQ,...n},i={...o.platform,_c:r};return xQ(e,t,{...o,platform:i})},GQ=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?uP({element:r.current,padding:o}).fn(n):{}:r?uP({element:r,padding:o}).fn(n):{}}}};var ig=typeof document<"u"?m.useLayoutEffect:m.useEffect;function kg(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!kg(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!kg(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function qA(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function mP(e,t){const n=qA(e);return Math.round(t*n)/n}function vP(e){const t=V.useRef(e);return ig(()=>{t.current=e}),t}function YQ(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,f]=V.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,g]=V.useState(r);kg(h,r)||g(r);const[v,b]=V.useState(null),[x,w]=V.useState(null),_=V.useCallback(Q=>{Q!=P.current&&(P.current=Q,b(Q))},[b]),S=V.useCallback(Q=>{Q!==A.current&&(A.current=Q,w(Q))},[w]),R=i||v,C=s||x,P=V.useRef(null),A=V.useRef(null),k=V.useRef(u),D=vP(l),I=vP(o),F=V.useCallback(()=>{if(!P.current||!A.current)return;const Q={placement:t,strategy:n,middleware:h};I.current&&(Q.platform=I.current),qQ(P.current,A.current,Q).then(W=>{const Y={...W,isPositioned:!0};B.current&&!kg(k.current,Y)&&(k.current=Y,dw.flushSync(()=>{f(Y)}))})},[h,t,n,I]);ig(()=>{c===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,f(Q=>({...Q,isPositioned:!1})))},[c]);const B=V.useRef(!1);ig(()=>(B.current=!0,()=>{B.current=!1}),[]),ig(()=>{if(R&&(P.current=R),C&&(A.current=C),R&&C){if(D.current)return D.current(R,C,F);F()}},[R,C,F,D]);const K=V.useMemo(()=>({reference:P,floating:A,setReference:_,setFloating:S}),[_,S]),Z=V.useMemo(()=>({reference:R,floating:C}),[R,C]),z=V.useMemo(()=>{const Q={position:n,left:0,top:0};if(!Z.floating)return Q;const W=mP(Z.floating,u.x),Y=mP(Z.floating,u.y);return a?{...Q,transform:"translate("+W+"px, "+Y+"px)",...qA(Z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:Y}},[n,a,Z.floating,u.x,u.y]);return V.useMemo(()=>({...u,update:F,refs:K,elements:Z,floatingStyles:z}),[u,F,K,Z,z])}function Am(e){const[t,n]=m.useState(void 0);return ur(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,a;if("borderBoxSize"in i){const l=i.borderBoxSize,c=Array.isArray(l)?l[0]:l;s=c.inlineSize,a=c.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}const GA="Popper",[YA,Ti]=Zn(GA),[KQ,KA]=YA(GA),XQ=e=>{const{__scopePopper:t,children:n}=e,[r,o]=m.useState(null);return m.createElement(KQ,{scope:t,anchor:r,onAnchorChange:o},n)},QQ="PopperAnchor",JQ=m.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=KA(QQ,n),s=m.useRef(null),a=_t(t,s);return m.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:m.createElement(Qe.div,he({},o,{ref:a}))}),XA="PopperContent",[ZQ,lye]=YA(XA),eJ=m.forwardRef((e,t)=>{var n,r,o,i,s,a,l,c;const{__scopePopper:u,side:f="bottom",sideOffset:h=0,align:g="center",alignOffset:v=0,arrowPadding:b=0,avoidCollisions:x=!0,collisionBoundary:w=[],collisionPadding:_=0,sticky:S="partial",hideWhenDetached:R=!1,updatePositionStrategy:C="optimized",onPlaced:P,...A}=e,k=KA(XA,u),[D,I]=m.useState(null),F=_t(t,Pe=>I(Pe)),[B,K]=m.useState(null),Z=Am(B),z=(n=Z==null?void 0:Z.width)!==null&&n!==void 0?n:0,Q=(r=Z==null?void 0:Z.height)!==null&&r!==void 0?r:0,W=f+(g!=="center"?"-"+g:""),Y=typeof _=="number"?_:{top:0,right:0,bottom:0,left:0,..._},oe=Array.isArray(w)?w:[w],$=oe.length>0,H={padding:Y,boundary:oe.filter(tJ),altBoundary:$},{refs:J,floatingStyles:N,placement:ce,isPositioned:le,middlewareData:de}=YQ({strategy:"fixed",placement:W,whileElementsMounted:(...Pe)=>UQ(...Pe,{animationFrame:C==="always"}),elements:{reference:k.anchor},middleware:[CQ({mainAxis:h+Q,alignmentAxis:v}),x&&EQ({mainAxis:!0,crossAxis:!1,limiter:S==="partial"?RQ():void 0,...H}),x&&wQ({...H}),OQ({...H,apply:({elements:Pe,rects:Te,availableWidth:Ue,availableHeight:Be})=>{const{width:Ie,height:Ke}=Te.reference,lt=Pe.floating.style;lt.setProperty("--radix-popper-available-width",`${Ue}px`),lt.setProperty("--radix-popper-available-height",`${Be}px`),lt.setProperty("--radix-popper-anchor-width",`${Ie}px`),lt.setProperty("--radix-popper-anchor-height",`${Ke}px`)}}),B&&GQ({element:B,padding:b}),nJ({arrowWidth:z,arrowHeight:Q}),R&&_Q({strategy:"referenceHidden",...H})]}),[pe,ie]=QA(ce),te=Ln(P);ur(()=>{le&&(te==null||te())},[le,te]);const ae=(o=de.arrow)===null||o===void 0?void 0:o.x,ye=(i=de.arrow)===null||i===void 0?void 0:i.y,G=((s=de.arrow)===null||s===void 0?void 0:s.centerOffset)!==0,[be,_e]=m.useState();return ur(()=>{D&&_e(window.getComputedStyle(D).zIndex)},[D]),m.createElement("div",{ref:J.setFloating,"data-radix-popper-content-wrapper":"",style:{...N,transform:le?N.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:be,"--radix-popper-transform-origin":[(a=de.transformOrigin)===null||a===void 0?void 0:a.x,(l=de.transformOrigin)===null||l===void 0?void 0:l.y].join(" ")},dir:e.dir},m.createElement(ZQ,{scope:u,placedSide:pe,onArrowChange:K,arrowX:ae,arrowY:ye,shouldHideArrow:G},m.createElement(Qe.div,he({"data-side":pe,"data-align":ie},A,{ref:F,style:{...A.style,animation:le?void 0:"none",opacity:(c=de.hide)!==null&&c!==void 0&&c.referenceHidden?0:void 0}}))))});function tJ(e){return e!==null}const nJ=e=>({name:"transformOrigin",options:e,fn(t){var n,r,o,i,s;const{placement:a,rects:l,middlewareData:c}=t,f=((n=c.arrow)===null||n===void 0?void 0:n.centerOffset)!==0,h=f?0:e.arrowWidth,g=f?0:e.arrowHeight,[v,b]=QA(a),x={start:"0%",center:"50%",end:"100%"}[b],w=((r=(o=c.arrow)===null||o===void 0?void 0:o.x)!==null&&r!==void 0?r:0)+h/2,_=((i=(s=c.arrow)===null||s===void 0?void 0:s.y)!==null&&i!==void 0?i:0)+g/2;let S="",R="";return v==="bottom"?(S=f?x:`${w}px`,R=`${-g}px`):v==="top"?(S=f?x:`${w}px`,R=`${l.floating.height+g}px`):v==="right"?(S=`${-g}px`,R=f?x:`${_}px`):v==="left"&&(S=`${l.floating.width+g}px`,R=f?x:`${_}px`),{data:{x:S,y:R}}}});function QA(e){const[t,n="center"]=e.split("-");return[t,n]}const Bf=XQ,Vf=JQ,Hf=eJ,k1=m.forwardRef((e,t)=>{var n;const{container:r=globalThis==null||(n=globalThis.document)===null||n===void 0?void 0:n.body,...o}=e;return r?ko.createPortal(m.createElement(Qe.div,he({},o,{ref:t})),r):null}),rJ=m.forwardRef((e,t)=>{const{children:n,...r}=e,o=m.Children.toArray(n),i=o.find(oJ);if(i){const s=i.props.children,a=o.map(l=>l===i?m.Children.count(s)>1?m.Children.only(null):m.isValidElement(s)?s.props.children:null:l);return m.createElement(bx,he({},r,{ref:t}),m.isValidElement(s)?m.cloneElement(s,void 0,a):null)}return m.createElement(bx,he({},r,{ref:t}),n)});rJ.displayName="Slot";const bx=m.forwardRef((e,t)=>{const{children:n,...r}=e;return m.isValidElement(n)?m.cloneElement(n,{...iJ(r,n.props),ref:t?cs(t,n.ref):n.ref}):m.Children.count(n)>1?m.Children.only(null):null});bx.displayName="SlotClone";const JA=({children:e})=>m.createElement(m.Fragment,null,e);function oJ(e){return m.isValidElement(e)&&e.type===JA}function iJ(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}const ZA=m.forwardRef((e,t)=>m.createElement(Qe.span,he({},e,{ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}))),sJ=ZA,[km,cye]=Zn("Tooltip",[Ti]),M1=Ti(),aJ="TooltipProvider",lJ=700,yx="tooltip.open",[cJ,I1]=km(aJ),uJ=e=>{const{__scopeTooltip:t,delayDuration:n=lJ,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=e,[s,a]=m.useState(!0),l=m.useRef(!1),c=m.useRef(0);return m.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),m.createElement(cJ,{scope:t,isOpenDelayed:s,delayDuration:n,onOpen:m.useCallback(()=>{window.clearTimeout(c.current),a(!1)},[]),onClose:m.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a(!0),r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:m.useCallback(u=>{l.current=u},[]),disableHoverableContent:o},i)},N1="Tooltip",[dJ,Mm]=km(N1),fJ=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o=!1,onOpenChange:i,disableHoverableContent:s,delayDuration:a}=e,l=I1(N1,e.__scopeTooltip),c=M1(t),[u,f]=m.useState(null),h=Jo(),g=m.useRef(0),v=s??l.disableHoverableContent,b=a??l.delayDuration,x=m.useRef(!1),[w=!1,_]=xr({prop:r,defaultProp:o,onChange:A=>{A?(l.onOpen(),document.dispatchEvent(new CustomEvent(yx))):l.onClose(),i==null||i(A)}}),S=m.useMemo(()=>w?x.current?"delayed-open":"instant-open":"closed",[w]),R=m.useCallback(()=>{window.clearTimeout(g.current),x.current=!1,_(!0)},[_]),C=m.useCallback(()=>{window.clearTimeout(g.current),_(!1)},[_]),P=m.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>{x.current=!0,_(!0)},b)},[b,_]);return m.useEffect(()=>()=>window.clearTimeout(g.current),[]),m.createElement(Bf,c,m.createElement(dJ,{scope:t,contentId:h,open:w,stateAttribute:S,trigger:u,onTriggerChange:f,onTriggerEnter:m.useCallback(()=>{l.isOpenDelayed?P():R()},[l.isOpenDelayed,P,R]),onTriggerLeave:m.useCallback(()=>{v?C():window.clearTimeout(g.current)},[C,v]),onOpen:R,onClose:C,disableHoverableContent:v},n))},bP="TooltipTrigger",ek=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Mm(bP,n),i=I1(bP,n),s=M1(n),a=m.useRef(null),l=_t(t,a,o.onTriggerChange),c=m.useRef(!1),u=m.useRef(!1),f=m.useCallback(()=>c.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),m.createElement(Vf,he({asChild:!0},s),m.createElement(Qe.button,he({"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute},r,{ref:l,onPointerMove:Me(e.onPointerMove,h=>{h.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),u.current=!0)}),onPointerLeave:Me(e.onPointerLeave,()=>{o.onTriggerLeave(),u.current=!1}),onPointerDown:Me(e.onPointerDown,()=>{c.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Me(e.onFocus,()=>{c.current||o.onOpen()}),onBlur:Me(e.onBlur,o.onClose),onClick:Me(e.onClick,o.onClose)})))}),hJ="TooltipPortal",[uye,pJ]=km(hJ,{forceMount:void 0}),Bd="TooltipContent",gJ=m.forwardRef((e,t)=>{const n=pJ(Bd,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...i}=e,s=Mm(Bd,e.__scopeTooltip);return m.createElement(er,{present:r||s.open},s.disableHoverableContent?m.createElement(tk,he({side:o},i,{ref:t})):m.createElement(mJ,he({side:o},i,{ref:t})))}),mJ=m.forwardRef((e,t)=>{const n=Mm(Bd,e.__scopeTooltip),r=I1(Bd,e.__scopeTooltip),o=m.useRef(null),i=_t(t,o),[s,a]=m.useState(null),{trigger:l,onClose:c}=n,u=o.current,{onPointerInTransitChange:f}=r,h=m.useCallback(()=>{a(null),f(!1)},[f]),g=m.useCallback((v,b)=>{const x=v.currentTarget,w={x:v.clientX,y:v.clientY},_=bJ(w,x.getBoundingClientRect()),S=yJ(w,_),R=xJ(b.getBoundingClientRect()),C=_J([...S,...R]);a(C),f(!0)},[f]);return m.useEffect(()=>()=>h(),[h]),m.useEffect(()=>{if(l&&u){const v=x=>g(x,u),b=x=>g(x,l);return l.addEventListener("pointerleave",v),u.addEventListener("pointerleave",b),()=>{l.removeEventListener("pointerleave",v),u.removeEventListener("pointerleave",b)}}},[l,u,g,h]),m.useEffect(()=>{if(s){const v=b=>{const x=b.target,w={x:b.clientX,y:b.clientY},_=(l==null?void 0:l.contains(x))||(u==null?void 0:u.contains(x)),S=!wJ(w,s);_?h():S&&(h(),c())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[l,u,s,c,h]),m.createElement(tk,he({},e,{ref:i}))}),[vJ,dye]=km(N1,{isInside:!1}),tk=m.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:s,...a}=e,l=Mm(Bd,n),c=M1(n),{onClose:u}=l;return m.useEffect(()=>(document.addEventListener(yx,u),()=>document.removeEventListener(yx,u)),[u]),m.useEffect(()=>{if(l.trigger){const f=h=>{const g=h.target;g!=null&&g.contains(l.trigger)&&u()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[l.trigger,u]),m.createElement(jf,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:u},m.createElement(Hf,he({"data-state":l.stateAttribute},c,a,{ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"}}),m.createElement(JA,null,r),m.createElement(vJ,{scope:n,isInside:!0},m.createElement(sJ,{id:l.contentId,role:"tooltip"},o||r))))});function bJ(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function yJ(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function xJ(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function wJ(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const a=t[i].x,l=t[i].y,c=t[s].x,u=t[s].y;l>r!=u>r&&n<(c-a)*(r-l)/(u-l)+a&&(o=!o)}return o}function _J(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),SJ(t)}function SJ(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const i=t[t.length-1],s=t[t.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const i=n[n.length-1],s=n[n.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}const CJ=uJ,EJ=fJ,RJ=ek,nk=gJ,OJ=CJ,rk=EJ,ok=RJ,L1=V.forwardRef(({className:e,sideOffset:t=4,...n},r)=>O.jsx(nk,{ref:r,sideOffset:t,className:Ce("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n}));L1.displayName=nk.displayName;function ll({number:e,decimalPlaces:t=0,useSuffix:n=!1,customSuffix:r="",currency:o="",locale:i="en-US"}){let s=1,a=r,l=i;const c=t;n&&!r&&(e>=1e9?(s=1e9,a="B"):e>=1e7&&i==="en-IN"?(s=1e7,a="Cr"):e>=1e5&&i==="en-IN"?(s=1e5,a="L"):e>=1e6?(s=1e6,a="M"):e>=1e3&&(s=1e3,a="K"));const u=e/s,f={maximumFractionDigits:c,minimumFractionDigits:c};if(o){f.style="currency",f.currency=o;try{new Intl.NumberFormat(i,f).format(0)}catch{f.currency="USD"}}try{new Intl.NumberFormat(i,f).format(0)}catch{l="en-US"}let g=new Intl.NumberFormat(l,f).format(u);return n&&(g+=a),g}function ik(e,t){if(!t)return"";const n=t.find(r=>e>=r.start&&e<=r.end);return(n==null?void 0:n.color)||""}function sk({card:e,isLoading:t}){var w,_,S,R,C,P,A,k,D,I,F,B,K,Z,z,Q,W,Y,oe,$,H,J,N,ce;const n=ke(le=>le.actions.setCardTitle),r=ke(le=>le.actions.setCardDescription),o=ke(le=>le.isVisualEditing),i=Ar(le=>le.card),s=Ar(le=>le.actions.setCard);Ar(le=>le.actions.setNumberFormat);const a=ke(le=>le.selectedSheetId),l=e.data,c=(_=(w=e.preferences)==null?void 0:w.formatNumber)==null?void 0:_.colorRanges,{metricKeys:u}=ar(l||[]),f=(S=l==null?void 0:l[0])==null?void 0:S[u==null?void 0:u[0]],h=(R=l==null?void 0:l[0])==null?void 0:R[u==null?void 0:u[1]],g=!!e.data&&e.data.length>0;function v(le){o?s({...i,title:le}):n(a,e.id,le)}function b(le){o?s({...i,description:le}):r(a,e.id,le)}const x=h&&h-f!==0?(f-h)/h:null;return O.jsxs("div",{className:"kpi-card flex grow flex-col overflow-scroll",children:[O.jsxs(am,{className:"grow pb-3",children:[O.jsx(is,{text:o?i.title:e.title,onSave:v,children:O.jsxs("div",{className:"flex items-center gap-2",children:[O.jsx($f,{className:"text-base font-medium text-muted-foreground",children:e.title}),!e.refreshInterval&&t&&O.jsx(C1,{className:"h-4 w-4 animate-spin text-muted-foreground"})]})}),g&&O.jsxs("div",{className:"flex flex-wrap items-end gap-3 text-foreground",children:[O.jsx("p",{style:{color:ik(f,c)},className:"text-3xl font-semibold",children:ll({number:f,decimalPlaces:((P=(C=e.preferences)==null?void 0:C.formatNumber)==null?void 0:P.decimalPlaces)||0,useSuffix:!!((k=(A=e.preferences)==null?void 0:A.formatNumber)!=null&&k.suffix),customSuffix:((I=(D=e.preferences)==null?void 0:D.formatNumber)==null?void 0:I.suffix)||"",locale:((B=(F=e.preferences)==null?void 0:F.formatNumber)==null?void 0:B.locale)||"",currency:((Z=(K=e.preferences)==null?void 0:K.formatNumber)==null?void 0:Z.currency)||""})}),h&&O.jsxs("span",{className:"min-w-fit text-base font-normal text-muted-foreground",children:["from  ",ll({number:h,decimalPlaces:((Q=(z=e.preferences)==null?void 0:z.formatNumber)==null?void 0:Q.decimalPlaces)||0,useSuffix:!!((Y=(W=e.preferences)==null?void 0:W.formatNumber)!=null&&Y.suffix),customSuffix:(($=(oe=e.preferences)==null?void 0:oe.formatNumber)==null?void 0:$.suffix)||"",locale:((J=(H=e.preferences)==null?void 0:H.formatNumber)==null?void 0:J.locale)||"",currency:((ce=(N=e.preferences)==null?void 0:N.formatNumber)==null?void 0:ce.currency)||""})]})]})]}),x&&O.jsxs(lm,{className:"grow items-start gap-1 pb-4 text-sm",children:[O.jsx(PJ,{children:x}),O.jsxs("div",{className:"flex gap-1 text-muted-foreground",children:[x>0?"up ":"down ",O.jsx(is,{text:e.description||"",onSave:b,children:e.description})]})]})]})}function PJ({children:e}){const t=e>0?O.jsx(_1,{className:"h-4 w-4"}):O.jsx(w1,{className:"h-4 w-4"}),n=`${Math.abs(e*100).toFixed(0)}%`;return O.jsxs("div",{className:Ce("flex items-center",{"text-green-600":e>0,"text-destructive":e<0}),children:[t,O.jsx("span",{className:"ml-[1px]",children:n})]})}var Kc=1e3,Xc=Kc*60,Qc=Xc*60,vl=Qc*24,TJ=vl*7,DJ=vl*365.25,$J=function(e,t){t=t||{};var n=typeof e;if(n==="string"&&e.length>0)return AJ(e);if(n==="number"&&isFinite(e))return t.long?MJ(e):kJ(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function AJ(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*DJ;case"weeks":case"week":case"w":return n*TJ;case"days":case"day":case"d":return n*vl;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Qc;case"minutes":case"minute":case"mins":case"min":case"m":return n*Xc;case"seconds":case"second":case"secs":case"sec":case"s":return n*Kc;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function kJ(e){var t=Math.abs(e);return t>=vl?Math.round(e/vl)+"d":t>=Qc?Math.round(e/Qc)+"h":t>=Xc?Math.round(e/Xc)+"m":t>=Kc?Math.round(e/Kc)+"s":e+"ms"}function MJ(e){var t=Math.abs(e);return t>=vl?bp(e,t,vl,"day"):t>=Qc?bp(e,t,Qc,"hour"):t>=Xc?bp(e,t,Xc,"minute"):t>=Kc?bp(e,t,Kc,"second"):e+" ms"}function bp(e,t,n,r){var o=t>=n*1.5;return Math.round(e/n)+" "+r+(o?"s":"")}const IJ=nu($J);function ak({children:e}){const{setIsSessionExpired:t}=Mo(),n=new Jz({queryCache:new gD({onError:r=>{console.error(`Something went wrong: ${r.message}`),r.message==="invalid token"&&t(!0)}}),defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1}}});return O.jsx(nB,{client:n,children:e})}function au({children:e,className:t,...n}){return O.jsx("div",{className:Ce("semaphor-scope",t),...n,children:e})}const NJ={id:"",authToken:void 0},lk=m.createContext(NJ),ck=({children:e,dashboardProps:t})=>O.jsx(ak,{children:O.jsx(lk.Provider,{value:t,children:O.jsx(au,{style:{height:"100%"},children:e})})});function ma(){const e=m.useContext(lk);if(e===void 0)throw new Error("useApplicationContext must be used within a ApplicationContextProvider");return e}function LJ(e){ke(u=>u.bookmarkKey),ke(u=>u.selectedSheetId);const t=ke(u=>u.dashboard.baseQueries),n=ke(u=>u.actions.getCardSheet),{authToken:r}=ma(),o=ke(u=>u.authToken),i=ke(u=>u.filterValues),s=ke(u=>u.isDashboardEditing),a=IJ((e==null?void 0:e.refreshInterval)||"0");n(e.id);const l=K2(e.sql,t);return Df({queryKey:[e.id,l],queryFn:()=>Of("https://semaphor.cloud/api/v1/query",(r==null?void 0:r.accessToken)||(o==null?void 0:o.accessToken)||"",{connection_id:e.connectionId,sql:l,python:e.python===lD?"":e.python,active_filters:i}),refetchInterval:a,enabled:!!e.connectionId&&!s})}function Ia({data:e,cfg:t,customCfg:n,preferences:r}){const{dimensionKeys:o,metricKeys:i}=ar(e),s=BX(i,e,r),a=og(s,n),l=o[0],c=hx(e,l);F1(r,t),uk(r);const u=dk(t,r),f=qo((t==null?void 0:t.options)||{},r==null?void 0:r.chartOptions),h=qo(u,f),g=qo(h,(n==null?void 0:n.options)||{});return{type:(n==null?void 0:n.type)||(t==null?void 0:t.type)||"bar",data:{labels:c,datasets:a},options:g}}function F1(e,t){var o,i,s;const n=((o=t==null?void 0:t.options)==null?void 0:o.indexAxis)==="y"?"x":"y";return(i=e==null?void 0:e.chartOptions)!=null&&i.indexAxis?((s=e==null?void 0:e.chartOptions)==null?void 0:s.indexAxis)==="x"?"y":"x":n}function uk(e){var n,r;return(n=e==null?void 0:e.chartOptions)!=null&&n.indexAxis?((r=e==null?void 0:e.chartOptions)==null?void 0:r.indexAxis)==="x"?"x":"y":"x"}function dk(e,t){var i,s,a,l,c,u,f,h,g,v,b,x;const n=F1(t,e),r=uk(t);return{...e==null?void 0:e.options,scales:{...(i=e==null?void 0:e.options)==null?void 0:i.scales,[n]:{...(a=(s=e==null?void 0:e.options)==null?void 0:s.scales)==null?void 0:a[n],ticks:{...(u=(c=(l=e==null?void 0:e.options)==null?void 0:l.scales)==null?void 0:c[n])==null?void 0:u.ticks,callback:w=>{var _,S,R,C;return ll({number:Number(w),decimalPlaces:((_=t==null?void 0:t.numberAxisFormat)==null?void 0:_.decimalPlaces)||0,useSuffix:!!((S=t==null?void 0:t.numberAxisFormat)!=null&&S.suffix),customSuffix:"",locale:((R=t==null?void 0:t.numberAxisFormat)==null?void 0:R.locale)||"",currency:((C=t==null?void 0:t.numberAxisFormat)==null?void 0:C.currency)||""})}}},[r]:{...(g=(h=(f=e==null?void 0:e.options)==null?void 0:f.scales)==null?void 0:h[r])==null?void 0:g.ticks,callback:null}},plugins:{...(v=e==null?void 0:e.options)==null?void 0:v.plugins,datalabels:{...(x=(b=e==null?void 0:e.options)==null?void 0:b.plugins)==null?void 0:x.datalabels,formatter:function(w){var _,S,R,C;return ll({number:Number(w),decimalPlaces:((_=t==null?void 0:t.numberAxisFormat)==null?void 0:_.decimalPlaces)||0,useSuffix:!!((S=t==null?void 0:t.numberAxisFormat)!=null&&S.suffix),customSuffix:"",locale:((R=t==null?void 0:t.numberAxisFormat)==null?void 0:R.locale)||"",currency:((C=t==null?void 0:t.numberAxisFormat)==null?void 0:C.currency)||""})}}}}}function FJ(e){return{...e,type:"bar",options:{...e==null?void 0:e.options,indexAxis:"y",scales:{x:{display:!0},y:{display:!0}}}}}function jJ(e){return{...e,type:"bar",options:{...e==null?void 0:e.options,indexAxis:"y",scales:{x:{beginAtZero:!0,stack:1,reverse:!0},y:{stacked:!0,beginAtZero:!0}}}}}function zJ(e){return{...e,type:"bar",options:{...e==null?void 0:e.options,scales:{x:{display:!0},y:{display:!0}}}}}function BJ(e,t=!1){return{...e,type:"bar",options:{...e==null?void 0:e.options,indexAxis:"y",scales:{x:{display:!0,beginAtZero:!1},y:{display:!0,stacked:t}}}}}function VJ(e,t){var r,o,i,s;return{...e,type:t==="stackedBar"?"bar":"line",options:{...e==null?void 0:e.options,scales:{x:{...(o=(r=e==null?void 0:e.options)==null?void 0:r.scales)==null?void 0:o.x,display:!0,stacked:!0},y:{...(s=(i=e==null?void 0:e.options)==null?void 0:i.scales)==null?void 0:s.y,display:!0,stacked:!0}}}}}function HJ(e){return{...e,type:"line",options:{...e==null?void 0:e.options,scales:{x:{display:!0},y:{display:!0}}}}}function WJ(e,t){var r;return{...t,type:e,options:{...t==null?void 0:t.options,scales:{x:{display:!1},y:{display:!1}},plugins:{...(r=t==null?void 0:t.options)==null?void 0:r.plugins,legend:{position:"top",align:"center",maxHeight:0,labels:{useBorderRadius:!0,borderRadius:2}}},borderRadius:0}}}function UJ(e){return{...e,type:"radar",options:{...e==null?void 0:e.options,scales:{x:{display:!1},y:{display:!1}}}}}function qJ(e){const n=new Function("getDatalabelColor",e)(_0);return{options:n==null?void 0:n.options,plugins:(n==null?void 0:n.plugins)||[]}}function j1({data:e,cardType:t="bar",cfg:n,customCfg:r,provider:o="chartjs",userSettings:i,preferences:s}){var a,l,c;if(t==="bar"){const u=zJ(n);return Ia({data:e,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="horizontalBar"){const u=FJ(n);return Ia({data:e,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="pyramid"){const u=jJ(n),{dimensionKeys:f,metricKeys:h}=ar(e),g=Tg({dataArray:e,groupKey:f[0],pivotKey:f[1],valueKey:h[0]}),v=Ia({data:g,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s}),b="x2";return{...v,data:{...v.data,datasets:v.data.datasets.map((w,_)=>_===1?{...w,xAxisID:b}:w)},options:{...v.options,scales:{...(a=v==null?void 0:v.options)==null?void 0:a.scales,[b]:{beginAtZero:!0,stack:1}}}}}if(t==="stackedBar"||t==="stackedLine"){const u=VJ(n,t),{dimensionKeys:f,metricKeys:h}=ar(e),g=Tg({dataArray:e,groupKey:f[0],pivotKey:f[1],valueKey:h[0]});return Ia({data:g,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="line"){const u=HJ(n);return Ia({data:e,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="range"){const u=BJ(n),f=WX(e),h=og(f,r),{plugins:g,options:v}=qJ((s==null?void 0:s.customVisualCode)||""),b=qo((u==null?void 0:u.options)||{},(n==null?void 0:n.options)||{}),x=qo(b,(s==null?void 0:s.chartOptions)||{}),w=qo(x,(r==null?void 0:r.options)||{}),_=qo(w,v),S=dk(n,s),R=qo(_,S),C={...R,plugins:{...R==null?void 0:R.plugins,datalabels:{...(l=R==null?void 0:R.plugins)==null?void 0:l.datalabels,formatter:(I,F)=>I.map(K=>{var Z,z,Q,W;return ll({number:Number(K),decimalPlaces:((Z=s==null?void 0:s.numberAxisFormat)==null?void 0:Z.decimalPlaces)||0,useSuffix:!!((z=s==null?void 0:s.numberAxisFormat)!=null&&z.suffix),customSuffix:"",locale:((Q=s==null?void 0:s.numberAxisFormat)==null?void 0:Q.locale)||"",currency:((W=s==null?void 0:s.numberAxisFormat)==null?void 0:W.currency)||""})}).slice(0,2).join(" - ")}}},{dimensionKeys:P}=ar(e),A=P[0];return{type:"bar",data:{labels:[...new Set(hx(e,A))],datasets:h},options:C,plugins:[...g]}}if(t==="pie"||t==="doughnut"||t==="polarArea"){const u=WJ(t,n),{dimensionKeys:f,metricKeys:h}=ar(e),g=UX(h,e),v=og(g,r),b=f[0],x=hx(e,b),w=qo((u==null?void 0:u.options)||{},(r==null?void 0:r.options)||{}),_=qo(w,(s==null?void 0:s.chartOptions)||{}),S={..._,plugins:{..._.plugins,datalabels:{...(c=_.plugins)==null?void 0:c.datalabels,formatter:(P,A)=>{var k,D,I,F;return ll({number:Number(P),decimalPlaces:((k=s==null?void 0:s.numberAxisFormat)==null?void 0:k.decimalPlaces)||0,useSuffix:!!((D=s==null?void 0:s.numberAxisFormat)!=null&&D.suffix),customSuffix:"",locale:((I=s==null?void 0:s.numberAxisFormat)==null?void 0:I.locale)||"",currency:((F=s==null?void 0:s.numberAxisFormat)==null?void 0:F.currency)||""})}}}};return{type:t,data:{labels:x,datasets:v},options:S,plugins:[t==="doughnut"?{id:"doughnutLabel",beforeDatasetsDraw:function(P,A,k){var Q,W,Y,oe;const{ctx:D,data:I}=P;D.save();const F=P.getDatasetMeta(0).data[0].x,B=P.getDatasetMeta(0).data[0].y,K=Bc(Pd());D.font="1.2rem Arial",D.fontWeight="bolder",D.fillStyle=K,D.textAlign="center",D.textBaseline="middle";const Z=I.datasets[0].data.reduce(($,H)=>$+H,0),z=ll({number:Number(Z),decimalPlaces:((Q=s==null?void 0:s.numberAxisFormat)==null?void 0:Q.decimalPlaces)||0,useSuffix:!!((W=s==null?void 0:s.numberAxisFormat)!=null&&W.suffix),customSuffix:"",locale:((Y=s==null?void 0:s.numberAxisFormat)==null?void 0:Y.locale)||"",currency:((oe=s==null?void 0:s.numberAxisFormat)==null?void 0:oe.currency)||""});D.fillText(z,F,B)}}:""]}}if(t==="radar"){const u=UJ(n);return Ia({data:e,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="bubble"||t==="scatter"){const{metricKeys:u}=ar(e);if(u.length<3){console.log("Bubble charts require 3 numeric columns");return}const f=HX(e),h=og(f,r),g={plugins:{datalabels:{display:!0}},scales:{x:{title:{display:!0,text:u[0]},beginAtZero:!0,ticks:{precision:0}},y:{title:{display:!0,text:u[1]},beginAtZero:!0,ticks:{precision:0}}}},v=qo(g,(r==null?void 0:r.options)||{});return{type:t,data:{datasets:h},options:v}}return Ia({data:e,cfg:n,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}function GJ({chart:e,elementIndex:t,datasetIndex:n,cardType:r,cfg:o,apply:i}){const s=ke.getState().theme;if(!o)return;const a=s==="dark"?"rgb(238,238,238,0.2)":"rgb(238,238,238,0.8)";["bar","line","horizontalBar","bubble","scatter"].includes(r)&&KJ(e,t,o,i,a),["pie","doughnut","polarArea"].includes(r)&&XJ(e,t,o,i,a),["stackedBar","pyramid"].includes(r)&&YJ({chart:e,elementIndex:t,datasetIndex:n,cfg:o,apply:i,blurColor:a})}function YJ(e){var a,l,c,u;const{chart:t,elementIndex:n,datasetIndex:r,cfg:o,apply:i,blurColor:s}=e;i?(l=(a=t==null?void 0:t.data)==null?void 0:a.datasets)==null||l.forEach((f,h)=>{var g,v;typeof f.backgroundColor=="string"&&(f.backgroundColor=new Array(f.data.length).fill(f.backgroundColor),f.borderColor=new Array(f.data.length).fill(f.borderColor)),f.backgroundColor=(g=f==null?void 0:f.backgroundColor)==null?void 0:g.map((b,x)=>x===n&&h===r?b:s),f.borderColor=(v=f==null?void 0:f.borderColor)==null?void 0:v.map((b,x)=>x===n&&h===r?b:s)}):(u=(c=t==null?void 0:t.data)==null?void 0:c.datasets)==null||u.forEach((f,h)=>{var g,v,b,x,w,_;f.backgroundColor=new Array(f.data.length).fill((b=(v=(g=o==null?void 0:o.data)==null?void 0:g.datasets)==null?void 0:v[h])==null?void 0:b.backgroundColor),f.borderColor=new Array(f.data.length).fill((_=(w=(x=o==null?void 0:o.data)==null?void 0:x.datasets)==null?void 0:w[h])==null?void 0:_.borderColor)}),t==null||t.update()}function KJ(e,t,n,r,o){var i,s,a,l;console.log("clicked index",t),r?(s=(i=e==null?void 0:e.data)==null?void 0:i.datasets)==null||s.forEach(c=>{var u,f;typeof c.backgroundColor=="string"&&(c.backgroundColor=new Array(c.data.length).fill(c.backgroundColor),c.borderColor=new Array(c.data.length).fill(c.borderColor)),c.backgroundColor=(u=c==null?void 0:c.backgroundColor)==null?void 0:u.map((h,g)=>g===t?h:o),c.borderColor=(f=c==null?void 0:c.borderColor)==null?void 0:f.map((h,g)=>g===t?h:o)}):(l=(a=e==null?void 0:e.data)==null?void 0:a.datasets)==null||l.forEach((c,u)=>{var f,h,g,v,b,x;c.backgroundColor=new Array(c.data.length).fill((g=(h=(f=n==null?void 0:n.data)==null?void 0:f.datasets)==null?void 0:h[u])==null?void 0:g.backgroundColor),c.borderColor=new Array(c.data.length).fill((x=(b=(v=n==null?void 0:n.data)==null?void 0:v.datasets)==null?void 0:b[u])==null?void 0:x.borderColor)}),e==null||e.update()}function XJ(e,t,n,r,o){var i,s,a,l;r?(s=(i=e==null?void 0:e.data)==null?void 0:i.datasets)==null||s.forEach(c=>{var u,f;c.backgroundColor=(u=c==null?void 0:c.backgroundColor)==null?void 0:u.map((h,g)=>g===t?h:o),c.borderColor=(f=c==null?void 0:c.borderColor)==null?void 0:f.map((h,g)=>g===t?h:o)}):(l=(a=e==null?void 0:e.data)==null?void 0:a.datasets)==null||l.forEach((c,u)=>{var f,h,g,v,b,x,w,_;typeof c.backgroundColor=="string"&&(c.backgroundColor=(g=(h=(f=n==null?void 0:n.data)==null?void 0:f.datasets)==null?void 0:h[u])==null?void 0:g.backgroundColor,c.borderColor=(x=(b=(v=n==null?void 0:n.data)==null?void 0:v.datasets)==null?void 0:b[u])==null?void 0:x.borderColor),c.backgroundColor=(w=c==null?void 0:c.backgroundColor)==null?void 0:w.map((S,R)=>{var C;return(C=n.data.datasets[u].backgroundColor)==null?void 0:C[R]}),c.borderColor=(_=c==null?void 0:c.borderColor)==null?void 0:_.map((S,R)=>{var C;return(C=n.data.datasets[u].borderColor)==null?void 0:C[R]})}),e==null||e.update()}function QJ(e,t,n,r){var o,i;try{if(!e||!e.data)return;const{dimensionKeys:s,metricKeys:a}=ar(e.data);if(["bar","horizontalBar","line","pie","doughnut","radar","polarArea"].includes(e.type)){const l=s[0],c=(o=e.data[n])==null?void 0:o[l];return[{columnName:l,columnValue:c,metric:a[t],value:r}]}if(["stackedBar","pyramid"].includes(e.type)){const l=Tg({dataArray:e.data,groupKey:s[0],pivotKey:s[1],valueKey:a[0]}),c=s[0],u=(i=l[n])==null?void 0:i[c],f=s[1],{metricKeys:h}=ar(l),g=h[t];return[{columnName:c,columnValue:u,metric:a[0],value:r},{columnName:f,columnValue:g,metric:a[0],value:r}]}if(e.type==="bubble"||e.type==="scatter"){const l=s[0],c=r.label;return[{columnName:l,columnValue:c,metric1:a[0],value1:r.x,metric2:a[1],value2:r.y,metric3:a==null?void 0:a[2],value3:r==null?void 0:r.r}]}}catch(s){console.error("Error in getAdhocFilter",s)}}function JJ(e){var s,a;const[t]=m.useState({id:"",title:"",type:"bar",data:[]}),{getCard:n}=Mo(),r=n(e),o=z1(r||t),i={...r,data:((s=o==null?void 0:o.data)==null?void 0:s.records)||[]};return{...o,data:((a=o==null?void 0:o.data)==null?void 0:a.records)||[],card:i}}function z1(e){var B,K,Z;const{onChartElementClicked:t}=ma(),[n,r]=m.useState(0),o=((B=e==null?void 0:e.preferences)==null?void 0:B.filterOnClickColumnIndex)===void 0?0:(K=e.preferences)==null?void 0:K.filterOnClickColumnIndex,i=ke(z=>z.bookmarkKey);ke(z=>z.isVisualEditing);const s=ke(z=>z.filteringCards),a=ke(z=>z.selectedSheetId);ke(z=>z.selectedCardId),ke(z=>z.isDashboardEditing);const l=ke(z=>z.themeStyle),c=ke(z=>z.filterValues),u=m.useRef(c),f=(Z=e==null?void 0:e.preferences)==null?void 0:Z.onClickFilter,{addFrame:h,addFilteringCard:g,setFrameCardData:v,getSelectedFrame:b,addOrUpdateFilterValue:x,addOrUpdateFilterValues:w,removeFilterValue:_,removeFilteringCard:S}=Mo(),{data:R,isLoading:C,isFetching:P,isError:A,refetch:k}=LJ(e),D=s==null?void 0:s.find(z=>z.id===e.id);let I;e.data&&e.data.length>0&&(I=j1({data:e.data,cardType:e.type,cfg:e.cfg,customCfg:e.customCfg,preferences:e.preferences})),m.useEffect(()=>{!R||!R.records||v(a,e.id,(R==null?void 0:R.records)||[])},[R,a,e.id,v,c]),m.useEffect(()=>{e.data&&r(n+1)},[e.data,e.type,e.cfg,e.customCfg,e.preferences,l]),m.useEffect(()=>{e.connectionId&&!D&&(k(),u.current=c)},[c,i]);function F(z,Q,W,Y){var H,J;let oe=!1;if(!e.data)return;const $=QJ(e,Q,W,Y);if(console.log("fieldValues",$),t==null||t(e,$),!!(((H=e==null?void 0:e.preferences)==null?void 0:H.onClickFilter)??[]).length){if(D){const N=e.id;_(N),S(e)}else{if(oe=!0,!$)return;const N=[];$.forEach((ce,le)=>{const de=f==null?void 0:f.find(ie=>ie.columnIndex===le);if(!de)return;const pe={filterId:e.id+"-"+ce.columnName,connectionId:e==null?void 0:e.connectionId,tableName:e.lastSelectedTable,name:ce.columnName,expression:de.expression,valueType:Td($[de.columnIndex].columnValue),operation:"=",values:[$[de.columnIndex].columnValue]};N.push(pe)}),e.id,e==null||e.connectionId,e.lastSelectedTable,$[o].columnName,(J=e.preferences)==null||J.filterOnClickField,Td($[o].columnValue),$[o].columnValue,w(N),g(e)}GJ({chart:z,elementIndex:W,datasetIndex:Q,cardType:e.type,cfg:I,apply:oe})}}return{isError:A,isLoading:C,isFetching:P,data:R,visualKey:n,handleDatapointClick:F,cfg:I}}var ZJ=e=>{switch(e){case"success":return nZ;case"info":return oZ;case"warning":return rZ;case"error":return iZ;default:return null}},eZ=Array(12).fill(0),tZ=({visible:e})=>m.createElement("div",{className:"sonner-loading-wrapper","data-visible":e},m.createElement("div",{className:"sonner-spinner"},eZ.map((t,n)=>m.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),nZ=m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},m.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),rZ=m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},m.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),oZ=m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},m.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),iZ=m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},m.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),sZ=()=>{let[e,t]=m.useState(document.hidden);return m.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},xx=1,aZ=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;let{message:r,...o}=t,i=typeof(t==null?void 0:t.id)=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:xx++,s=this.toasts.find(l=>l.id===i),a=t.dismissible===void 0?!0:t.dismissible;return s?this.toasts=this.toasts.map(l=>l.id===i?(this.publish({...l,...t,id:i,title:r}),{...l,...t,id:i,dismissible:a,title:r}):l):this.addToast({title:r,...o,dismissible:a,id:i}),i},this.dismiss=t=>(t||this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),this.subscribers.forEach(n=>n({id:t,dismiss:!0})),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));let o=t instanceof Promise?t:t(),i=r!==void 0;return o.then(async s=>{if(cZ(s)&&!s.ok){i=!1;let a=typeof n.error=="function"?await n.error(`HTTP error! status: ${s.status}`):n.error,l=typeof n.description=="function"?await n.description(`HTTP error! status: ${s.status}`):n.description;this.create({id:r,type:"error",message:a,description:l})}else if(n.success!==void 0){i=!1;let a=typeof n.success=="function"?await n.success(s):n.success,l=typeof n.description=="function"?await n.description(s):n.description;this.create({id:r,type:"success",message:a,description:l})}}).catch(async s=>{if(n.error!==void 0){i=!1;let a=typeof n.error=="function"?await n.error(s):n.error,l=typeof n.description=="function"?await n.description(s):n.description;this.create({id:r,type:"error",message:a,description:l})}}).finally(()=>{var s;i&&(this.dismiss(r),r=void 0),(s=n.finally)==null||s.call(n)}),r},this.custom=(t,n)=>{let r=(n==null?void 0:n.id)||xx++;return this.create({jsx:t(r),id:r,...n}),r},this.subscribers=[],this.toasts=[]}},Qr=new aZ,lZ=(e,t)=>{let n=(t==null?void 0:t.id)||xx++;return Qr.addToast({title:e,...t,id:n}),n},cZ=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",uZ=lZ,dZ=()=>Qr.toasts,fk=Object.assign(uZ,{success:Qr.success,info:Qr.info,warning:Qr.warning,error:Qr.error,custom:Qr.custom,message:Qr.message,promise:Qr.promise,dismiss:Qr.dismiss,loading:Qr.loading},{getHistory:dZ});function fZ(e,{insertAt:t}={}){if(!e||typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}fZ(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999}:where([data-sonner-toaster][data-x-position="right"]){right:max(var(--offset),env(safe-area-inset-right))}:where([data-sonner-toaster][data-x-position="left"]){left:max(var(--offset),env(safe-area-inset-left))}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:max(var(--offset),env(safe-area-inset-top))}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:max(var(--offset),env(safe-area-inset-bottom))}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;background:var(--gray1);color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:0;right:0;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount, 0px));transition:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation:swipe-out .2s ease-out forwards}@keyframes swipe-out{0%{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount)));opacity:1}to{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;--mobile-offset: 16px;right:var(--mobile-offset);left:var(--mobile-offset);width:100%}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset)}[data-sonner-toaster][data-y-position=bottom]{bottom:20px}[data-sonner-toaster][data-y-position=top]{top:20px}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset);right:var(--mobile-offset);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
253
+ `),s=new Blob([i],{type:"text/csv"}),a=window.URL.createObjectURL(s),l=document.createElement("a");l.setAttribute("hidden",""),l.setAttribute("href",a),l.setAttribute("download",t),document.body.appendChild(l),l.click(),document.body.removeChild(l)};return O.jsx(QX,{onClick:n,className:"h-[14px] w-[14px] text-foreground/30 hover:cursor-pointer hover:text-foreground/50"})};function iQ({frame:e}){var _;const t=ke(S=>S.isDashboardEditing),n=ke(S=>S.filterValues),r=ke(S=>S.isVisualEditing),o=ke(S=>S.selectedSheetId);ke(S=>S.currentBreakpoint);const{removeFrame:i}=ke(S=>S.actions),s=ke(S=>S.actions.setIsVisualEditing),a=Ar(S=>S.actions.setFilterValues),l=Ar(S=>S.actions.setApplyFilters),{setCard:c,setFrame:u,setQueryResultColumns:f}=Ar(S=>S.actions),h=Ar(S=>S.actions.setSelectedConnectionId),g=Ar(S=>S.actions.setSelectedDatabaseName),v=Ar(S=>S.actions.setSelectedSchemaName),b=Ar(S=>S.actions.setSelectedTableName),x=e.cards.find(S=>S.id===e.activeCardId);function w(){s(!r),c(x);const{dimensionKeys:S}=ar((x==null?void 0:x.data)||[]);f(S),u(e),x!=null&&x.connectionId&&h(x==null?void 0:x.connectionId),x!=null&&x.lastSelectedDatabase&&g(x==null?void 0:x.lastSelectedDatabase),x!=null&&x.lastSelectedSchema&&v(x==null?void 0:x.lastSelectedSchema),x!=null&&x.lastSelectedTable&&b(x==null?void 0:x.lastSelectedTable),n&&(a(n),l(!0))}return O.jsx("section",{className:"absolute right-2 top-2 z-10",children:O.jsxs("div",{className:"flex items-center gap-2",children:[t&&(r?O.jsx(SX,{onClick:()=>{s(!r)},className:"h-[14px] w-[14px] text-foreground/30 hover:cursor-pointer hover:text-foreground/50"}):O.jsx(EX,{role:"edit-visual",onClick:w,className:"h-[14px] w-[14px] text-foreground/30 hover:cursor-pointer hover:text-foreground/50"})),t&&O.jsx(DA,{onClick:()=>i(o,e.id),className:"h-[14px] w-[14px] text-foreground/30 hover:cursor-pointer hover:text-foreground/50"}),((_=x.preferences)==null?void 0:_.allowDownload)===!0&&O.jsx(oQ,{data:(x==null?void 0:x.data)||[],filename:x.title})]})})}function sQ(e,t=globalThis==null?void 0:globalThis.document){const n=Ln(e);m.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r),()=>t.removeEventListener("keydown",r)},[n,t])}const gx="dismissableLayer.update",aQ="dismissableLayer.pointerDownOutside",lQ="dismissableLayer.focusOutside";let aP;const cQ=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),jf=m.forwardRef((e,t)=>{var n;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:a,onDismiss:l,...c}=e,u=m.useContext(cQ),[f,h]=m.useState(null),g=(n=f==null?void 0:f.ownerDocument)!==null&&n!==void 0?n:globalThis==null?void 0:globalThis.document,[,v]=m.useState({}),b=_t(t,k=>h(k)),x=Array.from(u.layers),[w]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),_=x.indexOf(w),S=f?x.indexOf(f):-1,R=u.layersWithOutsidePointerEventsDisabled.size>0,C=S>=_,P=uQ(k=>{const D=k.target,I=[...u.branches].some(F=>F.contains(D));!C||I||(i==null||i(k),a==null||a(k),k.defaultPrevented||l==null||l())},g),A=dQ(k=>{const D=k.target;[...u.branches].some(F=>F.contains(D))||(s==null||s(k),a==null||a(k),k.defaultPrevented||l==null||l())},g);return sQ(k=>{S===u.layers.size-1&&(o==null||o(k),!k.defaultPrevented&&l&&(k.preventDefault(),l()))},g),m.useEffect(()=>{if(f)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(aP=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),lP(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=aP)}},[f,g,r,u]),m.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),lP())},[f,u]),m.useEffect(()=>{const k=()=>v({});return document.addEventListener(gx,k),()=>document.removeEventListener(gx,k)},[]),m.createElement(Qe.div,he({},c,{ref:b,style:{pointerEvents:R?C?"auto":"none":void 0,...e.style},onFocusCapture:Me(e.onFocusCapture,A.onFocusCapture),onBlurCapture:Me(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:Me(e.onPointerDownCapture,P.onPointerDownCapture)}))});function uQ(e,t=globalThis==null?void 0:globalThis.document){const n=Ln(e),r=m.useRef(!1),o=m.useRef(()=>{});return m.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let c=function(){LA(aQ,n,l,{discrete:!0})};const l={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function dQ(e,t=globalThis==null?void 0:globalThis.document){const n=Ln(e),r=m.useRef(!1);return m.useEffect(()=>{const o=i=>{i.target&&!r.current&&LA(lQ,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function lP(){const e=new CustomEvent(gx);document.dispatchEvent(e)}function LA(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?ED(o,i):o.dispatchEvent(i)}const fQ=["top","right","bottom","left"],ca=Math.min,no=Math.max,Dg=Math.round,vp=Math.floor,ua=e=>({x:e,y:e}),hQ={left:"right",right:"left",bottom:"top",top:"bottom"},pQ={start:"end",end:"start"};function mx(e,t,n){return no(e,ca(t,n))}function ss(e,t){return typeof e=="function"?e(t):e}function as(e){return e.split("-")[0]}function iu(e){return e.split("-")[1]}function O1(e){return e==="x"?"y":"x"}function P1(e){return e==="y"?"height":"width"}function su(e){return["top","bottom"].includes(as(e))?"y":"x"}function T1(e){return O1(su(e))}function gQ(e,t,n){n===void 0&&(n=!1);const r=iu(e),o=T1(e),i=P1(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=$g(s)),[s,$g(s)]}function mQ(e){const t=$g(e);return[vx(e),t,vx(t)]}function vx(e){return e.replace(/start|end/g,t=>pQ[t])}function vQ(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:s;default:return[]}}function bQ(e,t,n,r){const o=iu(e);let i=vQ(as(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(vx)))),i}function $g(e){return e.replace(/left|right|bottom|top/g,t=>hQ[t])}function yQ(e){return{top:0,right:0,bottom:0,left:0,...e}}function FA(e){return typeof e!="number"?yQ(e):{top:e,right:e,bottom:e,left:e}}function Ag(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function cP(e,t,n){let{reference:r,floating:o}=e;const i=su(t),s=T1(t),a=P1(s),l=as(t),c=i==="y",u=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,h=r[a]/2-o[a]/2;let g;switch(l){case"top":g={x:u,y:r.y-o.height};break;case"bottom":g={x:u,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:f};break;case"left":g={x:r.x-o.width,y:f};break;default:g={x:r.x,y:r.y}}switch(iu(t)){case"start":g[s]-=h*(n&&c?-1:1);break;case"end":g[s]+=h*(n&&c?-1:1);break}return g}const xQ=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=cP(c,r,l),h=r,g={},v=0;for(let b=0;b<a.length;b++){const{name:x,fn:w}=a[b],{x:_,y:S,data:R,reset:C}=await w({x:u,y:f,initialPlacement:r,placement:h,strategy:o,middlewareData:g,rects:c,platform:s,elements:{reference:e,floating:t}});if(u=_??u,f=S??f,g={...g,[x]:{...g[x],...R}},C&&v<=50){v++,typeof C=="object"&&(C.placement&&(h=C.placement),C.rects&&(c=C.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:u,y:f}=cP(c,h,l)),b=-1;continue}}return{x:u,y:f,placement:h,strategy:o,middlewareData:g}};async function jd(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:g=0}=ss(t,e),v=FA(g),x=a[h?f==="floating"?"reference":"floating":f],w=Ag(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(x)))==null||n?x:x.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),_=f==="floating"?{...s.floating,x:r,y:o}:s.reference,S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),R=await(i.isElement==null?void 0:i.isElement(S))?await(i.getScale==null?void 0:i.getScale(S))||{x:1,y:1}:{x:1,y:1},C=Ag(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:_,offsetParent:S,strategy:l}):_);return{top:(w.top-C.top+v.top)/R.y,bottom:(C.bottom-w.bottom+v.bottom)/R.y,left:(w.left-C.left+v.left)/R.x,right:(C.right-w.right+v.right)/R.x}}const uP=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=ss(e,t)||{};if(c==null)return{};const f=FA(u),h={x:n,y:r},g=T1(o),v=P1(g),b=await s.getDimensions(c),x=g==="y",w=x?"top":"left",_=x?"bottom":"right",S=x?"clientHeight":"clientWidth",R=i.reference[v]+i.reference[g]-h[g]-i.floating[v],C=h[g]-i.reference[g],P=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let A=P?P[S]:0;(!A||!await(s.isElement==null?void 0:s.isElement(P)))&&(A=a.floating[S]||i.floating[v]);const k=R/2-C/2,D=A/2-b[v]/2-1,I=ca(f[w],D),F=ca(f[_],D),B=I,K=A-b[v]-F,Z=A/2-b[v]/2+k,z=mx(B,Z,K),Q=!l.arrow&&iu(o)!=null&&Z!=z&&i.reference[v]/2-(Z<B?I:F)-b[v]/2<0,W=Q?Z<B?Z-B:Z-K:0;return{[g]:h[g]+W,data:{[g]:z,centerOffset:Z-z-W,...Q&&{alignmentOffset:W}},reset:Q}}}),wQ=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:b=!0,...x}=ss(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const w=as(o),_=as(a)===a,S=await(l.isRTL==null?void 0:l.isRTL(c.floating)),R=h||(_||!b?[$g(a)]:mQ(a));!h&&v!=="none"&&R.push(...bQ(a,b,v,S));const C=[a,...R],P=await jd(t,x),A=[];let k=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&A.push(P[w]),f){const B=gQ(o,s,S);A.push(P[B[0]],P[B[1]])}if(k=[...k,{placement:o,overflows:A}],!A.every(B=>B<=0)){var D,I;const B=(((D=i.flip)==null?void 0:D.index)||0)+1,K=C[B];if(K)return{data:{index:B,overflows:k},reset:{placement:K}};let Z=(I=k.filter(z=>z.overflows[0]<=0).sort((z,Q)=>z.overflows[1]-Q.overflows[1])[0])==null?void 0:I.placement;if(!Z)switch(g){case"bestFit":{var F;const z=(F=k.map(Q=>[Q.placement,Q.overflows.filter(W=>W>0).reduce((W,Y)=>W+Y,0)]).sort((Q,W)=>Q[1]-W[1])[0])==null?void 0:F[0];z&&(Z=z);break}case"initialPlacement":Z=a;break}if(o!==Z)return{reset:{placement:Z}}}return{}}}};function dP(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function fP(e){return fQ.some(t=>e[t]>=0)}const _Q=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=ss(e,t);switch(r){case"referenceHidden":{const i=await jd(t,{...o,elementContext:"reference"}),s=dP(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:fP(s)}}}case"escaped":{const i=await jd(t,{...o,altBoundary:!0}),s=dP(i,n.floating);return{data:{escapedOffsets:s,escaped:fP(s)}}}default:return{}}}}};async function SQ(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=as(n),a=iu(n),l=su(n)==="y",c=["left","top"].includes(s)?-1:1,u=i&&l?-1:1,f=ss(t,e);let{mainAxis:h,crossAxis:g,alignmentAxis:v}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return a&&typeof v=="number"&&(g=a==="end"?v*-1:v),l?{x:g*u,y:h*c}:{x:h*c,y:g*u}}const CQ=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,l=await SQ(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},EQ=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:x=>{let{x:w,y:_}=x;return{x:w,y:_}}},...l}=ss(e,t),c={x:n,y:r},u=await jd(t,l),f=su(as(o)),h=O1(f);let g=c[h],v=c[f];if(i){const x=h==="y"?"top":"left",w=h==="y"?"bottom":"right",_=g+u[x],S=g-u[w];g=mx(_,g,S)}if(s){const x=f==="y"?"top":"left",w=f==="y"?"bottom":"right",_=v+u[x],S=v-u[w];v=mx(_,v,S)}const b=a.fn({...t,[h]:g,[f]:v});return{...b,data:{x:b.x-n,y:b.y-r}}}}},RQ=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:s}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=ss(e,t),u={x:n,y:r},f=su(o),h=O1(f);let g=u[h],v=u[f];const b=ss(a,t),x=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(l){const S=h==="y"?"height":"width",R=i.reference[h]-i.floating[S]+x.mainAxis,C=i.reference[h]+i.reference[S]-x.mainAxis;g<R?g=R:g>C&&(g=C)}if(c){var w,_;const S=h==="y"?"width":"height",R=["top","left"].includes(as(o)),C=i.reference[f]-i.floating[S]+(R&&((w=s.offset)==null?void 0:w[f])||0)+(R?0:x.crossAxis),P=i.reference[f]+i.reference[S]+(R?0:((_=s.offset)==null?void 0:_[f])||0)-(R?x.crossAxis:0);v<C?v=C:v>P&&(v=P)}return{[h]:g,[f]:v}}}},OQ=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:i}=t,{apply:s=()=>{},...a}=ss(e,t),l=await jd(t,a),c=as(n),u=iu(n),f=su(n)==="y",{width:h,height:g}=r.floating;let v,b;c==="top"||c==="bottom"?(v=c,b=u===(await(o.isRTL==null?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(b=c,v=u==="end"?"top":"bottom");const x=g-l[v],w=h-l[b],_=!t.middlewareData.shift;let S=x,R=w;if(f){const P=h-l.left-l.right;R=u||_?ca(w,P):P}else{const P=g-l.top-l.bottom;S=u||_?ca(x,P):P}if(_&&!u){const P=no(l.left,0),A=no(l.right,0),k=no(l.top,0),D=no(l.bottom,0);f?R=h-2*(P!==0||A!==0?P+A:no(l.left,l.right)):S=g-2*(k!==0||D!==0?k+D:no(l.top,l.bottom))}await s({...t,availableWidth:R,availableHeight:S});const C=await o.getDimensions(i.floating);return h!==C.width||g!==C.height?{reset:{rects:!0}}:{}}}};function da(e){return jA(e)?(e.nodeName||"").toLowerCase():"#document"}function so(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ds(e){var t;return(t=(jA(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function jA(e){return e instanceof Node||e instanceof so(e).Node}function ls(e){return e instanceof Element||e instanceof so(e).Element}function Si(e){return e instanceof HTMLElement||e instanceof so(e).HTMLElement}function hP(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof so(e).ShadowRoot}function zf(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=$o(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function PQ(e){return["table","td","th"].includes(da(e))}function D1(e){const t=$1(),n=$o(e);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function TQ(e){let t=Yc(e);for(;Si(t)&&!Dm(t);){if(D1(t))return t;t=Yc(t)}return null}function $1(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Dm(e){return["html","body","#document"].includes(da(e))}function $o(e){return so(e).getComputedStyle(e)}function $m(e){return ls(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Yc(e){if(da(e)==="html")return e;const t=e.assignedSlot||e.parentNode||hP(e)&&e.host||ds(e);return hP(t)?t.host:t}function zA(e){const t=Yc(e);return Dm(t)?e.ownerDocument?e.ownerDocument.body:e.body:Si(t)&&zf(t)?t:zA(t)}function zd(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=zA(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=so(o);return i?t.concat(s,s.visualViewport||[],zf(o)?o:[],s.frameElement&&n?zd(s.frameElement):[]):t.concat(o,zd(o,[],n))}function BA(e){const t=$o(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Si(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=Dg(n)!==i||Dg(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function A1(e){return ls(e)?e:e.contextElement}function yc(e){const t=A1(e);if(!Si(t))return ua(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=BA(t);let s=(i?Dg(n.width):n.width)/r,a=(i?Dg(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const DQ=ua(0);function VA(e){const t=so(e);return!$1()||!t.visualViewport?DQ:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function $Q(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==so(e)?!1:t}function ml(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=A1(e);let s=ua(1);t&&(r?ls(r)&&(s=yc(r)):s=yc(e));const a=$Q(i,n,r)?VA(i):ua(0);let l=(o.left+a.x)/s.x,c=(o.top+a.y)/s.y,u=o.width/s.x,f=o.height/s.y;if(i){const h=so(i),g=r&&ls(r)?so(r):r;let v=h.frameElement;for(;v&&r&&g!==h;){const b=yc(v),x=v.getBoundingClientRect(),w=$o(v),_=x.left+(v.clientLeft+parseFloat(w.paddingLeft))*b.x,S=x.top+(v.clientTop+parseFloat(w.paddingTop))*b.y;l*=b.x,c*=b.y,u*=b.x,f*=b.y,l+=_,c+=S,v=so(v).frameElement}}return Ag({width:u,height:f,x:l,y:c})}function AQ(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=Si(n),i=ds(n);if(n===i)return t;let s={scrollLeft:0,scrollTop:0},a=ua(1);const l=ua(0);if((o||!o&&r!=="fixed")&&((da(n)!=="body"||zf(i))&&(s=$m(n)),Si(n))){const c=ml(n);a=yc(n),l.x=c.x+n.clientLeft,l.y=c.y+n.clientTop}return{width:t.width*a.x,height:t.height*a.y,x:t.x*a.x-s.scrollLeft*a.x+l.x,y:t.y*a.y-s.scrollTop*a.y+l.y}}function kQ(e){return Array.from(e.getClientRects())}function HA(e){return ml(ds(e)).left+$m(e).scrollLeft}function MQ(e){const t=ds(e),n=$m(e),r=e.ownerDocument.body,o=no(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=no(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+HA(e);const a=-n.scrollTop;return $o(r).direction==="rtl"&&(s+=no(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function IQ(e,t){const n=so(e),r=ds(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;const c=$1();(!c||c&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:i,height:s,x:a,y:l}}function NQ(e,t){const n=ml(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Si(e)?yc(e):ua(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,l=o*i.x,c=r*i.y;return{width:s,height:a,x:l,y:c}}function pP(e,t,n){let r;if(t==="viewport")r=IQ(e,n);else if(t==="document")r=MQ(ds(e));else if(ls(t))r=NQ(t,n);else{const o=VA(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return Ag(r)}function WA(e,t){const n=Yc(e);return n===t||!ls(n)||Dm(n)?!1:$o(n).position==="fixed"||WA(n,t)}function LQ(e,t){const n=t.get(e);if(n)return n;let r=zd(e,[],!1).filter(a=>ls(a)&&da(a)!=="body"),o=null;const i=$o(e).position==="fixed";let s=i?Yc(e):e;for(;ls(s)&&!Dm(s);){const a=$o(s),l=D1(s);!l&&a.position==="fixed"&&(o=null),(i?!l&&!o:!l&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||zf(s)&&!l&&WA(e,s))?r=r.filter(u=>u!==s):o=a,s=Yc(s)}return t.set(e,r),r}function FQ(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?LQ(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,u)=>{const f=pP(t,u,o);return c.top=no(f.top,c.top),c.right=ca(f.right,c.right),c.bottom=ca(f.bottom,c.bottom),c.left=no(f.left,c.left),c},pP(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function jQ(e){return BA(e)}function zQ(e,t,n){const r=Si(t),o=ds(t),i=n==="fixed",s=ml(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=ua(0);if(r||!r&&!i)if((da(t)!=="body"||zf(o))&&(a=$m(t)),r){const c=ml(t,!0,i,t);l.x=c.x+t.clientLeft,l.y=c.y+t.clientTop}else o&&(l.x=HA(o));return{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}function gP(e,t){return!Si(e)||$o(e).position==="fixed"?null:t?t(e):e.offsetParent}function UA(e,t){const n=so(e);if(!Si(e))return n;let r=gP(e,t);for(;r&&PQ(r)&&$o(r).position==="static";)r=gP(r,t);return r&&(da(r)==="html"||da(r)==="body"&&$o(r).position==="static"&&!D1(r))?n:r||TQ(e)||n}const BQ=async function(e){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||UA,i=this.getDimensions;return{reference:zQ(t,await o(n),r),floating:{x:0,y:0,...await i(n)}}};function VQ(e){return $o(e).direction==="rtl"}const HQ={convertOffsetParentRelativeRectToViewportRelativeRect:AQ,getDocumentElement:ds,getClippingRect:FQ,getOffsetParent:UA,getElementRects:BQ,getClientRects:kQ,getDimensions:jQ,getScale:yc,isElement:ls,isRTL:VQ};function WQ(e,t){let n=null,r;const o=ds(e);function i(){clearTimeout(r),n&&n.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const{left:c,top:u,width:f,height:h}=e.getBoundingClientRect();if(a||t(),!f||!h)return;const g=vp(u),v=vp(o.clientWidth-(c+f)),b=vp(o.clientHeight-(u+h)),x=vp(c),_={rootMargin:-g+"px "+-v+"px "+-b+"px "+-x+"px",threshold:no(0,ca(1,l))||1};let S=!0;function R(C){const P=C[0].intersectionRatio;if(P!==l){if(!S)return s();P?s(!1,P):r=setTimeout(()=>{s(!1,1e-7)},100)}S=!1}try{n=new IntersectionObserver(R,{..._,root:o.ownerDocument})}catch{n=new IntersectionObserver(R,_)}n.observe(e)}return s(!0),i}function UQ(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=A1(e),u=o||i?[...c?zd(c):[],...zd(t)]:[];u.forEach(w=>{o&&w.addEventListener("scroll",n,{passive:!0}),i&&w.addEventListener("resize",n)});const f=c&&a?WQ(c,n):null;let h=-1,g=null;s&&(g=new ResizeObserver(w=>{let[_]=w;_&&_.target===c&&g&&(g.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{g&&g.observe(t)})),n()}),c&&!l&&g.observe(c),g.observe(t));let v,b=l?ml(e):null;l&&x();function x(){const w=ml(e);b&&(w.x!==b.x||w.y!==b.y||w.width!==b.width||w.height!==b.height)&&n(),b=w,v=requestAnimationFrame(x)}return n(),()=>{u.forEach(w=>{o&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),f&&f(),g&&g.disconnect(),g=null,l&&cancelAnimationFrame(v)}}const qQ=(e,t,n)=>{const r=new Map,o={platform:HQ,...n},i={...o.platform,_c:r};return xQ(e,t,{...o,platform:i})},GQ=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?uP({element:r.current,padding:o}).fn(n):{}:r?uP({element:r,padding:o}).fn(n):{}}}};var ig=typeof document<"u"?m.useLayoutEffect:m.useEffect;function kg(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!kg(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!kg(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function qA(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function mP(e,t){const n=qA(e);return Math.round(t*n)/n}function vP(e){const t=V.useRef(e);return ig(()=>{t.current=e}),t}function YQ(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,f]=V.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,g]=V.useState(r);kg(h,r)||g(r);const[v,b]=V.useState(null),[x,w]=V.useState(null),_=V.useCallback(Q=>{Q!=P.current&&(P.current=Q,b(Q))},[b]),S=V.useCallback(Q=>{Q!==A.current&&(A.current=Q,w(Q))},[w]),R=i||v,C=s||x,P=V.useRef(null),A=V.useRef(null),k=V.useRef(u),D=vP(l),I=vP(o),F=V.useCallback(()=>{if(!P.current||!A.current)return;const Q={placement:t,strategy:n,middleware:h};I.current&&(Q.platform=I.current),qQ(P.current,A.current,Q).then(W=>{const Y={...W,isPositioned:!0};B.current&&!kg(k.current,Y)&&(k.current=Y,dw.flushSync(()=>{f(Y)}))})},[h,t,n,I]);ig(()=>{c===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,f(Q=>({...Q,isPositioned:!1})))},[c]);const B=V.useRef(!1);ig(()=>(B.current=!0,()=>{B.current=!1}),[]),ig(()=>{if(R&&(P.current=R),C&&(A.current=C),R&&C){if(D.current)return D.current(R,C,F);F()}},[R,C,F,D]);const K=V.useMemo(()=>({reference:P,floating:A,setReference:_,setFloating:S}),[_,S]),Z=V.useMemo(()=>({reference:R,floating:C}),[R,C]),z=V.useMemo(()=>{const Q={position:n,left:0,top:0};if(!Z.floating)return Q;const W=mP(Z.floating,u.x),Y=mP(Z.floating,u.y);return a?{...Q,transform:"translate("+W+"px, "+Y+"px)",...qA(Z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:Y}},[n,a,Z.floating,u.x,u.y]);return V.useMemo(()=>({...u,update:F,refs:K,elements:Z,floatingStyles:z}),[u,F,K,Z,z])}function Am(e){const[t,n]=m.useState(void 0);return ur(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,a;if("borderBoxSize"in i){const l=i.borderBoxSize,c=Array.isArray(l)?l[0]:l;s=c.inlineSize,a=c.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}const GA="Popper",[YA,Ti]=Zn(GA),[KQ,KA]=YA(GA),XQ=e=>{const{__scopePopper:t,children:n}=e,[r,o]=m.useState(null);return m.createElement(KQ,{scope:t,anchor:r,onAnchorChange:o},n)},QQ="PopperAnchor",JQ=m.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=KA(QQ,n),s=m.useRef(null),a=_t(t,s);return m.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:m.createElement(Qe.div,he({},o,{ref:a}))}),XA="PopperContent",[ZQ,lye]=YA(XA),eJ=m.forwardRef((e,t)=>{var n,r,o,i,s,a,l,c;const{__scopePopper:u,side:f="bottom",sideOffset:h=0,align:g="center",alignOffset:v=0,arrowPadding:b=0,avoidCollisions:x=!0,collisionBoundary:w=[],collisionPadding:_=0,sticky:S="partial",hideWhenDetached:R=!1,updatePositionStrategy:C="optimized",onPlaced:P,...A}=e,k=KA(XA,u),[D,I]=m.useState(null),F=_t(t,Pe=>I(Pe)),[B,K]=m.useState(null),Z=Am(B),z=(n=Z==null?void 0:Z.width)!==null&&n!==void 0?n:0,Q=(r=Z==null?void 0:Z.height)!==null&&r!==void 0?r:0,W=f+(g!=="center"?"-"+g:""),Y=typeof _=="number"?_:{top:0,right:0,bottom:0,left:0,..._},oe=Array.isArray(w)?w:[w],$=oe.length>0,H={padding:Y,boundary:oe.filter(tJ),altBoundary:$},{refs:J,floatingStyles:N,placement:ce,isPositioned:le,middlewareData:de}=YQ({strategy:"fixed",placement:W,whileElementsMounted:(...Pe)=>UQ(...Pe,{animationFrame:C==="always"}),elements:{reference:k.anchor},middleware:[CQ({mainAxis:h+Q,alignmentAxis:v}),x&&EQ({mainAxis:!0,crossAxis:!1,limiter:S==="partial"?RQ():void 0,...H}),x&&wQ({...H}),OQ({...H,apply:({elements:Pe,rects:Te,availableWidth:Ue,availableHeight:Be})=>{const{width:Ie,height:Ke}=Te.reference,lt=Pe.floating.style;lt.setProperty("--radix-popper-available-width",`${Ue}px`),lt.setProperty("--radix-popper-available-height",`${Be}px`),lt.setProperty("--radix-popper-anchor-width",`${Ie}px`),lt.setProperty("--radix-popper-anchor-height",`${Ke}px`)}}),B&&GQ({element:B,padding:b}),nJ({arrowWidth:z,arrowHeight:Q}),R&&_Q({strategy:"referenceHidden",...H})]}),[pe,ie]=QA(ce),te=Ln(P);ur(()=>{le&&(te==null||te())},[le,te]);const ae=(o=de.arrow)===null||o===void 0?void 0:o.x,ye=(i=de.arrow)===null||i===void 0?void 0:i.y,G=((s=de.arrow)===null||s===void 0?void 0:s.centerOffset)!==0,[be,_e]=m.useState();return ur(()=>{D&&_e(window.getComputedStyle(D).zIndex)},[D]),m.createElement("div",{ref:J.setFloating,"data-radix-popper-content-wrapper":"",style:{...N,transform:le?N.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:be,"--radix-popper-transform-origin":[(a=de.transformOrigin)===null||a===void 0?void 0:a.x,(l=de.transformOrigin)===null||l===void 0?void 0:l.y].join(" ")},dir:e.dir},m.createElement(ZQ,{scope:u,placedSide:pe,onArrowChange:K,arrowX:ae,arrowY:ye,shouldHideArrow:G},m.createElement(Qe.div,he({"data-side":pe,"data-align":ie},A,{ref:F,style:{...A.style,animation:le?void 0:"none",opacity:(c=de.hide)!==null&&c!==void 0&&c.referenceHidden?0:void 0}}))))});function tJ(e){return e!==null}const nJ=e=>({name:"transformOrigin",options:e,fn(t){var n,r,o,i,s;const{placement:a,rects:l,middlewareData:c}=t,f=((n=c.arrow)===null||n===void 0?void 0:n.centerOffset)!==0,h=f?0:e.arrowWidth,g=f?0:e.arrowHeight,[v,b]=QA(a),x={start:"0%",center:"50%",end:"100%"}[b],w=((r=(o=c.arrow)===null||o===void 0?void 0:o.x)!==null&&r!==void 0?r:0)+h/2,_=((i=(s=c.arrow)===null||s===void 0?void 0:s.y)!==null&&i!==void 0?i:0)+g/2;let S="",R="";return v==="bottom"?(S=f?x:`${w}px`,R=`${-g}px`):v==="top"?(S=f?x:`${w}px`,R=`${l.floating.height+g}px`):v==="right"?(S=`${-g}px`,R=f?x:`${_}px`):v==="left"&&(S=`${l.floating.width+g}px`,R=f?x:`${_}px`),{data:{x:S,y:R}}}});function QA(e){const[t,n="center"]=e.split("-");return[t,n]}const Bf=XQ,Vf=JQ,Hf=eJ,k1=m.forwardRef((e,t)=>{var n;const{container:r=globalThis==null||(n=globalThis.document)===null||n===void 0?void 0:n.body,...o}=e;return r?ko.createPortal(m.createElement(Qe.div,he({},o,{ref:t})),r):null}),rJ=m.forwardRef((e,t)=>{const{children:n,...r}=e,o=m.Children.toArray(n),i=o.find(oJ);if(i){const s=i.props.children,a=o.map(l=>l===i?m.Children.count(s)>1?m.Children.only(null):m.isValidElement(s)?s.props.children:null:l);return m.createElement(bx,he({},r,{ref:t}),m.isValidElement(s)?m.cloneElement(s,void 0,a):null)}return m.createElement(bx,he({},r,{ref:t}),n)});rJ.displayName="Slot";const bx=m.forwardRef((e,t)=>{const{children:n,...r}=e;return m.isValidElement(n)?m.cloneElement(n,{...iJ(r,n.props),ref:t?cs(t,n.ref):n.ref}):m.Children.count(n)>1?m.Children.only(null):null});bx.displayName="SlotClone";const JA=({children:e})=>m.createElement(m.Fragment,null,e);function oJ(e){return m.isValidElement(e)&&e.type===JA}function iJ(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}const ZA=m.forwardRef((e,t)=>m.createElement(Qe.span,he({},e,{ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}))),sJ=ZA,[km,cye]=Zn("Tooltip",[Ti]),M1=Ti(),aJ="TooltipProvider",lJ=700,yx="tooltip.open",[cJ,I1]=km(aJ),uJ=e=>{const{__scopeTooltip:t,delayDuration:n=lJ,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=e,[s,a]=m.useState(!0),l=m.useRef(!1),c=m.useRef(0);return m.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),m.createElement(cJ,{scope:t,isOpenDelayed:s,delayDuration:n,onOpen:m.useCallback(()=>{window.clearTimeout(c.current),a(!1)},[]),onClose:m.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a(!0),r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:m.useCallback(u=>{l.current=u},[]),disableHoverableContent:o},i)},N1="Tooltip",[dJ,Mm]=km(N1),fJ=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o=!1,onOpenChange:i,disableHoverableContent:s,delayDuration:a}=e,l=I1(N1,e.__scopeTooltip),c=M1(t),[u,f]=m.useState(null),h=Jo(),g=m.useRef(0),v=s??l.disableHoverableContent,b=a??l.delayDuration,x=m.useRef(!1),[w=!1,_]=xr({prop:r,defaultProp:o,onChange:A=>{A?(l.onOpen(),document.dispatchEvent(new CustomEvent(yx))):l.onClose(),i==null||i(A)}}),S=m.useMemo(()=>w?x.current?"delayed-open":"instant-open":"closed",[w]),R=m.useCallback(()=>{window.clearTimeout(g.current),x.current=!1,_(!0)},[_]),C=m.useCallback(()=>{window.clearTimeout(g.current),_(!1)},[_]),P=m.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>{x.current=!0,_(!0)},b)},[b,_]);return m.useEffect(()=>()=>window.clearTimeout(g.current),[]),m.createElement(Bf,c,m.createElement(dJ,{scope:t,contentId:h,open:w,stateAttribute:S,trigger:u,onTriggerChange:f,onTriggerEnter:m.useCallback(()=>{l.isOpenDelayed?P():R()},[l.isOpenDelayed,P,R]),onTriggerLeave:m.useCallback(()=>{v?C():window.clearTimeout(g.current)},[C,v]),onOpen:R,onClose:C,disableHoverableContent:v},n))},bP="TooltipTrigger",ek=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Mm(bP,n),i=I1(bP,n),s=M1(n),a=m.useRef(null),l=_t(t,a,o.onTriggerChange),c=m.useRef(!1),u=m.useRef(!1),f=m.useCallback(()=>c.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),m.createElement(Vf,he({asChild:!0},s),m.createElement(Qe.button,he({"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute},r,{ref:l,onPointerMove:Me(e.onPointerMove,h=>{h.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),u.current=!0)}),onPointerLeave:Me(e.onPointerLeave,()=>{o.onTriggerLeave(),u.current=!1}),onPointerDown:Me(e.onPointerDown,()=>{c.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Me(e.onFocus,()=>{c.current||o.onOpen()}),onBlur:Me(e.onBlur,o.onClose),onClick:Me(e.onClick,o.onClose)})))}),hJ="TooltipPortal",[uye,pJ]=km(hJ,{forceMount:void 0}),Bd="TooltipContent",gJ=m.forwardRef((e,t)=>{const n=pJ(Bd,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...i}=e,s=Mm(Bd,e.__scopeTooltip);return m.createElement(er,{present:r||s.open},s.disableHoverableContent?m.createElement(tk,he({side:o},i,{ref:t})):m.createElement(mJ,he({side:o},i,{ref:t})))}),mJ=m.forwardRef((e,t)=>{const n=Mm(Bd,e.__scopeTooltip),r=I1(Bd,e.__scopeTooltip),o=m.useRef(null),i=_t(t,o),[s,a]=m.useState(null),{trigger:l,onClose:c}=n,u=o.current,{onPointerInTransitChange:f}=r,h=m.useCallback(()=>{a(null),f(!1)},[f]),g=m.useCallback((v,b)=>{const x=v.currentTarget,w={x:v.clientX,y:v.clientY},_=bJ(w,x.getBoundingClientRect()),S=yJ(w,_),R=xJ(b.getBoundingClientRect()),C=_J([...S,...R]);a(C),f(!0)},[f]);return m.useEffect(()=>()=>h(),[h]),m.useEffect(()=>{if(l&&u){const v=x=>g(x,u),b=x=>g(x,l);return l.addEventListener("pointerleave",v),u.addEventListener("pointerleave",b),()=>{l.removeEventListener("pointerleave",v),u.removeEventListener("pointerleave",b)}}},[l,u,g,h]),m.useEffect(()=>{if(s){const v=b=>{const x=b.target,w={x:b.clientX,y:b.clientY},_=(l==null?void 0:l.contains(x))||(u==null?void 0:u.contains(x)),S=!wJ(w,s);_?h():S&&(h(),c())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[l,u,s,c,h]),m.createElement(tk,he({},e,{ref:i}))}),[vJ,dye]=km(N1,{isInside:!1}),tk=m.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:s,...a}=e,l=Mm(Bd,n),c=M1(n),{onClose:u}=l;return m.useEffect(()=>(document.addEventListener(yx,u),()=>document.removeEventListener(yx,u)),[u]),m.useEffect(()=>{if(l.trigger){const f=h=>{const g=h.target;g!=null&&g.contains(l.trigger)&&u()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[l.trigger,u]),m.createElement(jf,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:u},m.createElement(Hf,he({"data-state":l.stateAttribute},c,a,{ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"}}),m.createElement(JA,null,r),m.createElement(vJ,{scope:n,isInside:!0},m.createElement(sJ,{id:l.contentId,role:"tooltip"},o||r))))});function bJ(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function yJ(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function xJ(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function wJ(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const a=t[i].x,l=t[i].y,c=t[s].x,u=t[s].y;l>r!=u>r&&n<(c-a)*(r-l)/(u-l)+a&&(o=!o)}return o}function _J(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),SJ(t)}function SJ(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const i=t[t.length-1],s=t[t.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const i=n[n.length-1],s=n[n.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}const CJ=uJ,EJ=fJ,RJ=ek,nk=gJ,OJ=CJ,rk=EJ,ok=RJ,L1=V.forwardRef(({className:e,sideOffset:t=4,...n},r)=>O.jsx(nk,{ref:r,sideOffset:t,className:Ce("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n}));L1.displayName=nk.displayName;function ll({number:e,decimalPlaces:t=0,useSuffix:n=!1,customSuffix:r="",currency:o="",locale:i="en-US"}){let s=1,a=r,l=i;const c=t;n&&!r&&(e>=1e9?(s=1e9,a="B"):e>=1e7&&i==="en-IN"?(s=1e7,a="Cr"):e>=1e5&&i==="en-IN"?(s=1e5,a="L"):e>=1e6?(s=1e6,a="M"):e>=1e3&&(s=1e3,a="K"));const u=e/s,f={maximumFractionDigits:c,minimumFractionDigits:c};if(o){f.style="currency",f.currency=o;try{new Intl.NumberFormat(i,f).format(0)}catch{f.currency="USD"}}try{new Intl.NumberFormat(i,f).format(0)}catch{l="en-US"}let g=new Intl.NumberFormat(l,f).format(u);return n&&(g+=a),g}function ik(e,t){if(!t)return"";const n=t.find(r=>e>=r.start&&e<=r.end);return(n==null?void 0:n.color)||""}function sk({card:e,isLoading:t}){var w,_,S,R,C,P,A,k,D,I,F,B,K,Z,z,Q,W,Y,oe,$,H,J,N,ce;const n=ke(le=>le.actions.setCardTitle),r=ke(le=>le.actions.setCardDescription),o=ke(le=>le.isVisualEditing),i=Ar(le=>le.card),s=Ar(le=>le.actions.setCard);Ar(le=>le.actions.setNumberFormat);const a=ke(le=>le.selectedSheetId),l=e.data,c=(_=(w=e.preferences)==null?void 0:w.formatNumber)==null?void 0:_.colorRanges,{metricKeys:u}=ar(l||[]),f=(S=l==null?void 0:l[0])==null?void 0:S[u==null?void 0:u[0]],h=(R=l==null?void 0:l[0])==null?void 0:R[u==null?void 0:u[1]],g=!!e.data&&e.data.length>0;function v(le){o?s({...i,title:le}):n(a,e.id,le)}function b(le){o?s({...i,description:le}):r(a,e.id,le)}const x=h&&h-f!==0?(f-h)/h:null;return O.jsxs("div",{className:"kpi-card flex grow flex-col overflow-scroll",children:[O.jsxs(am,{className:"grow pb-3",children:[O.jsx(is,{text:o?i.title:e.title,onSave:v,children:O.jsxs("div",{className:"flex items-center gap-2",children:[O.jsx($f,{className:"text-base font-medium text-muted-foreground",children:e.title}),!e.refreshInterval&&t&&O.jsx(C1,{className:"h-4 w-4 animate-spin text-muted-foreground"})]})}),g&&O.jsxs("div",{className:"flex flex-wrap items-end gap-3 text-foreground",children:[O.jsx("p",{style:{color:ik(f,c)},className:"text-3xl font-semibold",children:ll({number:f,decimalPlaces:((P=(C=e.preferences)==null?void 0:C.formatNumber)==null?void 0:P.decimalPlaces)||0,useSuffix:!!((k=(A=e.preferences)==null?void 0:A.formatNumber)!=null&&k.suffix),customSuffix:((I=(D=e.preferences)==null?void 0:D.formatNumber)==null?void 0:I.suffix)||"",locale:((B=(F=e.preferences)==null?void 0:F.formatNumber)==null?void 0:B.locale)||"",currency:((Z=(K=e.preferences)==null?void 0:K.formatNumber)==null?void 0:Z.currency)||""})}),h&&O.jsxs("span",{className:"min-w-fit text-base font-normal text-muted-foreground",children:["from  ",ll({number:h,decimalPlaces:((Q=(z=e.preferences)==null?void 0:z.formatNumber)==null?void 0:Q.decimalPlaces)||0,useSuffix:!!((Y=(W=e.preferences)==null?void 0:W.formatNumber)!=null&&Y.suffix),customSuffix:(($=(oe=e.preferences)==null?void 0:oe.formatNumber)==null?void 0:$.suffix)||"",locale:((J=(H=e.preferences)==null?void 0:H.formatNumber)==null?void 0:J.locale)||"",currency:((ce=(N=e.preferences)==null?void 0:N.formatNumber)==null?void 0:ce.currency)||""})]})]})]}),x&&O.jsxs(lm,{className:"grow items-start gap-1 pb-4 text-sm",children:[O.jsx(PJ,{children:x}),O.jsxs("div",{className:"flex gap-1 text-muted-foreground",children:[x>0?"up ":"down ",O.jsx(is,{text:e.description||"",onSave:b,children:e.description})]})]})]})}function PJ({children:e}){const t=e>0?O.jsx(_1,{className:"h-4 w-4"}):O.jsx(w1,{className:"h-4 w-4"}),n=`${Math.abs(e*100).toFixed(0)}%`;return O.jsxs("div",{className:Ce("flex items-center",{"text-green-600":e>0,"text-destructive":e<0}),children:[t,O.jsx("span",{className:"ml-[1px]",children:n})]})}var Kc=1e3,Xc=Kc*60,Qc=Xc*60,vl=Qc*24,TJ=vl*7,DJ=vl*365.25,$J=function(e,t){t=t||{};var n=typeof e;if(n==="string"&&e.length>0)return AJ(e);if(n==="number"&&isFinite(e))return t.long?MJ(e):kJ(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function AJ(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*DJ;case"weeks":case"week":case"w":return n*TJ;case"days":case"day":case"d":return n*vl;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Qc;case"minutes":case"minute":case"mins":case"min":case"m":return n*Xc;case"seconds":case"second":case"secs":case"sec":case"s":return n*Kc;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function kJ(e){var t=Math.abs(e);return t>=vl?Math.round(e/vl)+"d":t>=Qc?Math.round(e/Qc)+"h":t>=Xc?Math.round(e/Xc)+"m":t>=Kc?Math.round(e/Kc)+"s":e+"ms"}function MJ(e){var t=Math.abs(e);return t>=vl?bp(e,t,vl,"day"):t>=Qc?bp(e,t,Qc,"hour"):t>=Xc?bp(e,t,Xc,"minute"):t>=Kc?bp(e,t,Kc,"second"):e+" ms"}function bp(e,t,n,r){var o=t>=n*1.5;return Math.round(e/n)+" "+r+(o?"s":"")}const IJ=nu($J);function ak({children:e}){const{setIsSessionExpired:t}=Mo(),n=new Jz({queryCache:new gD({onError:r=>{console.error(`Something went wrong: ${r.message}`),r.message==="invalid token"&&t(!0)}}),defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1}}});return O.jsx(nB,{client:n,children:e})}const au=m.forwardRef(({children:e,className:t,...n},r)=>O.jsx("div",{className:Ce("semaphor-scope",t),ref:r,...n,children:e})),NJ={id:"",authToken:void 0},lk=m.createContext(NJ),ck=({children:e,dashboardProps:t})=>O.jsx(ak,{children:O.jsx(lk.Provider,{value:t,children:O.jsx(au,{style:{height:"100%"},children:e})})});function ma(){const e=m.useContext(lk);if(e===void 0)throw new Error("useApplicationContext must be used within a ApplicationContextProvider");return e}function LJ(e){ke(u=>u.bookmarkKey),ke(u=>u.selectedSheetId);const t=ke(u=>u.dashboard.baseQueries),n=ke(u=>u.actions.getCardSheet),{authToken:r}=ma(),o=ke(u=>u.authToken),i=ke(u=>u.filterValues),s=ke(u=>u.isDashboardEditing),a=IJ((e==null?void 0:e.refreshInterval)||"0");n(e.id);const l=K2(e.sql,t);return Df({queryKey:[e.id,l],queryFn:()=>Of("https://semaphor.cloud/api/v1/query",(r==null?void 0:r.accessToken)||(o==null?void 0:o.accessToken)||"",{connection_id:e.connectionId,sql:l,python:e.python===lD?"":e.python,active_filters:i}),refetchInterval:a,enabled:!!e.connectionId&&!s})}function Ia({data:e,cfg:t,customCfg:n,preferences:r}){const{dimensionKeys:o,metricKeys:i}=ar(e),s=BX(i,e,r),a=og(s,n),l=o[0],c=hx(e,l);F1(r,t),uk(r);const u=dk(t,r),f=qo((t==null?void 0:t.options)||{},r==null?void 0:r.chartOptions),h=qo(u,f),g=qo(h,(n==null?void 0:n.options)||{});return{type:(n==null?void 0:n.type)||(t==null?void 0:t.type)||"bar",data:{labels:c,datasets:a},options:g}}function F1(e,t){var o,i,s;const n=((o=t==null?void 0:t.options)==null?void 0:o.indexAxis)==="y"?"x":"y";return(i=e==null?void 0:e.chartOptions)!=null&&i.indexAxis?((s=e==null?void 0:e.chartOptions)==null?void 0:s.indexAxis)==="x"?"y":"x":n}function uk(e){var n,r;return(n=e==null?void 0:e.chartOptions)!=null&&n.indexAxis?((r=e==null?void 0:e.chartOptions)==null?void 0:r.indexAxis)==="x"?"x":"y":"x"}function dk(e,t){var i,s,a,l,c,u,f,h,g,v,b,x;const n=F1(t,e),r=uk(t);return{...e==null?void 0:e.options,scales:{...(i=e==null?void 0:e.options)==null?void 0:i.scales,[n]:{...(a=(s=e==null?void 0:e.options)==null?void 0:s.scales)==null?void 0:a[n],ticks:{...(u=(c=(l=e==null?void 0:e.options)==null?void 0:l.scales)==null?void 0:c[n])==null?void 0:u.ticks,callback:w=>{var _,S,R,C;return ll({number:Number(w),decimalPlaces:((_=t==null?void 0:t.numberAxisFormat)==null?void 0:_.decimalPlaces)||0,useSuffix:!!((S=t==null?void 0:t.numberAxisFormat)!=null&&S.suffix),customSuffix:"",locale:((R=t==null?void 0:t.numberAxisFormat)==null?void 0:R.locale)||"",currency:((C=t==null?void 0:t.numberAxisFormat)==null?void 0:C.currency)||""})}}},[r]:{...(g=(h=(f=e==null?void 0:e.options)==null?void 0:f.scales)==null?void 0:h[r])==null?void 0:g.ticks,callback:null}},plugins:{...(v=e==null?void 0:e.options)==null?void 0:v.plugins,datalabels:{...(x=(b=e==null?void 0:e.options)==null?void 0:b.plugins)==null?void 0:x.datalabels,formatter:function(w){var _,S,R,C;return ll({number:Number(w),decimalPlaces:((_=t==null?void 0:t.numberAxisFormat)==null?void 0:_.decimalPlaces)||0,useSuffix:!!((S=t==null?void 0:t.numberAxisFormat)!=null&&S.suffix),customSuffix:"",locale:((R=t==null?void 0:t.numberAxisFormat)==null?void 0:R.locale)||"",currency:((C=t==null?void 0:t.numberAxisFormat)==null?void 0:C.currency)||""})}}}}}function FJ(e){return{...e,type:"bar",options:{...e==null?void 0:e.options,indexAxis:"y",scales:{x:{display:!0},y:{display:!0}}}}}function jJ(e){return{...e,type:"bar",options:{...e==null?void 0:e.options,indexAxis:"y",scales:{x:{beginAtZero:!0,stack:1,reverse:!0},y:{stacked:!0,beginAtZero:!0}}}}}function zJ(e){return{...e,type:"bar",options:{...e==null?void 0:e.options,scales:{x:{display:!0},y:{display:!0}}}}}function BJ(e,t=!1){return{...e,type:"bar",options:{...e==null?void 0:e.options,indexAxis:"y",scales:{x:{display:!0,beginAtZero:!1},y:{display:!0,stacked:t}}}}}function VJ(e,t){var r,o,i,s;return{...e,type:t==="stackedBar"?"bar":"line",options:{...e==null?void 0:e.options,scales:{x:{...(o=(r=e==null?void 0:e.options)==null?void 0:r.scales)==null?void 0:o.x,display:!0,stacked:!0},y:{...(s=(i=e==null?void 0:e.options)==null?void 0:i.scales)==null?void 0:s.y,display:!0,stacked:!0}}}}}function HJ(e){return{...e,type:"line",options:{...e==null?void 0:e.options,scales:{x:{display:!0},y:{display:!0}}}}}function WJ(e,t){var r;return{...t,type:e,options:{...t==null?void 0:t.options,scales:{x:{display:!1},y:{display:!1}},plugins:{...(r=t==null?void 0:t.options)==null?void 0:r.plugins,legend:{position:"top",align:"center",maxHeight:0,labels:{useBorderRadius:!0,borderRadius:2}}},borderRadius:0}}}function UJ(e){return{...e,type:"radar",options:{...e==null?void 0:e.options,scales:{x:{display:!1},y:{display:!1}}}}}function qJ(e){const n=new Function("getDatalabelColor",e)(_0);return{options:n==null?void 0:n.options,plugins:(n==null?void 0:n.plugins)||[]}}function j1({data:e,cardType:t="bar",cfg:n,customCfg:r,provider:o="chartjs",userSettings:i,preferences:s}){var a,l,c;if(t==="bar"){const u=zJ(n);return Ia({data:e,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="horizontalBar"){const u=FJ(n);return Ia({data:e,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="pyramid"){const u=jJ(n),{dimensionKeys:f,metricKeys:h}=ar(e),g=Tg({dataArray:e,groupKey:f[0],pivotKey:f[1],valueKey:h[0]}),v=Ia({data:g,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s}),b="x2";return{...v,data:{...v.data,datasets:v.data.datasets.map((w,_)=>_===1?{...w,xAxisID:b}:w)},options:{...v.options,scales:{...(a=v==null?void 0:v.options)==null?void 0:a.scales,[b]:{beginAtZero:!0,stack:1}}}}}if(t==="stackedBar"||t==="stackedLine"){const u=VJ(n,t),{dimensionKeys:f,metricKeys:h}=ar(e),g=Tg({dataArray:e,groupKey:f[0],pivotKey:f[1],valueKey:h[0]});return Ia({data:g,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="line"){const u=HJ(n);return Ia({data:e,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="range"){const u=BJ(n),f=WX(e),h=og(f,r),{plugins:g,options:v}=qJ((s==null?void 0:s.customVisualCode)||""),b=qo((u==null?void 0:u.options)||{},(n==null?void 0:n.options)||{}),x=qo(b,(s==null?void 0:s.chartOptions)||{}),w=qo(x,(r==null?void 0:r.options)||{}),_=qo(w,v),S=dk(n,s),R=qo(_,S),C={...R,plugins:{...R==null?void 0:R.plugins,datalabels:{...(l=R==null?void 0:R.plugins)==null?void 0:l.datalabels,formatter:(I,F)=>I.map(K=>{var Z,z,Q,W;return ll({number:Number(K),decimalPlaces:((Z=s==null?void 0:s.numberAxisFormat)==null?void 0:Z.decimalPlaces)||0,useSuffix:!!((z=s==null?void 0:s.numberAxisFormat)!=null&&z.suffix),customSuffix:"",locale:((Q=s==null?void 0:s.numberAxisFormat)==null?void 0:Q.locale)||"",currency:((W=s==null?void 0:s.numberAxisFormat)==null?void 0:W.currency)||""})}).slice(0,2).join(" - ")}}},{dimensionKeys:P}=ar(e),A=P[0];return{type:"bar",data:{labels:[...new Set(hx(e,A))],datasets:h},options:C,plugins:[...g]}}if(t==="pie"||t==="doughnut"||t==="polarArea"){const u=WJ(t,n),{dimensionKeys:f,metricKeys:h}=ar(e),g=UX(h,e),v=og(g,r),b=f[0],x=hx(e,b),w=qo((u==null?void 0:u.options)||{},(r==null?void 0:r.options)||{}),_=qo(w,(s==null?void 0:s.chartOptions)||{}),S={..._,plugins:{..._.plugins,datalabels:{...(c=_.plugins)==null?void 0:c.datalabels,formatter:(P,A)=>{var k,D,I,F;return ll({number:Number(P),decimalPlaces:((k=s==null?void 0:s.numberAxisFormat)==null?void 0:k.decimalPlaces)||0,useSuffix:!!((D=s==null?void 0:s.numberAxisFormat)!=null&&D.suffix),customSuffix:"",locale:((I=s==null?void 0:s.numberAxisFormat)==null?void 0:I.locale)||"",currency:((F=s==null?void 0:s.numberAxisFormat)==null?void 0:F.currency)||""})}}}};return{type:t,data:{labels:x,datasets:v},options:S,plugins:[t==="doughnut"?{id:"doughnutLabel",beforeDatasetsDraw:function(P,A,k){var Q,W,Y,oe;const{ctx:D,data:I}=P;D.save();const F=P.getDatasetMeta(0).data[0].x,B=P.getDatasetMeta(0).data[0].y,K=Bc(Pd());D.font="1.2rem Arial",D.fontWeight="bolder",D.fillStyle=K,D.textAlign="center",D.textBaseline="middle";const Z=I.datasets[0].data.reduce(($,H)=>$+H,0),z=ll({number:Number(Z),decimalPlaces:((Q=s==null?void 0:s.numberAxisFormat)==null?void 0:Q.decimalPlaces)||0,useSuffix:!!((W=s==null?void 0:s.numberAxisFormat)!=null&&W.suffix),customSuffix:"",locale:((Y=s==null?void 0:s.numberAxisFormat)==null?void 0:Y.locale)||"",currency:((oe=s==null?void 0:s.numberAxisFormat)==null?void 0:oe.currency)||""});D.fillText(z,F,B)}}:""]}}if(t==="radar"){const u=UJ(n);return Ia({data:e,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="bubble"||t==="scatter"){const{metricKeys:u}=ar(e);if(u.length<3){console.log("Bubble charts require 3 numeric columns");return}const f=HX(e),h=og(f,r),g={plugins:{datalabels:{display:!0}},scales:{x:{title:{display:!0,text:u[0]},beginAtZero:!0,ticks:{precision:0}},y:{title:{display:!0,text:u[1]},beginAtZero:!0,ticks:{precision:0}}}},v=qo(g,(r==null?void 0:r.options)||{});return{type:t,data:{datasets:h},options:v}}return Ia({data:e,cfg:n,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}function GJ({chart:e,elementIndex:t,datasetIndex:n,cardType:r,cfg:o,apply:i}){const s=ke.getState().theme;if(!o)return;const a=s==="dark"?"rgb(238,238,238,0.2)":"rgb(238,238,238,0.8)";["bar","line","horizontalBar","bubble","scatter"].includes(r)&&KJ(e,t,o,i,a),["pie","doughnut","polarArea"].includes(r)&&XJ(e,t,o,i,a),["stackedBar","pyramid"].includes(r)&&YJ({chart:e,elementIndex:t,datasetIndex:n,cfg:o,apply:i,blurColor:a})}function YJ(e){var a,l,c,u;const{chart:t,elementIndex:n,datasetIndex:r,cfg:o,apply:i,blurColor:s}=e;i?(l=(a=t==null?void 0:t.data)==null?void 0:a.datasets)==null||l.forEach((f,h)=>{var g,v;typeof f.backgroundColor=="string"&&(f.backgroundColor=new Array(f.data.length).fill(f.backgroundColor),f.borderColor=new Array(f.data.length).fill(f.borderColor)),f.backgroundColor=(g=f==null?void 0:f.backgroundColor)==null?void 0:g.map((b,x)=>x===n&&h===r?b:s),f.borderColor=(v=f==null?void 0:f.borderColor)==null?void 0:v.map((b,x)=>x===n&&h===r?b:s)}):(u=(c=t==null?void 0:t.data)==null?void 0:c.datasets)==null||u.forEach((f,h)=>{var g,v,b,x,w,_;f.backgroundColor=new Array(f.data.length).fill((b=(v=(g=o==null?void 0:o.data)==null?void 0:g.datasets)==null?void 0:v[h])==null?void 0:b.backgroundColor),f.borderColor=new Array(f.data.length).fill((_=(w=(x=o==null?void 0:o.data)==null?void 0:x.datasets)==null?void 0:w[h])==null?void 0:_.borderColor)}),t==null||t.update()}function KJ(e,t,n,r,o){var i,s,a,l;console.log("clicked index",t),r?(s=(i=e==null?void 0:e.data)==null?void 0:i.datasets)==null||s.forEach(c=>{var u,f;typeof c.backgroundColor=="string"&&(c.backgroundColor=new Array(c.data.length).fill(c.backgroundColor),c.borderColor=new Array(c.data.length).fill(c.borderColor)),c.backgroundColor=(u=c==null?void 0:c.backgroundColor)==null?void 0:u.map((h,g)=>g===t?h:o),c.borderColor=(f=c==null?void 0:c.borderColor)==null?void 0:f.map((h,g)=>g===t?h:o)}):(l=(a=e==null?void 0:e.data)==null?void 0:a.datasets)==null||l.forEach((c,u)=>{var f,h,g,v,b,x;c.backgroundColor=new Array(c.data.length).fill((g=(h=(f=n==null?void 0:n.data)==null?void 0:f.datasets)==null?void 0:h[u])==null?void 0:g.backgroundColor),c.borderColor=new Array(c.data.length).fill((x=(b=(v=n==null?void 0:n.data)==null?void 0:v.datasets)==null?void 0:b[u])==null?void 0:x.borderColor)}),e==null||e.update()}function XJ(e,t,n,r,o){var i,s,a,l;r?(s=(i=e==null?void 0:e.data)==null?void 0:i.datasets)==null||s.forEach(c=>{var u,f;c.backgroundColor=(u=c==null?void 0:c.backgroundColor)==null?void 0:u.map((h,g)=>g===t?h:o),c.borderColor=(f=c==null?void 0:c.borderColor)==null?void 0:f.map((h,g)=>g===t?h:o)}):(l=(a=e==null?void 0:e.data)==null?void 0:a.datasets)==null||l.forEach((c,u)=>{var f,h,g,v,b,x,w,_;typeof c.backgroundColor=="string"&&(c.backgroundColor=(g=(h=(f=n==null?void 0:n.data)==null?void 0:f.datasets)==null?void 0:h[u])==null?void 0:g.backgroundColor,c.borderColor=(x=(b=(v=n==null?void 0:n.data)==null?void 0:v.datasets)==null?void 0:b[u])==null?void 0:x.borderColor),c.backgroundColor=(w=c==null?void 0:c.backgroundColor)==null?void 0:w.map((S,R)=>{var C;return(C=n.data.datasets[u].backgroundColor)==null?void 0:C[R]}),c.borderColor=(_=c==null?void 0:c.borderColor)==null?void 0:_.map((S,R)=>{var C;return(C=n.data.datasets[u].borderColor)==null?void 0:C[R]})}),e==null||e.update()}function QJ(e,t,n,r){var o,i;try{if(!e||!e.data)return;const{dimensionKeys:s,metricKeys:a}=ar(e.data);if(["bar","horizontalBar","line","pie","doughnut","radar","polarArea"].includes(e.type)){const l=s[0],c=(o=e.data[n])==null?void 0:o[l];return[{columnName:l,columnValue:c,metric:a[t],value:r}]}if(["stackedBar","pyramid"].includes(e.type)){const l=Tg({dataArray:e.data,groupKey:s[0],pivotKey:s[1],valueKey:a[0]}),c=s[0],u=(i=l[n])==null?void 0:i[c],f=s[1],{metricKeys:h}=ar(l),g=h[t];return[{columnName:c,columnValue:u,metric:a[0],value:r},{columnName:f,columnValue:g,metric:a[0],value:r}]}if(e.type==="bubble"||e.type==="scatter"){const l=s[0],c=r.label;return[{columnName:l,columnValue:c,metric1:a[0],value1:r.x,metric2:a[1],value2:r.y,metric3:a==null?void 0:a[2],value3:r==null?void 0:r.r}]}}catch(s){console.error("Error in getAdhocFilter",s)}}function JJ(e){var s,a;const[t]=m.useState({id:"",title:"",type:"bar",data:[]}),{getCard:n}=Mo(),r=n(e),o=z1(r||t),i={...r,data:((s=o==null?void 0:o.data)==null?void 0:s.records)||[]};return{...o,data:((a=o==null?void 0:o.data)==null?void 0:a.records)||[],card:i}}function z1(e){var B,K,Z;const{onChartElementClicked:t}=ma(),[n,r]=m.useState(0),o=((B=e==null?void 0:e.preferences)==null?void 0:B.filterOnClickColumnIndex)===void 0?0:(K=e.preferences)==null?void 0:K.filterOnClickColumnIndex,i=ke(z=>z.bookmarkKey);ke(z=>z.isVisualEditing);const s=ke(z=>z.filteringCards),a=ke(z=>z.selectedSheetId);ke(z=>z.selectedCardId),ke(z=>z.isDashboardEditing);const l=ke(z=>z.themeStyle),c=ke(z=>z.filterValues),u=m.useRef(c),f=(Z=e==null?void 0:e.preferences)==null?void 0:Z.onClickFilter,{addFrame:h,addFilteringCard:g,setFrameCardData:v,getSelectedFrame:b,addOrUpdateFilterValue:x,addOrUpdateFilterValues:w,removeFilterValue:_,removeFilteringCard:S}=Mo(),{data:R,isLoading:C,isFetching:P,isError:A,refetch:k}=LJ(e),D=s==null?void 0:s.find(z=>z.id===e.id);let I;e.data&&e.data.length>0&&(I=j1({data:e.data,cardType:e.type,cfg:e.cfg,customCfg:e.customCfg,preferences:e.preferences})),m.useEffect(()=>{!R||!R.records||v(a,e.id,(R==null?void 0:R.records)||[])},[R,a,e.id,v,c]),m.useEffect(()=>{e.data&&r(n+1)},[e.data,e.type,e.cfg,e.customCfg,e.preferences,l]),m.useEffect(()=>{e.connectionId&&!D&&(k(),u.current=c)},[c,i]);function F(z,Q,W,Y){var H,J;let oe=!1;if(!e.data)return;const $=QJ(e,Q,W,Y);if(console.log("fieldValues",$),t==null||t(e,$),!!(((H=e==null?void 0:e.preferences)==null?void 0:H.onClickFilter)??[]).length){if(D){const N=e.id;_(N),S(e)}else{if(oe=!0,!$)return;const N=[];$.forEach((ce,le)=>{const de=f==null?void 0:f.find(ie=>ie.columnIndex===le);if(!de)return;const pe={filterId:e.id+"-"+ce.columnName,connectionId:e==null?void 0:e.connectionId,tableName:e.lastSelectedTable,name:ce.columnName,expression:de.expression,valueType:Td($[de.columnIndex].columnValue),operation:"=",values:[$[de.columnIndex].columnValue]};N.push(pe)}),e.id,e==null||e.connectionId,e.lastSelectedTable,$[o].columnName,(J=e.preferences)==null||J.filterOnClickField,Td($[o].columnValue),$[o].columnValue,w(N),g(e)}GJ({chart:z,elementIndex:W,datasetIndex:Q,cardType:e.type,cfg:I,apply:oe})}}return{isError:A,isLoading:C,isFetching:P,data:R,visualKey:n,handleDatapointClick:F,cfg:I}}var ZJ=e=>{switch(e){case"success":return nZ;case"info":return oZ;case"warning":return rZ;case"error":return iZ;default:return null}},eZ=Array(12).fill(0),tZ=({visible:e})=>m.createElement("div",{className:"sonner-loading-wrapper","data-visible":e},m.createElement("div",{className:"sonner-spinner"},eZ.map((t,n)=>m.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),nZ=m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},m.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),rZ=m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},m.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),oZ=m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},m.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),iZ=m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},m.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),sZ=()=>{let[e,t]=m.useState(document.hidden);return m.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},xx=1,aZ=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;let{message:r,...o}=t,i=typeof(t==null?void 0:t.id)=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:xx++,s=this.toasts.find(l=>l.id===i),a=t.dismissible===void 0?!0:t.dismissible;return s?this.toasts=this.toasts.map(l=>l.id===i?(this.publish({...l,...t,id:i,title:r}),{...l,...t,id:i,dismissible:a,title:r}):l):this.addToast({title:r,...o,dismissible:a,id:i}),i},this.dismiss=t=>(t||this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),this.subscribers.forEach(n=>n({id:t,dismiss:!0})),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));let o=t instanceof Promise?t:t(),i=r!==void 0;return o.then(async s=>{if(cZ(s)&&!s.ok){i=!1;let a=typeof n.error=="function"?await n.error(`HTTP error! status: ${s.status}`):n.error,l=typeof n.description=="function"?await n.description(`HTTP error! status: ${s.status}`):n.description;this.create({id:r,type:"error",message:a,description:l})}else if(n.success!==void 0){i=!1;let a=typeof n.success=="function"?await n.success(s):n.success,l=typeof n.description=="function"?await n.description(s):n.description;this.create({id:r,type:"success",message:a,description:l})}}).catch(async s=>{if(n.error!==void 0){i=!1;let a=typeof n.error=="function"?await n.error(s):n.error,l=typeof n.description=="function"?await n.description(s):n.description;this.create({id:r,type:"error",message:a,description:l})}}).finally(()=>{var s;i&&(this.dismiss(r),r=void 0),(s=n.finally)==null||s.call(n)}),r},this.custom=(t,n)=>{let r=(n==null?void 0:n.id)||xx++;return this.create({jsx:t(r),id:r,...n}),r},this.subscribers=[],this.toasts=[]}},Qr=new aZ,lZ=(e,t)=>{let n=(t==null?void 0:t.id)||xx++;return Qr.addToast({title:e,...t,id:n}),n},cZ=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",uZ=lZ,dZ=()=>Qr.toasts,fk=Object.assign(uZ,{success:Qr.success,info:Qr.info,warning:Qr.warning,error:Qr.error,custom:Qr.custom,message:Qr.message,promise:Qr.promise,dismiss:Qr.dismiss,loading:Qr.loading},{getHistory:dZ});function fZ(e,{insertAt:t}={}){if(!e||typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}fZ(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999}:where([data-sonner-toaster][data-x-position="right"]){right:max(var(--offset),env(safe-area-inset-right))}:where([data-sonner-toaster][data-x-position="left"]){left:max(var(--offset),env(safe-area-inset-left))}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:max(var(--offset),env(safe-area-inset-top))}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:max(var(--offset),env(safe-area-inset-bottom))}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;background:var(--gray1);color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:0;right:0;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount, 0px));transition:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation:swipe-out .2s ease-out forwards}@keyframes swipe-out{0%{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount)));opacity:1}to{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;--mobile-offset: 16px;right:var(--mobile-offset);left:var(--mobile-offset);width:100%}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset)}[data-sonner-toaster][data-y-position=bottom]{bottom:20px}[data-sonner-toaster][data-y-position=top]{top:20px}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset);right:var(--mobile-offset);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
254
254
  `);function yp(e){return e.label!==void 0}var hZ=3,pZ="32px",gZ=4e3,mZ=356,vZ=14,bZ=20,yZ=200;function xZ(...e){return e.filter(Boolean).join(" ")}var wZ=e=>{var t,n,r,o,i,s,a,l,c,u;let{invert:f,toast:h,unstyled:g,interacting:v,setHeights:b,visibleToasts:x,heights:w,index:_,toasts:S,expanded:R,removeToast:C,defaultRichColors:P,closeButton:A,style:k,cancelButtonStyle:D,actionButtonStyle:I,className:F="",descriptionClassName:B="",duration:K,position:Z,gap:z,loadingIcon:Q,expandByDefault:W,classNames:Y,icons:oe,closeButtonAriaLabel:$="Close toast",pauseWhenPageIsHidden:H,cn:J}=e,[N,ce]=m.useState(!1),[le,de]=m.useState(!1),[pe,ie]=m.useState(!1),[te,ae]=m.useState(!1),[ye,G]=m.useState(0),[be,_e]=m.useState(0),Pe=m.useRef(null),Te=m.useRef(null),Ue=_===0,Be=_+1<=x,Ie=h.type,Ke=h.dismissible!==!1,lt=h.className||"",It=h.descriptionClassName||"",$t=m.useMemo(()=>w.findIndex(nt=>nt.toastId===h.id)||0,[w,h.id]),Ht=m.useMemo(()=>{var nt;return(nt=h.closeButton)!=null?nt:A},[h.closeButton,A]),fe=m.useMemo(()=>h.duration||K||gZ,[h.duration,K]),Ee=m.useRef(0),Le=m.useRef(0),Ge=m.useRef(0),Ze=m.useRef(null),[Wt,Zt]=Z.split("-"),Kt=m.useMemo(()=>w.reduce((nt,ht,At)=>At>=$t?nt:nt+ht.height,0),[w,$t]),vn=sZ(),ln=h.invert||f,Lt=Ie==="loading";Le.current=m.useMemo(()=>$t*z+Kt,[$t,Kt]),m.useEffect(()=>{ce(!0)},[]),m.useLayoutEffect(()=>{if(!N)return;let nt=Te.current,ht=nt.style.height;nt.style.height="auto";let At=nt.getBoundingClientRect().height;nt.style.height=ht,_e(At),b(Xt=>Xt.find(bt=>bt.toastId===h.id)?Xt.map(bt=>bt.toastId===h.id?{...bt,height:At}:bt):[{toastId:h.id,height:At,position:h.position},...Xt])},[N,h.title,h.description,b,h.id]);let tn=m.useCallback(()=>{de(!0),G(Le.current),b(nt=>nt.filter(ht=>ht.toastId!==h.id)),setTimeout(()=>{C(h)},yZ)},[h,C,b,Le]);m.useEffect(()=>{if(h.promise&&Ie==="loading"||h.duration===1/0||h.type==="loading")return;let nt,ht=fe;return R||v||H&&vn?(()=>{if(Ge.current<Ee.current){let At=new Date().getTime()-Ee.current;ht=ht-At}Ge.current=new Date().getTime()})():ht!==1/0&&(Ee.current=new Date().getTime(),nt=setTimeout(()=>{var At;(At=h.onAutoClose)==null||At.call(h,h),tn()},ht)),()=>clearTimeout(nt)},[R,v,W,h,fe,tn,h.promise,Ie,H,vn]),m.useEffect(()=>{let nt=Te.current;if(nt){let ht=nt.getBoundingClientRect().height;return _e(ht),b(At=>[{toastId:h.id,height:ht,position:h.position},...At]),()=>b(At=>At.filter(Xt=>Xt.toastId!==h.id))}},[b,h.id]),m.useEffect(()=>{h.delete&&tn()},[tn,h.delete]);function xn(){return oe!=null&&oe.loading?m.createElement("div",{className:"sonner-loader","data-visible":Ie==="loading"},oe.loading):Q?m.createElement("div",{className:"sonner-loader","data-visible":Ie==="loading"},Q):m.createElement(tZ,{visible:Ie==="loading"})}return m.createElement("li",{"aria-live":h.important?"assertive":"polite","aria-atomic":"true",role:"status",tabIndex:0,ref:Te,className:J(F,lt,Y==null?void 0:Y.toast,(t=h==null?void 0:h.classNames)==null?void 0:t.toast,Y==null?void 0:Y.default,Y==null?void 0:Y[Ie],(n=h==null?void 0:h.classNames)==null?void 0:n[Ie]),"data-sonner-toast":"","data-rich-colors":(r=h.richColors)!=null?r:P,"data-styled":!(h.jsx||h.unstyled||g),"data-mounted":N,"data-promise":!!h.promise,"data-removed":le,"data-visible":Be,"data-y-position":Wt,"data-x-position":Zt,"data-index":_,"data-front":Ue,"data-swiping":pe,"data-dismissible":Ke,"data-type":Ie,"data-invert":ln,"data-swipe-out":te,"data-expanded":!!(R||W&&N),style:{"--index":_,"--toasts-before":_,"--z-index":S.length-_,"--offset":`${le?ye:Le.current}px`,"--initial-height":W?"auto":`${be}px`,...k,...h.style},onPointerDown:nt=>{Lt||!Ke||(Pe.current=new Date,G(Le.current),nt.target.setPointerCapture(nt.pointerId),nt.target.tagName!=="BUTTON"&&(ie(!0),Ze.current={x:nt.clientX,y:nt.clientY}))},onPointerUp:()=>{var nt,ht,At,Xt;if(te||!Ke)return;Ze.current=null;let bt=Number(((nt=Te.current)==null?void 0:nt.style.getPropertyValue("--swipe-amount").replace("px",""))||0),Rn=new Date().getTime()-((ht=Pe.current)==null?void 0:ht.getTime()),Lo=Math.abs(bt)/Rn;if(Math.abs(bt)>=bZ||Lo>.11){G(Le.current),(At=h.onDismiss)==null||At.call(h,h),tn(),ae(!0);return}(Xt=Te.current)==null||Xt.style.setProperty("--swipe-amount","0px"),ie(!1)},onPointerMove:nt=>{var ht;if(!Ze.current||!Ke)return;let At=nt.clientY-Ze.current.y,Xt=nt.clientX-Ze.current.x,bt=(Wt==="top"?Math.min:Math.max)(0,At),Rn=nt.pointerType==="touch"?10:2;Math.abs(bt)>Rn?(ht=Te.current)==null||ht.style.setProperty("--swipe-amount",`${At}px`):Math.abs(Xt)>Rn&&(Ze.current=null)}},Ht&&!h.jsx?m.createElement("button",{"aria-label":$,"data-disabled":Lt,"data-close-button":!0,onClick:Lt||!Ke?()=>{}:()=>{var nt;tn(),(nt=h.onDismiss)==null||nt.call(h,h)},className:J(Y==null?void 0:Y.closeButton,(o=h==null?void 0:h.classNames)==null?void 0:o.closeButton)},m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},m.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),m.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))):null,h.jsx||m.isValidElement(h.title)?h.jsx||h.title:m.createElement(m.Fragment,null,Ie||h.icon||h.promise?m.createElement("div",{"data-icon":"",className:J(Y==null?void 0:Y.icon,(i=h==null?void 0:h.classNames)==null?void 0:i.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||xn():null,h.type!=="loading"?h.icon||(oe==null?void 0:oe[Ie])||ZJ(Ie):null):null,m.createElement("div",{"data-content":"",className:J(Y==null?void 0:Y.content,(s=h==null?void 0:h.classNames)==null?void 0:s.content)},m.createElement("div",{"data-title":"",className:J(Y==null?void 0:Y.title,(a=h==null?void 0:h.classNames)==null?void 0:a.title)},h.title),h.description?m.createElement("div",{"data-description":"",className:J(B,It,Y==null?void 0:Y.description,(l=h==null?void 0:h.classNames)==null?void 0:l.description)},h.description):null),m.isValidElement(h.cancel)?h.cancel:h.cancel&&yp(h.cancel)?m.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||D,onClick:nt=>{var ht,At;yp(h.cancel)&&Ke&&((At=(ht=h.cancel).onClick)==null||At.call(ht,nt),tn())},className:J(Y==null?void 0:Y.cancelButton,(c=h==null?void 0:h.classNames)==null?void 0:c.cancelButton)},h.cancel.label):null,m.isValidElement(h.action)?h.action:h.action&&yp(h.action)?m.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||I,onClick:nt=>{var ht,At;yp(h.action)&&(nt.defaultPrevented||((At=(ht=h.action).onClick)==null||At.call(ht,nt),tn()))},className:J(Y==null?void 0:Y.actionButton,(u=h==null?void 0:h.classNames)==null?void 0:u.actionButton)},h.action.label):null))};function yP(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}var _Z=e=>{let{invert:t,position:n="bottom-right",hotkey:r=["altKey","KeyT"],expand:o,closeButton:i,className:s,offset:a,theme:l="light",richColors:c,duration:u,style:f,visibleToasts:h=hZ,toastOptions:g,dir:v=yP(),gap:b=vZ,loadingIcon:x,icons:w,containerAriaLabel:_="Notifications",pauseWhenPageIsHidden:S,cn:R=xZ}=e,[C,P]=m.useState([]),A=m.useMemo(()=>Array.from(new Set([n].concat(C.filter(H=>H.position).map(H=>H.position)))),[C,n]),[k,D]=m.useState([]),[I,F]=m.useState(!1),[B,K]=m.useState(!1),[Z,z]=m.useState(l!=="system"?l:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Q=m.useRef(null),W=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),Y=m.useRef(null),oe=m.useRef(!1),$=m.useCallback(H=>{var J;(J=C.find(N=>N.id===H.id))!=null&&J.delete||Qr.dismiss(H.id),P(N=>N.filter(({id:ce})=>ce!==H.id))},[C]);return m.useEffect(()=>Qr.subscribe(H=>{if(H.dismiss){P(J=>J.map(N=>N.id===H.id?{...N,delete:!0}:N));return}setTimeout(()=>{ko.flushSync(()=>{P(J=>{let N=J.findIndex(ce=>ce.id===H.id);return N!==-1?[...J.slice(0,N),{...J[N],...H},...J.slice(N+1)]:[H,...J]})})})}),[]),m.useEffect(()=>{if(l!=="system"){z(l);return}l==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?z("dark"):z("light")),typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",({matches:H})=>{z(H?"dark":"light")})},[l]),m.useEffect(()=>{C.length<=1&&F(!1)},[C]),m.useEffect(()=>{let H=J=>{var N,ce;r.every(le=>J[le]||J.code===le)&&(F(!0),(N=Q.current)==null||N.focus()),J.code==="Escape"&&(document.activeElement===Q.current||(ce=Q.current)!=null&&ce.contains(document.activeElement))&&F(!1)};return document.addEventListener("keydown",H),()=>document.removeEventListener("keydown",H)},[r]),m.useEffect(()=>{if(Q.current)return()=>{Y.current&&(Y.current.focus({preventScroll:!0}),Y.current=null,oe.current=!1)}},[Q.current]),C.length?m.createElement("section",{"aria-label":`${_} ${W}`,tabIndex:-1},A.map((H,J)=>{var N;let[ce,le]=H.split("-");return m.createElement("ol",{key:H,dir:v==="auto"?yP():v,tabIndex:-1,ref:Q,className:s,"data-sonner-toaster":!0,"data-theme":Z,"data-y-position":ce,"data-x-position":le,style:{"--front-toast-height":`${((N=k[0])==null?void 0:N.height)||0}px`,"--offset":typeof a=="number"?`${a}px`:a||pZ,"--width":`${mZ}px`,"--gap":`${b}px`,...f},onBlur:de=>{oe.current&&!de.currentTarget.contains(de.relatedTarget)&&(oe.current=!1,Y.current&&(Y.current.focus({preventScroll:!0}),Y.current=null))},onFocus:de=>{de.target instanceof HTMLElement&&de.target.dataset.dismissible==="false"||oe.current||(oe.current=!0,Y.current=de.relatedTarget)},onMouseEnter:()=>F(!0),onMouseMove:()=>F(!0),onMouseLeave:()=>{B||F(!1)},onPointerDown:de=>{de.target instanceof HTMLElement&&de.target.dataset.dismissible==="false"||K(!0)},onPointerUp:()=>K(!1)},C.filter(de=>!de.position&&J===0||de.position===H).map((de,pe)=>{var ie,te;return m.createElement(wZ,{key:de.id,icons:w,index:pe,toast:de,defaultRichColors:c,duration:(ie=g==null?void 0:g.duration)!=null?ie:u,className:g==null?void 0:g.className,descriptionClassName:g==null?void 0:g.descriptionClassName,invert:t,visibleToasts:h,closeButton:(te=g==null?void 0:g.closeButton)!=null?te:i,interacting:B,position:H,style:g==null?void 0:g.style,unstyled:g==null?void 0:g.unstyled,classNames:g==null?void 0:g.classNames,cancelButtonStyle:g==null?void 0:g.cancelButtonStyle,actionButtonStyle:g==null?void 0:g.actionButtonStyle,removeToast:$,toasts:C.filter(ae=>ae.position==de.position),heights:k.filter(ae=>ae.position==de.position),setHeights:D,expandByDefault:o,gap:b,loadingIcon:x,expanded:I,pauseWhenPageIsHidden:S,cn:R})}))})):null};function SZ(e,t){const n=ke(u=>u.selectedSheetId),r=ke(u=>u.selectedFrameId),o=ke(u=>u.isDashboardEditing),i=ke(u=>u.isVisualEditing),{addFrame:s,getSelectedFrame:a,setSelectedFrameId:l}=ke(u=>u.actions);m.useEffect(()=>{const u=h=>{if(o&&((h.metaKey||h.ctrlKey)&&h.key==="c"&&(navigator.clipboard.writeText(JSON.stringify(a())),fk.success("Card copied to clipboard")),(h.ctrlKey||h.metaKey)&&h.key==="v")){console.log("Ctrl+V has been pressed");try{navigator.clipboard.readText().then(g=>{try{const v=JSON.parse(g);if(v&&v.id){v.id=la();const b=v.activeCardId;v.cards.forEach(x=>{const w=x.id;x.id=la(),w===b&&(v.activeCardId=x.id,x.title=`${x.title} (Copy)`)}),s(n,v),l(v.id)}}catch(v){console.error("Failed to parse clipboard contents: ",v)}})}catch(g){console.error("Failed to read clipboard contents: ",g)}}},f=t==null?void 0:t.current;return f==null||f.addEventListener("keydown",u),()=>{f==null||f.removeEventListener("keydown",u)}},[o,n,a,s,t,l]),m.useEffect(()=>{r===e.id&&o&&!i&&c()},[r,e.id,o,i]);function c(){const u=t==null?void 0:t.current;u==null||u.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}}let oy;const hk="HoverCard",[pk,hye]=Zn(hk,[Ti]),B1=Ti(),[CZ,V1]=pk(hk),EZ=e=>{const{__scopeHoverCard:t,children:n,open:r,defaultOpen:o,onOpenChange:i,openDelay:s=700,closeDelay:a=300}=e,l=B1(t),c=m.useRef(0),u=m.useRef(0),f=m.useRef(!1),h=m.useRef(!1),[g=!1,v]=xr({prop:r,defaultProp:o,onChange:i}),b=m.useCallback(()=>{clearTimeout(u.current),c.current=window.setTimeout(()=>v(!0),s)},[s,v]),x=m.useCallback(()=>{clearTimeout(c.current),!f.current&&!h.current&&(u.current=window.setTimeout(()=>v(!1),a))},[a,v]),w=m.useCallback(()=>v(!1),[v]);return m.useEffect(()=>()=>{clearTimeout(c.current),clearTimeout(u.current)},[]),m.createElement(CZ,{scope:t,open:g,onOpenChange:v,onOpen:b,onClose:x,onDismiss:w,hasSelectionRef:f,isPointerDownOnContentRef:h},m.createElement(Bf,l,n))},RZ="HoverCardTrigger",OZ=m.forwardRef((e,t)=>{const{__scopeHoverCard:n,...r}=e,o=V1(RZ,n),i=B1(n);return m.createElement(Vf,he({asChild:!0},i),m.createElement(Qe.a,he({"data-state":o.open?"open":"closed"},r,{ref:t,onPointerEnter:Me(e.onPointerEnter,Mg(o.onOpen)),onPointerLeave:Me(e.onPointerLeave,Mg(o.onClose)),onFocus:Me(e.onFocus,o.onOpen),onBlur:Me(e.onBlur,o.onClose),onTouchStart:Me(e.onTouchStart,s=>s.preventDefault())})))}),PZ="HoverCardPortal",[pye,TZ]=pk(PZ,{forceMount:void 0}),wx="HoverCardContent",DZ=m.forwardRef((e,t)=>{const n=TZ(wx,e.__scopeHoverCard),{forceMount:r=n.forceMount,...o}=e,i=V1(wx,e.__scopeHoverCard);return m.createElement(er,{present:r||i.open},m.createElement($Z,he({"data-state":i.open?"open":"closed"},o,{onPointerEnter:Me(e.onPointerEnter,Mg(i.onOpen)),onPointerLeave:Me(e.onPointerLeave,Mg(i.onClose)),ref:t})))}),$Z=m.forwardRef((e,t)=>{const{__scopeHoverCard:n,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,...a}=e,l=V1(wx,n),c=B1(n),u=m.useRef(null),f=_t(t,u),[h,g]=m.useState(!1);return m.useEffect(()=>{if(h){const v=document.body;return oy=v.style.userSelect||v.style.webkitUserSelect,v.style.userSelect="none",v.style.webkitUserSelect="none",()=>{v.style.userSelect=oy,v.style.webkitUserSelect=oy}}},[h]),m.useEffect(()=>{if(u.current){const v=()=>{g(!1),l.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var b;((b=document.getSelection())===null||b===void 0?void 0:b.toString())!==""&&(l.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",v),()=>{document.removeEventListener("pointerup",v),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!1}}},[l.isPointerDownOnContentRef,l.hasSelectionRef]),m.useEffect(()=>{u.current&&AZ(u.current).forEach(b=>b.setAttribute("tabindex","-1"))}),m.createElement(jf,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:s,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:Me(i,v=>{v.preventDefault()}),onDismiss:l.onDismiss},m.createElement(Hf,he({},c,a,{onPointerDown:Me(a.onPointerDown,v=>{v.currentTarget.contains(v.target)&&g(!0),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!0}),ref:f,style:{...a.style,userSelect:h?"text":void 0,WebkitUserSelect:h?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})))});function Mg(e){return t=>t.pointerType==="touch"?void 0:e()}function AZ(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)t.push(n.currentNode);return t}const kZ=EZ,MZ=OZ,gk=DZ,H1=kZ,W1=MZ,Im=V.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>O.jsx(gk,{ref:o,align:t,sideOffset:n,className:Ce("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r}));Im.displayName=gk.displayName;function IZ({card:e}){const{setCardInfo:t}=Mo();return O.jsxs(H1,{openDelay:0,children:[O.jsx(W1,{children:O.jsx(ZX,{className:"size-4 text-muted-foreground/40"})}),O.jsx(Im,{align:"start",className:"w-[300px]",onMouseDown:n=>n.stopPropagation(),children:O.jsx(is,{type:"textarea",text:e.info||"",onSave:n=>t(e.id,n),children:O.jsx("p",{className:"text-sm text-muted-foreground",children:e.info||"Double-click to add info"})})})]})}const U1=V.forwardRef(({className:e,containerClassName:t,containerStyle:n,...r},o)=>O.jsx("div",{style:n,className:Ce("relative w-full overflow-auto",t),children:O.jsx("table",{ref:o,className:Ce("w-full caption-bottom text-sm",e),...r})}));U1.displayName="Table";const q1=V.forwardRef(({className:e,...t},n)=>O.jsx("thead",{ref:n,className:Ce("[&_tr]:border-b",e),...t}));q1.displayName="TableHeader";const G1=V.forwardRef(({className:e,...t},n)=>O.jsx("tbody",{ref:n,className:Ce("[&_tr:last-child]:border-0",e),...t}));G1.displayName="TableBody";const NZ=V.forwardRef(({className:e,...t},n)=>O.jsx("tfoot",{ref:n,className:Ce("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));NZ.displayName="TableFooter";const yd=V.forwardRef(({className:e,...t},n)=>O.jsx("tr",{ref:n,className:Ce("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));yd.displayName="TableRow";const Y1=V.forwardRef(({className:e,...t},n)=>O.jsx("th",{ref:n,className:Ce("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));Y1.displayName="TableHead";const Ig=V.forwardRef(({className:e,...t},n)=>O.jsx("td",{ref:n,className:Ce("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));Ig.displayName="TableCell";const LZ=V.forwardRef(({className:e,...t},n)=>O.jsx("caption",{ref:n,className:Ce("mt-4 text-sm text-muted-foreground",e),...t}));LZ.displayName="TableCaption";/**
255
255
  * table-core
256
256
  *
@@ -409,7 +409,7 @@ Check the top-level render call using <`+ue+">.")}return ee}}function ni(T,ee){{
409
409
  `});++r<e.length;)r&&n.push({type:"text",value:`
410
410
  `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
411
411
  `}),n}function XT(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function QT(e,t){const n=Vfe(e,t),r=n.one(e,void 0),o=$fe(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return o&&i.children.push({type:"text",value:`
412
- `},o),i}function Gfe(e,t){return e&&"run"in e?async function(n,r){const o=QT(n,{file:r,...t});await e.run(o,r)}:function(n,r){return QT(n,{file:r,...t||e})}}function JT(e){if(e)throw e}var cg=Object.prototype.hasOwnProperty,mN=Object.prototype.toString,ZT=Object.defineProperty,e2=Object.getOwnPropertyDescriptor,t2=function(t){return typeof Array.isArray=="function"?Array.isArray(t):mN.call(t)==="[object Array]"},n2=function(t){if(!t||mN.call(t)!=="[object Object]")return!1;var n=cg.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&cg.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var o;for(o in t);return typeof o>"u"||cg.call(t,o)},r2=function(t,n){ZT&&n.name==="__proto__"?ZT(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},o2=function(t,n){if(n==="__proto__")if(cg.call(t,n)){if(e2)return e2(t,n).value}else return;return t[n]},Yfe=function e(){var t,n,r,o,i,s,a=arguments[0],l=1,c=arguments.length,u=!1;for(typeof a=="boolean"&&(u=a,a=arguments[1]||{},l=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});l<c;++l)if(t=arguments[l],t!=null)for(n in t)r=o2(a,n),o=o2(t,n),a!==o&&(u&&o&&(n2(o)||(i=t2(o)))?(i?(i=!1,s=r&&t2(r)?r:[]):s=r&&n2(r)?r:{},r2(a,{name:n,newValue:e(u,s,o)})):typeof o<"u"&&r2(a,{name:n,newValue:o}));return a};const Uy=nu(Yfe);function tw(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Kfe(){const e=[],t={run:n,use:r};return t;function n(...o){let i=-1;const s=o.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);a(null,...o);function a(l,...c){const u=e[++i];let f=-1;if(l){s(l);return}for(;++f<o.length;)(c[f]===null||c[f]===void 0)&&(c[f]=o[f]);o=c,u?Xfe(u,a)(...c):s(null,...c)}}function r(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function Xfe(e,t){let n;return r;function r(...s){const a=e.length>s.length;let l;a&&s.push(o);try{l=e.apply(this,s)}catch(c){const u=c;if(a&&n)throw u;return o(u)}a||(l instanceof Promise?l.then(i,o):l instanceof Error?o(l):i(l))}function o(s,...a){n||(n=!0,t(s,...a))}function i(s){o(null,s)}}const di={basename:Qfe,dirname:Jfe,extname:Zfe,join:ehe,sep:"/"};function Qfe(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Zf(e);let n=0,r=-1,o=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(i){n=o+1;break}}else r<0&&(i=!0,r=o+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let s=-1,a=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(i){n=o+1;break}}else s<0&&(i=!0,s=o+1),a>-1&&(e.codePointAt(o)===t.codePointAt(a--)?a<0&&(r=o):(a=-1,r=s));return n===r?r=s:r<0&&(r=e.length),e.slice(n,r)}function Jfe(e){if(Zf(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Zfe(e){Zf(e);let t=e.length,n=-1,r=0,o=-1,i=0,s;for(;t--;){const a=e.codePointAt(t);if(a===47){if(s){r=t+1;break}continue}n<0&&(s=!0,n=t+1),a===46?o<0?o=t:i!==1&&(i=1):o>-1&&(i=-1)}return o<0||n<0||i===0||i===1&&o===n-1&&o===r+1?"":e.slice(o,n)}function ehe(...e){let t=-1,n;for(;++t<e.length;)Zf(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":the(n)}function the(e){Zf(e);const t=e.codePointAt(0)===47;let n=nhe(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function nhe(e,t){let n="",r=0,o=-1,i=0,s=-1,a,l;for(;++s<=e.length;){if(s<e.length)a=e.codePointAt(s);else{if(a===47)break;a=47}if(a===47){if(!(o===s-1||i===1))if(o!==s-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),o=s,i=0;continue}}else if(n.length>0){n="",r=0,o=s,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(o+1,s):n=e.slice(o+1,s),r=s-o-1;o=s,i=0}else a===46&&i>-1?i++:i=-1}return n}function Zf(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const rhe={cwd:ohe};function ohe(){return"/"}function nw(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function ihe(e){if(typeof e=="string")e=new URL(e);else if(!nw(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return she(e)}function she(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(t)}const qy=["history","path","basename","stem","extname","dirname"];class vN{constructor(t){let n;t?nw(t)?n={path:t}:typeof t=="string"||ahe(t)?n={value:t}:n=t:n={},this.cwd=rhe.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<qy.length;){const i=qy[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let o;for(o in n)qy.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?di.basename(this.path):void 0}set basename(t){Yy(t,"basename"),Gy(t,"basename"),this.path=di.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?di.dirname(this.path):void 0}set dirname(t){i2(this.basename,"dirname"),this.path=di.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?di.extname(this.path):void 0}set extname(t){if(Gy(t,"extname"),i2(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=di.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){nw(t)&&(t=ihe(t)),Yy(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?di.basename(this.path,this.extname):void 0}set stem(t){Yy(t,"stem"),Gy(t,"stem"),this.path=di.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const o=this.message(t,n,r);throw o.fatal=!0,o}info(t,n,r){const o=this.message(t,n,r);return o.fatal=void 0,o}message(t,n,r){const o=new dr(t,n,r);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Gy(e,t){if(e&&e.includes(di.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+di.sep+"`")}function Yy(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function i2(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function ahe(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const lhe=function(e){const r=this.constructor.prototype,o=r[e],i=function(){return o.apply(i,arguments)};Object.setPrototypeOf(i,r);const s=Object.getOwnPropertyNames(o);for(const a of s){const l=Object.getOwnPropertyDescriptor(o,a);l&&Object.defineProperty(i,a,l)}return i},che={}.hasOwnProperty;class G_ extends lhe{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Kfe()}copy(){const t=new G_;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Uy(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Qy("data",this.frozen),this.namespace[t]=n,this):che.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Qy("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const o=n.call(t,...r);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Fp(t),r=this.parser||this.Parser;return Ky("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Ky("process",this.parser||this.Parser),Xy("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(i,s){const a=Fp(t),l=r.parse(a);r.run(l,a,function(u,f,h){if(u||!f||!h)return c(u);const g=f,v=r.stringify(g,h);fhe(v)?h.value=v:h.result=v,c(u,h)});function c(u,f){u||!f?s(u):i?i(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),Ky("processSync",this.parser||this.Parser),Xy("processSync",this.compiler||this.Compiler),this.process(t,o),a2("processSync","process",n),r;function o(i,s){n=!0,JT(i),r=s}}run(t,n,r){s2(t),this.freeze();const o=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(s,a){const l=Fp(n);o.run(t,l,c);function c(u,f,h){const g=f||t;u?a(u):s?s(g):r(void 0,g,h)}}}runSync(t,n){let r=!1,o;return this.run(t,n,i),a2("runSync","run",r),o;function i(s,a){JT(s),o=a,r=!0}}stringify(t,n){this.freeze();const r=Fp(n),o=this.compiler||this.Compiler;return Xy("stringify",o),s2(t),o(t,r)}use(t,...n){const r=this.attachers,o=this.namespace;if(Qy("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?a(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[u,...f]=c;l(u,f)}else s(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function s(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(c.plugins),c.settings&&(o.settings=Uy(!0,o.settings,c.settings))}function a(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){const f=c[u];i(f)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let f=-1,h=-1;for(;++f<r.length;)if(r[f][0]===c){h=f;break}if(h===-1)r.push([c,...u]);else if(u.length>0){let[g,...v]=u;const b=r[h][1];tw(b)&&tw(g)&&(g=Uy(!0,b,g)),r[h]=[c,g,...v]}}}}const uhe=new G_().freeze();function Ky(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Xy(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Qy(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function s2(e){if(!tw(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function a2(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Fp(e){return dhe(e)?e:new vN(e)}function dhe(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function fhe(e){return typeof e=="string"||hhe(e)}function hhe(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const phe="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",l2=[],c2={allowDangerousHtml:!0},ghe=/^(https?|ircs?|mailto|xmpp)$/i,mhe=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function bN(e){const t=e.allowedElements,n=e.allowElement,r=e.children||"",o=e.className,i=e.components,s=e.disallowedElements,a=e.rehypePlugins||l2,l=e.remarkPlugins||l2,c=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...c2}:c2,u=e.skipHtml,f=e.unwrapDisallowed,h=e.urlTransform||vhe,g=uhe().use(Jde).use(l).use(Gfe,c).use(a),v=new vN;typeof r=="string"&&(v.value=r);for(const _ of mhe)Object.hasOwn(e,_.from)&&(""+_.from+(_.to?"use `"+_.to+"` instead":"remove it")+phe+_.id,void 0);const b=g.parse(v);let x=g.runSync(b,v);return o&&(x={type:"element",tagName:"div",properties:{className:o},children:x.type==="root"?x.children:[x]}),gN(x,w),$ce(x,{Fragment:O.Fragment,components:i,ignoreInvalidStyle:!0,jsx:O.jsx,jsxs:O.jsxs,passKeys:!0,passNode:!0});function w(_,S,R){if(_.type==="raw"&&R&&typeof S=="number")return u?R.children.splice(S,1):R.children[S]={type:"text",value:_.value},S;if(_.type==="element"){let C;for(C in Vy)if(Object.hasOwn(Vy,C)&&Object.hasOwn(_.properties,C)){const P=_.properties[C],A=Vy[C];(A===null||A.includes(_.tagName))&&(_.properties[C]=h(String(P||""),C,_))}}if(_.type==="element"){let C=t?!t.includes(_.tagName):s?s.includes(_.tagName):!1;if(!C&&n&&typeof S=="number"&&(C=!n(_,S,R)),C&&R&&typeof S=="number")return f&&_.children?R.children.splice(S,1,..._.children):R.children.splice(S,1),S}}}function vhe(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),o=e.indexOf("/");return t<0||o>-1&&t>o||n>-1&&t>n||r>-1&&t>r||ghe.test(e.slice(0,t))?e:""}function bhe(){const e=m.useRef(null),[t,n]=m.useState(""),[r,o]=m.useState(!1),i=ke(D=>D.dashboard.aiScopeTables);Om();const s=ke(D=>D.selectedSheetId),{addFrame:a,setSelectedFrameId:l,setIsDashboardEditing:c}=Mo(),{authToken:u}=ma(),f=bD(),{messages:h,input:g,handleInputChange:v,handleSubmit:b,addToolResult:x,stop:w,isLoading:_}=yle({api:"https://semaphor.cloud/api/v1/chat",headers:{Authorization:`Bearer ${u==null?void 0:u.accessToken}`},maxToolRoundtrips:5,async onToolCall({toolCall:D}){if(R(D.toolName),D.toolName==="getLocation"){const I=["New York","Los Angeles","Chicago","San Francisco"];return I[Math.floor(Math.random()*I.length)]}if(D.toolName==="getTables")return JSON.stringify(i||[]);if(D.toolName==="getData"){console.log(D.args);const I=D.args;if(!(I!=null&&I.sql)||!(I!=null&&I.connectionId))return"Please provide sql, connectionId and table";const F=await f.fetchQuery({queryKey:["chat",I.connectionId,I.sql],queryFn:()=>Of("https://semaphor.cloud/api/v1/query",(u==null?void 0:u.accessToken)||(u==null?void 0:u.accessToken)||"",{connection_id:I.connectionId,sql:I.sql})});return n("Summarizing"),JSON.stringify(F)}},onFinish(D,I){console.log("onFinish",D,I),D.content&&n("")}}),S=()=>{var D;(D=e.current)==null||D.scrollIntoView({behavior:"smooth"})};m.useEffect(()=>{S()},[h]);function R(D){D==="getTables"&&n("Initializing"),D==="getSchemas"&&n("Analyzing"),D==="getData"&&n("Fetching")}function C(D){const I=D.toolInvocations||[];return I.length===0||I.find(B=>B.toolName==="getData"&&"result"in B)?!0:r}function P(D){return D==null?void 0:D.map(I=>{var B;const F=I.role==="user";return C(I)?O.jsxs("div",{className:Ce("relative rounded-md bg-background px-4 py-4 text-sm text-foreground/80",{"bg-muted":F}),children:[O.jsx("div",{className:"space-y-2",children:O.jsxs("div",{className:"flex shrink-0 items-start gap-3",children:[O.jsx("div",{className:"text-muted-foreground",children:F?O.jsx(rQ,{className:"size-5 shrink-0"}):O.jsx(px,{className:"size-5 shrink-0"})}),O.jsx("div",{children:O.jsx(bN,{components:yhe,children:I.content})})]})}),(B=I.toolInvocations)==null?void 0:B.map(K=>{const Z=K.toolCallId;return"result"in K?O.jsx("div",{children:A(K)},Z):O.jsxs("div",{children:["Calling ",K.toolName,"..."]},Z)})]},I.id):null})}function A(D){if("result"in D){let I;try{const F=JSON.parse(D.result);if(I=O.jsx("pre",{className:"whitespace-normal text-xs",children:JSON.stringify(F,null,2)}),D.toolName==="getData"){console.log(D);const B=j1({cardType:D.args.chartType,data:F.records});return O.jsxs("div",{className:"space-y-2",children:[r&&O.jsxs("div",{children:[O.jsx("span",{className:"font-semibold text-blue-700",children:"Tool call"})," ",`${D.toolName}: `,I]}),O.jsxs("div",{className:"flex h-[350px] w-[99%] grow flex-col py-2",children:[O.jsx(yr,{onClick:()=>{const K=D.args.chartTitle,Z=D.args.connectionId;k({sql:D.args.sql,data:F.records,cardType:D.args.chartType,cardCfg:B,cardTitle:K,connectionId:Z})},variant:"secondary",size:"sm",className:"absolute right-3 top-3",children:"Add"}),B&&O.jsx(x1,{cfg:B})]})]})}}catch{I=O.jsx("span",{children:D.result})}return O.jsxs("div",{children:[O.jsx("span",{className:"font-semibold text-blue-700",children:"Tool call"})," ",`${D.toolName}: `,I]})}return`Calling ${D.toolName}...`}function k({sql:D,data:I,cardCfg:F,cardTitle:B,connectionId:K,cardType:Z}){if(!s)return;const z={id:la(),title:B||"Title",description:"Description",preferences:{onClickFilter:[{columnIndex:0,expression:""}],chartOptions:{indexAxis:Z==="horizontalBar"?"y":"x"}},type:F.type,cfg:F,sql:D,data:I,connectionId:K},Q={id:la(),cards:[z],activeCardId:z.id};c(!0),a(s,Q,"start"),l(Q.id)}return O.jsxs("div",{className:"flex h-full grow flex-col justify-between break-words rounded-md bg-muted/30 px-6 py-8",children:[O.jsxs("div",{className:"flex items-center gap-3",children:[O.jsx(Wn,{className:"flex items-center gap-2 text-xl",children:"Assistant"}),O.jsxs(H1,{openDelay:700,children:[O.jsx(W1,{children:O.jsx(tQ,{className:"size-4 text-muted-foreground"})}),O.jsx(Im,{className:"w-70",children:O.jsxs("div",{className:"flex justify-between space-x-2 text-muted-foreground",children:[O.jsx(px,{className:"size-5"}),O.jsxs("div",{className:"space-y-1",children:[O.jsx("p",{className:"text-sm",children:i&&(i==null?void 0:i.length)>0?"I can analyze following datasets":"No datasets in scope"}),O.jsx("div",{className:"space-y-2 pt-2",children:i==null?void 0:i.map((D,I)=>O.jsxs("div",{className:"flex gap-2 text-xs",children:[O.jsx(NA,{className:"size-4 opacity-70"}),O.jsx("span",{children:D.tableName})]},I))})]})]})})]}),!1]}),O.jsx(Um,{className:"my-4"}),O.jsx("div",{className:"",children:O.jsxs("form",{className:"mb-1 flex w-full grow items-center justify-between gap-2 rounded-md",onSubmit:b,children:[O.jsxs("div",{className:"flex w-full items-center justify-between rounded-md border bg-background",children:[O.jsx(xc,{className:"w-full border-none focus-visible:ring-0 focus-visible:ring-offset-0",value:g,disabled:_,placeholder:"What can I help you with?",onChange:v}),O.jsx("button",{className:"mr-3",children:O.jsx($A,{className:"size-4 text-muted-foreground/70 hover:text-muted-foreground"})})]}),_&&O.jsx(yr,{size:"sm",className:"rounded-full",onClick:()=>w(),children:O.jsx(MX,{className:"size-2.5 bg-background"})})]})}),O.jsxs(k_,{className:"flex flex-1 basis-0 flex-col flex-wrap justify-end",children:[O.jsxs("div",{className:"flex items-center text-xs text-foreground/90",children:[_&&t!==""&&O.jsx(wX,{className:"size-10 animate-pulse"}),t]}),O.jsx("div",{className:"flex flex-col-reverse gap-2 py-2",children:P(h)}),O.jsx(Zm,{orientation:"vertical"})]})]})}const yhe={li:({node:e,...t})=>O.jsx("li",{className:"my-2 ml-5 list-disc rounded-md bg-muted/50 px-2 py-1",...t}),pre:({node:e,...t})=>O.jsx("pre",{className:"word my-2 overflow-auto whitespace-pre-wrap break-words rounded-md bg-muted/50 p-2 text-xs text-foreground/80",...t})},{createElement:tu,createContext:xhe,createRef:xye,forwardRef:yN,useCallback:Yr,useContext:xN,useEffect:ul,useImperativeHandle:wN,useLayoutEffect:whe,useMemo:_he,useRef:Do,useState:Yg}=V,u2=V.useId,ov=xhe(null);ov.displayName="PanelGroupContext";const cf=whe,She=typeof u2=="function"?u2:()=>null;let Che=0;function Y_(e=null){const t=She(),n=Do(e||t||null);return n.current===null&&(n.current=""+Che++),e??n.current}function _N({children:e,className:t="",collapsedSize:n,collapsible:r,defaultSize:o,forwardedRef:i,id:s,maxSize:a,minSize:l,onCollapse:c,onExpand:u,onResize:f,order:h,style:g,tagName:v="div",...b}){const x=xN(ov);if(x===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:w,expandPanel:_,getPanelSize:S,getPanelStyle:R,groupId:C,isPanelCollapsed:P,registerPanel:A,resizePanel:k,unregisterPanel:D}=x,I=Y_(s),F=Do({callbacks:{onCollapse:c,onExpand:u,onResize:f},constraints:{collapsedSize:n,collapsible:r,defaultSize:o,maxSize:a,minSize:l},id:I,idIsFromProps:s!==void 0,order:h});Do({didLogMissingDefaultSizeWarning:!1}),cf(()=>{const{callbacks:K,constraints:Z}=F.current;F.current.id=I,F.current.idIsFromProps=s!==void 0,F.current.order=h,K.onCollapse=c,K.onExpand=u,K.onResize=f,Z.collapsedSize=n,Z.collapsible=r,Z.defaultSize=o,Z.maxSize=a,Z.minSize=l}),cf(()=>{const K=F.current;return A(K),()=>{D(K)}},[h,I,A,D]),wN(i,()=>({collapse:()=>{w(F.current)},expand:()=>{_(F.current)},getId(){return I},getSize(){return S(F.current)},isCollapsed(){return P(F.current)},isExpanded(){return!P(F.current)},resize:K=>{k(F.current,K)}}),[w,_,S,P,I,k]);const B=R(F.current,o);return tu(v,{...b,children:e,className:t,style:{...B,...g},"data-panel":"","data-panel-id":I,"data-panel-group-id":C,"data-panel-collapsible":void 0,"data-panel-size":void 0})}const SN=yN((e,t)=>tu(_N,{...e,forwardedRef:t}));_N.displayName="Panel";SN.displayName="forwardRef(Panel)";function vt(e,t="Assertion failed!"){if(!e)throw console.error(t),Error(t)}const CN=10;function uf(e,t,n=CN){e=parseFloat(e.toFixed(n)),t=parseFloat(t.toFixed(n));const r=e-t;return r===0?0:r>0?1:-1}function Zr(e,t,n){return uf(e,t,n)===0}function gc({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];vt(r!=null);let{collapsedSize:o=0,collapsible:i,maxSize:s=100,minSize:a=0}=r;if(uf(n,a)<0)if(i){const l=(o+a)/2;uf(n,l)<0?n=o:n=a}else n=a;return n=Math.min(s,n),n=parseFloat(n.toFixed(CN)),n}function ad({delta:e,layout:t,panelConstraints:n,pivotIndices:r,trigger:o}){if(Zr(e,0))return t;const i=[...t],[s,a]=r;vt(s!=null),vt(a!=null);let l=0;if(o==="keyboard"){{const u=e<0?a:s,f=n[u];if(vt(f),f.collapsible){const h=t[u];vt(h!=null);const g=n[u];vt(g);const{collapsedSize:v=0,minSize:b=0}=g;if(Zr(h,v)){const x=b-h;uf(x,Math.abs(e))>0&&(e=e<0?0-x:x)}}}{const u=e<0?s:a,f=n[u];vt(f);const{collapsible:h}=f;if(h){const g=t[u];vt(g!=null);const v=n[u];vt(v);const{collapsedSize:b=0,minSize:x=0}=v;if(Zr(g,x)){const w=g-b;uf(w,Math.abs(e))>0&&(e=e<0?0-w:w)}}}}{const u=e<0?1:-1;let f=e<0?a:s,h=0;for(;;){const v=t[f];vt(v!=null);const x=gc({panelConstraints:n,panelIndex:f,size:100})-v;if(h+=x,f+=u,f<0||f>=n.length)break}const g=Math.min(Math.abs(e),Math.abs(h));e=e<0?0-g:g}{let f=e<0?s:a;for(;f>=0&&f<n.length;){const h=Math.abs(e)-Math.abs(l),g=t[f];vt(g!=null);const v=g-h,b=gc({panelConstraints:n,panelIndex:f,size:v});if(!Zr(g,b)&&(l+=g-b,i[f]=b,l.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?f--:f++}}if(Zr(l,0))return t;{const u=e<0?a:s,f=t[u];vt(f!=null);const h=f+l,g=gc({panelConstraints:n,panelIndex:u,size:h});if(i[u]=g,!Zr(g,h)){let v=h-g,x=e<0?a:s;for(;x>=0&&x<n.length;){const w=i[x];vt(w!=null);const _=w+v,S=gc({panelConstraints:n,panelIndex:x,size:_});if(Zr(w,S)||(v-=S-w,i[x]=S),Zr(v,0))break;e>0?x--:x++}}}const c=i.reduce((u,f)=>f+u,0);return Zr(c,100)?i:t}function Ehe({layout:e,panelsArray:t,pivotIndices:n}){let r=0,o=100,i=0,s=0;const a=n[0];vt(a!=null),t.forEach((f,h)=>{const{constraints:g}=f,{maxSize:v=100,minSize:b=0}=g;h===a?(r=b,o=v):(i+=b,s+=v)});const l=Math.min(o,100-i),c=Math.max(r,100-s),u=e[a];return{valueMax:l,valueMin:c,valueNow:u}}function df(e){return Array.from(document.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function EN(e,t){const r=df(e).findIndex(o=>o.getAttribute("data-panel-resize-handle-id")===t);return r??null}function RN(e,t){const n=EN(e,t);return n!=null?[n,n+1]:[-1,-1]}function ON(e){const t=document.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return t||null}function iv(e){const t=document.querySelector(`[data-panel-resize-handle-id="${e}"]`);return t||null}function Rhe(e,t,n){var r,o,i,s;const a=iv(t),l=df(e),c=a?l.indexOf(a):-1,u=(r=(o=n[c])===null||o===void 0?void 0:o.id)!==null&&r!==void 0?r:null,f=(i=(s=n[c+1])===null||s===void 0?void 0:s.id)!==null&&i!==void 0?i:null;return[u,f]}function Ohe({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:r,panelDataArray:o,setLayout:i}){Do({didWarnAboutMissingResizeHandle:!1}),cf(()=>{const s=df(n);for(let a=0;a<o.length-1;a++){const{valueMax:l,valueMin:c,valueNow:u}=Ehe({layout:r,panelsArray:o,pivotIndices:[a,a+1]}),f=s[a];if(f!=null){const h=o[a];vt(h),f.setAttribute("aria-controls",h.id),f.setAttribute("aria-valuemax",""+Math.round(l)),f.setAttribute("aria-valuemin",""+Math.round(c)),f.setAttribute("aria-valuenow",u!=null?""+Math.round(u):"")}}return()=>{s.forEach((a,l)=>{a.removeAttribute("aria-controls"),a.removeAttribute("aria-valuemax"),a.removeAttribute("aria-valuemin"),a.removeAttribute("aria-valuenow")})}},[n,r,o]),ul(()=>{const s=t.current;vt(s);const{panelDataArray:a}=s,l=ON(n);vt(l!=null,`No group found for id "${n}"`);const c=df(n);vt(c);const u=c.map(f=>{const h=f.getAttribute("data-panel-resize-handle-id");vt(h);const[g,v]=Rhe(n,h,a);if(g==null||v==null)return()=>{};const b=x=>{if(!x.defaultPrevented)switch(x.key){case"Enter":{x.preventDefault();const w=a.findIndex(_=>_.id===g);if(w>=0){const _=a[w];vt(_);const S=r[w],{collapsedSize:R=0,collapsible:C,minSize:P=0}=_.constraints;if(S!=null&&C){const A=ad({delta:Zr(S,R)?P-R:R-S,layout:r,panelConstraints:a.map(k=>k.constraints),pivotIndices:RN(n,h),trigger:"keyboard"});r!==A&&i(A)}}break}}};return f.addEventListener("keydown",b),()=>{f.removeEventListener("keydown",b)}});return()=>{u.forEach(f=>f())}},[e,t,n,r,o,i])}function d2(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function PN(e){return e.type==="keydown"}function TN(e){return e.type.startsWith("mouse")}function DN(e){return e.type.startsWith("touch")}function $N(e,t){const n=e==="horizontal";if(TN(t))return n?t.clientX:t.clientY;if(DN(t)){const r=t.touches[0];return vt(r),n?r.screenX:r.screenY}else throw Error(`Unsupported event type "${t.type}"`)}function Phe(e,t,n,r){const o=n==="horizontal",i=iv(t);vt(i);const s=i.getAttribute("data-panel-group-id");vt(s);let{initialCursorPosition:a}=r;const l=$N(n,e),c=ON(s);vt(c);const u=c.getBoundingClientRect(),f=o?u.width:u.height;return(l-a)/f*100}function The(e,t,n,r,o){if(PN(e)){const i=n==="horizontal";let s=0;e.shiftKey?s=100:o!=null?s=o:s=10;let a=0;switch(e.key){case"ArrowDown":a=i?0:s;break;case"ArrowLeft":a=i?-s:0;break;case"ArrowRight":a=i?s:0;break;case"ArrowUp":a=i?0:-s;break;case"End":a=100;break;case"Home":a=-100;break}return a}else return r==null?0:Phe(e,t,n,r)}function Dhe({panelDataArray:e}){const t=Array(e.length),n=e.map(i=>i.constraints);let r=0,o=100;for(let i=0;i<e.length;i++){const s=n[i];vt(s);const{defaultSize:a}=s;a!=null&&(r++,t[i]=a,o-=a)}for(let i=0;i<e.length;i++){const s=n[i];vt(s);const{defaultSize:a}=s;if(a!=null)continue;const l=e.length-r,c=o/l;r++,t[i]=c,o-=c}return t}function sc(e,t,n){t.forEach((r,o)=>{const i=e[o];vt(i);const{callbacks:s,constraints:a,id:l}=i,{collapsedSize:c=0,collapsible:u}=a,f=n[l];if(f==null||r!==f){n[l]=r;const{onCollapse:h,onExpand:g,onResize:v}=s;v&&v(r,f),u&&(h||g)&&(g&&(f==null||f===c)&&r!==c&&g(),h&&(f==null||f!==c)&&r===c&&h())}})}function jp(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function $he({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:o,precision:i=3}){const s=n[o];let a;return s==null?a=e??"1":r.length===1?a="1":a=s.toPrecision(i),{flexBasis:0,flexGrow:a,flexShrink:1,overflow:"hidden",pointerEvents:t!==null?"none":void 0}}let rw=null,Ka=null;function AN(e){switch(e){case"horizontal":return"ew-resize";case"horizontal-max":return"w-resize";case"horizontal-min":return"e-resize";case"vertical":return"ns-resize";case"vertical-max":return"n-resize";case"vertical-min":return"s-resize"}}function Ahe(){Ka!==null&&(document.head.removeChild(Ka),rw=null,Ka=null)}function Jy(e){if(rw===e)return;rw=e;const t=AN(e);Ka===null&&(Ka=document.createElement("style"),document.head.appendChild(Ka)),Ka.innerHTML=`*{cursor: ${t}!important;}`}function khe(e,t=10){let n=null;return(...o)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...o)},t)}}function f2(e){try{if(typeof localStorage<"u")e.getItem=t=>localStorage.getItem(t),e.setItem=(t,n)=>{localStorage.setItem(t,n)};else throw new Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function kN(e){return`react-resizable-panels:${e}`}function MN(e){return e.map(t=>{const{constraints:n,id:r,idIsFromProps:o,order:i}=t;return o?r:i?`${i}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((t,n)=>t.localeCompare(n)).join(",")}function IN(e,t){try{const n=kN(e),r=t.getItem(n);if(r){const o=JSON.parse(r);if(typeof o=="object"&&o!=null)return o}}catch{}return null}function Mhe(e,t,n){var r,o;const i=(r=IN(e,n))!==null&&r!==void 0?r:{},s=MN(t);return(o=i[s])!==null&&o!==void 0?o:null}function Ihe(e,t,n,r,o){var i;const s=kN(e),a=MN(t),l=(i=IN(e,o))!==null&&i!==void 0?i:{};l[a]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{o.setItem(s,JSON.stringify(l))}catch(c){console.error(c)}}function h2({layout:e,panelConstraints:t}){const n=[...e],r=n.reduce((i,s)=>i+s,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(i=>`${i}%`).join(", ")}`);if(!Zr(r,100))for(let i=0;i<t.length;i++){const s=n[i];vt(s!=null);const a=100/r*s;n[i]=a}let o=0;for(let i=0;i<t.length;i++){const s=n[i];vt(s!=null);const a=gc({panelConstraints:t,panelIndex:i,size:s});s!=a&&(o+=s-a,n[i]=a)}if(!Zr(o,0))for(let i=0;i<t.length;i++){const s=n[i];vt(s!=null);const a=s+o,l=gc({panelConstraints:t,panelIndex:i,size:a});if(s!==l&&(o-=l-s,n[i]=l,Zr(o,0)))break}return n}const Nhe=100,ld={getItem:e=>(f2(ld),ld.getItem(e)),setItem:(e,t)=>{f2(ld),ld.setItem(e,t)}},p2={};function NN({autoSaveId:e=null,children:t,className:n="",direction:r,forwardedRef:o,id:i=null,onLayout:s=null,keyboardResizeBy:a=null,storage:l=ld,style:c,tagName:u="div",...f}){const h=Y_(i),[g,v]=Yg(null),[b,x]=Yg([]),w=Do({}),_=Do(new Map),S=Do(0),R=Do({autoSaveId:e,direction:r,dragState:g,id:h,keyboardResizeBy:a,onLayout:s,storage:l}),C=Do({layout:b,panelDataArray:[],panelDataArrayChanged:!1});Do({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),wN(o,()=>({getId:()=>R.current.id,getLayout:()=>{const{layout:$}=C.current;return $},setLayout:$=>{const{onLayout:H}=R.current,{layout:J,panelDataArray:N}=C.current,ce=h2({layout:$,panelConstraints:N.map(le=>le.constraints)});d2(J,ce)||(x(ce),C.current.layout=ce,H&&H(ce),sc(N,ce,w.current))}}),[]),cf(()=>{R.current.autoSaveId=e,R.current.direction=r,R.current.dragState=g,R.current.id=h,R.current.onLayout=s,R.current.storage=l}),Ohe({committedValuesRef:R,eagerValuesRef:C,groupId:h,layout:b,panelDataArray:C.current.panelDataArray,setLayout:x}),ul(()=>{const{panelDataArray:$}=C.current;if(e){if(b.length===0||b.length!==$.length)return;let H=p2[e];H==null&&(H=khe(Ihe,Nhe),p2[e]=H);const J=[...$],N=new Map(_.current);H(e,J,N,b,l)}},[e,b,l]),ul(()=>{});const P=Yr($=>{const{onLayout:H}=R.current,{layout:J,panelDataArray:N}=C.current;if($.constraints.collapsible){const ce=N.map(ie=>ie.constraints),{collapsedSize:le=0,panelSize:de,pivotIndices:pe}=ac(N,$,J);if(vt(de!=null),de!==le){_.current.set($.id,de);const te=fc(N,$)===N.length-1?de-le:le-de,ae=ad({delta:te,layout:J,panelConstraints:ce,pivotIndices:pe,trigger:"imperative-api"});jp(J,ae)||(x(ae),C.current.layout=ae,H&&H(ae),sc(N,ae,w.current))}}},[]),A=Yr($=>{const{onLayout:H}=R.current,{layout:J,panelDataArray:N}=C.current;if($.constraints.collapsible){const ce=N.map(te=>te.constraints),{collapsedSize:le=0,panelSize:de,minSize:pe=0,pivotIndices:ie}=ac(N,$,J);if(de===le){const te=_.current.get($.id),ae=te!=null&&te>=pe?te:pe,G=fc(N,$)===N.length-1?de-ae:ae-de,be=ad({delta:G,layout:J,panelConstraints:ce,pivotIndices:ie,trigger:"imperative-api"});jp(J,be)||(x(be),C.current.layout=be,H&&H(be),sc(N,be,w.current))}}},[]),k=Yr($=>{const{layout:H,panelDataArray:J}=C.current,{panelSize:N}=ac(J,$,H);return vt(N!=null),N},[]),D=Yr(($,H)=>{const{panelDataArray:J}=C.current,N=fc(J,$);return $he({defaultSize:H,dragState:g,layout:b,panelData:J,panelIndex:N})},[g,b]),I=Yr($=>{const{layout:H,panelDataArray:J}=C.current,{collapsedSize:N=0,collapsible:ce,panelSize:le}=ac(J,$,H);return ce===!0&&le===N},[]),F=Yr($=>{const{layout:H,panelDataArray:J}=C.current,{collapsedSize:N=0,collapsible:ce,panelSize:le}=ac(J,$,H);return vt(le!=null),!ce||le>N},[]),B=Yr($=>{const{panelDataArray:H}=C.current;H.push($),H.sort((J,N)=>{const ce=J.order,le=N.order;return ce==null&&le==null?0:ce==null?-1:le==null?1:ce-le}),C.current.panelDataArrayChanged=!0},[]);cf(()=>{if(C.current.panelDataArrayChanged){C.current.panelDataArrayChanged=!1;const{autoSaveId:$,onLayout:H,storage:J}=R.current,{layout:N,panelDataArray:ce}=C.current;let le=null;if($){const pe=Mhe($,ce,J);pe&&(_.current=new Map(Object.entries(pe.expandToSizes)),le=pe.layout)}le==null&&(le=Dhe({panelDataArray:ce}));const de=h2({layout:le,panelConstraints:ce.map(pe=>pe.constraints)});d2(N,de)||(x(de),C.current.layout=de,H&&H(de),sc(ce,de,w.current))}});const K=Yr($=>function(J){J.preventDefault();const{direction:N,dragState:ce,id:le,keyboardResizeBy:de,onLayout:pe}=R.current,{layout:ie,panelDataArray:te}=C.current,{initialLayout:ae}=ce??{},ye=RN(le,$);let G=The(J,$,N,ce,de);if(G===0)return;const be=N==="horizontal";document.dir==="rtl"&&be&&(G=-G);const _e=te.map(Ue=>Ue.constraints),Pe=ad({delta:G,layout:ae??ie,panelConstraints:_e,pivotIndices:ye,trigger:PN(J)?"keyboard":"mouse-or-touch"}),Te=!jp(ie,Pe);(TN(J)||DN(J))&&S.current!=G&&(S.current=G,Jy(Te?be?"horizontal":"vertical":be?G<0?"horizontal-min":"horizontal-max":G<0?"vertical-min":"vertical-max")),Te&&(x(Pe),C.current.layout=Pe,pe&&pe(Pe),sc(te,Pe,w.current))},[]),Z=Yr(($,H)=>{const{onLayout:J}=R.current,{layout:N,panelDataArray:ce}=C.current,le=ce.map(ye=>ye.constraints),{panelSize:de,pivotIndices:pe}=ac(ce,$,N);vt(de!=null);const te=fc(ce,$)===ce.length-1?de-H:H-de,ae=ad({delta:te,layout:N,panelConstraints:le,pivotIndices:pe,trigger:"imperative-api"});jp(N,ae)||(x(ae),C.current.layout=ae,J&&J(ae),sc(ce,ae,w.current))},[]),z=Yr(($,H)=>{const{direction:J}=R.current,{layout:N}=C.current,ce=iv($);vt(ce);const le=$N(J,H);v({dragHandleId:$,dragHandleRect:ce.getBoundingClientRect(),initialCursorPosition:le,initialLayout:N})},[]),Q=Yr(()=>{Ahe(),v(null)},[]),W=Yr($=>{const{panelDataArray:H}=C.current,J=fc(H,$);J>=0&&(H.splice(J,1),delete w.current[$.id],C.current.panelDataArrayChanged=!0)},[]),Y=_he(()=>({collapsePanel:P,direction:r,dragState:g,expandPanel:A,getPanelSize:k,getPanelStyle:D,groupId:h,isPanelCollapsed:I,isPanelExpanded:F,registerPanel:B,registerResizeHandle:K,resizePanel:Z,startDragging:z,stopDragging:Q,unregisterPanel:W}),[P,g,r,A,k,D,h,I,F,B,K,Z,z,Q,W]),oe={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return tu(ov.Provider,{value:Y},tu(u,{...f,children:t,className:n,style:{...oe,...c},"data-panel-group":"","data-panel-group-direction":r,"data-panel-group-id":h}))}const LN=yN((e,t)=>tu(NN,{...e,forwardedRef:t}));NN.displayName="PanelGroup";LN.displayName="forwardRef(PanelGroup)";function fc(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function ac(e,t,n){const r=e.map(c=>c.constraints),o=fc(e,t),i=r[o],a=o===e.length-1?[o-1,o]:[o,o+1],l=n[o];return{...i,panelSize:l,pivotIndices:a}}function Lhe({disabled:e,handleId:t,resizeHandler:n}){ul(()=>{if(e||n==null)return;const r=iv(t);if(r==null)return;const o=i=>{if(!i.defaultPrevented)switch(i.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{i.preventDefault(),n(i);break}case"F6":{i.preventDefault();const s=r.getAttribute("data-panel-group-id");vt(s);const a=df(s),l=EN(s,t);vt(l!==null);const c=i.shiftKey?l>0?l-1:a.length-1:l+1<a.length?l+1:0;a[c].focus();break}}};return r.addEventListener("keydown",o),()=>{r.removeEventListener("keydown",o)}},[e,t,n])}function K_({children:e=null,className:t="",disabled:n=!1,id:r,onDragging:o,style:i={},tabIndex:s=0,tagName:a="div",...l}){const c=Do(null),u=Do({onDragging:o});ul(()=>{u.current.onDragging=o});const f=xN(ov);if(f===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:h,dragState:g,groupId:v,registerResizeHandle:b,startDragging:x,stopDragging:w}=f,_=Y_(r),S=(g==null?void 0:g.dragHandleId)===_,[R,C]=Yg(!1),[P,A]=Yg(null),k=Yr(()=>{const I=c.current;vt(I),I.blur(),w();const{onDragging:F}=u.current;F&&F(!1)},[w]);ul(()=>{if(n)A(null);else{const I=b(_);A(()=>I)}},[n,_,b]),ul(()=>{if(n||P==null||!S)return;const I=Z=>{P(Z)},F=Z=>{P(Z)},B=c.current;vt(B);const K=B.ownerDocument;return K.body.addEventListener("contextmenu",k),K.body.addEventListener("mousemove",I),K.body.addEventListener("touchmove",I),K.body.addEventListener("mouseleave",F),window.addEventListener("mouseup",k),window.addEventListener("touchend",k),()=>{K.body.removeEventListener("contextmenu",k),K.body.removeEventListener("mousemove",I),K.body.removeEventListener("touchmove",I),K.body.removeEventListener("mouseleave",F),window.removeEventListener("mouseup",k),window.removeEventListener("touchend",k)}},[h,n,S,P,k]),Lhe({disabled:n,handleId:_,resizeHandler:P});const D={cursor:AN(h),touchAction:"none",userSelect:"none"};return tu(a,{...l,children:e,className:t,onBlur:()=>C(!1),onFocus:()=>C(!0),onMouseDown:I=>{x(_,I.nativeEvent);const F=u.current;vt(F);const{onDragging:B}=F;B&&B(!0)},onMouseUp:k,onTouchCancel:k,onTouchEnd:k,onTouchStart:I=>{x(_,I.nativeEvent);const F=u.current;vt(F);const{onDragging:B}=F;B&&B(!0)},ref:c,role:"separator",style:{...D,...i},tabIndex:s,"data-panel-group-direction":h,"data-panel-group-id":v,"data-resize-handle":"","data-resize-handle-active":S?"pointer":R?"keyboard":void 0,"data-panel-resize-handle-enabled":!n,"data-panel-resize-handle-id":_})}K_.displayName="PanelResizeHandle";const FN=({className:e,...t})=>O.jsx(LN,{className:Ce("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t}),ow=SN,Fhe=({withHandle:e,className:t,...n})=>O.jsx(K_,{className:Ce("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),...n,children:e&&O.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:O.jsx(JX,{className:"h-2.5 w-2.5"})})}),jhe=({withHandle:e,className:t,onTabClick:n,open:r,...o})=>O.jsx(K_,{className:Ce("relative flex w-px items-start justify-end bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",{"justify-start":r},t),...o,children:e&&O.jsx("div",{className:Ce("z-50 flex items-center justify-start",{"border-l":r}),children:O.jsx(yr,{variant:"secondary",className:Ce("h-7 p-1",{"rounded-bl-none rounded-br-md rounded-tl-none rounded-tr-md":r,"mt-2 rounded-bl-md rounded-br-none rounded-tl-md rounded-tr-none":!r}),onClick:()=>n(!r),children:r?O.jsx(S1,{className:"size-4"}):O.jsx(MA,{className:"size-4"})})})});function zhe(e,t=[]){let n=[];function r(i,s){const a=V.createContext(s),l=n.length;n=[...n,s];function c(f){const{scope:h,children:g,...v}=f,b=(h==null?void 0:h[e][l])||a,x=V.useMemo(()=>v,Object.values(v));return O.jsx(b.Provider,{value:x,children:g})}function u(f,h){const g=(h==null?void 0:h[e][l])||a,v=V.useContext(g);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return c.displayName=i+"Provider",[c,u]}const o=()=>{const i=n.map(s=>V.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return V.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,Bhe(o,...t)]}function Bhe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(i)[`__scope${c}`];return{...a,...f}},{});return V.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Vhe(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Hhe(...e){return t=>e.forEach(n=>Vhe(n,t))}function jN(...e){return V.useCallback(Hhe(...e),e)}function oa(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Whe(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Uhe(...e){return t=>e.forEach(n=>Whe(n,t))}function $l(...e){return V.useCallback(Uhe(...e),e)}function qhe(e,t){const n=V.createContext(t);function r(i){const{children:s,...a}=i,l=V.useMemo(()=>a,Object.values(a));return O.jsx(n.Provider,{value:l,children:s})}function o(i){const s=V.useContext(n);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return r.displayName=e+"Provider",[r,o]}function Ghe(e,t=[]){let n=[];function r(i,s){const a=V.createContext(s),l=n.length;n=[...n,s];function c(f){const{scope:h,children:g,...v}=f,b=(h==null?void 0:h[e][l])||a,x=V.useMemo(()=>v,Object.values(v));return O.jsx(b.Provider,{value:x,children:g})}function u(f,h){const g=(h==null?void 0:h[e][l])||a,v=V.useContext(g);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return c.displayName=i+"Provider",[c,u]}const o=()=>{const i=n.map(s=>V.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return V.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,Yhe(o,...t)]}function Yhe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(i)[`__scope${c}`];return{...a,...f}},{});return V.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var Kg=globalThis!=null&&globalThis.document?V.useLayoutEffect:()=>{},Khe=V.useId||(()=>{}),Xhe=0;function Zy(e){const[t,n]=V.useState(Khe());return Kg(()=>{e||n(r=>r??String(Xhe++))},[e]),e||(t?`radix-${t}`:"")}function xl(e){const t=V.useRef(e);return V.useEffect(()=>{t.current=e}),V.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function Qhe({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=Jhe({defaultProp:t,onChange:n}),i=e!==void 0,s=i?e:r,a=xl(n),l=V.useCallback(c=>{if(i){const f=typeof c=="function"?c(e):c;f!==e&&a(f)}else o(c)},[i,e,o,a]);return[s,l]}function Jhe({defaultProp:e,onChange:t}){const n=V.useState(e),[r]=n,o=V.useRef(r),i=xl(t);return V.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}var Zhe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],ps=Zhe.reduce((e,t)=>{const n=V.forwardRef((r,o)=>{const{asChild:i,...s}=r,a=i?Vm:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),O.jsx(a,{...s,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function epe(e,t){e&&dw.flushSync(()=>e.dispatchEvent(t))}function tpe(e,t=globalThis==null?void 0:globalThis.document){const n=xl(e);V.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var npe="DismissableLayer",iw="dismissableLayer.update",rpe="dismissableLayer.pointerDownOutside",ope="dismissableLayer.focusOutside",g2,zN=V.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),BN=V.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:a,...l}=e,c=V.useContext(zN),[u,f]=V.useState(null),h=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=V.useState({}),v=$l(t,A=>f(A)),b=Array.from(c.layers),[x]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),w=b.indexOf(x),_=u?b.indexOf(u):-1,S=c.layersWithOutsidePointerEventsDisabled.size>0,R=_>=w,C=ape(A=>{const k=A.target,D=[...c.branches].some(I=>I.contains(k));!R||D||(o==null||o(A),s==null||s(A),A.defaultPrevented||a==null||a())},h),P=lpe(A=>{const k=A.target;[...c.branches].some(I=>I.contains(k))||(i==null||i(A),s==null||s(A),A.defaultPrevented||a==null||a())},h);return tpe(A=>{_===c.layers.size-1&&(r==null||r(A),!A.defaultPrevented&&a&&(A.preventDefault(),a()))},h),V.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(g2=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),m2(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=g2)}},[u,h,n,c]),V.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),m2())},[u,c]),V.useEffect(()=>{const A=()=>g({});return document.addEventListener(iw,A),()=>document.removeEventListener(iw,A)},[]),O.jsx(ps.div,{...l,ref:v,style:{pointerEvents:S?R?"auto":"none":void 0,...e.style},onFocusCapture:oa(e.onFocusCapture,P.onFocusCapture),onBlurCapture:oa(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:oa(e.onPointerDownCapture,C.onPointerDownCapture)})});BN.displayName=npe;var ipe="DismissableLayerBranch",spe=V.forwardRef((e,t)=>{const n=V.useContext(zN),r=V.useRef(null),o=$l(t,r);return V.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),O.jsx(ps.div,{...e,ref:o})});spe.displayName=ipe;function ape(e,t=globalThis==null?void 0:globalThis.document){const n=xl(e),r=V.useRef(!1),o=V.useRef(()=>{});return V.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let l=function(){VN(rpe,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=l,t.addEventListener("click",o.current,{once:!0})):l()}else t.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function lpe(e,t=globalThis==null?void 0:globalThis.document){const n=xl(e),r=V.useRef(!1);return V.useEffect(()=>{const o=i=>{i.target&&!r.current&&VN(ope,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function m2(){const e=new CustomEvent(iw);document.dispatchEvent(e)}function VN(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?epe(o,i):o.dispatchEvent(i)}var e0="focusScope.autoFocusOnMount",t0="focusScope.autoFocusOnUnmount",v2={bubbles:!1,cancelable:!0},cpe="FocusScope",HN=V.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...s}=e,[a,l]=V.useState(null),c=xl(o),u=xl(i),f=V.useRef(null),h=$l(t,b=>l(b)),g=V.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;V.useEffect(()=>{if(r){let b=function(S){if(g.paused||!a)return;const R=S.target;a.contains(R)?f.current=R:js(f.current,{select:!0})},x=function(S){if(g.paused||!a)return;const R=S.relatedTarget;R!==null&&(a.contains(R)||js(f.current,{select:!0}))},w=function(S){if(document.activeElement===document.body)for(const C of S)C.removedNodes.length>0&&js(a)};document.addEventListener("focusin",b),document.addEventListener("focusout",x);const _=new MutationObserver(w);return a&&_.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",x),_.disconnect()}}},[r,a,g.paused]),V.useEffect(()=>{if(a){y2.add(g);const b=document.activeElement;if(!a.contains(b)){const w=new CustomEvent(e0,v2);a.addEventListener(e0,c),a.dispatchEvent(w),w.defaultPrevented||(upe(gpe(WN(a)),{select:!0}),document.activeElement===b&&js(a))}return()=>{a.removeEventListener(e0,c),setTimeout(()=>{const w=new CustomEvent(t0,v2);a.addEventListener(t0,u),a.dispatchEvent(w),w.defaultPrevented||js(b??document.body,{select:!0}),a.removeEventListener(t0,u),y2.remove(g)},0)}}},[a,c,u,g]);const v=V.useCallback(b=>{if(!n&&!r||g.paused)return;const x=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,w=document.activeElement;if(x&&w){const _=b.currentTarget,[S,R]=dpe(_);S&&R?!b.shiftKey&&w===R?(b.preventDefault(),n&&js(S,{select:!0})):b.shiftKey&&w===S&&(b.preventDefault(),n&&js(R,{select:!0})):w===_&&b.preventDefault()}},[n,r,g.paused]);return O.jsx(ps.div,{tabIndex:-1,...s,ref:h,onKeyDown:v})});HN.displayName=cpe;function upe(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(js(r,{select:t}),document.activeElement!==n)return}function dpe(e){const t=WN(e),n=b2(t,e),r=b2(t.reverse(),e);return[n,r]}function WN(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function b2(e,t){for(const n of e)if(!fpe(n,{upTo:t}))return n}function fpe(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function hpe(e){return e instanceof HTMLInputElement&&"select"in e}function js(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&hpe(e)&&t&&e.select()}}var y2=ppe();function ppe(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=x2(e,t),e.unshift(t)},remove(t){var n;e=x2(e,t),(n=e[0])==null||n.resume()}}}function x2(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function gpe(e){return e.filter(t=>t.tagName!=="A")}var mpe="Portal",UN=V.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,i]=V.useState(!1);Kg(()=>i(!0),[]);const s=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return s?ko.createPortal(O.jsx(ps.div,{...r,ref:t}),s):null});UN.displayName=mpe;function vpe(e,t){return V.useReducer((n,r)=>t[n][r]??n,e)}var sv=e=>{const{present:t,children:n}=e,r=bpe(t),o=typeof n=="function"?n({present:r.isPresent}):V.Children.only(n),i=$l(r.ref,ype(o));return typeof n=="function"||r.isPresent?V.cloneElement(o,{ref:i}):null};sv.displayName="Presence";function bpe(e){const[t,n]=V.useState(),r=V.useRef({}),o=V.useRef(e),i=V.useRef("none"),s=e?"mounted":"unmounted",[a,l]=vpe(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return V.useEffect(()=>{const c=zp(r.current);i.current=a==="mounted"?c:"none"},[a]),Kg(()=>{const c=r.current,u=o.current;if(u!==e){const h=i.current,g=zp(c);e?l("MOUNT"):g==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&h!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),Kg(()=>{if(t){const c=f=>{const g=zp(r.current).includes(f.animationName);f.target===t&&g&&dw.flushSync(()=>l("ANIMATION_END"))},u=f=>{f.target===t&&(i.current=zp(r.current))};return t.addEventListener("animationstart",u),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{t.removeEventListener("animationstart",u),t.removeEventListener("animationcancel",c),t.removeEventListener("animationend",c)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:V.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function zp(e){return(e==null?void 0:e.animationName)||"none"}function ype(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var n0=0;function xpe(){V.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??w2()),document.body.insertAdjacentElement("beforeend",e[1]??w2()),n0++,()=>{n0===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),n0--}},[])}function w2(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}var qN=Mk(),r0=function(){},av=V.forwardRef(function(e,t){var n=V.useRef(null),r=V.useState({onScrollCapture:r0,onWheelCapture:r0,onTouchMoveCapture:r0}),o=r[0],i=r[1],s=e.forwardProps,a=e.children,l=e.className,c=e.removeScrollBar,u=e.enabled,f=e.shards,h=e.sideCar,g=e.noIsolation,v=e.inert,b=e.allowPinchZoom,x=e.as,w=x===void 0?"div":x,_=e.gapMode,S=e_(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),R=h,C=kk([n,t]),P=lr(lr({},S),o);return V.createElement(V.Fragment,null,u&&V.createElement(R,{sideCar:qN,removeScrollBar:c,shards:f,noIsolation:g,inert:v,setCallbacks:i,allowPinchZoom:!!b,lockRef:n,gapMode:_}),s?V.cloneElement(V.Children.only(a),lr(lr({},P),{ref:C})):V.createElement(w,lr({},P,{className:l,ref:C}),a))});av.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};av.classNames={fullWidth:wd,zeroRight:xd};var sw=!1;if(typeof window<"u")try{var Bp=Object.defineProperty({},"passive",{get:function(){return sw=!0,!0}});window.addEventListener("test",Bp,Bp),window.removeEventListener("test",Bp,Bp)}catch{sw=!1}var lc=sw?{passive:!1}:!1,wpe=function(e){return e.tagName==="TEXTAREA"},GN=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!wpe(e)&&n[t]==="visible")},_pe=function(e){return GN(e,"overflowY")},Spe=function(e){return GN(e,"overflowX")},_2=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=YN(e,r);if(o){var i=KN(e,r),s=i[1],a=i[2];if(s>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Cpe=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Epe=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},YN=function(e,t){return e==="v"?_pe(t):Spe(t)},KN=function(e,t){return e==="v"?Cpe(t):Epe(t)},Rpe=function(e,t){return e==="h"&&t==="rtl"?-1:1},Ope=function(e,t,n,r,o){var i=Rpe(e,window.getComputedStyle(t).direction),s=i*r,a=n.target,l=t.contains(a),c=!1,u=s>0,f=0,h=0;do{var g=KN(e,a),v=g[0],b=g[1],x=g[2],w=b-x-i*v;(v||w)&&YN(e,a)&&(f+=w,h+=v),a instanceof ShadowRoot?a=a.host:a=a.parentNode}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(u&&(o&&Math.abs(f)<1||!o&&s>f)||!u&&(o&&Math.abs(h)<1||!o&&-s>h))&&(c=!0),c},Vp=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},S2=function(e){return[e.deltaX,e.deltaY]},C2=function(e){return e&&"current"in e?e.current:e},Ppe=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Tpe=function(e){return`
412
+ `},o),i}function Gfe(e,t){return e&&"run"in e?async function(n,r){const o=QT(n,{file:r,...t});await e.run(o,r)}:function(n,r){return QT(n,{file:r,...t||e})}}function JT(e){if(e)throw e}var cg=Object.prototype.hasOwnProperty,mN=Object.prototype.toString,ZT=Object.defineProperty,e2=Object.getOwnPropertyDescriptor,t2=function(t){return typeof Array.isArray=="function"?Array.isArray(t):mN.call(t)==="[object Array]"},n2=function(t){if(!t||mN.call(t)!=="[object Object]")return!1;var n=cg.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&cg.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var o;for(o in t);return typeof o>"u"||cg.call(t,o)},r2=function(t,n){ZT&&n.name==="__proto__"?ZT(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},o2=function(t,n){if(n==="__proto__")if(cg.call(t,n)){if(e2)return e2(t,n).value}else return;return t[n]},Yfe=function e(){var t,n,r,o,i,s,a=arguments[0],l=1,c=arguments.length,u=!1;for(typeof a=="boolean"&&(u=a,a=arguments[1]||{},l=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});l<c;++l)if(t=arguments[l],t!=null)for(n in t)r=o2(a,n),o=o2(t,n),a!==o&&(u&&o&&(n2(o)||(i=t2(o)))?(i?(i=!1,s=r&&t2(r)?r:[]):s=r&&n2(r)?r:{},r2(a,{name:n,newValue:e(u,s,o)})):typeof o<"u"&&r2(a,{name:n,newValue:o}));return a};const Uy=nu(Yfe);function tw(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Kfe(){const e=[],t={run:n,use:r};return t;function n(...o){let i=-1;const s=o.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);a(null,...o);function a(l,...c){const u=e[++i];let f=-1;if(l){s(l);return}for(;++f<o.length;)(c[f]===null||c[f]===void 0)&&(c[f]=o[f]);o=c,u?Xfe(u,a)(...c):s(null,...c)}}function r(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function Xfe(e,t){let n;return r;function r(...s){const a=e.length>s.length;let l;a&&s.push(o);try{l=e.apply(this,s)}catch(c){const u=c;if(a&&n)throw u;return o(u)}a||(l instanceof Promise?l.then(i,o):l instanceof Error?o(l):i(l))}function o(s,...a){n||(n=!0,t(s,...a))}function i(s){o(null,s)}}const di={basename:Qfe,dirname:Jfe,extname:Zfe,join:ehe,sep:"/"};function Qfe(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Zf(e);let n=0,r=-1,o=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(i){n=o+1;break}}else r<0&&(i=!0,r=o+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let s=-1,a=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(i){n=o+1;break}}else s<0&&(i=!0,s=o+1),a>-1&&(e.codePointAt(o)===t.codePointAt(a--)?a<0&&(r=o):(a=-1,r=s));return n===r?r=s:r<0&&(r=e.length),e.slice(n,r)}function Jfe(e){if(Zf(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Zfe(e){Zf(e);let t=e.length,n=-1,r=0,o=-1,i=0,s;for(;t--;){const a=e.codePointAt(t);if(a===47){if(s){r=t+1;break}continue}n<0&&(s=!0,n=t+1),a===46?o<0?o=t:i!==1&&(i=1):o>-1&&(i=-1)}return o<0||n<0||i===0||i===1&&o===n-1&&o===r+1?"":e.slice(o,n)}function ehe(...e){let t=-1,n;for(;++t<e.length;)Zf(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":the(n)}function the(e){Zf(e);const t=e.codePointAt(0)===47;let n=nhe(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function nhe(e,t){let n="",r=0,o=-1,i=0,s=-1,a,l;for(;++s<=e.length;){if(s<e.length)a=e.codePointAt(s);else{if(a===47)break;a=47}if(a===47){if(!(o===s-1||i===1))if(o!==s-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),o=s,i=0;continue}}else if(n.length>0){n="",r=0,o=s,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(o+1,s):n=e.slice(o+1,s),r=s-o-1;o=s,i=0}else a===46&&i>-1?i++:i=-1}return n}function Zf(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const rhe={cwd:ohe};function ohe(){return"/"}function nw(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function ihe(e){if(typeof e=="string")e=new URL(e);else if(!nw(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return she(e)}function she(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(t)}const qy=["history","path","basename","stem","extname","dirname"];class vN{constructor(t){let n;t?nw(t)?n={path:t}:typeof t=="string"||ahe(t)?n={value:t}:n=t:n={},this.cwd=rhe.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<qy.length;){const i=qy[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let o;for(o in n)qy.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?di.basename(this.path):void 0}set basename(t){Yy(t,"basename"),Gy(t,"basename"),this.path=di.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?di.dirname(this.path):void 0}set dirname(t){i2(this.basename,"dirname"),this.path=di.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?di.extname(this.path):void 0}set extname(t){if(Gy(t,"extname"),i2(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=di.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){nw(t)&&(t=ihe(t)),Yy(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?di.basename(this.path,this.extname):void 0}set stem(t){Yy(t,"stem"),Gy(t,"stem"),this.path=di.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const o=this.message(t,n,r);throw o.fatal=!0,o}info(t,n,r){const o=this.message(t,n,r);return o.fatal=void 0,o}message(t,n,r){const o=new dr(t,n,r);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Gy(e,t){if(e&&e.includes(di.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+di.sep+"`")}function Yy(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function i2(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function ahe(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const lhe=function(e){const r=this.constructor.prototype,o=r[e],i=function(){return o.apply(i,arguments)};Object.setPrototypeOf(i,r);const s=Object.getOwnPropertyNames(o);for(const a of s){const l=Object.getOwnPropertyDescriptor(o,a);l&&Object.defineProperty(i,a,l)}return i},che={}.hasOwnProperty;class G_ extends lhe{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Kfe()}copy(){const t=new G_;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Uy(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Qy("data",this.frozen),this.namespace[t]=n,this):che.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Qy("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const o=n.call(t,...r);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Fp(t),r=this.parser||this.Parser;return Ky("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Ky("process",this.parser||this.Parser),Xy("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(i,s){const a=Fp(t),l=r.parse(a);r.run(l,a,function(u,f,h){if(u||!f||!h)return c(u);const g=f,v=r.stringify(g,h);fhe(v)?h.value=v:h.result=v,c(u,h)});function c(u,f){u||!f?s(u):i?i(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),Ky("processSync",this.parser||this.Parser),Xy("processSync",this.compiler||this.Compiler),this.process(t,o),a2("processSync","process",n),r;function o(i,s){n=!0,JT(i),r=s}}run(t,n,r){s2(t),this.freeze();const o=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(s,a){const l=Fp(n);o.run(t,l,c);function c(u,f,h){const g=f||t;u?a(u):s?s(g):r(void 0,g,h)}}}runSync(t,n){let r=!1,o;return this.run(t,n,i),a2("runSync","run",r),o;function i(s,a){JT(s),o=a,r=!0}}stringify(t,n){this.freeze();const r=Fp(n),o=this.compiler||this.Compiler;return Xy("stringify",o),s2(t),o(t,r)}use(t,...n){const r=this.attachers,o=this.namespace;if(Qy("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?a(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[u,...f]=c;l(u,f)}else s(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function s(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(c.plugins),c.settings&&(o.settings=Uy(!0,o.settings,c.settings))}function a(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){const f=c[u];i(f)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let f=-1,h=-1;for(;++f<r.length;)if(r[f][0]===c){h=f;break}if(h===-1)r.push([c,...u]);else if(u.length>0){let[g,...v]=u;const b=r[h][1];tw(b)&&tw(g)&&(g=Uy(!0,b,g)),r[h]=[c,g,...v]}}}}const uhe=new G_().freeze();function Ky(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Xy(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Qy(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function s2(e){if(!tw(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function a2(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Fp(e){return dhe(e)?e:new vN(e)}function dhe(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function fhe(e){return typeof e=="string"||hhe(e)}function hhe(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const phe="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",l2=[],c2={allowDangerousHtml:!0},ghe=/^(https?|ircs?|mailto|xmpp)$/i,mhe=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function bN(e){const t=e.allowedElements,n=e.allowElement,r=e.children||"",o=e.className,i=e.components,s=e.disallowedElements,a=e.rehypePlugins||l2,l=e.remarkPlugins||l2,c=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...c2}:c2,u=e.skipHtml,f=e.unwrapDisallowed,h=e.urlTransform||vhe,g=uhe().use(Jde).use(l).use(Gfe,c).use(a),v=new vN;typeof r=="string"&&(v.value=r);for(const _ of mhe)Object.hasOwn(e,_.from)&&(""+_.from+(_.to?"use `"+_.to+"` instead":"remove it")+phe+_.id,void 0);const b=g.parse(v);let x=g.runSync(b,v);return o&&(x={type:"element",tagName:"div",properties:{className:o},children:x.type==="root"?x.children:[x]}),gN(x,w),$ce(x,{Fragment:O.Fragment,components:i,ignoreInvalidStyle:!0,jsx:O.jsx,jsxs:O.jsxs,passKeys:!0,passNode:!0});function w(_,S,R){if(_.type==="raw"&&R&&typeof S=="number")return u?R.children.splice(S,1):R.children[S]={type:"text",value:_.value},S;if(_.type==="element"){let C;for(C in Vy)if(Object.hasOwn(Vy,C)&&Object.hasOwn(_.properties,C)){const P=_.properties[C],A=Vy[C];(A===null||A.includes(_.tagName))&&(_.properties[C]=h(String(P||""),C,_))}}if(_.type==="element"){let C=t?!t.includes(_.tagName):s?s.includes(_.tagName):!1;if(!C&&n&&typeof S=="number"&&(C=!n(_,S,R)),C&&R&&typeof S=="number")return f&&_.children?R.children.splice(S,1,..._.children):R.children.splice(S,1),S}}}function vhe(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),o=e.indexOf("/");return t<0||o>-1&&t>o||n>-1&&t>n||r>-1&&t>r||ghe.test(e.slice(0,t))?e:""}function bhe(){const e=m.useRef(null),[t,n]=m.useState(""),[r,o]=m.useState(!1),i=ke(D=>D.dashboard.aiScopeTables);Om();const s=ke(D=>D.selectedSheetId),{addFrame:a,setSelectedFrameId:l,setIsDashboardEditing:c}=Mo(),{authToken:u}=ma(),f=bD(),{messages:h,input:g,handleInputChange:v,handleSubmit:b,addToolResult:x,stop:w,isLoading:_}=yle({api:"https://semaphor.cloud/api/v1/chat",headers:{Authorization:`Bearer ${u==null?void 0:u.accessToken}`},maxToolRoundtrips:5,async onToolCall({toolCall:D}){if(R(D.toolName),D.toolName==="getLocation"){const I=["New York","Los Angeles","Chicago","San Francisco"];return I[Math.floor(Math.random()*I.length)]}if(D.toolName==="getTables")return JSON.stringify(i||[]);if(D.toolName==="getData"){console.log(D.args);const I=D.args;if(!(I!=null&&I.sql)||!(I!=null&&I.connectionId))return"Please provide sql, connectionId and table";const F=await f.fetchQuery({queryKey:["chat",I.connectionId,I.sql],queryFn:()=>Of("https://semaphor.cloud/api/v1/query",(u==null?void 0:u.accessToken)||(u==null?void 0:u.accessToken)||"",{connection_id:I.connectionId,sql:I.sql})});return n("Summarizing"),JSON.stringify(F)}},onFinish(D,I){console.log("onFinish",D,I),D.content&&n("")}}),S=()=>{var D;(D=e.current)==null||D.scrollIntoView({behavior:"smooth"})};m.useEffect(()=>{S()},[h]);function R(D){D==="getTables"&&n("Initializing"),D==="getSchemas"&&n("Analyzing"),D==="getData"&&n("Fetching")}function C(D){const I=D.toolInvocations||[];return I.length===0||I.find(B=>B.toolName==="getData"&&"result"in B)?!0:r}function P(D){return D==null?void 0:D.map(I=>{var B;const F=I.role==="user";return C(I)?O.jsxs("div",{className:Ce("relative rounded-md bg-background px-4 py-4 text-sm text-foreground/80",{"bg-muted":F}),children:[O.jsx("div",{className:"space-y-2",children:O.jsxs("div",{className:"flex shrink-0 items-start gap-3",children:[O.jsx("div",{className:"text-muted-foreground",children:F?O.jsx(rQ,{className:"size-5 shrink-0"}):O.jsx(px,{className:"size-5 shrink-0"})}),O.jsx("div",{children:O.jsx(bN,{components:yhe,children:I.content})})]})}),(B=I.toolInvocations)==null?void 0:B.map(K=>{const Z=K.toolCallId;return"result"in K?O.jsx("div",{children:A(K)},Z):O.jsxs("div",{children:["Calling ",K.toolName,"..."]},Z)})]},I.id):null})}function A(D){if("result"in D){let I;try{const F=JSON.parse(D.result);if(I=O.jsx("pre",{className:"whitespace-normal text-xs",children:JSON.stringify(F,null,2)}),D.toolName==="getData"){const B=j1({cardType:D.args.chartType,data:F.records});return O.jsxs("div",{className:"space-y-2",children:[r&&O.jsxs("div",{children:[O.jsx("span",{className:"font-semibold text-blue-700",children:"Tool call"})," ",`${D.toolName}: `,I]}),O.jsxs("div",{className:"flex h-[350px] w-[99%] grow flex-col py-2",children:[O.jsx(yr,{onClick:()=>{const K=D.args.chartTitle,Z=D.args.connectionId;k({sql:D.args.sql,data:F.records,cardType:D.args.chartType,cardCfg:B,cardTitle:K,connectionId:Z})},variant:"secondary",size:"sm",className:"absolute right-3 top-3",children:"Add"}),B&&O.jsx(x1,{cfg:B})]})]})}}catch{I=O.jsx("span",{children:D.result})}return O.jsxs("div",{children:[O.jsx("span",{className:"font-semibold text-blue-700",children:"Tool call"})," ",`${D.toolName}: `,I]})}return`Calling ${D.toolName}...`}function k({sql:D,data:I,cardCfg:F,cardTitle:B,connectionId:K,cardType:Z}){if(!s)return;const z={id:la(),title:B||"Title",description:"Description",preferences:{onClickFilter:[{columnIndex:0,expression:""}],chartOptions:{indexAxis:Z==="horizontalBar"?"y":"x"}},type:F.type,cfg:F,sql:D,data:I,connectionId:K},Q={id:la(),cards:[z],activeCardId:z.id};c(!0),a(s,Q,"start"),l(Q.id)}return O.jsxs("div",{role:"chat-box",className:"flex h-full grow flex-col justify-between break-words rounded-md bg-muted/30 px-6 py-8",children:[O.jsxs("div",{className:"flex items-center gap-3",children:[O.jsx(Wn,{className:"flex items-center gap-2 text-xl",children:"Assistant"}),O.jsxs(H1,{openDelay:700,children:[O.jsx(W1,{children:O.jsx(tQ,{className:"size-4 text-muted-foreground"})}),O.jsx(Im,{className:"w-70",children:O.jsxs("div",{className:"flex justify-between space-x-2 text-muted-foreground",children:[O.jsx(px,{className:"size-5"}),O.jsxs("div",{className:"space-y-1",children:[O.jsx("p",{className:"text-sm",children:i&&(i==null?void 0:i.length)>0?"I can analyze following datasets":"No datasets in scope"}),O.jsx("div",{className:"space-y-2 pt-2",children:i==null?void 0:i.map((D,I)=>O.jsxs("div",{className:"flex gap-2 text-xs",children:[O.jsx(NA,{className:"size-4 opacity-70"}),O.jsx("span",{children:D.tableName})]},I))})]})]})})]}),!1]}),O.jsx(Um,{className:"my-4"}),O.jsx("div",{className:"",children:O.jsxs("form",{className:"mb-1 flex w-full grow items-center justify-between gap-2 rounded-md",onSubmit:b,children:[O.jsxs("div",{className:"flex w-full items-center justify-between rounded-md border bg-background",children:[O.jsx(xc,{className:"w-full border-none focus-visible:ring-0 focus-visible:ring-offset-0",value:g,disabled:_,placeholder:"What can I help you with?",onChange:v}),O.jsx("button",{className:"mr-3",children:O.jsx($A,{className:"size-4 text-muted-foreground/70 hover:text-muted-foreground"})})]}),_&&O.jsx(yr,{size:"sm",className:"rounded-full",onClick:()=>w(),children:O.jsx(MX,{className:"size-2.5 bg-background"})})]})}),O.jsxs(k_,{className:"flex flex-1 basis-0 flex-col flex-wrap justify-end",children:[O.jsxs("div",{className:"flex items-center text-xs text-foreground/90",children:[_&&t!==""&&O.jsx(wX,{className:"size-10 animate-pulse"}),t]}),O.jsx("div",{className:"flex flex-col-reverse gap-2 py-2",children:P(h)}),O.jsx(Zm,{orientation:"vertical"})]})]})}const yhe={li:({node:e,...t})=>O.jsx("li",{className:"my-2 ml-5 list-disc rounded-md bg-muted/50 px-2 py-1",...t}),pre:({node:e,...t})=>O.jsx("pre",{className:"word my-2 overflow-auto whitespace-pre-wrap break-words rounded-md bg-muted/50 p-2 text-xs text-foreground/80",...t})},{createElement:tu,createContext:xhe,createRef:xye,forwardRef:yN,useCallback:Yr,useContext:xN,useEffect:ul,useImperativeHandle:wN,useLayoutEffect:whe,useMemo:_he,useRef:Do,useState:Yg}=V,u2=V.useId,ov=xhe(null);ov.displayName="PanelGroupContext";const cf=whe,She=typeof u2=="function"?u2:()=>null;let Che=0;function Y_(e=null){const t=She(),n=Do(e||t||null);return n.current===null&&(n.current=""+Che++),e??n.current}function _N({children:e,className:t="",collapsedSize:n,collapsible:r,defaultSize:o,forwardedRef:i,id:s,maxSize:a,minSize:l,onCollapse:c,onExpand:u,onResize:f,order:h,style:g,tagName:v="div",...b}){const x=xN(ov);if(x===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:w,expandPanel:_,getPanelSize:S,getPanelStyle:R,groupId:C,isPanelCollapsed:P,registerPanel:A,resizePanel:k,unregisterPanel:D}=x,I=Y_(s),F=Do({callbacks:{onCollapse:c,onExpand:u,onResize:f},constraints:{collapsedSize:n,collapsible:r,defaultSize:o,maxSize:a,minSize:l},id:I,idIsFromProps:s!==void 0,order:h});Do({didLogMissingDefaultSizeWarning:!1}),cf(()=>{const{callbacks:K,constraints:Z}=F.current;F.current.id=I,F.current.idIsFromProps=s!==void 0,F.current.order=h,K.onCollapse=c,K.onExpand=u,K.onResize=f,Z.collapsedSize=n,Z.collapsible=r,Z.defaultSize=o,Z.maxSize=a,Z.minSize=l}),cf(()=>{const K=F.current;return A(K),()=>{D(K)}},[h,I,A,D]),wN(i,()=>({collapse:()=>{w(F.current)},expand:()=>{_(F.current)},getId(){return I},getSize(){return S(F.current)},isCollapsed(){return P(F.current)},isExpanded(){return!P(F.current)},resize:K=>{k(F.current,K)}}),[w,_,S,P,I,k]);const B=R(F.current,o);return tu(v,{...b,children:e,className:t,style:{...B,...g},"data-panel":"","data-panel-id":I,"data-panel-group-id":C,"data-panel-collapsible":void 0,"data-panel-size":void 0})}const SN=yN((e,t)=>tu(_N,{...e,forwardedRef:t}));_N.displayName="Panel";SN.displayName="forwardRef(Panel)";function vt(e,t="Assertion failed!"){if(!e)throw console.error(t),Error(t)}const CN=10;function uf(e,t,n=CN){e=parseFloat(e.toFixed(n)),t=parseFloat(t.toFixed(n));const r=e-t;return r===0?0:r>0?1:-1}function Zr(e,t,n){return uf(e,t,n)===0}function gc({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];vt(r!=null);let{collapsedSize:o=0,collapsible:i,maxSize:s=100,minSize:a=0}=r;if(uf(n,a)<0)if(i){const l=(o+a)/2;uf(n,l)<0?n=o:n=a}else n=a;return n=Math.min(s,n),n=parseFloat(n.toFixed(CN)),n}function ad({delta:e,layout:t,panelConstraints:n,pivotIndices:r,trigger:o}){if(Zr(e,0))return t;const i=[...t],[s,a]=r;vt(s!=null),vt(a!=null);let l=0;if(o==="keyboard"){{const u=e<0?a:s,f=n[u];if(vt(f),f.collapsible){const h=t[u];vt(h!=null);const g=n[u];vt(g);const{collapsedSize:v=0,minSize:b=0}=g;if(Zr(h,v)){const x=b-h;uf(x,Math.abs(e))>0&&(e=e<0?0-x:x)}}}{const u=e<0?s:a,f=n[u];vt(f);const{collapsible:h}=f;if(h){const g=t[u];vt(g!=null);const v=n[u];vt(v);const{collapsedSize:b=0,minSize:x=0}=v;if(Zr(g,x)){const w=g-b;uf(w,Math.abs(e))>0&&(e=e<0?0-w:w)}}}}{const u=e<0?1:-1;let f=e<0?a:s,h=0;for(;;){const v=t[f];vt(v!=null);const x=gc({panelConstraints:n,panelIndex:f,size:100})-v;if(h+=x,f+=u,f<0||f>=n.length)break}const g=Math.min(Math.abs(e),Math.abs(h));e=e<0?0-g:g}{let f=e<0?s:a;for(;f>=0&&f<n.length;){const h=Math.abs(e)-Math.abs(l),g=t[f];vt(g!=null);const v=g-h,b=gc({panelConstraints:n,panelIndex:f,size:v});if(!Zr(g,b)&&(l+=g-b,i[f]=b,l.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?f--:f++}}if(Zr(l,0))return t;{const u=e<0?a:s,f=t[u];vt(f!=null);const h=f+l,g=gc({panelConstraints:n,panelIndex:u,size:h});if(i[u]=g,!Zr(g,h)){let v=h-g,x=e<0?a:s;for(;x>=0&&x<n.length;){const w=i[x];vt(w!=null);const _=w+v,S=gc({panelConstraints:n,panelIndex:x,size:_});if(Zr(w,S)||(v-=S-w,i[x]=S),Zr(v,0))break;e>0?x--:x++}}}const c=i.reduce((u,f)=>f+u,0);return Zr(c,100)?i:t}function Ehe({layout:e,panelsArray:t,pivotIndices:n}){let r=0,o=100,i=0,s=0;const a=n[0];vt(a!=null),t.forEach((f,h)=>{const{constraints:g}=f,{maxSize:v=100,minSize:b=0}=g;h===a?(r=b,o=v):(i+=b,s+=v)});const l=Math.min(o,100-i),c=Math.max(r,100-s),u=e[a];return{valueMax:l,valueMin:c,valueNow:u}}function df(e){return Array.from(document.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function EN(e,t){const r=df(e).findIndex(o=>o.getAttribute("data-panel-resize-handle-id")===t);return r??null}function RN(e,t){const n=EN(e,t);return n!=null?[n,n+1]:[-1,-1]}function ON(e){const t=document.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return t||null}function iv(e){const t=document.querySelector(`[data-panel-resize-handle-id="${e}"]`);return t||null}function Rhe(e,t,n){var r,o,i,s;const a=iv(t),l=df(e),c=a?l.indexOf(a):-1,u=(r=(o=n[c])===null||o===void 0?void 0:o.id)!==null&&r!==void 0?r:null,f=(i=(s=n[c+1])===null||s===void 0?void 0:s.id)!==null&&i!==void 0?i:null;return[u,f]}function Ohe({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:r,panelDataArray:o,setLayout:i}){Do({didWarnAboutMissingResizeHandle:!1}),cf(()=>{const s=df(n);for(let a=0;a<o.length-1;a++){const{valueMax:l,valueMin:c,valueNow:u}=Ehe({layout:r,panelsArray:o,pivotIndices:[a,a+1]}),f=s[a];if(f!=null){const h=o[a];vt(h),f.setAttribute("aria-controls",h.id),f.setAttribute("aria-valuemax",""+Math.round(l)),f.setAttribute("aria-valuemin",""+Math.round(c)),f.setAttribute("aria-valuenow",u!=null?""+Math.round(u):"")}}return()=>{s.forEach((a,l)=>{a.removeAttribute("aria-controls"),a.removeAttribute("aria-valuemax"),a.removeAttribute("aria-valuemin"),a.removeAttribute("aria-valuenow")})}},[n,r,o]),ul(()=>{const s=t.current;vt(s);const{panelDataArray:a}=s,l=ON(n);vt(l!=null,`No group found for id "${n}"`);const c=df(n);vt(c);const u=c.map(f=>{const h=f.getAttribute("data-panel-resize-handle-id");vt(h);const[g,v]=Rhe(n,h,a);if(g==null||v==null)return()=>{};const b=x=>{if(!x.defaultPrevented)switch(x.key){case"Enter":{x.preventDefault();const w=a.findIndex(_=>_.id===g);if(w>=0){const _=a[w];vt(_);const S=r[w],{collapsedSize:R=0,collapsible:C,minSize:P=0}=_.constraints;if(S!=null&&C){const A=ad({delta:Zr(S,R)?P-R:R-S,layout:r,panelConstraints:a.map(k=>k.constraints),pivotIndices:RN(n,h),trigger:"keyboard"});r!==A&&i(A)}}break}}};return f.addEventListener("keydown",b),()=>{f.removeEventListener("keydown",b)}});return()=>{u.forEach(f=>f())}},[e,t,n,r,o,i])}function d2(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function PN(e){return e.type==="keydown"}function TN(e){return e.type.startsWith("mouse")}function DN(e){return e.type.startsWith("touch")}function $N(e,t){const n=e==="horizontal";if(TN(t))return n?t.clientX:t.clientY;if(DN(t)){const r=t.touches[0];return vt(r),n?r.screenX:r.screenY}else throw Error(`Unsupported event type "${t.type}"`)}function Phe(e,t,n,r){const o=n==="horizontal",i=iv(t);vt(i);const s=i.getAttribute("data-panel-group-id");vt(s);let{initialCursorPosition:a}=r;const l=$N(n,e),c=ON(s);vt(c);const u=c.getBoundingClientRect(),f=o?u.width:u.height;return(l-a)/f*100}function The(e,t,n,r,o){if(PN(e)){const i=n==="horizontal";let s=0;e.shiftKey?s=100:o!=null?s=o:s=10;let a=0;switch(e.key){case"ArrowDown":a=i?0:s;break;case"ArrowLeft":a=i?-s:0;break;case"ArrowRight":a=i?s:0;break;case"ArrowUp":a=i?0:-s;break;case"End":a=100;break;case"Home":a=-100;break}return a}else return r==null?0:Phe(e,t,n,r)}function Dhe({panelDataArray:e}){const t=Array(e.length),n=e.map(i=>i.constraints);let r=0,o=100;for(let i=0;i<e.length;i++){const s=n[i];vt(s);const{defaultSize:a}=s;a!=null&&(r++,t[i]=a,o-=a)}for(let i=0;i<e.length;i++){const s=n[i];vt(s);const{defaultSize:a}=s;if(a!=null)continue;const l=e.length-r,c=o/l;r++,t[i]=c,o-=c}return t}function sc(e,t,n){t.forEach((r,o)=>{const i=e[o];vt(i);const{callbacks:s,constraints:a,id:l}=i,{collapsedSize:c=0,collapsible:u}=a,f=n[l];if(f==null||r!==f){n[l]=r;const{onCollapse:h,onExpand:g,onResize:v}=s;v&&v(r,f),u&&(h||g)&&(g&&(f==null||f===c)&&r!==c&&g(),h&&(f==null||f!==c)&&r===c&&h())}})}function jp(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function $he({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:o,precision:i=3}){const s=n[o];let a;return s==null?a=e??"1":r.length===1?a="1":a=s.toPrecision(i),{flexBasis:0,flexGrow:a,flexShrink:1,overflow:"hidden",pointerEvents:t!==null?"none":void 0}}let rw=null,Ka=null;function AN(e){switch(e){case"horizontal":return"ew-resize";case"horizontal-max":return"w-resize";case"horizontal-min":return"e-resize";case"vertical":return"ns-resize";case"vertical-max":return"n-resize";case"vertical-min":return"s-resize"}}function Ahe(){Ka!==null&&(document.head.removeChild(Ka),rw=null,Ka=null)}function Jy(e){if(rw===e)return;rw=e;const t=AN(e);Ka===null&&(Ka=document.createElement("style"),document.head.appendChild(Ka)),Ka.innerHTML=`*{cursor: ${t}!important;}`}function khe(e,t=10){let n=null;return(...o)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...o)},t)}}function f2(e){try{if(typeof localStorage<"u")e.getItem=t=>localStorage.getItem(t),e.setItem=(t,n)=>{localStorage.setItem(t,n)};else throw new Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function kN(e){return`react-resizable-panels:${e}`}function MN(e){return e.map(t=>{const{constraints:n,id:r,idIsFromProps:o,order:i}=t;return o?r:i?`${i}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((t,n)=>t.localeCompare(n)).join(",")}function IN(e,t){try{const n=kN(e),r=t.getItem(n);if(r){const o=JSON.parse(r);if(typeof o=="object"&&o!=null)return o}}catch{}return null}function Mhe(e,t,n){var r,o;const i=(r=IN(e,n))!==null&&r!==void 0?r:{},s=MN(t);return(o=i[s])!==null&&o!==void 0?o:null}function Ihe(e,t,n,r,o){var i;const s=kN(e),a=MN(t),l=(i=IN(e,o))!==null&&i!==void 0?i:{};l[a]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{o.setItem(s,JSON.stringify(l))}catch(c){console.error(c)}}function h2({layout:e,panelConstraints:t}){const n=[...e],r=n.reduce((i,s)=>i+s,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(i=>`${i}%`).join(", ")}`);if(!Zr(r,100))for(let i=0;i<t.length;i++){const s=n[i];vt(s!=null);const a=100/r*s;n[i]=a}let o=0;for(let i=0;i<t.length;i++){const s=n[i];vt(s!=null);const a=gc({panelConstraints:t,panelIndex:i,size:s});s!=a&&(o+=s-a,n[i]=a)}if(!Zr(o,0))for(let i=0;i<t.length;i++){const s=n[i];vt(s!=null);const a=s+o,l=gc({panelConstraints:t,panelIndex:i,size:a});if(s!==l&&(o-=l-s,n[i]=l,Zr(o,0)))break}return n}const Nhe=100,ld={getItem:e=>(f2(ld),ld.getItem(e)),setItem:(e,t)=>{f2(ld),ld.setItem(e,t)}},p2={};function NN({autoSaveId:e=null,children:t,className:n="",direction:r,forwardedRef:o,id:i=null,onLayout:s=null,keyboardResizeBy:a=null,storage:l=ld,style:c,tagName:u="div",...f}){const h=Y_(i),[g,v]=Yg(null),[b,x]=Yg([]),w=Do({}),_=Do(new Map),S=Do(0),R=Do({autoSaveId:e,direction:r,dragState:g,id:h,keyboardResizeBy:a,onLayout:s,storage:l}),C=Do({layout:b,panelDataArray:[],panelDataArrayChanged:!1});Do({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),wN(o,()=>({getId:()=>R.current.id,getLayout:()=>{const{layout:$}=C.current;return $},setLayout:$=>{const{onLayout:H}=R.current,{layout:J,panelDataArray:N}=C.current,ce=h2({layout:$,panelConstraints:N.map(le=>le.constraints)});d2(J,ce)||(x(ce),C.current.layout=ce,H&&H(ce),sc(N,ce,w.current))}}),[]),cf(()=>{R.current.autoSaveId=e,R.current.direction=r,R.current.dragState=g,R.current.id=h,R.current.onLayout=s,R.current.storage=l}),Ohe({committedValuesRef:R,eagerValuesRef:C,groupId:h,layout:b,panelDataArray:C.current.panelDataArray,setLayout:x}),ul(()=>{const{panelDataArray:$}=C.current;if(e){if(b.length===0||b.length!==$.length)return;let H=p2[e];H==null&&(H=khe(Ihe,Nhe),p2[e]=H);const J=[...$],N=new Map(_.current);H(e,J,N,b,l)}},[e,b,l]),ul(()=>{});const P=Yr($=>{const{onLayout:H}=R.current,{layout:J,panelDataArray:N}=C.current;if($.constraints.collapsible){const ce=N.map(ie=>ie.constraints),{collapsedSize:le=0,panelSize:de,pivotIndices:pe}=ac(N,$,J);if(vt(de!=null),de!==le){_.current.set($.id,de);const te=fc(N,$)===N.length-1?de-le:le-de,ae=ad({delta:te,layout:J,panelConstraints:ce,pivotIndices:pe,trigger:"imperative-api"});jp(J,ae)||(x(ae),C.current.layout=ae,H&&H(ae),sc(N,ae,w.current))}}},[]),A=Yr($=>{const{onLayout:H}=R.current,{layout:J,panelDataArray:N}=C.current;if($.constraints.collapsible){const ce=N.map(te=>te.constraints),{collapsedSize:le=0,panelSize:de,minSize:pe=0,pivotIndices:ie}=ac(N,$,J);if(de===le){const te=_.current.get($.id),ae=te!=null&&te>=pe?te:pe,G=fc(N,$)===N.length-1?de-ae:ae-de,be=ad({delta:G,layout:J,panelConstraints:ce,pivotIndices:ie,trigger:"imperative-api"});jp(J,be)||(x(be),C.current.layout=be,H&&H(be),sc(N,be,w.current))}}},[]),k=Yr($=>{const{layout:H,panelDataArray:J}=C.current,{panelSize:N}=ac(J,$,H);return vt(N!=null),N},[]),D=Yr(($,H)=>{const{panelDataArray:J}=C.current,N=fc(J,$);return $he({defaultSize:H,dragState:g,layout:b,panelData:J,panelIndex:N})},[g,b]),I=Yr($=>{const{layout:H,panelDataArray:J}=C.current,{collapsedSize:N=0,collapsible:ce,panelSize:le}=ac(J,$,H);return ce===!0&&le===N},[]),F=Yr($=>{const{layout:H,panelDataArray:J}=C.current,{collapsedSize:N=0,collapsible:ce,panelSize:le}=ac(J,$,H);return vt(le!=null),!ce||le>N},[]),B=Yr($=>{const{panelDataArray:H}=C.current;H.push($),H.sort((J,N)=>{const ce=J.order,le=N.order;return ce==null&&le==null?0:ce==null?-1:le==null?1:ce-le}),C.current.panelDataArrayChanged=!0},[]);cf(()=>{if(C.current.panelDataArrayChanged){C.current.panelDataArrayChanged=!1;const{autoSaveId:$,onLayout:H,storage:J}=R.current,{layout:N,panelDataArray:ce}=C.current;let le=null;if($){const pe=Mhe($,ce,J);pe&&(_.current=new Map(Object.entries(pe.expandToSizes)),le=pe.layout)}le==null&&(le=Dhe({panelDataArray:ce}));const de=h2({layout:le,panelConstraints:ce.map(pe=>pe.constraints)});d2(N,de)||(x(de),C.current.layout=de,H&&H(de),sc(ce,de,w.current))}});const K=Yr($=>function(J){J.preventDefault();const{direction:N,dragState:ce,id:le,keyboardResizeBy:de,onLayout:pe}=R.current,{layout:ie,panelDataArray:te}=C.current,{initialLayout:ae}=ce??{},ye=RN(le,$);let G=The(J,$,N,ce,de);if(G===0)return;const be=N==="horizontal";document.dir==="rtl"&&be&&(G=-G);const _e=te.map(Ue=>Ue.constraints),Pe=ad({delta:G,layout:ae??ie,panelConstraints:_e,pivotIndices:ye,trigger:PN(J)?"keyboard":"mouse-or-touch"}),Te=!jp(ie,Pe);(TN(J)||DN(J))&&S.current!=G&&(S.current=G,Jy(Te?be?"horizontal":"vertical":be?G<0?"horizontal-min":"horizontal-max":G<0?"vertical-min":"vertical-max")),Te&&(x(Pe),C.current.layout=Pe,pe&&pe(Pe),sc(te,Pe,w.current))},[]),Z=Yr(($,H)=>{const{onLayout:J}=R.current,{layout:N,panelDataArray:ce}=C.current,le=ce.map(ye=>ye.constraints),{panelSize:de,pivotIndices:pe}=ac(ce,$,N);vt(de!=null);const te=fc(ce,$)===ce.length-1?de-H:H-de,ae=ad({delta:te,layout:N,panelConstraints:le,pivotIndices:pe,trigger:"imperative-api"});jp(N,ae)||(x(ae),C.current.layout=ae,J&&J(ae),sc(ce,ae,w.current))},[]),z=Yr(($,H)=>{const{direction:J}=R.current,{layout:N}=C.current,ce=iv($);vt(ce);const le=$N(J,H);v({dragHandleId:$,dragHandleRect:ce.getBoundingClientRect(),initialCursorPosition:le,initialLayout:N})},[]),Q=Yr(()=>{Ahe(),v(null)},[]),W=Yr($=>{const{panelDataArray:H}=C.current,J=fc(H,$);J>=0&&(H.splice(J,1),delete w.current[$.id],C.current.panelDataArrayChanged=!0)},[]),Y=_he(()=>({collapsePanel:P,direction:r,dragState:g,expandPanel:A,getPanelSize:k,getPanelStyle:D,groupId:h,isPanelCollapsed:I,isPanelExpanded:F,registerPanel:B,registerResizeHandle:K,resizePanel:Z,startDragging:z,stopDragging:Q,unregisterPanel:W}),[P,g,r,A,k,D,h,I,F,B,K,Z,z,Q,W]),oe={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return tu(ov.Provider,{value:Y},tu(u,{...f,children:t,className:n,style:{...oe,...c},"data-panel-group":"","data-panel-group-direction":r,"data-panel-group-id":h}))}const LN=yN((e,t)=>tu(NN,{...e,forwardedRef:t}));NN.displayName="PanelGroup";LN.displayName="forwardRef(PanelGroup)";function fc(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function ac(e,t,n){const r=e.map(c=>c.constraints),o=fc(e,t),i=r[o],a=o===e.length-1?[o-1,o]:[o,o+1],l=n[o];return{...i,panelSize:l,pivotIndices:a}}function Lhe({disabled:e,handleId:t,resizeHandler:n}){ul(()=>{if(e||n==null)return;const r=iv(t);if(r==null)return;const o=i=>{if(!i.defaultPrevented)switch(i.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{i.preventDefault(),n(i);break}case"F6":{i.preventDefault();const s=r.getAttribute("data-panel-group-id");vt(s);const a=df(s),l=EN(s,t);vt(l!==null);const c=i.shiftKey?l>0?l-1:a.length-1:l+1<a.length?l+1:0;a[c].focus();break}}};return r.addEventListener("keydown",o),()=>{r.removeEventListener("keydown",o)}},[e,t,n])}function K_({children:e=null,className:t="",disabled:n=!1,id:r,onDragging:o,style:i={},tabIndex:s=0,tagName:a="div",...l}){const c=Do(null),u=Do({onDragging:o});ul(()=>{u.current.onDragging=o});const f=xN(ov);if(f===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:h,dragState:g,groupId:v,registerResizeHandle:b,startDragging:x,stopDragging:w}=f,_=Y_(r),S=(g==null?void 0:g.dragHandleId)===_,[R,C]=Yg(!1),[P,A]=Yg(null),k=Yr(()=>{const I=c.current;vt(I),I.blur(),w();const{onDragging:F}=u.current;F&&F(!1)},[w]);ul(()=>{if(n)A(null);else{const I=b(_);A(()=>I)}},[n,_,b]),ul(()=>{if(n||P==null||!S)return;const I=Z=>{P(Z)},F=Z=>{P(Z)},B=c.current;vt(B);const K=B.ownerDocument;return K.body.addEventListener("contextmenu",k),K.body.addEventListener("mousemove",I),K.body.addEventListener("touchmove",I),K.body.addEventListener("mouseleave",F),window.addEventListener("mouseup",k),window.addEventListener("touchend",k),()=>{K.body.removeEventListener("contextmenu",k),K.body.removeEventListener("mousemove",I),K.body.removeEventListener("touchmove",I),K.body.removeEventListener("mouseleave",F),window.removeEventListener("mouseup",k),window.removeEventListener("touchend",k)}},[h,n,S,P,k]),Lhe({disabled:n,handleId:_,resizeHandler:P});const D={cursor:AN(h),touchAction:"none",userSelect:"none"};return tu(a,{...l,children:e,className:t,onBlur:()=>C(!1),onFocus:()=>C(!0),onMouseDown:I=>{x(_,I.nativeEvent);const F=u.current;vt(F);const{onDragging:B}=F;B&&B(!0)},onMouseUp:k,onTouchCancel:k,onTouchEnd:k,onTouchStart:I=>{x(_,I.nativeEvent);const F=u.current;vt(F);const{onDragging:B}=F;B&&B(!0)},ref:c,role:"separator",style:{...D,...i},tabIndex:s,"data-panel-group-direction":h,"data-panel-group-id":v,"data-resize-handle":"","data-resize-handle-active":S?"pointer":R?"keyboard":void 0,"data-panel-resize-handle-enabled":!n,"data-panel-resize-handle-id":_})}K_.displayName="PanelResizeHandle";const FN=({className:e,...t})=>O.jsx(LN,{className:Ce("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t}),ow=SN,Fhe=({withHandle:e,className:t,...n})=>O.jsx(K_,{className:Ce("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),...n,children:e&&O.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:O.jsx(JX,{className:"h-2.5 w-2.5"})})}),jhe=({withHandle:e,className:t,onTabClick:n,open:r,...o})=>O.jsx(K_,{className:Ce("relative flex w-px items-start justify-end bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",{"justify-start":r},t),...o,children:e&&O.jsx("div",{className:Ce("z-50 flex items-center justify-start",{"border-l":r}),children:O.jsx(yr,{variant:"secondary",className:Ce("h-7 p-1",{"rounded-bl-none rounded-br-md rounded-tl-none rounded-tr-md":r,"mt-2 rounded-bl-md rounded-br-none rounded-tl-md rounded-tr-none":!r}),onClick:()=>n(!r),children:r?O.jsx(S1,{className:"size-4"}):O.jsx(MA,{className:"size-4"})})})});function zhe(e,t=[]){let n=[];function r(i,s){const a=V.createContext(s),l=n.length;n=[...n,s];function c(f){const{scope:h,children:g,...v}=f,b=(h==null?void 0:h[e][l])||a,x=V.useMemo(()=>v,Object.values(v));return O.jsx(b.Provider,{value:x,children:g})}function u(f,h){const g=(h==null?void 0:h[e][l])||a,v=V.useContext(g);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return c.displayName=i+"Provider",[c,u]}const o=()=>{const i=n.map(s=>V.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return V.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,Bhe(o,...t)]}function Bhe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(i)[`__scope${c}`];return{...a,...f}},{});return V.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Vhe(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Hhe(...e){return t=>e.forEach(n=>Vhe(n,t))}function jN(...e){return V.useCallback(Hhe(...e),e)}function oa(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Whe(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Uhe(...e){return t=>e.forEach(n=>Whe(n,t))}function $l(...e){return V.useCallback(Uhe(...e),e)}function qhe(e,t){const n=V.createContext(t);function r(i){const{children:s,...a}=i,l=V.useMemo(()=>a,Object.values(a));return O.jsx(n.Provider,{value:l,children:s})}function o(i){const s=V.useContext(n);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return r.displayName=e+"Provider",[r,o]}function Ghe(e,t=[]){let n=[];function r(i,s){const a=V.createContext(s),l=n.length;n=[...n,s];function c(f){const{scope:h,children:g,...v}=f,b=(h==null?void 0:h[e][l])||a,x=V.useMemo(()=>v,Object.values(v));return O.jsx(b.Provider,{value:x,children:g})}function u(f,h){const g=(h==null?void 0:h[e][l])||a,v=V.useContext(g);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return c.displayName=i+"Provider",[c,u]}const o=()=>{const i=n.map(s=>V.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return V.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,Yhe(o,...t)]}function Yhe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(i)[`__scope${c}`];return{...a,...f}},{});return V.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var Kg=globalThis!=null&&globalThis.document?V.useLayoutEffect:()=>{},Khe=V.useId||(()=>{}),Xhe=0;function Zy(e){const[t,n]=V.useState(Khe());return Kg(()=>{e||n(r=>r??String(Xhe++))},[e]),e||(t?`radix-${t}`:"")}function xl(e){const t=V.useRef(e);return V.useEffect(()=>{t.current=e}),V.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function Qhe({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=Jhe({defaultProp:t,onChange:n}),i=e!==void 0,s=i?e:r,a=xl(n),l=V.useCallback(c=>{if(i){const f=typeof c=="function"?c(e):c;f!==e&&a(f)}else o(c)},[i,e,o,a]);return[s,l]}function Jhe({defaultProp:e,onChange:t}){const n=V.useState(e),[r]=n,o=V.useRef(r),i=xl(t);return V.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}var Zhe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],ps=Zhe.reduce((e,t)=>{const n=V.forwardRef((r,o)=>{const{asChild:i,...s}=r,a=i?Vm:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),O.jsx(a,{...s,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function epe(e,t){e&&dw.flushSync(()=>e.dispatchEvent(t))}function tpe(e,t=globalThis==null?void 0:globalThis.document){const n=xl(e);V.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var npe="DismissableLayer",iw="dismissableLayer.update",rpe="dismissableLayer.pointerDownOutside",ope="dismissableLayer.focusOutside",g2,zN=V.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),BN=V.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:a,...l}=e,c=V.useContext(zN),[u,f]=V.useState(null),h=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=V.useState({}),v=$l(t,A=>f(A)),b=Array.from(c.layers),[x]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),w=b.indexOf(x),_=u?b.indexOf(u):-1,S=c.layersWithOutsidePointerEventsDisabled.size>0,R=_>=w,C=ape(A=>{const k=A.target,D=[...c.branches].some(I=>I.contains(k));!R||D||(o==null||o(A),s==null||s(A),A.defaultPrevented||a==null||a())},h),P=lpe(A=>{const k=A.target;[...c.branches].some(I=>I.contains(k))||(i==null||i(A),s==null||s(A),A.defaultPrevented||a==null||a())},h);return tpe(A=>{_===c.layers.size-1&&(r==null||r(A),!A.defaultPrevented&&a&&(A.preventDefault(),a()))},h),V.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(g2=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),m2(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=g2)}},[u,h,n,c]),V.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),m2())},[u,c]),V.useEffect(()=>{const A=()=>g({});return document.addEventListener(iw,A),()=>document.removeEventListener(iw,A)},[]),O.jsx(ps.div,{...l,ref:v,style:{pointerEvents:S?R?"auto":"none":void 0,...e.style},onFocusCapture:oa(e.onFocusCapture,P.onFocusCapture),onBlurCapture:oa(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:oa(e.onPointerDownCapture,C.onPointerDownCapture)})});BN.displayName=npe;var ipe="DismissableLayerBranch",spe=V.forwardRef((e,t)=>{const n=V.useContext(zN),r=V.useRef(null),o=$l(t,r);return V.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),O.jsx(ps.div,{...e,ref:o})});spe.displayName=ipe;function ape(e,t=globalThis==null?void 0:globalThis.document){const n=xl(e),r=V.useRef(!1),o=V.useRef(()=>{});return V.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let l=function(){VN(rpe,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=l,t.addEventListener("click",o.current,{once:!0})):l()}else t.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function lpe(e,t=globalThis==null?void 0:globalThis.document){const n=xl(e),r=V.useRef(!1);return V.useEffect(()=>{const o=i=>{i.target&&!r.current&&VN(ope,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function m2(){const e=new CustomEvent(iw);document.dispatchEvent(e)}function VN(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?epe(o,i):o.dispatchEvent(i)}var e0="focusScope.autoFocusOnMount",t0="focusScope.autoFocusOnUnmount",v2={bubbles:!1,cancelable:!0},cpe="FocusScope",HN=V.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...s}=e,[a,l]=V.useState(null),c=xl(o),u=xl(i),f=V.useRef(null),h=$l(t,b=>l(b)),g=V.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;V.useEffect(()=>{if(r){let b=function(S){if(g.paused||!a)return;const R=S.target;a.contains(R)?f.current=R:js(f.current,{select:!0})},x=function(S){if(g.paused||!a)return;const R=S.relatedTarget;R!==null&&(a.contains(R)||js(f.current,{select:!0}))},w=function(S){if(document.activeElement===document.body)for(const C of S)C.removedNodes.length>0&&js(a)};document.addEventListener("focusin",b),document.addEventListener("focusout",x);const _=new MutationObserver(w);return a&&_.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",x),_.disconnect()}}},[r,a,g.paused]),V.useEffect(()=>{if(a){y2.add(g);const b=document.activeElement;if(!a.contains(b)){const w=new CustomEvent(e0,v2);a.addEventListener(e0,c),a.dispatchEvent(w),w.defaultPrevented||(upe(gpe(WN(a)),{select:!0}),document.activeElement===b&&js(a))}return()=>{a.removeEventListener(e0,c),setTimeout(()=>{const w=new CustomEvent(t0,v2);a.addEventListener(t0,u),a.dispatchEvent(w),w.defaultPrevented||js(b??document.body,{select:!0}),a.removeEventListener(t0,u),y2.remove(g)},0)}}},[a,c,u,g]);const v=V.useCallback(b=>{if(!n&&!r||g.paused)return;const x=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,w=document.activeElement;if(x&&w){const _=b.currentTarget,[S,R]=dpe(_);S&&R?!b.shiftKey&&w===R?(b.preventDefault(),n&&js(S,{select:!0})):b.shiftKey&&w===S&&(b.preventDefault(),n&&js(R,{select:!0})):w===_&&b.preventDefault()}},[n,r,g.paused]);return O.jsx(ps.div,{tabIndex:-1,...s,ref:h,onKeyDown:v})});HN.displayName=cpe;function upe(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(js(r,{select:t}),document.activeElement!==n)return}function dpe(e){const t=WN(e),n=b2(t,e),r=b2(t.reverse(),e);return[n,r]}function WN(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function b2(e,t){for(const n of e)if(!fpe(n,{upTo:t}))return n}function fpe(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function hpe(e){return e instanceof HTMLInputElement&&"select"in e}function js(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&hpe(e)&&t&&e.select()}}var y2=ppe();function ppe(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=x2(e,t),e.unshift(t)},remove(t){var n;e=x2(e,t),(n=e[0])==null||n.resume()}}}function x2(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function gpe(e){return e.filter(t=>t.tagName!=="A")}var mpe="Portal",UN=V.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,i]=V.useState(!1);Kg(()=>i(!0),[]);const s=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return s?ko.createPortal(O.jsx(ps.div,{...r,ref:t}),s):null});UN.displayName=mpe;function vpe(e,t){return V.useReducer((n,r)=>t[n][r]??n,e)}var sv=e=>{const{present:t,children:n}=e,r=bpe(t),o=typeof n=="function"?n({present:r.isPresent}):V.Children.only(n),i=$l(r.ref,ype(o));return typeof n=="function"||r.isPresent?V.cloneElement(o,{ref:i}):null};sv.displayName="Presence";function bpe(e){const[t,n]=V.useState(),r=V.useRef({}),o=V.useRef(e),i=V.useRef("none"),s=e?"mounted":"unmounted",[a,l]=vpe(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return V.useEffect(()=>{const c=zp(r.current);i.current=a==="mounted"?c:"none"},[a]),Kg(()=>{const c=r.current,u=o.current;if(u!==e){const h=i.current,g=zp(c);e?l("MOUNT"):g==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&h!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),Kg(()=>{if(t){const c=f=>{const g=zp(r.current).includes(f.animationName);f.target===t&&g&&dw.flushSync(()=>l("ANIMATION_END"))},u=f=>{f.target===t&&(i.current=zp(r.current))};return t.addEventListener("animationstart",u),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{t.removeEventListener("animationstart",u),t.removeEventListener("animationcancel",c),t.removeEventListener("animationend",c)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:V.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function zp(e){return(e==null?void 0:e.animationName)||"none"}function ype(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var n0=0;function xpe(){V.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??w2()),document.body.insertAdjacentElement("beforeend",e[1]??w2()),n0++,()=>{n0===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),n0--}},[])}function w2(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}var qN=Mk(),r0=function(){},av=V.forwardRef(function(e,t){var n=V.useRef(null),r=V.useState({onScrollCapture:r0,onWheelCapture:r0,onTouchMoveCapture:r0}),o=r[0],i=r[1],s=e.forwardProps,a=e.children,l=e.className,c=e.removeScrollBar,u=e.enabled,f=e.shards,h=e.sideCar,g=e.noIsolation,v=e.inert,b=e.allowPinchZoom,x=e.as,w=x===void 0?"div":x,_=e.gapMode,S=e_(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),R=h,C=kk([n,t]),P=lr(lr({},S),o);return V.createElement(V.Fragment,null,u&&V.createElement(R,{sideCar:qN,removeScrollBar:c,shards:f,noIsolation:g,inert:v,setCallbacks:i,allowPinchZoom:!!b,lockRef:n,gapMode:_}),s?V.cloneElement(V.Children.only(a),lr(lr({},P),{ref:C})):V.createElement(w,lr({},P,{className:l,ref:C}),a))});av.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};av.classNames={fullWidth:wd,zeroRight:xd};var sw=!1;if(typeof window<"u")try{var Bp=Object.defineProperty({},"passive",{get:function(){return sw=!0,!0}});window.addEventListener("test",Bp,Bp),window.removeEventListener("test",Bp,Bp)}catch{sw=!1}var lc=sw?{passive:!1}:!1,wpe=function(e){return e.tagName==="TEXTAREA"},GN=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!wpe(e)&&n[t]==="visible")},_pe=function(e){return GN(e,"overflowY")},Spe=function(e){return GN(e,"overflowX")},_2=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=YN(e,r);if(o){var i=KN(e,r),s=i[1],a=i[2];if(s>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Cpe=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Epe=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},YN=function(e,t){return e==="v"?_pe(t):Spe(t)},KN=function(e,t){return e==="v"?Cpe(t):Epe(t)},Rpe=function(e,t){return e==="h"&&t==="rtl"?-1:1},Ope=function(e,t,n,r,o){var i=Rpe(e,window.getComputedStyle(t).direction),s=i*r,a=n.target,l=t.contains(a),c=!1,u=s>0,f=0,h=0;do{var g=KN(e,a),v=g[0],b=g[1],x=g[2],w=b-x-i*v;(v||w)&&YN(e,a)&&(f+=w,h+=v),a instanceof ShadowRoot?a=a.host:a=a.parentNode}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(u&&(o&&Math.abs(f)<1||!o&&s>f)||!u&&(o&&Math.abs(h)<1||!o&&-s>h))&&(c=!0),c},Vp=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},S2=function(e){return[e.deltaX,e.deltaY]},C2=function(e){return e&&"current"in e?e.current:e},Ppe=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Tpe=function(e){return`
413
413
  .block-interactivity-`.concat(e,` {pointer-events: none;}
414
414
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
415
415
  `)},Dpe=0,cc=[];function $pe(e){var t=V.useRef([]),n=V.useRef([0,0]),r=V.useRef(),o=V.useState(Dpe++)[0],i=V.useState(t_)[0],s=V.useRef(e);V.useEffect(function(){s.current=e},[e]),V.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var b=Ak([e.lockRef.current],(e.shards||[]).map(C2),!0).filter(Boolean);return b.forEach(function(x){return x.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),b.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=V.useCallback(function(b,x){if("touches"in b&&b.touches.length===2)return!s.current.allowPinchZoom;var w=Vp(b),_=n.current,S="deltaX"in b?b.deltaX:_[0]-w[0],R="deltaY"in b?b.deltaY:_[1]-w[1],C,P=b.target,A=Math.abs(S)>Math.abs(R)?"h":"v";if("touches"in b&&A==="h"&&P.type==="range")return!1;var k=_2(A,P);if(!k)return!0;if(k?C=A:(C=A==="v"?"h":"v",k=_2(A,P)),!k)return!1;if(!r.current&&"changedTouches"in b&&(S||R)&&(r.current=C),!C)return!0;var D=r.current||C;return Ope(D,x,b,D==="h"?S:R,!0)},[]),l=V.useCallback(function(b){var x=b;if(!(!cc.length||cc[cc.length-1]!==i)){var w="deltaY"in x?S2(x):Vp(x),_=t.current.filter(function(C){return C.name===x.type&&(C.target===x.target||x.target===C.shadowParent)&&Ppe(C.delta,w)})[0];if(_&&_.should){x.cancelable&&x.preventDefault();return}if(!_){var S=(s.current.shards||[]).map(C2).filter(Boolean).filter(function(C){return C.contains(x.target)}),R=S.length>0?a(x,S[0]):!s.current.noIsolation;R&&x.cancelable&&x.preventDefault()}}},[]),c=V.useCallback(function(b,x,w,_){var S={name:b,delta:x,target:w,should:_,shadowParent:Ape(w)};t.current.push(S),setTimeout(function(){t.current=t.current.filter(function(R){return R!==S})},1)},[]),u=V.useCallback(function(b){n.current=Vp(b),r.current=void 0},[]),f=V.useCallback(function(b){c(b.type,S2(b),b.target,a(b,e.lockRef.current))},[]),h=V.useCallback(function(b){c(b.type,Vp(b),b.target,a(b,e.lockRef.current))},[]);V.useEffect(function(){return cc.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",l,lc),document.addEventListener("touchmove",l,lc),document.addEventListener("touchstart",u,lc),function(){cc=cc.filter(function(b){return b!==i}),document.removeEventListener("wheel",l,lc),document.removeEventListener("touchmove",l,lc),document.removeEventListener("touchstart",u,lc)}},[]);var g=e.removeScrollBar,v=e.inert;return V.createElement(V.Fragment,null,v?V.createElement(i,{styles:Tpe(o)}):null,g?V.createElement(Fk,{gapMode:e.gapMode}):null)}function Ape(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const kpe=Nk(qN,$pe);var XN=V.forwardRef(function(e,t){return V.createElement(av,lr({},e,{ref:t,sideCar:kpe}))});XN.classNames=av.classNames;const Mpe=XN;var X_="Dialog",[QN,JN]=Ghe(X_),[Ipe,ti]=QN(X_),ZN=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!0}=e,a=V.useRef(null),l=V.useRef(null),[c=!1,u]=Qhe({prop:r,defaultProp:o,onChange:i});return O.jsx(Ipe,{scope:t,triggerRef:a,contentRef:l,contentId:Zy(),titleId:Zy(),descriptionId:Zy(),open:c,onOpenChange:u,onOpenToggle:V.useCallback(()=>u(f=>!f),[u]),modal:s,children:n})};ZN.displayName=X_;var e5="DialogTrigger",t5=V.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ti(e5,n),i=$l(t,o.triggerRef);return O.jsx(ps.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Z_(o.open),...r,ref:i,onClick:oa(e.onClick,o.onOpenToggle)})});t5.displayName=e5;var Q_="DialogPortal",[Npe,n5]=QN(Q_,{forceMount:void 0}),r5=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,i=ti(Q_,t);return O.jsx(Npe,{scope:t,forceMount:n,children:V.Children.map(r,s=>O.jsx(sv,{present:n||i.open,children:O.jsx(UN,{asChild:!0,container:o,children:s})}))})};r5.displayName=Q_;var Xg="DialogOverlay",o5=V.forwardRef((e,t)=>{const n=n5(Xg,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=ti(Xg,e.__scopeDialog);return i.modal?O.jsx(sv,{present:r||i.open,children:O.jsx(Lpe,{...o,ref:t})}):null});o5.displayName=Xg;var Lpe=V.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ti(Xg,n);return O.jsx(Mpe,{as:Vm,allowPinchZoom:!0,shards:[o.contentRef],children:O.jsx(ps.div,{"data-state":Z_(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),wl="DialogContent",i5=V.forwardRef((e,t)=>{const n=n5(wl,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=ti(wl,e.__scopeDialog);return O.jsx(sv,{present:r||i.open,children:i.modal?O.jsx(Fpe,{...o,ref:t}):O.jsx(jpe,{...o,ref:t})})});i5.displayName=wl;var Fpe=V.forwardRef((e,t)=>{const n=ti(wl,e.__scopeDialog),r=V.useRef(null),o=$l(t,n.contentRef,r);return V.useEffect(()=>{const i=r.current;if(i)return Lm(i)},[]),O.jsx(s5,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:oa(e.onCloseAutoFocus,i=>{var s;i.preventDefault(),(s=n.triggerRef.current)==null||s.focus()}),onPointerDownOutside:oa(e.onPointerDownOutside,i=>{const s=i.detail.originalEvent,a=s.button===0&&s.ctrlKey===!0;(s.button===2||a)&&i.preventDefault()}),onFocusOutside:oa(e.onFocusOutside,i=>i.preventDefault())})}),jpe=V.forwardRef((e,t)=>{const n=ti(wl,e.__scopeDialog),r=V.useRef(!1),o=V.useRef(!1);return O.jsx(s5,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s,a;(s=e.onCloseAutoFocus)==null||s.call(e,i),i.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:i=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=i.target;((c=n.triggerRef.current)==null?void 0:c.contains(s))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),s5=V.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,...s}=e,a=ti(wl,n),l=V.useRef(null),c=$l(t,l);return xpe(),O.jsxs(O.Fragment,{children:[O.jsx(HN,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:O.jsx(BN,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":Z_(a.open),...s,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),O.jsxs(O.Fragment,{children:[O.jsx(Bpe,{titleId:a.titleId}),O.jsx(Hpe,{contentRef:l,descriptionId:a.descriptionId})]})]})}),J_="DialogTitle",a5=V.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ti(J_,n);return O.jsx(ps.h2,{id:o.titleId,...r,ref:t})});a5.displayName=J_;var l5="DialogDescription",c5=V.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ti(l5,n);return O.jsx(ps.p,{id:o.descriptionId,...r,ref:t})});c5.displayName=l5;var u5="DialogClose",d5=V.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ti(u5,n);return O.jsx(ps.button,{type:"button",...r,ref:t,onClick:oa(e.onClick,()=>o.onOpenChange(!1))})});d5.displayName=u5;function Z_(e){return e?"open":"closed"}var f5="DialogTitleWarning",[zpe,h5]=qhe(f5,{contentName:wl,titleName:J_,docsSlug:"dialog"}),Bpe=({titleId:e})=>{const t=h5(f5),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
@@ -422,7 +422,7 @@ You can add a description to the \`${Sc}\` by passing a \`${C5}\` component as a
422
422
 
423
423
  Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Sc}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
424
424
 
425
- For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return V.useEffect(()=>{var r;document.getElementById((r=e.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},ege=b5,tge=y5,T5=x5,D5=w5,$5=R5,A5=P5,k5=S5,M5=E5;const nge=ege,rge=tge,I5=V.forwardRef(({className:e,...t},n)=>O.jsx(T5,{className:Ce("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));I5.displayName=T5.displayName;const N5=V.forwardRef(({className:e,...t},n)=>O.jsx(rge,{children:O.jsxs(au,{children:[O.jsx(I5,{}),O.jsx(D5,{ref:n,className:Ce("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]})}));N5.displayName=D5.displayName;const L5=({className:e,...t})=>O.jsx("div",{className:Ce("flex flex-col space-y-2 text-center sm:text-left",e),...t});L5.displayName="AlertDialogHeader";const F5=({className:e,...t})=>O.jsx("div",{className:Ce("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});F5.displayName="AlertDialogFooter";const j5=V.forwardRef(({className:e,...t},n)=>O.jsx(k5,{ref:n,className:Ce("text-lg font-semibold",e),...t}));j5.displayName=k5.displayName;const z5=V.forwardRef(({className:e,...t},n)=>O.jsx(M5,{ref:n,className:Ce("text-sm text-muted-foreground",e),...t}));z5.displayName=M5.displayName;const B5=V.forwardRef(({className:e,...t},n)=>O.jsx($5,{ref:n,className:Ce(Vd(),e),...t}));B5.displayName=$5.displayName;const V5=V.forwardRef(({className:e,...t},n)=>O.jsx(A5,{ref:n,className:Ce(Vd({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));V5.displayName=A5.displayName;function oge({open:e,setOpen:t}){const n=ke(i=>i.selectedSheetId),{deleteSheet:r}=Mo();function o(){n&&(r(n),t(!1))}return O.jsx(nge,{open:e,onOpenChange:t,children:O.jsxs(N5,{children:[O.jsxs(L5,{children:[O.jsx(j5,{children:"Delete Sheet"}),O.jsx(z5,{children:"Are you sure you want to delete this sheet along with all its cards? This action cannot be undone."})]}),O.jsxs(F5,{children:[O.jsx(V5,{children:"Cancel"}),O.jsx(B5,{onClick:o,children:"Delete"})]})]})})}function H5(){var b,x;const[e,t]=m.useState(!1),n=ke(w=>{var _;return(_=w.dashboard)==null?void 0:_.sheets}),{showAssistant:r}=ma(),o=m.useRef(null),[i,s]=m.useState(!1),a=ke(w=>w.isDashboardEditing),l=ke(w=>w.themeStyle);ke(w=>w.isVisualEditing);const c=ke(w=>w.selectedSheetId),{setSelectedSheetId:u,setSheetTitle:f,addSheet:h}=Mo();if(!n)return null;function g(w){var _,S;w?((_=o.current)==null||_.resize(35),s(!0)):(s(!1),(S=o.current)==null||S.resize(0))}function v(){const w={id:la(),title:"New Sheet"};h(w)}return O.jsxs(ID,{role:"dashboard-tabs-container",className:Ce("relative flex grow",l==null?void 0:l.dashboardTabsContainer),onValueChange:w=>{u(w)},value:c||n[0].id,children:[O.jsxs(FN,{direction:"horizontal",children:[O.jsx(ow,{children:O.jsxs("div",{style:{},children:[(n.length>1||a)&&O.jsxs(Dw,{role:"tab-list",className:"flex h-11 items-center justify-start gap-2 rounded-none bg-transparent px-2.5 py-3",children:[n==null?void 0:n.map(w=>{var _,S;return O.jsx(is,{text:w.title,onSave:R=>f(w.id,R),children:O.jsxs($w,{style:{borderRadius:(S=(_=l==null?void 0:l.chart)==null?void 0:_.options)==null?void 0:S.borderRadius},onClick:()=>u(w.id),className:"flex items-center gap-1 rounded-none border px-2 py-1",value:w.id,children:[w.title,a&&c===w.id&&n.length>1&&O.jsx(Tm,{className:"ml-1 size-3",onClick:()=>t(!0)})]})},w.id)}),a&&O.jsx("div",{style:{borderRadius:(x=(b=l==null?void 0:l.chart)==null?void 0:b.options)==null?void 0:x.borderRadius},className:"flex h-7 items-center justify-center border-none bg-muted p-2 hover:cursor-pointer dark:border-l-background",onClick:v,children:O.jsx(E1,{className:"size-3"})})]}),n==null?void 0:n.map(w=>O.jsx(Aw,{className:Ce("mt-0",{"bg-muted":(l==null?void 0:l.canvasTheme)==="muted"||!(l!=null&&l.canvasTheme)}),value:w.id,children:O.jsx(Cae,{})},w.id))]})}),r===!0&&O.jsxs(O.Fragment,{children:[O.jsx(jhe,{open:i,onTabClick:g,withHandle:!0}),O.jsx(ow,{onResize:w=>{w<1?s(!1):i||s(!0)},defaultSize:0,ref:o,children:O.jsx(bhe,{})})]})]}),O.jsx(oge,{open:e,setOpen:t})]})}function W5({children:e}){return O.jsx(mB,{defaultTheme:"system",storageKey:"vite-ui-theme",children:O.jsx(OJ,{delayDuration:0,children:e})})}function U5(e){return O.jsx(ck,{dashboardProps:e,children:O.jsx(W5,{children:O.jsx(SD,{...e,children:O.jsx(H5,{})})})})}const q5=m.forwardRef((e,t)=>{const{children:n,...r}=e,o=m.Children.toArray(n),i=o.find(sge);if(i){const s=i.props.children,a=o.map(l=>l===i?m.Children.count(s)>1?m.Children.only(null):m.isValidElement(s)?s.props.children:null:l);return m.createElement(aw,he({},r,{ref:t}),m.isValidElement(s)?m.cloneElement(s,void 0,a):null)}return m.createElement(aw,he({},r,{ref:t}),n)});q5.displayName="Slot";const aw=m.forwardRef((e,t)=>{const{children:n,...r}=e;return m.isValidElement(n)?m.cloneElement(n,{...age(r,n.props),ref:t?cs(t,n.ref):n.ref}):m.Children.count(n)>1?m.Children.only(null):null});aw.displayName="SlotClone";const ige=({children:e})=>m.createElement(m.Fragment,null,e);function sge(e){return m.isValidElement(e)&&e.type===ige}function age(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}const lw=["Enter"," "],lge=["ArrowDown","PageUp","Home"],G5=["ArrowUp","PageDown","End"],cge=[...lge,...G5],uge={ltr:[...lw,"ArrowRight"],rtl:[...lw,"ArrowLeft"]},dge={ltr:["ArrowLeft"],rtl:["ArrowRight"]},lv="Menu",[ff,fge,hge]=cm(lv),[Al,Y5]=Zn(lv,[hge,Ti,ou]),iS=Ti(),K5=ou(),[pge,kl]=Al(lv),[gge,eh]=Al(lv),mge=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:i,modal:s=!0}=e,a=iS(t),[l,c]=m.useState(null),u=m.useRef(!1),f=Ln(i),h=_l(o);return m.useEffect(()=>{const g=()=>{u.current=!0,document.addEventListener("pointerdown",v,{capture:!0,once:!0}),document.addEventListener("pointermove",v,{capture:!0,once:!0})},v=()=>u.current=!1;return document.addEventListener("keydown",g,{capture:!0}),()=>{document.removeEventListener("keydown",g,{capture:!0}),document.removeEventListener("pointerdown",v,{capture:!0}),document.removeEventListener("pointermove",v,{capture:!0})}},[]),m.createElement(Bf,a,m.createElement(pge,{scope:t,open:n,onOpenChange:f,content:l,onContentChange:c},m.createElement(gge,{scope:t,onClose:m.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:u,dir:h,modal:s},r)))},X5=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=iS(n);return m.createElement(Vf,he({},o,r,{ref:t}))}),Q5="MenuPortal",[vge,J5]=Al(Q5,{forceMount:void 0}),bge=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,i=kl(Q5,t);return m.createElement(vge,{scope:t,forceMount:n},m.createElement(er,{present:n||i.open},m.createElement(k1,{asChild:!0,container:o},r)))},Qo="MenuContent",[yge,sS]=Al(Qo),xge=m.forwardRef((e,t)=>{const n=J5(Qo,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=kl(Qo,e.__scopeMenu),s=eh(Qo,e.__scopeMenu);return m.createElement(ff.Provider,{scope:e.__scopeMenu},m.createElement(er,{present:r||i.open},m.createElement(ff.Slot,{scope:e.__scopeMenu},s.modal?m.createElement(wge,he({},o,{ref:t})):m.createElement(_ge,he({},o,{ref:t})))))}),wge=m.forwardRef((e,t)=>{const n=kl(Qo,e.__scopeMenu),r=m.useRef(null),o=_t(t,r);return m.useEffect(()=>{const i=r.current;if(i)return Lm(i)},[]),m.createElement(aS,he({},e,{ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Me(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)}))}),_ge=m.forwardRef((e,t)=>{const n=kl(Qo,e.__scopeMenu);return m.createElement(aS,he({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)}))}),aS=m.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:h,onDismiss:g,disableOutsideScroll:v,...b}=e,x=kl(Qo,n),w=eh(Qo,n),_=iS(n),S=K5(n),R=fge(n),[C,P]=m.useState(null),A=m.useRef(null),k=_t(t,A,x.onContentChange),D=m.useRef(0),I=m.useRef(""),F=m.useRef(0),B=m.useRef(null),K=m.useRef("right"),Z=m.useRef(0),z=v?n_:m.Fragment,Q=v?{as:q5,allowPinchZoom:!0}:void 0,W=oe=>{var $,H;const J=I.current+oe,N=R().filter(te=>!te.disabled),ce=document.activeElement,le=($=N.find(te=>te.ref.current===ce))===null||$===void 0?void 0:$.textValue,de=N.map(te=>te.textValue),pe=Bge(de,J,le),ie=(H=N.find(te=>te.textValue===pe))===null||H===void 0?void 0:H.ref.current;(function te(ae){I.current=ae,window.clearTimeout(D.current),ae!==""&&(D.current=window.setTimeout(()=>te(""),1e3))})(J),ie&&setTimeout(()=>ie.focus())};m.useEffect(()=>()=>window.clearTimeout(D.current),[]),J1();const Y=m.useCallback(oe=>{var $,H;return K.current===(($=B.current)===null||$===void 0?void 0:$.side)&&Hge(oe,(H=B.current)===null||H===void 0?void 0:H.area)},[]);return m.createElement(yge,{scope:n,searchRef:I,onItemEnter:m.useCallback(oe=>{Y(oe)&&oe.preventDefault()},[Y]),onItemLeave:m.useCallback(oe=>{var $;Y(oe)||(($=A.current)===null||$===void 0||$.focus(),P(null))},[Y]),onTriggerLeave:m.useCallback(oe=>{Y(oe)&&oe.preventDefault()},[Y]),pointerGraceTimerRef:F,onPointerGraceIntentChange:m.useCallback(oe=>{B.current=oe},[])},m.createElement(z,Q,m.createElement(Z1,{asChild:!0,trapped:o,onMountAutoFocus:Me(i,oe=>{var $;oe.preventDefault(),($=A.current)===null||$===void 0||$.focus()}),onUnmountAutoFocus:s},m.createElement(jf,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:h,onDismiss:g},m.createElement(Ow,he({asChild:!0},S,{dir:w.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:P,onEntryFocus:Me(l,oe=>{w.isUsingKeyboardRef.current||oe.preventDefault()})}),m.createElement(Hf,he({role:"menu","aria-orientation":"vertical","data-state":rL(x.open),"data-radix-menu-content":"",dir:w.dir},_,b,{ref:k,style:{outline:"none",...b.style},onKeyDown:Me(b.onKeyDown,oe=>{const H=oe.target.closest("[data-radix-menu-content]")===oe.currentTarget,J=oe.ctrlKey||oe.altKey||oe.metaKey,N=oe.key.length===1;H&&(oe.key==="Tab"&&oe.preventDefault(),!J&&N&&W(oe.key));const ce=A.current;if(oe.target!==ce||!cge.includes(oe.key))return;oe.preventDefault();const de=R().filter(pe=>!pe.disabled).map(pe=>pe.ref.current);G5.includes(oe.key)&&de.reverse(),jge(de)}),onBlur:Me(e.onBlur,oe=>{oe.currentTarget.contains(oe.target)||(window.clearTimeout(D.current),I.current="")}),onPointerMove:Me(e.onPointerMove,hf(oe=>{const $=oe.target,H=Z.current!==oe.clientX;if(oe.currentTarget.contains($)&&H){const J=oe.clientX>Z.current?"right":"left";K.current=J,Z.current=oe.clientX}}))})))))))}),Sge=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.createElement(Qe.div,he({role:"group"},r,{ref:t}))}),Cge=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.createElement(Qe.div,he({},r,{ref:t}))}),cw="MenuItem",E2="menu.itemSelect",lS=m.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,i=m.useRef(null),s=eh(cw,e.__scopeMenu),a=sS(cw,e.__scopeMenu),l=_t(t,i),c=m.useRef(!1),u=()=>{const f=i.current;if(!n&&f){const h=new CustomEvent(E2,{bubbles:!0,cancelable:!0});f.addEventListener(E2,g=>r==null?void 0:r(g),{once:!0}),ED(f,h),h.defaultPrevented?c.current=!1:s.onClose()}};return m.createElement(Z5,he({},o,{ref:l,disabled:n,onClick:Me(e.onClick,u),onPointerDown:f=>{var h;(h=e.onPointerDown)===null||h===void 0||h.call(e,f),c.current=!0},onPointerUp:Me(e.onPointerUp,f=>{var h;c.current||(h=f.currentTarget)===null||h===void 0||h.click()}),onKeyDown:Me(e.onKeyDown,f=>{const h=a.searchRef.current!=="";n||h&&f.key===" "||lw.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})}))}),Z5=m.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...i}=e,s=sS(cw,n),a=K5(n),l=m.useRef(null),c=_t(t,l),[u,f]=m.useState(!1),[h,g]=m.useState("");return m.useEffect(()=>{const v=l.current;if(v){var b;g(((b=v.textContent)!==null&&b!==void 0?b:"").trim())}},[i.children]),m.createElement(ff.ItemSlot,{scope:n,disabled:r,textValue:o??h},m.createElement(Pw,he({asChild:!0},a,{focusable:!r}),m.createElement(Qe.div,he({role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0},i,{ref:c,onPointerMove:Me(e.onPointerMove,hf(v=>{r?s.onItemLeave(v):(s.onItemEnter(v),v.defaultPrevented||v.currentTarget.focus())})),onPointerLeave:Me(e.onPointerLeave,hf(v=>s.onItemLeave(v))),onFocus:Me(e.onFocus,()=>f(!0)),onBlur:Me(e.onBlur,()=>f(!1))}))))}),Ege=m.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return m.createElement(tL,{scope:e.__scopeMenu,checked:n},m.createElement(lS,he({role:"menuitemcheckbox","aria-checked":Qg(n)?"mixed":n},o,{ref:t,"data-state":cS(n),onSelect:Me(o.onSelect,()=>r==null?void 0:r(Qg(n)?!0:!n),{checkForDefaultPrevented:!1})})))}),Rge="MenuRadioGroup",[Oge,Pge]=Al(Rge,{value:void 0,onValueChange:()=>{}}),Tge=m.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,i=Ln(r);return m.createElement(Oge,{scope:e.__scopeMenu,value:n,onValueChange:i},m.createElement(Sge,he({},o,{ref:t})))}),Dge="MenuRadioItem",$ge=m.forwardRef((e,t)=>{const{value:n,...r}=e,o=Pge(Dge,e.__scopeMenu),i=n===o.value;return m.createElement(tL,{scope:e.__scopeMenu,checked:i},m.createElement(lS,he({role:"menuitemradio","aria-checked":i},r,{ref:t,"data-state":cS(i),onSelect:Me(r.onSelect,()=>{var s;return(s=o.onValueChange)===null||s===void 0?void 0:s.call(o,n)},{checkForDefaultPrevented:!1})})))}),eL="MenuItemIndicator",[tL,Age]=Al(eL,{checked:!1}),kge=m.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,i=Age(eL,n);return m.createElement(er,{present:r||Qg(i.checked)||i.checked===!0},m.createElement(Qe.span,he({},o,{ref:t,"data-state":cS(i.checked)})))}),Mge=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.createElement(Qe.div,he({role:"separator","aria-orientation":"horizontal"},r,{ref:t}))}),Ige="MenuSub",[_ye,nL]=Al(Ige),Hp="MenuSubTrigger",Nge=m.forwardRef((e,t)=>{const n=kl(Hp,e.__scopeMenu),r=eh(Hp,e.__scopeMenu),o=nL(Hp,e.__scopeMenu),i=sS(Hp,e.__scopeMenu),s=m.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=i,c={__scopeMenu:e.__scopeMenu},u=m.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return m.useEffect(()=>u,[u]),m.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),l(null)}},[a,l]),m.createElement(X5,he({asChild:!0},c),m.createElement(Z5,he({id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":rL(n.open)},e,{ref:cs(t,o.onTriggerChange),onClick:f=>{var h;(h=e.onClick)===null||h===void 0||h.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Me(e.onPointerMove,hf(f=>{i.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:Me(e.onPointerLeave,hf(f=>{var h;u();const g=(h=n.content)===null||h===void 0?void 0:h.getBoundingClientRect();if(g){var v;const b=(v=n.content)===null||v===void 0?void 0:v.dataset.side,x=b==="right",w=x?-5:5,_=g[x?"left":"right"],S=g[x?"right":"left"];i.onPointerGraceIntentChange({area:[{x:f.clientX+w,y:f.clientY},{x:_,y:g.top},{x:S,y:g.top},{x:S,y:g.bottom},{x:_,y:g.bottom}],side:b}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(f),f.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:Me(e.onKeyDown,f=>{const h=i.searchRef.current!=="";if(!(e.disabled||h&&f.key===" ")&&uge[r.dir].includes(f.key)){var g;n.onOpenChange(!0),(g=n.content)===null||g===void 0||g.focus(),f.preventDefault()}})})))}),Lge="MenuSubContent",Fge=m.forwardRef((e,t)=>{const n=J5(Qo,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=kl(Qo,e.__scopeMenu),s=eh(Qo,e.__scopeMenu),a=nL(Lge,e.__scopeMenu),l=m.useRef(null),c=_t(t,l);return m.createElement(ff.Provider,{scope:e.__scopeMenu},m.createElement(er,{present:r||i.open},m.createElement(ff.Slot,{scope:e.__scopeMenu},m.createElement(aS,he({id:a.contentId,"aria-labelledby":a.triggerId},o,{ref:c,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{var f;s.isUsingKeyboardRef.current&&((f=l.current)===null||f===void 0||f.focus()),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:Me(e.onFocusOutside,u=>{u.target!==a.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Me(e.onEscapeKeyDown,u=>{s.onClose(),u.preventDefault()}),onKeyDown:Me(e.onKeyDown,u=>{const f=u.currentTarget.contains(u.target),h=dge[s.dir].includes(u.key);if(f&&h){var g;i.onOpenChange(!1),(g=a.trigger)===null||g===void 0||g.focus(),u.preventDefault()}})})))))});function rL(e){return e?"open":"closed"}function Qg(e){return e==="indeterminate"}function cS(e){return Qg(e)?"indeterminate":e?"checked":"unchecked"}function jge(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function zge(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Bge(e,t,n){const o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=zge(e,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));const l=s.find(c=>c.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function Vge(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const a=t[i].x,l=t[i].y,c=t[s].x,u=t[s].y;l>r!=u>r&&n<(c-a)*(r-l)/(u-l)+a&&(o=!o)}return o}function Hge(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Vge(n,t)}function hf(e){return t=>t.pointerType==="mouse"?e(t):void 0}const Wge=mge,Uge=X5,qge=bge,Gge=xge,Yge=Cge,Kge=lS,Xge=Ege,Qge=Tge,Jge=$ge,Zge=kge,eme=Mge,tme=Nge,nme=Fge,oL="DropdownMenu",[rme,Sye]=Zn(oL,[Y5]),ho=Y5(),[ome,iL]=rme(oL),ime=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:i,onOpenChange:s,modal:a=!0}=e,l=ho(t),c=m.useRef(null),[u=!1,f]=xr({prop:o,defaultProp:i,onChange:s});return m.createElement(ome,{scope:t,triggerId:Jo(),triggerRef:c,contentId:Jo(),open:u,onOpenChange:f,onOpenToggle:m.useCallback(()=>f(h=>!h),[f]),modal:a},m.createElement(Wge,he({},l,{open:u,onOpenChange:f,dir:r,modal:a}),n))},sme="DropdownMenuTrigger",ame=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,i=iL(sme,n),s=ho(n);return m.createElement(Uge,he({asChild:!0},s),m.createElement(Qe.button,he({type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r},o,{ref:cs(t,i.triggerRef),onPointerDown:Me(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(i.onOpenToggle(),i.open||a.preventDefault())}),onKeyDown:Me(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&i.onOpenToggle(),a.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})))}),lme=e=>{const{__scopeDropdownMenu:t,...n}=e,r=ho(t);return m.createElement(qge,he({},r,n))},cme="DropdownMenuContent",ume=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=iL(cme,n),i=ho(n),s=m.useRef(!1);return m.createElement(Gge,he({id:o.contentId,"aria-labelledby":o.triggerId},i,r,{ref:t,onCloseAutoFocus:Me(e.onCloseAutoFocus,a=>{var l;s.current||(l=o.triggerRef.current)===null||l===void 0||l.focus(),s.current=!1,a.preventDefault()}),onInteractOutside:Me(e.onInteractOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;(!o.modal||u)&&(s.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}}))}),dme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(Yge,he({},o,r,{ref:t}))}),fme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(Kge,he({},o,r,{ref:t}))}),hme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(Xge,he({},o,r,{ref:t}))}),pme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(Qge,he({},o,r,{ref:t}))}),gme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(Jge,he({},o,r,{ref:t}))}),mme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(Zge,he({},o,r,{ref:t}))}),vme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(eme,he({},o,r,{ref:t}))}),bme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(tme,he({},o,r,{ref:t}))}),yme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(nme,he({},o,r,{ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}}))}),xme=ime,wme=ame,_me=lme,sL=ume,aL=dme,lL=fme,cL=hme,Sme=pme,uL=gme,dL=mme,fL=vme,hL=bme,pL=yme,Cme=xme,Eme=wme,Rme=Sme,Ome=V.forwardRef(({className:e,inset:t,children:n,...r},o)=>O.jsxs(hL,{ref:o,className:Ce("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...r,children:[n,O.jsx(S1,{className:"ml-auto h-4 w-4"})]}));Ome.displayName=hL.displayName;const Pme=V.forwardRef(({className:e,...t},n)=>O.jsx(pL,{ref:n,className:Ce("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));Pme.displayName=pL.displayName;const gL=V.forwardRef(({className:e,sideOffset:t=4,...n},r)=>O.jsx(_me,{children:O.jsx(au,{children:O.jsx(sL,{ref:r,sideOffset:t,className:Ce("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})})}));gL.displayName=sL.displayName;const Tme=V.forwardRef(({className:e,inset:t,...n},r)=>O.jsx(lL,{ref:r,className:Ce("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));Tme.displayName=lL.displayName;const Dme=V.forwardRef(({className:e,children:t,checked:n,...r},o)=>O.jsxs(cL,{ref:o,className:Ce("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[O.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:O.jsx(dL,{children:O.jsx(Ff,{className:"h-4 w-4"})})}),t]}));Dme.displayName=cL.displayName;const mL=V.forwardRef(({className:e,children:t,...n},r)=>O.jsxs(uL,{ref:r,className:Ce("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[O.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:O.jsx(dL,{children:O.jsx(IA,{className:"h-2 w-2 fill-current"})})}),t]}));mL.displayName=uL.displayName;const vL=V.forwardRef(({className:e,inset:t,...n},r)=>O.jsx(aL,{ref:r,className:Ce("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));vL.displayName=aL.displayName;const bL=V.forwardRef(({className:e,...t},n)=>O.jsx(fL,{ref:n,className:Ce("-mx-1 my-1 h-px bg-muted",e),...t}));bL.displayName=fL.displayName;function $me(e){var t;return{...e,sheets:(t=e==null?void 0:e.sheets)==null?void 0:t.map(n=>{var r;return{...n,frames:(r=n.frames)==null?void 0:r.map(o=>{var i;return{...o,cards:(i=o.cards)==null?void 0:i.map(s=>yL(s))}})}})}}function yL(e){var t,n,r,o;return{...e,cfg:{...e.cfg,data:{...(t=e.cfg)==null?void 0:t.data,labels:[],datasets:(o=(r=(n=e.cfg)==null?void 0:n.data)==null?void 0:r.datasets)==null?void 0:o.map(i=>({...i,data:[]}))}},customCfg:Ame(e.customCfg),data:[]}}function Ame(e){var t,n;return e?{...e,data:{...e==null?void 0:e.data,labels:[],datasets:(n=(t=e==null?void 0:e.data)==null?void 0:t.datasets)==null?void 0:n.map(r=>({...r,data:[]}))}}:null}function xL(e){return`semaphor:bookmark:${e}`}const kme=p5,Mme=g5,Ime=m5,wL=V.forwardRef(({className:e,...t},n)=>O.jsx(eS,{ref:n,className:Ce("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));wL.displayName=eS.displayName;const _L=V.forwardRef(({className:e,children:t,...n},r)=>O.jsx(Ime,{children:O.jsxs(au,{children:[O.jsx(wL,{}),O.jsxs(tS,{ref:r,className:Ce("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,O.jsxs(oS,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[O.jsx(Tm,{className:"h-4 w-4"}),O.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}));_L.displayName=tS.displayName;const SL=({className:e,...t})=>O.jsx("div",{className:Ce("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});SL.displayName="DialogHeader";const CL=({className:e,...t})=>O.jsx("div",{className:Ce("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});CL.displayName="DialogFooter";const EL=V.forwardRef(({className:e,...t},n)=>O.jsx(nS,{ref:n,className:Ce("text-lg font-semibold leading-none tracking-tight",e),...t}));EL.displayName=nS.displayName;const RL=V.forwardRef(({className:e,...t},n)=>O.jsx(rS,{ref:n,className:Ce("text-sm text-muted-foreground",e),...t}));RL.displayName=rS.displayName;const OL="Checkbox",[Nme,Cye]=Zn(OL),[Lme,Fme]=Nme(OL),jme=m.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:l="on",onCheckedChange:c,...u}=e,[f,h]=m.useState(null),g=_t(t,S=>h(S)),v=m.useRef(!1),b=f?!!f.closest("form"):!0,[x=!1,w]=xr({prop:o,defaultProp:i,onChange:c}),_=m.useRef(x);return m.useEffect(()=>{const S=f==null?void 0:f.form;if(S){const R=()=>w(_.current);return S.addEventListener("reset",R),()=>S.removeEventListener("reset",R)}},[f,w]),m.createElement(Lme,{scope:n,state:x,disabled:a},m.createElement(Qe.button,he({type:"button",role:"checkbox","aria-checked":dl(x)?"mixed":x,"aria-required":s,"data-state":PL(x),"data-disabled":a?"":void 0,disabled:a,value:l},u,{ref:g,onKeyDown:Me(e.onKeyDown,S=>{S.key==="Enter"&&S.preventDefault()}),onClick:Me(e.onClick,S=>{w(R=>dl(R)?!0:!R),b&&(v.current=S.isPropagationStopped(),v.current||S.stopPropagation())})})),b&&m.createElement(Vme,{control:f,bubbles:!v.current,name:r,value:l,checked:x,required:s,disabled:a,style:{transform:"translateX(-100%)"}}))}),zme="CheckboxIndicator",Bme=m.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=Fme(zme,n);return m.createElement(er,{present:r||dl(i.state)||i.state===!0},m.createElement(Qe.span,he({"data-state":PL(i.state),"data-disabled":i.disabled?"":void 0},o,{ref:t,style:{pointerEvents:"none",...e.style}})))}),Vme=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,i=m.useRef(null),s=Nm(n),a=Am(t);return m.useEffect(()=>{const l=i.current,c=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(c,"checked").set;if(s!==n&&f){const h=new Event("click",{bubbles:r});l.indeterminate=dl(n),f.call(l,dl(n)?!1:n),l.dispatchEvent(h)}},[s,n,r]),m.createElement("input",he({type:"checkbox","aria-hidden":!0,defaultChecked:dl(n)?!1:n},o,{tabIndex:-1,ref:i,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function dl(e){return e==="indeterminate"}function PL(e){return dl(e)?"indeterminate":e?"checked":"unchecked"}const TL=jme,Hme=Bme,DL=V.forwardRef(({className:e,...t},n)=>O.jsx(TL,{ref:n,className:Ce("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:O.jsx(Hme,{className:Ce("flex items-center justify-center text-current"),children:O.jsx(Ff,{className:"h-4 w-4"})})}));DL.displayName=TL.displayName;const $L=m.forwardRef(({className:e,...t},n)=>O.jsx("div",{role:"editor-panel",ref:n,className:Ce("flex grow h-full",e),...t}));$L.displayName="EditorPanel";const AL=m.forwardRef(({className:e,...t},n)=>O.jsx("div",{ref:n,className:Ce(" flex flex-col space-y-2 w-[270px]",e),...t}));AL.displayName="EditorAside";const kL=m.forwardRef(({className:e,...t},n)=>O.jsx("div",{ref:n,className:Ce(" grow",e),...t}));kL.displayName="EditorMain";function Wme(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function R2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function O2(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?R2(Object(n),!0).forEach(function(r){Wme(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R2(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ume(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function qme(e,t){if(e==null)return{};var n=Ume(e,t),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)r=i[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Gme(e,t){return Yme(e)||Kme(e,t)||Xme(e,t)||Qme()}function Yme(e){if(Array.isArray(e))return e}function Kme(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var n=[],r=!0,o=!1,i=void 0;try{for(var s=e[Symbol.iterator](),a;!(r=(a=s.next()).done)&&(n.push(a.value),!(t&&n.length===t));r=!0);}catch(l){o=!0,i=l}finally{try{!r&&s.return!=null&&s.return()}finally{if(o)throw i}}return n}}function Xme(e,t){if(e){if(typeof e=="string")return P2(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return P2(e,t)}}function P2(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Qme(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
425
+ For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return V.useEffect(()=>{var r;document.getElementById((r=e.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},ege=b5,tge=y5,T5=x5,D5=w5,$5=R5,A5=P5,k5=S5,M5=E5;const nge=ege,rge=tge,I5=V.forwardRef(({className:e,...t},n)=>O.jsx(T5,{className:Ce("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));I5.displayName=T5.displayName;const N5=V.forwardRef(({className:e,...t},n)=>O.jsx(rge,{children:O.jsxs(au,{children:[O.jsx(I5,{}),O.jsx(D5,{ref:n,className:Ce("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]})}));N5.displayName=D5.displayName;const L5=({className:e,...t})=>O.jsx("div",{className:Ce("flex flex-col space-y-2 text-center sm:text-left",e),...t});L5.displayName="AlertDialogHeader";const F5=({className:e,...t})=>O.jsx("div",{className:Ce("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});F5.displayName="AlertDialogFooter";const j5=V.forwardRef(({className:e,...t},n)=>O.jsx(k5,{ref:n,className:Ce("text-lg font-semibold",e),...t}));j5.displayName=k5.displayName;const z5=V.forwardRef(({className:e,...t},n)=>O.jsx(M5,{ref:n,className:Ce("text-sm text-muted-foreground",e),...t}));z5.displayName=M5.displayName;const B5=V.forwardRef(({className:e,...t},n)=>O.jsx($5,{ref:n,className:Ce(Vd(),e),...t}));B5.displayName=$5.displayName;const V5=V.forwardRef(({className:e,...t},n)=>O.jsx(A5,{ref:n,className:Ce(Vd({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));V5.displayName=A5.displayName;function oge({open:e,setOpen:t}){const n=ke(i=>i.selectedSheetId),{deleteSheet:r}=Mo();function o(){n&&(r(n),t(!1))}return O.jsx(nge,{open:e,onOpenChange:t,children:O.jsxs(N5,{children:[O.jsxs(L5,{children:[O.jsx(j5,{children:"Delete Sheet"}),O.jsx(z5,{children:"Are you sure you want to delete this sheet along with all its cards? This action cannot be undone."})]}),O.jsxs(F5,{children:[O.jsx(V5,{children:"Cancel"}),O.jsx(B5,{onClick:o,children:"Delete"})]})]})})}function H5(){var b,x;const[e,t]=m.useState(!1),n=ke(w=>{var _;return(_=w.dashboard)==null?void 0:_.sheets}),{showAssistant:r}=ma(),o=m.useRef(null),[i,s]=m.useState(!1),a=ke(w=>w.isDashboardEditing),l=ke(w=>w.themeStyle);ke(w=>w.isVisualEditing);const c=ke(w=>w.selectedSheetId),{setSelectedSheetId:u,setSheetTitle:f,addSheet:h}=Mo();if(!n)return null;function g(w){var _,S;w?((_=o.current)==null||_.resize(35),s(!0)):(s(!1),(S=o.current)==null||S.resize(0))}function v(){const w={id:la(),title:"New Sheet"};h(w)}return O.jsxs(ID,{role:"dashboard-tabs-container",className:Ce("relative flex grow flex-col",l==null?void 0:l.dashboardTabsContainer),onValueChange:w=>{u(w)},value:c||n[0].id,children:[O.jsx("div",{children:(n.length>1||a)&&O.jsxs(Dw,{role:"tab-list",className:"flex h-11 items-center justify-start gap-2 rounded-none bg-transparent px-2.5 py-3",children:[n==null?void 0:n.map(w=>{var _,S;return O.jsx(is,{text:w.title,onSave:R=>f(w.id,R),children:O.jsxs($w,{style:{borderRadius:(S=(_=l==null?void 0:l.chart)==null?void 0:_.options)==null?void 0:S.borderRadius},onClick:()=>u(w.id),className:"flex items-center gap-1 rounded-none border px-2 py-1",value:w.id,children:[w.title,a&&c===w.id&&n.length>1&&O.jsx(Tm,{className:"ml-1 size-3",onClick:()=>t(!0)})]})},w.id)}),a&&O.jsx("div",{style:{borderRadius:(x=(b=l==null?void 0:l.chart)==null?void 0:b.options)==null?void 0:x.borderRadius},className:"flex h-7 items-center justify-center border-none bg-muted p-2 hover:cursor-pointer dark:border-l-background",onClick:v,children:O.jsx(E1,{className:"size-3"})})]})}),O.jsxs(FN,{className:"grow",direction:"horizontal",children:[O.jsx(ow,{children:O.jsx("div",{style:{},children:n==null?void 0:n.map(w=>O.jsx(Aw,{className:Ce("mt-0",{"bg-muted":(l==null?void 0:l.canvasTheme)==="muted"||!(l!=null&&l.canvasTheme)}),value:w.id,children:O.jsx(Cae,{})},w.id))})}),r===!0&&O.jsxs(O.Fragment,{children:[O.jsx(jhe,{open:i,onTabClick:g,withHandle:!0}),O.jsx(ow,{onResize:w=>{w<1?s(!1):i||s(!0)},defaultSize:0,ref:o,children:O.jsx(bhe,{})})]})]}),O.jsx(oge,{open:e,setOpen:t})]})}function W5({children:e}){return O.jsx(mB,{defaultTheme:"system",storageKey:"vite-ui-theme",children:O.jsx(OJ,{delayDuration:0,children:e})})}function U5(e){return O.jsx(ck,{dashboardProps:e,children:O.jsx(W5,{children:O.jsx(SD,{...e,children:O.jsx(H5,{})})})})}const q5=m.forwardRef((e,t)=>{const{children:n,...r}=e,o=m.Children.toArray(n),i=o.find(sge);if(i){const s=i.props.children,a=o.map(l=>l===i?m.Children.count(s)>1?m.Children.only(null):m.isValidElement(s)?s.props.children:null:l);return m.createElement(aw,he({},r,{ref:t}),m.isValidElement(s)?m.cloneElement(s,void 0,a):null)}return m.createElement(aw,he({},r,{ref:t}),n)});q5.displayName="Slot";const aw=m.forwardRef((e,t)=>{const{children:n,...r}=e;return m.isValidElement(n)?m.cloneElement(n,{...age(r,n.props),ref:t?cs(t,n.ref):n.ref}):m.Children.count(n)>1?m.Children.only(null):null});aw.displayName="SlotClone";const ige=({children:e})=>m.createElement(m.Fragment,null,e);function sge(e){return m.isValidElement(e)&&e.type===ige}function age(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}const lw=["Enter"," "],lge=["ArrowDown","PageUp","Home"],G5=["ArrowUp","PageDown","End"],cge=[...lge,...G5],uge={ltr:[...lw,"ArrowRight"],rtl:[...lw,"ArrowLeft"]},dge={ltr:["ArrowLeft"],rtl:["ArrowRight"]},lv="Menu",[ff,fge,hge]=cm(lv),[Al,Y5]=Zn(lv,[hge,Ti,ou]),iS=Ti(),K5=ou(),[pge,kl]=Al(lv),[gge,eh]=Al(lv),mge=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:i,modal:s=!0}=e,a=iS(t),[l,c]=m.useState(null),u=m.useRef(!1),f=Ln(i),h=_l(o);return m.useEffect(()=>{const g=()=>{u.current=!0,document.addEventListener("pointerdown",v,{capture:!0,once:!0}),document.addEventListener("pointermove",v,{capture:!0,once:!0})},v=()=>u.current=!1;return document.addEventListener("keydown",g,{capture:!0}),()=>{document.removeEventListener("keydown",g,{capture:!0}),document.removeEventListener("pointerdown",v,{capture:!0}),document.removeEventListener("pointermove",v,{capture:!0})}},[]),m.createElement(Bf,a,m.createElement(pge,{scope:t,open:n,onOpenChange:f,content:l,onContentChange:c},m.createElement(gge,{scope:t,onClose:m.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:u,dir:h,modal:s},r)))},X5=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=iS(n);return m.createElement(Vf,he({},o,r,{ref:t}))}),Q5="MenuPortal",[vge,J5]=Al(Q5,{forceMount:void 0}),bge=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,i=kl(Q5,t);return m.createElement(vge,{scope:t,forceMount:n},m.createElement(er,{present:n||i.open},m.createElement(k1,{asChild:!0,container:o},r)))},Qo="MenuContent",[yge,sS]=Al(Qo),xge=m.forwardRef((e,t)=>{const n=J5(Qo,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=kl(Qo,e.__scopeMenu),s=eh(Qo,e.__scopeMenu);return m.createElement(ff.Provider,{scope:e.__scopeMenu},m.createElement(er,{present:r||i.open},m.createElement(ff.Slot,{scope:e.__scopeMenu},s.modal?m.createElement(wge,he({},o,{ref:t})):m.createElement(_ge,he({},o,{ref:t})))))}),wge=m.forwardRef((e,t)=>{const n=kl(Qo,e.__scopeMenu),r=m.useRef(null),o=_t(t,r);return m.useEffect(()=>{const i=r.current;if(i)return Lm(i)},[]),m.createElement(aS,he({},e,{ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Me(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)}))}),_ge=m.forwardRef((e,t)=>{const n=kl(Qo,e.__scopeMenu);return m.createElement(aS,he({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)}))}),aS=m.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:h,onDismiss:g,disableOutsideScroll:v,...b}=e,x=kl(Qo,n),w=eh(Qo,n),_=iS(n),S=K5(n),R=fge(n),[C,P]=m.useState(null),A=m.useRef(null),k=_t(t,A,x.onContentChange),D=m.useRef(0),I=m.useRef(""),F=m.useRef(0),B=m.useRef(null),K=m.useRef("right"),Z=m.useRef(0),z=v?n_:m.Fragment,Q=v?{as:q5,allowPinchZoom:!0}:void 0,W=oe=>{var $,H;const J=I.current+oe,N=R().filter(te=>!te.disabled),ce=document.activeElement,le=($=N.find(te=>te.ref.current===ce))===null||$===void 0?void 0:$.textValue,de=N.map(te=>te.textValue),pe=Bge(de,J,le),ie=(H=N.find(te=>te.textValue===pe))===null||H===void 0?void 0:H.ref.current;(function te(ae){I.current=ae,window.clearTimeout(D.current),ae!==""&&(D.current=window.setTimeout(()=>te(""),1e3))})(J),ie&&setTimeout(()=>ie.focus())};m.useEffect(()=>()=>window.clearTimeout(D.current),[]),J1();const Y=m.useCallback(oe=>{var $,H;return K.current===(($=B.current)===null||$===void 0?void 0:$.side)&&Hge(oe,(H=B.current)===null||H===void 0?void 0:H.area)},[]);return m.createElement(yge,{scope:n,searchRef:I,onItemEnter:m.useCallback(oe=>{Y(oe)&&oe.preventDefault()},[Y]),onItemLeave:m.useCallback(oe=>{var $;Y(oe)||(($=A.current)===null||$===void 0||$.focus(),P(null))},[Y]),onTriggerLeave:m.useCallback(oe=>{Y(oe)&&oe.preventDefault()},[Y]),pointerGraceTimerRef:F,onPointerGraceIntentChange:m.useCallback(oe=>{B.current=oe},[])},m.createElement(z,Q,m.createElement(Z1,{asChild:!0,trapped:o,onMountAutoFocus:Me(i,oe=>{var $;oe.preventDefault(),($=A.current)===null||$===void 0||$.focus()}),onUnmountAutoFocus:s},m.createElement(jf,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:h,onDismiss:g},m.createElement(Ow,he({asChild:!0},S,{dir:w.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:P,onEntryFocus:Me(l,oe=>{w.isUsingKeyboardRef.current||oe.preventDefault()})}),m.createElement(Hf,he({role:"menu","aria-orientation":"vertical","data-state":rL(x.open),"data-radix-menu-content":"",dir:w.dir},_,b,{ref:k,style:{outline:"none",...b.style},onKeyDown:Me(b.onKeyDown,oe=>{const H=oe.target.closest("[data-radix-menu-content]")===oe.currentTarget,J=oe.ctrlKey||oe.altKey||oe.metaKey,N=oe.key.length===1;H&&(oe.key==="Tab"&&oe.preventDefault(),!J&&N&&W(oe.key));const ce=A.current;if(oe.target!==ce||!cge.includes(oe.key))return;oe.preventDefault();const de=R().filter(pe=>!pe.disabled).map(pe=>pe.ref.current);G5.includes(oe.key)&&de.reverse(),jge(de)}),onBlur:Me(e.onBlur,oe=>{oe.currentTarget.contains(oe.target)||(window.clearTimeout(D.current),I.current="")}),onPointerMove:Me(e.onPointerMove,hf(oe=>{const $=oe.target,H=Z.current!==oe.clientX;if(oe.currentTarget.contains($)&&H){const J=oe.clientX>Z.current?"right":"left";K.current=J,Z.current=oe.clientX}}))})))))))}),Sge=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.createElement(Qe.div,he({role:"group"},r,{ref:t}))}),Cge=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.createElement(Qe.div,he({},r,{ref:t}))}),cw="MenuItem",E2="menu.itemSelect",lS=m.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,i=m.useRef(null),s=eh(cw,e.__scopeMenu),a=sS(cw,e.__scopeMenu),l=_t(t,i),c=m.useRef(!1),u=()=>{const f=i.current;if(!n&&f){const h=new CustomEvent(E2,{bubbles:!0,cancelable:!0});f.addEventListener(E2,g=>r==null?void 0:r(g),{once:!0}),ED(f,h),h.defaultPrevented?c.current=!1:s.onClose()}};return m.createElement(Z5,he({},o,{ref:l,disabled:n,onClick:Me(e.onClick,u),onPointerDown:f=>{var h;(h=e.onPointerDown)===null||h===void 0||h.call(e,f),c.current=!0},onPointerUp:Me(e.onPointerUp,f=>{var h;c.current||(h=f.currentTarget)===null||h===void 0||h.click()}),onKeyDown:Me(e.onKeyDown,f=>{const h=a.searchRef.current!=="";n||h&&f.key===" "||lw.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})}))}),Z5=m.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...i}=e,s=sS(cw,n),a=K5(n),l=m.useRef(null),c=_t(t,l),[u,f]=m.useState(!1),[h,g]=m.useState("");return m.useEffect(()=>{const v=l.current;if(v){var b;g(((b=v.textContent)!==null&&b!==void 0?b:"").trim())}},[i.children]),m.createElement(ff.ItemSlot,{scope:n,disabled:r,textValue:o??h},m.createElement(Pw,he({asChild:!0},a,{focusable:!r}),m.createElement(Qe.div,he({role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0},i,{ref:c,onPointerMove:Me(e.onPointerMove,hf(v=>{r?s.onItemLeave(v):(s.onItemEnter(v),v.defaultPrevented||v.currentTarget.focus())})),onPointerLeave:Me(e.onPointerLeave,hf(v=>s.onItemLeave(v))),onFocus:Me(e.onFocus,()=>f(!0)),onBlur:Me(e.onBlur,()=>f(!1))}))))}),Ege=m.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return m.createElement(tL,{scope:e.__scopeMenu,checked:n},m.createElement(lS,he({role:"menuitemcheckbox","aria-checked":Qg(n)?"mixed":n},o,{ref:t,"data-state":cS(n),onSelect:Me(o.onSelect,()=>r==null?void 0:r(Qg(n)?!0:!n),{checkForDefaultPrevented:!1})})))}),Rge="MenuRadioGroup",[Oge,Pge]=Al(Rge,{value:void 0,onValueChange:()=>{}}),Tge=m.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,i=Ln(r);return m.createElement(Oge,{scope:e.__scopeMenu,value:n,onValueChange:i},m.createElement(Sge,he({},o,{ref:t})))}),Dge="MenuRadioItem",$ge=m.forwardRef((e,t)=>{const{value:n,...r}=e,o=Pge(Dge,e.__scopeMenu),i=n===o.value;return m.createElement(tL,{scope:e.__scopeMenu,checked:i},m.createElement(lS,he({role:"menuitemradio","aria-checked":i},r,{ref:t,"data-state":cS(i),onSelect:Me(r.onSelect,()=>{var s;return(s=o.onValueChange)===null||s===void 0?void 0:s.call(o,n)},{checkForDefaultPrevented:!1})})))}),eL="MenuItemIndicator",[tL,Age]=Al(eL,{checked:!1}),kge=m.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,i=Age(eL,n);return m.createElement(er,{present:r||Qg(i.checked)||i.checked===!0},m.createElement(Qe.span,he({},o,{ref:t,"data-state":cS(i.checked)})))}),Mge=m.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return m.createElement(Qe.div,he({role:"separator","aria-orientation":"horizontal"},r,{ref:t}))}),Ige="MenuSub",[_ye,nL]=Al(Ige),Hp="MenuSubTrigger",Nge=m.forwardRef((e,t)=>{const n=kl(Hp,e.__scopeMenu),r=eh(Hp,e.__scopeMenu),o=nL(Hp,e.__scopeMenu),i=sS(Hp,e.__scopeMenu),s=m.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=i,c={__scopeMenu:e.__scopeMenu},u=m.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return m.useEffect(()=>u,[u]),m.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),l(null)}},[a,l]),m.createElement(X5,he({asChild:!0},c),m.createElement(Z5,he({id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":rL(n.open)},e,{ref:cs(t,o.onTriggerChange),onClick:f=>{var h;(h=e.onClick)===null||h===void 0||h.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Me(e.onPointerMove,hf(f=>{i.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:Me(e.onPointerLeave,hf(f=>{var h;u();const g=(h=n.content)===null||h===void 0?void 0:h.getBoundingClientRect();if(g){var v;const b=(v=n.content)===null||v===void 0?void 0:v.dataset.side,x=b==="right",w=x?-5:5,_=g[x?"left":"right"],S=g[x?"right":"left"];i.onPointerGraceIntentChange({area:[{x:f.clientX+w,y:f.clientY},{x:_,y:g.top},{x:S,y:g.top},{x:S,y:g.bottom},{x:_,y:g.bottom}],side:b}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(f),f.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:Me(e.onKeyDown,f=>{const h=i.searchRef.current!=="";if(!(e.disabled||h&&f.key===" ")&&uge[r.dir].includes(f.key)){var g;n.onOpenChange(!0),(g=n.content)===null||g===void 0||g.focus(),f.preventDefault()}})})))}),Lge="MenuSubContent",Fge=m.forwardRef((e,t)=>{const n=J5(Qo,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=kl(Qo,e.__scopeMenu),s=eh(Qo,e.__scopeMenu),a=nL(Lge,e.__scopeMenu),l=m.useRef(null),c=_t(t,l);return m.createElement(ff.Provider,{scope:e.__scopeMenu},m.createElement(er,{present:r||i.open},m.createElement(ff.Slot,{scope:e.__scopeMenu},m.createElement(aS,he({id:a.contentId,"aria-labelledby":a.triggerId},o,{ref:c,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{var f;s.isUsingKeyboardRef.current&&((f=l.current)===null||f===void 0||f.focus()),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:Me(e.onFocusOutside,u=>{u.target!==a.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Me(e.onEscapeKeyDown,u=>{s.onClose(),u.preventDefault()}),onKeyDown:Me(e.onKeyDown,u=>{const f=u.currentTarget.contains(u.target),h=dge[s.dir].includes(u.key);if(f&&h){var g;i.onOpenChange(!1),(g=a.trigger)===null||g===void 0||g.focus(),u.preventDefault()}})})))))});function rL(e){return e?"open":"closed"}function Qg(e){return e==="indeterminate"}function cS(e){return Qg(e)?"indeterminate":e?"checked":"unchecked"}function jge(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function zge(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Bge(e,t,n){const o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=zge(e,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));const l=s.find(c=>c.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function Vge(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const a=t[i].x,l=t[i].y,c=t[s].x,u=t[s].y;l>r!=u>r&&n<(c-a)*(r-l)/(u-l)+a&&(o=!o)}return o}function Hge(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Vge(n,t)}function hf(e){return t=>t.pointerType==="mouse"?e(t):void 0}const Wge=mge,Uge=X5,qge=bge,Gge=xge,Yge=Cge,Kge=lS,Xge=Ege,Qge=Tge,Jge=$ge,Zge=kge,eme=Mge,tme=Nge,nme=Fge,oL="DropdownMenu",[rme,Sye]=Zn(oL,[Y5]),ho=Y5(),[ome,iL]=rme(oL),ime=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:i,onOpenChange:s,modal:a=!0}=e,l=ho(t),c=m.useRef(null),[u=!1,f]=xr({prop:o,defaultProp:i,onChange:s});return m.createElement(ome,{scope:t,triggerId:Jo(),triggerRef:c,contentId:Jo(),open:u,onOpenChange:f,onOpenToggle:m.useCallback(()=>f(h=>!h),[f]),modal:a},m.createElement(Wge,he({},l,{open:u,onOpenChange:f,dir:r,modal:a}),n))},sme="DropdownMenuTrigger",ame=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,i=iL(sme,n),s=ho(n);return m.createElement(Uge,he({asChild:!0},s),m.createElement(Qe.button,he({type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r},o,{ref:cs(t,i.triggerRef),onPointerDown:Me(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(i.onOpenToggle(),i.open||a.preventDefault())}),onKeyDown:Me(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&i.onOpenToggle(),a.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})))}),lme=e=>{const{__scopeDropdownMenu:t,...n}=e,r=ho(t);return m.createElement(qge,he({},r,n))},cme="DropdownMenuContent",ume=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=iL(cme,n),i=ho(n),s=m.useRef(!1);return m.createElement(Gge,he({id:o.contentId,"aria-labelledby":o.triggerId},i,r,{ref:t,onCloseAutoFocus:Me(e.onCloseAutoFocus,a=>{var l;s.current||(l=o.triggerRef.current)===null||l===void 0||l.focus(),s.current=!1,a.preventDefault()}),onInteractOutside:Me(e.onInteractOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;(!o.modal||u)&&(s.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}}))}),dme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(Yge,he({},o,r,{ref:t}))}),fme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(Kge,he({},o,r,{ref:t}))}),hme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(Xge,he({},o,r,{ref:t}))}),pme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(Qge,he({},o,r,{ref:t}))}),gme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(Jge,he({},o,r,{ref:t}))}),mme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(Zge,he({},o,r,{ref:t}))}),vme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(eme,he({},o,r,{ref:t}))}),bme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(tme,he({},o,r,{ref:t}))}),yme=m.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ho(n);return m.createElement(nme,he({},o,r,{ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}}))}),xme=ime,wme=ame,_me=lme,sL=ume,aL=dme,lL=fme,cL=hme,Sme=pme,uL=gme,dL=mme,fL=vme,hL=bme,pL=yme,Cme=xme,Eme=wme,Rme=Sme,Ome=V.forwardRef(({className:e,inset:t,children:n,...r},o)=>O.jsxs(hL,{ref:o,className:Ce("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...r,children:[n,O.jsx(S1,{className:"ml-auto h-4 w-4"})]}));Ome.displayName=hL.displayName;const Pme=V.forwardRef(({className:e,...t},n)=>O.jsx(pL,{ref:n,className:Ce("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));Pme.displayName=pL.displayName;const gL=V.forwardRef(({className:e,sideOffset:t=4,...n},r)=>O.jsx(_me,{children:O.jsx(au,{children:O.jsx(sL,{ref:r,sideOffset:t,className:Ce("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})})}));gL.displayName=sL.displayName;const Tme=V.forwardRef(({className:e,inset:t,...n},r)=>O.jsx(lL,{ref:r,className:Ce("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));Tme.displayName=lL.displayName;const Dme=V.forwardRef(({className:e,children:t,checked:n,...r},o)=>O.jsxs(cL,{ref:o,className:Ce("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[O.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:O.jsx(dL,{children:O.jsx(Ff,{className:"h-4 w-4"})})}),t]}));Dme.displayName=cL.displayName;const mL=V.forwardRef(({className:e,children:t,...n},r)=>O.jsxs(uL,{ref:r,className:Ce("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[O.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:O.jsx(dL,{children:O.jsx(IA,{className:"h-2 w-2 fill-current"})})}),t]}));mL.displayName=uL.displayName;const vL=V.forwardRef(({className:e,inset:t,...n},r)=>O.jsx(aL,{ref:r,className:Ce("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));vL.displayName=aL.displayName;const bL=V.forwardRef(({className:e,...t},n)=>O.jsx(fL,{ref:n,className:Ce("-mx-1 my-1 h-px bg-muted",e),...t}));bL.displayName=fL.displayName;function $me(e){var t;return{...e,sheets:(t=e==null?void 0:e.sheets)==null?void 0:t.map(n=>{var r;return{...n,frames:(r=n.frames)==null?void 0:r.map(o=>{var i;return{...o,cards:(i=o.cards)==null?void 0:i.map(s=>yL(s))}})}})}}function yL(e){var t,n,r,o;return{...e,cfg:{...e.cfg,data:{...(t=e.cfg)==null?void 0:t.data,labels:[],datasets:(o=(r=(n=e.cfg)==null?void 0:n.data)==null?void 0:r.datasets)==null?void 0:o.map(i=>({...i,data:[]}))}},customCfg:Ame(e.customCfg),data:[]}}function Ame(e){var t,n;return e?{...e,data:{...e==null?void 0:e.data,labels:[],datasets:(n=(t=e==null?void 0:e.data)==null?void 0:t.datasets)==null?void 0:n.map(r=>({...r,data:[]}))}}:null}function xL(e){return`semaphor:bookmark:${e}`}const kme=p5,Mme=g5,Ime=m5,wL=V.forwardRef(({className:e,...t},n)=>O.jsx(eS,{ref:n,className:Ce("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));wL.displayName=eS.displayName;const _L=V.forwardRef(({className:e,children:t,...n},r)=>O.jsx(Ime,{children:O.jsxs(au,{children:[O.jsx(wL,{}),O.jsxs(tS,{ref:r,className:Ce("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,O.jsxs(oS,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[O.jsx(Tm,{className:"h-4 w-4"}),O.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}));_L.displayName=tS.displayName;const SL=({className:e,...t})=>O.jsx("div",{className:Ce("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});SL.displayName="DialogHeader";const CL=({className:e,...t})=>O.jsx("div",{className:Ce("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});CL.displayName="DialogFooter";const EL=V.forwardRef(({className:e,...t},n)=>O.jsx(nS,{ref:n,className:Ce("text-lg font-semibold leading-none tracking-tight",e),...t}));EL.displayName=nS.displayName;const RL=V.forwardRef(({className:e,...t},n)=>O.jsx(rS,{ref:n,className:Ce("text-sm text-muted-foreground",e),...t}));RL.displayName=rS.displayName;const OL="Checkbox",[Nme,Cye]=Zn(OL),[Lme,Fme]=Nme(OL),jme=m.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:l="on",onCheckedChange:c,...u}=e,[f,h]=m.useState(null),g=_t(t,S=>h(S)),v=m.useRef(!1),b=f?!!f.closest("form"):!0,[x=!1,w]=xr({prop:o,defaultProp:i,onChange:c}),_=m.useRef(x);return m.useEffect(()=>{const S=f==null?void 0:f.form;if(S){const R=()=>w(_.current);return S.addEventListener("reset",R),()=>S.removeEventListener("reset",R)}},[f,w]),m.createElement(Lme,{scope:n,state:x,disabled:a},m.createElement(Qe.button,he({type:"button",role:"checkbox","aria-checked":dl(x)?"mixed":x,"aria-required":s,"data-state":PL(x),"data-disabled":a?"":void 0,disabled:a,value:l},u,{ref:g,onKeyDown:Me(e.onKeyDown,S=>{S.key==="Enter"&&S.preventDefault()}),onClick:Me(e.onClick,S=>{w(R=>dl(R)?!0:!R),b&&(v.current=S.isPropagationStopped(),v.current||S.stopPropagation())})})),b&&m.createElement(Vme,{control:f,bubbles:!v.current,name:r,value:l,checked:x,required:s,disabled:a,style:{transform:"translateX(-100%)"}}))}),zme="CheckboxIndicator",Bme=m.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=Fme(zme,n);return m.createElement(er,{present:r||dl(i.state)||i.state===!0},m.createElement(Qe.span,he({"data-state":PL(i.state),"data-disabled":i.disabled?"":void 0},o,{ref:t,style:{pointerEvents:"none",...e.style}})))}),Vme=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,i=m.useRef(null),s=Nm(n),a=Am(t);return m.useEffect(()=>{const l=i.current,c=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(c,"checked").set;if(s!==n&&f){const h=new Event("click",{bubbles:r});l.indeterminate=dl(n),f.call(l,dl(n)?!1:n),l.dispatchEvent(h)}},[s,n,r]),m.createElement("input",he({type:"checkbox","aria-hidden":!0,defaultChecked:dl(n)?!1:n},o,{tabIndex:-1,ref:i,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function dl(e){return e==="indeterminate"}function PL(e){return dl(e)?"indeterminate":e?"checked":"unchecked"}const TL=jme,Hme=Bme,DL=V.forwardRef(({className:e,...t},n)=>O.jsx(TL,{ref:n,className:Ce("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:O.jsx(Hme,{className:Ce("flex items-center justify-center text-current"),children:O.jsx(Ff,{className:"h-4 w-4"})})}));DL.displayName=TL.displayName;const $L=m.forwardRef(({className:e,...t},n)=>O.jsx("div",{role:"editor-panel",ref:n,className:Ce("flex grow h-full",e),...t}));$L.displayName="EditorPanel";const AL=m.forwardRef(({className:e,...t},n)=>O.jsx("div",{ref:n,className:Ce(" flex flex-col space-y-2 w-[270px]",e),...t}));AL.displayName="EditorAside";const kL=m.forwardRef(({className:e,...t},n)=>O.jsx("div",{ref:n,className:Ce(" grow",e),...t}));kL.displayName="EditorMain";function Wme(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function R2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function O2(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?R2(Object(n),!0).forEach(function(r){Wme(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R2(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ume(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function qme(e,t){if(e==null)return{};var n=Ume(e,t),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)r=i[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Gme(e,t){return Yme(e)||Kme(e,t)||Xme(e,t)||Qme()}function Yme(e){if(Array.isArray(e))return e}function Kme(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var n=[],r=!0,o=!1,i=void 0;try{for(var s=e[Symbol.iterator](),a;!(r=(a=s.next()).done)&&(n.push(a.value),!(t&&n.length===t));r=!0);}catch(l){o=!0,i=l}finally{try{!r&&s.return!=null&&s.return()}finally{if(o)throw i}}return n}}function Xme(e,t){if(e){if(typeof e=="string")return P2(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return P2(e,t)}}function P2(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Qme(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
426
426
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Jme(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function T2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function D2(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?T2(Object(n),!0).forEach(function(r){Jme(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):T2(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Zme(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){return t.reduceRight(function(o,i){return i(o)},r)}}function cd(e){return function t(){for(var n=this,r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var s=arguments.length,a=new Array(s),l=0;l<s;l++)a[l]=arguments[l];return t.apply(n,[].concat(o,a))}}}function Jg(e){return{}.toString.call(e).includes("Object")}function eve(e){return!Object.keys(e).length}function pf(e){return typeof e=="function"}function tve(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function nve(e,t){return Jg(t)||ia("changeType"),Object.keys(t).some(function(n){return!tve(e,n)})&&ia("changeField"),t}function rve(e){pf(e)||ia("selectorType")}function ove(e){pf(e)||Jg(e)||ia("handlerType"),Jg(e)&&Object.values(e).some(function(t){return!pf(t)})&&ia("handlersType")}function ive(e){e||ia("initialIsRequired"),Jg(e)||ia("initialType"),eve(e)&&ia("initialContent")}function sve(e,t){throw new Error(e[t]||e.default)}var ave={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},ia=cd(sve)(ave),Wp={changes:nve,selector:rve,handler:ove,initial:ive};function lve(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Wp.initial(e),Wp.handler(t);var n={current:e},r=cd(dve)(n,t),o=cd(uve)(n),i=cd(Wp.changes)(e),s=cd(cve)(n);function a(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(u){return u};return Wp.selector(c),c(n.current)}function l(c){Zme(r,o,i,s)(c)}return[a,l]}function cve(e,t){return pf(t)?t(e.current):t}function uve(e,t){return e.current=D2(D2({},e.current),t),t}function dve(e,t,n){return pf(t)?t(e.current):Object.keys(n).forEach(function(r){var o;return(o=t[r])===null||o===void 0?void 0:o.call(t,e.current[r])}),n}var fve={create:lve},hve={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.43.0/min/vs"}};function pve(e){return function t(){for(var n=this,r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var s=arguments.length,a=new Array(s),l=0;l<s;l++)a[l]=arguments[l];return t.apply(n,[].concat(o,a))}}}function gve(e){return{}.toString.call(e).includes("Object")}function mve(e){return e||$2("configIsRequired"),gve(e)||$2("configType"),e.urls?(vve(),{paths:{vs:e.urls.monacoBase}}):e}function vve(){console.warn(ML.deprecation)}function bve(e,t){throw new Error(e[t]||e.default)}var ML={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
427
427
  You are using deprecated way of configuration.
428
428