semaphor 0.0.46 → 0.0.47

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.
@@ -85,7 +85,7 @@ __p += '`),ht&&(be+=`' +
85
85
  function print() { __p += __j.call(arguments, '') }
86
86
  `:`;
87
87
  `)+be+`return __p
88
- }`;var et=T1(function(){return vt(T,Te+"return "+be).apply(n,N)});if(et.source=be,Wg(et))throw et;return et}function d3(c){return yt(c).toLowerCase()}function f3(c){return yt(c).toUpperCase()}function h3(c,f,v){if(c=yt(c),c&&(v||f===n))return Vx(c);if(!c||!(f=Zn(f)))return c;var S=Hr(c),P=Hr(f),T=Hx(S,P),N=Wx(S,P)+1;return vi(S,T,N).join("")}function p3(c,f,v){if(c=yt(c),c&&(v||f===n))return c.slice(0,Ux(c)+1);if(!c||!(f=Zn(f)))return c;var S=Hr(c),P=Wx(S,Hr(f))+1;return vi(S,0,P).join("")}function g3(c,f,v){if(c=yt(c),c&&(v||f===n))return c.replace(hs,"");if(!c||!(f=Zn(f)))return c;var S=Hr(c),P=Hx(S,Hr(f));return vi(S,P).join("")}function m3(c,f){var v=L,S=W;if(Ht(f)){var P="separator"in f?f.separator:P;v="length"in f?Qe(f.length):v,S="omission"in f?Zn(f.omission):S}c=yt(c);var T=c.length;if(Ra(c)){var N=Hr(c);T=N.length}if(v>=T)return c;var z=v-$a(S);if(z<1)return S;var G=N?vi(N,0,z).join(""):c.slice(0,z);if(P===n)return G+S;if(N&&(z+=G.length-z),Bg(P)){if(c.slice(z).search(P)){var he,pe=G;for(P.global||(P=sg(P.source,yt(Ae.exec(P))+"g")),P.lastIndex=0;he=P.exec(pe);)var be=he.index;G=G.slice(0,be===n?z:be)}}else if(c.indexOf(Zn(P),z)!=z){var Re=G.lastIndexOf(P);Re>-1&&(G=G.slice(0,Re))}return G+S}function v3(c){return c=yt(c),c&&To.test(c)?c.replace(wn,qT):c}var b3=Ia(function(c,f,v){return c+(v?" ":"")+f.toUpperCase()}),Gg=Aw("toUpperCase");function M1(c,f,v){return c=yt(c),f=v?n:f,f===n?VT(c)?KT(c):TT(c):c.match(f)||[]}var T1=rt(function(c,f){try{return Xn(c,n,f)}catch(v){return Wg(v)?v:new Ue(v)}}),y3=Lo(function(c,f){return wr(f,function(v){v=so(v),ko(c,v,Vg(c[v],c))}),c});function x3(c){var f=c==null?0:c.length,v=Le();return c=f?jt(c,function(S){if(typeof S[1]!="function")throw new _r(s);return[v(S[0]),S[1]]}):[],rt(function(S){for(var P=-1;++P<f;){var T=c[P];if(Xn(T[0],this,S))return Xn(T[1],this,S)}})}function w3(c){return q5(Cr(c,h))}function Yg(c){return function(){return c}}function _3(c,f){return c==null||c!==c?f:c}var S3=kw(),C3=kw(!0);function zn(c){return c}function Kg(c){return dw(typeof c=="function"?c:Cr(c,h))}function E3(c){return hw(Cr(c,h))}function R3(c,f){return pw(c,Cr(f,h))}var $3=rt(function(c,f){return function(v){return ac(v,c,f)}}),P3=rt(function(c,f){return function(v){return ac(c,v,f)}});function Xg(c,f,v){var S=ln(f),P=Pd(f,S);v==null&&!(Ht(f)&&(P.length||!S.length))&&(v=f,f=c,c=this,P=Pd(f,ln(f)));var T=!(Ht(v)&&"chain"in v)||!!v.chain,N=zo(c);return wr(P,function(z){var G=f[z];c[z]=G,N&&(c.prototype[z]=function(){var he=this.__chain__;if(T||he){var pe=c(this.__wrapped__),be=pe.__actions__=Nn(this.__actions__);return be.push({func:G,args:arguments,thisArg:c}),pe.__chain__=he,pe}return G.apply(c,di([this.value()],arguments))})}),c}function O3(){return hn._===this&&(hn._=t5),this}function Qg(){}function D3(c){return c=Qe(c),rt(function(f){return gw(f,c)})}var M3=Pg(jt),T3=Pg(Nx),A3=Pg(Jp);function A1(c){return kg(c)?eg(so(c)):cA(c)}function I3(c){return function(f){return c==null?n:xs(c,f)}}var k3=Lw(),N3=Lw(!0);function Zg(){return[]}function Jg(){return!1}function L3(){return{}}function F3(){return""}function z3(){return!0}function j3(c,f){if(c=Qe(c),c<1||c>X)return[];var v=V,S=_n(c,V);f=Le(f),c-=V;for(var P=rg(S,f);++v<c;)f(v);return P}function V3(c){return Ye(c)?jt(c,so):Jn(c)?[c]:Nn(Jw(yt(c)))}function H3(c){var f=++JT;return yt(c)+f}var W3=Id(function(c,f){return c+f},0),B3=Og("ceil"),U3=Id(function(c,f){return c/f},1),q3=Og("floor");function G3(c){return c&&c.length?$d(c,zn,pg):n}function Y3(c,f){return c&&c.length?$d(c,Le(f,2),pg):n}function K3(c){return zx(c,zn)}function X3(c,f){return zx(c,Le(f,2))}function Q3(c){return c&&c.length?$d(c,zn,bg):n}function Z3(c,f){return c&&c.length?$d(c,Le(f,2),bg):n}var J3=Id(function(c,f){return c*f},1),eN=Og("round"),tN=Id(function(c,f){return c-f},0);function nN(c){return c&&c.length?ng(c,zn):0}function rN(c,f){return c&&c.length?ng(c,Le(f,2)):0}return O.after=Ek,O.ary=u1,O.assign=f7,O.assignIn=C1,O.assignInWith=Gd,O.assignWith=h7,O.at=p7,O.before=d1,O.bind=Vg,O.bindAll=y3,O.bindKey=f1,O.castArray=Lk,O.chain=a1,O.chunk=qA,O.compact=GA,O.concat=YA,O.cond=x3,O.conforms=w3,O.constant=Yg,O.countBy=nk,O.create=g7,O.curry=h1,O.curryRight=p1,O.debounce=g1,O.defaults=m7,O.defaultsDeep=v7,O.defer=Rk,O.delay=$k,O.difference=KA,O.differenceBy=XA,O.differenceWith=QA,O.drop=ZA,O.dropRight=JA,O.dropRightWhile=eI,O.dropWhile=tI,O.fill=nI,O.filter=ok,O.flatMap=ak,O.flatMapDeep=lk,O.flatMapDepth=ck,O.flatten=r1,O.flattenDeep=rI,O.flattenDepth=oI,O.flip=Pk,O.flow=S3,O.flowRight=C3,O.fromPairs=iI,O.functions=C7,O.functionsIn=E7,O.groupBy=uk,O.initial=aI,O.intersection=lI,O.intersectionBy=cI,O.intersectionWith=uI,O.invert=$7,O.invertBy=P7,O.invokeMap=fk,O.iteratee=Kg,O.keyBy=hk,O.keys=ln,O.keysIn=Fn,O.map=Vd,O.mapKeys=D7,O.mapValues=M7,O.matches=E3,O.matchesProperty=R3,O.memoize=Wd,O.merge=T7,O.mergeWith=E1,O.method=$3,O.methodOf=P3,O.mixin=Xg,O.negate=Bd,O.nthArg=D3,O.omit=A7,O.omitBy=I7,O.once=Ok,O.orderBy=pk,O.over=M3,O.overArgs=Dk,O.overEvery=T3,O.overSome=A3,O.partial=Hg,O.partialRight=m1,O.partition=gk,O.pick=k7,O.pickBy=R1,O.property=A1,O.propertyOf=I3,O.pull=pI,O.pullAll=i1,O.pullAllBy=gI,O.pullAllWith=mI,O.pullAt=vI,O.range=k3,O.rangeRight=N3,O.rearg=Mk,O.reject=bk,O.remove=bI,O.rest=Tk,O.reverse=zg,O.sampleSize=xk,O.set=L7,O.setWith=F7,O.shuffle=wk,O.slice=yI,O.sortBy=Ck,O.sortedUniq=RI,O.sortedUniqBy=$I,O.split=a3,O.spread=Ak,O.tail=PI,O.take=OI,O.takeRight=DI,O.takeRightWhile=MI,O.takeWhile=TI,O.tap=GI,O.throttle=Ik,O.thru=jd,O.toArray=w1,O.toPairs=$1,O.toPairsIn=P1,O.toPath=V3,O.toPlainObject=S1,O.transform=z7,O.unary=kk,O.union=AI,O.unionBy=II,O.unionWith=kI,O.uniq=NI,O.uniqBy=LI,O.uniqWith=FI,O.unset=j7,O.unzip=jg,O.unzipWith=s1,O.update=V7,O.updateWith=H7,O.values=La,O.valuesIn=W7,O.without=zI,O.words=M1,O.wrap=Nk,O.xor=jI,O.xorBy=VI,O.xorWith=HI,O.zip=WI,O.zipObject=BI,O.zipObjectDeep=UI,O.zipWith=qI,O.entries=$1,O.entriesIn=P1,O.extend=C1,O.extendWith=Gd,Xg(O,O),O.add=W3,O.attempt=T1,O.camelCase=G7,O.capitalize=O1,O.ceil=B3,O.clamp=B7,O.clone=Fk,O.cloneDeep=jk,O.cloneDeepWith=Vk,O.cloneWith=zk,O.conformsTo=Hk,O.deburr=D1,O.defaultTo=_3,O.divide=U3,O.endsWith=Y7,O.eq=Br,O.escape=K7,O.escapeRegExp=X7,O.every=rk,O.find=ik,O.findIndex=t1,O.findKey=b7,O.findLast=sk,O.findLastIndex=n1,O.findLastKey=y7,O.floor=q3,O.forEach=l1,O.forEachRight=c1,O.forIn=x7,O.forInRight=w7,O.forOwn=_7,O.forOwnRight=S7,O.get=Ug,O.gt=Wk,O.gte=Bk,O.has=R7,O.hasIn=qg,O.head=o1,O.identity=zn,O.includes=dk,O.indexOf=sI,O.inRange=U7,O.invoke=O7,O.isArguments=Ss,O.isArray=Ye,O.isArrayBuffer=Uk,O.isArrayLike=Ln,O.isArrayLikeObject=Yt,O.isBoolean=qk,O.isBuffer=bi,O.isDate=Gk,O.isElement=Yk,O.isEmpty=Kk,O.isEqual=Xk,O.isEqualWith=Qk,O.isError=Wg,O.isFinite=Zk,O.isFunction=zo,O.isInteger=v1,O.isLength=Ud,O.isMap=b1,O.isMatch=Jk,O.isMatchWith=e7,O.isNaN=t7,O.isNative=n7,O.isNil=o7,O.isNull=r7,O.isNumber=y1,O.isObject=Ht,O.isObjectLike=Ut,O.isPlainObject=hc,O.isRegExp=Bg,O.isSafeInteger=i7,O.isSet=x1,O.isString=qd,O.isSymbol=Jn,O.isTypedArray=Na,O.isUndefined=s7,O.isWeakMap=a7,O.isWeakSet=l7,O.join=dI,O.kebabCase=Q7,O.last=Rr,O.lastIndexOf=fI,O.lowerCase=Z7,O.lowerFirst=J7,O.lt=c7,O.lte=u7,O.max=G3,O.maxBy=Y3,O.mean=K3,O.meanBy=X3,O.min=Q3,O.minBy=Z3,O.stubArray=Zg,O.stubFalse=Jg,O.stubObject=L3,O.stubString=F3,O.stubTrue=z3,O.multiply=J3,O.nth=hI,O.noConflict=O3,O.noop=Qg,O.now=Hd,O.pad=e3,O.padEnd=t3,O.padStart=n3,O.parseInt=r3,O.random=q7,O.reduce=mk,O.reduceRight=vk,O.repeat=o3,O.replace=i3,O.result=N7,O.round=eN,O.runInContext=B,O.sample=yk,O.size=_k,O.snakeCase=s3,O.some=Sk,O.sortedIndex=xI,O.sortedIndexBy=wI,O.sortedIndexOf=_I,O.sortedLastIndex=SI,O.sortedLastIndexBy=CI,O.sortedLastIndexOf=EI,O.startCase=l3,O.startsWith=c3,O.subtract=tN,O.sum=nN,O.sumBy=rN,O.template=u3,O.times=j3,O.toFinite=jo,O.toInteger=Qe,O.toLength=_1,O.toLower=d3,O.toNumber=$r,O.toSafeInteger=d7,O.toString=yt,O.toUpper=f3,O.trim=h3,O.trimEnd=p3,O.trimStart=g3,O.truncate=m3,O.unescape=v3,O.uniqueId=H3,O.upperCase=b3,O.upperFirst=Gg,O.each=l1,O.eachRight=c1,O.first=o1,Xg(O,function(){var c={};return oo(O,function(f,v){St.call(O.prototype,v)||(c[v]=f)}),c}(),{chain:!1}),O.VERSION=r,wr(["bind","bindKey","curry","curryRight","partial","partialRight"],function(c){O[c].placeholder=O}),wr(["drop","take"],function(c,f){ut.prototype[c]=function(v){v=v===n?1:tn(Qe(v),0);var S=this.__filtered__&&!f?new ut(this):this.clone();return S.__filtered__?S.__takeCount__=_n(v,S.__takeCount__):S.__views__.push({size:_n(v,V),type:c+(S.__dir__<0?"Right":"")}),S},ut.prototype[c+"Right"]=function(v){return this.reverse()[c](v).reverse()}}),wr(["filter","map","takeWhile"],function(c,f){var v=f+1,S=v==Q||v==J;ut.prototype[c]=function(P){var T=this.clone();return T.__iteratees__.push({iteratee:Le(P,3),type:v}),T.__filtered__=T.__filtered__||S,T}}),wr(["head","last"],function(c,f){var v="take"+(f?"Right":"");ut.prototype[c]=function(){return this[v](1).value()[0]}}),wr(["initial","tail"],function(c,f){var v="drop"+(f?"":"Right");ut.prototype[c]=function(){return this.__filtered__?new ut(this):this[v](1)}}),ut.prototype.compact=function(){return this.filter(zn)},ut.prototype.find=function(c){return this.filter(c).head()},ut.prototype.findLast=function(c){return this.reverse().find(c)},ut.prototype.invokeMap=rt(function(c,f){return typeof c=="function"?new ut(this):this.map(function(v){return ac(v,c,f)})}),ut.prototype.reject=function(c){return this.filter(Bd(Le(c)))},ut.prototype.slice=function(c,f){c=Qe(c);var v=this;return v.__filtered__&&(c>0||f<0)?new ut(v):(c<0?v=v.takeRight(-c):c&&(v=v.drop(c)),f!==n&&(f=Qe(f),v=f<0?v.dropRight(-f):v.take(f-c)),v)},ut.prototype.takeRightWhile=function(c){return this.reverse().takeWhile(c).reverse()},ut.prototype.toArray=function(){return this.take(V)},oo(ut.prototype,function(c,f){var v=/^(?:filter|find|map|reject)|While$/.test(f),S=/^(?:head|last)$/.test(f),P=O[S?"take"+(f=="last"?"Right":""):f],T=S||/^find/.test(f);P&&(O.prototype[f]=function(){var N=this.__wrapped__,z=S?[1]:arguments,G=N instanceof ut,he=z[0],pe=G||Ye(N),be=function(lt){var ht=P.apply(O,di([lt],z));return S&&Re?ht[0]:ht};pe&&v&&typeof he=="function"&&he.length!=1&&(G=pe=!1);var Re=this.__chain__,Te=!!this.__actions__.length,Fe=T&&!Re,et=G&&!Te;if(!T&&pe){N=et?N:new ut(this);var ze=c.apply(N,z);return ze.__actions__.push({func:jd,args:[be],thisArg:n}),new Sr(ze,Re)}return Fe&&et?c.apply(this,z):(ze=this.thru(be),Fe?S?ze.value()[0]:ze.value():ze)})}),wr(["pop","push","shift","sort","splice","unshift"],function(c){var f=fd[c],v=/^(?:push|sort|unshift)$/.test(c)?"tap":"thru",S=/^(?:pop|shift)$/.test(c);O.prototype[c]=function(){var P=arguments;if(S&&!this.__chain__){var T=this.value();return f.apply(Ye(T)?T:[],P)}return this[v](function(N){return f.apply(Ye(N)?N:[],P)})}}),oo(ut.prototype,function(c,f){var v=O[f];if(v){var S=v.name+"";St.call(Ma,S)||(Ma[S]=[]),Ma[S].push({name:f,func:v})}}),Ma[Ad(n,_).name]=[{name:"wrapper",func:n}],ut.prototype.clone=v5,ut.prototype.reverse=b5,ut.prototype.value=y5,O.prototype.at=YI,O.prototype.chain=KI,O.prototype.commit=XI,O.prototype.next=QI,O.prototype.plant=JI,O.prototype.reverse=ek,O.prototype.toJSON=O.prototype.valueOf=O.prototype.value=tk,O.prototype.first=O.prototype.head,ec&&(O.prototype[ec]=ZI),O},Pa=XT();gs?((gs.exports=Pa)._=Pa,Kp._=Pa):hn._=Pa}).call(ks)})(ah,ah.exports);var Za=ah.exports;const ia=Lu(Za),e_=["lg","md","sm","xs","xxs"],Ce=AE()(jE((e,t)=>({isSessionExpired:!1,currentBreakpoint:"lg",dashboard:{id:"",style:Rv},showContext:!1,selectedSheetId:null,selectedCardId:null,selectedFrameId:null,selectedCard:null,showFilters:!1,isDashboardEditing:!1,isVisualEditing:!1,showDashboardJSON:!1,filteringCards:[],actions:{setIsSessionExpired:n=>{e(()=>({isSessionExpired:n}))},setCardPython:(n,r)=>{e(o=>{var s,a;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===o.selectedSheetId);i&&Za.forEach(i.frames,l=>{var d;const u=(d=l.cards)==null?void 0:d.find(h=>h.id===n);u&&(u.python=r)})})},addBaseQuery:n=>{e(r=>{var o;r.dashboard.baseQueries||(r.dashboard.baseQueries=[]),(o=r.dashboard.baseQueries)==null||o.push(n)})},removeBaseQuery:n=>{e(r=>{var i,s;const o=(i=r.dashboard.baseQueries)==null?void 0:i.findIndex(a=>a.id===n);o!=null&&o>-1&&((s=r.dashboard.baseQueries)==null||s.splice(o,1))})},setBaseQueries:n=>{e(r=>{r.dashboard.baseQueries=n})},setCurrentBreakpoint:n=>{e(()=>({currentBreakpoint:n}))},addFilteringCard:n=>{e(r=>{var o;(o=r.filteringCards)==null||o.push(n)})},removeFilteringCard:n=>{e(r=>{var i,s;const o=(i=r.filteringCards)==null?void 0:i.findIndex(a=>a.id===n.id);o!==void 0&&o>-1&&((s=r.filteringCards)==null||s.splice(o,1))})},setCustomCards:n=>{e(r=>{r.dashboard.customCards=n})},setAuthToken:n=>{e(()=>({authToken:n}))},setThemeStyle:n=>{e(()=>({themeStyle:n}))},setDashboard:n=>e({dashboard:n}),setBookmarkKey:n=>{e(()=>({bookmarkKey:n}))},setDashboardTheme:n=>{e(r=>{r.theme=n})},setSheets:n=>{e(r=>{r.dashboard&&(r.dashboard.sheets=n)})},setCardTitle:(n,r,o)=>{e(i=>{var a,l;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(u=>u.id===n);s&&Za.forEach(s.frames,u=>{var h;const d=(h=u.cards)==null?void 0:h.find(p=>p.id===r);d&&(d.title=o)})})},setCardInfo:(n,r)=>{e(o=>{var s,a;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===o.selectedSheetId);i&&Za.forEach(i.frames,l=>{var d;const u=(d=l.cards)==null?void 0:d.find(h=>h.id===n);u&&(u.info=r)})})},setCardDescription:(n,r,o)=>{e(i=>{var a,l;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(u=>u.id===n);s&&Za.forEach(s.frames,u=>{var h;const d=(h=u.cards)==null?void 0:h.find(p=>p.id===r);d&&(d.description=o)})})},setCardSql:(n,r,o)=>{e(i=>{var a,l,u,d;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(h=>h.id===n);if(s){const h=(u=s.cards)==null?void 0:u.find(p=>p.id===r);h&&(h.sql=o,(d=i.onUpdateCard)==null||d.call(i,h,n))}})},setFrameCardData:(n,r,o)=>{e(i=>{var a,l;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(u=>u.id===n);s&&Za.forEach(s.frames,u=>{var h;const d=(h=u.cards)==null?void 0:h.find(p=>p.id===r);d&&(d.data=o)})})},setSheetLayout:(n,r)=>{e(o=>{var s,a;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);i&&(i.layout=r)})},setSheetLayouts:(n,r)=>{e(o=>{var s,a;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);i&&(i.layouts=r)})},setShowContext:n=>{e(()=>({showContext:n}))},setShowFilters:n=>{e(()=>({showFilters:n}))},setFilterValues:n=>{e(()=>({filterValues:n}))},addOrUpdateFilterValue:n=>{e(r=>{if(r.filterValues){const o=r.filterValues.findIndex(i=>i.filterId===n.filterId);o>-1?r.filterValues.splice(o,1,n):r.filterValues.push(n)}else r.filterValues=[n]})},addOrUpdateFilterValues:n=>{e(r=>{r.filterValues?n.forEach(o=>{var s,a,l;const i=(s=r==null?void 0:r.filterValues)==null?void 0:s.findIndex(u=>u.filterId===o.filterId);i!==void 0&&i>-1?(a=r.filterValues)==null||a.splice(i,1,o):(l=r.filterValues)==null||l.push(o)}):r.filterValues=n})},removeFilterValue:n=>{e(r=>{if(r.filterValues){const o=r.filterValues.filter(i=>i.filterId!==n&&!i.filterId.startsWith(n));r.filterValues=o}})},replaceFilterValue:n=>{e(r=>{if(r.filterValues){const o=r.filterValues.findIndex(i=>i.filterId===n.filterId);o>-1&&r.filterValues.splice(o,1,n)}})},addFilter:n=>{e(r=>{var o;r.dashboard.filters?(o=r.dashboard.filters)==null||o.push(n):r.dashboard.filters=[n]})},removeFilter:n=>{e(r=>{var o,i;if(r.dashboard.filters){const s=(o=r.dashboard.filters)==null?void 0:o.findIndex(a=>a.id===n);console.log("index",s),s>-1&&((i=r.dashboard.filters)==null||i.splice(s,1))}})},updateFrameCard:(n,r,o)=>{e(i=>{var l,u,d,h,p;const s=(u=(l=i.dashboard)==null?void 0:l.sheets)==null?void 0:u.find(g=>g.id===n);if(!s)return;const a=(d=s==null?void 0:s.frames)==null?void 0:d.find(g=>g.id===r);if(a){const g=(h=a.cards)==null?void 0:h.findIndex(b=>b.id===o.id);g>-1&&((p=a.cards)==null||p.splice(g,1,o))}})},updateFilter:n=>{e(r=>{var o,i;if(r.dashboard.filters){const s=(o=r.dashboard.filters)==null?void 0:o.findIndex(a=>a.id===n.id);s>-1&&((i=r.dashboard.filters)==null||i.splice(s,1,n))}})},setIsDashboardEditing:n=>{e(()=>({isDashboardEditing:n}))},setShowDashboardJSON:n=>{e(()=>({showDashboardJSON:n}))},setIsVisualEditing:n=>{e(()=>({isVisualEditing:n}))},addFrame:(n,r)=>{e(o=>{var s,a,l,u,d;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(h=>h.id===n);if(i){i.frames||(i.frames=[]),(l=i.frames)==null||l.push(r);const h={i:r.id,x:0,y:1/0,w:20,h:7,minW:6,minH:2};(u=i.layout)==null||u.push(h),i!=null&&i.layouts||(i.layouts={}),e_.forEach(p=>{i.layouts[p]||(i.layouts[p]=[]),i.layouts[p].push(h)}),(d=o.onAddFrame)==null||d.call(o,r,n)}})},removeFrame:(n,r)=>{e(o=>{var s,a,l,u,d;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(h=>h.id===n);if(i){const h=(l=i.frames)==null?void 0:l.findIndex(p=>p.id===r);console.log(h),typeof h=="number"&&h>-1&&((u=i.frames)==null||u.splice(h,1),(d=i.layout)==null||d.splice(h,1),i.layouts=e_.reduce((p,g)=>{if(p&&p[g]){const b=p[g].findIndex(y=>y.i===r);typeof b=="number"&&b>-1&&p[g].splice(b,1)}return p},i.layouts))}})},updateFrame:(n,r)=>{e(o=>{var a,l,u,d;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(h=>h.id===n),s=(u=i==null?void 0:i.frames)==null?void 0:u.findIndex(h=>h.id===r.id);i&&((d=i.frames)==null||d.splice(s,1,r))})},updateCard:(n,r)=>{e(o=>{var a,l,u,d,h;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(p=>p.id===n),s=(u=i==null?void 0:i.cards)==null?void 0:u.findIndex(p=>p.id===r.id);i&&((d=i.cards)==null||d.splice(s,1,r),(h=o.onUpdateCard)==null||h.call(o,r,n))})},removeCard:(n,r)=>{e(o=>{var a,l,u,d,h,p;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(g=>g.id===n),s=(u=i==null?void 0:i.cards)==null?void 0:u.findIndex(g=>g.id===r.id);i&&((d=i.cards)==null||d.splice(s,1),(h=i.layout)==null||h.splice(s,1),(p=o.onRemoveCard)==null||p.call(o,r,n))})},setStyle:n=>{e(r=>{r.dashboard&&(r.dashboard.style=n)})},setSelectedCardId:(n,r)=>{e(o=>{var s,a,l;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(u=>u.id===n);i&&(((l=i.cards)==null?void 0:l.find(d=>d.id===r))?o.selectedCardId=r:o.selectedCardId=null)})},setSelectedFrameId:n=>{e(r=>{var i,s;((s=(i=r.dashboard)==null?void 0:i.sheets)==null?void 0:s.find(a=>a.id===r.selectedSheetId))&&(r.selectedFrameId=n)})},setSelectedSheetId:n=>{e(r=>{var i,s;((s=(i=r.dashboard)==null?void 0:i.sheets)==null?void 0:s.find(a=>a.id===n))&&(r.selectedSheetId=n)})},setOnSaveFunction:n=>{e(()=>({onSaveFunction:n}))},setOnAddCard:n=>{e(()=>({onAddCard:n}))},setOnUpdateCard:n=>{e(()=>({onUpdateCard:n}))},setOnRemoveCard:n=>{e(()=>({onRemoveCard:n}))},setOnEvent:n=>{e(()=>({onEvent:n}))},getDashboard:()=>t().dashboard,getSelectedSheet:()=>{var n,r;return(r=(n=t().dashboard)==null?void 0:n.sheets)==null?void 0:r.find(o=>o.id===t().selectedSheetId)},getSelectedFrame:()=>{var r,o,i;const n=(o=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:o.find(s=>s.id===t().selectedSheetId);return(i=n==null?void 0:n.frames)==null?void 0:i.find(s=>s.id===t().selectedFrameId)},getCard:n=>{var o,i;const r=(o=t().dashboard)==null?void 0:o.sheets;if(r)for(let s=0;s<r.length;s++){const a=r[s].frames;if(a)for(let l=0;l<a.length;l++){const u=(i=a[l].cards)==null?void 0:i.find(d=>d.id===n);if(u)return u}}},getSelectedSheetLayout:()=>{var r,o;const n=(o=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:o.find(i=>i.id===t().selectedSheetId);return n==null?void 0:n.layout},getSelectedSheetLayouts:()=>{var r,o;const n=(o=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:o.find(i=>i.id===t().selectedSheetId);return n==null?void 0:n.layouts},getStyle:()=>{var n;return(n=t().dashboard)==null?void 0:n.style},handleDataPointClickAction:(n,r)=>{E6({card:n,dataPoint:r,set:e,get:t})}}}))),Ki=()=>Ce(e=>e.actions);var zu=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},El=typeof window>"u"||"Deno"in window;function Tr(){}function R6(e,t){return typeof e=="function"?e(t):e}function $v(e){return typeof e=="number"&&e>=0&&e!==1/0}function qE(e,t){return Math.max(e+(t||0)-Date.now(),0)}function t_(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==Qb(s,t.options))return!1}else if(!ou(t.queryKey,s))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||typeof o<"u"&&o!==t.state.fetchStatus||i&&!i(t))}function n_(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(ru(t.options.mutationKey)!==ru(i))return!1}else if(!ou(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function Qb(e,t){return((t==null?void 0:t.queryKeyHashFn)||ru)(e)}function ru(e){return JSON.stringify(e,(t,n)=>Ov(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function ou(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!ou(e[n],t[n])):!1}function GE(e,t){if(e===t)return e;const n=r_(e)&&r_(t);if(n||Ov(e)&&Ov(t)){const r=n?e:Object.keys(e),o=r.length,i=n?t:Object.keys(t),s=i.length,a=n?[]:{};let l=0;for(let u=0;u<s;u++){const d=n?u:i[u];!n&&e[d]===void 0&&t[d]===void 0&&r.includes(d)?(a[d]=void 0,l++):(a[d]=GE(e[d],t[d]),a[d]===e[d]&&e[d]!==void 0&&l++)}return o===s&&l===o?e:a}return t}function Pv(e,t){if(e&&!t||t&&!e)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function r_(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ov(e){if(!o_(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const n=t.prototype;return!(!o_(n)||!n.hasOwnProperty("isPrototypeOf"))}function o_(e){return Object.prototype.toString.call(e)==="[object Object]"}function $6(e){return new Promise(t=>{setTimeout(t,e)})}function Dv(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?GE(e,t):t}function P6(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function O6(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Hs,Pi,al,pE,D6=(pE=class extends zu{constructor(){super();Ie(this,Hs,void 0);Ie(this,Pi,void 0);Ie(this,al,void 0);Pe(this,al,t=>{if(!El&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){U(this,Pi)||this.setEventListener(U(this,al))}onUnsubscribe(){var t;this.hasListeners()||((t=U(this,Pi))==null||t.call(this),Pe(this,Pi,void 0))}setEventListener(t){var n;Pe(this,al,t),(n=U(this,Pi))==null||n.call(this),Pe(this,Pi,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){U(this,Hs)!==t&&(Pe(this,Hs,t),this.onFocus())}onFocus(){this.listeners.forEach(t=>{t()})}isFocused(){var t;return typeof U(this,Hs)=="boolean"?U(this,Hs):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Hs=new WeakMap,Pi=new WeakMap,al=new WeakMap,pE),lh=new D6,ll,Oi,cl,gE,M6=(gE=class extends zu{constructor(){super();Ie(this,ll,!0);Ie(this,Oi,void 0);Ie(this,cl,void 0);Pe(this,cl,t=>{if(!El&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){U(this,Oi)||this.setEventListener(U(this,cl))}onUnsubscribe(){var t;this.hasListeners()||((t=U(this,Oi))==null||t.call(this),Pe(this,Oi,void 0))}setEventListener(t){var n;Pe(this,cl,t),(n=U(this,Oi))==null||n.call(this),Pe(this,Oi,t(this.setOnline.bind(this)))}setOnline(t){U(this,ll)!==t&&(Pe(this,ll,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return U(this,ll)}},ll=new WeakMap,Oi=new WeakMap,cl=new WeakMap,gE),ch=new M6;function T6(e){return Math.min(1e3*2**e,3e4)}function qh(e){return(e??"online")==="online"?ch.isOnline():!0}var YE=class{constructor(e){this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function lm(e){return e instanceof YE}function KE(e){let t=!1,n=0,r=!1,o,i,s;const a=new Promise((x,_)=>{i=x,s=_}),l=x=>{var _;r||(g(new YE(x)),(_=e.abort)==null||_.call(e))},u=()=>{t=!0},d=()=>{t=!1},h=()=>!lh.isFocused()||e.networkMode!=="always"&&!ch.isOnline(),p=x=>{var _;r||(r=!0,(_=e.onSuccess)==null||_.call(e,x),o==null||o(),i(x))},g=x=>{var _;r||(r=!0,(_=e.onError)==null||_.call(e,x),o==null||o(),s(x))},b=()=>new Promise(x=>{var _;o=w=>{const C=r||!h();return C&&x(w),C},(_=e.onPause)==null||_.call(e)}).then(()=>{var x;o=void 0,r||(x=e.onContinue)==null||x.call(e)}),y=()=>{if(r)return;let x;try{x=e.fn()}catch(_){x=Promise.reject(_)}Promise.resolve(x).then(p).catch(_=>{var M;if(r)return;const w=e.retry??(El?0:3),C=e.retryDelay??T6,R=typeof C=="function"?C(n,_):C,E=w===!0||typeof w=="number"&&n<w||typeof w=="function"&&w(n,_);if(t||!E){g(_);return}n++,(M=e.onFail)==null||M.call(e,n,_),$6(R).then(()=>{if(h())return b()}).then(()=>{t?g(_):y()})})};return qh(e.networkMode)?y():b().then(y),{promise:a,cancel:l,continue:()=>(o==null?void 0:o())?a:Promise.resolve(),cancelRetry:u,continueRetry:d}}function A6(){let e=[],t=0,n=p=>{p()},r=p=>{p()},o=p=>setTimeout(p,0);const i=p=>{o=p},s=p=>{let g;t++;try{g=p()}finally{t--,t||u()}return g},a=p=>{t?e.push(p):o(()=>{n(p)})},l=p=>(...g)=>{a(()=>{p(...g)})},u=()=>{const p=e;e=[],p.length&&o(()=>{r(()=>{p.forEach(g=>{n(g)})})})};return{batch:s,batchCalls:l,schedule:a,setNotifyFunction:p=>{n=p},setBatchNotifyFunction:p=>{r=p},setScheduler:i}}var vn=A6(),Ws,mE,XE=(mE=class{constructor(){Ie(this,Ws,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),$v(this.gcTime)&&Pe(this,Ws,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(El?1/0:5*60*1e3))}clearGcTimeout(){U(this,Ws)&&(clearTimeout(U(this,Ws)),Pe(this,Ws,void 0))}},Ws=new WeakMap,mE),ul,dl,Or,Di,Dr,cn,Eu,Bs,fl,Wf,Yr,Uo,vE,I6=(vE=class extends XE{constructor(t){super();Ie(this,fl);Ie(this,Yr);Ie(this,ul,void 0);Ie(this,dl,void 0);Ie(this,Or,void 0);Ie(this,Di,void 0);Ie(this,Dr,void 0);Ie(this,cn,void 0);Ie(this,Eu,void 0);Ie(this,Bs,void 0);Pe(this,Bs,!1),Pe(this,Eu,t.defaultOptions),ot(this,fl,Wf).call(this,t.options),Pe(this,cn,[]),Pe(this,Or,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Pe(this,ul,t.state||k6(this.options)),this.state=U(this,ul),this.scheduleGc()}get meta(){return this.options.meta}optionalRemove(){!U(this,cn).length&&this.state.fetchStatus==="idle"&&U(this,Or).remove(this)}setData(t,n){const r=Dv(this.state.data,t,this.options);return ot(this,Yr,Uo).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){ot(this,Yr,Uo).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r;const n=U(this,Di);return(r=U(this,Dr))==null||r.cancel(t),n?n.then(Tr).catch(Tr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(U(this,ul))}isActive(){return U(this,cn).some(t=>t.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||U(this,cn).some(t=>t.getCurrentResult().isStale)}isStaleByTime(t=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!qE(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=U(this,cn).find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=U(this,Dr))==null||n.continue()}onOnline(){var n;const t=U(this,cn).find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=U(this,Dr))==null||n.continue()}addObserver(t){U(this,cn).includes(t)||(U(this,cn).push(t),this.clearGcTimeout(),U(this,Or).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){U(this,cn).includes(t)&&(Pe(this,cn,U(this,cn).filter(n=>n!==t)),U(this,cn).length||(U(this,Dr)&&(U(this,Bs)?U(this,Dr).cancel({revert:!0}):U(this,Dr).cancelRetry()),this.scheduleGc()),U(this,Or).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return U(this,cn).length}invalidate(){this.state.isInvalidated||ot(this,Yr,Uo).call(this,{type:"invalidate"})}fetch(t,n){var u,d,h,p;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(U(this,Di))return(u=U(this,Dr))==null||u.continueRetry(),U(this,Di)}if(t&&ot(this,fl,Wf).call(this,t),!this.options.queryFn){const g=U(this,cn).find(b=>b.options.queryFn);g&&ot(this,fl,Wf).call(this,g.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,o={queryKey:this.queryKey,meta:this.meta},i=g=>{Object.defineProperty(g,"signal",{enumerable:!0,get:()=>(Pe(this,Bs,!0),r.signal)})};i(o);const s=()=>this.options.queryFn?(Pe(this,Bs,!1),this.options.persister?this.options.persister(this.options.queryFn,o,this):this.options.queryFn(o)):Promise.reject(new Error(`Missing queryFn: '${this.options.queryHash}'`)),a={fetchOptions:n,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:s};i(a),(d=this.options.behavior)==null||d.onFetch(a,this),Pe(this,dl,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((h=a.fetchOptions)==null?void 0:h.meta))&&ot(this,Yr,Uo).call(this,{type:"fetch",meta:(p=a.fetchOptions)==null?void 0:p.meta});const l=g=>{var b,y,x,_;lm(g)&&g.silent||ot(this,Yr,Uo).call(this,{type:"error",error:g}),lm(g)||((y=(b=U(this,Or).config).onError)==null||y.call(b,g,this),(_=(x=U(this,Or).config).onSettled)==null||_.call(x,this.state.data,g,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return Pe(this,Dr,KE({fn:a.fetchFn,abort:r.abort.bind(r),onSuccess:g=>{var b,y,x,_;if(typeof g>"u"){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),l(new Error(`${this.queryHash} data is undefined`));return}this.setData(g),(y=(b=U(this,Or).config).onSuccess)==null||y.call(b,g,this),(_=(x=U(this,Or).config).onSettled)==null||_.call(x,g,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:l,onFail:(g,b)=>{ot(this,Yr,Uo).call(this,{type:"failed",failureCount:g,error:b})},onPause:()=>{ot(this,Yr,Uo).call(this,{type:"pause"})},onContinue:()=>{ot(this,Yr,Uo).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode})),Pe(this,Di,U(this,Dr).promise),U(this,Di)}},ul=new WeakMap,dl=new WeakMap,Or=new WeakMap,Di=new WeakMap,Dr=new WeakMap,cn=new WeakMap,Eu=new WeakMap,Bs=new WeakMap,fl=new WeakSet,Wf=function(t){this.options={...U(this,Eu),...t},this.updateGcTime(this.options.gcTime)},Yr=new WeakSet,Uo=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:t.meta??null,fetchStatus:qh(this.options.networkMode)?"fetching":"paused",...!r.dataUpdatedAt&&{error:null,status:"pending"}};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const o=t.error;return lm(o)&&o.revert&&U(this,dl)?{...U(this,dl),fetchStatus:"idle"}:{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),vn.batch(()=>{U(this,cn).forEach(r=>{r.onQueryUpdate()}),U(this,Or).notify({query:this,type:"updated",action:t})})},vE);function k6(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=typeof t<"u",r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var uo,bE,QE=(bE=class extends zu{constructor(t={}){super();Ie(this,uo,void 0);this.config=t,Pe(this,uo,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??Qb(o,n);let s=this.get(i);return s||(s=new I6({cache:this,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){U(this,uo).has(t.queryHash)||(U(this,uo).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=U(this,uo).get(t.queryHash);n&&(t.destroy(),n===t&&U(this,uo).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){vn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return U(this,uo).get(t)}getAll(){return[...U(this,uo).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>t_(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>t_(t,r)):n}notify(t){vn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){vn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){vn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},uo=new WeakMap,bE),fo,Ru,ir,hl,ho,Ri,yE,N6=(yE=class extends XE{constructor(t){super();Ie(this,ho);Ie(this,fo,void 0);Ie(this,Ru,void 0);Ie(this,ir,void 0);Ie(this,hl,void 0);this.mutationId=t.mutationId,Pe(this,Ru,t.defaultOptions),Pe(this,ir,t.mutationCache),Pe(this,fo,[]),this.state=t.state||L6(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options={...U(this,Ru),...t},this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){U(this,fo).includes(t)||(U(this,fo).push(t),this.clearGcTimeout(),U(this,ir).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Pe(this,fo,U(this,fo).filter(n=>n!==t)),this.scheduleGc(),U(this,ir).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){U(this,fo).length||(this.state.status==="pending"?this.scheduleGc():U(this,ir).remove(this))}continue(){var t;return((t=U(this,hl))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,s,a,l,u,d,h,p,g,b,y,x,_,w,C,R,E,M,D;const n=()=>(Pe(this,hl,KE({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(A,k)=>{ot(this,ho,Ri).call(this,{type:"failed",failureCount:A,error:k})},onPause:()=>{ot(this,ho,Ri).call(this,{type:"pause"})},onContinue:()=>{ot(this,ho,Ri).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode})),U(this,hl).promise),r=this.state.status==="pending";try{if(!r){ot(this,ho,Ri).call(this,{type:"pending",variables:t}),await((i=(o=U(this,ir).config).onMutate)==null?void 0:i.call(o,t,this));const k=await((a=(s=this.options).onMutate)==null?void 0:a.call(s,t));k!==this.state.context&&ot(this,ho,Ri).call(this,{type:"pending",context:k,variables:t})}const A=await n();return await((u=(l=U(this,ir).config).onSuccess)==null?void 0:u.call(l,A,t,this.state.context,this)),await((h=(d=this.options).onSuccess)==null?void 0:h.call(d,A,t,this.state.context)),await((g=(p=U(this,ir).config).onSettled)==null?void 0:g.call(p,A,null,this.state.variables,this.state.context,this)),await((y=(b=this.options).onSettled)==null?void 0:y.call(b,A,null,t,this.state.context)),ot(this,ho,Ri).call(this,{type:"success",data:A}),A}catch(A){try{throw await((_=(x=U(this,ir).config).onError)==null?void 0:_.call(x,A,t,this.state.context,this)),await((C=(w=this.options).onError)==null?void 0:C.call(w,A,t,this.state.context)),await((E=(R=U(this,ir).config).onSettled)==null?void 0:E.call(R,void 0,A,this.state.variables,this.state.context,this)),await((D=(M=this.options).onSettled)==null?void 0:D.call(M,void 0,A,t,this.state.context)),A}finally{ot(this,ho,Ri).call(this,{type:"error",error:A})}}}},fo=new WeakMap,Ru=new WeakMap,ir=new WeakMap,hl=new WeakMap,ho=new WeakSet,Ri=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!qh(this.options.networkMode),status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),vn.batch(()=>{U(this,fo).forEach(r=>{r.onMutationUpdate(t)}),U(this,ir).notify({mutation:this,type:"updated",action:t})})},yE);function L6(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Mr,$u,Us,xE,F6=(xE=class extends zu{constructor(t={}){super();Ie(this,Mr,void 0);Ie(this,$u,void 0);Ie(this,Us,void 0);this.config=t,Pe(this,Mr,[]),Pe(this,$u,0)}build(t,n,r){const o=new N6({mutationCache:this,mutationId:++Yd(this,$u)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){U(this,Mr).push(t),this.notify({type:"added",mutation:t})}remove(t){Pe(this,Mr,U(this,Mr).filter(n=>n!==t)),this.notify({type:"removed",mutation:t})}clear(){vn.batch(()=>{U(this,Mr).forEach(t=>{this.remove(t)})})}getAll(){return U(this,Mr)}find(t){const n={exact:!0,...t};return U(this,Mr).find(r=>n_(n,r))}findAll(t={}){return U(this,Mr).filter(n=>n_(t,n))}notify(t){vn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){return Pe(this,Us,(U(this,Us)??Promise.resolve()).then(()=>{const t=U(this,Mr).filter(n=>n.state.isPaused);return vn.batch(()=>t.reduce((n,r)=>n.then(()=>r.continue().catch(Tr)),Promise.resolve()))}).then(()=>{Pe(this,Us,void 0)})),U(this,Us)}},Mr=new WeakMap,$u=new WeakMap,Us=new WeakMap,xE);function z6(e){return{onFetch:(t,n)=>{const r=async()=>{var b,y,x,_,w;const o=t.options,i=(x=(y=(b=t.fetchOptions)==null?void 0:b.meta)==null?void 0:y.fetchMore)==null?void 0:x.direction,s=((_=t.state.data)==null?void 0:_.pages)||[],a=((w=t.state.data)==null?void 0:w.pageParams)||[],l={pages:[],pageParams:[]};let u=!1;const d=C=>{Object.defineProperty(C,"signal",{enumerable:!0,get:()=>(t.signal.aborted?u=!0:t.signal.addEventListener("abort",()=>{u=!0}),t.signal)})},h=t.options.queryFn||(()=>Promise.reject(new Error(`Missing queryFn: '${t.options.queryHash}'`))),p=async(C,R,E)=>{if(u)return Promise.reject();if(R==null&&C.pages.length)return Promise.resolve(C);const M={queryKey:t.queryKey,pageParam:R,direction:E?"backward":"forward",meta:t.options.meta};d(M);const D=await h(M),{maxPages:A}=t.options,k=E?O6:P6;return{pages:k(C.pages,D,A),pageParams:k(C.pageParams,R,A)}};let g;if(i&&s.length){const C=i==="backward",R=C?j6:i_,E={pages:s,pageParams:a},M=R(o,E);g=await p(E,M,C)}else{g=await p(l,a[0]??o.initialPageParam);const C=e??s.length;for(let R=1;R<C;R++){const E=i_(o,g);g=await p(g,E)}}return g};t.options.persister?t.fetchFn=()=>{var o,i;return(i=(o=t.options).persister)==null?void 0:i.call(o,r,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=r}}}function i_(e,{pages:t,pageParams:n}){const r=t.length-1;return e.getNextPageParam(t[r],t,n[r],n)}function j6(e,{pages:t,pageParams:n}){var r;return(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n)}var nn,Mi,Ti,pl,gl,Ai,ml,vl,wE,V6=(wE=class{constructor(e={}){Ie(this,nn,void 0);Ie(this,Mi,void 0);Ie(this,Ti,void 0);Ie(this,pl,void 0);Ie(this,gl,void 0);Ie(this,Ai,void 0);Ie(this,ml,void 0);Ie(this,vl,void 0);Pe(this,nn,e.queryCache||new QE),Pe(this,Mi,e.mutationCache||new F6),Pe(this,Ti,e.defaultOptions||{}),Pe(this,pl,new Map),Pe(this,gl,new Map),Pe(this,Ai,0)}mount(){Yd(this,Ai)._++,U(this,Ai)===1&&(Pe(this,ml,lh.subscribe(()=>{lh.isFocused()&&(this.resumePausedMutations(),U(this,nn).onFocus())})),Pe(this,vl,ch.subscribe(()=>{ch.isOnline()&&(this.resumePausedMutations(),U(this,nn).onOnline())})))}unmount(){var e,t;Yd(this,Ai)._--,U(this,Ai)===0&&((e=U(this,ml))==null||e.call(this),Pe(this,ml,void 0),(t=U(this,vl))==null||t.call(this),Pe(this,vl,void 0))}isFetching(e){return U(this,nn).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return U(this,Mi).findAll({...e,status:"pending"}).length}getQueryData(e){var t;return(t=U(this,nn).find({queryKey:e}))==null?void 0:t.state.data}ensureQueryData(e){const t=this.getQueryData(e.queryKey);return t!==void 0?Promise.resolve(t):this.fetchQuery(e)}getQueriesData(e){return this.getQueryCache().findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=U(this,nn).find({queryKey:e}),o=r==null?void 0:r.state.data,i=R6(t,o);if(typeof i>"u")return;const s=this.defaultQueryOptions({queryKey:e});return U(this,nn).build(this,s).setData(i,{...n,manual:!0})}setQueriesData(e,t,n){return vn.batch(()=>this.getQueryCache().findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var t;return(t=U(this,nn).find({queryKey:e}))==null?void 0:t.state}removeQueries(e){const t=U(this,nn);vn.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=U(this,nn),r={type:"active",...e};return vn.batch(()=>(n.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries(r,t)))}cancelQueries(e={},t={}){const n={revert:!0,...t},r=vn.batch(()=>U(this,nn).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(Tr).catch(Tr)}invalidateQueries(e={},t={}){return vn.batch(()=>{if(U(this,nn).findAll(e).forEach(r=>{r.invalidate()}),e.refetchType==="none")return Promise.resolve();const n={...e,type:e.refetchType??e.type??"active"};return this.refetchQueries(n,t)})}refetchQueries(e={},t){const n={...t,cancelRefetch:(t==null?void 0:t.cancelRefetch)??!0},r=vn.batch(()=>U(this,nn).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(Tr)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Tr)}fetchQuery(e){const t=this.defaultQueryOptions(e);typeof t.retry>"u"&&(t.retry=!1);const n=U(this,nn).build(this,t);return n.isStaleByTime(t.staleTime)?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Tr).catch(Tr)}fetchInfiniteQuery(e){return e.behavior=z6(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Tr).catch(Tr)}resumePausedMutations(){return U(this,Mi).resumePausedMutations()}getQueryCache(){return U(this,nn)}getMutationCache(){return U(this,Mi)}getDefaultOptions(){return U(this,Ti)}setDefaultOptions(e){Pe(this,Ti,e)}setQueryDefaults(e,t){U(this,pl).set(ru(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...U(this,pl).values()];let n={};return t.forEach(r=>{ou(e,r.queryKey)&&(n={...n,...r.defaultOptions})}),n}setMutationDefaults(e,t){U(this,gl).set(ru(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...U(this,gl).values()];let n={};return t.forEach(r=>{ou(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e!=null&&e._defaulted)return e;const t={...U(this,Ti).queries,...(e==null?void 0:e.queryKey)&&this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Qb(t.queryKey,t)),typeof t.refetchOnReconnect>"u"&&(t.refetchOnReconnect=t.networkMode!=="always"),typeof t.throwOnError>"u"&&(t.throwOnError=!!t.suspense),typeof t.networkMode>"u"&&t.persister&&(t.networkMode="offlineFirst"),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...U(this,Ti).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){U(this,nn).clear(),U(this,Mi).clear()}},nn=new WeakMap,Mi=new WeakMap,Ti=new WeakMap,pl=new WeakMap,gl=new WeakMap,Ai=new WeakMap,ml=new WeakMap,vl=new WeakMap,wE),Bn,It,Pu,In,qs,bl,po,Ou,yl,xl,Gs,Ys,Ii,wl,Ks,Mc,Du,Mv,Mu,Tv,Tu,Av,Au,Iv,Iu,kv,ku,Nv,Nu,Lv,zh,ZE,_E,H6=(_E=class extends zu{constructor(t,n){super();Ie(this,Ks);Ie(this,Du);Ie(this,Mu);Ie(this,Tu);Ie(this,Au);Ie(this,Iu);Ie(this,ku);Ie(this,Nu);Ie(this,zh);Ie(this,Bn,void 0);Ie(this,It,void 0);Ie(this,Pu,void 0);Ie(this,In,void 0);Ie(this,qs,void 0);Ie(this,bl,void 0);Ie(this,po,void 0);Ie(this,Ou,void 0);Ie(this,yl,void 0);Ie(this,xl,void 0);Ie(this,Gs,void 0);Ie(this,Ys,void 0);Ie(this,Ii,void 0);Ie(this,wl,new Set);this.options=n,Pe(this,Bn,t),Pe(this,po,null),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(U(this,It).addObserver(this),s_(U(this,It),this.options)?ot(this,Ks,Mc).call(this):this.updateResult(),ot(this,Au,Iv).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Fv(U(this,It),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Fv(U(this,It),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ot(this,Iu,kv).call(this),ot(this,ku,Nv).call(this),U(this,It).removeObserver(this)}setOptions(t,n){const r=this.options,o=U(this,It);if(this.options=U(this,Bn).defaultQueryOptions(t),Pv(r,this.options)||U(this,Bn).getQueryCache().notify({type:"observerOptionsUpdated",query:U(this,It),observer:this}),typeof this.options.enabled<"u"&&typeof this.options.enabled!="boolean")throw new Error("Expected enabled to be a boolean");this.options.queryKey||(this.options.queryKey=r.queryKey),ot(this,Nu,Lv).call(this);const i=this.hasListeners();i&&a_(U(this,It),o,this.options,r)&&ot(this,Ks,Mc).call(this),this.updateResult(n),i&&(U(this,It)!==o||this.options.enabled!==r.enabled||this.options.staleTime!==r.staleTime)&&ot(this,Du,Mv).call(this);const s=ot(this,Mu,Tv).call(this);i&&(U(this,It)!==o||this.options.enabled!==r.enabled||s!==U(this,Ii))&&ot(this,Tu,Av).call(this,s)}getOptimisticResult(t){const n=U(this,Bn).getQueryCache().build(U(this,Bn),t),r=this.createResult(n,t);return B6(this,r)&&(Pe(this,In,r),Pe(this,bl,this.options),Pe(this,qs,U(this,It).state)),r}getCurrentResult(){return U(this,In)}trackResult(t){const n={};return Object.keys(t).forEach(r=>{Object.defineProperty(n,r,{configurable:!1,enumerable:!0,get:()=>(U(this,wl).add(r),t[r])})}),n}getCurrentQuery(){return U(this,It)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=U(this,Bn).defaultQueryOptions(t),r=U(this,Bn).getQueryCache().build(U(this,Bn),n);return r.isFetchingOptimistic=!0,r.fetch().then(()=>this.createResult(r,n))}fetch(t){return ot(this,Ks,Mc).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),U(this,In)))}createResult(t,n){var M;const r=U(this,It),o=this.options,i=U(this,In),s=U(this,qs),a=U(this,bl),u=t!==r?t.state:U(this,Pu),{state:d}=t;let{error:h,errorUpdatedAt:p,fetchStatus:g,status:b}=d,y=!1,x;if(n._optimisticResults){const D=this.hasListeners(),A=!D&&s_(t,n),k=D&&a_(t,r,n,o);(A||k)&&(g=qh(t.options.networkMode)?"fetching":"paused",d.dataUpdatedAt||(b="pending")),n._optimisticResults==="isRestoring"&&(g="idle")}if(n.select&&typeof d.data<"u")if(i&&d.data===(s==null?void 0:s.data)&&n.select===U(this,Ou))x=U(this,yl);else try{Pe(this,Ou,n.select),x=n.select(d.data),x=Dv(i==null?void 0:i.data,x,n),Pe(this,yl,x),Pe(this,po,null)}catch(D){Pe(this,po,D)}else x=d.data;if(typeof n.placeholderData<"u"&&typeof x>"u"&&b==="pending"){let D;if(i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData))D=i.data;else if(D=typeof n.placeholderData=="function"?n.placeholderData((M=U(this,xl))==null?void 0:M.state.data,U(this,xl)):n.placeholderData,n.select&&typeof D<"u")try{D=n.select(D),Pe(this,po,null)}catch(A){Pe(this,po,A)}typeof D<"u"&&(b="success",x=Dv(i==null?void 0:i.data,D,n),y=!0)}U(this,po)&&(h=U(this,po),x=U(this,yl),p=Date.now(),b="error");const _=g==="fetching",w=b==="pending",C=b==="error",R=w&&_;return{status:b,fetchStatus:g,isPending:w,isSuccess:b==="success",isError:C,isInitialLoading:R,isLoading:R,data:x,dataUpdatedAt:d.dataUpdatedAt,error:h,errorUpdatedAt:p,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>u.dataUpdateCount||d.errorUpdateCount>u.errorUpdateCount,isFetching:_,isRefetching:_&&!w,isLoadingError:C&&d.dataUpdatedAt===0,isPaused:g==="paused",isPlaceholderData:y,isRefetchError:C&&d.dataUpdatedAt!==0,isStale:Zb(t,n),refetch:this.refetch}}updateResult(t){const n=U(this,In),r=this.createResult(U(this,It),this.options);if(Pe(this,qs,U(this,It).state),Pe(this,bl,this.options),U(this,qs).data!==void 0&&Pe(this,xl,U(this,It)),Pv(r,n))return;Pe(this,In,r);const o={},i=()=>{if(!n)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!U(this,wl).size)return!0;const l=new Set(a??U(this,wl));return this.options.throwOnError&&l.add("error"),Object.keys(U(this,In)).some(u=>{const d=u;return U(this,In)[d]!==n[d]&&l.has(d)})};(t==null?void 0:t.listeners)!==!1&&i()&&(o.listeners=!0),ot(this,zh,ZE).call(this,{...o,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ot(this,Au,Iv).call(this)}},Bn=new WeakMap,It=new WeakMap,Pu=new WeakMap,In=new WeakMap,qs=new WeakMap,bl=new WeakMap,po=new WeakMap,Ou=new WeakMap,yl=new WeakMap,xl=new WeakMap,Gs=new WeakMap,Ys=new WeakMap,Ii=new WeakMap,wl=new WeakMap,Ks=new WeakSet,Mc=function(t){ot(this,Nu,Lv).call(this);let n=U(this,It).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Tr)),n},Du=new WeakSet,Mv=function(){if(ot(this,Iu,kv).call(this),El||U(this,In).isStale||!$v(this.options.staleTime))return;const n=qE(U(this,In).dataUpdatedAt,this.options.staleTime)+1;Pe(this,Gs,setTimeout(()=>{U(this,In).isStale||this.updateResult()},n))},Mu=new WeakSet,Tv=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(U(this,It)):this.options.refetchInterval)??!1},Tu=new WeakSet,Av=function(t){ot(this,ku,Nv).call(this),Pe(this,Ii,t),!(El||this.options.enabled===!1||!$v(U(this,Ii))||U(this,Ii)===0)&&Pe(this,Ys,setInterval(()=>{(this.options.refetchIntervalInBackground||lh.isFocused())&&ot(this,Ks,Mc).call(this)},U(this,Ii)))},Au=new WeakSet,Iv=function(){ot(this,Du,Mv).call(this),ot(this,Tu,Av).call(this,ot(this,Mu,Tv).call(this))},Iu=new WeakSet,kv=function(){U(this,Gs)&&(clearTimeout(U(this,Gs)),Pe(this,Gs,void 0))},ku=new WeakSet,Nv=function(){U(this,Ys)&&(clearInterval(U(this,Ys)),Pe(this,Ys,void 0))},Nu=new WeakSet,Lv=function(){const t=U(this,Bn).getQueryCache().build(U(this,Bn),this.options);if(t===U(this,It))return;const n=U(this,It);Pe(this,It,t),Pe(this,Pu,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},zh=new WeakSet,ZE=function(t){vn.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(U(this,In))}),U(this,Bn).getQueryCache().notify({query:U(this,It),type:"observerResultsUpdated"})})},_E);function W6(e,t){return t.enabled!==!1&&!e.state.dataUpdatedAt&&!(e.state.status==="error"&&t.retryOnMount===!1)}function s_(e,t){return W6(e,t)||e.state.dataUpdatedAt>0&&Fv(e,t,t.refetchOnMount)}function Fv(e,t,n){if(t.enabled!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Zb(e,t)}return!1}function a_(e,t,n,r){return n.enabled!==!1&&(e!==t||r.enabled===!1)&&(!n.suspense||e.state.status!=="error")&&Zb(e,n)}function Zb(e,t){return e.isStaleByTime(t.staleTime)}function B6(e,t){return!Pv(e.getCurrentResult(),t)}var JE=le.createContext(void 0),U6=e=>{const t=le.useContext(JE);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},q6=({client:e,children:t})=>(le.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),le.createElement(JE.Provider,{value:e},t)),eR=le.createContext(!1),G6=()=>le.useContext(eR);eR.Provider;function Y6(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var K6=le.createContext(Y6()),X6=()=>le.useContext(K6);function Q6(e,t){return typeof e=="function"?e(...t):!!e}var Z6=(e,t)=>{(e.suspense||e.throwOnError)&&(t.isReset()||(e.retryOnMount=!1))},J6=e=>{le.useEffect(()=>{e.clearReset()},[e])},e9=({result:e,errorResetBoundary:t,throwOnError:n,query:r})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&Q6(n,[e.error,r]),t9=e=>{e.suspense&&typeof e.staleTime!="number"&&(e.staleTime=1e3)},n9=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,r9=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function o9(e,t,n){if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=U6(n),o=G6(),i=X6(),s=r.defaultQueryOptions(e);s._optimisticResults=o?"isRestoring":"optimistic",t9(s),Z6(s,i),J6(i);const[a]=le.useState(()=>new t(r,s)),l=a.getOptimisticResult(s);if(le.useSyncExternalStore(le.useCallback(u=>{const d=o?()=>{}:a.subscribe(vn.batchCalls(u));return a.updateResult(),d},[a,o]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),le.useEffect(()=>{a.setOptions(s,{listeners:!1})},[s,a]),n9(s,l))throw r9(s,a,i);if(e9({result:l,errorResetBoundary:i,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash)}))throw l.error;return s.notifyOnChangeProps?l:a.trackResult(l)}function ju(e,t){return o9(e,H6,t)}const i9={theme:"system",setTheme:()=>null},tR=m.createContext(i9);function s9({children:e,defaultTheme:t="system",storageKey:n="vite-ui-theme",...r}){const[o,i]=m.useState(()=>localStorage.getItem(n)||t);m.useEffect(()=>{const a=window.document.documentElement;if(a.classList.remove("light","dark"),o==="system"){const l=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";a.classList.add(l);return}a.classList.add(o)},[o]);const s={theme:o,setTheme:a=>{localStorage.setItem(n,a),i(a)}};return I.jsx(tR.Provider,{...r,value:s,children:e})}const nR=()=>{const e=m.useContext(tR);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e};async function a9(e){return await(await fetch("https://semaphor.cloud/api/v1/dashboard",{headers:{Authorization:`Bearer ${e}`}})).json()}function rR(e){return e==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e}function l_(e,t){const n=rR(e);return n==="dark"?ia.merge({...t==null?void 0:t.default},{...t==null?void 0:t.dark}):t==null?void 0:t.default}function l9({authToken:e,customStyle:t,currentTheme:n,onSave:r,onEvent:o}){const{data:i,refetch:s,isLoading:a,isError:l}=ju({queryKey:["dashboard",e==null?void 0:e.accessToken],queryFn:()=>a9(e==null?void 0:e.accessToken),enabled:!1}),{theme:u,setTheme:d}=nR(),{setDashboard:h,setSelectedSheetId:p,setStyle:g,setOnSaveFunction:b}=Ce(E=>E.actions);Ce(E=>E.actions.setCustomCards);const y=Ce(E=>E.actions.setFilterValues),x=Ce(E=>E.actions.setBookmarkKey),_=Ce(E=>E.actions.setAuthToken),w=Ce(E=>E.actions.setThemeStyle),C=Ce(E=>E.actions.setDashboardTheme),R=Ce(E=>E.actions.setOnEvent);return m.useEffect(()=>{if(u){const E=rR(u);C(E)}},[u,C]),m.useEffect(()=>{n&&d(n)},[n,d]),m.useEffect(()=>{const E=ia.cloneDeep(Rv);if(t){const M=ia.merge(E,t),D=l_(u,M);w(D),g(M)}else{const M=l_(u,E);w(M),g(Rv)}},[u,t,g,w]),m.useEffect(()=>{var k;if(!i||!i.dashboard)return;const E=i.dashboard,M=uD(E.id),D=JSON.parse(localStorage.getItem(M)||"[]"),A=D.find(L=>L.default===!0);if(A)h(A.template),x(A.name),A.filterValues&&y(A.filterValues);else{h(E);const L=D.find(W=>(W==null?void 0:W.name)==="Original");L?L.template=E:D.push({name:"Original",template:E,default:!1}),localStorage.setItem(M,JSON.stringify(D))}p((k=E.sheets)==null?void 0:k[0].id)},[i,h,p,y,x]),m.useEffect(()=>{r&&b(r),o&&R(o)},[r,b,o,R]),m.useEffect(()=>{e&&e.accessToken&&(_(e),s())},[e,s,_]),{isLoading:a,isError:l}}function Jb({className:e,...t}){return I.jsx("div",{className:_e("animate-pulse rounded-md bg-muted",e),...t})}const e0=le.forwardRef(({className:e,...t},n)=>I.jsx("div",{ref:n,className:_e("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));e0.displayName="Card";const Gh=le.forwardRef(({className:e,...t},n)=>I.jsx("div",{ref:n,className:_e("flex flex-col space-y-1.5 p-6",e),...t}));Gh.displayName="CardHeader";const Vu=le.forwardRef(({className:e,...t},n)=>I.jsx("h3",{ref:n,className:_e("text-2xl font-semibold leading-none tracking-tight",e),...t}));Vu.displayName="CardTitle";const t0=le.forwardRef(({className:e,...t},n)=>I.jsx("p",{ref:n,className:_e("text-sm text-muted-foreground",e),...t}));t0.displayName="CardDescription";const Yh=le.forwardRef(({className:e,...t},n)=>I.jsx("div",{ref:n,className:_e("px-6 pt-0",e),...t}));Yh.displayName="CardContent";const n0=le.forwardRef(({className:e,...t},n)=>I.jsx("div",{ref:n,className:_e("flex items-center p-6 pt-0",e),...t}));n0.displayName="CardFooter";function oR({className:e,style:t,onSave:n,onEvent:r,LoadingComponent:o,ErrorComponent:i,onChartElementClicked:s,id:a,authToken:l,currentTheme:u,version:d,customCards:h,...p}){Ce(w=>w.selectedSheetId);const g=Ce(w=>w.themeStyle),b=Ce(w=>w.onEvent),y=Ce(w=>w.isSessionExpired),{isLoading:x,isError:_}=l9({authToken:l,customStyle:t,currentTheme:u,onSave:n,onEvent:r});return x||!l?(b==null||b({type:"info",message:`isLoading: ${x}, accessToken: ${l==null?void 0:l.accessToken}`}),o?I.jsx(o,{message:"loading"}):I.jsx("div",{className:"flex items-center gap-3",children:I.jsx(Jb,{className:"h-1 w-full dark:h-[2px]"})})):_?(b==null||b({type:"error",message:"Error fetching dashboard"}),i?(console.log("Error fetching dashboard"),I.jsx(i,{})):I.jsx("div",{children:"Error"})):y?(b==null||b({type:"error",message:"Session Expired"}),I.jsx("div",{className:"flex h-full items-center justify-center",children:I.jsxs("div",{className:"space-y-4 rounded-md border border-muted p-10",children:[I.jsx(Vu,{children:"Session Expired"}),I.jsx("p",{className:"text-muted-foreground",children:"Your session has expired. Please refresh the page to continue."})]})})):I.jsx("div",{className:_e("flex h-full grow flex-col justify-between",g==null?void 0:g.dashboardPanel,e),role:"dashboard-panel",...p})}function te(){return te=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},te.apply(this,arguments)}function we(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 dn(e,t=[]){let n=[];function r(i,s){const a=m.createContext(s),l=n.length;n=[...n,s];function u(h){const{scope:p,children:g,...b}=h,y=(p==null?void 0:p[e][l])||a,x=m.useMemo(()=>b,Object.values(b));return m.createElement(y.Provider,{value:x},g)}function d(h,p){const g=(p==null?void 0:p[e][l])||a,b=m.useContext(g);if(b)return b;if(s!==void 0)return s;throw new Error(`\`${h}\` must be used within \`${i}\``)}return u.displayName=i+"Provider",[u,d]}const o=()=>{const i=n.map(s=>m.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return m.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,c9(o,...t)]}function c9(...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:u})=>{const h=l(i)[`__scope${u}`];return{...a,...h}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function u9(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Kh(...e){return t=>e.forEach(n=>u9(n,t))}function Xe(...e){return m.useCallback(Kh(...e),e)}const ni=m.forwardRef((e,t)=>{const{children:n,...r}=e,o=m.Children.toArray(n),i=o.find(d9);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(zv,te({},r,{ref:t}),m.isValidElement(s)?m.cloneElement(s,void 0,a):null)}return m.createElement(zv,te({},r,{ref:t}),n)});ni.displayName="Slot";const zv=m.forwardRef((e,t)=>{const{children:n,...r}=e;return m.isValidElement(n)?m.cloneElement(n,{...f9(r,n.props),ref:t?Kh(t,n.ref):n.ref}):m.Children.count(n)>1?m.Children.only(null):null});zv.displayName="SlotClone";const iR=({children:e})=>m.createElement(m.Fragment,null,e);function d9(e){return m.isValidElement(e)&&e.type===iR}function f9(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}}function Xh(e){const t=e+"CollectionProvider",[n,r]=dn(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=g=>{const{scope:b,children:y}=g,x=m.useRef(null),_=m.useRef(new Map).current;return m.createElement(o,{scope:b,itemMap:_,collectionRef:x},y)},a=e+"CollectionSlot",l=m.forwardRef((g,b)=>{const{scope:y,children:x}=g,_=i(a,y),w=Xe(b,_.collectionRef);return m.createElement(ni,{ref:w},x)}),u=e+"CollectionItemSlot",d="data-radix-collection-item",h=m.forwardRef((g,b)=>{const{scope:y,children:x,..._}=g,w=m.useRef(null),C=Xe(b,w),R=i(u,y);return m.useEffect(()=>(R.itemMap.set(w,{ref:w,..._}),()=>void R.itemMap.delete(w))),m.createElement(ni,{[d]:"",ref:C},x)});function p(g){const b=i(e+"CollectionConsumer",g);return m.useCallback(()=>{const x=b.collectionRef.current;if(!x)return[];const _=Array.from(x.querySelectorAll(`[${d}]`));return Array.from(b.itemMap.values()).sort((R,E)=>_.indexOf(R.ref.current)-_.indexOf(E.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:s,Slot:l,ItemSlot:h},p,r]}const Pn=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},h9=le.useId||(()=>{});let p9=0;function Yn(e){const[t,n]=le.useState(h9());return Pn(()=>{e||n(r=>r??String(p9++))},[e]),e||(t?`radix-${t}`:"")}const g9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],ke=g9.reduce((e,t)=>{const n=m.forwardRef((r,o)=>{const{asChild:i,...s}=r,a=i?ni:t;return m.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),m.createElement(a,te({},s,{ref:o}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function sR(e,t){e&&So.flushSync(()=>e.dispatchEvent(t))}function on(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}function On({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=m9({defaultProp:t,onChange:n}),i=e!==void 0,s=i?e:r,a=on(n),l=m.useCallback(u=>{if(i){const h=typeof u=="function"?u(e):u;h!==e&&a(h)}else o(u)},[i,e,o,a]);return[s,l]}function m9({defaultProp:e,onChange:t}){const n=m.useState(e),[r]=n,o=m.useRef(r),i=on(t);return m.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}const v9=m.createContext(void 0);function ha(e){const t=m.useContext(v9);return e||t||"ltr"}const cm="rovingFocusGroup.onEntryFocus",b9={bubbles:!1,cancelable:!0},r0="RovingFocusGroup",[jv,aR,y9]=Xh(r0),[x9,zl]=dn(r0,[y9]),[w9,_9]=x9(r0),S9=m.forwardRef((e,t)=>m.createElement(jv.Provider,{scope:e.__scopeRovingFocusGroup},m.createElement(jv.Slot,{scope:e.__scopeRovingFocusGroup},m.createElement(C9,te({},e,{ref:t}))))),C9=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:u,...d}=e,h=m.useRef(null),p=Xe(t,h),g=ha(i),[b=null,y]=On({prop:s,defaultProp:a,onChange:l}),[x,_]=m.useState(!1),w=on(u),C=aR(n),R=m.useRef(!1),[E,M]=m.useState(0);return m.useEffect(()=>{const D=h.current;if(D)return D.addEventListener(cm,w),()=>D.removeEventListener(cm,w)},[w]),m.createElement(w9,{scope:n,orientation:r,dir:g,loop:o,currentTabStopId:b,onItemFocus:m.useCallback(D=>y(D),[y]),onItemShiftTab:m.useCallback(()=>_(!0),[]),onFocusableItemAdd:m.useCallback(()=>M(D=>D+1),[]),onFocusableItemRemove:m.useCallback(()=>M(D=>D-1),[])},m.createElement(ke.div,te({tabIndex:x||E===0?-1:0,"data-orientation":r},d,{ref:p,style:{outline:"none",...e.style},onMouseDown:we(e.onMouseDown,()=>{R.current=!0}),onFocus:we(e.onFocus,D=>{const A=!R.current;if(D.target===D.currentTarget&&A&&!x){const k=new CustomEvent(cm,b9);if(D.currentTarget.dispatchEvent(k),!k.defaultPrevented){const L=C().filter(F=>F.focusable),W=L.find(F=>F.active),Y=L.find(F=>F.id===b),Q=[W,Y,...L].filter(Boolean).map(F=>F.ref.current);lR(Q)}}R.current=!1}),onBlur:we(e.onBlur,()=>_(!1))})))}),E9="RovingFocusGroupItem",R9=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,...s}=e,a=Yn(),l=i||a,u=_9(E9,n),d=u.currentTabStopId===l,h=aR(n),{onFocusableItemAdd:p,onFocusableItemRemove:g}=u;return m.useEffect(()=>{if(r)return p(),()=>g()},[r,p,g]),m.createElement(jv.ItemSlot,{scope:n,id:l,focusable:r,active:o},m.createElement(ke.span,te({tabIndex:d?0:-1,"data-orientation":u.orientation},s,{ref:t,onMouseDown:we(e.onMouseDown,b=>{r?u.onItemFocus(l):b.preventDefault()}),onFocus:we(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:we(e.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){u.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const y=O9(b,u.orientation,u.dir);if(y!==void 0){b.preventDefault();let _=h().filter(w=>w.focusable).map(w=>w.ref.current);if(y==="last")_.reverse();else if(y==="prev"||y==="next"){y==="prev"&&_.reverse();const w=_.indexOf(b.currentTarget);_=u.loop?D9(_,w+1):_.slice(w+1)}setTimeout(()=>lR(_))}})})))}),$9={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function P9(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function O9(e,t,n){const r=P9(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return $9[r]}function lR(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function D9(e,t){return e.map((n,r)=>e[(t+r)%e.length])}const o0=S9,i0=R9;function M9(e,t){return m.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const Zt=e=>{const{present:t,children:n}=e,r=T9(t),o=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),i=Xe(r.ref,o.ref);return typeof n=="function"||r.isPresent?m.cloneElement(o,{ref:i}):null};Zt.displayName="Presence";function T9(e){const[t,n]=m.useState(),r=m.useRef({}),o=m.useRef(e),i=m.useRef("none"),s=e?"mounted":"unmounted",[a,l]=M9(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const u=Zd(r.current);i.current=a==="mounted"?u:"none"},[a]),Pn(()=>{const u=r.current,d=o.current;if(d!==e){const p=i.current,g=Zd(u);e?l("MOUNT"):g==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(d&&p!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),Pn(()=>{if(t){const u=h=>{const g=Zd(r.current).includes(h.animationName);h.target===t&&g&&So.flushSync(()=>l("ANIMATION_END"))},d=h=>{h.target===t&&(i.current=Zd(r.current))};return t.addEventListener("animationstart",d),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{t.removeEventListener("animationstart",d),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:m.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function Zd(e){return(e==null?void 0:e.animationName)||"none"}const cR="Tabs",[A9,Qre]=dn(cR,[zl]),uR=zl(),[I9,s0]=A9(cR),k9=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:l="automatic",...u}=e,d=ha(a),[h,p]=On({prop:r,onChange:o,defaultProp:i});return m.createElement(I9,{scope:n,baseId:Yn(),value:h,onValueChange:p,orientation:s,dir:d,activationMode:l},m.createElement(ke.div,te({dir:d,"data-orientation":s},u,{ref:t})))}),N9="TabsList",L9=m.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=s0(N9,n),s=uR(n);return m.createElement(o0,te({asChild:!0},s,{orientation:i.orientation,dir:i.dir,loop:r}),m.createElement(ke.div,te({role:"tablist","aria-orientation":i.orientation},o,{ref:t})))}),F9="TabsTrigger",z9=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=s0(F9,n),a=uR(n),l=dR(s.baseId,r),u=fR(s.baseId,r),d=r===s.value;return m.createElement(i0,te({asChild:!0},a,{focusable:!o,active:d}),m.createElement(ke.button,te({type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:l},i,{ref:t,onMouseDown:we(e.onMouseDown,h=>{!o&&h.button===0&&h.ctrlKey===!1?s.onValueChange(r):h.preventDefault()}),onKeyDown:we(e.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&s.onValueChange(r)}),onFocus:we(e.onFocus,()=>{const h=s.activationMode!=="manual";!d&&!o&&h&&s.onValueChange(r)})})))}),j9="TabsContent",V9=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=s0(j9,n),l=dR(a.baseId,r),u=fR(a.baseId,r),d=r===a.value,h=m.useRef(d);return m.useEffect(()=>{const p=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(p)},[]),m.createElement(Zt,{present:o||d},({present:p})=>m.createElement(ke.div,te({"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!p,id:u,tabIndex:0},s,{ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0}}),p&&i))});function dR(e,t){return`${e}-trigger-${t}`}function fR(e,t){return`${e}-content-${t}`}const H9=k9,hR=L9,pR=z9,gR=V9,mR=H9,vR=le.forwardRef(({className:e,...t},n)=>I.jsx(hR,{ref:n,className:_e("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));vR.displayName=hR.displayName;const bR=le.forwardRef(({className:e,...t},n)=>I.jsx(pR,{ref:n,className:_e("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));bR.displayName=pR.displayName;const a0=le.forwardRef(({className:e,...t},n)=>I.jsx(gR,{ref:n,className:_e("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));a0.displayName=gR.displayName;var yR={exports:{}},Hu={},Vv={exports:{}};(function(e,t){(function(n,r){r(t)})(ks,function(n){function r(ee){return function(ie,ye,Z,De,Ne,Ve,qe){return ee(ie,ye,qe)}}function o(ee){return function(ie,ye,Z,De){if(!ie||!ye||typeof ie!="object"||typeof ye!="object")return ee(ie,ye,Z,De);var Ne=De.get(ie),Ve=De.get(ye);if(Ne&&Ve)return Ne===ye&&Ve===ie;De.set(ie,ye),De.set(ye,ie);var qe=ee(ie,ye,Z,De);return De.delete(ie),De.delete(ye),qe}}function i(ee,K){var ie={};for(var ye in ee)ie[ye]=ee[ye];for(var ye in K)ie[ye]=K[ye];return ie}function s(ee){return ee.constructor===Object||ee.constructor==null}function a(ee){return typeof ee.then=="function"}function l(ee,K){return ee===K||ee!==ee&&K!==K}var u="[object Arguments]",d="[object Boolean]",h="[object Date]",p="[object RegExp]",g="[object Map]",b="[object Number]",y="[object Object]",x="[object Set]",_="[object String]",w=Object.prototype.toString;function C(ee){var K=ee.areArraysEqual,ie=ee.areDatesEqual,ye=ee.areMapsEqual,Z=ee.areObjectsEqual,De=ee.areRegExpsEqual,Ne=ee.areSetsEqual,Ve=ee.createIsNestedEqual,qe=Ve(pt);function pt(dt,ft,Bt){if(dt===ft)return!0;if(!dt||!ft||typeof dt!="object"||typeof ft!="object")return dt!==dt&&ft!==ft;if(s(dt)&&s(ft))return Z(dt,ft,qe,Bt);var Vt=Array.isArray(dt),xn=Array.isArray(ft);if(Vt||xn)return Vt===xn&&K(dt,ft,qe,Bt);var Jt=w.call(dt);return Jt!==w.call(ft)?!1:Jt===h?ie(dt,ft,qe,Bt):Jt===p?De(dt,ft,qe,Bt):Jt===g?ye(dt,ft,qe,Bt):Jt===x?Ne(dt,ft,qe,Bt):Jt===y||Jt===u?a(dt)||a(ft)?!1:Z(dt,ft,qe,Bt):Jt===d||Jt===b||Jt===_?l(dt.valueOf(),ft.valueOf()):!1}return pt}function R(ee,K,ie,ye){var Z=ee.length;if(K.length!==Z)return!1;for(;Z-- >0;)if(!ie(ee[Z],K[Z],Z,Z,ee,K,ye))return!1;return!0}var E=o(R);function M(ee,K){return l(ee.valueOf(),K.valueOf())}function D(ee,K,ie,ye){var Z=ee.size===K.size;if(!Z)return!1;if(!ee.size)return!0;var De={},Ne=0;return ee.forEach(function(Ve,qe){if(Z){var pt=!1,dt=0;K.forEach(function(ft,Bt){!pt&&!De[dt]&&(pt=ie(qe,Bt,Ne,dt,ee,K,ye)&&ie(Ve,ft,qe,Bt,ee,K,ye))&&(De[dt]=!0),dt++}),Ne++,Z=pt}}),Z}var A=o(D),k="_owner",L=Object.prototype.hasOwnProperty;function W(ee,K,ie,ye){var Z=Object.keys(ee),De=Z.length;if(Object.keys(K).length!==De)return!1;for(var Ne;De-- >0;){if(Ne=Z[De],Ne===k){var Ve=!!ee.$$typeof,qe=!!K.$$typeof;if((Ve||qe)&&Ve!==qe)return!1}if(!L.call(K,Ne)||!ie(ee[Ne],K[Ne],Ne,Ne,ee,K,ye))return!1}return!0}var Y=o(W);function ne(ee,K){return ee.source===K.source&&ee.flags===K.flags}function Q(ee,K,ie,ye){var Z=ee.size===K.size;if(!Z)return!1;if(!ee.size)return!0;var De={};return ee.forEach(function(Ne,Ve){if(Z){var qe=!1,pt=0;K.forEach(function(dt,ft){!qe&&!De[pt]&&(qe=ie(Ne,dt,Ve,ft,ee,K,ye))&&(De[pt]=!0),pt++}),Z=qe}}),Z}var F=o(Q),J=Object.freeze({areArraysEqual:R,areDatesEqual:M,areMapsEqual:D,areObjectsEqual:W,areRegExpsEqual:ne,areSetsEqual:Q,createIsNestedEqual:r}),q=Object.freeze({areArraysEqual:E,areDatesEqual:M,areMapsEqual:A,areObjectsEqual:Y,areRegExpsEqual:ne,areSetsEqual:F,createIsNestedEqual:r}),X=C(J);function ae(ee,K){return X(ee,K,void 0)}var j=C(i(J,{createIsNestedEqual:function(){return l}}));function V(ee,K){return j(ee,K,void 0)}var oe=C(q);function ce(ee,K){return oe(ee,K,new WeakMap)}var ue=C(i(q,{createIsNestedEqual:function(){return l}}));function ge(ee,K){return ue(ee,K,new WeakMap)}function ve(ee){return C(i(J,ee(J)))}function fe(ee){var K=C(i(q,ee(q)));return function(ie,ye,Z){return Z===void 0&&(Z=new WeakMap),K(ie,ye,Z)}}n.circularDeepEqual=ce,n.circularShallowEqual=ge,n.createCustomCircularEqual=fe,n.createCustomEqual=ve,n.deepEqual=ae,n.sameValueZeroEqual=l,n.shallowEqual=V,Object.defineProperty(n,"__esModule",{value:!0})})})(Vv,Vv.exports);var l0=Vv.exports;const c0=Bb(cN);var at={},W9=function(t,n,r){return t===n?!0:t.className===n.className&&r(t.style,n.style)&&t.width===n.width&&t.autoSize===n.autoSize&&t.cols===n.cols&&t.draggableCancel===n.draggableCancel&&t.draggableHandle===n.draggableHandle&&r(t.verticalCompact,n.verticalCompact)&&r(t.compactType,n.compactType)&&r(t.layout,n.layout)&&r(t.margin,n.margin)&&r(t.containerPadding,n.containerPadding)&&t.rowHeight===n.rowHeight&&t.maxRows===n.maxRows&&t.isBounded===n.isBounded&&t.isDraggable===n.isDraggable&&t.isResizable===n.isResizable&&t.allowOverlap===n.allowOverlap&&t.preventCollision===n.preventCollision&&t.useCSSTransforms===n.useCSSTransforms&&t.transformScale===n.transformScale&&t.isDroppable===n.isDroppable&&r(t.resizeHandles,n.resizeHandles)&&r(t.resizeHandle,n.resizeHandle)&&t.onLayoutChange===n.onLayoutChange&&t.onDragStart===n.onDragStart&&t.onDrag===n.onDrag&&t.onDragStop===n.onDragStop&&t.onResizeStart===n.onResizeStart&&t.onResize===n.onResize&&t.onResizeStop===n.onResizeStop&&t.onDrop===n.onDrop&&r(t.droppingItem,n.droppingItem)&&r(t.innerRef,n.innerRef)};Object.defineProperty(at,"__esModule",{value:!0});at.bottom=u0;at.childrenEqual=G9;at.cloneLayout=xR;at.cloneLayoutItem=Xs;at.collides=Qh;at.compact=_R;at.compactItem=SR;at.compactType=aL;at.correctBounds=CR;at.fastPositionEqual=K9;at.fastRGLPropsEqual=void 0;at.getAllCollisions=ER;at.getFirstCollision=Fs;at.getLayoutItem=d0;at.getStatics=f0;at.modifyLayout=wR;at.moveElement=Ac;at.moveElementAwayFromCollision=Wv;at.noop=void 0;at.perc=Q9;at.resizeItemInDirection=rL;at.setTopLeft=iL;at.setTransform=oL;at.sortLayoutItems=b0;at.sortLayoutItemsByColRow=DR;at.sortLayoutItemsByRowCol=OR;at.synchronizeLayoutWithChildren=sL;at.validateLayout=MR;at.withLayoutItem=q9;var c_=l0,Tc=B9(m);function B9(e){return e&&e.__esModule?e:{default:e}}const U9=process.env.NODE_ENV==="production";function u0(e){let t=0,n;for(let r=0,o=e.length;r<o;r++)n=e[r].y+e[r].h,n>t&&(t=n);return t}function xR(e){const t=Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=Xs(e[n]);return t}function wR(e,t){const n=Array(e.length);for(let r=0,o=e.length;r<o;r++)t.i===e[r].i?n[r]=t:n[r]=e[r];return n}function q9(e,t,n){let r=d0(e,t);return r?(r=n(Xs(r)),e=wR(e,r),[e,r]):[e,null]}function Xs(e){return{w:e.w,h:e.h,x:e.x,y:e.y,i:e.i,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:!!e.moved,static:!!e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}}function G9(e,t){return(0,c_.deepEqual)(Tc.default.Children.map(e,n=>n==null?void 0:n.key),Tc.default.Children.map(t,n=>n==null?void 0:n.key))&&(0,c_.deepEqual)(Tc.default.Children.map(e,n=>n==null?void 0:n.props["data-grid"]),Tc.default.Children.map(t,n=>n==null?void 0:n.props["data-grid"]))}const Y9=W9;at.fastRGLPropsEqual=Y9;function K9(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function Qh(e,t){return!(e.i===t.i||e.x+e.w<=t.x||e.x>=t.x+t.w||e.y+e.h<=t.y||e.y>=t.y+t.h)}function _R(e,t,n,r){const o=f0(e),i=b0(e,t),s=Array(e.length);for(let a=0,l=i.length;a<l;a++){let u=Xs(i[a]);u.static||(u=SR(o,u,t,n,i,r),o.push(u)),s[e.indexOf(i[a])]=u,u.moved=!1}return s}const X9={x:"w",y:"h"};function Hv(e,t,n,r){const o=X9[r];t[r]+=1;const i=e.map(s=>s.i).indexOf(t.i);for(let s=i+1;s<e.length;s++){const a=e[s];if(!a.static){if(a.y>t.y+t.h)break;Qh(t,a)&&Hv(e,a,n+t[o],r)}}t[r]=n}function SR(e,t,n,r,o,i){const s=n==="vertical",a=n==="horizontal";if(s)for(t.y=Math.min(u0(e),t.y);t.y>0&&!Fs(e,t);)t.y--;else if(a)for(;t.x>0&&!Fs(e,t);)t.x--;let l;for(;(l=Fs(e,t))&&!(n===null&&i);)if(a?Hv(o,t,l.x+l.w,"x"):Hv(o,t,l.y+l.h,"y"),a&&t.x+t.w>r)for(t.x=r-t.w,t.y++;t.x>0&&!Fs(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function CR(e,t){const n=f0(e);for(let r=0,o=e.length;r<o;r++){const i=e[r];if(i.x+i.w>t.cols&&(i.x=t.cols-i.w),i.x<0&&(i.x=0,i.w=t.cols),!i.static)n.push(i);else for(;Fs(n,i);)i.y++}return e}function d0(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function Fs(e,t){for(let n=0,r=e.length;n<r;n++)if(Qh(e[n],t))return e[n]}function ER(e,t){return e.filter(n=>Qh(n,t))}function f0(e){return e.filter(t=>t.static)}function Ac(e,t,n,r,o,i,s,a,l){if(t.static&&t.isDraggable!==!0||t.y===r&&t.x===n)return e;"Moving element ".concat(t.i," to [").concat(String(n),",").concat(String(r),"] from [").concat(t.x,",").concat(t.y,"]");const u=t.x,d=t.y;typeof n=="number"&&(t.x=n),typeof r=="number"&&(t.y=r),t.moved=!0;let h=b0(e,s);(s==="vertical"&&typeof r=="number"?d>=r:s==="horizontal"&&typeof n=="number"?u>=n:!1)&&(h=h.reverse());const g=ER(h,t),b=g.length>0;if(b&&l)return xR(e);if(b&&i)return"Collision prevented on ".concat(t.i,", reverting."),t.x=u,t.y=d,t.moved=!1,e;for(let y=0,x=g.length;y<x;y++){const _=g[y];"Resolving collision between ".concat(t.i," at [").concat(t.x,",").concat(t.y,"] and ").concat(_.i," at [").concat(_.x,",").concat(_.y,"]"),!_.moved&&(_.static?e=Wv(e,_,t,o,s):e=Wv(e,t,_,o,s))}return e}function Wv(e,t,n,r,o,i){const s=o==="horizontal",a=o==="vertical",l=t.static;if(r){r=!1;const h={x:s?Math.max(t.x-n.w,0):n.x,y:a?Math.max(t.y-n.h,0):n.y,w:n.w,h:n.h,i:"-1"},p=Fs(e,h),g=p&&p.y+p.h>t.y,b=p&&t.x+t.w>p.x;if(p){if(g&&a)return Ac(e,n,void 0,t.y+1,r,l,o);if(g&&o==null)return t.y=n.y,n.y=n.y+n.h,e;if(b&&s)return Ac(e,t,n.x,void 0,r,l,o)}else return"Doing reverse collision on ".concat(n.i," up to [").concat(h.x,",").concat(h.y,"]."),Ac(e,n,s?h.x:void 0,a?h.y:void 0,r,l,o)}const u=s?n.x+1:void 0,d=a?n.y+1:void 0;return u==null&&d==null?e:Ac(e,n,s?n.x+1:void 0,a?n.y+1:void 0,r,l,o)}function Q9(e){return e*100+"%"}const RR=(e,t,n,r)=>e+n>r?t:n,$R=(e,t,n)=>e<0?t:n,PR=e=>Math.max(0,e),h0=e=>Math.max(0,e),p0=(e,t,n)=>{let{left:r,height:o,width:i}=t;const s=e.top-(o-e.height);return{left:r,width:i,height:$R(s,e.height,o),top:h0(s)}},g0=(e,t,n)=>{let{top:r,left:o,height:i,width:s}=t;return{top:r,height:i,width:RR(e.left,e.width,s,n),left:PR(o)}},m0=(e,t,n)=>{let{top:r,height:o,width:i}=t;const s=e.left-(i-e.width);return{height:o,width:s<0?e.width:RR(e.left,e.width,i,n),top:h0(r),left:PR(s)}},v0=(e,t,n)=>{let{top:r,left:o,height:i,width:s}=t;return{width:s,left:o,height:$R(r,e.height,i),top:h0(r)}},Z9=function(){return p0(arguments.length<=0?void 0:arguments[0],g0(...arguments))},J9=function(){return p0(arguments.length<=0?void 0:arguments[0],m0(...arguments))},eL=function(){return v0(arguments.length<=0?void 0:arguments[0],g0(...arguments))},tL=function(){return v0(arguments.length<=0?void 0:arguments[0],m0(...arguments))},nL={n:p0,ne:Z9,e:g0,se:eL,s:v0,sw:tL,w:m0,nw:J9};function rL(e,t,n,r){const o=nL[e];return o?o(t,{...t,...n},r):n}function oL(e){let{top:t,left:n,width:r,height:o}=e;const i="translate(".concat(n,"px,").concat(t,"px)");return{transform:i,WebkitTransform:i,MozTransform:i,msTransform:i,OTransform:i,width:"".concat(r,"px"),height:"".concat(o,"px"),position:"absolute"}}function iL(e){let{top:t,left:n,width:r,height:o}=e;return{top:"".concat(t,"px"),left:"".concat(n,"px"),width:"".concat(r,"px"),height:"".concat(o,"px"),position:"absolute"}}function b0(e,t){return t==="horizontal"?DR(e):t==="vertical"?OR(e):e}function OR(e){return e.slice(0).sort(function(t,n){return t.y>n.y||t.y===n.y&&t.x>n.x?1:t.y===n.y&&t.x===n.x?0:-1})}function DR(e){return e.slice(0).sort(function(t,n){return t.x>n.x||t.x===n.x&&t.y>n.y?1:-1})}function sL(e,t,n,r,o){e=e||[];const i=[];Tc.default.Children.forEach(t,a=>{if((a==null?void 0:a.key)==null)return;const l=d0(e,String(a.key)),u=a.props["data-grid"];l&&u==null?i.push(Xs(l)):u?(U9||MR([u],"ReactGridLayout.children"),i.push(Xs({...u,i:a.key}))):i.push(Xs({w:1,h:1,x:0,y:u0(i),i:String(a.key)}))});const s=CR(i,{cols:n});return o?s:_R(s,r,n)}function MR(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Layout";const n=["x","y","w","h"];if(!Array.isArray(e))throw new Error(t+" must be an array!");for(let r=0,o=e.length;r<o;r++){const i=e[r];for(let s=0;s<n.length;s++)if(typeof i[n[s]]!="number")throw new Error("ReactGridLayout: "+t+"["+r+"]."+n[s]+" must be a number!")}}function aL(e){const{verticalCompact:t,compactType:n}=e||{};return t===!1?null:n}const lL=()=>{};at.noop=lL;var Co={};Object.defineProperty(Co,"__esModule",{value:!0});Co.calcGridColWidth=Zh;Co.calcGridItemPosition=cL;Co.calcGridItemWHPx=Bv;Co.calcWH=dL;Co.calcXY=uL;Co.clamp=zs;function Zh(e){const{margin:t,containerPadding:n,containerWidth:r,cols:o}=e;return(r-t[0]*(o-1)-n[0]*2)/o}function Bv(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function cL(e,t,n,r,o,i){const{margin:s,containerPadding:a,rowHeight:l}=e,u=Zh(e),d={};return i&&i.resizing?(d.width=Math.round(i.resizing.width),d.height=Math.round(i.resizing.height)):(d.width=Bv(r,u,s[0]),d.height=Bv(o,l,s[1])),i&&i.dragging?(d.top=Math.round(i.dragging.top),d.left=Math.round(i.dragging.left)):i&&i.resizing&&typeof i.resizing.top=="number"&&typeof i.resizing.left=="number"?(d.top=Math.round(i.resizing.top),d.left=Math.round(i.resizing.left)):(d.top=Math.round((l+s[1])*n+a[1]),d.left=Math.round((u+s[0])*t+a[0])),d}function uL(e,t,n,r,o){const{margin:i,cols:s,rowHeight:a,maxRows:l}=e,u=Zh(e);let d=Math.round((n-i[0])/(u+i[0])),h=Math.round((t-i[1])/(a+i[1]));return d=zs(d,0,s-r),h=zs(h,0,l-o),{x:d,y:h}}function dL(e,t,n,r,o,i){const{margin:s,maxRows:a,cols:l,rowHeight:u}=e,d=Zh(e);let h=Math.round((t+s[0])/(d+s[0])),p=Math.round((n+s[1])/(u+s[1])),g=zs(h,0,l-r),b=zs(p,0,a-o);return["sw","w","nw"].indexOf(i)!==-1&&(g=zs(h,0,l)),["nw","n","ne"].indexOf(i)!==-1&&(b=zs(p,0,a)),{w:g,h:b}}function zs(e,t,n){return Math.max(Math.min(e,n),t)}var Jh={},Uv={exports:{}},um,u_;function y0(){if(u_)return um;u_=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return um=e,um}var dm,d_;function fL(){if(d_)return dm;d_=1;var e=y0();function t(){}function n(){}return n.resetWarningCache=t,dm=function(){function r(s,a,l,u,d,h){if(h!==e){var p=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw p.name="Invariant Violation",p}}r.isRequired=r;function o(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},dm}var Jd={exports:{}},xt={};/** @license React v16.13.1
88
+ }`;var et=T1(function(){return vt(T,Te+"return "+be).apply(n,N)});if(et.source=be,Wg(et))throw et;return et}function d3(c){return yt(c).toLowerCase()}function f3(c){return yt(c).toUpperCase()}function h3(c,f,v){if(c=yt(c),c&&(v||f===n))return Vx(c);if(!c||!(f=Zn(f)))return c;var S=Hr(c),P=Hr(f),T=Hx(S,P),N=Wx(S,P)+1;return vi(S,T,N).join("")}function p3(c,f,v){if(c=yt(c),c&&(v||f===n))return c.slice(0,Ux(c)+1);if(!c||!(f=Zn(f)))return c;var S=Hr(c),P=Wx(S,Hr(f))+1;return vi(S,0,P).join("")}function g3(c,f,v){if(c=yt(c),c&&(v||f===n))return c.replace(hs,"");if(!c||!(f=Zn(f)))return c;var S=Hr(c),P=Hx(S,Hr(f));return vi(S,P).join("")}function m3(c,f){var v=L,S=W;if(Ht(f)){var P="separator"in f?f.separator:P;v="length"in f?Qe(f.length):v,S="omission"in f?Zn(f.omission):S}c=yt(c);var T=c.length;if(Ra(c)){var N=Hr(c);T=N.length}if(v>=T)return c;var z=v-$a(S);if(z<1)return S;var G=N?vi(N,0,z).join(""):c.slice(0,z);if(P===n)return G+S;if(N&&(z+=G.length-z),Bg(P)){if(c.slice(z).search(P)){var he,pe=G;for(P.global||(P=sg(P.source,yt(Ae.exec(P))+"g")),P.lastIndex=0;he=P.exec(pe);)var be=he.index;G=G.slice(0,be===n?z:be)}}else if(c.indexOf(Zn(P),z)!=z){var Re=G.lastIndexOf(P);Re>-1&&(G=G.slice(0,Re))}return G+S}function v3(c){return c=yt(c),c&&To.test(c)?c.replace(wn,qT):c}var b3=Ia(function(c,f,v){return c+(v?" ":"")+f.toUpperCase()}),Gg=Aw("toUpperCase");function M1(c,f,v){return c=yt(c),f=v?n:f,f===n?VT(c)?KT(c):TT(c):c.match(f)||[]}var T1=rt(function(c,f){try{return Xn(c,n,f)}catch(v){return Wg(v)?v:new Ue(v)}}),y3=Lo(function(c,f){return wr(f,function(v){v=so(v),ko(c,v,Vg(c[v],c))}),c});function x3(c){var f=c==null?0:c.length,v=Le();return c=f?jt(c,function(S){if(typeof S[1]!="function")throw new _r(s);return[v(S[0]),S[1]]}):[],rt(function(S){for(var P=-1;++P<f;){var T=c[P];if(Xn(T[0],this,S))return Xn(T[1],this,S)}})}function w3(c){return q5(Cr(c,h))}function Yg(c){return function(){return c}}function _3(c,f){return c==null||c!==c?f:c}var S3=kw(),C3=kw(!0);function zn(c){return c}function Kg(c){return dw(typeof c=="function"?c:Cr(c,h))}function E3(c){return hw(Cr(c,h))}function R3(c,f){return pw(c,Cr(f,h))}var $3=rt(function(c,f){return function(v){return ac(v,c,f)}}),P3=rt(function(c,f){return function(v){return ac(c,v,f)}});function Xg(c,f,v){var S=ln(f),P=Pd(f,S);v==null&&!(Ht(f)&&(P.length||!S.length))&&(v=f,f=c,c=this,P=Pd(f,ln(f)));var T=!(Ht(v)&&"chain"in v)||!!v.chain,N=zo(c);return wr(P,function(z){var G=f[z];c[z]=G,N&&(c.prototype[z]=function(){var he=this.__chain__;if(T||he){var pe=c(this.__wrapped__),be=pe.__actions__=Nn(this.__actions__);return be.push({func:G,args:arguments,thisArg:c}),pe.__chain__=he,pe}return G.apply(c,di([this.value()],arguments))})}),c}function O3(){return hn._===this&&(hn._=t5),this}function Qg(){}function D3(c){return c=Qe(c),rt(function(f){return gw(f,c)})}var M3=Pg(jt),T3=Pg(Nx),A3=Pg(Jp);function A1(c){return kg(c)?eg(so(c)):cA(c)}function I3(c){return function(f){return c==null?n:xs(c,f)}}var k3=Lw(),N3=Lw(!0);function Zg(){return[]}function Jg(){return!1}function L3(){return{}}function F3(){return""}function z3(){return!0}function j3(c,f){if(c=Qe(c),c<1||c>X)return[];var v=V,S=_n(c,V);f=Le(f),c-=V;for(var P=rg(S,f);++v<c;)f(v);return P}function V3(c){return Ye(c)?jt(c,so):Jn(c)?[c]:Nn(Jw(yt(c)))}function H3(c){var f=++JT;return yt(c)+f}var W3=Id(function(c,f){return c+f},0),B3=Og("ceil"),U3=Id(function(c,f){return c/f},1),q3=Og("floor");function G3(c){return c&&c.length?$d(c,zn,pg):n}function Y3(c,f){return c&&c.length?$d(c,Le(f,2),pg):n}function K3(c){return zx(c,zn)}function X3(c,f){return zx(c,Le(f,2))}function Q3(c){return c&&c.length?$d(c,zn,bg):n}function Z3(c,f){return c&&c.length?$d(c,Le(f,2),bg):n}var J3=Id(function(c,f){return c*f},1),eN=Og("round"),tN=Id(function(c,f){return c-f},0);function nN(c){return c&&c.length?ng(c,zn):0}function rN(c,f){return c&&c.length?ng(c,Le(f,2)):0}return O.after=Ek,O.ary=u1,O.assign=f7,O.assignIn=C1,O.assignInWith=Gd,O.assignWith=h7,O.at=p7,O.before=d1,O.bind=Vg,O.bindAll=y3,O.bindKey=f1,O.castArray=Lk,O.chain=a1,O.chunk=qA,O.compact=GA,O.concat=YA,O.cond=x3,O.conforms=w3,O.constant=Yg,O.countBy=nk,O.create=g7,O.curry=h1,O.curryRight=p1,O.debounce=g1,O.defaults=m7,O.defaultsDeep=v7,O.defer=Rk,O.delay=$k,O.difference=KA,O.differenceBy=XA,O.differenceWith=QA,O.drop=ZA,O.dropRight=JA,O.dropRightWhile=eI,O.dropWhile=tI,O.fill=nI,O.filter=ok,O.flatMap=ak,O.flatMapDeep=lk,O.flatMapDepth=ck,O.flatten=r1,O.flattenDeep=rI,O.flattenDepth=oI,O.flip=Pk,O.flow=S3,O.flowRight=C3,O.fromPairs=iI,O.functions=C7,O.functionsIn=E7,O.groupBy=uk,O.initial=aI,O.intersection=lI,O.intersectionBy=cI,O.intersectionWith=uI,O.invert=$7,O.invertBy=P7,O.invokeMap=fk,O.iteratee=Kg,O.keyBy=hk,O.keys=ln,O.keysIn=Fn,O.map=Vd,O.mapKeys=D7,O.mapValues=M7,O.matches=E3,O.matchesProperty=R3,O.memoize=Wd,O.merge=T7,O.mergeWith=E1,O.method=$3,O.methodOf=P3,O.mixin=Xg,O.negate=Bd,O.nthArg=D3,O.omit=A7,O.omitBy=I7,O.once=Ok,O.orderBy=pk,O.over=M3,O.overArgs=Dk,O.overEvery=T3,O.overSome=A3,O.partial=Hg,O.partialRight=m1,O.partition=gk,O.pick=k7,O.pickBy=R1,O.property=A1,O.propertyOf=I3,O.pull=pI,O.pullAll=i1,O.pullAllBy=gI,O.pullAllWith=mI,O.pullAt=vI,O.range=k3,O.rangeRight=N3,O.rearg=Mk,O.reject=bk,O.remove=bI,O.rest=Tk,O.reverse=zg,O.sampleSize=xk,O.set=L7,O.setWith=F7,O.shuffle=wk,O.slice=yI,O.sortBy=Ck,O.sortedUniq=RI,O.sortedUniqBy=$I,O.split=a3,O.spread=Ak,O.tail=PI,O.take=OI,O.takeRight=DI,O.takeRightWhile=MI,O.takeWhile=TI,O.tap=GI,O.throttle=Ik,O.thru=jd,O.toArray=w1,O.toPairs=$1,O.toPairsIn=P1,O.toPath=V3,O.toPlainObject=S1,O.transform=z7,O.unary=kk,O.union=AI,O.unionBy=II,O.unionWith=kI,O.uniq=NI,O.uniqBy=LI,O.uniqWith=FI,O.unset=j7,O.unzip=jg,O.unzipWith=s1,O.update=V7,O.updateWith=H7,O.values=La,O.valuesIn=W7,O.without=zI,O.words=M1,O.wrap=Nk,O.xor=jI,O.xorBy=VI,O.xorWith=HI,O.zip=WI,O.zipObject=BI,O.zipObjectDeep=UI,O.zipWith=qI,O.entries=$1,O.entriesIn=P1,O.extend=C1,O.extendWith=Gd,Xg(O,O),O.add=W3,O.attempt=T1,O.camelCase=G7,O.capitalize=O1,O.ceil=B3,O.clamp=B7,O.clone=Fk,O.cloneDeep=jk,O.cloneDeepWith=Vk,O.cloneWith=zk,O.conformsTo=Hk,O.deburr=D1,O.defaultTo=_3,O.divide=U3,O.endsWith=Y7,O.eq=Br,O.escape=K7,O.escapeRegExp=X7,O.every=rk,O.find=ik,O.findIndex=t1,O.findKey=b7,O.findLast=sk,O.findLastIndex=n1,O.findLastKey=y7,O.floor=q3,O.forEach=l1,O.forEachRight=c1,O.forIn=x7,O.forInRight=w7,O.forOwn=_7,O.forOwnRight=S7,O.get=Ug,O.gt=Wk,O.gte=Bk,O.has=R7,O.hasIn=qg,O.head=o1,O.identity=zn,O.includes=dk,O.indexOf=sI,O.inRange=U7,O.invoke=O7,O.isArguments=Ss,O.isArray=Ye,O.isArrayBuffer=Uk,O.isArrayLike=Ln,O.isArrayLikeObject=Yt,O.isBoolean=qk,O.isBuffer=bi,O.isDate=Gk,O.isElement=Yk,O.isEmpty=Kk,O.isEqual=Xk,O.isEqualWith=Qk,O.isError=Wg,O.isFinite=Zk,O.isFunction=zo,O.isInteger=v1,O.isLength=Ud,O.isMap=b1,O.isMatch=Jk,O.isMatchWith=e7,O.isNaN=t7,O.isNative=n7,O.isNil=o7,O.isNull=r7,O.isNumber=y1,O.isObject=Ht,O.isObjectLike=Ut,O.isPlainObject=hc,O.isRegExp=Bg,O.isSafeInteger=i7,O.isSet=x1,O.isString=qd,O.isSymbol=Jn,O.isTypedArray=Na,O.isUndefined=s7,O.isWeakMap=a7,O.isWeakSet=l7,O.join=dI,O.kebabCase=Q7,O.last=Rr,O.lastIndexOf=fI,O.lowerCase=Z7,O.lowerFirst=J7,O.lt=c7,O.lte=u7,O.max=G3,O.maxBy=Y3,O.mean=K3,O.meanBy=X3,O.min=Q3,O.minBy=Z3,O.stubArray=Zg,O.stubFalse=Jg,O.stubObject=L3,O.stubString=F3,O.stubTrue=z3,O.multiply=J3,O.nth=hI,O.noConflict=O3,O.noop=Qg,O.now=Hd,O.pad=e3,O.padEnd=t3,O.padStart=n3,O.parseInt=r3,O.random=q7,O.reduce=mk,O.reduceRight=vk,O.repeat=o3,O.replace=i3,O.result=N7,O.round=eN,O.runInContext=B,O.sample=yk,O.size=_k,O.snakeCase=s3,O.some=Sk,O.sortedIndex=xI,O.sortedIndexBy=wI,O.sortedIndexOf=_I,O.sortedLastIndex=SI,O.sortedLastIndexBy=CI,O.sortedLastIndexOf=EI,O.startCase=l3,O.startsWith=c3,O.subtract=tN,O.sum=nN,O.sumBy=rN,O.template=u3,O.times=j3,O.toFinite=jo,O.toInteger=Qe,O.toLength=_1,O.toLower=d3,O.toNumber=$r,O.toSafeInteger=d7,O.toString=yt,O.toUpper=f3,O.trim=h3,O.trimEnd=p3,O.trimStart=g3,O.truncate=m3,O.unescape=v3,O.uniqueId=H3,O.upperCase=b3,O.upperFirst=Gg,O.each=l1,O.eachRight=c1,O.first=o1,Xg(O,function(){var c={};return oo(O,function(f,v){St.call(O.prototype,v)||(c[v]=f)}),c}(),{chain:!1}),O.VERSION=r,wr(["bind","bindKey","curry","curryRight","partial","partialRight"],function(c){O[c].placeholder=O}),wr(["drop","take"],function(c,f){ut.prototype[c]=function(v){v=v===n?1:tn(Qe(v),0);var S=this.__filtered__&&!f?new ut(this):this.clone();return S.__filtered__?S.__takeCount__=_n(v,S.__takeCount__):S.__views__.push({size:_n(v,V),type:c+(S.__dir__<0?"Right":"")}),S},ut.prototype[c+"Right"]=function(v){return this.reverse()[c](v).reverse()}}),wr(["filter","map","takeWhile"],function(c,f){var v=f+1,S=v==Q||v==J;ut.prototype[c]=function(P){var T=this.clone();return T.__iteratees__.push({iteratee:Le(P,3),type:v}),T.__filtered__=T.__filtered__||S,T}}),wr(["head","last"],function(c,f){var v="take"+(f?"Right":"");ut.prototype[c]=function(){return this[v](1).value()[0]}}),wr(["initial","tail"],function(c,f){var v="drop"+(f?"":"Right");ut.prototype[c]=function(){return this.__filtered__?new ut(this):this[v](1)}}),ut.prototype.compact=function(){return this.filter(zn)},ut.prototype.find=function(c){return this.filter(c).head()},ut.prototype.findLast=function(c){return this.reverse().find(c)},ut.prototype.invokeMap=rt(function(c,f){return typeof c=="function"?new ut(this):this.map(function(v){return ac(v,c,f)})}),ut.prototype.reject=function(c){return this.filter(Bd(Le(c)))},ut.prototype.slice=function(c,f){c=Qe(c);var v=this;return v.__filtered__&&(c>0||f<0)?new ut(v):(c<0?v=v.takeRight(-c):c&&(v=v.drop(c)),f!==n&&(f=Qe(f),v=f<0?v.dropRight(-f):v.take(f-c)),v)},ut.prototype.takeRightWhile=function(c){return this.reverse().takeWhile(c).reverse()},ut.prototype.toArray=function(){return this.take(V)},oo(ut.prototype,function(c,f){var v=/^(?:filter|find|map|reject)|While$/.test(f),S=/^(?:head|last)$/.test(f),P=O[S?"take"+(f=="last"?"Right":""):f],T=S||/^find/.test(f);P&&(O.prototype[f]=function(){var N=this.__wrapped__,z=S?[1]:arguments,G=N instanceof ut,he=z[0],pe=G||Ye(N),be=function(lt){var ht=P.apply(O,di([lt],z));return S&&Re?ht[0]:ht};pe&&v&&typeof he=="function"&&he.length!=1&&(G=pe=!1);var Re=this.__chain__,Te=!!this.__actions__.length,Fe=T&&!Re,et=G&&!Te;if(!T&&pe){N=et?N:new ut(this);var ze=c.apply(N,z);return ze.__actions__.push({func:jd,args:[be],thisArg:n}),new Sr(ze,Re)}return Fe&&et?c.apply(this,z):(ze=this.thru(be),Fe?S?ze.value()[0]:ze.value():ze)})}),wr(["pop","push","shift","sort","splice","unshift"],function(c){var f=fd[c],v=/^(?:push|sort|unshift)$/.test(c)?"tap":"thru",S=/^(?:pop|shift)$/.test(c);O.prototype[c]=function(){var P=arguments;if(S&&!this.__chain__){var T=this.value();return f.apply(Ye(T)?T:[],P)}return this[v](function(N){return f.apply(Ye(N)?N:[],P)})}}),oo(ut.prototype,function(c,f){var v=O[f];if(v){var S=v.name+"";St.call(Ma,S)||(Ma[S]=[]),Ma[S].push({name:f,func:v})}}),Ma[Ad(n,_).name]=[{name:"wrapper",func:n}],ut.prototype.clone=v5,ut.prototype.reverse=b5,ut.prototype.value=y5,O.prototype.at=YI,O.prototype.chain=KI,O.prototype.commit=XI,O.prototype.next=QI,O.prototype.plant=JI,O.prototype.reverse=ek,O.prototype.toJSON=O.prototype.valueOf=O.prototype.value=tk,O.prototype.first=O.prototype.head,ec&&(O.prototype[ec]=ZI),O},Pa=XT();gs?((gs.exports=Pa)._=Pa,Kp._=Pa):hn._=Pa}).call(ks)})(ah,ah.exports);var Za=ah.exports;const ia=Lu(Za),e_=["lg","md","sm","xs","xxs"],Ce=AE()(jE((e,t)=>({isSessionExpired:!1,currentBreakpoint:"lg",dashboard:{id:"",style:Rv},showContext:!1,selectedSheetId:null,selectedCardId:null,selectedFrameId:null,selectedCard:null,showFilters:!1,isDashboardEditing:!1,isVisualEditing:!1,showDashboardJSON:!1,filteringCards:[],actions:{setIsSessionExpired:n=>{e(()=>({isSessionExpired:n}))},setCardPython:(n,r)=>{e(o=>{var s,a;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===o.selectedSheetId);i&&Za.forEach(i.frames,l=>{var d;const u=(d=l.cards)==null?void 0:d.find(h=>h.id===n);u&&(u.python=r)})})},addBaseQuery:n=>{e(r=>{var o;r.dashboard.baseQueries||(r.dashboard.baseQueries=[]),(o=r.dashboard.baseQueries)==null||o.push(n)})},removeBaseQuery:n=>{e(r=>{var i,s;const o=(i=r.dashboard.baseQueries)==null?void 0:i.findIndex(a=>a.id===n);o!=null&&o>-1&&((s=r.dashboard.baseQueries)==null||s.splice(o,1))})},setBaseQueries:n=>{e(r=>{r.dashboard.baseQueries=n})},setCurrentBreakpoint:n=>{e(()=>({currentBreakpoint:n}))},addFilteringCard:n=>{e(r=>{var o;(o=r.filteringCards)==null||o.push(n)})},removeFilteringCard:n=>{e(r=>{var i,s;const o=(i=r.filteringCards)==null?void 0:i.findIndex(a=>a.id===n.id);o!==void 0&&o>-1&&((s=r.filteringCards)==null||s.splice(o,1))})},setCustomCards:n=>{e(r=>{r.dashboard.customCards=n})},setAuthToken:n=>{e(()=>({authToken:n}))},setThemeStyle:n=>{e(()=>({themeStyle:n}))},setDashboard:n=>e({dashboard:n}),setBookmarkKey:n=>{e(()=>({bookmarkKey:n}))},setDashboardTheme:n=>{e(r=>{r.theme=n})},setSheets:n=>{e(r=>{r.dashboard&&(r.dashboard.sheets=n)})},setCardTitle:(n,r,o)=>{e(i=>{var a,l;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(u=>u.id===n);s&&Za.forEach(s.frames,u=>{var h;const d=(h=u.cards)==null?void 0:h.find(p=>p.id===r);d&&(d.title=o)})})},setCardInfo:(n,r)=>{e(o=>{var s,a;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===o.selectedSheetId);i&&Za.forEach(i.frames,l=>{var d;const u=(d=l.cards)==null?void 0:d.find(h=>h.id===n);u&&(u.info=r)})})},setCardDescription:(n,r,o)=>{e(i=>{var a,l;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(u=>u.id===n);s&&Za.forEach(s.frames,u=>{var h;const d=(h=u.cards)==null?void 0:h.find(p=>p.id===r);d&&(d.description=o)})})},setCardSql:(n,r,o)=>{e(i=>{var a,l,u,d;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(h=>h.id===n);if(s){const h=(u=s.cards)==null?void 0:u.find(p=>p.id===r);h&&(h.sql=o,(d=i.onUpdateCard)==null||d.call(i,h,n))}})},setFrameCardData:(n,r,o)=>{e(i=>{var a,l;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(u=>u.id===n);s&&Za.forEach(s.frames,u=>{var h;const d=(h=u.cards)==null?void 0:h.find(p=>p.id===r);d&&(d.data=o)})})},setSheetLayout:(n,r)=>{e(o=>{var s,a;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);i&&(i.layout=r)})},setSheetLayouts:(n,r)=>{e(o=>{var s,a;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);i&&(i.layouts=r)})},setShowContext:n=>{e(()=>({showContext:n}))},setShowFilters:n=>{e(()=>({showFilters:n}))},setFilterValues:n=>{e(()=>({filterValues:n}))},addOrUpdateFilterValue:n=>{e(r=>{if(r.filterValues){const o=r.filterValues.findIndex(i=>i.filterId===n.filterId);o>-1?r.filterValues.splice(o,1,n):r.filterValues.push(n)}else r.filterValues=[n]})},addOrUpdateFilterValues:n=>{e(r=>{r.filterValues?n.forEach(o=>{var s,a,l;const i=(s=r==null?void 0:r.filterValues)==null?void 0:s.findIndex(u=>u.filterId===o.filterId);i!==void 0&&i>-1?(a=r.filterValues)==null||a.splice(i,1,o):(l=r.filterValues)==null||l.push(o)}):r.filterValues=n})},removeFilterValue:n=>{e(r=>{if(r.filterValues){const o=r.filterValues.filter(i=>i.filterId!==n&&!i.filterId.startsWith(n));r.filterValues=o}})},replaceFilterValue:n=>{e(r=>{if(r.filterValues){const o=r.filterValues.findIndex(i=>i.filterId===n.filterId);o>-1&&r.filterValues.splice(o,1,n)}})},addFilter:n=>{e(r=>{var o;r.dashboard.filters?(o=r.dashboard.filters)==null||o.push(n):r.dashboard.filters=[n]})},removeFilter:n=>{e(r=>{var o,i;if(r.dashboard.filters){const s=(o=r.dashboard.filters)==null?void 0:o.findIndex(a=>a.id===n);console.log("index",s),s>-1&&((i=r.dashboard.filters)==null||i.splice(s,1))}})},updateFrameCard:(n,r,o)=>{e(i=>{var l,u,d,h,p;const s=(u=(l=i.dashboard)==null?void 0:l.sheets)==null?void 0:u.find(g=>g.id===n);if(!s)return;const a=(d=s==null?void 0:s.frames)==null?void 0:d.find(g=>g.id===r);if(a){const g=(h=a.cards)==null?void 0:h.findIndex(b=>b.id===o.id);g>-1&&((p=a.cards)==null||p.splice(g,1,o))}})},updateFilter:n=>{e(r=>{var o,i;if(r.dashboard.filters){const s=(o=r.dashboard.filters)==null?void 0:o.findIndex(a=>a.id===n.id);s>-1&&((i=r.dashboard.filters)==null||i.splice(s,1,n))}})},setIsDashboardEditing:n=>{e(()=>({isDashboardEditing:n}))},setShowDashboardJSON:n=>{e(()=>({showDashboardJSON:n}))},setIsVisualEditing:n=>{e(()=>({isVisualEditing:n}))},addFrame:(n,r)=>{e(o=>{var s,a,l,u,d;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(h=>h.id===n);if(i){i.frames||(i.frames=[]),(l=i.frames)==null||l.push(r);const h={i:r.id,x:0,y:1/0,w:20,h:7,minW:6,minH:2};(u=i.layout)==null||u.push(h),i!=null&&i.layouts||(i.layouts={}),e_.forEach(p=>{i.layouts[p]||(i.layouts[p]=[]),i.layouts[p].push(h)}),(d=o.onAddFrame)==null||d.call(o,r,n)}})},removeFrame:(n,r)=>{e(o=>{var s,a,l,u,d;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(h=>h.id===n);if(i){const h=(l=i.frames)==null?void 0:l.findIndex(p=>p.id===r);console.log(h),typeof h=="number"&&h>-1&&((u=i.frames)==null||u.splice(h,1),(d=i.layout)==null||d.splice(h,1),i.layouts=e_.reduce((p,g)=>{if(p&&p[g]){const b=p[g].findIndex(y=>y.i===r);typeof b=="number"&&b>-1&&p[g].splice(b,1)}return p},i.layouts))}})},updateFrame:(n,r)=>{e(o=>{var a,l,u,d;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(h=>h.id===n),s=(u=i==null?void 0:i.frames)==null?void 0:u.findIndex(h=>h.id===r.id);i&&((d=i.frames)==null||d.splice(s,1,r))})},updateCard:(n,r)=>{e(o=>{var a,l,u,d,h;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(p=>p.id===n),s=(u=i==null?void 0:i.cards)==null?void 0:u.findIndex(p=>p.id===r.id);i&&((d=i.cards)==null||d.splice(s,1,r),(h=o.onUpdateCard)==null||h.call(o,r,n))})},removeCard:(n,r)=>{e(o=>{var a,l,u,d,h,p;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(g=>g.id===n),s=(u=i==null?void 0:i.cards)==null?void 0:u.findIndex(g=>g.id===r.id);i&&((d=i.cards)==null||d.splice(s,1),(h=i.layout)==null||h.splice(s,1),(p=o.onRemoveCard)==null||p.call(o,r,n))})},setStyle:n=>{e(r=>{r.dashboard&&(r.dashboard.style=n)})},setSelectedCardId:(n,r)=>{e(o=>{var s,a,l;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(u=>u.id===n);i&&(((l=i.cards)==null?void 0:l.find(d=>d.id===r))?o.selectedCardId=r:o.selectedCardId=null)})},setSelectedFrameId:n=>{e(r=>{var i,s;((s=(i=r.dashboard)==null?void 0:i.sheets)==null?void 0:s.find(a=>a.id===r.selectedSheetId))&&(r.selectedFrameId=n)})},setSelectedSheetId:n=>{e(r=>{var i,s;((s=(i=r.dashboard)==null?void 0:i.sheets)==null?void 0:s.find(a=>a.id===n))&&(r.selectedSheetId=n)})},setOnSaveFunction:n=>{e(()=>({onSaveFunction:n}))},setOnAddCard:n=>{e(()=>({onAddCard:n}))},setOnUpdateCard:n=>{e(()=>({onUpdateCard:n}))},setOnRemoveCard:n=>{e(()=>({onRemoveCard:n}))},setOnEvent:n=>{e(()=>({onEvent:n}))},getDashboard:()=>t().dashboard,getSelectedSheet:()=>{var n,r;return(r=(n=t().dashboard)==null?void 0:n.sheets)==null?void 0:r.find(o=>o.id===t().selectedSheetId)},getSelectedFrame:()=>{var r,o,i;const n=(o=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:o.find(s=>s.id===t().selectedSheetId);return(i=n==null?void 0:n.frames)==null?void 0:i.find(s=>s.id===t().selectedFrameId)},getCard:n=>{var o,i;const r=(o=t().dashboard)==null?void 0:o.sheets;if(r)for(let s=0;s<r.length;s++){const a=r[s].frames;if(a)for(let l=0;l<a.length;l++){const u=(i=a[l].cards)==null?void 0:i.find(d=>d.id===n);if(u)return u}}},getSelectedSheetLayout:()=>{var r,o;const n=(o=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:o.find(i=>i.id===t().selectedSheetId);return n==null?void 0:n.layout},getSelectedSheetLayouts:()=>{var r,o;const n=(o=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:o.find(i=>i.id===t().selectedSheetId);return n==null?void 0:n.layouts},getStyle:()=>{var n;return(n=t().dashboard)==null?void 0:n.style},handleDataPointClickAction:(n,r)=>{E6({card:n,dataPoint:r,set:e,get:t})}}}))),Ki=()=>Ce(e=>e.actions);var zu=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},El=typeof window>"u"||"Deno"in window;function Tr(){}function R6(e,t){return typeof e=="function"?e(t):e}function $v(e){return typeof e=="number"&&e>=0&&e!==1/0}function qE(e,t){return Math.max(e+(t||0)-Date.now(),0)}function t_(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==Qb(s,t.options))return!1}else if(!ou(t.queryKey,s))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||typeof o<"u"&&o!==t.state.fetchStatus||i&&!i(t))}function n_(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(ru(t.options.mutationKey)!==ru(i))return!1}else if(!ou(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function Qb(e,t){return((t==null?void 0:t.queryKeyHashFn)||ru)(e)}function ru(e){return JSON.stringify(e,(t,n)=>Ov(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function ou(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!ou(e[n],t[n])):!1}function GE(e,t){if(e===t)return e;const n=r_(e)&&r_(t);if(n||Ov(e)&&Ov(t)){const r=n?e:Object.keys(e),o=r.length,i=n?t:Object.keys(t),s=i.length,a=n?[]:{};let l=0;for(let u=0;u<s;u++){const d=n?u:i[u];!n&&e[d]===void 0&&t[d]===void 0&&r.includes(d)?(a[d]=void 0,l++):(a[d]=GE(e[d],t[d]),a[d]===e[d]&&e[d]!==void 0&&l++)}return o===s&&l===o?e:a}return t}function Pv(e,t){if(e&&!t||t&&!e)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function r_(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ov(e){if(!o_(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const n=t.prototype;return!(!o_(n)||!n.hasOwnProperty("isPrototypeOf"))}function o_(e){return Object.prototype.toString.call(e)==="[object Object]"}function $6(e){return new Promise(t=>{setTimeout(t,e)})}function Dv(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?GE(e,t):t}function P6(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function O6(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Hs,Pi,al,pE,D6=(pE=class extends zu{constructor(){super();Ie(this,Hs,void 0);Ie(this,Pi,void 0);Ie(this,al,void 0);Pe(this,al,t=>{if(!El&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){U(this,Pi)||this.setEventListener(U(this,al))}onUnsubscribe(){var t;this.hasListeners()||((t=U(this,Pi))==null||t.call(this),Pe(this,Pi,void 0))}setEventListener(t){var n;Pe(this,al,t),(n=U(this,Pi))==null||n.call(this),Pe(this,Pi,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){U(this,Hs)!==t&&(Pe(this,Hs,t),this.onFocus())}onFocus(){this.listeners.forEach(t=>{t()})}isFocused(){var t;return typeof U(this,Hs)=="boolean"?U(this,Hs):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Hs=new WeakMap,Pi=new WeakMap,al=new WeakMap,pE),lh=new D6,ll,Oi,cl,gE,M6=(gE=class extends zu{constructor(){super();Ie(this,ll,!0);Ie(this,Oi,void 0);Ie(this,cl,void 0);Pe(this,cl,t=>{if(!El&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){U(this,Oi)||this.setEventListener(U(this,cl))}onUnsubscribe(){var t;this.hasListeners()||((t=U(this,Oi))==null||t.call(this),Pe(this,Oi,void 0))}setEventListener(t){var n;Pe(this,cl,t),(n=U(this,Oi))==null||n.call(this),Pe(this,Oi,t(this.setOnline.bind(this)))}setOnline(t){U(this,ll)!==t&&(Pe(this,ll,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return U(this,ll)}},ll=new WeakMap,Oi=new WeakMap,cl=new WeakMap,gE),ch=new M6;function T6(e){return Math.min(1e3*2**e,3e4)}function qh(e){return(e??"online")==="online"?ch.isOnline():!0}var YE=class{constructor(e){this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function lm(e){return e instanceof YE}function KE(e){let t=!1,n=0,r=!1,o,i,s;const a=new Promise((x,_)=>{i=x,s=_}),l=x=>{var _;r||(g(new YE(x)),(_=e.abort)==null||_.call(e))},u=()=>{t=!0},d=()=>{t=!1},h=()=>!lh.isFocused()||e.networkMode!=="always"&&!ch.isOnline(),p=x=>{var _;r||(r=!0,(_=e.onSuccess)==null||_.call(e,x),o==null||o(),i(x))},g=x=>{var _;r||(r=!0,(_=e.onError)==null||_.call(e,x),o==null||o(),s(x))},b=()=>new Promise(x=>{var _;o=w=>{const C=r||!h();return C&&x(w),C},(_=e.onPause)==null||_.call(e)}).then(()=>{var x;o=void 0,r||(x=e.onContinue)==null||x.call(e)}),y=()=>{if(r)return;let x;try{x=e.fn()}catch(_){x=Promise.reject(_)}Promise.resolve(x).then(p).catch(_=>{var M;if(r)return;const w=e.retry??(El?0:3),C=e.retryDelay??T6,R=typeof C=="function"?C(n,_):C,E=w===!0||typeof w=="number"&&n<w||typeof w=="function"&&w(n,_);if(t||!E){g(_);return}n++,(M=e.onFail)==null||M.call(e,n,_),$6(R).then(()=>{if(h())return b()}).then(()=>{t?g(_):y()})})};return qh(e.networkMode)?y():b().then(y),{promise:a,cancel:l,continue:()=>(o==null?void 0:o())?a:Promise.resolve(),cancelRetry:u,continueRetry:d}}function A6(){let e=[],t=0,n=p=>{p()},r=p=>{p()},o=p=>setTimeout(p,0);const i=p=>{o=p},s=p=>{let g;t++;try{g=p()}finally{t--,t||u()}return g},a=p=>{t?e.push(p):o(()=>{n(p)})},l=p=>(...g)=>{a(()=>{p(...g)})},u=()=>{const p=e;e=[],p.length&&o(()=>{r(()=>{p.forEach(g=>{n(g)})})})};return{batch:s,batchCalls:l,schedule:a,setNotifyFunction:p=>{n=p},setBatchNotifyFunction:p=>{r=p},setScheduler:i}}var vn=A6(),Ws,mE,XE=(mE=class{constructor(){Ie(this,Ws,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),$v(this.gcTime)&&Pe(this,Ws,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(El?1/0:5*60*1e3))}clearGcTimeout(){U(this,Ws)&&(clearTimeout(U(this,Ws)),Pe(this,Ws,void 0))}},Ws=new WeakMap,mE),ul,dl,Or,Di,Dr,cn,Eu,Bs,fl,Wf,Yr,Uo,vE,I6=(vE=class extends XE{constructor(t){super();Ie(this,fl);Ie(this,Yr);Ie(this,ul,void 0);Ie(this,dl,void 0);Ie(this,Or,void 0);Ie(this,Di,void 0);Ie(this,Dr,void 0);Ie(this,cn,void 0);Ie(this,Eu,void 0);Ie(this,Bs,void 0);Pe(this,Bs,!1),Pe(this,Eu,t.defaultOptions),ot(this,fl,Wf).call(this,t.options),Pe(this,cn,[]),Pe(this,Or,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Pe(this,ul,t.state||k6(this.options)),this.state=U(this,ul),this.scheduleGc()}get meta(){return this.options.meta}optionalRemove(){!U(this,cn).length&&this.state.fetchStatus==="idle"&&U(this,Or).remove(this)}setData(t,n){const r=Dv(this.state.data,t,this.options);return ot(this,Yr,Uo).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){ot(this,Yr,Uo).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r;const n=U(this,Di);return(r=U(this,Dr))==null||r.cancel(t),n?n.then(Tr).catch(Tr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(U(this,ul))}isActive(){return U(this,cn).some(t=>t.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||U(this,cn).some(t=>t.getCurrentResult().isStale)}isStaleByTime(t=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!qE(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=U(this,cn).find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=U(this,Dr))==null||n.continue()}onOnline(){var n;const t=U(this,cn).find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=U(this,Dr))==null||n.continue()}addObserver(t){U(this,cn).includes(t)||(U(this,cn).push(t),this.clearGcTimeout(),U(this,Or).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){U(this,cn).includes(t)&&(Pe(this,cn,U(this,cn).filter(n=>n!==t)),U(this,cn).length||(U(this,Dr)&&(U(this,Bs)?U(this,Dr).cancel({revert:!0}):U(this,Dr).cancelRetry()),this.scheduleGc()),U(this,Or).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return U(this,cn).length}invalidate(){this.state.isInvalidated||ot(this,Yr,Uo).call(this,{type:"invalidate"})}fetch(t,n){var u,d,h,p;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(U(this,Di))return(u=U(this,Dr))==null||u.continueRetry(),U(this,Di)}if(t&&ot(this,fl,Wf).call(this,t),!this.options.queryFn){const g=U(this,cn).find(b=>b.options.queryFn);g&&ot(this,fl,Wf).call(this,g.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,o={queryKey:this.queryKey,meta:this.meta},i=g=>{Object.defineProperty(g,"signal",{enumerable:!0,get:()=>(Pe(this,Bs,!0),r.signal)})};i(o);const s=()=>this.options.queryFn?(Pe(this,Bs,!1),this.options.persister?this.options.persister(this.options.queryFn,o,this):this.options.queryFn(o)):Promise.reject(new Error(`Missing queryFn: '${this.options.queryHash}'`)),a={fetchOptions:n,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:s};i(a),(d=this.options.behavior)==null||d.onFetch(a,this),Pe(this,dl,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((h=a.fetchOptions)==null?void 0:h.meta))&&ot(this,Yr,Uo).call(this,{type:"fetch",meta:(p=a.fetchOptions)==null?void 0:p.meta});const l=g=>{var b,y,x,_;lm(g)&&g.silent||ot(this,Yr,Uo).call(this,{type:"error",error:g}),lm(g)||((y=(b=U(this,Or).config).onError)==null||y.call(b,g,this),(_=(x=U(this,Or).config).onSettled)==null||_.call(x,this.state.data,g,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return Pe(this,Dr,KE({fn:a.fetchFn,abort:r.abort.bind(r),onSuccess:g=>{var b,y,x,_;if(typeof g>"u"){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),l(new Error(`${this.queryHash} data is undefined`));return}this.setData(g),(y=(b=U(this,Or).config).onSuccess)==null||y.call(b,g,this),(_=(x=U(this,Or).config).onSettled)==null||_.call(x,g,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:l,onFail:(g,b)=>{ot(this,Yr,Uo).call(this,{type:"failed",failureCount:g,error:b})},onPause:()=>{ot(this,Yr,Uo).call(this,{type:"pause"})},onContinue:()=>{ot(this,Yr,Uo).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode})),Pe(this,Di,U(this,Dr).promise),U(this,Di)}},ul=new WeakMap,dl=new WeakMap,Or=new WeakMap,Di=new WeakMap,Dr=new WeakMap,cn=new WeakMap,Eu=new WeakMap,Bs=new WeakMap,fl=new WeakSet,Wf=function(t){this.options={...U(this,Eu),...t},this.updateGcTime(this.options.gcTime)},Yr=new WeakSet,Uo=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:t.meta??null,fetchStatus:qh(this.options.networkMode)?"fetching":"paused",...!r.dataUpdatedAt&&{error:null,status:"pending"}};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const o=t.error;return lm(o)&&o.revert&&U(this,dl)?{...U(this,dl),fetchStatus:"idle"}:{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),vn.batch(()=>{U(this,cn).forEach(r=>{r.onQueryUpdate()}),U(this,Or).notify({query:this,type:"updated",action:t})})},vE);function k6(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=typeof t<"u",r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var uo,bE,QE=(bE=class extends zu{constructor(t={}){super();Ie(this,uo,void 0);this.config=t,Pe(this,uo,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??Qb(o,n);let s=this.get(i);return s||(s=new I6({cache:this,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){U(this,uo).has(t.queryHash)||(U(this,uo).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=U(this,uo).get(t.queryHash);n&&(t.destroy(),n===t&&U(this,uo).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){vn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return U(this,uo).get(t)}getAll(){return[...U(this,uo).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>t_(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>t_(t,r)):n}notify(t){vn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){vn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){vn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},uo=new WeakMap,bE),fo,Ru,ir,hl,ho,Ri,yE,N6=(yE=class extends XE{constructor(t){super();Ie(this,ho);Ie(this,fo,void 0);Ie(this,Ru,void 0);Ie(this,ir,void 0);Ie(this,hl,void 0);this.mutationId=t.mutationId,Pe(this,Ru,t.defaultOptions),Pe(this,ir,t.mutationCache),Pe(this,fo,[]),this.state=t.state||L6(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options={...U(this,Ru),...t},this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){U(this,fo).includes(t)||(U(this,fo).push(t),this.clearGcTimeout(),U(this,ir).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Pe(this,fo,U(this,fo).filter(n=>n!==t)),this.scheduleGc(),U(this,ir).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){U(this,fo).length||(this.state.status==="pending"?this.scheduleGc():U(this,ir).remove(this))}continue(){var t;return((t=U(this,hl))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,s,a,l,u,d,h,p,g,b,y,x,_,w,C,R,E,M,D;const n=()=>(Pe(this,hl,KE({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(A,k)=>{ot(this,ho,Ri).call(this,{type:"failed",failureCount:A,error:k})},onPause:()=>{ot(this,ho,Ri).call(this,{type:"pause"})},onContinue:()=>{ot(this,ho,Ri).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode})),U(this,hl).promise),r=this.state.status==="pending";try{if(!r){ot(this,ho,Ri).call(this,{type:"pending",variables:t}),await((i=(o=U(this,ir).config).onMutate)==null?void 0:i.call(o,t,this));const k=await((a=(s=this.options).onMutate)==null?void 0:a.call(s,t));k!==this.state.context&&ot(this,ho,Ri).call(this,{type:"pending",context:k,variables:t})}const A=await n();return await((u=(l=U(this,ir).config).onSuccess)==null?void 0:u.call(l,A,t,this.state.context,this)),await((h=(d=this.options).onSuccess)==null?void 0:h.call(d,A,t,this.state.context)),await((g=(p=U(this,ir).config).onSettled)==null?void 0:g.call(p,A,null,this.state.variables,this.state.context,this)),await((y=(b=this.options).onSettled)==null?void 0:y.call(b,A,null,t,this.state.context)),ot(this,ho,Ri).call(this,{type:"success",data:A}),A}catch(A){try{throw await((_=(x=U(this,ir).config).onError)==null?void 0:_.call(x,A,t,this.state.context,this)),await((C=(w=this.options).onError)==null?void 0:C.call(w,A,t,this.state.context)),await((E=(R=U(this,ir).config).onSettled)==null?void 0:E.call(R,void 0,A,this.state.variables,this.state.context,this)),await((D=(M=this.options).onSettled)==null?void 0:D.call(M,void 0,A,t,this.state.context)),A}finally{ot(this,ho,Ri).call(this,{type:"error",error:A})}}}},fo=new WeakMap,Ru=new WeakMap,ir=new WeakMap,hl=new WeakMap,ho=new WeakSet,Ri=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!qh(this.options.networkMode),status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),vn.batch(()=>{U(this,fo).forEach(r=>{r.onMutationUpdate(t)}),U(this,ir).notify({mutation:this,type:"updated",action:t})})},yE);function L6(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Mr,$u,Us,xE,F6=(xE=class extends zu{constructor(t={}){super();Ie(this,Mr,void 0);Ie(this,$u,void 0);Ie(this,Us,void 0);this.config=t,Pe(this,Mr,[]),Pe(this,$u,0)}build(t,n,r){const o=new N6({mutationCache:this,mutationId:++Yd(this,$u)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){U(this,Mr).push(t),this.notify({type:"added",mutation:t})}remove(t){Pe(this,Mr,U(this,Mr).filter(n=>n!==t)),this.notify({type:"removed",mutation:t})}clear(){vn.batch(()=>{U(this,Mr).forEach(t=>{this.remove(t)})})}getAll(){return U(this,Mr)}find(t){const n={exact:!0,...t};return U(this,Mr).find(r=>n_(n,r))}findAll(t={}){return U(this,Mr).filter(n=>n_(t,n))}notify(t){vn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){return Pe(this,Us,(U(this,Us)??Promise.resolve()).then(()=>{const t=U(this,Mr).filter(n=>n.state.isPaused);return vn.batch(()=>t.reduce((n,r)=>n.then(()=>r.continue().catch(Tr)),Promise.resolve()))}).then(()=>{Pe(this,Us,void 0)})),U(this,Us)}},Mr=new WeakMap,$u=new WeakMap,Us=new WeakMap,xE);function z6(e){return{onFetch:(t,n)=>{const r=async()=>{var b,y,x,_,w;const o=t.options,i=(x=(y=(b=t.fetchOptions)==null?void 0:b.meta)==null?void 0:y.fetchMore)==null?void 0:x.direction,s=((_=t.state.data)==null?void 0:_.pages)||[],a=((w=t.state.data)==null?void 0:w.pageParams)||[],l={pages:[],pageParams:[]};let u=!1;const d=C=>{Object.defineProperty(C,"signal",{enumerable:!0,get:()=>(t.signal.aborted?u=!0:t.signal.addEventListener("abort",()=>{u=!0}),t.signal)})},h=t.options.queryFn||(()=>Promise.reject(new Error(`Missing queryFn: '${t.options.queryHash}'`))),p=async(C,R,E)=>{if(u)return Promise.reject();if(R==null&&C.pages.length)return Promise.resolve(C);const M={queryKey:t.queryKey,pageParam:R,direction:E?"backward":"forward",meta:t.options.meta};d(M);const D=await h(M),{maxPages:A}=t.options,k=E?O6:P6;return{pages:k(C.pages,D,A),pageParams:k(C.pageParams,R,A)}};let g;if(i&&s.length){const C=i==="backward",R=C?j6:i_,E={pages:s,pageParams:a},M=R(o,E);g=await p(E,M,C)}else{g=await p(l,a[0]??o.initialPageParam);const C=e??s.length;for(let R=1;R<C;R++){const E=i_(o,g);g=await p(g,E)}}return g};t.options.persister?t.fetchFn=()=>{var o,i;return(i=(o=t.options).persister)==null?void 0:i.call(o,r,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=r}}}function i_(e,{pages:t,pageParams:n}){const r=t.length-1;return e.getNextPageParam(t[r],t,n[r],n)}function j6(e,{pages:t,pageParams:n}){var r;return(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n)}var nn,Mi,Ti,pl,gl,Ai,ml,vl,wE,V6=(wE=class{constructor(e={}){Ie(this,nn,void 0);Ie(this,Mi,void 0);Ie(this,Ti,void 0);Ie(this,pl,void 0);Ie(this,gl,void 0);Ie(this,Ai,void 0);Ie(this,ml,void 0);Ie(this,vl,void 0);Pe(this,nn,e.queryCache||new QE),Pe(this,Mi,e.mutationCache||new F6),Pe(this,Ti,e.defaultOptions||{}),Pe(this,pl,new Map),Pe(this,gl,new Map),Pe(this,Ai,0)}mount(){Yd(this,Ai)._++,U(this,Ai)===1&&(Pe(this,ml,lh.subscribe(()=>{lh.isFocused()&&(this.resumePausedMutations(),U(this,nn).onFocus())})),Pe(this,vl,ch.subscribe(()=>{ch.isOnline()&&(this.resumePausedMutations(),U(this,nn).onOnline())})))}unmount(){var e,t;Yd(this,Ai)._--,U(this,Ai)===0&&((e=U(this,ml))==null||e.call(this),Pe(this,ml,void 0),(t=U(this,vl))==null||t.call(this),Pe(this,vl,void 0))}isFetching(e){return U(this,nn).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return U(this,Mi).findAll({...e,status:"pending"}).length}getQueryData(e){var t;return(t=U(this,nn).find({queryKey:e}))==null?void 0:t.state.data}ensureQueryData(e){const t=this.getQueryData(e.queryKey);return t!==void 0?Promise.resolve(t):this.fetchQuery(e)}getQueriesData(e){return this.getQueryCache().findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=U(this,nn).find({queryKey:e}),o=r==null?void 0:r.state.data,i=R6(t,o);if(typeof i>"u")return;const s=this.defaultQueryOptions({queryKey:e});return U(this,nn).build(this,s).setData(i,{...n,manual:!0})}setQueriesData(e,t,n){return vn.batch(()=>this.getQueryCache().findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var t;return(t=U(this,nn).find({queryKey:e}))==null?void 0:t.state}removeQueries(e){const t=U(this,nn);vn.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=U(this,nn),r={type:"active",...e};return vn.batch(()=>(n.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries(r,t)))}cancelQueries(e={},t={}){const n={revert:!0,...t},r=vn.batch(()=>U(this,nn).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(Tr).catch(Tr)}invalidateQueries(e={},t={}){return vn.batch(()=>{if(U(this,nn).findAll(e).forEach(r=>{r.invalidate()}),e.refetchType==="none")return Promise.resolve();const n={...e,type:e.refetchType??e.type??"active"};return this.refetchQueries(n,t)})}refetchQueries(e={},t){const n={...t,cancelRefetch:(t==null?void 0:t.cancelRefetch)??!0},r=vn.batch(()=>U(this,nn).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(Tr)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Tr)}fetchQuery(e){const t=this.defaultQueryOptions(e);typeof t.retry>"u"&&(t.retry=!1);const n=U(this,nn).build(this,t);return n.isStaleByTime(t.staleTime)?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Tr).catch(Tr)}fetchInfiniteQuery(e){return e.behavior=z6(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Tr).catch(Tr)}resumePausedMutations(){return U(this,Mi).resumePausedMutations()}getQueryCache(){return U(this,nn)}getMutationCache(){return U(this,Mi)}getDefaultOptions(){return U(this,Ti)}setDefaultOptions(e){Pe(this,Ti,e)}setQueryDefaults(e,t){U(this,pl).set(ru(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...U(this,pl).values()];let n={};return t.forEach(r=>{ou(e,r.queryKey)&&(n={...n,...r.defaultOptions})}),n}setMutationDefaults(e,t){U(this,gl).set(ru(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...U(this,gl).values()];let n={};return t.forEach(r=>{ou(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e!=null&&e._defaulted)return e;const t={...U(this,Ti).queries,...(e==null?void 0:e.queryKey)&&this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Qb(t.queryKey,t)),typeof t.refetchOnReconnect>"u"&&(t.refetchOnReconnect=t.networkMode!=="always"),typeof t.throwOnError>"u"&&(t.throwOnError=!!t.suspense),typeof t.networkMode>"u"&&t.persister&&(t.networkMode="offlineFirst"),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...U(this,Ti).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){U(this,nn).clear(),U(this,Mi).clear()}},nn=new WeakMap,Mi=new WeakMap,Ti=new WeakMap,pl=new WeakMap,gl=new WeakMap,Ai=new WeakMap,ml=new WeakMap,vl=new WeakMap,wE),Bn,It,Pu,In,qs,bl,po,Ou,yl,xl,Gs,Ys,Ii,wl,Ks,Mc,Du,Mv,Mu,Tv,Tu,Av,Au,Iv,Iu,kv,ku,Nv,Nu,Lv,zh,ZE,_E,H6=(_E=class extends zu{constructor(t,n){super();Ie(this,Ks);Ie(this,Du);Ie(this,Mu);Ie(this,Tu);Ie(this,Au);Ie(this,Iu);Ie(this,ku);Ie(this,Nu);Ie(this,zh);Ie(this,Bn,void 0);Ie(this,It,void 0);Ie(this,Pu,void 0);Ie(this,In,void 0);Ie(this,qs,void 0);Ie(this,bl,void 0);Ie(this,po,void 0);Ie(this,Ou,void 0);Ie(this,yl,void 0);Ie(this,xl,void 0);Ie(this,Gs,void 0);Ie(this,Ys,void 0);Ie(this,Ii,void 0);Ie(this,wl,new Set);this.options=n,Pe(this,Bn,t),Pe(this,po,null),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(U(this,It).addObserver(this),s_(U(this,It),this.options)?ot(this,Ks,Mc).call(this):this.updateResult(),ot(this,Au,Iv).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Fv(U(this,It),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Fv(U(this,It),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ot(this,Iu,kv).call(this),ot(this,ku,Nv).call(this),U(this,It).removeObserver(this)}setOptions(t,n){const r=this.options,o=U(this,It);if(this.options=U(this,Bn).defaultQueryOptions(t),Pv(r,this.options)||U(this,Bn).getQueryCache().notify({type:"observerOptionsUpdated",query:U(this,It),observer:this}),typeof this.options.enabled<"u"&&typeof this.options.enabled!="boolean")throw new Error("Expected enabled to be a boolean");this.options.queryKey||(this.options.queryKey=r.queryKey),ot(this,Nu,Lv).call(this);const i=this.hasListeners();i&&a_(U(this,It),o,this.options,r)&&ot(this,Ks,Mc).call(this),this.updateResult(n),i&&(U(this,It)!==o||this.options.enabled!==r.enabled||this.options.staleTime!==r.staleTime)&&ot(this,Du,Mv).call(this);const s=ot(this,Mu,Tv).call(this);i&&(U(this,It)!==o||this.options.enabled!==r.enabled||s!==U(this,Ii))&&ot(this,Tu,Av).call(this,s)}getOptimisticResult(t){const n=U(this,Bn).getQueryCache().build(U(this,Bn),t),r=this.createResult(n,t);return B6(this,r)&&(Pe(this,In,r),Pe(this,bl,this.options),Pe(this,qs,U(this,It).state)),r}getCurrentResult(){return U(this,In)}trackResult(t){const n={};return Object.keys(t).forEach(r=>{Object.defineProperty(n,r,{configurable:!1,enumerable:!0,get:()=>(U(this,wl).add(r),t[r])})}),n}getCurrentQuery(){return U(this,It)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=U(this,Bn).defaultQueryOptions(t),r=U(this,Bn).getQueryCache().build(U(this,Bn),n);return r.isFetchingOptimistic=!0,r.fetch().then(()=>this.createResult(r,n))}fetch(t){return ot(this,Ks,Mc).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),U(this,In)))}createResult(t,n){var M;const r=U(this,It),o=this.options,i=U(this,In),s=U(this,qs),a=U(this,bl),u=t!==r?t.state:U(this,Pu),{state:d}=t;let{error:h,errorUpdatedAt:p,fetchStatus:g,status:b}=d,y=!1,x;if(n._optimisticResults){const D=this.hasListeners(),A=!D&&s_(t,n),k=D&&a_(t,r,n,o);(A||k)&&(g=qh(t.options.networkMode)?"fetching":"paused",d.dataUpdatedAt||(b="pending")),n._optimisticResults==="isRestoring"&&(g="idle")}if(n.select&&typeof d.data<"u")if(i&&d.data===(s==null?void 0:s.data)&&n.select===U(this,Ou))x=U(this,yl);else try{Pe(this,Ou,n.select),x=n.select(d.data),x=Dv(i==null?void 0:i.data,x,n),Pe(this,yl,x),Pe(this,po,null)}catch(D){Pe(this,po,D)}else x=d.data;if(typeof n.placeholderData<"u"&&typeof x>"u"&&b==="pending"){let D;if(i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData))D=i.data;else if(D=typeof n.placeholderData=="function"?n.placeholderData((M=U(this,xl))==null?void 0:M.state.data,U(this,xl)):n.placeholderData,n.select&&typeof D<"u")try{D=n.select(D),Pe(this,po,null)}catch(A){Pe(this,po,A)}typeof D<"u"&&(b="success",x=Dv(i==null?void 0:i.data,D,n),y=!0)}U(this,po)&&(h=U(this,po),x=U(this,yl),p=Date.now(),b="error");const _=g==="fetching",w=b==="pending",C=b==="error",R=w&&_;return{status:b,fetchStatus:g,isPending:w,isSuccess:b==="success",isError:C,isInitialLoading:R,isLoading:R,data:x,dataUpdatedAt:d.dataUpdatedAt,error:h,errorUpdatedAt:p,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>u.dataUpdateCount||d.errorUpdateCount>u.errorUpdateCount,isFetching:_,isRefetching:_&&!w,isLoadingError:C&&d.dataUpdatedAt===0,isPaused:g==="paused",isPlaceholderData:y,isRefetchError:C&&d.dataUpdatedAt!==0,isStale:Zb(t,n),refetch:this.refetch}}updateResult(t){const n=U(this,In),r=this.createResult(U(this,It),this.options);if(Pe(this,qs,U(this,It).state),Pe(this,bl,this.options),U(this,qs).data!==void 0&&Pe(this,xl,U(this,It)),Pv(r,n))return;Pe(this,In,r);const o={},i=()=>{if(!n)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!U(this,wl).size)return!0;const l=new Set(a??U(this,wl));return this.options.throwOnError&&l.add("error"),Object.keys(U(this,In)).some(u=>{const d=u;return U(this,In)[d]!==n[d]&&l.has(d)})};(t==null?void 0:t.listeners)!==!1&&i()&&(o.listeners=!0),ot(this,zh,ZE).call(this,{...o,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ot(this,Au,Iv).call(this)}},Bn=new WeakMap,It=new WeakMap,Pu=new WeakMap,In=new WeakMap,qs=new WeakMap,bl=new WeakMap,po=new WeakMap,Ou=new WeakMap,yl=new WeakMap,xl=new WeakMap,Gs=new WeakMap,Ys=new WeakMap,Ii=new WeakMap,wl=new WeakMap,Ks=new WeakSet,Mc=function(t){ot(this,Nu,Lv).call(this);let n=U(this,It).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Tr)),n},Du=new WeakSet,Mv=function(){if(ot(this,Iu,kv).call(this),El||U(this,In).isStale||!$v(this.options.staleTime))return;const n=qE(U(this,In).dataUpdatedAt,this.options.staleTime)+1;Pe(this,Gs,setTimeout(()=>{U(this,In).isStale||this.updateResult()},n))},Mu=new WeakSet,Tv=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(U(this,It)):this.options.refetchInterval)??!1},Tu=new WeakSet,Av=function(t){ot(this,ku,Nv).call(this),Pe(this,Ii,t),!(El||this.options.enabled===!1||!$v(U(this,Ii))||U(this,Ii)===0)&&Pe(this,Ys,setInterval(()=>{(this.options.refetchIntervalInBackground||lh.isFocused())&&ot(this,Ks,Mc).call(this)},U(this,Ii)))},Au=new WeakSet,Iv=function(){ot(this,Du,Mv).call(this),ot(this,Tu,Av).call(this,ot(this,Mu,Tv).call(this))},Iu=new WeakSet,kv=function(){U(this,Gs)&&(clearTimeout(U(this,Gs)),Pe(this,Gs,void 0))},ku=new WeakSet,Nv=function(){U(this,Ys)&&(clearInterval(U(this,Ys)),Pe(this,Ys,void 0))},Nu=new WeakSet,Lv=function(){const t=U(this,Bn).getQueryCache().build(U(this,Bn),this.options);if(t===U(this,It))return;const n=U(this,It);Pe(this,It,t),Pe(this,Pu,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},zh=new WeakSet,ZE=function(t){vn.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(U(this,In))}),U(this,Bn).getQueryCache().notify({query:U(this,It),type:"observerResultsUpdated"})})},_E);function W6(e,t){return t.enabled!==!1&&!e.state.dataUpdatedAt&&!(e.state.status==="error"&&t.retryOnMount===!1)}function s_(e,t){return W6(e,t)||e.state.dataUpdatedAt>0&&Fv(e,t,t.refetchOnMount)}function Fv(e,t,n){if(t.enabled!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Zb(e,t)}return!1}function a_(e,t,n,r){return n.enabled!==!1&&(e!==t||r.enabled===!1)&&(!n.suspense||e.state.status!=="error")&&Zb(e,n)}function Zb(e,t){return e.isStaleByTime(t.staleTime)}function B6(e,t){return!Pv(e.getCurrentResult(),t)}var JE=le.createContext(void 0),U6=e=>{const t=le.useContext(JE);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},q6=({client:e,children:t})=>(le.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),le.createElement(JE.Provider,{value:e},t)),eR=le.createContext(!1),G6=()=>le.useContext(eR);eR.Provider;function Y6(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var K6=le.createContext(Y6()),X6=()=>le.useContext(K6);function Q6(e,t){return typeof e=="function"?e(...t):!!e}var Z6=(e,t)=>{(e.suspense||e.throwOnError)&&(t.isReset()||(e.retryOnMount=!1))},J6=e=>{le.useEffect(()=>{e.clearReset()},[e])},e9=({result:e,errorResetBoundary:t,throwOnError:n,query:r})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&Q6(n,[e.error,r]),t9=e=>{e.suspense&&typeof e.staleTime!="number"&&(e.staleTime=1e3)},n9=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,r9=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function o9(e,t,n){if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=U6(n),o=G6(),i=X6(),s=r.defaultQueryOptions(e);s._optimisticResults=o?"isRestoring":"optimistic",t9(s),Z6(s,i),J6(i);const[a]=le.useState(()=>new t(r,s)),l=a.getOptimisticResult(s);if(le.useSyncExternalStore(le.useCallback(u=>{const d=o?()=>{}:a.subscribe(vn.batchCalls(u));return a.updateResult(),d},[a,o]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),le.useEffect(()=>{a.setOptions(s,{listeners:!1})},[s,a]),n9(s,l))throw r9(s,a,i);if(e9({result:l,errorResetBoundary:i,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash)}))throw l.error;return s.notifyOnChangeProps?l:a.trackResult(l)}function ju(e,t){return o9(e,H6,t)}const i9={theme:"system",setTheme:()=>null},tR=m.createContext(i9);function s9({children:e,defaultTheme:t="system",storageKey:n="vite-ui-theme",...r}){const[o,i]=m.useState(()=>localStorage.getItem(n)||t);m.useEffect(()=>{const a=window.document.documentElement;if(a.classList.remove("light","dark"),o==="system"){const l=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";a.classList.add(l);return}a.classList.add(o)},[o]);const s={theme:o,setTheme:a=>{localStorage.setItem(n,a),i(a)}};return I.jsx(tR.Provider,{...r,value:s,children:e})}const nR=()=>{const e=m.useContext(tR);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e};async function a9(e){return await(await fetch("https://semaphor.cloud/api/v1/dashboard",{headers:{Authorization:`Bearer ${e}`}})).json()}function rR(e){return e==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e}function l_(e,t){const n=rR(e);return n==="dark"?ia.merge({...t==null?void 0:t.default},{...t==null?void 0:t.dark}):t==null?void 0:t.default}function l9({authToken:e,customStyle:t,currentTheme:n,onSave:r,onEvent:o}){const{data:i,refetch:s,isLoading:a,isError:l}=ju({queryKey:["dashboard",e==null?void 0:e.accessToken],queryFn:()=>a9(e==null?void 0:e.accessToken),enabled:!1}),{theme:u,setTheme:d}=nR(),{setDashboard:h,setSelectedSheetId:p,setStyle:g,setOnSaveFunction:b}=Ce(E=>E.actions);Ce(E=>E.actions.setCustomCards);const y=Ce(E=>E.actions.setFilterValues),x=Ce(E=>E.actions.setBookmarkKey),_=Ce(E=>E.actions.setAuthToken),w=Ce(E=>E.actions.setThemeStyle),C=Ce(E=>E.actions.setDashboardTheme),R=Ce(E=>E.actions.setOnEvent);return m.useEffect(()=>{if(u){const E=rR(u);C(E)}},[u,C]),m.useEffect(()=>{n&&d(n)},[n,d]),m.useEffect(()=>{const E=ia.cloneDeep(Rv);if(t){const M=ia.merge(E,t),D=l_(u,M);w(D),g(M)}else{const M=l_(u,E);w(M),g(Rv)}},[u,t,g,w]),m.useEffect(()=>{var k;if(!i||!i.dashboard)return;const E=i.dashboard,M=uD(E.id),D=JSON.parse(localStorage.getItem(M)||"[]"),A=D.find(L=>L.default===!0);if(A)h(A.template),x(A.name),A.filterValues&&y(A.filterValues);else{h(E);const L=D.find(W=>(W==null?void 0:W.name)==="Original");L?L.template=E:D.push({name:"Original",template:E,default:!1}),localStorage.setItem(M,JSON.stringify(D))}p((k=E.sheets)==null?void 0:k[0].id)},[i,h,p,y,x]),m.useEffect(()=>{r&&b(r),o&&R(o)},[r,b,o,R]),m.useEffect(()=>{e&&e.accessToken&&(_(e),s())},[e,s,_]),{isLoading:a,isError:l}}function Jb({className:e,...t}){return I.jsx("div",{className:_e("animate-pulse rounded-md bg-muted",e),...t})}const e0=le.forwardRef(({className:e,...t},n)=>I.jsx("div",{ref:n,className:_e("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));e0.displayName="Card";const Gh=le.forwardRef(({className:e,...t},n)=>I.jsx("div",{ref:n,className:_e("flex flex-col space-y-1.5 p-6",e),...t}));Gh.displayName="CardHeader";const Vu=le.forwardRef(({className:e,...t},n)=>I.jsx("h3",{ref:n,className:_e("text-2xl font-semibold leading-none tracking-tight",e),...t}));Vu.displayName="CardTitle";const t0=le.forwardRef(({className:e,...t},n)=>I.jsx("p",{ref:n,className:_e("text-sm text-muted-foreground",e),...t}));t0.displayName="CardDescription";const Yh=le.forwardRef(({className:e,...t},n)=>I.jsx("div",{ref:n,className:_e("px-6 pt-0",e),...t}));Yh.displayName="CardContent";const n0=le.forwardRef(({className:e,...t},n)=>I.jsx("div",{ref:n,className:_e("flex items-center p-6 pt-0",e),...t}));n0.displayName="CardFooter";function oR({className:e,customStyle:t,onSave:n,onEvent:r,LoadingComponent:o,ErrorComponent:i,onChartElementClicked:s,id:a,authToken:l,currentTheme:u,version:d,customCards:h,...p}){Ce(_=>_.selectedSheetId);const g=Ce(_=>_.themeStyle),b=Ce(_=>_.isSessionExpired),{isLoading:y,isError:x}=l9({authToken:l,customStyle:t,currentTheme:u,onSave:n,onEvent:r});return y||!l?(r==null||r({type:"info",message:"Loading dashboard"}),o?I.jsx(o,{message:"loading"}):I.jsx("div",{className:"flex items-center gap-3",children:I.jsx(Jb,{className:"h-1 w-full dark:h-[2px]"})})):x?(r==null||r({type:"error",message:"Error fetching dashboard"}),i?(console.log("Error fetching dashboard"),I.jsx(i,{})):I.jsx("div",{children:"Error"})):b?(r==null||r({type:"error",message:"Session Expired"}),I.jsx("div",{className:"flex h-full items-center justify-center",children:I.jsxs("div",{className:"space-y-4 rounded-md border border-muted p-10",children:[I.jsx(Vu,{children:"Session Expired"}),I.jsx("p",{className:"text-muted-foreground",children:"Your session has expired. Please refresh the page to continue."})]})})):I.jsx("div",{className:_e("flex h-full grow flex-col justify-between",g==null?void 0:g.dashboardPanel,e),role:"dashboard-panel",...p})}function te(){return te=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},te.apply(this,arguments)}function we(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 dn(e,t=[]){let n=[];function r(i,s){const a=m.createContext(s),l=n.length;n=[...n,s];function u(h){const{scope:p,children:g,...b}=h,y=(p==null?void 0:p[e][l])||a,x=m.useMemo(()=>b,Object.values(b));return m.createElement(y.Provider,{value:x},g)}function d(h,p){const g=(p==null?void 0:p[e][l])||a,b=m.useContext(g);if(b)return b;if(s!==void 0)return s;throw new Error(`\`${h}\` must be used within \`${i}\``)}return u.displayName=i+"Provider",[u,d]}const o=()=>{const i=n.map(s=>m.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return m.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,c9(o,...t)]}function c9(...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:u})=>{const h=l(i)[`__scope${u}`];return{...a,...h}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function u9(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Kh(...e){return t=>e.forEach(n=>u9(n,t))}function Xe(...e){return m.useCallback(Kh(...e),e)}const ni=m.forwardRef((e,t)=>{const{children:n,...r}=e,o=m.Children.toArray(n),i=o.find(d9);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(zv,te({},r,{ref:t}),m.isValidElement(s)?m.cloneElement(s,void 0,a):null)}return m.createElement(zv,te({},r,{ref:t}),n)});ni.displayName="Slot";const zv=m.forwardRef((e,t)=>{const{children:n,...r}=e;return m.isValidElement(n)?m.cloneElement(n,{...f9(r,n.props),ref:t?Kh(t,n.ref):n.ref}):m.Children.count(n)>1?m.Children.only(null):null});zv.displayName="SlotClone";const iR=({children:e})=>m.createElement(m.Fragment,null,e);function d9(e){return m.isValidElement(e)&&e.type===iR}function f9(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}}function Xh(e){const t=e+"CollectionProvider",[n,r]=dn(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=g=>{const{scope:b,children:y}=g,x=m.useRef(null),_=m.useRef(new Map).current;return m.createElement(o,{scope:b,itemMap:_,collectionRef:x},y)},a=e+"CollectionSlot",l=m.forwardRef((g,b)=>{const{scope:y,children:x}=g,_=i(a,y),w=Xe(b,_.collectionRef);return m.createElement(ni,{ref:w},x)}),u=e+"CollectionItemSlot",d="data-radix-collection-item",h=m.forwardRef((g,b)=>{const{scope:y,children:x,..._}=g,w=m.useRef(null),C=Xe(b,w),R=i(u,y);return m.useEffect(()=>(R.itemMap.set(w,{ref:w,..._}),()=>void R.itemMap.delete(w))),m.createElement(ni,{[d]:"",ref:C},x)});function p(g){const b=i(e+"CollectionConsumer",g);return m.useCallback(()=>{const x=b.collectionRef.current;if(!x)return[];const _=Array.from(x.querySelectorAll(`[${d}]`));return Array.from(b.itemMap.values()).sort((R,E)=>_.indexOf(R.ref.current)-_.indexOf(E.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:s,Slot:l,ItemSlot:h},p,r]}const Pn=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},h9=le.useId||(()=>{});let p9=0;function Yn(e){const[t,n]=le.useState(h9());return Pn(()=>{e||n(r=>r??String(p9++))},[e]),e||(t?`radix-${t}`:"")}const g9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],ke=g9.reduce((e,t)=>{const n=m.forwardRef((r,o)=>{const{asChild:i,...s}=r,a=i?ni:t;return m.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),m.createElement(a,te({},s,{ref:o}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function sR(e,t){e&&So.flushSync(()=>e.dispatchEvent(t))}function on(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}function On({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=m9({defaultProp:t,onChange:n}),i=e!==void 0,s=i?e:r,a=on(n),l=m.useCallback(u=>{if(i){const h=typeof u=="function"?u(e):u;h!==e&&a(h)}else o(u)},[i,e,o,a]);return[s,l]}function m9({defaultProp:e,onChange:t}){const n=m.useState(e),[r]=n,o=m.useRef(r),i=on(t);return m.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}const v9=m.createContext(void 0);function ha(e){const t=m.useContext(v9);return e||t||"ltr"}const cm="rovingFocusGroup.onEntryFocus",b9={bubbles:!1,cancelable:!0},r0="RovingFocusGroup",[jv,aR,y9]=Xh(r0),[x9,zl]=dn(r0,[y9]),[w9,_9]=x9(r0),S9=m.forwardRef((e,t)=>m.createElement(jv.Provider,{scope:e.__scopeRovingFocusGroup},m.createElement(jv.Slot,{scope:e.__scopeRovingFocusGroup},m.createElement(C9,te({},e,{ref:t}))))),C9=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:u,...d}=e,h=m.useRef(null),p=Xe(t,h),g=ha(i),[b=null,y]=On({prop:s,defaultProp:a,onChange:l}),[x,_]=m.useState(!1),w=on(u),C=aR(n),R=m.useRef(!1),[E,M]=m.useState(0);return m.useEffect(()=>{const D=h.current;if(D)return D.addEventListener(cm,w),()=>D.removeEventListener(cm,w)},[w]),m.createElement(w9,{scope:n,orientation:r,dir:g,loop:o,currentTabStopId:b,onItemFocus:m.useCallback(D=>y(D),[y]),onItemShiftTab:m.useCallback(()=>_(!0),[]),onFocusableItemAdd:m.useCallback(()=>M(D=>D+1),[]),onFocusableItemRemove:m.useCallback(()=>M(D=>D-1),[])},m.createElement(ke.div,te({tabIndex:x||E===0?-1:0,"data-orientation":r},d,{ref:p,style:{outline:"none",...e.style},onMouseDown:we(e.onMouseDown,()=>{R.current=!0}),onFocus:we(e.onFocus,D=>{const A=!R.current;if(D.target===D.currentTarget&&A&&!x){const k=new CustomEvent(cm,b9);if(D.currentTarget.dispatchEvent(k),!k.defaultPrevented){const L=C().filter(F=>F.focusable),W=L.find(F=>F.active),Y=L.find(F=>F.id===b),Q=[W,Y,...L].filter(Boolean).map(F=>F.ref.current);lR(Q)}}R.current=!1}),onBlur:we(e.onBlur,()=>_(!1))})))}),E9="RovingFocusGroupItem",R9=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,...s}=e,a=Yn(),l=i||a,u=_9(E9,n),d=u.currentTabStopId===l,h=aR(n),{onFocusableItemAdd:p,onFocusableItemRemove:g}=u;return m.useEffect(()=>{if(r)return p(),()=>g()},[r,p,g]),m.createElement(jv.ItemSlot,{scope:n,id:l,focusable:r,active:o},m.createElement(ke.span,te({tabIndex:d?0:-1,"data-orientation":u.orientation},s,{ref:t,onMouseDown:we(e.onMouseDown,b=>{r?u.onItemFocus(l):b.preventDefault()}),onFocus:we(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:we(e.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){u.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const y=O9(b,u.orientation,u.dir);if(y!==void 0){b.preventDefault();let _=h().filter(w=>w.focusable).map(w=>w.ref.current);if(y==="last")_.reverse();else if(y==="prev"||y==="next"){y==="prev"&&_.reverse();const w=_.indexOf(b.currentTarget);_=u.loop?D9(_,w+1):_.slice(w+1)}setTimeout(()=>lR(_))}})})))}),$9={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function P9(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function O9(e,t,n){const r=P9(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return $9[r]}function lR(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function D9(e,t){return e.map((n,r)=>e[(t+r)%e.length])}const o0=S9,i0=R9;function M9(e,t){return m.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const Zt=e=>{const{present:t,children:n}=e,r=T9(t),o=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),i=Xe(r.ref,o.ref);return typeof n=="function"||r.isPresent?m.cloneElement(o,{ref:i}):null};Zt.displayName="Presence";function T9(e){const[t,n]=m.useState(),r=m.useRef({}),o=m.useRef(e),i=m.useRef("none"),s=e?"mounted":"unmounted",[a,l]=M9(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const u=Zd(r.current);i.current=a==="mounted"?u:"none"},[a]),Pn(()=>{const u=r.current,d=o.current;if(d!==e){const p=i.current,g=Zd(u);e?l("MOUNT"):g==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(d&&p!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),Pn(()=>{if(t){const u=h=>{const g=Zd(r.current).includes(h.animationName);h.target===t&&g&&So.flushSync(()=>l("ANIMATION_END"))},d=h=>{h.target===t&&(i.current=Zd(r.current))};return t.addEventListener("animationstart",d),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{t.removeEventListener("animationstart",d),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:m.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function Zd(e){return(e==null?void 0:e.animationName)||"none"}const cR="Tabs",[A9,Qre]=dn(cR,[zl]),uR=zl(),[I9,s0]=A9(cR),k9=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:l="automatic",...u}=e,d=ha(a),[h,p]=On({prop:r,onChange:o,defaultProp:i});return m.createElement(I9,{scope:n,baseId:Yn(),value:h,onValueChange:p,orientation:s,dir:d,activationMode:l},m.createElement(ke.div,te({dir:d,"data-orientation":s},u,{ref:t})))}),N9="TabsList",L9=m.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=s0(N9,n),s=uR(n);return m.createElement(o0,te({asChild:!0},s,{orientation:i.orientation,dir:i.dir,loop:r}),m.createElement(ke.div,te({role:"tablist","aria-orientation":i.orientation},o,{ref:t})))}),F9="TabsTrigger",z9=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=s0(F9,n),a=uR(n),l=dR(s.baseId,r),u=fR(s.baseId,r),d=r===s.value;return m.createElement(i0,te({asChild:!0},a,{focusable:!o,active:d}),m.createElement(ke.button,te({type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:l},i,{ref:t,onMouseDown:we(e.onMouseDown,h=>{!o&&h.button===0&&h.ctrlKey===!1?s.onValueChange(r):h.preventDefault()}),onKeyDown:we(e.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&s.onValueChange(r)}),onFocus:we(e.onFocus,()=>{const h=s.activationMode!=="manual";!d&&!o&&h&&s.onValueChange(r)})})))}),j9="TabsContent",V9=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=s0(j9,n),l=dR(a.baseId,r),u=fR(a.baseId,r),d=r===a.value,h=m.useRef(d);return m.useEffect(()=>{const p=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(p)},[]),m.createElement(Zt,{present:o||d},({present:p})=>m.createElement(ke.div,te({"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!p,id:u,tabIndex:0},s,{ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0}}),p&&i))});function dR(e,t){return`${e}-trigger-${t}`}function fR(e,t){return`${e}-content-${t}`}const H9=k9,hR=L9,pR=z9,gR=V9,mR=H9,vR=le.forwardRef(({className:e,...t},n)=>I.jsx(hR,{ref:n,className:_e("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));vR.displayName=hR.displayName;const bR=le.forwardRef(({className:e,...t},n)=>I.jsx(pR,{ref:n,className:_e("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));bR.displayName=pR.displayName;const a0=le.forwardRef(({className:e,...t},n)=>I.jsx(gR,{ref:n,className:_e("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));a0.displayName=gR.displayName;var yR={exports:{}},Hu={},Vv={exports:{}};(function(e,t){(function(n,r){r(t)})(ks,function(n){function r(ee){return function(ie,ye,Z,De,Ne,Ve,qe){return ee(ie,ye,qe)}}function o(ee){return function(ie,ye,Z,De){if(!ie||!ye||typeof ie!="object"||typeof ye!="object")return ee(ie,ye,Z,De);var Ne=De.get(ie),Ve=De.get(ye);if(Ne&&Ve)return Ne===ye&&Ve===ie;De.set(ie,ye),De.set(ye,ie);var qe=ee(ie,ye,Z,De);return De.delete(ie),De.delete(ye),qe}}function i(ee,K){var ie={};for(var ye in ee)ie[ye]=ee[ye];for(var ye in K)ie[ye]=K[ye];return ie}function s(ee){return ee.constructor===Object||ee.constructor==null}function a(ee){return typeof ee.then=="function"}function l(ee,K){return ee===K||ee!==ee&&K!==K}var u="[object Arguments]",d="[object Boolean]",h="[object Date]",p="[object RegExp]",g="[object Map]",b="[object Number]",y="[object Object]",x="[object Set]",_="[object String]",w=Object.prototype.toString;function C(ee){var K=ee.areArraysEqual,ie=ee.areDatesEqual,ye=ee.areMapsEqual,Z=ee.areObjectsEqual,De=ee.areRegExpsEqual,Ne=ee.areSetsEqual,Ve=ee.createIsNestedEqual,qe=Ve(pt);function pt(dt,ft,Bt){if(dt===ft)return!0;if(!dt||!ft||typeof dt!="object"||typeof ft!="object")return dt!==dt&&ft!==ft;if(s(dt)&&s(ft))return Z(dt,ft,qe,Bt);var Vt=Array.isArray(dt),xn=Array.isArray(ft);if(Vt||xn)return Vt===xn&&K(dt,ft,qe,Bt);var Jt=w.call(dt);return Jt!==w.call(ft)?!1:Jt===h?ie(dt,ft,qe,Bt):Jt===p?De(dt,ft,qe,Bt):Jt===g?ye(dt,ft,qe,Bt):Jt===x?Ne(dt,ft,qe,Bt):Jt===y||Jt===u?a(dt)||a(ft)?!1:Z(dt,ft,qe,Bt):Jt===d||Jt===b||Jt===_?l(dt.valueOf(),ft.valueOf()):!1}return pt}function R(ee,K,ie,ye){var Z=ee.length;if(K.length!==Z)return!1;for(;Z-- >0;)if(!ie(ee[Z],K[Z],Z,Z,ee,K,ye))return!1;return!0}var E=o(R);function M(ee,K){return l(ee.valueOf(),K.valueOf())}function D(ee,K,ie,ye){var Z=ee.size===K.size;if(!Z)return!1;if(!ee.size)return!0;var De={},Ne=0;return ee.forEach(function(Ve,qe){if(Z){var pt=!1,dt=0;K.forEach(function(ft,Bt){!pt&&!De[dt]&&(pt=ie(qe,Bt,Ne,dt,ee,K,ye)&&ie(Ve,ft,qe,Bt,ee,K,ye))&&(De[dt]=!0),dt++}),Ne++,Z=pt}}),Z}var A=o(D),k="_owner",L=Object.prototype.hasOwnProperty;function W(ee,K,ie,ye){var Z=Object.keys(ee),De=Z.length;if(Object.keys(K).length!==De)return!1;for(var Ne;De-- >0;){if(Ne=Z[De],Ne===k){var Ve=!!ee.$$typeof,qe=!!K.$$typeof;if((Ve||qe)&&Ve!==qe)return!1}if(!L.call(K,Ne)||!ie(ee[Ne],K[Ne],Ne,Ne,ee,K,ye))return!1}return!0}var Y=o(W);function ne(ee,K){return ee.source===K.source&&ee.flags===K.flags}function Q(ee,K,ie,ye){var Z=ee.size===K.size;if(!Z)return!1;if(!ee.size)return!0;var De={};return ee.forEach(function(Ne,Ve){if(Z){var qe=!1,pt=0;K.forEach(function(dt,ft){!qe&&!De[pt]&&(qe=ie(Ne,dt,Ve,ft,ee,K,ye))&&(De[pt]=!0),pt++}),Z=qe}}),Z}var F=o(Q),J=Object.freeze({areArraysEqual:R,areDatesEqual:M,areMapsEqual:D,areObjectsEqual:W,areRegExpsEqual:ne,areSetsEqual:Q,createIsNestedEqual:r}),q=Object.freeze({areArraysEqual:E,areDatesEqual:M,areMapsEqual:A,areObjectsEqual:Y,areRegExpsEqual:ne,areSetsEqual:F,createIsNestedEqual:r}),X=C(J);function ae(ee,K){return X(ee,K,void 0)}var j=C(i(J,{createIsNestedEqual:function(){return l}}));function V(ee,K){return j(ee,K,void 0)}var oe=C(q);function ce(ee,K){return oe(ee,K,new WeakMap)}var ue=C(i(q,{createIsNestedEqual:function(){return l}}));function ge(ee,K){return ue(ee,K,new WeakMap)}function ve(ee){return C(i(J,ee(J)))}function fe(ee){var K=C(i(q,ee(q)));return function(ie,ye,Z){return Z===void 0&&(Z=new WeakMap),K(ie,ye,Z)}}n.circularDeepEqual=ce,n.circularShallowEqual=ge,n.createCustomCircularEqual=fe,n.createCustomEqual=ve,n.deepEqual=ae,n.sameValueZeroEqual=l,n.shallowEqual=V,Object.defineProperty(n,"__esModule",{value:!0})})})(Vv,Vv.exports);var l0=Vv.exports;const c0=Bb(cN);var at={},W9=function(t,n,r){return t===n?!0:t.className===n.className&&r(t.style,n.style)&&t.width===n.width&&t.autoSize===n.autoSize&&t.cols===n.cols&&t.draggableCancel===n.draggableCancel&&t.draggableHandle===n.draggableHandle&&r(t.verticalCompact,n.verticalCompact)&&r(t.compactType,n.compactType)&&r(t.layout,n.layout)&&r(t.margin,n.margin)&&r(t.containerPadding,n.containerPadding)&&t.rowHeight===n.rowHeight&&t.maxRows===n.maxRows&&t.isBounded===n.isBounded&&t.isDraggable===n.isDraggable&&t.isResizable===n.isResizable&&t.allowOverlap===n.allowOverlap&&t.preventCollision===n.preventCollision&&t.useCSSTransforms===n.useCSSTransforms&&t.transformScale===n.transformScale&&t.isDroppable===n.isDroppable&&r(t.resizeHandles,n.resizeHandles)&&r(t.resizeHandle,n.resizeHandle)&&t.onLayoutChange===n.onLayoutChange&&t.onDragStart===n.onDragStart&&t.onDrag===n.onDrag&&t.onDragStop===n.onDragStop&&t.onResizeStart===n.onResizeStart&&t.onResize===n.onResize&&t.onResizeStop===n.onResizeStop&&t.onDrop===n.onDrop&&r(t.droppingItem,n.droppingItem)&&r(t.innerRef,n.innerRef)};Object.defineProperty(at,"__esModule",{value:!0});at.bottom=u0;at.childrenEqual=G9;at.cloneLayout=xR;at.cloneLayoutItem=Xs;at.collides=Qh;at.compact=_R;at.compactItem=SR;at.compactType=aL;at.correctBounds=CR;at.fastPositionEqual=K9;at.fastRGLPropsEqual=void 0;at.getAllCollisions=ER;at.getFirstCollision=Fs;at.getLayoutItem=d0;at.getStatics=f0;at.modifyLayout=wR;at.moveElement=Ac;at.moveElementAwayFromCollision=Wv;at.noop=void 0;at.perc=Q9;at.resizeItemInDirection=rL;at.setTopLeft=iL;at.setTransform=oL;at.sortLayoutItems=b0;at.sortLayoutItemsByColRow=DR;at.sortLayoutItemsByRowCol=OR;at.synchronizeLayoutWithChildren=sL;at.validateLayout=MR;at.withLayoutItem=q9;var c_=l0,Tc=B9(m);function B9(e){return e&&e.__esModule?e:{default:e}}const U9=process.env.NODE_ENV==="production";function u0(e){let t=0,n;for(let r=0,o=e.length;r<o;r++)n=e[r].y+e[r].h,n>t&&(t=n);return t}function xR(e){const t=Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=Xs(e[n]);return t}function wR(e,t){const n=Array(e.length);for(let r=0,o=e.length;r<o;r++)t.i===e[r].i?n[r]=t:n[r]=e[r];return n}function q9(e,t,n){let r=d0(e,t);return r?(r=n(Xs(r)),e=wR(e,r),[e,r]):[e,null]}function Xs(e){return{w:e.w,h:e.h,x:e.x,y:e.y,i:e.i,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,moved:!!e.moved,static:!!e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}}function G9(e,t){return(0,c_.deepEqual)(Tc.default.Children.map(e,n=>n==null?void 0:n.key),Tc.default.Children.map(t,n=>n==null?void 0:n.key))&&(0,c_.deepEqual)(Tc.default.Children.map(e,n=>n==null?void 0:n.props["data-grid"]),Tc.default.Children.map(t,n=>n==null?void 0:n.props["data-grid"]))}const Y9=W9;at.fastRGLPropsEqual=Y9;function K9(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function Qh(e,t){return!(e.i===t.i||e.x+e.w<=t.x||e.x>=t.x+t.w||e.y+e.h<=t.y||e.y>=t.y+t.h)}function _R(e,t,n,r){const o=f0(e),i=b0(e,t),s=Array(e.length);for(let a=0,l=i.length;a<l;a++){let u=Xs(i[a]);u.static||(u=SR(o,u,t,n,i,r),o.push(u)),s[e.indexOf(i[a])]=u,u.moved=!1}return s}const X9={x:"w",y:"h"};function Hv(e,t,n,r){const o=X9[r];t[r]+=1;const i=e.map(s=>s.i).indexOf(t.i);for(let s=i+1;s<e.length;s++){const a=e[s];if(!a.static){if(a.y>t.y+t.h)break;Qh(t,a)&&Hv(e,a,n+t[o],r)}}t[r]=n}function SR(e,t,n,r,o,i){const s=n==="vertical",a=n==="horizontal";if(s)for(t.y=Math.min(u0(e),t.y);t.y>0&&!Fs(e,t);)t.y--;else if(a)for(;t.x>0&&!Fs(e,t);)t.x--;let l;for(;(l=Fs(e,t))&&!(n===null&&i);)if(a?Hv(o,t,l.x+l.w,"x"):Hv(o,t,l.y+l.h,"y"),a&&t.x+t.w>r)for(t.x=r-t.w,t.y++;t.x>0&&!Fs(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function CR(e,t){const n=f0(e);for(let r=0,o=e.length;r<o;r++){const i=e[r];if(i.x+i.w>t.cols&&(i.x=t.cols-i.w),i.x<0&&(i.x=0,i.w=t.cols),!i.static)n.push(i);else for(;Fs(n,i);)i.y++}return e}function d0(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function Fs(e,t){for(let n=0,r=e.length;n<r;n++)if(Qh(e[n],t))return e[n]}function ER(e,t){return e.filter(n=>Qh(n,t))}function f0(e){return e.filter(t=>t.static)}function Ac(e,t,n,r,o,i,s,a,l){if(t.static&&t.isDraggable!==!0||t.y===r&&t.x===n)return e;"Moving element ".concat(t.i," to [").concat(String(n),",").concat(String(r),"] from [").concat(t.x,",").concat(t.y,"]");const u=t.x,d=t.y;typeof n=="number"&&(t.x=n),typeof r=="number"&&(t.y=r),t.moved=!0;let h=b0(e,s);(s==="vertical"&&typeof r=="number"?d>=r:s==="horizontal"&&typeof n=="number"?u>=n:!1)&&(h=h.reverse());const g=ER(h,t),b=g.length>0;if(b&&l)return xR(e);if(b&&i)return"Collision prevented on ".concat(t.i,", reverting."),t.x=u,t.y=d,t.moved=!1,e;for(let y=0,x=g.length;y<x;y++){const _=g[y];"Resolving collision between ".concat(t.i," at [").concat(t.x,",").concat(t.y,"] and ").concat(_.i," at [").concat(_.x,",").concat(_.y,"]"),!_.moved&&(_.static?e=Wv(e,_,t,o,s):e=Wv(e,t,_,o,s))}return e}function Wv(e,t,n,r,o,i){const s=o==="horizontal",a=o==="vertical",l=t.static;if(r){r=!1;const h={x:s?Math.max(t.x-n.w,0):n.x,y:a?Math.max(t.y-n.h,0):n.y,w:n.w,h:n.h,i:"-1"},p=Fs(e,h),g=p&&p.y+p.h>t.y,b=p&&t.x+t.w>p.x;if(p){if(g&&a)return Ac(e,n,void 0,t.y+1,r,l,o);if(g&&o==null)return t.y=n.y,n.y=n.y+n.h,e;if(b&&s)return Ac(e,t,n.x,void 0,r,l,o)}else return"Doing reverse collision on ".concat(n.i," up to [").concat(h.x,",").concat(h.y,"]."),Ac(e,n,s?h.x:void 0,a?h.y:void 0,r,l,o)}const u=s?n.x+1:void 0,d=a?n.y+1:void 0;return u==null&&d==null?e:Ac(e,n,s?n.x+1:void 0,a?n.y+1:void 0,r,l,o)}function Q9(e){return e*100+"%"}const RR=(e,t,n,r)=>e+n>r?t:n,$R=(e,t,n)=>e<0?t:n,PR=e=>Math.max(0,e),h0=e=>Math.max(0,e),p0=(e,t,n)=>{let{left:r,height:o,width:i}=t;const s=e.top-(o-e.height);return{left:r,width:i,height:$R(s,e.height,o),top:h0(s)}},g0=(e,t,n)=>{let{top:r,left:o,height:i,width:s}=t;return{top:r,height:i,width:RR(e.left,e.width,s,n),left:PR(o)}},m0=(e,t,n)=>{let{top:r,height:o,width:i}=t;const s=e.left-(i-e.width);return{height:o,width:s<0?e.width:RR(e.left,e.width,i,n),top:h0(r),left:PR(s)}},v0=(e,t,n)=>{let{top:r,left:o,height:i,width:s}=t;return{width:s,left:o,height:$R(r,e.height,i),top:h0(r)}},Z9=function(){return p0(arguments.length<=0?void 0:arguments[0],g0(...arguments))},J9=function(){return p0(arguments.length<=0?void 0:arguments[0],m0(...arguments))},eL=function(){return v0(arguments.length<=0?void 0:arguments[0],g0(...arguments))},tL=function(){return v0(arguments.length<=0?void 0:arguments[0],m0(...arguments))},nL={n:p0,ne:Z9,e:g0,se:eL,s:v0,sw:tL,w:m0,nw:J9};function rL(e,t,n,r){const o=nL[e];return o?o(t,{...t,...n},r):n}function oL(e){let{top:t,left:n,width:r,height:o}=e;const i="translate(".concat(n,"px,").concat(t,"px)");return{transform:i,WebkitTransform:i,MozTransform:i,msTransform:i,OTransform:i,width:"".concat(r,"px"),height:"".concat(o,"px"),position:"absolute"}}function iL(e){let{top:t,left:n,width:r,height:o}=e;return{top:"".concat(t,"px"),left:"".concat(n,"px"),width:"".concat(r,"px"),height:"".concat(o,"px"),position:"absolute"}}function b0(e,t){return t==="horizontal"?DR(e):t==="vertical"?OR(e):e}function OR(e){return e.slice(0).sort(function(t,n){return t.y>n.y||t.y===n.y&&t.x>n.x?1:t.y===n.y&&t.x===n.x?0:-1})}function DR(e){return e.slice(0).sort(function(t,n){return t.x>n.x||t.x===n.x&&t.y>n.y?1:-1})}function sL(e,t,n,r,o){e=e||[];const i=[];Tc.default.Children.forEach(t,a=>{if((a==null?void 0:a.key)==null)return;const l=d0(e,String(a.key)),u=a.props["data-grid"];l&&u==null?i.push(Xs(l)):u?(U9||MR([u],"ReactGridLayout.children"),i.push(Xs({...u,i:a.key}))):i.push(Xs({w:1,h:1,x:0,y:u0(i),i:String(a.key)}))});const s=CR(i,{cols:n});return o?s:_R(s,r,n)}function MR(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Layout";const n=["x","y","w","h"];if(!Array.isArray(e))throw new Error(t+" must be an array!");for(let r=0,o=e.length;r<o;r++){const i=e[r];for(let s=0;s<n.length;s++)if(typeof i[n[s]]!="number")throw new Error("ReactGridLayout: "+t+"["+r+"]."+n[s]+" must be a number!")}}function aL(e){const{verticalCompact:t,compactType:n}=e||{};return t===!1?null:n}const lL=()=>{};at.noop=lL;var Co={};Object.defineProperty(Co,"__esModule",{value:!0});Co.calcGridColWidth=Zh;Co.calcGridItemPosition=cL;Co.calcGridItemWHPx=Bv;Co.calcWH=dL;Co.calcXY=uL;Co.clamp=zs;function Zh(e){const{margin:t,containerPadding:n,containerWidth:r,cols:o}=e;return(r-t[0]*(o-1)-n[0]*2)/o}function Bv(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function cL(e,t,n,r,o,i){const{margin:s,containerPadding:a,rowHeight:l}=e,u=Zh(e),d={};return i&&i.resizing?(d.width=Math.round(i.resizing.width),d.height=Math.round(i.resizing.height)):(d.width=Bv(r,u,s[0]),d.height=Bv(o,l,s[1])),i&&i.dragging?(d.top=Math.round(i.dragging.top),d.left=Math.round(i.dragging.left)):i&&i.resizing&&typeof i.resizing.top=="number"&&typeof i.resizing.left=="number"?(d.top=Math.round(i.resizing.top),d.left=Math.round(i.resizing.left)):(d.top=Math.round((l+s[1])*n+a[1]),d.left=Math.round((u+s[0])*t+a[0])),d}function uL(e,t,n,r,o){const{margin:i,cols:s,rowHeight:a,maxRows:l}=e,u=Zh(e);let d=Math.round((n-i[0])/(u+i[0])),h=Math.round((t-i[1])/(a+i[1]));return d=zs(d,0,s-r),h=zs(h,0,l-o),{x:d,y:h}}function dL(e,t,n,r,o,i){const{margin:s,maxRows:a,cols:l,rowHeight:u}=e,d=Zh(e);let h=Math.round((t+s[0])/(d+s[0])),p=Math.round((n+s[1])/(u+s[1])),g=zs(h,0,l-r),b=zs(p,0,a-o);return["sw","w","nw"].indexOf(i)!==-1&&(g=zs(h,0,l)),["nw","n","ne"].indexOf(i)!==-1&&(b=zs(p,0,a)),{w:g,h:b}}function zs(e,t,n){return Math.max(Math.min(e,n),t)}var Jh={},Uv={exports:{}},um,u_;function y0(){if(u_)return um;u_=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return um=e,um}var dm,d_;function fL(){if(d_)return dm;d_=1;var e=y0();function t(){}function n(){}return n.resetWarningCache=t,dm=function(){function r(s,a,l,u,d,h){if(h!==e){var p=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw p.name="Invariant Violation",p}}r.isRequired=r;function o(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},dm}var Jd={exports:{}},xt={};/** @license React v16.13.1
89
89
  * react-is.development.js
90
90
  *
91
91
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -209,7 +209,7 @@ Valid keys: `+JSON.stringify(Object.keys(j),null," "));var Z=ye(fe,ie,ue,ge,ve+
209
209
  *
210
210
  * This source code is licensed under the ISC license.
211
211
  * See the LICENSE file in the root directory of this source tree.
212
- */const WP=br("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function vC({number:e,format:t,useSuffix:n=!1,customSuffix:r="",currency:o="",locale:i="en-US"}){let s=1,a=r,l=i;const u=t.includes(".")?t.split(".")[1].length:0;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 d=e/s,h={maximumFractionDigits:u,minimumFractionDigits:u};if(o){h.style="currency",h.currency=o;try{new Intl.NumberFormat("en-US",h).format(0)}catch{h.currency="USD"}}try{new Intl.NumberFormat(i,h).format(0)}catch{l="en-US"}let g=new Intl.NumberFormat(l,h).format(d);return n&&(g+=a),g}function BP({card:e,isLoading:t}){var x,_,w,C,R,E,M,D,A,k,L,W,Y,ne,Q,F,J,q;const n=Ce(X=>X.actions.setCardTitle),r=Ce(X=>X.actions.setCardDescription),o=Ce(X=>X.isVisualEditing),i=Ar(X=>X.card),s=Ar(X=>X.actions.setCard);Ar(X=>X.actions.setNumberFormat);const a=Ce(X=>X.selectedSheetId),l=e.data,{metricKeys:u}=Nr(l||[]),d=(x=l==null?void 0:l[0])==null?void 0:x[u==null?void 0:u[0]],h=(_=l==null?void 0:l[0])==null?void 0:_[u==null?void 0:u[1]],p=!!e.data&&e.data.length>0;function g(X){o?s({...i,title:X}):n(a,e.id,X)}function b(X){o?s({...i,description:X}):r(a,e.id,X)}const y=h&&h-d!==0?(d-h)/h:null;return I.jsxs("div",{className:"kpi-card flex grow flex-col overflow-scroll",children:[I.jsxs(Gh,{className:"grow pb-3",children:[I.jsx(sa,{text:o?i.title:e.title,onSave:g,children:I.jsxs("div",{className:"flex items-center gap-2",children:[I.jsx(Vu,{className:"text-base font-medium text-muted-foreground",children:e.title}),!e.refreshInterval&&t&&I.jsx(ly,{className:"h-4 w-4 animate-spin text-muted-foreground"})]})}),p&&I.jsxs("div",{className:"flex flex-wrap items-end gap-3 text-foreground",children:[I.jsx("p",{className:"text-3xl font-semibold",children:vC({number:d,format:((C=(w=e.preferences)==null?void 0:w.formatNumber)==null?void 0:C.format)||"",useSuffix:!!((E=(R=e.preferences)==null?void 0:R.formatNumber)!=null&&E.suffix),customSuffix:"",locale:((D=(M=e.preferences)==null?void 0:M.formatNumber)==null?void 0:D.locale)||"",currency:((k=(A=e.preferences)==null?void 0:A.formatNumber)==null?void 0:k.currency)||""})}),h&&I.jsxs("span",{className:"min-w-fit text-base font-normal text-muted-foreground",children:["from  ",vC({number:h,format:((W=(L=e.preferences)==null?void 0:L.formatNumber)==null?void 0:W.format)||"",useSuffix:!!((ne=(Y=e.preferences)==null?void 0:Y.formatNumber)!=null&&ne.suffix),customSuffix:"",locale:((F=(Q=e.preferences)==null?void 0:Q.formatNumber)==null?void 0:F.locale)||"",currency:((q=(J=e.preferences)==null?void 0:J.formatNumber)==null?void 0:q.currency)||""})]})]})]}),y&&I.jsxs(Yh,{className:"grow items-start gap-1 pb-4 text-sm",children:[I.jsx(nU,{children:y}),I.jsxs("div",{className:"flex gap-1 text-muted-foreground",children:[y>0?"up ":"down ",I.jsx(sa,{text:e.description||"",onSave:b,children:e.description})]})]})]})}function nU({children:e}){const t=e>0?I.jsx(X0,{className:"h-4 w-4"}):I.jsx(K0,{className:"h-4 w-4"}),n=`${Math.abs(e*100).toFixed(0)}%`;return I.jsxs("div",{className:_e("flex items-center",{"text-green-600":e>0,"text-destructive":e<0}),children:[t,I.jsx("span",{className:"ml-[1px]",children:n})]})}var Ml=1e3,Tl=Ml*60,Al=Tl*60,ua=Al*24,rU=ua*7,oU=ua*365.25,iU=function(e,t){t=t||{};var n=typeof e;if(n==="string"&&e.length>0)return sU(e);if(n==="number"&&isFinite(e))return t.long?lU(e):aU(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function sU(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*oU;case"weeks":case"week":case"w":return n*rU;case"days":case"day":case"d":return n*ua;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Al;case"minutes":case"minute":case"mins":case"min":case"m":return n*Tl;case"seconds":case"second":case"secs":case"sec":case"s":return n*Ml;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function aU(e){var t=Math.abs(e);return t>=ua?Math.round(e/ua)+"d":t>=Al?Math.round(e/Al)+"h":t>=Tl?Math.round(e/Tl)+"m":t>=Ml?Math.round(e/Ml)+"s":e+"ms"}function lU(e){var t=Math.abs(e);return t>=ua?Ef(e,t,ua,"day"):t>=Al?Ef(e,t,Al,"hour"):t>=Tl?Ef(e,t,Tl,"minute"):t>=Ml?Ef(e,t,Ml,"second"):e+" ms"}function Ef(e,t,n,r){var o=t>=n*1.5;return Math.round(e/n)+" "+r+(o?"s":"")}const cU=Lu(iU);function UP({children:e}){const{setIsSessionExpired:t}=Ki(),n=new V6({queryCache:new QE({onError:r=>{console.error(`Something went wrong: ${r.message}`),r.message==="invalid token"&&t(!0)}}),defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1}}});return I.jsx(q6,{client:n,children:e})}const uU={id:"",authToken:void 0},qP=m.createContext(uU),GP=({children:e,dashboardProps:t})=>I.jsx(UP,{children:I.jsx(qP.Provider,{value:t,children:e})});function Wl(){const e=m.useContext(qP);if(e===void 0)throw new Error("useApplicationContext must be used within a ApplicationContextProvider");return e}function dU(e){Ce(u=>u.bookmarkKey);const t=Ce(u=>u.dashboard.baseQueries),{authToken:n}=Wl(),r=Ce(u=>u.authToken),o=Ce(u=>u.filterValues),i=Ce(u=>u.isDashboardEditing),s=cU((e==null?void 0:e.refreshInterval)||"0"),a=DE(e.sql,t);return ju({queryKey:[e.id,a],queryFn:()=>jh("https://semaphor.cloud/api/v1/query",(n==null?void 0:n.accessToken)||(r==null?void 0:r.accessToken)||"",{connection_id:e.connectionId,sql:a,python:e.python===BE?"":e.python,active_filters:o}),refetchInterval:s,enabled:!!e.connectionId&&!i})}function Wa({data:e,cfg:t,customCfg:n,preferences:r}){const{dimensionKeys:o,metricKeys:i}=Nr(e),s=CW(i,e,r),a=gb(s,n),l=o[0],u=mP(e,l);ia.merge((t==null?void 0:t.options)||{},r==null?void 0:r.chartOptions);const d=mb((t==null?void 0:t.options)||{},(n==null?void 0:n.options)||{});return{type:(n==null?void 0:n.type)||(t==null?void 0:t.type)||"bar",data:{labels:u,datasets:a},options:d}}function fU(e){return{...e,type:"bar",options:{...e==null?void 0:e.options,indexAxis:"y",scales:{x:{display:!0},y:{display:!0}}}}}function hU(e){return{...e,type:"bar",options:{...e==null?void 0:e.options,scales:{x:{display:!0},y:{display:!0}}}}}function pU(e){var n,r,o,i;return{...e,type:"bar",options:{...e==null?void 0:e.options,scales:{x:{...(r=(n=e==null?void 0:e.options)==null?void 0:n.scales)==null?void 0:r.x,display:!0,stacked:!0},y:{...(i=(o=e==null?void 0:e.options)==null?void 0:o.scales)==null?void 0:i.y,display:!0,stacked:!0}}}}}function gU(e){return{...e,type:"line",options:{...e==null?void 0:e.options,scales:{x:{display:!0},y:{display:!0}}}}}function mU(e,t){return{...t,type:e,options:{...t==null?void 0:t.options,scales:{x:{display:!1},y:{display:!1}}}}}function vU(e){return{...e,type:"radar",options:{...e==null?void 0:e.options,scales:{x:{display:!1},y:{display:!1}}}}}function YP({data:e,cardType:t="bar",cfg:n,customCfg:r,provider:o="chartjs",userSettings:i,preferences:s}){if(t==="bar"){const a=hU(n);return Wa({data:e,cfg:a,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="horizontalBar"){const a=fU(n);return Wa({data:e,cfg:a,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="stackedBar"){const a=pU(n),{dimensionKeys:l,metricKeys:u}=Nr(e),d=Q0({dataArray:e,groupKey:l[0],pivotKey:l[1],valueKey:u[0]});return Wa({data:d,cfg:a,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="line"){const a=gU(n);return Wa({data:e,cfg:a,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="pie"||t==="doughnut"||t==="polarArea"){const a=mU(t,n),{dimensionKeys:l,metricKeys:u}=Nr(e),d=$W(u,e),h=gb(d,r),p=l[0],g=mP(e,p),b=mb((a==null?void 0:a.options)||{},(r==null?void 0:r.options)||{});return{type:t,data:{labels:g,datasets:h},options:b}}if(t==="radar"){const a=vU(n);return Wa({data:e,cfg:a,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="bubble"||t==="scatter"){const{metricKeys:a}=Nr(e);if(a.length<3){console.log("Bubble charts require 3 numeric columns");return}const l=RW(e),u=gb(l,r),d={plugins:{datalabels:{display:!0}},scales:{x:{title:{display:!0,text:a[0]},beginAtZero:!0,ticks:{precision:0}},y:{title:{display:!0,text:a[1]},beginAtZero:!0,ticks:{precision:0}}}},h=mb(d,(r==null?void 0:r.options)||{});return{type:t,data:{datasets:u},options:h}}return Wa({data:e,cfg:n,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}function bU({chart:e,elementIndex:t,datasetIndex:n,cardType:r,cfg:o,apply:i}){const s=Ce.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)&&xU(e,t,o,i,a),["pie","doughnut","polarArea"].includes(r)&&wU(e,t,o,i,a),r==="stackedBar"&&yU({chart:e,elementIndex:t,datasetIndex:n,cfg:o,apply:i,blurColor:a})}function yU(e){var a,l,u,d;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((h,p)=>{var g,b;typeof h.backgroundColor=="string"&&(h.backgroundColor=new Array(h.data.length).fill(h.backgroundColor),h.borderColor=new Array(h.data.length).fill(h.borderColor)),h.backgroundColor=(g=h==null?void 0:h.backgroundColor)==null?void 0:g.map((y,x)=>x===n&&p===r?y:s),h.borderColor=(b=h==null?void 0:h.borderColor)==null?void 0:b.map((y,x)=>x===n&&p===r?y:s)}):(d=(u=t==null?void 0:t.data)==null?void 0:u.datasets)==null||d.forEach((h,p)=>{var g,b,y,x,_,w;h.backgroundColor=new Array(h.data.length).fill((y=(b=(g=o==null?void 0:o.data)==null?void 0:g.datasets)==null?void 0:b[p])==null?void 0:y.backgroundColor),h.borderColor=new Array(h.data.length).fill((w=(_=(x=o==null?void 0:o.data)==null?void 0:x.datasets)==null?void 0:_[p])==null?void 0:w.borderColor)}),t==null||t.update()}function xU(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(u=>{var d,h;typeof u.backgroundColor=="string"&&(u.backgroundColor=new Array(u.data.length).fill(u.backgroundColor),u.borderColor=new Array(u.data.length).fill(u.borderColor)),u.backgroundColor=(d=u==null?void 0:u.backgroundColor)==null?void 0:d.map((p,g)=>g===t?p:o),u.borderColor=(h=u==null?void 0:u.borderColor)==null?void 0:h.map((p,g)=>g===t?p:o)}):(l=(a=e==null?void 0:e.data)==null?void 0:a.datasets)==null||l.forEach((u,d)=>{var h,p,g,b,y,x;u.backgroundColor=new Array(u.data.length).fill((g=(p=(h=n==null?void 0:n.data)==null?void 0:h.datasets)==null?void 0:p[d])==null?void 0:g.backgroundColor),u.borderColor=new Array(u.data.length).fill((x=(y=(b=n==null?void 0:n.data)==null?void 0:b.datasets)==null?void 0:y[d])==null?void 0:x.borderColor)}),e==null||e.update()}function wU(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(u=>{var d,h;u.backgroundColor=(d=u==null?void 0:u.backgroundColor)==null?void 0:d.map((p,g)=>g===t?p:o),u.borderColor=(h=u==null?void 0:u.borderColor)==null?void 0:h.map((p,g)=>g===t?p:o)}):(l=(a=e==null?void 0:e.data)==null?void 0:a.datasets)==null||l.forEach((u,d)=>{var h,p,g,b,y,x,_,w;typeof u.backgroundColor=="string"&&(u.backgroundColor=(g=(p=(h=n==null?void 0:n.data)==null?void 0:h.datasets)==null?void 0:p[d])==null?void 0:g.backgroundColor,u.borderColor=(x=(y=(b=n==null?void 0:n.data)==null?void 0:b.datasets)==null?void 0:y[d])==null?void 0:x.borderColor),u.backgroundColor=(_=u==null?void 0:u.backgroundColor)==null?void 0:_.map((C,R)=>{var E;return(E=n.data.datasets[d].backgroundColor)==null?void 0:E[R]}),u.borderColor=(w=u==null?void 0:u.borderColor)==null?void 0:w.map((C,R)=>{var E;return(E=n.data.datasets[d].borderColor)==null?void 0:E[R]})}),e==null||e.update()}function _U(e,t,n,r){var o,i;try{if(!e||!e.data)return;const{dimensionKeys:s,metricKeys:a}=Nr(e.data);if(["bar","horizontalBar","line","pie","doughnut","radar","polarArea"].includes(e.type)){const l=s[0],u=(o=e.data[n])==null?void 0:o[l];return[{columnName:l,columnValue:u,metric:a[t],value:r}]}if(e.type==="stackedBar"){const l=Q0({dataArray:e.data,groupKey:s[0],pivotKey:s[1],valueKey:a[0]}),u=s[0],d=(i=l[n])==null?void 0:i[u],h=s[1],{metricKeys:p}=Nr(l),g=p[t];return[{columnName:u,columnValue:d,metric:a[0],value:r},{columnName:h,columnValue:g,metric:a[0],value:r}]}if(e.type==="bubble"||e.type==="scatter"){const l=s[0],u=r.label;return[{columnName:l,columnValue:u,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 SU(e){var s,a;const[t]=m.useState({id:"",title:"",type:"bar",data:[]}),{getCard:n}=Ki(),r=n(e),o=cy(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 cy(e){var W,Y,ne;const{onChartElementClicked:t}=Wl(),[n,r]=m.useState(0),o=((W=e==null?void 0:e.preferences)==null?void 0:W.filterOnClickColumnIndex)===void 0?0:(Y=e.preferences)==null?void 0:Y.filterOnClickColumnIndex,i=Ce(Q=>Q.bookmarkKey);Ce(Q=>Q.isVisualEditing);const s=Ce(Q=>Q.filteringCards),a=Ce(Q=>Q.selectedSheetId);Ce(Q=>Q.selectedCardId),Ce(Q=>Q.isDashboardEditing);const l=Ce(Q=>Q.themeStyle),u=Ce(Q=>Q.filterValues),d=(ne=e==null?void 0:e.preferences)==null?void 0:ne.onClickFilter,{addFrame:h,addFilteringCard:p,setFrameCardData:g,getSelectedFrame:b,addOrUpdateFilterValue:y,addOrUpdateFilterValues:x,removeFilterValue:_,removeFilteringCard:w}=Ki(),{data:C,isLoading:R,isFetching:E,isError:M,refetch:D}=dU(e),A=s==null?void 0:s.find(Q=>Q.id===e.id);let k;e.data&&e.data.length>0&&(k=YP({data:e.data,cardType:e.type,cfg:e.cfg,customCfg:e.customCfg,preferences:e.preferences})),m.useEffect(()=>{!C||!C.records||g(a,e.id,(C==null?void 0:C.records)||[])},[C,a,e.id,g,u]),m.useEffect(()=>{e.data&&r(n+1)},[e.data,e.type,e.cfg,e.customCfg,e.preferences,l]),m.useEffect(()=>{e.connectionId&&!A&&D()},[u,i]);function L(Q,F,J,q){var j,V;let X=!1;if(!e.data)return;const ae=_U(e,F,J,q);if(console.log("fieldValues",ae),t==null||t(e,ae),!!(((j=e==null?void 0:e.preferences)==null?void 0:j.onClickFilter)??[]).length){if(A){const oe=e.id;_(oe),w(e)}else{if(X=!0,!ae)return;const oe=[];ae.forEach((ce,ue)=>{const ge=d==null?void 0:d.find(fe=>fe.columnIndex===ue);if(!ge)return;const ve={filterId:e.id+"-"+ce.columnName,connectionId:e==null?void 0:e.connectionId,tableName:e.lastSelectedTable,name:ce.columnName,expression:ge.expression,valueType:nu(ae[ge.columnIndex].columnValue),operation:"=",values:[ae[ge.columnIndex].columnValue]};oe.push(ve)}),e.id,e==null||e.connectionId,e.lastSelectedTable,ae[o].columnName,(V=e.preferences)==null||V.filterOnClickField,nu(ae[o].columnValue),ae[o].columnValue,x(oe),p(e)}bU({chart:Q,elementIndex:J,datasetIndex:F,cardType:e.type,cfg:k,apply:X})}}return{isError:M,isLoading:R,isFetching:E,data:C,visualKey:n,handleDatapointClick:L,cfg:k}}function CU(e,t){const n=Ce(d=>d.selectedSheetId),r=Ce(d=>d.selectedFrameId),o=Ce(d=>d.isDashboardEditing),i=Ce(d=>d.isVisualEditing),{addFrame:s,getSelectedFrame:a,setSelectedFrameId:l}=Ce(d=>d.actions);m.useEffect(()=>{const d=p=>{if(o&&((p.metaKey||p.ctrlKey)&&p.key==="c"&&navigator.clipboard.writeText(JSON.stringify(a())),(p.ctrlKey||p.metaKey)&&p.key==="v"))try{navigator.clipboard.readText().then(g=>{try{const b=JSON.parse(g);if(b&&b.id){b.id=fu();const y=b.activeCardId;b.cards.forEach(x=>{const _=x.id;x.id=fu(),_===y&&(b.activeCardId=x.id,x.title=`${x.title} (Copy)`)}),s(n,b),l(b.id)}}catch(b){console.error("Failed to parse clipboard contents: ",b)}})}catch(g){console.error("Failed to read clipboard contents: ",g)}},h=t==null?void 0:t.current;return h==null||h.addEventListener("keydown",d),()=>{h==null||h.removeEventListener("keydown",d)}},[o,n,a,s,t,l]),m.useEffect(()=>{r===e.id&&o&&!i&&u()},[r,e.id,o,i]);function u(){const d=t==null?void 0:t.current;d==null||d.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}}let Nm;const KP="HoverCard",[XP,soe]=dn(KP,[$o]),uy=$o(),[EU,dy]=XP(KP),RU=e=>{const{__scopeHoverCard:t,children:n,open:r,defaultOpen:o,onOpenChange:i,openDelay:s=700,closeDelay:a=300}=e,l=uy(t),u=m.useRef(0),d=m.useRef(0),h=m.useRef(!1),p=m.useRef(!1),[g=!1,b]=On({prop:r,defaultProp:o,onChange:i}),y=m.useCallback(()=>{clearTimeout(d.current),u.current=window.setTimeout(()=>b(!0),s)},[s,b]),x=m.useCallback(()=>{clearTimeout(u.current),!h.current&&!p.current&&(d.current=window.setTimeout(()=>b(!1),a))},[a,b]),_=m.useCallback(()=>b(!1),[b]);return m.useEffect(()=>()=>{clearTimeout(u.current),clearTimeout(d.current)},[]),m.createElement(EU,{scope:t,open:g,onOpenChange:b,onOpen:y,onClose:x,onDismiss:_,hasSelectionRef:h,isPointerDownOnContentRef:p},m.createElement(Ku,l,n))},$U="HoverCardTrigger",PU=m.forwardRef((e,t)=>{const{__scopeHoverCard:n,...r}=e,o=dy($U,n),i=uy(n);return m.createElement(Xu,te({asChild:!0},i),m.createElement(ke.a,te({"data-state":o.open?"open":"closed"},r,{ref:t,onPointerEnter:we(e.onPointerEnter,Rh(o.onOpen)),onPointerLeave:we(e.onPointerLeave,Rh(o.onClose)),onFocus:we(e.onFocus,o.onOpen),onBlur:we(e.onBlur,o.onClose),onTouchStart:we(e.onTouchStart,s=>s.preventDefault())})))}),OU="HoverCardPortal",[aoe,DU]=XP(OU,{forceMount:void 0}),wb="HoverCardContent",MU=m.forwardRef((e,t)=>{const n=DU(wb,e.__scopeHoverCard),{forceMount:r=n.forceMount,...o}=e,i=dy(wb,e.__scopeHoverCard);return m.createElement(Zt,{present:r||i.open},m.createElement(TU,te({"data-state":i.open?"open":"closed"},o,{onPointerEnter:we(e.onPointerEnter,Rh(i.onOpen)),onPointerLeave:we(e.onPointerLeave,Rh(i.onClose)),ref:t})))}),TU=m.forwardRef((e,t)=>{const{__scopeHoverCard:n,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,...a}=e,l=dy(wb,n),u=uy(n),d=m.useRef(null),h=Xe(t,d),[p,g]=m.useState(!1);return m.useEffect(()=>{if(p){const b=document.body;return Nm=b.style.userSelect||b.style.webkitUserSelect,b.style.userSelect="none",b.style.webkitUserSelect="none",()=>{b.style.userSelect=Nm,b.style.webkitUserSelect=Nm}}},[p]),m.useEffect(()=>{if(d.current){const b=()=>{g(!1),l.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var y;((y=document.getSelection())===null||y===void 0?void 0:y.toString())!==""&&(l.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",b),()=>{document.removeEventListener("pointerup",b),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!1}}},[l.isPointerDownOnContentRef,l.hasSelectionRef]),m.useEffect(()=>{d.current&&AU(d.current).forEach(y=>y.setAttribute("tabindex","-1"))}),m.createElement(jl,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:s,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:we(i,b=>{b.preventDefault()}),onDismiss:l.onDismiss},m.createElement(Qu,te({},u,a,{onPointerDown:we(a.onPointerDown,b=>{b.currentTarget.contains(b.target)&&g(!0),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!0}),ref:h,style:{...a.style,userSelect:p?"text":void 0,WebkitUserSelect:p?"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 Rh(e){return t=>t.pointerType==="touch"?void 0:e()}function AU(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 IU=RU,kU=PU,QP=MU,ZP=IU,JP=kU,fy=le.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>I.jsx(QP,{ref:o,align:t,sideOffset:n,className:_e("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}));fy.displayName=QP.displayName;function NU({card:e}){const{setCardInfo:t}=Ki();return I.jsxs(ZP,{openDelay:0,children:[I.jsx(JP,{children:I.jsx(eU,{className:"size-4 text-muted-foreground/40"})}),I.jsx(fy,{align:"start",className:"w-[300px]",onMouseDown:n=>n.stopPropagation(),children:I.jsx(sa,{type:"textarea",text:e.info||"",onSave:n=>t(e.id,n),children:I.jsx("p",{className:"text-sm text-muted-foreground",children:e.info||"Add Info"})})})]})}const hy=le.forwardRef(({className:e,...t},n)=>I.jsx("div",{className:"relative w-full overflow-auto",children:I.jsx("table",{ref:n,className:_e("w-full caption-bottom text-sm",e),...t})}));hy.displayName="Table";const py=le.forwardRef(({className:e,...t},n)=>I.jsx("thead",{ref:n,className:_e("[&_tr]:border-b",e),...t}));py.displayName="TableHeader";const gy=le.forwardRef(({className:e,...t},n)=>I.jsx("tbody",{ref:n,className:_e("[&_tr:last-child]:border-0",e),...t}));gy.displayName="TableBody";const LU=le.forwardRef(({className:e,...t},n)=>I.jsx("tfoot",{ref:n,className:_e("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));LU.displayName="TableFooter";const Xc=le.forwardRef(({className:e,...t},n)=>I.jsx("tr",{ref:n,className:_e("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));Xc.displayName="TableRow";const my=le.forwardRef(({className:e,...t},n)=>I.jsx("th",{ref:n,className:_e("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));my.displayName="TableHead";const $h=le.forwardRef(({className:e,...t},n)=>I.jsx("td",{ref:n,className:_e("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));$h.displayName="TableCell";const FU=le.forwardRef(({className:e,...t},n)=>I.jsx("caption",{ref:n,className:_e("mt-4 text-sm text-muted-foreground",e),...t}));FU.displayName="TableCaption";/**
212
+ */const WP=br("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function vC({number:e,format:t,useSuffix:n=!1,customSuffix:r="",currency:o="",locale:i="en-US"}){let s=1,a=r,l=i;const u=t.includes(".")?t.split(".")[1].length:0;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 d=e/s,h={maximumFractionDigits:u,minimumFractionDigits:u};if(o){h.style="currency",h.currency=o;try{new Intl.NumberFormat("en-US",h).format(0)}catch{h.currency="USD"}}try{new Intl.NumberFormat(i,h).format(0)}catch{l="en-US"}let g=new Intl.NumberFormat(l,h).format(d);return n&&(g+=a),g}function BP({card:e,isLoading:t}){var x,_,w,C,R,E,M,D,A,k,L,W,Y,ne,Q,F,J,q;const n=Ce(X=>X.actions.setCardTitle),r=Ce(X=>X.actions.setCardDescription),o=Ce(X=>X.isVisualEditing),i=Ar(X=>X.card),s=Ar(X=>X.actions.setCard);Ar(X=>X.actions.setNumberFormat);const a=Ce(X=>X.selectedSheetId),l=e.data,{metricKeys:u}=Nr(l||[]),d=(x=l==null?void 0:l[0])==null?void 0:x[u==null?void 0:u[0]],h=(_=l==null?void 0:l[0])==null?void 0:_[u==null?void 0:u[1]],p=!!e.data&&e.data.length>0;function g(X){o?s({...i,title:X}):n(a,e.id,X)}function b(X){o?s({...i,description:X}):r(a,e.id,X)}const y=h&&h-d!==0?(d-h)/h:null;return I.jsxs("div",{className:"kpi-card flex grow flex-col overflow-scroll",children:[I.jsxs(Gh,{className:"grow pb-3",children:[I.jsx(sa,{text:o?i.title:e.title,onSave:g,children:I.jsxs("div",{className:"flex items-center gap-2",children:[I.jsx(Vu,{className:"text-base font-medium text-muted-foreground",children:e.title}),!e.refreshInterval&&t&&I.jsx(ly,{className:"h-4 w-4 animate-spin text-muted-foreground"})]})}),p&&I.jsxs("div",{className:"flex flex-wrap items-end gap-3 text-foreground",children:[I.jsx("p",{className:"text-3xl font-semibold",children:vC({number:d,format:((C=(w=e.preferences)==null?void 0:w.formatNumber)==null?void 0:C.format)||"",useSuffix:!!((E=(R=e.preferences)==null?void 0:R.formatNumber)!=null&&E.suffix),customSuffix:"",locale:((D=(M=e.preferences)==null?void 0:M.formatNumber)==null?void 0:D.locale)||"",currency:((k=(A=e.preferences)==null?void 0:A.formatNumber)==null?void 0:k.currency)||""})}),h&&I.jsxs("span",{className:"min-w-fit text-base font-normal text-muted-foreground",children:["from  ",vC({number:h,format:((W=(L=e.preferences)==null?void 0:L.formatNumber)==null?void 0:W.format)||"",useSuffix:!!((ne=(Y=e.preferences)==null?void 0:Y.formatNumber)!=null&&ne.suffix),customSuffix:"",locale:((F=(Q=e.preferences)==null?void 0:Q.formatNumber)==null?void 0:F.locale)||"",currency:((q=(J=e.preferences)==null?void 0:J.formatNumber)==null?void 0:q.currency)||""})]})]})]}),y&&I.jsxs(Yh,{className:"grow items-start gap-1 pb-4 text-sm",children:[I.jsx(nU,{children:y}),I.jsxs("div",{className:"flex gap-1 text-muted-foreground",children:[y>0?"up ":"down ",I.jsx(sa,{text:e.description||"",onSave:b,children:e.description})]})]})]})}function nU({children:e}){const t=e>0?I.jsx(X0,{className:"h-4 w-4"}):I.jsx(K0,{className:"h-4 w-4"}),n=`${Math.abs(e*100).toFixed(0)}%`;return I.jsxs("div",{className:_e("flex items-center",{"text-green-600":e>0,"text-destructive":e<0}),children:[t,I.jsx("span",{className:"ml-[1px]",children:n})]})}var Ml=1e3,Tl=Ml*60,Al=Tl*60,ua=Al*24,rU=ua*7,oU=ua*365.25,iU=function(e,t){t=t||{};var n=typeof e;if(n==="string"&&e.length>0)return sU(e);if(n==="number"&&isFinite(e))return t.long?lU(e):aU(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function sU(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*oU;case"weeks":case"week":case"w":return n*rU;case"days":case"day":case"d":return n*ua;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Al;case"minutes":case"minute":case"mins":case"min":case"m":return n*Tl;case"seconds":case"second":case"secs":case"sec":case"s":return n*Ml;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function aU(e){var t=Math.abs(e);return t>=ua?Math.round(e/ua)+"d":t>=Al?Math.round(e/Al)+"h":t>=Tl?Math.round(e/Tl)+"m":t>=Ml?Math.round(e/Ml)+"s":e+"ms"}function lU(e){var t=Math.abs(e);return t>=ua?Ef(e,t,ua,"day"):t>=Al?Ef(e,t,Al,"hour"):t>=Tl?Ef(e,t,Tl,"minute"):t>=Ml?Ef(e,t,Ml,"second"):e+" ms"}function Ef(e,t,n,r){var o=t>=n*1.5;return Math.round(e/n)+" "+r+(o?"s":"")}const cU=Lu(iU);function UP({children:e}){const{setIsSessionExpired:t}=Ki(),n=new V6({queryCache:new QE({onError:r=>{console.error(`Something went wrong: ${r.message}`),r.message==="invalid token"&&t(!0)}}),defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1}}});return I.jsx(q6,{client:n,children:e})}const uU={id:"",authToken:void 0},qP=m.createContext(uU),GP=({children:e,dashboardProps:t})=>I.jsx(UP,{children:I.jsx(qP.Provider,{value:t,children:e})});function Wl(){const e=m.useContext(qP);if(e===void 0)throw new Error("useApplicationContext must be used within a ApplicationContextProvider");return e}function dU(e){Ce(u=>u.bookmarkKey);const t=Ce(u=>u.dashboard.baseQueries),{authToken:n}=Wl(),r=Ce(u=>u.authToken),o=Ce(u=>u.filterValues),i=Ce(u=>u.isDashboardEditing),s=cU((e==null?void 0:e.refreshInterval)||"0"),a=DE(e.sql,t);return ju({queryKey:[e.id,a],queryFn:()=>jh("https://semaphor.cloud/api/v1/query",(n==null?void 0:n.accessToken)||(r==null?void 0:r.accessToken)||"",{connection_id:e.connectionId,sql:a,python:e.python===BE?"":e.python,active_filters:o}),refetchInterval:s,enabled:!!e.connectionId&&!i})}function Wa({data:e,cfg:t,customCfg:n,preferences:r}){const{dimensionKeys:o,metricKeys:i}=Nr(e),s=CW(i,e,r),a=gb(s,n),l=o[0],u=mP(e,l);ia.merge((t==null?void 0:t.options)||{},r==null?void 0:r.chartOptions);const d=mb((t==null?void 0:t.options)||{},(n==null?void 0:n.options)||{});return{type:(n==null?void 0:n.type)||(t==null?void 0:t.type)||"bar",data:{labels:u,datasets:a},options:d}}function fU(e){return{...e,type:"bar",options:{...e==null?void 0:e.options,indexAxis:"y",scales:{x:{display:!0},y:{display:!0}}}}}function hU(e){return{...e,type:"bar",options:{...e==null?void 0:e.options,scales:{x:{display:!0},y:{display:!0}}}}}function pU(e){var n,r,o,i;return{...e,type:"bar",options:{...e==null?void 0:e.options,scales:{x:{...(r=(n=e==null?void 0:e.options)==null?void 0:n.scales)==null?void 0:r.x,display:!0,stacked:!0},y:{...(i=(o=e==null?void 0:e.options)==null?void 0:o.scales)==null?void 0:i.y,display:!0,stacked:!0}}}}}function gU(e){return{...e,type:"line",options:{...e==null?void 0:e.options,scales:{x:{display:!0},y:{display:!0}}}}}function mU(e,t){return{...t,type:e,options:{...t==null?void 0:t.options,scales:{x:{display:!1},y:{display:!1}}}}}function vU(e){return{...e,type:"radar",options:{...e==null?void 0:e.options,scales:{x:{display:!1},y:{display:!1}}}}}function YP({data:e,cardType:t="bar",cfg:n,customCfg:r,provider:o="chartjs",userSettings:i,preferences:s}){if(t==="bar"){const a=hU(n);return Wa({data:e,cfg:a,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="horizontalBar"){const a=fU(n);return Wa({data:e,cfg:a,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="stackedBar"){const a=pU(n),{dimensionKeys:l,metricKeys:u}=Nr(e),d=Q0({dataArray:e,groupKey:l[0],pivotKey:l[1],valueKey:u[0]});return Wa({data:d,cfg:a,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="line"){const a=gU(n);return Wa({data:e,cfg:a,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="pie"||t==="doughnut"||t==="polarArea"){const a=mU(t,n),{dimensionKeys:l,metricKeys:u}=Nr(e),d=$W(u,e),h=gb(d,r),p=l[0],g=mP(e,p),b=mb((a==null?void 0:a.options)||{},(r==null?void 0:r.options)||{});return{type:t,data:{labels:g,datasets:h},options:b}}if(t==="radar"){const a=vU(n);return Wa({data:e,cfg:a,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="bubble"||t==="scatter"){const{metricKeys:a}=Nr(e);if(a.length<3){console.log("Bubble charts require 3 numeric columns");return}const l=RW(e),u=gb(l,r),d={plugins:{datalabels:{display:!0}},scales:{x:{title:{display:!0,text:a[0]},beginAtZero:!0,ticks:{precision:0}},y:{title:{display:!0,text:a[1]},beginAtZero:!0,ticks:{precision:0}}}},h=mb(d,(r==null?void 0:r.options)||{});return{type:t,data:{datasets:u},options:h}}return Wa({data:e,cfg:n,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}function bU({chart:e,elementIndex:t,datasetIndex:n,cardType:r,cfg:o,apply:i}){const s=Ce.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)&&xU(e,t,o,i,a),["pie","doughnut","polarArea"].includes(r)&&wU(e,t,o,i,a),r==="stackedBar"&&yU({chart:e,elementIndex:t,datasetIndex:n,cfg:o,apply:i,blurColor:a})}function yU(e){var a,l,u,d;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((h,p)=>{var g,b;typeof h.backgroundColor=="string"&&(h.backgroundColor=new Array(h.data.length).fill(h.backgroundColor),h.borderColor=new Array(h.data.length).fill(h.borderColor)),h.backgroundColor=(g=h==null?void 0:h.backgroundColor)==null?void 0:g.map((y,x)=>x===n&&p===r?y:s),h.borderColor=(b=h==null?void 0:h.borderColor)==null?void 0:b.map((y,x)=>x===n&&p===r?y:s)}):(d=(u=t==null?void 0:t.data)==null?void 0:u.datasets)==null||d.forEach((h,p)=>{var g,b,y,x,_,w;h.backgroundColor=new Array(h.data.length).fill((y=(b=(g=o==null?void 0:o.data)==null?void 0:g.datasets)==null?void 0:b[p])==null?void 0:y.backgroundColor),h.borderColor=new Array(h.data.length).fill((w=(_=(x=o==null?void 0:o.data)==null?void 0:x.datasets)==null?void 0:_[p])==null?void 0:w.borderColor)}),t==null||t.update()}function xU(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(u=>{var d,h;typeof u.backgroundColor=="string"&&(u.backgroundColor=new Array(u.data.length).fill(u.backgroundColor),u.borderColor=new Array(u.data.length).fill(u.borderColor)),u.backgroundColor=(d=u==null?void 0:u.backgroundColor)==null?void 0:d.map((p,g)=>g===t?p:o),u.borderColor=(h=u==null?void 0:u.borderColor)==null?void 0:h.map((p,g)=>g===t?p:o)}):(l=(a=e==null?void 0:e.data)==null?void 0:a.datasets)==null||l.forEach((u,d)=>{var h,p,g,b,y,x;u.backgroundColor=new Array(u.data.length).fill((g=(p=(h=n==null?void 0:n.data)==null?void 0:h.datasets)==null?void 0:p[d])==null?void 0:g.backgroundColor),u.borderColor=new Array(u.data.length).fill((x=(y=(b=n==null?void 0:n.data)==null?void 0:b.datasets)==null?void 0:y[d])==null?void 0:x.borderColor)}),e==null||e.update()}function wU(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(u=>{var d,h;u.backgroundColor=(d=u==null?void 0:u.backgroundColor)==null?void 0:d.map((p,g)=>g===t?p:o),u.borderColor=(h=u==null?void 0:u.borderColor)==null?void 0:h.map((p,g)=>g===t?p:o)}):(l=(a=e==null?void 0:e.data)==null?void 0:a.datasets)==null||l.forEach((u,d)=>{var h,p,g,b,y,x,_,w;typeof u.backgroundColor=="string"&&(u.backgroundColor=(g=(p=(h=n==null?void 0:n.data)==null?void 0:h.datasets)==null?void 0:p[d])==null?void 0:g.backgroundColor,u.borderColor=(x=(y=(b=n==null?void 0:n.data)==null?void 0:b.datasets)==null?void 0:y[d])==null?void 0:x.borderColor),u.backgroundColor=(_=u==null?void 0:u.backgroundColor)==null?void 0:_.map((C,R)=>{var E;return(E=n.data.datasets[d].backgroundColor)==null?void 0:E[R]}),u.borderColor=(w=u==null?void 0:u.borderColor)==null?void 0:w.map((C,R)=>{var E;return(E=n.data.datasets[d].borderColor)==null?void 0:E[R]})}),e==null||e.update()}function _U(e,t,n,r){var o,i;try{if(!e||!e.data)return;const{dimensionKeys:s,metricKeys:a}=Nr(e.data);if(["bar","horizontalBar","line","pie","doughnut","radar","polarArea"].includes(e.type)){const l=s[0],u=(o=e.data[n])==null?void 0:o[l];return[{columnName:l,columnValue:u,metric:a[t],value:r}]}if(e.type==="stackedBar"){const l=Q0({dataArray:e.data,groupKey:s[0],pivotKey:s[1],valueKey:a[0]}),u=s[0],d=(i=l[n])==null?void 0:i[u],h=s[1],{metricKeys:p}=Nr(l),g=p[t];return[{columnName:u,columnValue:d,metric:a[0],value:r},{columnName:h,columnValue:g,metric:a[0],value:r}]}if(e.type==="bubble"||e.type==="scatter"){const l=s[0],u=r.label;return[{columnName:l,columnValue:u,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 SU(e){var s,a;const[t]=m.useState({id:"",title:"",type:"bar",data:[]}),{getCard:n}=Ki(),r=n(e),o=cy(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 cy(e){var W,Y,ne;const{onChartElementClicked:t}=Wl(),[n,r]=m.useState(0),o=((W=e==null?void 0:e.preferences)==null?void 0:W.filterOnClickColumnIndex)===void 0?0:(Y=e.preferences)==null?void 0:Y.filterOnClickColumnIndex,i=Ce(Q=>Q.bookmarkKey);Ce(Q=>Q.isVisualEditing);const s=Ce(Q=>Q.filteringCards),a=Ce(Q=>Q.selectedSheetId);Ce(Q=>Q.selectedCardId),Ce(Q=>Q.isDashboardEditing);const l=Ce(Q=>Q.themeStyle),u=Ce(Q=>Q.filterValues),d=(ne=e==null?void 0:e.preferences)==null?void 0:ne.onClickFilter,{addFrame:h,addFilteringCard:p,setFrameCardData:g,getSelectedFrame:b,addOrUpdateFilterValue:y,addOrUpdateFilterValues:x,removeFilterValue:_,removeFilteringCard:w}=Ki(),{data:C,isLoading:R,isFetching:E,isError:M,refetch:D}=dU(e),A=s==null?void 0:s.find(Q=>Q.id===e.id);let k;e.data&&e.data.length>0&&(k=YP({data:e.data,cardType:e.type,cfg:e.cfg,customCfg:e.customCfg,preferences:e.preferences})),m.useEffect(()=>{!C||!C.records||g(a,e.id,(C==null?void 0:C.records)||[])},[C,a,e.id,g,u]),m.useEffect(()=>{e.data&&r(n+1)},[e.data,e.type,e.cfg,e.customCfg,e.preferences,l]),m.useEffect(()=>{e.connectionId&&!A&&D()},[u,i]);function L(Q,F,J,q){var j,V;let X=!1;if(!e.data)return;const ae=_U(e,F,J,q);if(t==null||t(e,ae),!!(((j=e==null?void 0:e.preferences)==null?void 0:j.onClickFilter)??[]).length){if(A){const oe=e.id;_(oe),w(e)}else{if(X=!0,!ae)return;const oe=[];ae.forEach((ce,ue)=>{const ge=d==null?void 0:d.find(fe=>fe.columnIndex===ue);if(!ge)return;const ve={filterId:e.id+"-"+ce.columnName,connectionId:e==null?void 0:e.connectionId,tableName:e.lastSelectedTable,name:ce.columnName,expression:ge.expression,valueType:nu(ae[ge.columnIndex].columnValue),operation:"=",values:[ae[ge.columnIndex].columnValue]};oe.push(ve)}),e.id,e==null||e.connectionId,e.lastSelectedTable,ae[o].columnName,(V=e.preferences)==null||V.filterOnClickField,nu(ae[o].columnValue),ae[o].columnValue,x(oe),p(e)}bU({chart:Q,elementIndex:J,datasetIndex:F,cardType:e.type,cfg:k,apply:X})}}return{isError:M,isLoading:R,isFetching:E,data:C,visualKey:n,handleDatapointClick:L,cfg:k}}function CU(e,t){const n=Ce(d=>d.selectedSheetId),r=Ce(d=>d.selectedFrameId),o=Ce(d=>d.isDashboardEditing),i=Ce(d=>d.isVisualEditing),{addFrame:s,getSelectedFrame:a,setSelectedFrameId:l}=Ce(d=>d.actions);m.useEffect(()=>{const d=p=>{if(o&&((p.metaKey||p.ctrlKey)&&p.key==="c"&&navigator.clipboard.writeText(JSON.stringify(a())),(p.ctrlKey||p.metaKey)&&p.key==="v"))try{navigator.clipboard.readText().then(g=>{try{const b=JSON.parse(g);if(b&&b.id){b.id=fu();const y=b.activeCardId;b.cards.forEach(x=>{const _=x.id;x.id=fu(),_===y&&(b.activeCardId=x.id,x.title=`${x.title} (Copy)`)}),s(n,b),l(b.id)}}catch(b){console.error("Failed to parse clipboard contents: ",b)}})}catch(g){console.error("Failed to read clipboard contents: ",g)}},h=t==null?void 0:t.current;return h==null||h.addEventListener("keydown",d),()=>{h==null||h.removeEventListener("keydown",d)}},[o,n,a,s,t,l]),m.useEffect(()=>{r===e.id&&o&&!i&&u()},[r,e.id,o,i]);function u(){const d=t==null?void 0:t.current;d==null||d.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}}let Nm;const KP="HoverCard",[XP,soe]=dn(KP,[$o]),uy=$o(),[EU,dy]=XP(KP),RU=e=>{const{__scopeHoverCard:t,children:n,open:r,defaultOpen:o,onOpenChange:i,openDelay:s=700,closeDelay:a=300}=e,l=uy(t),u=m.useRef(0),d=m.useRef(0),h=m.useRef(!1),p=m.useRef(!1),[g=!1,b]=On({prop:r,defaultProp:o,onChange:i}),y=m.useCallback(()=>{clearTimeout(d.current),u.current=window.setTimeout(()=>b(!0),s)},[s,b]),x=m.useCallback(()=>{clearTimeout(u.current),!h.current&&!p.current&&(d.current=window.setTimeout(()=>b(!1),a))},[a,b]),_=m.useCallback(()=>b(!1),[b]);return m.useEffect(()=>()=>{clearTimeout(u.current),clearTimeout(d.current)},[]),m.createElement(EU,{scope:t,open:g,onOpenChange:b,onOpen:y,onClose:x,onDismiss:_,hasSelectionRef:h,isPointerDownOnContentRef:p},m.createElement(Ku,l,n))},$U="HoverCardTrigger",PU=m.forwardRef((e,t)=>{const{__scopeHoverCard:n,...r}=e,o=dy($U,n),i=uy(n);return m.createElement(Xu,te({asChild:!0},i),m.createElement(ke.a,te({"data-state":o.open?"open":"closed"},r,{ref:t,onPointerEnter:we(e.onPointerEnter,Rh(o.onOpen)),onPointerLeave:we(e.onPointerLeave,Rh(o.onClose)),onFocus:we(e.onFocus,o.onOpen),onBlur:we(e.onBlur,o.onClose),onTouchStart:we(e.onTouchStart,s=>s.preventDefault())})))}),OU="HoverCardPortal",[aoe,DU]=XP(OU,{forceMount:void 0}),wb="HoverCardContent",MU=m.forwardRef((e,t)=>{const n=DU(wb,e.__scopeHoverCard),{forceMount:r=n.forceMount,...o}=e,i=dy(wb,e.__scopeHoverCard);return m.createElement(Zt,{present:r||i.open},m.createElement(TU,te({"data-state":i.open?"open":"closed"},o,{onPointerEnter:we(e.onPointerEnter,Rh(i.onOpen)),onPointerLeave:we(e.onPointerLeave,Rh(i.onClose)),ref:t})))}),TU=m.forwardRef((e,t)=>{const{__scopeHoverCard:n,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,...a}=e,l=dy(wb,n),u=uy(n),d=m.useRef(null),h=Xe(t,d),[p,g]=m.useState(!1);return m.useEffect(()=>{if(p){const b=document.body;return Nm=b.style.userSelect||b.style.webkitUserSelect,b.style.userSelect="none",b.style.webkitUserSelect="none",()=>{b.style.userSelect=Nm,b.style.webkitUserSelect=Nm}}},[p]),m.useEffect(()=>{if(d.current){const b=()=>{g(!1),l.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var y;((y=document.getSelection())===null||y===void 0?void 0:y.toString())!==""&&(l.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",b),()=>{document.removeEventListener("pointerup",b),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!1}}},[l.isPointerDownOnContentRef,l.hasSelectionRef]),m.useEffect(()=>{d.current&&AU(d.current).forEach(y=>y.setAttribute("tabindex","-1"))}),m.createElement(jl,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:s,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:we(i,b=>{b.preventDefault()}),onDismiss:l.onDismiss},m.createElement(Qu,te({},u,a,{onPointerDown:we(a.onPointerDown,b=>{b.currentTarget.contains(b.target)&&g(!0),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!0}),ref:h,style:{...a.style,userSelect:p?"text":void 0,WebkitUserSelect:p?"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 Rh(e){return t=>t.pointerType==="touch"?void 0:e()}function AU(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 IU=RU,kU=PU,QP=MU,ZP=IU,JP=kU,fy=le.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>I.jsx(QP,{ref:o,align:t,sideOffset:n,className:_e("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}));fy.displayName=QP.displayName;function NU({card:e}){const{setCardInfo:t}=Ki();return I.jsxs(ZP,{openDelay:0,children:[I.jsx(JP,{children:I.jsx(eU,{className:"size-4 text-muted-foreground/40"})}),I.jsx(fy,{align:"start",className:"w-[300px]",onMouseDown:n=>n.stopPropagation(),children:I.jsx(sa,{type:"textarea",text:e.info||"",onSave:n=>t(e.id,n),children:I.jsx("p",{className:"text-sm text-muted-foreground",children:e.info||"Add Info"})})})]})}const hy=le.forwardRef(({className:e,...t},n)=>I.jsx("div",{className:"relative w-full overflow-auto",children:I.jsx("table",{ref:n,className:_e("w-full caption-bottom text-sm",e),...t})}));hy.displayName="Table";const py=le.forwardRef(({className:e,...t},n)=>I.jsx("thead",{ref:n,className:_e("[&_tr]:border-b",e),...t}));py.displayName="TableHeader";const gy=le.forwardRef(({className:e,...t},n)=>I.jsx("tbody",{ref:n,className:_e("[&_tr:last-child]:border-0",e),...t}));gy.displayName="TableBody";const LU=le.forwardRef(({className:e,...t},n)=>I.jsx("tfoot",{ref:n,className:_e("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));LU.displayName="TableFooter";const Xc=le.forwardRef(({className:e,...t},n)=>I.jsx("tr",{ref:n,className:_e("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));Xc.displayName="TableRow";const my=le.forwardRef(({className:e,...t},n)=>I.jsx("th",{ref:n,className:_e("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));my.displayName="TableHead";const $h=le.forwardRef(({className:e,...t},n)=>I.jsx("td",{ref:n,className:_e("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));$h.displayName="TableCell";const FU=le.forwardRef(({className:e,...t},n)=>I.jsx("caption",{ref:n,className:_e("mt-4 text-sm text-muted-foreground",e),...t}));FU.displayName="TableCaption";/**
213
213
  * table-core
214
214
  *
215
215
  * Copyright (c) TanStack
@@ -361,4 +361,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
361
361
  monaco.config({ paths: { vs: '...' } })
362
362
 
363
363
  For more please check the link https://github.com/suren-atoyan/monaco-loader#config
364
- `},fE=Jte(rne)(hM),one={config:tne},ine=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return function(o){return n.reduceRight(function(i,s){return s(i)},o)}};function pM(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],pM(e[n],t[n]))}),lE(lE({},e),t)}var sne={type:"cancelation",msg:"operation is manually canceled"};function uv(e){var t=!1,n=new Promise(function(r,o){e.then(function(i){return t?o(sne):r(i)}),e.catch(o)});return n.cancel=function(){return t=!0},n}var ane=Qte.create({config:Zte,isInitialized:!1,resolve:null,reject:null,monaco:null}),gM=Tte(ane,2),ad=gM[0],jp=gM[1];function lne(e){var t=one.config(e),n=t.monaco,r=Mte(t,["monaco"]);jp(function(o){return{config:pM(o.config,r),monaco:n}})}function cne(){var e=ad(function(t){var n=t.monaco,r=t.isInitialized,o=t.resolve;return{monaco:n,isInitialized:r,resolve:o}});if(!e.isInitialized){if(jp({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),uv(dv);if(window.monaco&&window.monaco.editor)return mM(window.monaco),e.resolve(window.monaco),uv(dv);ine(une,fne)(hne)}return uv(dv)}function une(e){return document.body.appendChild(e)}function dne(e){var t=document.createElement("script");return e&&(t.src=e),t}function fne(e){var t=ad(function(r){var o=r.config,i=r.reject;return{config:o,reject:i}}),n=dne("".concat(t.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=t.reject,n}function hne(){var e=ad(function(n){var r=n.config,o=n.resolve,i=n.reject;return{config:r,resolve:o,reject:i}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(n){mM(n),e.resolve(n)},function(n){e.reject(n)})}function mM(e){ad().monaco||jp({monaco:e})}function pne(){return ad(function(e){var t=e.monaco;return t})}var dv=new Promise(function(e,t){return jp({resolve:e,reject:t})}),vM={config:lne,init:cne,__getMonacoInstance:pne},gne={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},fv=gne,mne={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},vne=mne;function bne({children:e}){return m.createElement("div",{style:vne.container},e)}var yne=bne,xne=yne;function wne({width:e,height:t,isEditorReady:n,loading:r,_ref:o,className:i,wrapperProps:s}){return m.createElement("section",{style:{...fv.wrapper,width:e,height:t},...s},!n&&m.createElement(xne,null,r),m.createElement("div",{ref:o,style:{...fv.fullWidth,...!n&&fv.hide},className:i}))}var _ne=wne,bM=m.memo(_ne);function Sne(e){m.useEffect(e,[])}var yM=Sne;function Cne(e,t,n=!0){let r=m.useRef(!0);m.useEffect(r.current||!n?()=>{r.current=!1}:e,t)}var cr=Cne;function Zc(){}function rl(e,t,n,r){return Ene(e,r)||Rne(e,t,n,r)}function Ene(e,t){return e.editor.getModel(xM(e,t))}function Rne(e,t,n,r){return e.editor.createModel(t,n,r?xM(e,r):void 0)}function xM(e,t){return e.Uri.parse(t)}function $ne({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:o,originalModelPath:i,modifiedModelPath:s,keepCurrentOriginalModel:a=!1,keepCurrentModifiedModel:l=!1,theme:u="light",loading:d="Loading...",options:h={},height:p="100%",width:g="100%",className:b,wrapperProps:y={},beforeMount:x=Zc,onMount:_=Zc}){let[w,C]=m.useState(!1),[R,E]=m.useState(!0),M=m.useRef(null),D=m.useRef(null),A=m.useRef(null),k=m.useRef(_),L=m.useRef(x),W=m.useRef(!1);yM(()=>{let F=vM.init();return F.then(J=>(D.current=J)&&E(!1)).catch(J=>(J==null?void 0:J.type)!=="cancelation"&&console.error("Monaco initialization: error:",J)),()=>M.current?Q():F.cancel()}),cr(()=>{if(M.current&&D.current){let F=M.current.getOriginalEditor(),J=rl(D.current,e||"",r||n||"text",i||"");J!==F.getModel()&&F.setModel(J)}},[i],w),cr(()=>{if(M.current&&D.current){let F=M.current.getModifiedEditor(),J=rl(D.current,t||"",o||n||"text",s||"");J!==F.getModel()&&F.setModel(J)}},[s],w),cr(()=>{let F=M.current.getModifiedEditor();F.getOption(D.current.editor.EditorOption.readOnly)?F.setValue(t||""):t!==F.getValue()&&(F.executeEdits("",[{range:F.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),F.pushUndoStop())},[t],w),cr(()=>{var F,J;(J=(F=M.current)==null?void 0:F.getModel())==null||J.original.setValue(e||"")},[e],w),cr(()=>{let{original:F,modified:J}=M.current.getModel();D.current.editor.setModelLanguage(F,r||n||"text"),D.current.editor.setModelLanguage(J,o||n||"text")},[n,r,o],w),cr(()=>{var F;(F=D.current)==null||F.editor.setTheme(u)},[u],w),cr(()=>{var F;(F=M.current)==null||F.updateOptions(h)},[h],w);let Y=m.useCallback(()=>{var q;if(!D.current)return;L.current(D.current);let F=rl(D.current,e||"",r||n||"text",i||""),J=rl(D.current,t||"",o||n||"text",s||"");(q=M.current)==null||q.setModel({original:F,modified:J})},[n,t,o,e,r,i,s]),ne=m.useCallback(()=>{var F;!W.current&&A.current&&(M.current=D.current.editor.createDiffEditor(A.current,{automaticLayout:!0,...h}),Y(),(F=D.current)==null||F.editor.setTheme(u),C(!0),W.current=!0)},[h,u,Y]);m.useEffect(()=>{w&&k.current(M.current,D.current)},[w]),m.useEffect(()=>{!R&&!w&&ne()},[R,w,ne]);function Q(){var J,q,X,ae;let F=(J=M.current)==null?void 0:J.getModel();a||((q=F==null?void 0:F.original)==null||q.dispose()),l||((X=F==null?void 0:F.modified)==null||X.dispose()),(ae=M.current)==null||ae.dispose()}return m.createElement(bM,{width:g,height:p,isEditorReady:w,loading:d,_ref:A,className:b,wrapperProps:y})}var Pne=$ne;m.memo(Pne);function One(e){let t=m.useRef();return m.useEffect(()=>{t.current=e},[e]),t.current}var Dne=One,zf=new Map;function Mne({defaultValue:e,defaultLanguage:t,defaultPath:n,value:r,language:o,path:i,theme:s="light",line:a,loading:l="Loading...",options:u={},overrideServices:d={},saveViewState:h=!0,keepCurrentModel:p=!1,width:g="100%",height:b="100%",className:y,wrapperProps:x={},beforeMount:_=Zc,onMount:w=Zc,onChange:C,onValidate:R=Zc}){let[E,M]=m.useState(!1),[D,A]=m.useState(!0),k=m.useRef(null),L=m.useRef(null),W=m.useRef(null),Y=m.useRef(w),ne=m.useRef(_),Q=m.useRef(),F=m.useRef(r),J=Dne(i),q=m.useRef(!1),X=m.useRef(!1);yM(()=>{let V=vM.init();return V.then(oe=>(k.current=oe)&&A(!1)).catch(oe=>(oe==null?void 0:oe.type)!=="cancelation"&&console.error("Monaco initialization: error:",oe)),()=>L.current?j():V.cancel()}),cr(()=>{var oe,ce,ue,ge;let V=rl(k.current,e||r||"",t||o||"",i||n||"");V!==((oe=L.current)==null?void 0:oe.getModel())&&(h&&zf.set(J,(ce=L.current)==null?void 0:ce.saveViewState()),(ue=L.current)==null||ue.setModel(V),h&&((ge=L.current)==null||ge.restoreViewState(zf.get(i))))},[i],E),cr(()=>{var V;(V=L.current)==null||V.updateOptions(u)},[u],E),cr(()=>{!L.current||r===void 0||(L.current.getOption(k.current.editor.EditorOption.readOnly)?L.current.setValue(r):r!==L.current.getValue()&&(X.current=!0,L.current.executeEdits("",[{range:L.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),L.current.pushUndoStop(),X.current=!1))},[r],E),cr(()=>{var oe,ce;let V=(oe=L.current)==null?void 0:oe.getModel();V&&o&&((ce=k.current)==null||ce.editor.setModelLanguage(V,o))},[o],E),cr(()=>{var V;a!==void 0&&((V=L.current)==null||V.revealLine(a))},[a],E),cr(()=>{var V;(V=k.current)==null||V.editor.setTheme(s)},[s],E);let ae=m.useCallback(()=>{var V;if(!(!W.current||!k.current)&&!q.current){ne.current(k.current);let oe=i||n,ce=rl(k.current,r||e||"",t||o||"",oe||"");L.current=(V=k.current)==null?void 0:V.editor.create(W.current,{model:ce,automaticLayout:!0,...u},d),h&&L.current.restoreViewState(zf.get(oe)),k.current.editor.setTheme(s),a!==void 0&&L.current.revealLine(a),M(!0),q.current=!0}},[e,t,n,r,o,i,u,d,h,s,a]);m.useEffect(()=>{E&&Y.current(L.current,k.current)},[E]),m.useEffect(()=>{!D&&!E&&ae()},[D,E,ae]),F.current=r,m.useEffect(()=>{var V,oe;E&&C&&((V=Q.current)==null||V.dispose(),Q.current=(oe=L.current)==null?void 0:oe.onDidChangeModelContent(ce=>{X.current||C(L.current.getValue(),ce)}))},[E,C]),m.useEffect(()=>{if(E){let V=k.current.editor.onDidChangeMarkers(oe=>{var ue;let ce=(ue=L.current.getModel())==null?void 0:ue.uri;if(ce&&oe.find(ge=>ge.path===ce.path)){let ge=k.current.editor.getModelMarkers({resource:ce});R==null||R(ge)}});return()=>{V==null||V.dispose()}}return()=>{}},[E,R]);function j(){var V,oe;(V=Q.current)==null||V.dispose(),p?h&&zf.set(i,L.current.saveViewState()):(oe=L.current.getModel())==null||oe.dispose(),L.current.dispose()}return m.createElement(bM,{width:g,height:b,isEditorReady:E,loading:l,_ref:W,className:y,wrapperProps:x})}var Tne=Mne,wM=m.memo(Tne),Ane=wM;const Ine=m.forwardRef((e,t)=>{const{pressed:n,defaultPressed:r=!1,onPressedChange:o,...i}=e,[s=!1,a]=On({prop:n,onChange:o,defaultProp:r});return m.createElement(ke.button,te({type:"button","aria-pressed":s,"data-state":s?"on":"off","data-disabled":e.disabled?"":void 0},i,{ref:t,onClick:we(e.onClick,()=>{e.disabled||a(!s)})}))}),_M=Ine,kne=Py("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-3",sm:"h-9 px-2.5",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),SM=le.forwardRef(({className:e,variant:t,size:n,...r},o)=>I.jsx(_M,{ref:o,className:_e(kne({variant:t,size:n,className:e})),...r}));SM.displayName=_M.displayName;const CM="Switch",[Nne,voe]=dn(CM),[Lne,Fne]=Nne(CM),zne=m.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:l="on",onCheckedChange:u,...d}=e,[h,p]=m.useState(null),g=Xe(t,w=>p(w)),b=m.useRef(!1),y=h?!!h.closest("form"):!0,[x=!1,_]=On({prop:o,defaultProp:i,onChange:u});return m.createElement(Lne,{scope:n,checked:x,disabled:a},m.createElement(ke.button,te({type:"button",role:"switch","aria-checked":x,"aria-required":s,"data-state":EM(x),"data-disabled":a?"":void 0,disabled:a,value:l},d,{ref:g,onClick:we(e.onClick,w=>{_(C=>!C),y&&(b.current=w.isPropagationStopped(),b.current||w.stopPropagation())})})),y&&m.createElement(Hne,{control:h,bubbles:!b.current,name:r,value:l,checked:x,required:s,disabled:a,style:{transform:"translateX(-100%)"}}))}),jne="SwitchThumb",Vne=m.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=Fne(jne,n);return m.createElement(ke.span,te({"data-state":EM(o.checked),"data-disabled":o.disabled?"":void 0},r,{ref:t}))}),Hne=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,i=m.useRef(null),s=Mp(n),a=mp(t);return m.useEffect(()=>{const l=i.current,u=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(u,"checked").set;if(s!==n&&h){const p=new Event("click",{bubbles:r});h.call(l,n),l.dispatchEvent(p)}},[s,n,r]),m.createElement("input",te({type:"checkbox","aria-hidden":!0,defaultChecked:n},o,{tabIndex:-1,ref:i,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function EM(e){return e?"checked":"unchecked"}const Vp=zne,RM=Vne,$M=le.forwardRef(({className:e,...t},n)=>I.jsx(Vp,{className:_e("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:I.jsx(RM,{className:_e("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));$M.displayName=Vp.displayName;const Wne=le.forwardRef(({className:e,...t},n)=>I.jsx(Vp,{className:_e("peer inline-flex h-4 w-8 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:I.jsx(RM,{className:_e("pointer-events-none block h-3 w-3 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Wne.displayName=Vp.displayName;const PM="Collapsible",[Bne,OM]=dn(PM),[Une,ix]=Bne(PM),qne=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:i,onOpenChange:s,...a}=e,[l=!1,u]=On({prop:r,defaultProp:o,onChange:s});return m.createElement(Une,{scope:n,disabled:i,contentId:Yn(),open:l,onOpenToggle:m.useCallback(()=>u(d=>!d),[u])},m.createElement(ke.div,te({"data-state":sx(l),"data-disabled":i?"":void 0},a,{ref:t})))}),Gne="CollapsibleTrigger",Yne=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=ix(Gne,n);return m.createElement(ke.button,te({type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":sx(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled},r,{ref:t,onClick:we(e.onClick,o.onOpenToggle)}))}),DM="CollapsibleContent",Kne=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=ix(DM,e.__scopeCollapsible);return m.createElement(Zt,{present:n||o.open},({present:i})=>m.createElement(Xne,te({},r,{ref:t,present:i})))}),Xne=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...i}=e,s=ix(DM,n),[a,l]=m.useState(r),u=m.useRef(null),d=Xe(t,u),h=m.useRef(0),p=h.current,g=m.useRef(0),b=g.current,y=s.open||a,x=m.useRef(y),_=m.useRef();return m.useEffect(()=>{const w=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(w)},[]),Pn(()=>{const w=u.current;if(w){_.current=_.current||{transitionDuration:w.style.transitionDuration,animationName:w.style.animationName},w.style.transitionDuration="0s",w.style.animationName="none";const C=w.getBoundingClientRect();h.current=C.height,g.current=C.width,x.current||(w.style.transitionDuration=_.current.transitionDuration,w.style.animationName=_.current.animationName),l(r)}},[s.open,r]),m.createElement(ke.div,te({"data-state":sx(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!y},i,{ref:d,style:{"--radix-collapsible-content-height":p?`${p}px`:void 0,"--radix-collapsible-content-width":b?`${b}px`:void 0,...e.style}}),y&&o)});function sx(e){return e?"open":"closed"}const Qne=qne,Zne=Yne,Jne=Kne,Zi="Accordion",ere=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[ax,tre,nre]=Xh(Zi),[Hp,boe]=dn(Zi,[nre,OM]),lx=OM(),MM=m.forwardRef((e,t)=>{const{type:n,...r}=e,o=r,i=r;return m.createElement(ax.Provider,{scope:e.__scopeAccordion},n==="multiple"?m.createElement(sre,te({},i,{ref:t})):m.createElement(ire,te({},o,{ref:t})))});MM.propTypes={type(e){const t=e.value||e.defaultValue;return e.type&&!["single","multiple"].includes(e.type)?new Error("Invalid prop `type` supplied to `Accordion`. Expected one of `single | multiple`."):e.type==="multiple"&&typeof t=="string"?new Error("Invalid prop `type` supplied to `Accordion`. Expected `single` when `defaultValue` or `value` is type `string`."):e.type==="single"&&Array.isArray(t)?new Error("Invalid prop `type` supplied to `Accordion`. Expected `multiple` when `defaultValue` or `value` is type `string[]`."):null}};const[TM,rre]=Hp(Zi),[AM,ore]=Hp(Zi,{collapsible:!1}),ire=m.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},collapsible:i=!1,...s}=e,[a,l]=On({prop:n,defaultProp:r,onChange:o});return m.createElement(TM,{scope:e.__scopeAccordion,value:a?[a]:[],onItemOpen:l,onItemClose:m.useCallback(()=>i&&l(""),[i,l])},m.createElement(AM,{scope:e.__scopeAccordion,collapsible:i},m.createElement(IM,te({},s,{ref:t}))))}),sre=m.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},...i}=e,[s=[],a]=On({prop:n,defaultProp:r,onChange:o}),l=m.useCallback(d=>a((h=[])=>[...h,d]),[a]),u=m.useCallback(d=>a((h=[])=>h.filter(p=>p!==d)),[a]);return m.createElement(TM,{scope:e.__scopeAccordion,value:s,onItemOpen:l,onItemClose:u},m.createElement(AM,{scope:e.__scopeAccordion,collapsible:!0},m.createElement(IM,te({},i,{ref:t}))))}),[are,Wp]=Hp(Zi),IM=m.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:o,orientation:i="vertical",...s}=e,a=m.useRef(null),l=Xe(a,t),u=tre(n),h=ha(o)==="ltr",p=we(e.onKeyDown,g=>{var b;if(!ere.includes(g.key))return;const y=g.target,x=u().filter(k=>{var L;return!((L=k.ref.current)!==null&&L!==void 0&&L.disabled)}),_=x.findIndex(k=>k.ref.current===y),w=x.length;if(_===-1)return;g.preventDefault();let C=_;const R=0,E=w-1,M=()=>{C=_+1,C>E&&(C=R)},D=()=>{C=_-1,C<R&&(C=E)};switch(g.key){case"Home":C=R;break;case"End":C=E;break;case"ArrowRight":i==="horizontal"&&(h?M():D());break;case"ArrowDown":i==="vertical"&&M();break;case"ArrowLeft":i==="horizontal"&&(h?D():M());break;case"ArrowUp":i==="vertical"&&D();break}const A=C%w;(b=x[A].ref.current)===null||b===void 0||b.focus()});return m.createElement(are,{scope:n,disabled:r,direction:o,orientation:i},m.createElement(ax.Slot,{scope:n},m.createElement(ke.div,te({},s,{"data-orientation":i,ref:l,onKeyDown:r?void 0:p}))))}),Wb="AccordionItem",[lre,cx]=Hp(Wb),cre=m.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...o}=e,i=Wp(Wb,n),s=rre(Wb,n),a=lx(n),l=Yn(),u=r&&s.value.includes(r)||!1,d=i.disabled||e.disabled;return m.createElement(lre,{scope:n,open:u,disabled:d,triggerId:l},m.createElement(Qne,te({"data-orientation":i.orientation,"data-state":kM(u)},a,o,{ref:t,disabled:d,open:u,onOpenChange:h=>{h?s.onItemOpen(r):s.onItemClose(r)}})))}),ure="AccordionHeader",dre=m.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=Wp(Zi,n),i=cx(ure,n);return m.createElement(ke.h3,te({"data-orientation":o.orientation,"data-state":kM(i.open),"data-disabled":i.disabled?"":void 0},r,{ref:t}))}),hE="AccordionTrigger",fre=m.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=Wp(Zi,n),i=cx(hE,n),s=ore(hE,n),a=lx(n);return m.createElement(ax.ItemSlot,{scope:n},m.createElement(Zne,te({"aria-disabled":i.open&&!s.collapsible||void 0,"data-orientation":o.orientation,id:i.triggerId},a,r,{ref:t})))}),hre="AccordionContent",pre=m.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=Wp(Zi,n),i=cx(hre,n),s=lx(n);return m.createElement(Jne,te({role:"region","aria-labelledby":i.triggerId,"data-orientation":o.orientation},s,r,{ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}}))});function kM(e){return e?"open":"closed"}const gre=MM,mre=cre,vre=dre,NM=fre,LM=pre,bre=gre,FM=le.forwardRef(({className:e,...t},n)=>I.jsx(mre,{ref:n,className:_e("border-b",e),...t}));FM.displayName="AccordionItem";const zM=le.forwardRef(({className:e,children:t,...n},r)=>I.jsx(vre,{className:"flex",children:I.jsxs(NM,{ref:r,className:_e("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,I.jsx(xp,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));zM.displayName=NM.displayName;const jM=le.forwardRef(({className:e,children:t,...n},r)=>I.jsx(LM,{ref:r,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:I.jsx("div",{className:_e("pb-4 pt-0",e),children:t})}));jM.displayName=LM.displayName;const VM="Radio",[yre,HM]=dn(VM),[xre,wre]=yre(VM),_re=m.forwardRef((e,t)=>{const{__scopeRadio:n,name:r,checked:o=!1,required:i,disabled:s,value:a="on",onCheck:l,...u}=e,[d,h]=m.useState(null),p=Xe(t,y=>h(y)),g=m.useRef(!1),b=d?!!d.closest("form"):!0;return m.createElement(xre,{scope:n,checked:o,disabled:s},m.createElement(ke.button,te({type:"button",role:"radio","aria-checked":o,"data-state":WM(o),"data-disabled":s?"":void 0,disabled:s,value:a},u,{ref:p,onClick:we(e.onClick,y=>{o||l==null||l(),b&&(g.current=y.isPropagationStopped(),g.current||y.stopPropagation())})})),b&&m.createElement(Ere,{control:d,bubbles:!g.current,name:r,value:a,checked:o,required:i,disabled:s,style:{transform:"translateX(-100%)"}}))}),Sre="RadioIndicator",Cre=m.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:r,...o}=e,i=wre(Sre,n);return m.createElement(Zt,{present:r||i.checked},m.createElement(ke.span,te({"data-state":WM(i.checked),"data-disabled":i.disabled?"":void 0},o,{ref:t})))}),Ere=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,i=m.useRef(null),s=Mp(n),a=mp(t);return m.useEffect(()=>{const l=i.current,u=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(u,"checked").set;if(s!==n&&h){const p=new Event("click",{bubbles:r});h.call(l,n),l.dispatchEvent(p)}},[s,n,r]),m.createElement("input",te({type:"radio","aria-hidden":!0,defaultChecked:n},o,{tabIndex:-1,ref:i,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function WM(e){return e?"checked":"unchecked"}const Rre=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],BM="RadioGroup",[$re,yoe]=dn(BM,[zl,HM]),UM=zl(),qM=HM(),[Pre,Ore]=$re(BM),Dre=m.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:r,defaultValue:o,value:i,required:s=!1,disabled:a=!1,orientation:l,dir:u,loop:d=!0,onValueChange:h,...p}=e,g=UM(n),b=ha(u),[y,x]=On({prop:i,defaultProp:o,onChange:h});return m.createElement(Pre,{scope:n,name:r,required:s,disabled:a,value:y,onValueChange:x},m.createElement(o0,te({asChild:!0},g,{orientation:l,dir:b,loop:d}),m.createElement(ke.div,te({role:"radiogroup","aria-required":s,"aria-orientation":l,"data-disabled":a?"":void 0,dir:b},p,{ref:t}))))}),Mre="RadioGroupItem",Tre=m.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:r,...o}=e,i=Ore(Mre,n),s=i.disabled||r,a=UM(n),l=qM(n),u=m.useRef(null),d=Xe(t,u),h=i.value===o.value,p=m.useRef(!1);return m.useEffect(()=>{const g=y=>{Rre.includes(y.key)&&(p.current=!0)},b=()=>p.current=!1;return document.addEventListener("keydown",g),document.addEventListener("keyup",b),()=>{document.removeEventListener("keydown",g),document.removeEventListener("keyup",b)}},[]),m.createElement(i0,te({asChild:!0},a,{focusable:!s,active:h}),m.createElement(_re,te({disabled:s,required:i.required,checked:h},l,o,{name:i.name,ref:d,onCheck:()=>i.onValueChange(o.value),onKeyDown:we(g=>{g.key==="Enter"&&g.preventDefault()}),onFocus:we(o.onFocus,()=>{var g;p.current&&((g=u.current)===null||g===void 0||g.click())})})))}),Are=m.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...r}=e,o=qM(n);return m.createElement(Cre,te({},o,r,{ref:t}))}),GM=Dre,YM=Tre,Ire=Are,KM=le.forwardRef(({className:e,...t},n)=>I.jsx(GM,{className:_e("grid gap-2",e),...t,ref:n}));KM.displayName=GM.displayName;const XM=le.forwardRef(({className:e,...t},n)=>I.jsx(YM,{ref:n,className:_e("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:I.jsx(Ire,{className:"flex items-center justify-center",children:I.jsx(VP,{className:"h-2.5 w-2.5 fill-current text-current"})})}));XM.displayName=YM.displayName;var kre=Object.defineProperty,Nre=(e,t,n)=>t in e?kre(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jf=(e,t,n)=>(Nre(e,typeof t!="symbol"?t+"":t,n),n);const Lre={stringify:e=>e,parse:e=>e},Fre={stringify:e=>`${e}`,parse:e=>parseFloat(e)},zre={stringify:e=>e?"true":"false",parse:e=>/^[ty1-9]/i.test(e)},jre={stringify:e=>e.name,parse:(e,t)=>{const n=(()=>{if(typeof window<"u"&&e in window)return window[e];if(typeof global<"u"&&e in global)return global[e]})();return typeof n=="function"?n.bind(t):void 0}},Vre={stringify:e=>JSON.stringify(e),parse:e=>JSON.parse(e)},hv={string:Lre,number:Fre,boolean:zre,function:jre,json:Vre},pv=Symbol.for("r2wc.render"),Vf=Symbol.for("r2wc.connected"),Ds=Symbol.for("r2wc.context"),Ei=Symbol.for("r2wc.props");function Hre(e,t,n){var r,o,i;t.props||(t.props=e.propTypes?Object.keys(e.propTypes):[]);const s=(Array.isArray(t.props)?t.props.slice():Object.keys(t.props)).filter(h=>h!=="container"),a={},l={},u={};for(const h of s){a[h]=Array.isArray(t.props)?"string":t.props[h];const p=Wre(h);l[h]=p,u[p]=h}class d extends HTMLElement{constructor(){super(),jf(this,r,!0),jf(this,o),jf(this,i,{}),jf(this,"container"),t.shadow?this.container=this.attachShadow({mode:t.shadow}):this.container=this,this[Ei].container=this.container;for(const p of s){const g=l[p],b=this.getAttribute(g),y=a[p],x=hv[y];b&&x!=null&&x.parse&&(this[Ei][p]=x.parse(b,this))}}static get observedAttributes(){return Object.keys(u)}connectedCallback(){this[Vf]=!0,this[pv]()}disconnectedCallback(){this[Vf]=!1,this[Ds]&&n.unmount(this[Ds]),delete this[Ds]}attributeChangedCallback(p,g,b){const y=u[p],x=a[y],_=hv[x];y in a&&_!=null&&_.parse&&(this[Ei][y]=_.parse(b,this),this[pv]())}[(r=Vf,o=Ds,i=Ei,pv)](){this[Vf]&&(this[Ds]?n.update(this[Ds],this[Ei]):this[Ds]=n.mount(this.container,e,this[Ei]))}}for(const h of s){const p=l[h],g=a[h];Object.defineProperty(d.prototype,h,{enumerable:!0,configurable:!0,get(){return this[Ei][h]},set(b){this[Ei][h]=b;const y=hv[g];if(y!=null&&y.stringify){const x=y.stringify(b);this.getAttribute(p)!==x&&this.setAttribute(p,x)}}})}return d}function Wre(e=""){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Bre(e,t,n){const r=Ev(e),o=m.createElement(t,n);return r.render(o),{root:r,ReactComponent:t}}function Ure({root:e,ReactComponent:t},n){const r=m.createElement(t,n);e.render(r)}function qre({root:e}){e.unmount()}function Gre(e,t={}){return Hre(e,t,{mount:Bre,update:Ure,unmount:qre})}const Yre={id:"string",version:"string",authToken:"json",currentTheme:"string",customCards:"json",style:"json",onChartElementClicked:"function",onEvent:"function",onSave:"function",LoadingComponent:"function",ErrorComponent:"function"},Kre=Gre(N2,{props:Yre});exports.$57acba87d6e25586$export$ccf8d8d7bbf3c2cc=ND;exports.$a093c7e1ec25a057$export$8c610744efcf8a1d=AP;exports.Accordion=bre;exports.AccordionContent=jM;exports.AccordionItem=FM;exports.AccordionTrigger=zM;exports.BOOLEAN_DATA_TYPES=Kb;exports.Button=ea;exports.Calendar=zP;exports.Card=e0;exports.CardContent=Yh;exports.CardDescription=t0;exports.CardFooter=n0;exports.CardHeader=Gh;exports.CardTitle=Vu;exports.ChartJsVisual=fP;exports.Check=Zu;exports.CheckIcon=hP;exports.Checkbox=DD;exports.ChevronDown=xp;exports.ClipboardCopyIcon=oW;exports.Cross2Icon=pP;exports.DATE_DATA_TYPES=Fu;exports.Dashboard=N2;exports.DashboardPanel=oR;exports.DashboardTabs=I2;exports.DashboardWC=Kre;exports.Dialog=Lee;exports.DialogContent=wD;exports.DialogDescription=ED;exports.DialogFooter=SD;exports.DialogHeader=_D;exports.DialogTitle=CD;exports.DialogTrigger=Fee;exports.DropdownMenu=aee;exports.DropdownMenuContent=iD;exports.DropdownMenuLabel=aD;exports.DropdownMenuRadioGroup=cee;exports.DropdownMenuRadioItem=sD;exports.DropdownMenuSeparator=lD;exports.DropdownMenuTrigger=lee;exports.Editable=sa;exports.EditorAside=TD;exports.EditorMain=AD;exports.EditorPanel=MD;exports.Ft=Ane;exports.HoverCard=ZP;exports.HoverCardContent=fy;exports.HoverCardTrigger=JP;exports.InfoCircledIcon=dW;exports.Input=RD;exports.KPICard=BP;exports.Label=Xo;exports.LoaderCircle=ly;exports.NUMBER_DATA_TYPES=Cl;exports.PYTHON_DEFAULT_CODE=BE;exports.Panel=QD;exports.PanelGroup=dM;exports.PanelResizeHandle=fM;exports.PaperPlaneIcon=hW;exports.PlayIcon=gW;exports.Popover=Hy;exports.PopoverContent=Dp;exports.PopoverTrigger=Wy;exports.RadioGroup=KM;exports.RadioGroupItem=XM;exports.ScrollArea=qD;exports.ScrollBar=rx;exports.Select=P2;exports.SelectContent=Ky;exports.SelectGroup=VZ;exports.SelectItem=Qc;exports.SelectLabel=T2;exports.SelectSeparator=A2;exports.SelectTrigger=Yy;exports.SelectValue=O2;exports.SemaphorContextProvider=GP;exports.SemaphorQueryClient=UP;exports.Separator=Uy;exports.Settings=HP;exports.SliderIcon=vW;exports.Switch=$M;exports.TEXT_DATA_TYPES=Uh;exports.Table=hy;exports.TableBody=gy;exports.TableCell=$h;exports.TableHead=my;exports.TableHeader=py;exports.TableRow=Xc;exports.TableVisual=hO;exports.Tabs=mR;exports.TabsContent=a0;exports.TabsList=vR;exports.TabsTrigger=bR;exports.Textarea=By;exports.Toggle=SM;exports.Tooltip=NP;exports.TooltipContent=ay;exports.TooltipTrigger=LP;exports.TriangleDownIcon=K0;exports.TriangleUpIcon=X0;exports.UXProvider=k2;exports.X=WP;exports._=ia;exports.cleanCard=cD;exports.cn=_e;exports.commonjsGlobal=ks;exports.copyToClipboard=WN;exports.createChartConfig=YP;exports.createLucideIcon=br;exports.createSqlGenConfig=x6;exports.de=wM;exports.flexRender=$b;exports.fmt=Xb;exports.getBookmarkKey=uD;exports.getCanvasBackgroundColor=oh;exports.getColumnDataType=w6;exports.getContrastColor=ih;exports.getCoreRowModel=cO;exports.getDashbaordStateWithoutData=pee;exports.getDefaultExportFromCjs=Lu;exports.getDefaultFilterSql=rY;exports.getFilterValueType=sh;exports.getKeys=Nr;exports.getPaginationRowModel=dO;exports.getQualifiedTableName=UE;exports.getRequest=HN;exports.getSortedRowModel=uO;exports.getSql=y6;exports.isColumnInSqlGen=_6;exports.jsxRuntimeExports=I;exports.pivotData=Q0;exports.postRequest=jh;exports.resolveBaseQuery=DE;exports.resolveDataType=nu;exports.titleCase=UN;exports.useCard=SU;exports.useDashboardActions=Ki;exports.useDashboardCard=cy;exports.useDashboardStore=Ce;exports.useEditorActions=gP;exports.useEditorStore=Ar;exports.useQuery=ju;exports.useReactTable=fO;exports.useSemaphorContext=Wl;exports.useTheme=nR;exports.v4=fu;
364
+ `},fE=Jte(rne)(hM),one={config:tne},ine=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return function(o){return n.reduceRight(function(i,s){return s(i)},o)}};function pM(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],pM(e[n],t[n]))}),lE(lE({},e),t)}var sne={type:"cancelation",msg:"operation is manually canceled"};function uv(e){var t=!1,n=new Promise(function(r,o){e.then(function(i){return t?o(sne):r(i)}),e.catch(o)});return n.cancel=function(){return t=!0},n}var ane=Qte.create({config:Zte,isInitialized:!1,resolve:null,reject:null,monaco:null}),gM=Tte(ane,2),ad=gM[0],jp=gM[1];function lne(e){var t=one.config(e),n=t.monaco,r=Mte(t,["monaco"]);jp(function(o){return{config:pM(o.config,r),monaco:n}})}function cne(){var e=ad(function(t){var n=t.monaco,r=t.isInitialized,o=t.resolve;return{monaco:n,isInitialized:r,resolve:o}});if(!e.isInitialized){if(jp({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),uv(dv);if(window.monaco&&window.monaco.editor)return mM(window.monaco),e.resolve(window.monaco),uv(dv);ine(une,fne)(hne)}return uv(dv)}function une(e){return document.body.appendChild(e)}function dne(e){var t=document.createElement("script");return e&&(t.src=e),t}function fne(e){var t=ad(function(r){var o=r.config,i=r.reject;return{config:o,reject:i}}),n=dne("".concat(t.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=t.reject,n}function hne(){var e=ad(function(n){var r=n.config,o=n.resolve,i=n.reject;return{config:r,resolve:o,reject:i}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(n){mM(n),e.resolve(n)},function(n){e.reject(n)})}function mM(e){ad().monaco||jp({monaco:e})}function pne(){return ad(function(e){var t=e.monaco;return t})}var dv=new Promise(function(e,t){return jp({resolve:e,reject:t})}),vM={config:lne,init:cne,__getMonacoInstance:pne},gne={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},fv=gne,mne={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},vne=mne;function bne({children:e}){return m.createElement("div",{style:vne.container},e)}var yne=bne,xne=yne;function wne({width:e,height:t,isEditorReady:n,loading:r,_ref:o,className:i,wrapperProps:s}){return m.createElement("section",{style:{...fv.wrapper,width:e,height:t},...s},!n&&m.createElement(xne,null,r),m.createElement("div",{ref:o,style:{...fv.fullWidth,...!n&&fv.hide},className:i}))}var _ne=wne,bM=m.memo(_ne);function Sne(e){m.useEffect(e,[])}var yM=Sne;function Cne(e,t,n=!0){let r=m.useRef(!0);m.useEffect(r.current||!n?()=>{r.current=!1}:e,t)}var cr=Cne;function Zc(){}function rl(e,t,n,r){return Ene(e,r)||Rne(e,t,n,r)}function Ene(e,t){return e.editor.getModel(xM(e,t))}function Rne(e,t,n,r){return e.editor.createModel(t,n,r?xM(e,r):void 0)}function xM(e,t){return e.Uri.parse(t)}function $ne({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:o,originalModelPath:i,modifiedModelPath:s,keepCurrentOriginalModel:a=!1,keepCurrentModifiedModel:l=!1,theme:u="light",loading:d="Loading...",options:h={},height:p="100%",width:g="100%",className:b,wrapperProps:y={},beforeMount:x=Zc,onMount:_=Zc}){let[w,C]=m.useState(!1),[R,E]=m.useState(!0),M=m.useRef(null),D=m.useRef(null),A=m.useRef(null),k=m.useRef(_),L=m.useRef(x),W=m.useRef(!1);yM(()=>{let F=vM.init();return F.then(J=>(D.current=J)&&E(!1)).catch(J=>(J==null?void 0:J.type)!=="cancelation"&&console.error("Monaco initialization: error:",J)),()=>M.current?Q():F.cancel()}),cr(()=>{if(M.current&&D.current){let F=M.current.getOriginalEditor(),J=rl(D.current,e||"",r||n||"text",i||"");J!==F.getModel()&&F.setModel(J)}},[i],w),cr(()=>{if(M.current&&D.current){let F=M.current.getModifiedEditor(),J=rl(D.current,t||"",o||n||"text",s||"");J!==F.getModel()&&F.setModel(J)}},[s],w),cr(()=>{let F=M.current.getModifiedEditor();F.getOption(D.current.editor.EditorOption.readOnly)?F.setValue(t||""):t!==F.getValue()&&(F.executeEdits("",[{range:F.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),F.pushUndoStop())},[t],w),cr(()=>{var F,J;(J=(F=M.current)==null?void 0:F.getModel())==null||J.original.setValue(e||"")},[e],w),cr(()=>{let{original:F,modified:J}=M.current.getModel();D.current.editor.setModelLanguage(F,r||n||"text"),D.current.editor.setModelLanguage(J,o||n||"text")},[n,r,o],w),cr(()=>{var F;(F=D.current)==null||F.editor.setTheme(u)},[u],w),cr(()=>{var F;(F=M.current)==null||F.updateOptions(h)},[h],w);let Y=m.useCallback(()=>{var q;if(!D.current)return;L.current(D.current);let F=rl(D.current,e||"",r||n||"text",i||""),J=rl(D.current,t||"",o||n||"text",s||"");(q=M.current)==null||q.setModel({original:F,modified:J})},[n,t,o,e,r,i,s]),ne=m.useCallback(()=>{var F;!W.current&&A.current&&(M.current=D.current.editor.createDiffEditor(A.current,{automaticLayout:!0,...h}),Y(),(F=D.current)==null||F.editor.setTheme(u),C(!0),W.current=!0)},[h,u,Y]);m.useEffect(()=>{w&&k.current(M.current,D.current)},[w]),m.useEffect(()=>{!R&&!w&&ne()},[R,w,ne]);function Q(){var J,q,X,ae;let F=(J=M.current)==null?void 0:J.getModel();a||((q=F==null?void 0:F.original)==null||q.dispose()),l||((X=F==null?void 0:F.modified)==null||X.dispose()),(ae=M.current)==null||ae.dispose()}return m.createElement(bM,{width:g,height:p,isEditorReady:w,loading:d,_ref:A,className:b,wrapperProps:y})}var Pne=$ne;m.memo(Pne);function One(e){let t=m.useRef();return m.useEffect(()=>{t.current=e},[e]),t.current}var Dne=One,zf=new Map;function Mne({defaultValue:e,defaultLanguage:t,defaultPath:n,value:r,language:o,path:i,theme:s="light",line:a,loading:l="Loading...",options:u={},overrideServices:d={},saveViewState:h=!0,keepCurrentModel:p=!1,width:g="100%",height:b="100%",className:y,wrapperProps:x={},beforeMount:_=Zc,onMount:w=Zc,onChange:C,onValidate:R=Zc}){let[E,M]=m.useState(!1),[D,A]=m.useState(!0),k=m.useRef(null),L=m.useRef(null),W=m.useRef(null),Y=m.useRef(w),ne=m.useRef(_),Q=m.useRef(),F=m.useRef(r),J=Dne(i),q=m.useRef(!1),X=m.useRef(!1);yM(()=>{let V=vM.init();return V.then(oe=>(k.current=oe)&&A(!1)).catch(oe=>(oe==null?void 0:oe.type)!=="cancelation"&&console.error("Monaco initialization: error:",oe)),()=>L.current?j():V.cancel()}),cr(()=>{var oe,ce,ue,ge;let V=rl(k.current,e||r||"",t||o||"",i||n||"");V!==((oe=L.current)==null?void 0:oe.getModel())&&(h&&zf.set(J,(ce=L.current)==null?void 0:ce.saveViewState()),(ue=L.current)==null||ue.setModel(V),h&&((ge=L.current)==null||ge.restoreViewState(zf.get(i))))},[i],E),cr(()=>{var V;(V=L.current)==null||V.updateOptions(u)},[u],E),cr(()=>{!L.current||r===void 0||(L.current.getOption(k.current.editor.EditorOption.readOnly)?L.current.setValue(r):r!==L.current.getValue()&&(X.current=!0,L.current.executeEdits("",[{range:L.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),L.current.pushUndoStop(),X.current=!1))},[r],E),cr(()=>{var oe,ce;let V=(oe=L.current)==null?void 0:oe.getModel();V&&o&&((ce=k.current)==null||ce.editor.setModelLanguage(V,o))},[o],E),cr(()=>{var V;a!==void 0&&((V=L.current)==null||V.revealLine(a))},[a],E),cr(()=>{var V;(V=k.current)==null||V.editor.setTheme(s)},[s],E);let ae=m.useCallback(()=>{var V;if(!(!W.current||!k.current)&&!q.current){ne.current(k.current);let oe=i||n,ce=rl(k.current,r||e||"",t||o||"",oe||"");L.current=(V=k.current)==null?void 0:V.editor.create(W.current,{model:ce,automaticLayout:!0,...u},d),h&&L.current.restoreViewState(zf.get(oe)),k.current.editor.setTheme(s),a!==void 0&&L.current.revealLine(a),M(!0),q.current=!0}},[e,t,n,r,o,i,u,d,h,s,a]);m.useEffect(()=>{E&&Y.current(L.current,k.current)},[E]),m.useEffect(()=>{!D&&!E&&ae()},[D,E,ae]),F.current=r,m.useEffect(()=>{var V,oe;E&&C&&((V=Q.current)==null||V.dispose(),Q.current=(oe=L.current)==null?void 0:oe.onDidChangeModelContent(ce=>{X.current||C(L.current.getValue(),ce)}))},[E,C]),m.useEffect(()=>{if(E){let V=k.current.editor.onDidChangeMarkers(oe=>{var ue;let ce=(ue=L.current.getModel())==null?void 0:ue.uri;if(ce&&oe.find(ge=>ge.path===ce.path)){let ge=k.current.editor.getModelMarkers({resource:ce});R==null||R(ge)}});return()=>{V==null||V.dispose()}}return()=>{}},[E,R]);function j(){var V,oe;(V=Q.current)==null||V.dispose(),p?h&&zf.set(i,L.current.saveViewState()):(oe=L.current.getModel())==null||oe.dispose(),L.current.dispose()}return m.createElement(bM,{width:g,height:b,isEditorReady:E,loading:l,_ref:W,className:y,wrapperProps:x})}var Tne=Mne,wM=m.memo(Tne),Ane=wM;const Ine=m.forwardRef((e,t)=>{const{pressed:n,defaultPressed:r=!1,onPressedChange:o,...i}=e,[s=!1,a]=On({prop:n,onChange:o,defaultProp:r});return m.createElement(ke.button,te({type:"button","aria-pressed":s,"data-state":s?"on":"off","data-disabled":e.disabled?"":void 0},i,{ref:t,onClick:we(e.onClick,()=>{e.disabled||a(!s)})}))}),_M=Ine,kne=Py("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-3",sm:"h-9 px-2.5",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),SM=le.forwardRef(({className:e,variant:t,size:n,...r},o)=>I.jsx(_M,{ref:o,className:_e(kne({variant:t,size:n,className:e})),...r}));SM.displayName=_M.displayName;const CM="Switch",[Nne,voe]=dn(CM),[Lne,Fne]=Nne(CM),zne=m.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:l="on",onCheckedChange:u,...d}=e,[h,p]=m.useState(null),g=Xe(t,w=>p(w)),b=m.useRef(!1),y=h?!!h.closest("form"):!0,[x=!1,_]=On({prop:o,defaultProp:i,onChange:u});return m.createElement(Lne,{scope:n,checked:x,disabled:a},m.createElement(ke.button,te({type:"button",role:"switch","aria-checked":x,"aria-required":s,"data-state":EM(x),"data-disabled":a?"":void 0,disabled:a,value:l},d,{ref:g,onClick:we(e.onClick,w=>{_(C=>!C),y&&(b.current=w.isPropagationStopped(),b.current||w.stopPropagation())})})),y&&m.createElement(Hne,{control:h,bubbles:!b.current,name:r,value:l,checked:x,required:s,disabled:a,style:{transform:"translateX(-100%)"}}))}),jne="SwitchThumb",Vne=m.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=Fne(jne,n);return m.createElement(ke.span,te({"data-state":EM(o.checked),"data-disabled":o.disabled?"":void 0},r,{ref:t}))}),Hne=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,i=m.useRef(null),s=Mp(n),a=mp(t);return m.useEffect(()=>{const l=i.current,u=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(u,"checked").set;if(s!==n&&h){const p=new Event("click",{bubbles:r});h.call(l,n),l.dispatchEvent(p)}},[s,n,r]),m.createElement("input",te({type:"checkbox","aria-hidden":!0,defaultChecked:n},o,{tabIndex:-1,ref:i,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function EM(e){return e?"checked":"unchecked"}const Vp=zne,RM=Vne,$M=le.forwardRef(({className:e,...t},n)=>I.jsx(Vp,{className:_e("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:I.jsx(RM,{className:_e("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));$M.displayName=Vp.displayName;const Wne=le.forwardRef(({className:e,...t},n)=>I.jsx(Vp,{className:_e("peer inline-flex h-4 w-8 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:I.jsx(RM,{className:_e("pointer-events-none block h-3 w-3 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Wne.displayName=Vp.displayName;const PM="Collapsible",[Bne,OM]=dn(PM),[Une,ix]=Bne(PM),qne=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:i,onOpenChange:s,...a}=e,[l=!1,u]=On({prop:r,defaultProp:o,onChange:s});return m.createElement(Une,{scope:n,disabled:i,contentId:Yn(),open:l,onOpenToggle:m.useCallback(()=>u(d=>!d),[u])},m.createElement(ke.div,te({"data-state":sx(l),"data-disabled":i?"":void 0},a,{ref:t})))}),Gne="CollapsibleTrigger",Yne=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=ix(Gne,n);return m.createElement(ke.button,te({type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":sx(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled},r,{ref:t,onClick:we(e.onClick,o.onOpenToggle)}))}),DM="CollapsibleContent",Kne=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=ix(DM,e.__scopeCollapsible);return m.createElement(Zt,{present:n||o.open},({present:i})=>m.createElement(Xne,te({},r,{ref:t,present:i})))}),Xne=m.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...i}=e,s=ix(DM,n),[a,l]=m.useState(r),u=m.useRef(null),d=Xe(t,u),h=m.useRef(0),p=h.current,g=m.useRef(0),b=g.current,y=s.open||a,x=m.useRef(y),_=m.useRef();return m.useEffect(()=>{const w=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(w)},[]),Pn(()=>{const w=u.current;if(w){_.current=_.current||{transitionDuration:w.style.transitionDuration,animationName:w.style.animationName},w.style.transitionDuration="0s",w.style.animationName="none";const C=w.getBoundingClientRect();h.current=C.height,g.current=C.width,x.current||(w.style.transitionDuration=_.current.transitionDuration,w.style.animationName=_.current.animationName),l(r)}},[s.open,r]),m.createElement(ke.div,te({"data-state":sx(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!y},i,{ref:d,style:{"--radix-collapsible-content-height":p?`${p}px`:void 0,"--radix-collapsible-content-width":b?`${b}px`:void 0,...e.style}}),y&&o)});function sx(e){return e?"open":"closed"}const Qne=qne,Zne=Yne,Jne=Kne,Zi="Accordion",ere=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[ax,tre,nre]=Xh(Zi),[Hp,boe]=dn(Zi,[nre,OM]),lx=OM(),MM=m.forwardRef((e,t)=>{const{type:n,...r}=e,o=r,i=r;return m.createElement(ax.Provider,{scope:e.__scopeAccordion},n==="multiple"?m.createElement(sre,te({},i,{ref:t})):m.createElement(ire,te({},o,{ref:t})))});MM.propTypes={type(e){const t=e.value||e.defaultValue;return e.type&&!["single","multiple"].includes(e.type)?new Error("Invalid prop `type` supplied to `Accordion`. Expected one of `single | multiple`."):e.type==="multiple"&&typeof t=="string"?new Error("Invalid prop `type` supplied to `Accordion`. Expected `single` when `defaultValue` or `value` is type `string`."):e.type==="single"&&Array.isArray(t)?new Error("Invalid prop `type` supplied to `Accordion`. Expected `multiple` when `defaultValue` or `value` is type `string[]`."):null}};const[TM,rre]=Hp(Zi),[AM,ore]=Hp(Zi,{collapsible:!1}),ire=m.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},collapsible:i=!1,...s}=e,[a,l]=On({prop:n,defaultProp:r,onChange:o});return m.createElement(TM,{scope:e.__scopeAccordion,value:a?[a]:[],onItemOpen:l,onItemClose:m.useCallback(()=>i&&l(""),[i,l])},m.createElement(AM,{scope:e.__scopeAccordion,collapsible:i},m.createElement(IM,te({},s,{ref:t}))))}),sre=m.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:o=()=>{},...i}=e,[s=[],a]=On({prop:n,defaultProp:r,onChange:o}),l=m.useCallback(d=>a((h=[])=>[...h,d]),[a]),u=m.useCallback(d=>a((h=[])=>h.filter(p=>p!==d)),[a]);return m.createElement(TM,{scope:e.__scopeAccordion,value:s,onItemOpen:l,onItemClose:u},m.createElement(AM,{scope:e.__scopeAccordion,collapsible:!0},m.createElement(IM,te({},i,{ref:t}))))}),[are,Wp]=Hp(Zi),IM=m.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:o,orientation:i="vertical",...s}=e,a=m.useRef(null),l=Xe(a,t),u=tre(n),h=ha(o)==="ltr",p=we(e.onKeyDown,g=>{var b;if(!ere.includes(g.key))return;const y=g.target,x=u().filter(k=>{var L;return!((L=k.ref.current)!==null&&L!==void 0&&L.disabled)}),_=x.findIndex(k=>k.ref.current===y),w=x.length;if(_===-1)return;g.preventDefault();let C=_;const R=0,E=w-1,M=()=>{C=_+1,C>E&&(C=R)},D=()=>{C=_-1,C<R&&(C=E)};switch(g.key){case"Home":C=R;break;case"End":C=E;break;case"ArrowRight":i==="horizontal"&&(h?M():D());break;case"ArrowDown":i==="vertical"&&M();break;case"ArrowLeft":i==="horizontal"&&(h?D():M());break;case"ArrowUp":i==="vertical"&&D();break}const A=C%w;(b=x[A].ref.current)===null||b===void 0||b.focus()});return m.createElement(are,{scope:n,disabled:r,direction:o,orientation:i},m.createElement(ax.Slot,{scope:n},m.createElement(ke.div,te({},s,{"data-orientation":i,ref:l,onKeyDown:r?void 0:p}))))}),Wb="AccordionItem",[lre,cx]=Hp(Wb),cre=m.forwardRef((e,t)=>{const{__scopeAccordion:n,value:r,...o}=e,i=Wp(Wb,n),s=rre(Wb,n),a=lx(n),l=Yn(),u=r&&s.value.includes(r)||!1,d=i.disabled||e.disabled;return m.createElement(lre,{scope:n,open:u,disabled:d,triggerId:l},m.createElement(Qne,te({"data-orientation":i.orientation,"data-state":kM(u)},a,o,{ref:t,disabled:d,open:u,onOpenChange:h=>{h?s.onItemOpen(r):s.onItemClose(r)}})))}),ure="AccordionHeader",dre=m.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=Wp(Zi,n),i=cx(ure,n);return m.createElement(ke.h3,te({"data-orientation":o.orientation,"data-state":kM(i.open),"data-disabled":i.disabled?"":void 0},r,{ref:t}))}),hE="AccordionTrigger",fre=m.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=Wp(Zi,n),i=cx(hE,n),s=ore(hE,n),a=lx(n);return m.createElement(ax.ItemSlot,{scope:n},m.createElement(Zne,te({"aria-disabled":i.open&&!s.collapsible||void 0,"data-orientation":o.orientation,id:i.triggerId},a,r,{ref:t})))}),hre="AccordionContent",pre=m.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,o=Wp(Zi,n),i=cx(hre,n),s=lx(n);return m.createElement(Jne,te({role:"region","aria-labelledby":i.triggerId,"data-orientation":o.orientation},s,r,{ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}}))});function kM(e){return e?"open":"closed"}const gre=MM,mre=cre,vre=dre,NM=fre,LM=pre,bre=gre,FM=le.forwardRef(({className:e,...t},n)=>I.jsx(mre,{ref:n,className:_e("border-b",e),...t}));FM.displayName="AccordionItem";const zM=le.forwardRef(({className:e,children:t,...n},r)=>I.jsx(vre,{className:"flex",children:I.jsxs(NM,{ref:r,className:_e("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,I.jsx(xp,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));zM.displayName=NM.displayName;const jM=le.forwardRef(({className:e,children:t,...n},r)=>I.jsx(LM,{ref:r,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:I.jsx("div",{className:_e("pb-4 pt-0",e),children:t})}));jM.displayName=LM.displayName;const VM="Radio",[yre,HM]=dn(VM),[xre,wre]=yre(VM),_re=m.forwardRef((e,t)=>{const{__scopeRadio:n,name:r,checked:o=!1,required:i,disabled:s,value:a="on",onCheck:l,...u}=e,[d,h]=m.useState(null),p=Xe(t,y=>h(y)),g=m.useRef(!1),b=d?!!d.closest("form"):!0;return m.createElement(xre,{scope:n,checked:o,disabled:s},m.createElement(ke.button,te({type:"button",role:"radio","aria-checked":o,"data-state":WM(o),"data-disabled":s?"":void 0,disabled:s,value:a},u,{ref:p,onClick:we(e.onClick,y=>{o||l==null||l(),b&&(g.current=y.isPropagationStopped(),g.current||y.stopPropagation())})})),b&&m.createElement(Ere,{control:d,bubbles:!g.current,name:r,value:a,checked:o,required:i,disabled:s,style:{transform:"translateX(-100%)"}}))}),Sre="RadioIndicator",Cre=m.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:r,...o}=e,i=wre(Sre,n);return m.createElement(Zt,{present:r||i.checked},m.createElement(ke.span,te({"data-state":WM(i.checked),"data-disabled":i.disabled?"":void 0},o,{ref:t})))}),Ere=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,i=m.useRef(null),s=Mp(n),a=mp(t);return m.useEffect(()=>{const l=i.current,u=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(u,"checked").set;if(s!==n&&h){const p=new Event("click",{bubbles:r});h.call(l,n),l.dispatchEvent(p)}},[s,n,r]),m.createElement("input",te({type:"radio","aria-hidden":!0,defaultChecked:n},o,{tabIndex:-1,ref:i,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function WM(e){return e?"checked":"unchecked"}const Rre=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],BM="RadioGroup",[$re,yoe]=dn(BM,[zl,HM]),UM=zl(),qM=HM(),[Pre,Ore]=$re(BM),Dre=m.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:r,defaultValue:o,value:i,required:s=!1,disabled:a=!1,orientation:l,dir:u,loop:d=!0,onValueChange:h,...p}=e,g=UM(n),b=ha(u),[y,x]=On({prop:i,defaultProp:o,onChange:h});return m.createElement(Pre,{scope:n,name:r,required:s,disabled:a,value:y,onValueChange:x},m.createElement(o0,te({asChild:!0},g,{orientation:l,dir:b,loop:d}),m.createElement(ke.div,te({role:"radiogroup","aria-required":s,"aria-orientation":l,"data-disabled":a?"":void 0,dir:b},p,{ref:t}))))}),Mre="RadioGroupItem",Tre=m.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:r,...o}=e,i=Ore(Mre,n),s=i.disabled||r,a=UM(n),l=qM(n),u=m.useRef(null),d=Xe(t,u),h=i.value===o.value,p=m.useRef(!1);return m.useEffect(()=>{const g=y=>{Rre.includes(y.key)&&(p.current=!0)},b=()=>p.current=!1;return document.addEventListener("keydown",g),document.addEventListener("keyup",b),()=>{document.removeEventListener("keydown",g),document.removeEventListener("keyup",b)}},[]),m.createElement(i0,te({asChild:!0},a,{focusable:!s,active:h}),m.createElement(_re,te({disabled:s,required:i.required,checked:h},l,o,{name:i.name,ref:d,onCheck:()=>i.onValueChange(o.value),onKeyDown:we(g=>{g.key==="Enter"&&g.preventDefault()}),onFocus:we(o.onFocus,()=>{var g;p.current&&((g=u.current)===null||g===void 0||g.click())})})))}),Are=m.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...r}=e,o=qM(n);return m.createElement(Cre,te({},o,r,{ref:t}))}),GM=Dre,YM=Tre,Ire=Are,KM=le.forwardRef(({className:e,...t},n)=>I.jsx(GM,{className:_e("grid gap-2",e),...t,ref:n}));KM.displayName=GM.displayName;const XM=le.forwardRef(({className:e,...t},n)=>I.jsx(YM,{ref:n,className:_e("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:I.jsx(Ire,{className:"flex items-center justify-center",children:I.jsx(VP,{className:"h-2.5 w-2.5 fill-current text-current"})})}));XM.displayName=YM.displayName;var kre=Object.defineProperty,Nre=(e,t,n)=>t in e?kre(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jf=(e,t,n)=>(Nre(e,typeof t!="symbol"?t+"":t,n),n);const Lre={stringify:e=>e,parse:e=>e},Fre={stringify:e=>`${e}`,parse:e=>parseFloat(e)},zre={stringify:e=>e?"true":"false",parse:e=>/^[ty1-9]/i.test(e)},jre={stringify:e=>e.name,parse:(e,t)=>{const n=(()=>{if(typeof window<"u"&&e in window)return window[e];if(typeof global<"u"&&e in global)return global[e]})();return typeof n=="function"?n.bind(t):void 0}},Vre={stringify:e=>JSON.stringify(e),parse:e=>JSON.parse(e)},hv={string:Lre,number:Fre,boolean:zre,function:jre,json:Vre},pv=Symbol.for("r2wc.render"),Vf=Symbol.for("r2wc.connected"),Ds=Symbol.for("r2wc.context"),Ei=Symbol.for("r2wc.props");function Hre(e,t,n){var r,o,i;t.props||(t.props=e.propTypes?Object.keys(e.propTypes):[]);const s=(Array.isArray(t.props)?t.props.slice():Object.keys(t.props)).filter(h=>h!=="container"),a={},l={},u={};for(const h of s){a[h]=Array.isArray(t.props)?"string":t.props[h];const p=Wre(h);l[h]=p,u[p]=h}class d extends HTMLElement{constructor(){super(),jf(this,r,!0),jf(this,o),jf(this,i,{}),jf(this,"container"),t.shadow?this.container=this.attachShadow({mode:t.shadow}):this.container=this,this[Ei].container=this.container;for(const p of s){const g=l[p],b=this.getAttribute(g),y=a[p],x=hv[y];b&&x!=null&&x.parse&&(this[Ei][p]=x.parse(b,this))}}static get observedAttributes(){return Object.keys(u)}connectedCallback(){this[Vf]=!0,this[pv]()}disconnectedCallback(){this[Vf]=!1,this[Ds]&&n.unmount(this[Ds]),delete this[Ds]}attributeChangedCallback(p,g,b){const y=u[p],x=a[y],_=hv[x];y in a&&_!=null&&_.parse&&(this[Ei][y]=_.parse(b,this),this[pv]())}[(r=Vf,o=Ds,i=Ei,pv)](){this[Vf]&&(this[Ds]?n.update(this[Ds],this[Ei]):this[Ds]=n.mount(this.container,e,this[Ei]))}}for(const h of s){const p=l[h],g=a[h];Object.defineProperty(d.prototype,h,{enumerable:!0,configurable:!0,get(){return this[Ei][h]},set(b){this[Ei][h]=b;const y=hv[g];if(y!=null&&y.stringify){const x=y.stringify(b);this.getAttribute(p)!==x&&this.setAttribute(p,x)}}})}return d}function Wre(e=""){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Bre(e,t,n){const r=Ev(e),o=m.createElement(t,n);return r.render(o),{root:r,ReactComponent:t}}function Ure({root:e,ReactComponent:t},n){const r=m.createElement(t,n);e.render(r)}function qre({root:e}){e.unmount()}function Gre(e,t={}){return Hre(e,t,{mount:Bre,update:Ure,unmount:qre})}const Yre={id:"string",version:"string",authToken:"json",currentTheme:"string",customCards:"json",customStyle:"json",onChartElementClicked:"function",onEvent:"function",onSave:"function",LoadingComponent:"function",ErrorComponent:"function"},Kre=Gre(N2,{props:Yre});exports.$57acba87d6e25586$export$ccf8d8d7bbf3c2cc=ND;exports.$a093c7e1ec25a057$export$8c610744efcf8a1d=AP;exports.Accordion=bre;exports.AccordionContent=jM;exports.AccordionItem=FM;exports.AccordionTrigger=zM;exports.BOOLEAN_DATA_TYPES=Kb;exports.Button=ea;exports.Calendar=zP;exports.Card=e0;exports.CardContent=Yh;exports.CardDescription=t0;exports.CardFooter=n0;exports.CardHeader=Gh;exports.CardTitle=Vu;exports.ChartJsVisual=fP;exports.Check=Zu;exports.CheckIcon=hP;exports.Checkbox=DD;exports.ChevronDown=xp;exports.ClipboardCopyIcon=oW;exports.Cross2Icon=pP;exports.DATE_DATA_TYPES=Fu;exports.Dashboard=N2;exports.DashboardPanel=oR;exports.DashboardTabs=I2;exports.DashboardWC=Kre;exports.Dialog=Lee;exports.DialogContent=wD;exports.DialogDescription=ED;exports.DialogFooter=SD;exports.DialogHeader=_D;exports.DialogTitle=CD;exports.DialogTrigger=Fee;exports.DropdownMenu=aee;exports.DropdownMenuContent=iD;exports.DropdownMenuLabel=aD;exports.DropdownMenuRadioGroup=cee;exports.DropdownMenuRadioItem=sD;exports.DropdownMenuSeparator=lD;exports.DropdownMenuTrigger=lee;exports.Editable=sa;exports.EditorAside=TD;exports.EditorMain=AD;exports.EditorPanel=MD;exports.Ft=Ane;exports.HoverCard=ZP;exports.HoverCardContent=fy;exports.HoverCardTrigger=JP;exports.InfoCircledIcon=dW;exports.Input=RD;exports.KPICard=BP;exports.Label=Xo;exports.LoaderCircle=ly;exports.NUMBER_DATA_TYPES=Cl;exports.PYTHON_DEFAULT_CODE=BE;exports.Panel=QD;exports.PanelGroup=dM;exports.PanelResizeHandle=fM;exports.PaperPlaneIcon=hW;exports.PlayIcon=gW;exports.Popover=Hy;exports.PopoverContent=Dp;exports.PopoverTrigger=Wy;exports.RadioGroup=KM;exports.RadioGroupItem=XM;exports.ScrollArea=qD;exports.ScrollBar=rx;exports.Select=P2;exports.SelectContent=Ky;exports.SelectGroup=VZ;exports.SelectItem=Qc;exports.SelectLabel=T2;exports.SelectSeparator=A2;exports.SelectTrigger=Yy;exports.SelectValue=O2;exports.SemaphorContextProvider=GP;exports.SemaphorQueryClient=UP;exports.Separator=Uy;exports.Settings=HP;exports.SliderIcon=vW;exports.Switch=$M;exports.TEXT_DATA_TYPES=Uh;exports.Table=hy;exports.TableBody=gy;exports.TableCell=$h;exports.TableHead=my;exports.TableHeader=py;exports.TableRow=Xc;exports.TableVisual=hO;exports.Tabs=mR;exports.TabsContent=a0;exports.TabsList=vR;exports.TabsTrigger=bR;exports.Textarea=By;exports.Toggle=SM;exports.Tooltip=NP;exports.TooltipContent=ay;exports.TooltipTrigger=LP;exports.TriangleDownIcon=K0;exports.TriangleUpIcon=X0;exports.UXProvider=k2;exports.X=WP;exports._=ia;exports.cleanCard=cD;exports.cn=_e;exports.commonjsGlobal=ks;exports.copyToClipboard=WN;exports.createChartConfig=YP;exports.createLucideIcon=br;exports.createSqlGenConfig=x6;exports.de=wM;exports.flexRender=$b;exports.fmt=Xb;exports.getBookmarkKey=uD;exports.getCanvasBackgroundColor=oh;exports.getColumnDataType=w6;exports.getContrastColor=ih;exports.getCoreRowModel=cO;exports.getDashbaordStateWithoutData=pee;exports.getDefaultExportFromCjs=Lu;exports.getDefaultFilterSql=rY;exports.getFilterValueType=sh;exports.getKeys=Nr;exports.getPaginationRowModel=dO;exports.getQualifiedTableName=UE;exports.getRequest=HN;exports.getSortedRowModel=uO;exports.getSql=y6;exports.isColumnInSqlGen=_6;exports.jsxRuntimeExports=I;exports.pivotData=Q0;exports.postRequest=jh;exports.resolveBaseQuery=DE;exports.resolveDataType=nu;exports.titleCase=UN;exports.useCard=SU;exports.useDashboardActions=Ki;exports.useDashboardCard=cy;exports.useDashboardStore=Ce;exports.useEditorActions=gP;exports.useEditorStore=Ar;exports.useQuery=ju;exports.useReactTable=fO;exports.useSemaphorContext=Wl;exports.useTheme=nR;exports.v4=fu;