react-semaphor 0.0.203 → 0.0.205
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{dashboard-plus-mq_jVTH0.js → dashboard-plus--d0M3NZV.js} +1 -1
- package/dist/chunks/{dashboard-plus-V6cEoiwX.js → dashboard-plus-gT512BZS.js} +1 -1
- package/dist/chunks/{index-KZsTg_-m.js → index-LQVSHEGJ.js} +3 -3
- package/dist/chunks/{index-DfhnN9LT.js → index-vBFniV1K.js} +3 -3
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +3 -3
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/package.json +1 -1
|
@@ -85,7 +85,7 @@ __p += '`),Mt&&(Re+=`' +
|
|
|
85
85
|
function print() { __p += __j.call(arguments, '') }
|
|
86
86
|
`:`;
|
|
87
87
|
`)+Re+`return __p
|
|
88
|
-
}`;var yt=kE(function(){return jt(j,Ye+"return "+Re).apply(n,U)});if(yt.source=Re,ub(yt))throw yt;return yt}function _8(d){return Ut(d).toLowerCase()}function S8(d){return Ut(d).toUpperCase()}function C8(d,p,y){if(d=Ut(d),d&&(y||p===n))return VS(d);if(!d||!(p=Vr(p)))return d;var E=jo(d),M=jo(p),j=HS(E,M),U=WS(E,M)+1;return Os(E,j,U).join("")}function E8(d,p,y){if(d=Ut(d),d&&(y||p===n))return d.slice(0,qS(d)+1);if(!d||!(p=Vr(p)))return d;var E=jo(d),M=WS(E,jo(p))+1;return Os(E,0,M).join("")}function R8(d,p,y){if(d=Ut(d),d&&(y||p===n))return d.replace(jn,"");if(!d||!(p=Vr(p)))return d;var E=jo(d),M=HS(E,jo(p));return Os(E,M).join("")}function O8(d,p){var y=I,E=F;if(wn(p)){var M="separator"in p?p.separator:M;y="length"in p?pt(p.length):y,E="omission"in p?Vr(p.omission):E}d=Ut(d);var j=d.length;if(Nl(d)){var U=jo(d);j=U.length}if(y>=j)return d;var X=y-Ll(E);if(X<1)return E;var se=U?Os(U,0,X).join(""):d.slice(0,X);if(M===n)return se+E;if(U&&(X+=se.length-X),db(M)){if(d.slice(X).search(M)){var xe,we=se;for(M.global||(M=Ov(M.source,Ut(qe.exec(M))+"g")),M.lastIndex=0;xe=M.exec(we);)var Re=xe.index;se=se.slice(0,Re===n?X:Re)}}else if(d.indexOf(Vr(M),X)!=X){var je=se.lastIndexOf(M);je>-1&&(se=se.slice(0,je))}return se+E}function P8(d){return d=Ut(d),d&&Rn.test(d)?d.replace(Xt,rF):d}var T8=Wl(function(d,p,y){return d+(y?" ":"")+p.toUpperCase()}),pb=MC("toUpperCase");function AE(d,p,y){return d=Ut(d),p=y?n:p,p===n?J3(d)?sF(d):H3(d):d.match(p)||[]}var kE=St(function(d,p){try{return zr(d,n,p)}catch(y){return ub(y)?y:new ct(y)}}),D8=Fi(function(d,p){return mo(p,function(y){y=ai(y),Ni(d,y,lb(d[y],d))}),d});function $8(d){var p=d==null?0:d.length,y=Je();return d=p?yn(d,function(E){if(typeof E[1]!="function")throw new vo(s);return[y(E[0]),E[1]]}):[],St(function(E){for(var M=-1;++M<p;){var j=d[M];if(zr(j[0],this,E))return zr(j[1],this,E)}})}function A8(d){return r7(yo(d,f))}function gb(d){return function(){return d}}function k8(d,p){return d==null||d!==d?p:d}var M8=NC(),I8=NC(!0);function Er(d){return d}function mb(d){return fC(typeof d=="function"?d:yo(d,f))}function N8(d){return pC(yo(d,f))}function L8(d,p){return gC(d,yo(p,f))}var F8=St(function(d,p){return function(y){return _u(y,d,p)}}),j8=St(function(d,p){return function(y){return _u(d,y,p)}});function vb(d,p,y){var E=Bn(p),M=wh(p,E);y==null&&!(wn(p)&&(M.length||!E.length))&&(y=p,p=d,d=this,M=wh(p,Bn(p)));var j=!(wn(y)&&"chain"in y)||!!y.chain,U=zi(d);return mo(M,function(X){var se=p[X];d[X]=se,U&&(d.prototype[X]=function(){var xe=this.__chain__;if(j||xe){var we=d(this.__wrapped__),Re=we.__actions__=_r(this.__actions__);return Re.push({func:se,args:arguments,thisArg:d}),we.__chain__=xe,we}return se.apply(d,ws([this.value()],arguments))})}),d}function z8(){return qn._===this&&(qn._=fF),this}function bb(){}function B8(d){return d=pt(d),St(function(p){return mC(p,d)})}var V8=Kv(yn),H8=Kv(LS),W8=Kv(xv);function ME(d){return nb(d)?wv(ai(d)):x7(d)}function U8(d){return function(p){return d==null?n:Ea(d,p)}}var q8=FC(),G8=FC(!0);function yb(){return[]}function xb(){return!1}function Y8(){return{}}function K8(){return""}function X8(){return!0}function Q8(d,p){if(d=pt(d),d<1||d>Y)return[];var y=H,E=nr(d,H);p=Je(p),d-=H;for(var M=Cv(E,p);++y<d;)p(y);return M}function J8(d){return ut(d)?yn(d,ai):Hr(d)?[d]:_r(eE(Ut(d)))}function Z8(d){var p=++uF;return Ut(d)+p}var ej=Oh(function(d,p){return d+p},0),tj=Xv("ceil"),nj=Oh(function(d,p){return d/p},1),rj=Xv("floor");function oj(d){return d&&d.length?xh(d,Er,Iv):n}function ij(d,p){return d&&d.length?xh(d,Je(p,2),Iv):n}function sj(d){return zS(d,Er)}function aj(d,p){return zS(d,Je(p,2))}function lj(d){return d&&d.length?xh(d,Er,jv):n}function cj(d,p){return d&&d.length?xh(d,Je(p,2),jv):n}var uj=Oh(function(d,p){return d*p},1),dj=Xv("round"),fj=Oh(function(d,p){return d-p},0);function hj(d){return d&&d.length?Sv(d,Er):0}function pj(d,p){return d&&d.length?Sv(d,Je(p,2)):0}return L.after=N9,L.ary=dE,L.assign=S4,L.assignIn=EE,L.assignInWith=zh,L.assignWith=C4,L.at=E4,L.before=fE,L.bind=lb,L.bindAll=D8,L.bindKey=hE,L.castArray=Y9,L.chain=lE,L.chunk=r6,L.compact=o6,L.concat=i6,L.cond=$8,L.conforms=A8,L.constant=gb,L.countBy=h9,L.create=R4,L.curry=pE,L.curryRight=gE,L.debounce=mE,L.defaults=O4,L.defaultsDeep=P4,L.defer=L9,L.delay=F9,L.difference=s6,L.differenceBy=a6,L.differenceWith=l6,L.drop=c6,L.dropRight=u6,L.dropRightWhile=d6,L.dropWhile=f6,L.fill=h6,L.filter=g9,L.flatMap=b9,L.flatMapDeep=y9,L.flatMapDepth=x9,L.flatten=oE,L.flattenDeep=p6,L.flattenDepth=g6,L.flip=j9,L.flow=M8,L.flowRight=I8,L.fromPairs=m6,L.functions=I4,L.functionsIn=N4,L.groupBy=w9,L.initial=b6,L.intersection=y6,L.intersectionBy=x6,L.intersectionWith=w6,L.invert=F4,L.invertBy=j4,L.invokeMap=S9,L.iteratee=mb,L.keyBy=C9,L.keys=Bn,L.keysIn=Cr,L.map=Mh,L.mapKeys=B4,L.mapValues=V4,L.matches=N8,L.matchesProperty=L8,L.memoize=Nh,L.merge=H4,L.mergeWith=RE,L.method=F8,L.methodOf=j8,L.mixin=vb,L.negate=Lh,L.nthArg=B8,L.omit=W4,L.omitBy=U4,L.once=z9,L.orderBy=E9,L.over=V8,L.overArgs=B9,L.overEvery=H8,L.overSome=W8,L.partial=cb,L.partialRight=vE,L.partition=R9,L.pick=q4,L.pickBy=OE,L.property=ME,L.propertyOf=U8,L.pull=E6,L.pullAll=sE,L.pullAllBy=R6,L.pullAllWith=O6,L.pullAt=P6,L.range=q8,L.rangeRight=G8,L.rearg=V9,L.reject=T9,L.remove=T6,L.rest=H9,L.reverse=sb,L.sampleSize=$9,L.set=Y4,L.setWith=K4,L.shuffle=A9,L.slice=D6,L.sortBy=I9,L.sortedUniq=L6,L.sortedUniqBy=F6,L.split=b8,L.spread=W9,L.tail=j6,L.take=z6,L.takeRight=B6,L.takeRightWhile=V6,L.takeWhile=H6,L.tap=o9,L.throttle=U9,L.thru=kh,L.toArray=_E,L.toPairs=PE,L.toPairsIn=TE,L.toPath=J8,L.toPlainObject=CE,L.transform=X4,L.unary=q9,L.union=W6,L.unionBy=U6,L.unionWith=q6,L.uniq=G6,L.uniqBy=Y6,L.uniqWith=K6,L.unset=Q4,L.unzip=ab,L.unzipWith=aE,L.update=J4,L.updateWith=Z4,L.values=Gl,L.valuesIn=e8,L.without=X6,L.words=AE,L.wrap=G9,L.xor=Q6,L.xorBy=J6,L.xorWith=Z6,L.zip=e9,L.zipObject=t9,L.zipObjectDeep=n9,L.zipWith=r9,L.entries=PE,L.entriesIn=TE,L.extend=EE,L.extendWith=zh,vb(L,L),L.add=ej,L.attempt=kE,L.camelCase=o8,L.capitalize=DE,L.ceil=tj,L.clamp=t8,L.clone=K9,L.cloneDeep=Q9,L.cloneDeepWith=J9,L.cloneWith=X9,L.conformsTo=Z9,L.deburr=$E,L.defaultTo=k8,L.divide=nj,L.endsWith=i8,L.eq=Bo,L.escape=s8,L.escapeRegExp=a8,L.every=p9,L.find=m9,L.findIndex=nE,L.findKey=T4,L.findLast=v9,L.findLastIndex=rE,L.findLastKey=D4,L.floor=rj,L.forEach=cE,L.forEachRight=uE,L.forIn=$4,L.forInRight=A4,L.forOwn=k4,L.forOwnRight=M4,L.get=fb,L.gt=e4,L.gte=t4,L.has=L4,L.hasIn=hb,L.head=iE,L.identity=Er,L.includes=_9,L.indexOf=v6,L.inRange=n8,L.invoke=z4,L.isArguments=Pa,L.isArray=ut,L.isArrayBuffer=n4,L.isArrayLike=Sr,L.isArrayLikeObject=On,L.isBoolean=r4,L.isBuffer=Ps,L.isDate=o4,L.isElement=i4,L.isEmpty=s4,L.isEqual=a4,L.isEqualWith=l4,L.isError=ub,L.isFinite=c4,L.isFunction=zi,L.isInteger=bE,L.isLength=Fh,L.isMap=yE,L.isMatch=u4,L.isMatchWith=d4,L.isNaN=f4,L.isNative=h4,L.isNil=g4,L.isNull=p4,L.isNumber=xE,L.isObject=wn,L.isObjectLike=Sn,L.isPlainObject=Pu,L.isRegExp=db,L.isSafeInteger=m4,L.isSet=wE,L.isString=jh,L.isSymbol=Hr,L.isTypedArray=ql,L.isUndefined=v4,L.isWeakMap=b4,L.isWeakSet=y4,L.join=_6,L.kebabCase=l8,L.last=wo,L.lastIndexOf=S6,L.lowerCase=c8,L.lowerFirst=u8,L.lt=x4,L.lte=w4,L.max=oj,L.maxBy=ij,L.mean=sj,L.meanBy=aj,L.min=lj,L.minBy=cj,L.stubArray=yb,L.stubFalse=xb,L.stubObject=Y8,L.stubString=K8,L.stubTrue=X8,L.multiply=uj,L.nth=C6,L.noConflict=z8,L.noop=bb,L.now=Ih,L.pad=d8,L.padEnd=f8,L.padStart=h8,L.parseInt=p8,L.random=r8,L.reduce=O9,L.reduceRight=P9,L.repeat=g8,L.replace=m8,L.result=G4,L.round=dj,L.runInContext=ne,L.sample=D9,L.size=k9,L.snakeCase=v8,L.some=M9,L.sortedIndex=$6,L.sortedIndexBy=A6,L.sortedIndexOf=k6,L.sortedLastIndex=M6,L.sortedLastIndexBy=I6,L.sortedLastIndexOf=N6,L.startCase=y8,L.startsWith=x8,L.subtract=fj,L.sum=hj,L.sumBy=pj,L.template=w8,L.times=Q8,L.toFinite=Bi,L.toInteger=pt,L.toLength=SE,L.toLower=_8,L.toNumber=_o,L.toSafeInteger=_4,L.toString=Ut,L.toUpper=S8,L.trim=C8,L.trimEnd=E8,L.trimStart=R8,L.truncate=O8,L.unescape=P8,L.uniqueId=Z8,L.upperCase=T8,L.upperFirst=pb,L.each=cE,L.eachRight=uE,L.first=iE,vb(L,function(){var d={};return ii(L,function(p,y){Qt.call(L.prototype,y)||(d[y]=p)}),d}(),{chain:!1}),L.VERSION=r,mo(["bind","bindKey","curry","curryRight","partial","partialRight"],function(d){L[d].placeholder=L}),mo(["drop","take"],function(d,p){kt.prototype[d]=function(y){y=y===n?1:Mn(pt(y),0);var E=this.__filtered__&&!p?new kt(this):this.clone();return E.__filtered__?E.__takeCount__=nr(y,E.__takeCount__):E.__views__.push({size:nr(y,H),type:d+(E.__dir__<0?"Right":"")}),E},kt.prototype[d+"Right"]=function(y){return this.reverse()[d](y).reverse()}}),mo(["filter","map","takeWhile"],function(d,p){var y=p+1,E=y==Z||y==Q;kt.prototype[d]=function(M){var j=this.clone();return j.__iteratees__.push({iteratee:Je(M,3),type:y}),j.__filtered__=j.__filtered__||E,j}}),mo(["head","last"],function(d,p){var y="take"+(p?"Right":"");kt.prototype[d]=function(){return this[y](1).value()[0]}}),mo(["initial","tail"],function(d,p){var y="drop"+(p?"":"Right");kt.prototype[d]=function(){return this.__filtered__?new kt(this):this[y](1)}}),kt.prototype.compact=function(){return this.filter(Er)},kt.prototype.find=function(d){return this.filter(d).head()},kt.prototype.findLast=function(d){return this.reverse().find(d)},kt.prototype.invokeMap=St(function(d,p){return typeof d=="function"?new kt(this):this.map(function(y){return _u(y,d,p)})}),kt.prototype.reject=function(d){return this.filter(Lh(Je(d)))},kt.prototype.slice=function(d,p){d=pt(d);var y=this;return y.__filtered__&&(d>0||p<0)?new kt(y):(d<0?y=y.takeRight(-d):d&&(y=y.drop(d)),p!==n&&(p=pt(p),y=p<0?y.dropRight(-p):y.take(p-d)),y)},kt.prototype.takeRightWhile=function(d){return this.reverse().takeWhile(d).reverse()},kt.prototype.toArray=function(){return this.take(H)},ii(kt.prototype,function(d,p){var y=/^(?:filter|find|map|reject)|While$/.test(p),E=/^(?:head|last)$/.test(p),M=L[E?"take"+(p=="last"?"Right":""):p],j=E||/^find/.test(p);M&&(L.prototype[p]=function(){var U=this.__wrapped__,X=E?[1]:arguments,se=U instanceof kt,xe=X[0],we=se||ut(U),Re=function(Pt){var Mt=M.apply(L,ws([Pt],X));return E&&je?Mt[0]:Mt};we&&y&&typeof xe=="function"&&xe.length!=1&&(se=we=!1);var je=this.__chain__,Ye=!!this.__actions__.length,et=j&&!je,yt=se&&!Ye;if(!j&&we){U=yt?U:new kt(this);var tt=d.apply(U,X);return tt.__actions__.push({func:kh,args:[Re],thisArg:n}),new bo(tt,je)}return et&&yt?d.apply(this,X):(tt=this.thru(Re),et?E?tt.value()[0]:tt.value():tt)})}),mo(["pop","push","shift","sort","splice","unshift"],function(d){var p=ih[d],y=/^(?:push|sort|unshift)$/.test(d)?"tap":"thru",E=/^(?:pop|shift)$/.test(d);L.prototype[d]=function(){var M=arguments;if(E&&!this.__chain__){var j=this.value();return p.apply(ut(j)?j:[],M)}return this[y](function(U){return p.apply(ut(U)?U:[],M)})}}),ii(kt.prototype,function(d,p){var y=L[p];if(y){var E=y.name+"";Qt.call(Bl,E)||(Bl[E]=[]),Bl[E].push({name:p,func:y})}}),Bl[Rh(n,w).name]=[{name:"wrapper",func:n}],kt.prototype.clone=PF,kt.prototype.reverse=TF,kt.prototype.value=DF,L.prototype.at=i9,L.prototype.chain=s9,L.prototype.commit=a9,L.prototype.next=l9,L.prototype.plant=u9,L.prototype.reverse=d9,L.prototype.toJSON=L.prototype.valueOf=L.prototype.value=f9,L.prototype.first=L.prototype.head,gu&&(L.prototype[gu]=c9),L},Fl=aF();xa?((xa.exports=Fl)._=Fl,mv._=Fl):qn._=Fl}).call(Vs)})(hg,hg.exports);var uc=hg.exports;const ol=nu(uc);function eR({id:e,layouts:t,initialHeight:n,y:r,x:o,w:i,minH:s}){const a={i:e,x:o??0,y:r??1/0,w:i||20,h:n||35,minW:6,minH:s||10};return t||(t={}),vw.forEach(l=>{t!=null&&t[l]||(t={...t,[l]:[]});const c=t[l].reduce((u,f)=>Math.max(u,f.y+f.h),0);a.y=a.y===0?0:c,t[l].push(a)}),t}function tR(e,t){t&&vw.forEach(n=>{t!=null&&t[n]&&(t[n]=t[n].filter(r=>r.i!==e))})}const ke=X2()(rD((e,t)=>({isSessionExpired:!1,currentBreakpoint:"lg",dashboard:{id:"",style:x0},showContext:!1,selectedSheetId:null,selectedCardId:null,selectedFrameId:null,selectedCard:null,showFilters:!1,isDashboardEditing:!1,isVisualEditing:!1,showDashboardJSON:!1,filteringCards:[],actions:{deleteSheet:n=>{e(r=>{var i,s,a,l;const o=(i=r.dashboard.sheets)==null?void 0:i.findIndex(c=>c.id===n);o!==void 0&&o>-1&&((s=r.dashboard.sheets)==null||s.splice(o,1),r.selectedSheetId=(l=(a=r.dashboard.sheets)==null?void 0:a[0])==null?void 0:l.id)})},addSheet:n=>{e(r=>{r.dashboard.sheets||(r.dashboard.sheets=[]);const o=r.dashboard.filters;let i={};o==null||o.forEach(a=>{vw.forEach(l=>{i!=null&&i[l]||(i={...i,[l]:[]});const c={i:a.id,x:0,y:0,w:10,h:8};i[l].push(c)})});const s={...n,layouts:i};r.dashboard.sheets.push(s)})},setGlobalStyle:n=>{e(r=>{r.dashboard.globalStyle=n})},setAIScopeTables:n=>{e(r=>{r.dashboard.aiScopeTables=n})},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&&uc.forEach(i.frames,l=>{var u;const c=(u=l.cards)==null?void 0:u.find(f=>f.id===n);c&&(c.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)})},setSheetTitle:(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.title=r)})},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(c=>c.id===n);s&&uc.forEach(s.frames,c=>{var f;const u=(f=c.cards)==null?void 0:f.find(h=>h.id===r);u&&(u.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&&uc.forEach(i.frames,l=>{var u;const c=(u=l.cards)==null?void 0:u.find(f=>f.id===n);c&&(c.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(c=>c.id===n);s&&uc.forEach(s.frames,c=>{var f;const u=(f=c.cards)==null?void 0:f.find(h=>h.id===r);u&&(u.description=o)})})},setCardSql:(n,r,o)=>{e(i=>{var a,l,c,u;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(f=>f.id===n);if(s){const f=(c=s.cards)==null?void 0:c.find(h=>h.id===r);f&&(f.sql=o,(u=i.onUpdateCard)==null||u.call(i,f,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(c=>c.id===n);s&&uc.forEach(s.frames,c=>{var f;const u=(f=c.cards)==null?void 0:f.find(h=>h.id===r);u&&(u.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(c=>c.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 i,s;r.dashboard.filters?(i=r.dashboard.filters)==null||i.push(n):r.dashboard.filters=[n];const o=(s=r.dashboard.sheets)==null?void 0:s.find(a=>a.id===r.selectedSheetId);eR({id:n.id,layouts:o==null?void 0:o.layouts,y:0,initialHeight:8,minH:7,w:10})})},removeFilter:n=>{e(r=>{var o,i,s;if(r.dashboard.filters){const a=(o=r.dashboard.filters)==null?void 0:o.findIndex(l=>l.id===n);if(a>-1){(i=r.dashboard.filters)==null||i.splice(a,1);const l=(s=r.dashboard.sheets)==null?void 0:s.find(c=>c.id===r.selectedSheetId);tR(n,l==null?void 0:l.layouts)}}})},updateFrameCard:(n,r,o)=>{e(i=>{var l,c,u,f,h;const s=(c=(l=i.dashboard)==null?void 0:l.sheets)==null?void 0:c.find(g=>g.id===n);if(!s)return;const a=(u=s==null?void 0:s.frames)==null?void 0:u.find(g=>g.id===r);if(a){const g=(f=a.cards)==null?void 0:f.findIndex(v=>v.id===o.id);g>-1&&((h=a.cards)==null||h.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,o)=>{e(i=>{var a,l,c,u;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(f=>f.id===n);if(s){s.frames||(s.frames=[]),(c=s.frames)==null||c.push(r);let f=1/0,h=0;o==="start"&&(f=0),eR({id:r.id,layouts:s.layouts,minH:10,x:h,y:f}),(u=i.onAddFrame)==null||u.call(i,r,n)}})},removeFrame:(n,r)=>{e(o=>{var s,a,l,c,u;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(f=>f.id===n);if(i){const f=(l=i.frames)==null?void 0:l.findIndex(h=>h.id===r);console.log(f),typeof f=="number"&&f>-1&&((c=i.frames)==null||c.splice(f,1),(u=i.layout)==null||u.splice(f,1),tR(r,i.layouts))}})},updateFrame:(n,r)=>{e(o=>{var a,l,c,u;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(f=>f.id===n),s=(c=i==null?void 0:i.frames)==null?void 0:c.findIndex(f=>f.id===r.id);i&&((u=i.frames)==null||u.splice(s,1,r))})},updateCard:(n,r)=>{e(o=>{var a,l,c,u,f;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(h=>h.id===n),s=(c=i==null?void 0:i.cards)==null?void 0:c.findIndex(h=>h.id===r.id);i&&((u=i.cards)==null||u.splice(s,1,r),(f=o.onUpdateCard)==null||f.call(o,r,n))})},removeCard:(n,r)=>{e(o=>{var a,l,c,u,f,h;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(g=>g.id===n),s=(c=i==null?void 0:i.cards)==null?void 0:c.findIndex(g=>g.id===r.id);i&&((u=i.cards)==null||u.splice(s,1),(f=i.layout)==null||f.splice(s,1),(h=o.onRemoveCard)==null||h.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(c=>c.id===n);i&&(((l=i.cards)==null?void 0:l.find(u=>u.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 c=(i=a[l].cards)==null?void 0:i.find(u=>u.id===n);if(c)return c}}},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},getCardSheet(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++)if((i=a[l].cards)==null?void 0:i.find(u=>u.id===n))return r[s]}}},handleDataPointClickAction:(n,r)=>{Iz({card:n,dataPoint:r,set:e,get:t})}}}))),Mo=()=>ke(e=>e.actions);var Pf=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(){}},Hc=typeof window>"u"||"Deno"in window;function Oo(){}function Nz(e,t){return typeof e=="function"?e(t):e}function _0(e){return typeof e=="number"&&e>=0&&e!==1/0}function cD(e,t){return Math.max(e+(t||0)-Date.now(),0)}function nR(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==xw(s,t.options))return!1}else if(!Dd(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 rR(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Td(t.options.mutationKey)!==Td(i))return!1}else if(!Dd(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function xw(e,t){return((t==null?void 0:t.queryKeyHashFn)||Td)(e)}function Td(e){return JSON.stringify(e,(t,n)=>C0(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function Dd(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!Dd(e[n],t[n])):!1}function uD(e,t){if(e===t)return e;const n=oR(e)&&oR(t);if(n||C0(e)&&C0(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 c=0;c<s;c++){const u=n?c:i[c];!n&&e[u]===void 0&&t[u]===void 0&&r.includes(u)?(a[u]=void 0,l++):(a[u]=uD(e[u],t[u]),a[u]===e[u]&&e[u]!==void 0&&l++)}return o===s&&l===o?e:a}return t}function S0(e,t){if(e&&!t||t&&!e)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function oR(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function C0(e){if(!iR(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const n=t.prototype;return!(!iR(n)||!n.hasOwnProperty("isPrototypeOf"))}function iR(e){return Object.prototype.toString.call(e)==="[object Object]"}function Lz(e){return new Promise(t=>{setTimeout(t,e)})}function E0(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?uD(e,t):t}function Fz(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function jz(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Xa,Hs,Cc,A2,zz=(A2=class extends Pf{constructor(){super();Xe(this,Xa,void 0);Xe(this,Hs,void 0);Xe(this,Cc,void 0);Ve(this,Cc,t=>{if(!Hc&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){re(this,Hs)||this.setEventListener(re(this,Cc))}onUnsubscribe(){var t;this.hasListeners()||((t=re(this,Hs))==null||t.call(this),Ve(this,Hs,void 0))}setEventListener(t){var n;Ve(this,Cc,t),(n=re(this,Hs))==null||n.call(this),Ve(this,Hs,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){re(this,Xa)!==t&&(Ve(this,Xa,t),this.onFocus())}onFocus(){this.listeners.forEach(t=>{t()})}isFocused(){var t;return typeof re(this,Xa)=="boolean"?re(this,Xa):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Xa=new WeakMap,Hs=new WeakMap,Cc=new WeakMap,A2),pg=new zz,Ec,Ws,Rc,k2,Bz=(k2=class extends Pf{constructor(){super();Xe(this,Ec,!0);Xe(this,Ws,void 0);Xe(this,Rc,void 0);Ve(this,Rc,t=>{if(!Hc&&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(){re(this,Ws)||this.setEventListener(re(this,Rc))}onUnsubscribe(){var t;this.hasListeners()||((t=re(this,Ws))==null||t.call(this),Ve(this,Ws,void 0))}setEventListener(t){var n;Ve(this,Rc,t),(n=re(this,Ws))==null||n.call(this),Ve(this,Ws,t(this.setOnline.bind(this)))}setOnline(t){re(this,Ec)!==t&&(Ve(this,Ec,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return re(this,Ec)}},Ec=new WeakMap,Ws=new WeakMap,Rc=new WeakMap,k2),gg=new Bz;function Vz(e){return Math.min(1e3*2**e,3e4)}function om(e){return(e??"online")==="online"?gg.isOnline():!0}var dD=class{constructor(e){this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Tb(e){return e instanceof dD}function fD(e){let t=!1,n=0,r=!1,o,i,s;const a=new Promise((x,w)=>{i=x,s=w}),l=x=>{var w;r||(g(new dD(x)),(w=e.abort)==null||w.call(e))},c=()=>{t=!0},u=()=>{t=!1},f=()=>!pg.isFocused()||e.networkMode!=="always"&&!gg.isOnline(),h=x=>{var w;r||(r=!0,(w=e.onSuccess)==null||w.call(e,x),o==null||o(),i(x))},g=x=>{var w;r||(r=!0,(w=e.onError)==null||w.call(e,x),o==null||o(),s(x))},v=()=>new Promise(x=>{var w;o=_=>{const S=r||!f();return S&&x(_),S},(w=e.onPause)==null||w.call(e)}).then(()=>{var x;o=void 0,r||(x=e.onContinue)==null||x.call(e)}),b=()=>{if(r)return;let x;try{x=e.fn()}catch(w){x=Promise.reject(w)}Promise.resolve(x).then(h).catch(w=>{var P;if(r)return;const _=e.retry??(Hc?0:3),S=e.retryDelay??Vz,R=typeof S=="function"?S(n,w):S,C=_===!0||typeof _=="number"&&n<_||typeof _=="function"&&_(n,w);if(t||!C){g(w);return}n++,(P=e.onFail)==null||P.call(e,n,w),Lz(R).then(()=>{if(f())return v()}).then(()=>{t?g(w):b()})})};return om(e.networkMode)?b():v().then(b),{promise:a,cancel:l,continue:()=>(o==null?void 0:o())?a:Promise.resolve(),cancelRetry:c,continueRetry:u}}function Hz(){let e=[],t=0,n=h=>{h()},r=h=>{h()},o=h=>setTimeout(h,0);const i=h=>{o=h},s=h=>{let g;t++;try{g=h()}finally{t--,t||c()}return g},a=h=>{t?e.push(h):o(()=>{n(h)})},l=h=>(...g)=>{a(()=>{h(...g)})},c=()=>{const h=e;e=[],h.length&&o(()=>{r(()=>{h.forEach(g=>{n(g)})})})};return{batch:s,batchCalls:l,schedule:a,setNotifyFunction:h=>{n=h},setBatchNotifyFunction:h=>{r=h},setScheduler:i}}var Xn=Hz(),Qa,M2,hD=(M2=class{constructor(){Xe(this,Qa,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),_0(this.gcTime)&&Ve(this,Qa,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Hc?1/0:5*60*1e3))}clearGcTimeout(){re(this,Qa)&&(clearTimeout(re(this,Qa)),Ve(this,Qa,void 0))}},Qa=new WeakMap,M2),Oc,Pc,Co,Us,Eo,Vn,pf,Ja,Tc,Kp,Go,qi,I2,Wz=(I2=class extends hD{constructor(t){super();Xe(this,Tc);Xe(this,Go);Xe(this,Oc,void 0);Xe(this,Pc,void 0);Xe(this,Co,void 0);Xe(this,Us,void 0);Xe(this,Eo,void 0);Xe(this,Vn,void 0);Xe(this,pf,void 0);Xe(this,Ja,void 0);Ve(this,Ja,!1),Ve(this,pf,t.defaultOptions),Ct(this,Tc,Kp).call(this,t.options),Ve(this,Vn,[]),Ve(this,Co,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Ve(this,Oc,t.state||Uz(this.options)),this.state=re(this,Oc),this.scheduleGc()}get meta(){return this.options.meta}optionalRemove(){!re(this,Vn).length&&this.state.fetchStatus==="idle"&&re(this,Co).remove(this)}setData(t,n){const r=E0(this.state.data,t,this.options);return Ct(this,Go,qi).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){Ct(this,Go,qi).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r;const n=re(this,Us);return(r=re(this,Eo))==null||r.cancel(t),n?n.then(Oo).catch(Oo):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(re(this,Oc))}isActive(){return re(this,Vn).some(t=>t.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||re(this,Vn).some(t=>t.getCurrentResult().isStale)}isStaleByTime(t=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!cD(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=re(this,Vn).find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=re(this,Eo))==null||n.continue()}onOnline(){var n;const t=re(this,Vn).find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=re(this,Eo))==null||n.continue()}addObserver(t){re(this,Vn).includes(t)||(re(this,Vn).push(t),this.clearGcTimeout(),re(this,Co).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){re(this,Vn).includes(t)&&(Ve(this,Vn,re(this,Vn).filter(n=>n!==t)),re(this,Vn).length||(re(this,Eo)&&(re(this,Ja)?re(this,Eo).cancel({revert:!0}):re(this,Eo).cancelRetry()),this.scheduleGc()),re(this,Co).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return re(this,Vn).length}invalidate(){this.state.isInvalidated||Ct(this,Go,qi).call(this,{type:"invalidate"})}fetch(t,n){var c,u,f,h;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(re(this,Us))return(c=re(this,Eo))==null||c.continueRetry(),re(this,Us)}if(t&&Ct(this,Tc,Kp).call(this,t),!this.options.queryFn){const g=re(this,Vn).find(v=>v.options.queryFn);g&&Ct(this,Tc,Kp).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:()=>(Ve(this,Ja,!0),r.signal)})};i(o);const s=()=>this.options.queryFn?(Ve(this,Ja,!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),(u=this.options.behavior)==null||u.onFetch(a,this),Ve(this,Pc,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((f=a.fetchOptions)==null?void 0:f.meta))&&Ct(this,Go,qi).call(this,{type:"fetch",meta:(h=a.fetchOptions)==null?void 0:h.meta});const l=g=>{var v,b,x,w;Tb(g)&&g.silent||Ct(this,Go,qi).call(this,{type:"error",error:g}),Tb(g)||((b=(v=re(this,Co).config).onError)==null||b.call(v,g,this),(w=(x=re(this,Co).config).onSettled)==null||w.call(x,this.state.data,g,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return Ve(this,Eo,fD({fn:a.fetchFn,abort:r.abort.bind(r),onSuccess:g=>{var v,b,x,w;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),(b=(v=re(this,Co).config).onSuccess)==null||b.call(v,g,this),(w=(x=re(this,Co).config).onSettled)==null||w.call(x,g,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:l,onFail:(g,v)=>{Ct(this,Go,qi).call(this,{type:"failed",failureCount:g,error:v})},onPause:()=>{Ct(this,Go,qi).call(this,{type:"pause"})},onContinue:()=>{Ct(this,Go,qi).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode})),Ve(this,Us,re(this,Eo).promise),re(this,Us)}},Oc=new WeakMap,Pc=new WeakMap,Co=new WeakMap,Us=new WeakMap,Eo=new WeakMap,Vn=new WeakMap,pf=new WeakMap,Ja=new WeakMap,Tc=new WeakSet,Kp=function(t){this.options={...re(this,pf),...t},this.updateGcTime(this.options.gcTime)},Go=new WeakSet,qi=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:om(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 Tb(o)&&o.revert&&re(this,Pc)?{...re(this,Pc),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),Xn.batch(()=>{re(this,Vn).forEach(r=>{r.onQueryUpdate()}),re(this,Co).notify({query:this,type:"updated",action:t})})},I2);function Uz(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 fi,N2,pD=(N2=class extends Pf{constructor(t={}){super();Xe(this,fi,void 0);this.config=t,Ve(this,fi,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??xw(o,n);let s=this.get(i);return s||(s=new Wz({cache:this,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){re(this,fi).has(t.queryHash)||(re(this,fi).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=re(this,fi).get(t.queryHash);n&&(t.destroy(),n===t&&re(this,fi).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Xn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return re(this,fi).get(t)}getAll(){return[...re(this,fi).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>nR(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>nR(t,r)):n}notify(t){Xn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Xn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Xn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},fi=new WeakMap,N2),hi,gf,Xr,Dc,pi,Ls,L2,qz=(L2=class extends hD{constructor(t){super();Xe(this,pi);Xe(this,hi,void 0);Xe(this,gf,void 0);Xe(this,Xr,void 0);Xe(this,Dc,void 0);this.mutationId=t.mutationId,Ve(this,gf,t.defaultOptions),Ve(this,Xr,t.mutationCache),Ve(this,hi,[]),this.state=t.state||Gz(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options={...re(this,gf),...t},this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){re(this,hi).includes(t)||(re(this,hi).push(t),this.clearGcTimeout(),re(this,Xr).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Ve(this,hi,re(this,hi).filter(n=>n!==t)),this.scheduleGc(),re(this,Xr).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){re(this,hi).length||(this.state.status==="pending"?this.scheduleGc():re(this,Xr).remove(this))}continue(){var t;return((t=re(this,Dc))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,s,a,l,c,u,f,h,g,v,b,x,w,_,S,R,C,P,A;const n=()=>(Ve(this,Dc,fD({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(k,D)=>{Ct(this,pi,Ls).call(this,{type:"failed",failureCount:k,error:D})},onPause:()=>{Ct(this,pi,Ls).call(this,{type:"pause"})},onContinue:()=>{Ct(this,pi,Ls).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode})),re(this,Dc).promise),r=this.state.status==="pending";try{if(!r){Ct(this,pi,Ls).call(this,{type:"pending",variables:t}),await((i=(o=re(this,Xr).config).onMutate)==null?void 0:i.call(o,t,this));const D=await((a=(s=this.options).onMutate)==null?void 0:a.call(s,t));D!==this.state.context&&Ct(this,pi,Ls).call(this,{type:"pending",context:D,variables:t})}const k=await n();return await((c=(l=re(this,Xr).config).onSuccess)==null?void 0:c.call(l,k,t,this.state.context,this)),await((f=(u=this.options).onSuccess)==null?void 0:f.call(u,k,t,this.state.context)),await((g=(h=re(this,Xr).config).onSettled)==null?void 0:g.call(h,k,null,this.state.variables,this.state.context,this)),await((b=(v=this.options).onSettled)==null?void 0:b.call(v,k,null,t,this.state.context)),Ct(this,pi,Ls).call(this,{type:"success",data:k}),k}catch(k){try{throw await((w=(x=re(this,Xr).config).onError)==null?void 0:w.call(x,k,t,this.state.context,this)),await((S=(_=this.options).onError)==null?void 0:S.call(_,k,t,this.state.context)),await((C=(R=re(this,Xr).config).onSettled)==null?void 0:C.call(R,void 0,k,this.state.variables,this.state.context,this)),await((A=(P=this.options).onSettled)==null?void 0:A.call(P,void 0,k,t,this.state.context)),k}finally{Ct(this,pi,Ls).call(this,{type:"error",error:k})}}}},hi=new WeakMap,gf=new WeakMap,Xr=new WeakMap,Dc=new WeakMap,pi=new WeakSet,Ls=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:!om(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),Xn.batch(()=>{re(this,hi).forEach(r=>{r.onMutationUpdate(t)}),re(this,Xr).notify({mutation:this,type:"updated",action:t})})},L2);function Gz(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ro,mf,Za,F2,Yz=(F2=class extends Pf{constructor(t={}){super();Xe(this,Ro,void 0);Xe(this,mf,void 0);Xe(this,Za,void 0);this.config=t,Ve(this,Ro,[]),Ve(this,mf,0)}build(t,n,r){const o=new qz({mutationCache:this,mutationId:++Bh(this,mf)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){re(this,Ro).push(t),this.notify({type:"added",mutation:t})}remove(t){Ve(this,Ro,re(this,Ro).filter(n=>n!==t)),this.notify({type:"removed",mutation:t})}clear(){Xn.batch(()=>{re(this,Ro).forEach(t=>{this.remove(t)})})}getAll(){return re(this,Ro)}find(t){const n={exact:!0,...t};return re(this,Ro).find(r=>rR(n,r))}findAll(t={}){return re(this,Ro).filter(n=>rR(t,n))}notify(t){Xn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){return Ve(this,Za,(re(this,Za)??Promise.resolve()).then(()=>{const t=re(this,Ro).filter(n=>n.state.isPaused);return Xn.batch(()=>t.reduce((n,r)=>n.then(()=>r.continue().catch(Oo)),Promise.resolve()))}).then(()=>{Ve(this,Za,void 0)})),re(this,Za)}},Ro=new WeakMap,mf=new WeakMap,Za=new WeakMap,F2);function Kz(e){return{onFetch:(t,n)=>{const r=async()=>{var v,b,x,w,_;const o=t.options,i=(x=(b=(v=t.fetchOptions)==null?void 0:v.meta)==null?void 0:b.fetchMore)==null?void 0:x.direction,s=((w=t.state.data)==null?void 0:w.pages)||[],a=((_=t.state.data)==null?void 0:_.pageParams)||[],l={pages:[],pageParams:[]};let c=!1;const u=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(t.signal.aborted?c=!0:t.signal.addEventListener("abort",()=>{c=!0}),t.signal)})},f=t.options.queryFn||(()=>Promise.reject(new Error(`Missing queryFn: '${t.options.queryHash}'`))),h=async(S,R,C)=>{if(c)return Promise.reject();if(R==null&&S.pages.length)return Promise.resolve(S);const P={queryKey:t.queryKey,pageParam:R,direction:C?"backward":"forward",meta:t.options.meta};u(P);const A=await f(P),{maxPages:k}=t.options,D=C?jz:Fz;return{pages:D(S.pages,A,k),pageParams:D(S.pageParams,R,k)}};let g;if(i&&s.length){const S=i==="backward",R=S?Xz:sR,C={pages:s,pageParams:a},P=R(o,C);g=await h(C,P,S)}else{g=await h(l,a[0]??o.initialPageParam);const S=e??s.length;for(let R=1;R<S;R++){const C=sR(o,g);g=await h(g,C)}}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 sR(e,{pages:t,pageParams:n}){const r=t.length-1;return e.getNextPageParam(t[r],t,n[r],n)}function Xz(e,{pages:t,pageParams:n}){var r;return(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n)}var In,qs,Gs,$c,Ac,Ys,kc,Mc,j2,Qz=(j2=class{constructor(e={}){Xe(this,In,void 0);Xe(this,qs,void 0);Xe(this,Gs,void 0);Xe(this,$c,void 0);Xe(this,Ac,void 0);Xe(this,Ys,void 0);Xe(this,kc,void 0);Xe(this,Mc,void 0);Ve(this,In,e.queryCache||new pD),Ve(this,qs,e.mutationCache||new Yz),Ve(this,Gs,e.defaultOptions||{}),Ve(this,$c,new Map),Ve(this,Ac,new Map),Ve(this,Ys,0)}mount(){Bh(this,Ys)._++,re(this,Ys)===1&&(Ve(this,kc,pg.subscribe(()=>{pg.isFocused()&&(this.resumePausedMutations(),re(this,In).onFocus())})),Ve(this,Mc,gg.subscribe(()=>{gg.isOnline()&&(this.resumePausedMutations(),re(this,In).onOnline())})))}unmount(){var e,t;Bh(this,Ys)._--,re(this,Ys)===0&&((e=re(this,kc))==null||e.call(this),Ve(this,kc,void 0),(t=re(this,Mc))==null||t.call(this),Ve(this,Mc,void 0))}isFetching(e){return re(this,In).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return re(this,qs).findAll({...e,status:"pending"}).length}getQueryData(e){var t;return(t=re(this,In).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=re(this,In).find({queryKey:e}),o=r==null?void 0:r.state.data,i=Nz(t,o);if(typeof i>"u")return;const s=this.defaultQueryOptions({queryKey:e});return re(this,In).build(this,s).setData(i,{...n,manual:!0})}setQueriesData(e,t,n){return Xn.batch(()=>this.getQueryCache().findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var t;return(t=re(this,In).find({queryKey:e}))==null?void 0:t.state}removeQueries(e){const t=re(this,In);Xn.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=re(this,In),r={type:"active",...e};return Xn.batch(()=>(n.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries(r,t)))}cancelQueries(e={},t={}){const n={revert:!0,...t},r=Xn.batch(()=>re(this,In).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(Oo).catch(Oo)}invalidateQueries(e={},t={}){return Xn.batch(()=>{if(re(this,In).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=Xn.batch(()=>re(this,In).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(Oo)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Oo)}fetchQuery(e){const t=this.defaultQueryOptions(e);typeof t.retry>"u"&&(t.retry=!1);const n=re(this,In).build(this,t);return n.isStaleByTime(t.staleTime)?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Oo).catch(Oo)}fetchInfiniteQuery(e){return e.behavior=Kz(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Oo).catch(Oo)}resumePausedMutations(){return re(this,qs).resumePausedMutations()}getQueryCache(){return re(this,In)}getMutationCache(){return re(this,qs)}getDefaultOptions(){return re(this,Gs)}setDefaultOptions(e){Ve(this,Gs,e)}setQueryDefaults(e,t){re(this,$c).set(Td(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...re(this,$c).values()];let n={};return t.forEach(r=>{Dd(e,r.queryKey)&&(n={...n,...r.defaultOptions})}),n}setMutationDefaults(e,t){re(this,Ac).set(Td(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...re(this,Ac).values()];let n={};return t.forEach(r=>{Dd(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e!=null&&e._defaulted)return e;const t={...re(this,Gs).queries,...(e==null?void 0:e.queryKey)&&this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=xw(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:{...re(this,Gs).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){re(this,In).clear(),re(this,qs).clear()}},In=new WeakMap,qs=new WeakMap,Gs=new WeakMap,$c=new WeakMap,Ac=new WeakMap,Ys=new WeakMap,kc=new WeakMap,Mc=new WeakMap,j2),$r,fn,vf,vr,el,Ic,gi,bf,Nc,Lc,tl,nl,Ks,Fc,rl,Zu,yf,R0,xf,O0,wf,P0,_f,T0,Sf,D0,Cf,$0,Ef,A0,Jg,gD,z2,Jz=(z2=class extends Pf{constructor(t,n){super();Xe(this,rl);Xe(this,yf);Xe(this,xf);Xe(this,wf);Xe(this,_f);Xe(this,Sf);Xe(this,Cf);Xe(this,Ef);Xe(this,Jg);Xe(this,$r,void 0);Xe(this,fn,void 0);Xe(this,vf,void 0);Xe(this,vr,void 0);Xe(this,el,void 0);Xe(this,Ic,void 0);Xe(this,gi,void 0);Xe(this,bf,void 0);Xe(this,Nc,void 0);Xe(this,Lc,void 0);Xe(this,tl,void 0);Xe(this,nl,void 0);Xe(this,Ks,void 0);Xe(this,Fc,new Set);this.options=n,Ve(this,$r,t),Ve(this,gi,null),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(re(this,fn).addObserver(this),aR(re(this,fn),this.options)?Ct(this,rl,Zu).call(this):this.updateResult(),Ct(this,_f,T0).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return k0(re(this,fn),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return k0(re(this,fn),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ct(this,Sf,D0).call(this),Ct(this,Cf,$0).call(this),re(this,fn).removeObserver(this)}setOptions(t,n){const r=this.options,o=re(this,fn);if(this.options=re(this,$r).defaultQueryOptions(t),S0(r,this.options)||re(this,$r).getQueryCache().notify({type:"observerOptionsUpdated",query:re(this,fn),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),Ct(this,Ef,A0).call(this);const i=this.hasListeners();i&&lR(re(this,fn),o,this.options,r)&&Ct(this,rl,Zu).call(this),this.updateResult(n),i&&(re(this,fn)!==o||this.options.enabled!==r.enabled||this.options.staleTime!==r.staleTime)&&Ct(this,yf,R0).call(this);const s=Ct(this,xf,O0).call(this);i&&(re(this,fn)!==o||this.options.enabled!==r.enabled||s!==re(this,Ks))&&Ct(this,wf,P0).call(this,s)}getOptimisticResult(t){const n=re(this,$r).getQueryCache().build(re(this,$r),t),r=this.createResult(n,t);return eB(this,r)&&(Ve(this,vr,r),Ve(this,Ic,this.options),Ve(this,el,re(this,fn).state)),r}getCurrentResult(){return re(this,vr)}trackResult(t){const n={};return Object.keys(t).forEach(r=>{Object.defineProperty(n,r,{configurable:!1,enumerable:!0,get:()=>(re(this,Fc).add(r),t[r])})}),n}getCurrentQuery(){return re(this,fn)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=re(this,$r).defaultQueryOptions(t),r=re(this,$r).getQueryCache().build(re(this,$r),n);return r.isFetchingOptimistic=!0,r.fetch().then(()=>this.createResult(r,n))}fetch(t){return Ct(this,rl,Zu).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),re(this,vr)))}createResult(t,n){var P;const r=re(this,fn),o=this.options,i=re(this,vr),s=re(this,el),a=re(this,Ic),c=t!==r?t.state:re(this,vf),{state:u}=t;let{error:f,errorUpdatedAt:h,fetchStatus:g,status:v}=u,b=!1,x;if(n._optimisticResults){const A=this.hasListeners(),k=!A&&aR(t,n),D=A&&lR(t,r,n,o);(k||D)&&(g=om(t.options.networkMode)?"fetching":"paused",u.dataUpdatedAt||(v="pending")),n._optimisticResults==="isRestoring"&&(g="idle")}if(n.select&&typeof u.data<"u")if(i&&u.data===(s==null?void 0:s.data)&&n.select===re(this,bf))x=re(this,Nc);else try{Ve(this,bf,n.select),x=n.select(u.data),x=E0(i==null?void 0:i.data,x,n),Ve(this,Nc,x),Ve(this,gi,null)}catch(A){Ve(this,gi,A)}else x=u.data;if(typeof n.placeholderData<"u"&&typeof x>"u"&&v==="pending"){let A;if(i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData))A=i.data;else if(A=typeof n.placeholderData=="function"?n.placeholderData((P=re(this,Lc))==null?void 0:P.state.data,re(this,Lc)):n.placeholderData,n.select&&typeof A<"u")try{A=n.select(A),Ve(this,gi,null)}catch(k){Ve(this,gi,k)}typeof A<"u"&&(v="success",x=E0(i==null?void 0:i.data,A,n),b=!0)}re(this,gi)&&(f=re(this,gi),x=re(this,Nc),h=Date.now(),v="error");const w=g==="fetching",_=v==="pending",S=v==="error",R=_&&w;return{status:v,fetchStatus:g,isPending:_,isSuccess:v==="success",isError:S,isInitialLoading:R,isLoading:R,data:x,dataUpdatedAt:u.dataUpdatedAt,error:f,errorUpdatedAt:h,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>c.dataUpdateCount||u.errorUpdateCount>c.errorUpdateCount,isFetching:w,isRefetching:w&&!_,isLoadingError:S&&u.dataUpdatedAt===0,isPaused:g==="paused",isPlaceholderData:b,isRefetchError:S&&u.dataUpdatedAt!==0,isStale:ww(t,n),refetch:this.refetch}}updateResult(t){const n=re(this,vr),r=this.createResult(re(this,fn),this.options);if(Ve(this,el,re(this,fn).state),Ve(this,Ic,this.options),re(this,el).data!==void 0&&Ve(this,Lc,re(this,fn)),S0(r,n))return;Ve(this,vr,r);const o={},i=()=>{if(!n)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!re(this,Fc).size)return!0;const l=new Set(a??re(this,Fc));return this.options.throwOnError&&l.add("error"),Object.keys(re(this,vr)).some(c=>{const u=c;return re(this,vr)[u]!==n[u]&&l.has(u)})};(t==null?void 0:t.listeners)!==!1&&i()&&(o.listeners=!0),Ct(this,Jg,gD).call(this,{...o,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ct(this,_f,T0).call(this)}},$r=new WeakMap,fn=new WeakMap,vf=new WeakMap,vr=new WeakMap,el=new WeakMap,Ic=new WeakMap,gi=new WeakMap,bf=new WeakMap,Nc=new WeakMap,Lc=new WeakMap,tl=new WeakMap,nl=new WeakMap,Ks=new WeakMap,Fc=new WeakMap,rl=new WeakSet,Zu=function(t){Ct(this,Ef,A0).call(this);let n=re(this,fn).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Oo)),n},yf=new WeakSet,R0=function(){if(Ct(this,Sf,D0).call(this),Hc||re(this,vr).isStale||!_0(this.options.staleTime))return;const n=cD(re(this,vr).dataUpdatedAt,this.options.staleTime)+1;Ve(this,tl,setTimeout(()=>{re(this,vr).isStale||this.updateResult()},n))},xf=new WeakSet,O0=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(re(this,fn)):this.options.refetchInterval)??!1},wf=new WeakSet,P0=function(t){Ct(this,Cf,$0).call(this),Ve(this,Ks,t),!(Hc||this.options.enabled===!1||!_0(re(this,Ks))||re(this,Ks)===0)&&Ve(this,nl,setInterval(()=>{(this.options.refetchIntervalInBackground||pg.isFocused())&&Ct(this,rl,Zu).call(this)},re(this,Ks)))},_f=new WeakSet,T0=function(){Ct(this,yf,R0).call(this),Ct(this,wf,P0).call(this,Ct(this,xf,O0).call(this))},Sf=new WeakSet,D0=function(){re(this,tl)&&(clearTimeout(re(this,tl)),Ve(this,tl,void 0))},Cf=new WeakSet,$0=function(){re(this,nl)&&(clearInterval(re(this,nl)),Ve(this,nl,void 0))},Ef=new WeakSet,A0=function(){const t=re(this,$r).getQueryCache().build(re(this,$r),this.options);if(t===re(this,fn))return;const n=re(this,fn);Ve(this,fn,t),Ve(this,vf,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Jg=new WeakSet,gD=function(t){Xn.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(re(this,vr))}),re(this,$r).getQueryCache().notify({query:re(this,fn),type:"observerResultsUpdated"})})},z2);function Zz(e,t){return t.enabled!==!1&&!e.state.dataUpdatedAt&&!(e.state.status==="error"&&t.retryOnMount===!1)}function aR(e,t){return Zz(e,t)||e.state.dataUpdatedAt>0&&k0(e,t,t.refetchOnMount)}function k0(e,t,n){if(t.enabled!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&ww(e,t)}return!1}function lR(e,t,n,r){return n.enabled!==!1&&(e!==t||r.enabled===!1)&&(!n.suspense||e.state.status!=="error")&&ww(e,n)}function ww(e,t){return e.isStaleByTime(t.staleTime)}function eB(e,t){return!S0(e.getCurrentResult(),t)}var mD=V.createContext(void 0),vD=e=>{const t=V.useContext(mD);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},tB=({client:e,children:t})=>(V.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),V.createElement(mD.Provider,{value:e},t)),bD=V.createContext(!1),nB=()=>V.useContext(bD);bD.Provider;function rB(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var oB=V.createContext(rB()),iB=()=>V.useContext(oB);function sB(e,t){return typeof e=="function"?e(...t):!!e}var aB=(e,t)=>{(e.suspense||e.throwOnError)&&(t.isReset()||(e.retryOnMount=!1))},lB=e=>{V.useEffect(()=>{e.clearReset()},[e])},cB=({result:e,errorResetBoundary:t,throwOnError:n,query:r})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&sB(n,[e.error,r]),uB=e=>{e.suspense&&typeof e.staleTime!="number"&&(e.staleTime=1e3)},dB=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,fB=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function hB(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=vD(n),o=nB(),i=iB(),s=r.defaultQueryOptions(e);s._optimisticResults=o?"isRestoring":"optimistic",uB(s),aB(s,i),lB(i);const[a]=V.useState(()=>new t(r,s)),l=a.getOptimisticResult(s);if(V.useSyncExternalStore(V.useCallback(c=>{const u=o?()=>{}:a.subscribe(Xn.batchCalls(c));return a.updateResult(),u},[a,o]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),V.useEffect(()=>{a.setOptions(s,{listeners:!1})},[s,a]),dB(s,l))throw fB(s,a,i);if(cB({result:l,errorResetBoundary:i,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash)}))throw l.error;return s.notifyOnChangeProps?l:a.trackResult(l)}function Tf(e,t){return hB(e,Jz,t)}const pB={theme:"system",setTheme:()=>null},yD=m.createContext(pB);function gB({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 O.jsx(yD.Provider,{...r,value:s,children:e})}const xD=()=>{const e=m.useContext(yD);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e};async function mB(e){return await(await fetch("https://semaphor.cloud/api/v1/dashboard",{headers:{Authorization:`Bearer ${e}`}})).json()}function wD(e){return e==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e}function cR(e,t){const n=wD(e);return n==="dark"?ol.merge({...t==null?void 0:t.default},{...t==null?void 0:t.dark}):t==null?void 0:t.default}function vB({authToken:e,customStyle:t,currentTheme:n,onSave:r,onEvent:o}){const{data:i,refetch:s,isLoading:a,isError:l}=Tf({queryKey:["dashboard",e==null?void 0:e.accessToken],queryFn:()=>mB(e==null?void 0:e.accessToken),enabled:!1}),{theme:c,setTheme:u}=xD(),f=ke(A=>A.dashboard.globalStyle),{setDashboard:h,setSelectedSheetId:g,setStyle:v,setOnSaveFunction:b}=ke(A=>A.actions);ke(A=>A.actions.setCustomCards);const x=ke(A=>A.actions.setFilterValues),w=ke(A=>A.actions.setBookmarkKey),_=ke(A=>A.actions.setAuthToken),S=ke(A=>A.actions.setThemeStyle),R=ke(A=>A.actions.setDashboardTheme),C=ke(A=>A.actions.setOnEvent);m.useEffect(()=>{if(c){const A=wD(c);R(A)}},[c,R]),m.useEffect(()=>{n&&u(n)},[n,u]);function P(){const A=ol.cloneDeep(x0),k=ol.merge(A,f);if(t){const D=ol.merge(k,t),I=cR(c,D);S(I),v(D)}else{const D=cR(c,k);S(D),v(x0)}}return m.useEffect(()=>{i&&i.dashboard&&P()},[c,t,f]),m.useEffect(()=>{var F;if(!i||!i.dashboard)return;const A=i.dashboard,k=yL(A.id),D=JSON.parse(localStorage.getItem(k)||"[]"),I=D.find(B=>B.default===!0);if(I)h(I.template),P(),w(I.name),I.filterValues&&x(I.filterValues);else{h(A),P();const B=D.find(K=>(K==null?void 0:K.name)==="Original");B?B.template=A:D.push({name:"Original",template:A,default:!1}),localStorage.setItem(k,JSON.stringify(D))}g((F=A.sheets)==null?void 0:F[0].id)},[i,h,g,x,w]),m.useEffect(()=>{r&&b(r),o&&C(o)},[r,b,o,C]),m.useEffect(()=>{e&&e.accessToken&&(_(e),s())},[e,s,_]),{isLoading:a,isError:l}}function im({className:e,...t}){return O.jsx("div",{className:Ee("animate-pulse rounded-md bg-muted",e),...t})}const _w=V.forwardRef(({className:e,...t},n)=>O.jsx("div",{ref:n,className:Ee("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));_w.displayName="Card";const sm=V.forwardRef(({className:e,...t},n)=>O.jsx("div",{ref:n,className:Ee("flex flex-col space-y-1.5 p-6",e),...t}));sm.displayName="CardHeader";const Df=V.forwardRef(({className:e,...t},n)=>O.jsx("h3",{ref:n,className:Ee("text-2xl font-semibold leading-none tracking-tight",e),...t}));Df.displayName="CardTitle";const Sw=V.forwardRef(({className:e,...t},n)=>O.jsx("p",{ref:n,className:Ee("text-sm text-muted-foreground",e),...t}));Sw.displayName="CardDescription";const am=V.forwardRef(({className:e,...t},n)=>O.jsx("div",{ref:n,className:Ee("px-6 pt-0",e),...t}));am.displayName="CardContent";const Cw=V.forwardRef(({className:e,...t},n)=>O.jsx("div",{ref:n,className:Ee("flex items-center p-6 pt-0",e),...t}));Cw.displayName="CardFooter";function _D({className:e,customStyle:t,onSave:n,onEvent:r,LoadingComponent:o,ErrorComponent:i,onChartElementClicked:s,id:a,authToken:l,currentTheme:c,version:u,customCards:f,showAssistant:h,...g}){ke(_=>_.selectedSheetId);const v=ke(_=>_.themeStyle),b=ke(_=>_.isSessionExpired),{isLoading:x,isError:w}=vB({authToken:l,customStyle:t,currentTheme:c,onSave:n,onEvent:r});return x||!l?(r==null||r({type:"info",message:"Loading dashboard"}),o?O.jsx(o,{message:"loading"}):O.jsx("div",{className:"flex items-center gap-3",children:O.jsx(im,{className:"h-1 w-full dark:h-[2px]"})})):w?(r==null||r({type:"error",message:"Error fetching dashboard"}),i?(console.log("Error fetching dashboard"),O.jsx(i,{})):O.jsx("div",{children:"Error"})):b?(r==null||r({type:"error",message:"Session Expired"}),O.jsx("div",{className:"flex h-full items-center justify-center",children:O.jsxs("div",{className:"space-y-4 rounded-md border border-muted p-10",children:[O.jsx(Df,{children:"Session Expired"}),O.jsx("p",{className:"text-muted-foreground",children:"Please refresh your page to continue."})]})})):O.jsx("div",{className:Ee("flex h-full grow flex-col justify-between",v==null?void 0:v.dashboardPanel,e),role:"dashboard-panel",...g})}function he(){return he=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},he.apply(this,arguments)}function Me(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 Zn(e,t=[]){let n=[];function r(i,s){const a=m.createContext(s),l=n.length;n=[...n,s];function c(f){const{scope:h,children:g,...v}=f,b=(h==null?void 0:h[e][l])||a,x=m.useMemo(()=>v,Object.values(v));return m.createElement(b.Provider,{value:x},g)}function u(f,h){const g=(h==null?void 0:h[e][l])||a,v=m.useContext(g);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return c.displayName=i+"Provider",[c,u]}const o=()=>{const i=n.map(s=>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,bB(o,...t)]}function bB(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(i)[`__scope${c}`];return{...a,...f}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function yB(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function cs(...e){return t=>e.forEach(n=>yB(n,t))}function _t(...e){return m.useCallback(cs(...e),e)}const M0=m.forwardRef((e,t)=>{const{children:n,...r}=e,o=m.Children.toArray(n),i=o.find(wB);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(I0,he({},r,{ref:t}),m.isValidElement(s)?m.cloneElement(s,void 0,a):null)}return m.createElement(I0,he({},r,{ref:t}),n)});M0.displayName="Slot";const I0=m.forwardRef((e,t)=>{const{children:n,...r}=e;return m.isValidElement(n)?m.cloneElement(n,{..._B(r,n.props),ref:t?cs(t,n.ref):n.ref}):m.Children.count(n)>1?m.Children.only(null):null});I0.displayName="SlotClone";const xB=({children:e})=>m.createElement(m.Fragment,null,e);function wB(e){return m.isValidElement(e)&&e.type===xB}function _B(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 lm(e){const t=e+"CollectionProvider",[n,r]=Zn(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=g=>{const{scope:v,children:b}=g,x=m.useRef(null),w=m.useRef(new Map).current;return m.createElement(o,{scope:v,itemMap:w,collectionRef:x},b)},a=e+"CollectionSlot",l=m.forwardRef((g,v)=>{const{scope:b,children:x}=g,w=i(a,b),_=_t(v,w.collectionRef);return m.createElement(M0,{ref:_},x)}),c=e+"CollectionItemSlot",u="data-radix-collection-item",f=m.forwardRef((g,v)=>{const{scope:b,children:x,...w}=g,_=m.useRef(null),S=_t(v,_),R=i(c,b);return m.useEffect(()=>(R.itemMap.set(_,{ref:_,...w}),()=>void R.itemMap.delete(_))),m.createElement(M0,{[u]:"",ref:S},x)});function h(g){const v=i(e+"CollectionConsumer",g);return m.useCallback(()=>{const x=v.collectionRef.current;if(!x)return[];const w=Array.from(x.querySelectorAll(`[${u}]`));return Array.from(v.itemMap.values()).sort((R,C)=>w.indexOf(R.ref.current)-w.indexOf(C.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:s,Slot:l,ItemSlot:f},h,r]}const ur=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},SB=V.useId||(()=>{});let CB=0;function Jo(e){const[t,n]=V.useState(SB());return ur(()=>{e||n(r=>r??String(CB++))},[e]),e||(t?`radix-${t}`:"")}const SD=m.forwardRef((e,t)=>{const{children:n,...r}=e,o=m.Children.toArray(n),i=o.find(RB);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(N0,he({},r,{ref:t}),m.isValidElement(s)?m.cloneElement(s,void 0,a):null)}return m.createElement(N0,he({},r,{ref:t}),n)});SD.displayName="Slot";const N0=m.forwardRef((e,t)=>{const{children:n,...r}=e;return m.isValidElement(n)?m.cloneElement(n,{...OB(r,n.props),ref:t?cs(t,n.ref):n.ref}):m.Children.count(n)>1?m.Children.only(null):null});N0.displayName="SlotClone";const EB=({children:e})=>m.createElement(m.Fragment,null,e);function RB(e){return m.isValidElement(e)&&e.type===EB}function OB(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}const PB=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Qe=PB.reduce((e,t)=>{const n=m.forwardRef((r,o)=>{const{asChild:i,...s}=r,a=i?SD:t;return m.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),m.createElement(a,he({},s,{ref:o}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function CD(e,t){e&&ko.flushSync(()=>e.dispatchEvent(t))}function Ln(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 xr({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=TB({defaultProp:t,onChange:n}),i=e!==void 0,s=i?e:r,a=Ln(n),l=m.useCallback(c=>{if(i){const f=typeof c=="function"?c(e):c;f!==e&&a(f)}else o(c)},[i,e,o,a]);return[s,l]}function TB({defaultProp:e,onChange:t}){const n=m.useState(e),[r]=n,o=m.useRef(r),i=Ln(t);return m.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}const DB=m.createContext(void 0);function _l(e){const t=m.useContext(DB);return e||t||"ltr"}const Db="rovingFocusGroup.onEntryFocus",$B={bubbles:!1,cancelable:!0},Ew="RovingFocusGroup",[L0,ED,AB]=lm(Ew),[kB,ou]=Zn(Ew,[AB]),[MB,IB]=kB(Ew),NB=m.forwardRef((e,t)=>m.createElement(L0.Provider,{scope:e.__scopeRovingFocusGroup},m.createElement(L0.Slot,{scope:e.__scopeRovingFocusGroup},m.createElement(LB,he({},e,{ref:t}))))),LB=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,...u}=e,f=m.useRef(null),h=_t(t,f),g=_l(i),[v=null,b]=xr({prop:s,defaultProp:a,onChange:l}),[x,w]=m.useState(!1),_=Ln(c),S=ED(n),R=m.useRef(!1),[C,P]=m.useState(0);return m.useEffect(()=>{const A=f.current;if(A)return A.addEventListener(Db,_),()=>A.removeEventListener(Db,_)},[_]),m.createElement(MB,{scope:n,orientation:r,dir:g,loop:o,currentTabStopId:v,onItemFocus:m.useCallback(A=>b(A),[b]),onItemShiftTab:m.useCallback(()=>w(!0),[]),onFocusableItemAdd:m.useCallback(()=>P(A=>A+1),[]),onFocusableItemRemove:m.useCallback(()=>P(A=>A-1),[])},m.createElement(Qe.div,he({tabIndex:x||C===0?-1:0,"data-orientation":r},u,{ref:h,style:{outline:"none",...e.style},onMouseDown:Me(e.onMouseDown,()=>{R.current=!0}),onFocus:Me(e.onFocus,A=>{const k=!R.current;if(A.target===A.currentTarget&&k&&!x){const D=new CustomEvent(Db,$B);if(A.currentTarget.dispatchEvent(D),!D.defaultPrevented){const I=S().filter(z=>z.focusable),F=I.find(z=>z.active),B=I.find(z=>z.id===v),Z=[F,B,...I].filter(Boolean).map(z=>z.ref.current);RD(Z)}}R.current=!1}),onBlur:Me(e.onBlur,()=>w(!1))})))}),FB="RovingFocusGroupItem",jB=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,...s}=e,a=Jo(),l=i||a,c=IB(FB,n),u=c.currentTabStopId===l,f=ED(n),{onFocusableItemAdd:h,onFocusableItemRemove:g}=c;return m.useEffect(()=>{if(r)return h(),()=>g()},[r,h,g]),m.createElement(L0.ItemSlot,{scope:n,id:l,focusable:r,active:o},m.createElement(Qe.span,he({tabIndex:u?0:-1,"data-orientation":c.orientation},s,{ref:t,onMouseDown:Me(e.onMouseDown,v=>{r?c.onItemFocus(l):v.preventDefault()}),onFocus:Me(e.onFocus,()=>c.onItemFocus(l)),onKeyDown:Me(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){c.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const b=VB(v,c.orientation,c.dir);if(b!==void 0){v.preventDefault();let w=f().filter(_=>_.focusable).map(_=>_.ref.current);if(b==="last")w.reverse();else if(b==="prev"||b==="next"){b==="prev"&&w.reverse();const _=w.indexOf(v.currentTarget);w=c.loop?HB(w,_+1):w.slice(_+1)}setTimeout(()=>RD(w))}})})))}),zB={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function BB(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function VB(e,t,n){const r=BB(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return zB[r]}function RD(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function HB(e,t){return e.map((n,r)=>e[(t+r)%e.length])}const Rw=NB,Ow=jB;function WB(e,t){return m.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const er=e=>{const{present:t,children:n}=e,r=UB(t),o=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),i=_t(r.ref,o.ref);return typeof n=="function"||r.isPresent?m.cloneElement(o,{ref:i}):null};er.displayName="Presence";function UB(e){const[t,n]=m.useState(),r=m.useRef({}),o=m.useRef(e),i=m.useRef("none"),s=e?"mounted":"unmounted",[a,l]=WB(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const c=Uh(r.current);i.current=a==="mounted"?c:"none"},[a]),ur(()=>{const c=r.current,u=o.current;if(u!==e){const h=i.current,g=Uh(c);e?l("MOUNT"):g==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&h!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),ur(()=>{if(t){const c=f=>{const g=Uh(r.current).includes(f.animationName);f.target===t&&g&&ko.flushSync(()=>l("ANIMATION_END"))},u=f=>{f.target===t&&(i.current=Uh(r.current))};return t.addEventListener("animationstart",u),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{t.removeEventListener("animationstart",u),t.removeEventListener("animationcancel",c),t.removeEventListener("animationend",c)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:m.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function Uh(e){return(e==null?void 0:e.animationName)||"none"}const OD="Tabs",[qB,tye]=Zn(OD,[ou]),PD=ou(),[GB,Pw]=qB(OD),YB=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:l="automatic",...c}=e,u=_l(a),[f,h]=xr({prop:r,onChange:o,defaultProp:i});return m.createElement(GB,{scope:n,baseId:Jo(),value:f,onValueChange:h,orientation:s,dir:u,activationMode:l},m.createElement(Qe.div,he({dir:u,"data-orientation":s},c,{ref:t})))}),KB="TabsList",XB=m.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=Pw(KB,n),s=PD(n);return m.createElement(Rw,he({asChild:!0},s,{orientation:i.orientation,dir:i.dir,loop:r}),m.createElement(Qe.div,he({role:"tablist","aria-orientation":i.orientation},o,{ref:t})))}),QB="TabsTrigger",JB=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=Pw(QB,n),a=PD(n),l=TD(s.baseId,r),c=DD(s.baseId,r),u=r===s.value;return m.createElement(Ow,he({asChild:!0},a,{focusable:!o,active:u}),m.createElement(Qe.button,he({type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:l},i,{ref:t,onMouseDown:Me(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:Me(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:Me(e.onFocus,()=>{const f=s.activationMode!=="manual";!u&&!o&&f&&s.onValueChange(r)})})))}),ZB="TabsContent",eV=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=Pw(ZB,n),l=TD(a.baseId,r),c=DD(a.baseId,r),u=r===a.value,f=m.useRef(u);return m.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),m.createElement(er,{present:o||u},({present:h})=>m.createElement(Qe.div,he({"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!h,id:c,tabIndex:0},s,{ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0}}),h&&i))});function TD(e,t){return`${e}-trigger-${t}`}function DD(e,t){return`${e}-content-${t}`}const tV=YB,$D=XB,AD=JB,kD=eV,MD=tV,Tw=V.forwardRef(({className:e,...t},n)=>O.jsx($D,{ref:n,className:Ee("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Tw.displayName=$D.displayName;const Dw=V.forwardRef(({className:e,...t},n)=>O.jsx(AD,{ref:n,className:Ee("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}));Dw.displayName=AD.displayName;const $w=V.forwardRef(({className:e,...t},n)=>O.jsx(kD,{ref:n,className:Ee("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));$w.displayName=kD.displayName;var ID={exports:{}},$f={},F0={exports:{}};(function(e,t){(function(n,r){r(t)})(Vs,function(n){function r(ie){return function(ae,ye,G,be,_e,Pe,Te){return ie(ae,ye,Te)}}function o(ie){return function(ae,ye,G,be){if(!ae||!ye||typeof ae!="object"||typeof ye!="object")return ie(ae,ye,G,be);var _e=be.get(ae),Pe=be.get(ye);if(_e&&Pe)return _e===ye&&Pe===ae;be.set(ae,ye),be.set(ye,ae);var Te=ie(ae,ye,G,be);return be.delete(ae),be.delete(ye),Te}}function i(ie,te){var ae={};for(var ye in ie)ae[ye]=ie[ye];for(var ye in te)ae[ye]=te[ye];return ae}function s(ie){return ie.constructor===Object||ie.constructor==null}function a(ie){return typeof ie.then=="function"}function l(ie,te){return ie===te||ie!==ie&&te!==te}var c="[object Arguments]",u="[object Boolean]",f="[object Date]",h="[object RegExp]",g="[object Map]",v="[object Number]",b="[object Object]",x="[object Set]",w="[object String]",_=Object.prototype.toString;function S(ie){var te=ie.areArraysEqual,ae=ie.areDatesEqual,ye=ie.areMapsEqual,G=ie.areObjectsEqual,be=ie.areRegExpsEqual,_e=ie.areSetsEqual,Pe=ie.createIsNestedEqual,Te=Pe(Ue);function Ue(Be,Ie,Ke){if(Be===Ie)return!0;if(!Be||!Ie||typeof Be!="object"||typeof Ie!="object")return Be!==Be&&Ie!==Ie;if(s(Be)&&s(Ie))return G(Be,Ie,Te,Ke);var lt=Array.isArray(Be),It=Array.isArray(Ie);if(lt||It)return lt===It&&te(Be,Ie,Te,Ke);var $t=_.call(Be);return $t!==_.call(Ie)?!1:$t===f?ae(Be,Ie,Te,Ke):$t===h?be(Be,Ie,Te,Ke):$t===g?ye(Be,Ie,Te,Ke):$t===x?_e(Be,Ie,Te,Ke):$t===b||$t===c?a(Be)||a(Ie)?!1:G(Be,Ie,Te,Ke):$t===u||$t===v||$t===w?l(Be.valueOf(),Ie.valueOf()):!1}return Ue}function R(ie,te,ae,ye){var G=ie.length;if(te.length!==G)return!1;for(;G-- >0;)if(!ae(ie[G],te[G],G,G,ie,te,ye))return!1;return!0}var C=o(R);function P(ie,te){return l(ie.valueOf(),te.valueOf())}function A(ie,te,ae,ye){var G=ie.size===te.size;if(!G)return!1;if(!ie.size)return!0;var be={},_e=0;return ie.forEach(function(Pe,Te){if(G){var Ue=!1,Be=0;te.forEach(function(Ie,Ke){!Ue&&!be[Be]&&(Ue=ae(Te,Ke,_e,Be,ie,te,ye)&&ae(Pe,Ie,Te,Ke,ie,te,ye))&&(be[Be]=!0),Be++}),_e++,G=Ue}}),G}var k=o(A),D="_owner",I=Object.prototype.hasOwnProperty;function F(ie,te,ae,ye){var G=Object.keys(ie),be=G.length;if(Object.keys(te).length!==be)return!1;for(var _e;be-- >0;){if(_e=G[be],_e===D){var Pe=!!ie.$$typeof,Te=!!te.$$typeof;if((Pe||Te)&&Pe!==Te)return!1}if(!I.call(te,_e)||!ae(ie[_e],te[_e],_e,_e,ie,te,ye))return!1}return!0}var B=o(F);function K(ie,te){return ie.source===te.source&&ie.flags===te.flags}function Z(ie,te,ae,ye){var G=ie.size===te.size;if(!G)return!1;if(!ie.size)return!0;var be={};return ie.forEach(function(_e,Pe){if(G){var Te=!1,Ue=0;te.forEach(function(Be,Ie){!Te&&!be[Ue]&&(Te=ae(_e,Be,Pe,Ie,ie,te,ye))&&(be[Ue]=!0),Ue++}),G=Te}}),G}var z=o(Z),Q=Object.freeze({areArraysEqual:R,areDatesEqual:P,areMapsEqual:A,areObjectsEqual:F,areRegExpsEqual:K,areSetsEqual:Z,createIsNestedEqual:r}),W=Object.freeze({areArraysEqual:C,areDatesEqual:P,areMapsEqual:k,areObjectsEqual:B,areRegExpsEqual:K,areSetsEqual:z,createIsNestedEqual:r}),Y=S(Q);function oe(ie,te){return Y(ie,te,void 0)}var $=S(i(Q,{createIsNestedEqual:function(){return l}}));function H(ie,te){return $(ie,te,void 0)}var J=S(W);function N(ie,te){return J(ie,te,new WeakMap)}var ce=S(i(W,{createIsNestedEqual:function(){return l}}));function le(ie,te){return ce(ie,te,new WeakMap)}function de(ie){return S(i(Q,ie(Q)))}function pe(ie){var te=S(i(W,ie(W)));return function(ae,ye,G){return G===void 0&&(G=new WeakMap),te(ae,ye,G)}}n.circularDeepEqual=N,n.circularShallowEqual=le,n.createCustomCircularEqual=pe,n.createCustomEqual=de,n.deepEqual=oe,n.sameValueZeroEqual=l,n.shallowEqual=H,Object.defineProperty(n,"__esModule",{value:!0})})})(F0,F0.exports);var Aw=F0.exports;const kw=dw(yj);var Ot={},nV=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(Ot,"__esModule",{value:!0});Ot.bottom=Mw;Ot.childrenEqual=sV;Ot.cloneLayout=ND;Ot.cloneLayoutItem=il;Ot.collides=cm;Ot.compact=FD;Ot.compactItem=jD;Ot.compactType=xV;Ot.correctBounds=zD;Ot.fastPositionEqual=lV;Ot.fastRGLPropsEqual=void 0;Ot.getAllCollisions=BD;Ot.getFirstCollision=qa;Ot.getLayoutItem=Iw;Ot.getStatics=Nw;Ot.modifyLayout=LD;Ot.moveElement=td;Ot.moveElementAwayFromCollision=z0;Ot.noop=void 0;Ot.perc=uV;Ot.resizeItemInDirection=mV;Ot.setTopLeft=bV;Ot.setTransform=vV;Ot.sortLayoutItems=Vw;Ot.sortLayoutItemsByColRow=qD;Ot.sortLayoutItemsByRowCol=UD;Ot.synchronizeLayoutWithChildren=yV;Ot.validateLayout=GD;Ot.withLayoutItem=iV;var uR=Aw,ed=rV(m);function rV(e){return e&&e.__esModule?e:{default:e}}const oV=process.env.NODE_ENV==="production";function Mw(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 ND(e){const t=Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=il(e[n]);return t}function LD(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 iV(e,t,n){let r=Iw(e,t);return r?(r=n(il(r)),e=LD(e,r),[e,r]):[e,null]}function il(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 sV(e,t){return(0,uR.deepEqual)(ed.default.Children.map(e,n=>n==null?void 0:n.key),ed.default.Children.map(t,n=>n==null?void 0:n.key))&&(0,uR.deepEqual)(ed.default.Children.map(e,n=>n==null?void 0:n.props["data-grid"]),ed.default.Children.map(t,n=>n==null?void 0:n.props["data-grid"]))}const aV=nV;Ot.fastRGLPropsEqual=aV;function lV(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function cm(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 FD(e,t,n,r){const o=Nw(e),i=Vw(e,t),s=Array(e.length);for(let a=0,l=i.length;a<l;a++){let c=il(i[a]);c.static||(c=jD(o,c,t,n,i,r),o.push(c)),s[e.indexOf(i[a])]=c,c.moved=!1}return s}const cV={x:"w",y:"h"};function j0(e,t,n,r){const o=cV[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;cm(t,a)&&j0(e,a,n+t[o],r)}}t[r]=n}function jD(e,t,n,r,o,i){const s=n==="vertical",a=n==="horizontal";if(s)for(t.y=Math.min(Mw(e),t.y);t.y>0&&!qa(e,t);)t.y--;else if(a)for(;t.x>0&&!qa(e,t);)t.x--;let l;for(;(l=qa(e,t))&&!(n===null&&i);)if(a?j0(o,t,l.x+l.w,"x"):j0(o,t,l.y+l.h,"y"),a&&t.x+t.w>r)for(t.x=r-t.w,t.y++;t.x>0&&!qa(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function zD(e,t){const n=Nw(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(;qa(n,i);)i.y++}return e}function Iw(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function qa(e,t){for(let n=0,r=e.length;n<r;n++)if(cm(e[n],t))return e[n]}function BD(e,t){return e.filter(n=>cm(n,t))}function Nw(e){return e.filter(t=>t.static)}function td(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 c=t.x,u=t.y;typeof n=="number"&&(t.x=n),typeof r=="number"&&(t.y=r),t.moved=!0;let f=Vw(e,s);(s==="vertical"&&typeof r=="number"?u>=r:s==="horizontal"&&typeof n=="number"?c>=n:!1)&&(f=f.reverse());const g=BD(f,t),v=g.length>0;if(v&&l)return ND(e);if(v&&i)return"Collision prevented on ".concat(t.i,", reverting."),t.x=c,t.y=u,t.moved=!1,e;for(let b=0,x=g.length;b<x;b++){const w=g[b];"Resolving collision between ".concat(t.i," at [").concat(t.x,",").concat(t.y,"] and ").concat(w.i," at [").concat(w.x,",").concat(w.y,"]"),!w.moved&&(w.static?e=z0(e,w,t,o,s):e=z0(e,t,w,o,s))}return e}function z0(e,t,n,r,o,i){const s=o==="horizontal",a=o==="vertical",l=t.static;if(r){r=!1;const f={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"},h=qa(e,f),g=h&&h.y+h.h>t.y,v=h&&t.x+t.w>h.x;if(h){if(g&&a)return td(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(v&&s)return td(e,t,n.x,void 0,r,l,o)}else return"Doing reverse collision on ".concat(n.i," up to [").concat(f.x,",").concat(f.y,"]."),td(e,n,s?f.x:void 0,a?f.y:void 0,r,l,o)}const c=s?n.x+1:void 0,u=a?n.y+1:void 0;return c==null&&u==null?e:td(e,n,s?n.x+1:void 0,a?n.y+1:void 0,r,l,o)}function uV(e){return e*100+"%"}const VD=(e,t,n,r)=>e+n>r?t:n,HD=(e,t,n)=>e<0?t:n,WD=e=>Math.max(0,e),Lw=e=>Math.max(0,e),Fw=(e,t,n)=>{let{left:r,height:o,width:i}=t;const s=e.top-(o-e.height);return{left:r,width:i,height:HD(s,e.height,o),top:Lw(s)}},jw=(e,t,n)=>{let{top:r,left:o,height:i,width:s}=t;return{top:r,height:i,width:VD(e.left,e.width,s,n),left:WD(o)}},zw=(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:VD(e.left,e.width,i,n),top:Lw(r),left:WD(s)}},Bw=(e,t,n)=>{let{top:r,left:o,height:i,width:s}=t;return{width:s,left:o,height:HD(r,e.height,i),top:Lw(r)}},dV=function(){return Fw(arguments.length<=0?void 0:arguments[0],jw(...arguments))},fV=function(){return Fw(arguments.length<=0?void 0:arguments[0],zw(...arguments))},hV=function(){return Bw(arguments.length<=0?void 0:arguments[0],jw(...arguments))},pV=function(){return Bw(arguments.length<=0?void 0:arguments[0],zw(...arguments))},gV={n:Fw,ne:dV,e:jw,se:hV,s:Bw,sw:pV,w:zw,nw:fV};function mV(e,t,n,r){const o=gV[e];return o?o(t,{...t,...n},r):n}function vV(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 bV(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 Vw(e,t){return t==="horizontal"?qD(e):t==="vertical"?UD(e):e}function UD(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 qD(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 yV(e,t,n,r,o){e=e||[];const i=[];ed.default.Children.forEach(t,a=>{if((a==null?void 0:a.key)==null)return;const l=Iw(e,String(a.key)),c=a.props["data-grid"];l&&c==null?i.push(il(l)):c?(oV||GD([c],"ReactGridLayout.children"),i.push(il({...c,i:a.key}))):i.push(il({w:1,h:1,x:0,y:Mw(i),i:String(a.key)}))});const s=zD(i,{cols:n});return o?s:FD(s,r,n)}function GD(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 xV(e){const{verticalCompact:t,compactType:n}=e||{};return t===!1?null:n}const wV=()=>{};Ot.noop=wV;var Ri={};Object.defineProperty(Ri,"__esModule",{value:!0});Ri.calcGridColWidth=um;Ri.calcGridItemPosition=_V;Ri.calcGridItemWHPx=B0;Ri.calcWH=CV;Ri.calcXY=SV;Ri.clamp=Ga;function um(e){const{margin:t,containerPadding:n,containerWidth:r,cols:o}=e;return(r-t[0]*(o-1)-n[0]*2)/o}function B0(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function _V(e,t,n,r,o,i){const{margin:s,containerPadding:a,rowHeight:l}=e,c=um(e),u={};return i&&i.resizing?(u.width=Math.round(i.resizing.width),u.height=Math.round(i.resizing.height)):(u.width=B0(r,c,s[0]),u.height=B0(o,l,s[1])),i&&i.dragging?(u.top=Math.round(i.dragging.top),u.left=Math.round(i.dragging.left)):i&&i.resizing&&typeof i.resizing.top=="number"&&typeof i.resizing.left=="number"?(u.top=Math.round(i.resizing.top),u.left=Math.round(i.resizing.left)):(u.top=Math.round((l+s[1])*n+a[1]),u.left=Math.round((c+s[0])*t+a[0])),u}function SV(e,t,n,r,o){const{margin:i,cols:s,rowHeight:a,maxRows:l}=e,c=um(e);let u=Math.round((n-i[0])/(c+i[0])),f=Math.round((t-i[1])/(a+i[1]));return u=Ga(u,0,s-r),f=Ga(f,0,l-o),{x:u,y:f}}function CV(e,t,n,r,o,i){const{margin:s,maxRows:a,cols:l,rowHeight:c}=e,u=um(e);let f=Math.round((t+s[0])/(u+s[0])),h=Math.round((n+s[1])/(c+s[1])),g=Ga(f,0,l-r),v=Ga(h,0,a-o);return["sw","w","nw"].indexOf(i)!==-1&&(g=Ga(f,0,l)),["nw","n","ne"].indexOf(i)!==-1&&(v=Ga(h,0,a)),{w:g,h:v}}function Ga(e,t,n){return Math.max(Math.min(e,n),t)}var dm={},V0={exports:{}},$b,dR;function Hw(){if(dR)return $b;dR=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return $b=e,$b}var Ab,fR;function EV(){if(fR)return Ab;fR=1;var e=Hw();function t(){}function n(){}return n.resetWarningCache=t,Ab=function(){function r(s,a,l,c,u,f){if(f!==e){var h=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 h.name="Invariant Violation",h}}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},Ab}var qh={exports:{}},qt={};/** @license React v16.13.1
|
|
88
|
+
}`;var yt=kE(function(){return jt(j,Ye+"return "+Re).apply(n,U)});if(yt.source=Re,ub(yt))throw yt;return yt}function _8(d){return Ut(d).toLowerCase()}function S8(d){return Ut(d).toUpperCase()}function C8(d,p,y){if(d=Ut(d),d&&(y||p===n))return VS(d);if(!d||!(p=Vr(p)))return d;var E=jo(d),M=jo(p),j=HS(E,M),U=WS(E,M)+1;return Os(E,j,U).join("")}function E8(d,p,y){if(d=Ut(d),d&&(y||p===n))return d.slice(0,qS(d)+1);if(!d||!(p=Vr(p)))return d;var E=jo(d),M=WS(E,jo(p))+1;return Os(E,0,M).join("")}function R8(d,p,y){if(d=Ut(d),d&&(y||p===n))return d.replace(jn,"");if(!d||!(p=Vr(p)))return d;var E=jo(d),M=HS(E,jo(p));return Os(E,M).join("")}function O8(d,p){var y=I,E=F;if(wn(p)){var M="separator"in p?p.separator:M;y="length"in p?pt(p.length):y,E="omission"in p?Vr(p.omission):E}d=Ut(d);var j=d.length;if(Nl(d)){var U=jo(d);j=U.length}if(y>=j)return d;var X=y-Ll(E);if(X<1)return E;var se=U?Os(U,0,X).join(""):d.slice(0,X);if(M===n)return se+E;if(U&&(X+=se.length-X),db(M)){if(d.slice(X).search(M)){var xe,we=se;for(M.global||(M=Ov(M.source,Ut(qe.exec(M))+"g")),M.lastIndex=0;xe=M.exec(we);)var Re=xe.index;se=se.slice(0,Re===n?X:Re)}}else if(d.indexOf(Vr(M),X)!=X){var je=se.lastIndexOf(M);je>-1&&(se=se.slice(0,je))}return se+E}function P8(d){return d=Ut(d),d&&Rn.test(d)?d.replace(Xt,rF):d}var T8=Wl(function(d,p,y){return d+(y?" ":"")+p.toUpperCase()}),pb=MC("toUpperCase");function AE(d,p,y){return d=Ut(d),p=y?n:p,p===n?J3(d)?sF(d):H3(d):d.match(p)||[]}var kE=St(function(d,p){try{return zr(d,n,p)}catch(y){return ub(y)?y:new ct(y)}}),D8=Fi(function(d,p){return mo(p,function(y){y=ai(y),Ni(d,y,lb(d[y],d))}),d});function $8(d){var p=d==null?0:d.length,y=Je();return d=p?yn(d,function(E){if(typeof E[1]!="function")throw new vo(s);return[y(E[0]),E[1]]}):[],St(function(E){for(var M=-1;++M<p;){var j=d[M];if(zr(j[0],this,E))return zr(j[1],this,E)}})}function A8(d){return r7(yo(d,f))}function gb(d){return function(){return d}}function k8(d,p){return d==null||d!==d?p:d}var M8=NC(),I8=NC(!0);function Er(d){return d}function mb(d){return fC(typeof d=="function"?d:yo(d,f))}function N8(d){return pC(yo(d,f))}function L8(d,p){return gC(d,yo(p,f))}var F8=St(function(d,p){return function(y){return _u(y,d,p)}}),j8=St(function(d,p){return function(y){return _u(d,y,p)}});function vb(d,p,y){var E=Bn(p),M=wh(p,E);y==null&&!(wn(p)&&(M.length||!E.length))&&(y=p,p=d,d=this,M=wh(p,Bn(p)));var j=!(wn(y)&&"chain"in y)||!!y.chain,U=zi(d);return mo(M,function(X){var se=p[X];d[X]=se,U&&(d.prototype[X]=function(){var xe=this.__chain__;if(j||xe){var we=d(this.__wrapped__),Re=we.__actions__=_r(this.__actions__);return Re.push({func:se,args:arguments,thisArg:d}),we.__chain__=xe,we}return se.apply(d,ws([this.value()],arguments))})}),d}function z8(){return qn._===this&&(qn._=fF),this}function bb(){}function B8(d){return d=pt(d),St(function(p){return mC(p,d)})}var V8=Kv(yn),H8=Kv(LS),W8=Kv(xv);function ME(d){return nb(d)?wv(ai(d)):x7(d)}function U8(d){return function(p){return d==null?n:Ea(d,p)}}var q8=FC(),G8=FC(!0);function yb(){return[]}function xb(){return!1}function Y8(){return{}}function K8(){return""}function X8(){return!0}function Q8(d,p){if(d=pt(d),d<1||d>Y)return[];var y=H,E=nr(d,H);p=Je(p),d-=H;for(var M=Cv(E,p);++y<d;)p(y);return M}function J8(d){return ut(d)?yn(d,ai):Hr(d)?[d]:_r(eE(Ut(d)))}function Z8(d){var p=++uF;return Ut(d)+p}var ej=Oh(function(d,p){return d+p},0),tj=Xv("ceil"),nj=Oh(function(d,p){return d/p},1),rj=Xv("floor");function oj(d){return d&&d.length?xh(d,Er,Iv):n}function ij(d,p){return d&&d.length?xh(d,Je(p,2),Iv):n}function sj(d){return zS(d,Er)}function aj(d,p){return zS(d,Je(p,2))}function lj(d){return d&&d.length?xh(d,Er,jv):n}function cj(d,p){return d&&d.length?xh(d,Je(p,2),jv):n}var uj=Oh(function(d,p){return d*p},1),dj=Xv("round"),fj=Oh(function(d,p){return d-p},0);function hj(d){return d&&d.length?Sv(d,Er):0}function pj(d,p){return d&&d.length?Sv(d,Je(p,2)):0}return L.after=N9,L.ary=dE,L.assign=S4,L.assignIn=EE,L.assignInWith=zh,L.assignWith=C4,L.at=E4,L.before=fE,L.bind=lb,L.bindAll=D8,L.bindKey=hE,L.castArray=Y9,L.chain=lE,L.chunk=r6,L.compact=o6,L.concat=i6,L.cond=$8,L.conforms=A8,L.constant=gb,L.countBy=h9,L.create=R4,L.curry=pE,L.curryRight=gE,L.debounce=mE,L.defaults=O4,L.defaultsDeep=P4,L.defer=L9,L.delay=F9,L.difference=s6,L.differenceBy=a6,L.differenceWith=l6,L.drop=c6,L.dropRight=u6,L.dropRightWhile=d6,L.dropWhile=f6,L.fill=h6,L.filter=g9,L.flatMap=b9,L.flatMapDeep=y9,L.flatMapDepth=x9,L.flatten=oE,L.flattenDeep=p6,L.flattenDepth=g6,L.flip=j9,L.flow=M8,L.flowRight=I8,L.fromPairs=m6,L.functions=I4,L.functionsIn=N4,L.groupBy=w9,L.initial=b6,L.intersection=y6,L.intersectionBy=x6,L.intersectionWith=w6,L.invert=F4,L.invertBy=j4,L.invokeMap=S9,L.iteratee=mb,L.keyBy=C9,L.keys=Bn,L.keysIn=Cr,L.map=Mh,L.mapKeys=B4,L.mapValues=V4,L.matches=N8,L.matchesProperty=L8,L.memoize=Nh,L.merge=H4,L.mergeWith=RE,L.method=F8,L.methodOf=j8,L.mixin=vb,L.negate=Lh,L.nthArg=B8,L.omit=W4,L.omitBy=U4,L.once=z9,L.orderBy=E9,L.over=V8,L.overArgs=B9,L.overEvery=H8,L.overSome=W8,L.partial=cb,L.partialRight=vE,L.partition=R9,L.pick=q4,L.pickBy=OE,L.property=ME,L.propertyOf=U8,L.pull=E6,L.pullAll=sE,L.pullAllBy=R6,L.pullAllWith=O6,L.pullAt=P6,L.range=q8,L.rangeRight=G8,L.rearg=V9,L.reject=T9,L.remove=T6,L.rest=H9,L.reverse=sb,L.sampleSize=$9,L.set=Y4,L.setWith=K4,L.shuffle=A9,L.slice=D6,L.sortBy=I9,L.sortedUniq=L6,L.sortedUniqBy=F6,L.split=b8,L.spread=W9,L.tail=j6,L.take=z6,L.takeRight=B6,L.takeRightWhile=V6,L.takeWhile=H6,L.tap=o9,L.throttle=U9,L.thru=kh,L.toArray=_E,L.toPairs=PE,L.toPairsIn=TE,L.toPath=J8,L.toPlainObject=CE,L.transform=X4,L.unary=q9,L.union=W6,L.unionBy=U6,L.unionWith=q6,L.uniq=G6,L.uniqBy=Y6,L.uniqWith=K6,L.unset=Q4,L.unzip=ab,L.unzipWith=aE,L.update=J4,L.updateWith=Z4,L.values=Gl,L.valuesIn=e8,L.without=X6,L.words=AE,L.wrap=G9,L.xor=Q6,L.xorBy=J6,L.xorWith=Z6,L.zip=e9,L.zipObject=t9,L.zipObjectDeep=n9,L.zipWith=r9,L.entries=PE,L.entriesIn=TE,L.extend=EE,L.extendWith=zh,vb(L,L),L.add=ej,L.attempt=kE,L.camelCase=o8,L.capitalize=DE,L.ceil=tj,L.clamp=t8,L.clone=K9,L.cloneDeep=Q9,L.cloneDeepWith=J9,L.cloneWith=X9,L.conformsTo=Z9,L.deburr=$E,L.defaultTo=k8,L.divide=nj,L.endsWith=i8,L.eq=Bo,L.escape=s8,L.escapeRegExp=a8,L.every=p9,L.find=m9,L.findIndex=nE,L.findKey=T4,L.findLast=v9,L.findLastIndex=rE,L.findLastKey=D4,L.floor=rj,L.forEach=cE,L.forEachRight=uE,L.forIn=$4,L.forInRight=A4,L.forOwn=k4,L.forOwnRight=M4,L.get=fb,L.gt=e4,L.gte=t4,L.has=L4,L.hasIn=hb,L.head=iE,L.identity=Er,L.includes=_9,L.indexOf=v6,L.inRange=n8,L.invoke=z4,L.isArguments=Pa,L.isArray=ut,L.isArrayBuffer=n4,L.isArrayLike=Sr,L.isArrayLikeObject=On,L.isBoolean=r4,L.isBuffer=Ps,L.isDate=o4,L.isElement=i4,L.isEmpty=s4,L.isEqual=a4,L.isEqualWith=l4,L.isError=ub,L.isFinite=c4,L.isFunction=zi,L.isInteger=bE,L.isLength=Fh,L.isMap=yE,L.isMatch=u4,L.isMatchWith=d4,L.isNaN=f4,L.isNative=h4,L.isNil=g4,L.isNull=p4,L.isNumber=xE,L.isObject=wn,L.isObjectLike=Sn,L.isPlainObject=Pu,L.isRegExp=db,L.isSafeInteger=m4,L.isSet=wE,L.isString=jh,L.isSymbol=Hr,L.isTypedArray=ql,L.isUndefined=v4,L.isWeakMap=b4,L.isWeakSet=y4,L.join=_6,L.kebabCase=l8,L.last=wo,L.lastIndexOf=S6,L.lowerCase=c8,L.lowerFirst=u8,L.lt=x4,L.lte=w4,L.max=oj,L.maxBy=ij,L.mean=sj,L.meanBy=aj,L.min=lj,L.minBy=cj,L.stubArray=yb,L.stubFalse=xb,L.stubObject=Y8,L.stubString=K8,L.stubTrue=X8,L.multiply=uj,L.nth=C6,L.noConflict=z8,L.noop=bb,L.now=Ih,L.pad=d8,L.padEnd=f8,L.padStart=h8,L.parseInt=p8,L.random=r8,L.reduce=O9,L.reduceRight=P9,L.repeat=g8,L.replace=m8,L.result=G4,L.round=dj,L.runInContext=ne,L.sample=D9,L.size=k9,L.snakeCase=v8,L.some=M9,L.sortedIndex=$6,L.sortedIndexBy=A6,L.sortedIndexOf=k6,L.sortedLastIndex=M6,L.sortedLastIndexBy=I6,L.sortedLastIndexOf=N6,L.startCase=y8,L.startsWith=x8,L.subtract=fj,L.sum=hj,L.sumBy=pj,L.template=w8,L.times=Q8,L.toFinite=Bi,L.toInteger=pt,L.toLength=SE,L.toLower=_8,L.toNumber=_o,L.toSafeInteger=_4,L.toString=Ut,L.toUpper=S8,L.trim=C8,L.trimEnd=E8,L.trimStart=R8,L.truncate=O8,L.unescape=P8,L.uniqueId=Z8,L.upperCase=T8,L.upperFirst=pb,L.each=cE,L.eachRight=uE,L.first=iE,vb(L,function(){var d={};return ii(L,function(p,y){Qt.call(L.prototype,y)||(d[y]=p)}),d}(),{chain:!1}),L.VERSION=r,mo(["bind","bindKey","curry","curryRight","partial","partialRight"],function(d){L[d].placeholder=L}),mo(["drop","take"],function(d,p){kt.prototype[d]=function(y){y=y===n?1:Mn(pt(y),0);var E=this.__filtered__&&!p?new kt(this):this.clone();return E.__filtered__?E.__takeCount__=nr(y,E.__takeCount__):E.__views__.push({size:nr(y,H),type:d+(E.__dir__<0?"Right":"")}),E},kt.prototype[d+"Right"]=function(y){return this.reverse()[d](y).reverse()}}),mo(["filter","map","takeWhile"],function(d,p){var y=p+1,E=y==Z||y==Q;kt.prototype[d]=function(M){var j=this.clone();return j.__iteratees__.push({iteratee:Je(M,3),type:y}),j.__filtered__=j.__filtered__||E,j}}),mo(["head","last"],function(d,p){var y="take"+(p?"Right":"");kt.prototype[d]=function(){return this[y](1).value()[0]}}),mo(["initial","tail"],function(d,p){var y="drop"+(p?"":"Right");kt.prototype[d]=function(){return this.__filtered__?new kt(this):this[y](1)}}),kt.prototype.compact=function(){return this.filter(Er)},kt.prototype.find=function(d){return this.filter(d).head()},kt.prototype.findLast=function(d){return this.reverse().find(d)},kt.prototype.invokeMap=St(function(d,p){return typeof d=="function"?new kt(this):this.map(function(y){return _u(y,d,p)})}),kt.prototype.reject=function(d){return this.filter(Lh(Je(d)))},kt.prototype.slice=function(d,p){d=pt(d);var y=this;return y.__filtered__&&(d>0||p<0)?new kt(y):(d<0?y=y.takeRight(-d):d&&(y=y.drop(d)),p!==n&&(p=pt(p),y=p<0?y.dropRight(-p):y.take(p-d)),y)},kt.prototype.takeRightWhile=function(d){return this.reverse().takeWhile(d).reverse()},kt.prototype.toArray=function(){return this.take(H)},ii(kt.prototype,function(d,p){var y=/^(?:filter|find|map|reject)|While$/.test(p),E=/^(?:head|last)$/.test(p),M=L[E?"take"+(p=="last"?"Right":""):p],j=E||/^find/.test(p);M&&(L.prototype[p]=function(){var U=this.__wrapped__,X=E?[1]:arguments,se=U instanceof kt,xe=X[0],we=se||ut(U),Re=function(Pt){var Mt=M.apply(L,ws([Pt],X));return E&&je?Mt[0]:Mt};we&&y&&typeof xe=="function"&&xe.length!=1&&(se=we=!1);var je=this.__chain__,Ye=!!this.__actions__.length,et=j&&!je,yt=se&&!Ye;if(!j&&we){U=yt?U:new kt(this);var tt=d.apply(U,X);return tt.__actions__.push({func:kh,args:[Re],thisArg:n}),new bo(tt,je)}return et&&yt?d.apply(this,X):(tt=this.thru(Re),et?E?tt.value()[0]:tt.value():tt)})}),mo(["pop","push","shift","sort","splice","unshift"],function(d){var p=ih[d],y=/^(?:push|sort|unshift)$/.test(d)?"tap":"thru",E=/^(?:pop|shift)$/.test(d);L.prototype[d]=function(){var M=arguments;if(E&&!this.__chain__){var j=this.value();return p.apply(ut(j)?j:[],M)}return this[y](function(U){return p.apply(ut(U)?U:[],M)})}}),ii(kt.prototype,function(d,p){var y=L[p];if(y){var E=y.name+"";Qt.call(Bl,E)||(Bl[E]=[]),Bl[E].push({name:p,func:y})}}),Bl[Rh(n,w).name]=[{name:"wrapper",func:n}],kt.prototype.clone=PF,kt.prototype.reverse=TF,kt.prototype.value=DF,L.prototype.at=i9,L.prototype.chain=s9,L.prototype.commit=a9,L.prototype.next=l9,L.prototype.plant=u9,L.prototype.reverse=d9,L.prototype.toJSON=L.prototype.valueOf=L.prototype.value=f9,L.prototype.first=L.prototype.head,gu&&(L.prototype[gu]=c9),L},Fl=aF();xa?((xa.exports=Fl)._=Fl,mv._=Fl):qn._=Fl}).call(Vs)})(hg,hg.exports);var uc=hg.exports;const ol=nu(uc);function eR({id:e,layouts:t,initialHeight:n,y:r,x:o,w:i,minH:s}){const a={i:e,x:o??0,y:r??1/0,w:i||20,h:n||35,minW:6,minH:s||10};return t||(t={}),vw.forEach(l=>{t!=null&&t[l]||(t={...t,[l]:[]});const c=t[l].reduce((u,f)=>Math.max(u,f.y+f.h),0);a.y=a.y===0?0:c,t[l].push(a)}),t}function tR(e,t){t&&vw.forEach(n=>{t!=null&&t[n]&&(t[n]=t[n].filter(r=>r.i!==e))})}const ke=X2()(rD((e,t)=>({isSessionExpired:!1,currentBreakpoint:"lg",dashboard:{id:"",style:x0},showContext:!1,selectedSheetId:null,selectedCardId:null,selectedFrameId:null,selectedCard:null,showFilters:!1,isDashboardEditing:!1,isVisualEditing:!1,showDashboardJSON:!1,filteringCards:[],actions:{deleteSheet:n=>{e(r=>{var i,s,a,l;const o=(i=r.dashboard.sheets)==null?void 0:i.findIndex(c=>c.id===n);o!==void 0&&o>-1&&((s=r.dashboard.sheets)==null||s.splice(o,1),r.selectedSheetId=(l=(a=r.dashboard.sheets)==null?void 0:a[0])==null?void 0:l.id)})},addSheet:n=>{e(r=>{r.dashboard.sheets||(r.dashboard.sheets=[]);const o=r.dashboard.filters;let i={};o==null||o.forEach(a=>{vw.forEach(l=>{i!=null&&i[l]||(i={...i,[l]:[]});const c={i:a.id,x:0,y:0,w:10,h:8};i[l].push(c)})});const s={...n,layouts:i};r.dashboard.sheets.push(s)})},setGlobalStyle:n=>{e(r=>{r.dashboard.globalStyle=n})},setAIScopeTables:n=>{e(r=>{r.dashboard.aiScopeTables=n})},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&&uc.forEach(i.frames,l=>{var u;const c=(u=l.cards)==null?void 0:u.find(f=>f.id===n);c&&(c.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)})},setSheetTitle:(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.title=r)})},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(c=>c.id===n);s&&uc.forEach(s.frames,c=>{var f;const u=(f=c.cards)==null?void 0:f.find(h=>h.id===r);u&&(u.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&&uc.forEach(i.frames,l=>{var u;const c=(u=l.cards)==null?void 0:u.find(f=>f.id===n);c&&(c.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(c=>c.id===n);s&&uc.forEach(s.frames,c=>{var f;const u=(f=c.cards)==null?void 0:f.find(h=>h.id===r);u&&(u.description=o)})})},setCardSql:(n,r,o)=>{e(i=>{var a,l,c,u;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(f=>f.id===n);if(s){const f=(c=s.cards)==null?void 0:c.find(h=>h.id===r);f&&(f.sql=o,(u=i.onUpdateCard)==null||u.call(i,f,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(c=>c.id===n);s&&uc.forEach(s.frames,c=>{var f;const u=(f=c.cards)==null?void 0:f.find(h=>h.id===r);u&&(u.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(c=>c.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 i,s;r.dashboard.filters?(i=r.dashboard.filters)==null||i.push(n):r.dashboard.filters=[n];const o=(s=r.dashboard.sheets)==null?void 0:s.find(a=>a.id===r.selectedSheetId);eR({id:n.id,layouts:o==null?void 0:o.layouts,y:0,initialHeight:8,minH:7,w:10})})},removeFilter:n=>{e(r=>{var o,i,s;if(r.dashboard.filters){const a=(o=r.dashboard.filters)==null?void 0:o.findIndex(l=>l.id===n);if(a>-1){(i=r.dashboard.filters)==null||i.splice(a,1);const l=(s=r.dashboard.sheets)==null?void 0:s.find(c=>c.id===r.selectedSheetId);tR(n,l==null?void 0:l.layouts)}}})},updateFrameCard:(n,r,o)=>{e(i=>{var l,c,u,f,h;const s=(c=(l=i.dashboard)==null?void 0:l.sheets)==null?void 0:c.find(g=>g.id===n);if(!s)return;const a=(u=s==null?void 0:s.frames)==null?void 0:u.find(g=>g.id===r);if(a){const g=(f=a.cards)==null?void 0:f.findIndex(v=>v.id===o.id);g>-1&&((h=a.cards)==null||h.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,o)=>{e(i=>{var a,l,c,u;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(f=>f.id===n);if(s){s.frames||(s.frames=[]),(c=s.frames)==null||c.push(r);let f=1/0,h=0;o==="start"&&(f=0),eR({id:r.id,layouts:s.layouts,minH:10,x:h,y:f}),(u=i.onAddFrame)==null||u.call(i,r,n)}})},removeFrame:(n,r)=>{e(o=>{var s,a,l,c,u;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(f=>f.id===n);if(i){const f=(l=i.frames)==null?void 0:l.findIndex(h=>h.id===r);console.log(f),typeof f=="number"&&f>-1&&((c=i.frames)==null||c.splice(f,1),(u=i.layout)==null||u.splice(f,1),tR(r,i.layouts))}})},updateFrame:(n,r)=>{e(o=>{var a,l,c,u;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(f=>f.id===n),s=(c=i==null?void 0:i.frames)==null?void 0:c.findIndex(f=>f.id===r.id);i&&((u=i.frames)==null||u.splice(s,1,r))})},updateCard:(n,r)=>{e(o=>{var a,l,c,u,f;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(h=>h.id===n),s=(c=i==null?void 0:i.cards)==null?void 0:c.findIndex(h=>h.id===r.id);i&&((u=i.cards)==null||u.splice(s,1,r),(f=o.onUpdateCard)==null||f.call(o,r,n))})},removeCard:(n,r)=>{e(o=>{var a,l,c,u,f,h;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(g=>g.id===n),s=(c=i==null?void 0:i.cards)==null?void 0:c.findIndex(g=>g.id===r.id);i&&((u=i.cards)==null||u.splice(s,1),(f=i.layout)==null||f.splice(s,1),(h=o.onRemoveCard)==null||h.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(c=>c.id===n);i&&(((l=i.cards)==null?void 0:l.find(u=>u.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 c=(i=a[l].cards)==null?void 0:i.find(u=>u.id===n);if(c)return c}}},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},getCardSheet(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++)if((i=a[l].cards)==null?void 0:i.find(u=>u.id===n))return r[s]}}},handleDataPointClickAction:(n,r)=>{Iz({card:n,dataPoint:r,set:e,get:t})}}}))),Mo=()=>ke(e=>e.actions);var Pf=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(){}},Hc=typeof window>"u"||"Deno"in window;function Oo(){}function Nz(e,t){return typeof e=="function"?e(t):e}function _0(e){return typeof e=="number"&&e>=0&&e!==1/0}function cD(e,t){return Math.max(e+(t||0)-Date.now(),0)}function nR(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==xw(s,t.options))return!1}else if(!Dd(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 rR(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Td(t.options.mutationKey)!==Td(i))return!1}else if(!Dd(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function xw(e,t){return((t==null?void 0:t.queryKeyHashFn)||Td)(e)}function Td(e){return JSON.stringify(e,(t,n)=>C0(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function Dd(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!Dd(e[n],t[n])):!1}function uD(e,t){if(e===t)return e;const n=oR(e)&&oR(t);if(n||C0(e)&&C0(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 c=0;c<s;c++){const u=n?c:i[c];!n&&e[u]===void 0&&t[u]===void 0&&r.includes(u)?(a[u]=void 0,l++):(a[u]=uD(e[u],t[u]),a[u]===e[u]&&e[u]!==void 0&&l++)}return o===s&&l===o?e:a}return t}function S0(e,t){if(e&&!t||t&&!e)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function oR(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function C0(e){if(!iR(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const n=t.prototype;return!(!iR(n)||!n.hasOwnProperty("isPrototypeOf"))}function iR(e){return Object.prototype.toString.call(e)==="[object Object]"}function Lz(e){return new Promise(t=>{setTimeout(t,e)})}function E0(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?uD(e,t):t}function Fz(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function jz(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Xa,Hs,Cc,A2,zz=(A2=class extends Pf{constructor(){super();Xe(this,Xa,void 0);Xe(this,Hs,void 0);Xe(this,Cc,void 0);Ve(this,Cc,t=>{if(!Hc&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){re(this,Hs)||this.setEventListener(re(this,Cc))}onUnsubscribe(){var t;this.hasListeners()||((t=re(this,Hs))==null||t.call(this),Ve(this,Hs,void 0))}setEventListener(t){var n;Ve(this,Cc,t),(n=re(this,Hs))==null||n.call(this),Ve(this,Hs,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){re(this,Xa)!==t&&(Ve(this,Xa,t),this.onFocus())}onFocus(){this.listeners.forEach(t=>{t()})}isFocused(){var t;return typeof re(this,Xa)=="boolean"?re(this,Xa):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Xa=new WeakMap,Hs=new WeakMap,Cc=new WeakMap,A2),pg=new zz,Ec,Ws,Rc,k2,Bz=(k2=class extends Pf{constructor(){super();Xe(this,Ec,!0);Xe(this,Ws,void 0);Xe(this,Rc,void 0);Ve(this,Rc,t=>{if(!Hc&&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(){re(this,Ws)||this.setEventListener(re(this,Rc))}onUnsubscribe(){var t;this.hasListeners()||((t=re(this,Ws))==null||t.call(this),Ve(this,Ws,void 0))}setEventListener(t){var n;Ve(this,Rc,t),(n=re(this,Ws))==null||n.call(this),Ve(this,Ws,t(this.setOnline.bind(this)))}setOnline(t){re(this,Ec)!==t&&(Ve(this,Ec,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return re(this,Ec)}},Ec=new WeakMap,Ws=new WeakMap,Rc=new WeakMap,k2),gg=new Bz;function Vz(e){return Math.min(1e3*2**e,3e4)}function om(e){return(e??"online")==="online"?gg.isOnline():!0}var dD=class{constructor(e){this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Tb(e){return e instanceof dD}function fD(e){let t=!1,n=0,r=!1,o,i,s;const a=new Promise((x,w)=>{i=x,s=w}),l=x=>{var w;r||(g(new dD(x)),(w=e.abort)==null||w.call(e))},c=()=>{t=!0},u=()=>{t=!1},f=()=>!pg.isFocused()||e.networkMode!=="always"&&!gg.isOnline(),h=x=>{var w;r||(r=!0,(w=e.onSuccess)==null||w.call(e,x),o==null||o(),i(x))},g=x=>{var w;r||(r=!0,(w=e.onError)==null||w.call(e,x),o==null||o(),s(x))},v=()=>new Promise(x=>{var w;o=_=>{const S=r||!f();return S&&x(_),S},(w=e.onPause)==null||w.call(e)}).then(()=>{var x;o=void 0,r||(x=e.onContinue)==null||x.call(e)}),b=()=>{if(r)return;let x;try{x=e.fn()}catch(w){x=Promise.reject(w)}Promise.resolve(x).then(h).catch(w=>{var P;if(r)return;const _=e.retry??(Hc?0:3),S=e.retryDelay??Vz,R=typeof S=="function"?S(n,w):S,C=_===!0||typeof _=="number"&&n<_||typeof _=="function"&&_(n,w);if(t||!C){g(w);return}n++,(P=e.onFail)==null||P.call(e,n,w),Lz(R).then(()=>{if(f())return v()}).then(()=>{t?g(w):b()})})};return om(e.networkMode)?b():v().then(b),{promise:a,cancel:l,continue:()=>(o==null?void 0:o())?a:Promise.resolve(),cancelRetry:c,continueRetry:u}}function Hz(){let e=[],t=0,n=h=>{h()},r=h=>{h()},o=h=>setTimeout(h,0);const i=h=>{o=h},s=h=>{let g;t++;try{g=h()}finally{t--,t||c()}return g},a=h=>{t?e.push(h):o(()=>{n(h)})},l=h=>(...g)=>{a(()=>{h(...g)})},c=()=>{const h=e;e=[],h.length&&o(()=>{r(()=>{h.forEach(g=>{n(g)})})})};return{batch:s,batchCalls:l,schedule:a,setNotifyFunction:h=>{n=h},setBatchNotifyFunction:h=>{r=h},setScheduler:i}}var Xn=Hz(),Qa,M2,hD=(M2=class{constructor(){Xe(this,Qa,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),_0(this.gcTime)&&Ve(this,Qa,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Hc?1/0:5*60*1e3))}clearGcTimeout(){re(this,Qa)&&(clearTimeout(re(this,Qa)),Ve(this,Qa,void 0))}},Qa=new WeakMap,M2),Oc,Pc,Co,Us,Eo,Vn,pf,Ja,Tc,Kp,Go,qi,I2,Wz=(I2=class extends hD{constructor(t){super();Xe(this,Tc);Xe(this,Go);Xe(this,Oc,void 0);Xe(this,Pc,void 0);Xe(this,Co,void 0);Xe(this,Us,void 0);Xe(this,Eo,void 0);Xe(this,Vn,void 0);Xe(this,pf,void 0);Xe(this,Ja,void 0);Ve(this,Ja,!1),Ve(this,pf,t.defaultOptions),Ct(this,Tc,Kp).call(this,t.options),Ve(this,Vn,[]),Ve(this,Co,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Ve(this,Oc,t.state||Uz(this.options)),this.state=re(this,Oc),this.scheduleGc()}get meta(){return this.options.meta}optionalRemove(){!re(this,Vn).length&&this.state.fetchStatus==="idle"&&re(this,Co).remove(this)}setData(t,n){const r=E0(this.state.data,t,this.options);return Ct(this,Go,qi).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){Ct(this,Go,qi).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r;const n=re(this,Us);return(r=re(this,Eo))==null||r.cancel(t),n?n.then(Oo).catch(Oo):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(re(this,Oc))}isActive(){return re(this,Vn).some(t=>t.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated||!this.state.dataUpdatedAt||re(this,Vn).some(t=>t.getCurrentResult().isStale)}isStaleByTime(t=0){return this.state.isInvalidated||!this.state.dataUpdatedAt||!cD(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=re(this,Vn).find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=re(this,Eo))==null||n.continue()}onOnline(){var n;const t=re(this,Vn).find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=re(this,Eo))==null||n.continue()}addObserver(t){re(this,Vn).includes(t)||(re(this,Vn).push(t),this.clearGcTimeout(),re(this,Co).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){re(this,Vn).includes(t)&&(Ve(this,Vn,re(this,Vn).filter(n=>n!==t)),re(this,Vn).length||(re(this,Eo)&&(re(this,Ja)?re(this,Eo).cancel({revert:!0}):re(this,Eo).cancelRetry()),this.scheduleGc()),re(this,Co).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return re(this,Vn).length}invalidate(){this.state.isInvalidated||Ct(this,Go,qi).call(this,{type:"invalidate"})}fetch(t,n){var c,u,f,h;if(this.state.fetchStatus!=="idle"){if(this.state.dataUpdatedAt&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(re(this,Us))return(c=re(this,Eo))==null||c.continueRetry(),re(this,Us)}if(t&&Ct(this,Tc,Kp).call(this,t),!this.options.queryFn){const g=re(this,Vn).find(v=>v.options.queryFn);g&&Ct(this,Tc,Kp).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:()=>(Ve(this,Ja,!0),r.signal)})};i(o);const s=()=>this.options.queryFn?(Ve(this,Ja,!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),(u=this.options.behavior)==null||u.onFetch(a,this),Ve(this,Pc,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((f=a.fetchOptions)==null?void 0:f.meta))&&Ct(this,Go,qi).call(this,{type:"fetch",meta:(h=a.fetchOptions)==null?void 0:h.meta});const l=g=>{var v,b,x,w;Tb(g)&&g.silent||Ct(this,Go,qi).call(this,{type:"error",error:g}),Tb(g)||((b=(v=re(this,Co).config).onError)==null||b.call(v,g,this),(w=(x=re(this,Co).config).onSettled)==null||w.call(x,this.state.data,g,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return Ve(this,Eo,fD({fn:a.fetchFn,abort:r.abort.bind(r),onSuccess:g=>{var v,b,x,w;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),(b=(v=re(this,Co).config).onSuccess)==null||b.call(v,g,this),(w=(x=re(this,Co).config).onSettled)==null||w.call(x,g,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:l,onFail:(g,v)=>{Ct(this,Go,qi).call(this,{type:"failed",failureCount:g,error:v})},onPause:()=>{Ct(this,Go,qi).call(this,{type:"pause"})},onContinue:()=>{Ct(this,Go,qi).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode})),Ve(this,Us,re(this,Eo).promise),re(this,Us)}},Oc=new WeakMap,Pc=new WeakMap,Co=new WeakMap,Us=new WeakMap,Eo=new WeakMap,Vn=new WeakMap,pf=new WeakMap,Ja=new WeakMap,Tc=new WeakSet,Kp=function(t){this.options={...re(this,pf),...t},this.updateGcTime(this.options.gcTime)},Go=new WeakSet,qi=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:om(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 Tb(o)&&o.revert&&re(this,Pc)?{...re(this,Pc),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),Xn.batch(()=>{re(this,Vn).forEach(r=>{r.onQueryUpdate()}),re(this,Co).notify({query:this,type:"updated",action:t})})},I2);function Uz(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 fi,N2,pD=(N2=class extends Pf{constructor(t={}){super();Xe(this,fi,void 0);this.config=t,Ve(this,fi,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??xw(o,n);let s=this.get(i);return s||(s=new Wz({cache:this,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){re(this,fi).has(t.queryHash)||(re(this,fi).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=re(this,fi).get(t.queryHash);n&&(t.destroy(),n===t&&re(this,fi).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Xn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return re(this,fi).get(t)}getAll(){return[...re(this,fi).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>nR(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>nR(t,r)):n}notify(t){Xn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Xn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Xn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},fi=new WeakMap,N2),hi,gf,Xr,Dc,pi,Ls,L2,qz=(L2=class extends hD{constructor(t){super();Xe(this,pi);Xe(this,hi,void 0);Xe(this,gf,void 0);Xe(this,Xr,void 0);Xe(this,Dc,void 0);this.mutationId=t.mutationId,Ve(this,gf,t.defaultOptions),Ve(this,Xr,t.mutationCache),Ve(this,hi,[]),this.state=t.state||Gz(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options={...re(this,gf),...t},this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){re(this,hi).includes(t)||(re(this,hi).push(t),this.clearGcTimeout(),re(this,Xr).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Ve(this,hi,re(this,hi).filter(n=>n!==t)),this.scheduleGc(),re(this,Xr).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){re(this,hi).length||(this.state.status==="pending"?this.scheduleGc():re(this,Xr).remove(this))}continue(){var t;return((t=re(this,Dc))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,s,a,l,c,u,f,h,g,v,b,x,w,_,S,R,C,P,A;const n=()=>(Ve(this,Dc,fD({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(k,D)=>{Ct(this,pi,Ls).call(this,{type:"failed",failureCount:k,error:D})},onPause:()=>{Ct(this,pi,Ls).call(this,{type:"pause"})},onContinue:()=>{Ct(this,pi,Ls).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode})),re(this,Dc).promise),r=this.state.status==="pending";try{if(!r){Ct(this,pi,Ls).call(this,{type:"pending",variables:t}),await((i=(o=re(this,Xr).config).onMutate)==null?void 0:i.call(o,t,this));const D=await((a=(s=this.options).onMutate)==null?void 0:a.call(s,t));D!==this.state.context&&Ct(this,pi,Ls).call(this,{type:"pending",context:D,variables:t})}const k=await n();return await((c=(l=re(this,Xr).config).onSuccess)==null?void 0:c.call(l,k,t,this.state.context,this)),await((f=(u=this.options).onSuccess)==null?void 0:f.call(u,k,t,this.state.context)),await((g=(h=re(this,Xr).config).onSettled)==null?void 0:g.call(h,k,null,this.state.variables,this.state.context,this)),await((b=(v=this.options).onSettled)==null?void 0:b.call(v,k,null,t,this.state.context)),Ct(this,pi,Ls).call(this,{type:"success",data:k}),k}catch(k){try{throw await((w=(x=re(this,Xr).config).onError)==null?void 0:w.call(x,k,t,this.state.context,this)),await((S=(_=this.options).onError)==null?void 0:S.call(_,k,t,this.state.context)),await((C=(R=re(this,Xr).config).onSettled)==null?void 0:C.call(R,void 0,k,this.state.variables,this.state.context,this)),await((A=(P=this.options).onSettled)==null?void 0:A.call(P,void 0,k,t,this.state.context)),k}finally{Ct(this,pi,Ls).call(this,{type:"error",error:k})}}}},hi=new WeakMap,gf=new WeakMap,Xr=new WeakMap,Dc=new WeakMap,pi=new WeakSet,Ls=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:!om(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),Xn.batch(()=>{re(this,hi).forEach(r=>{r.onMutationUpdate(t)}),re(this,Xr).notify({mutation:this,type:"updated",action:t})})},L2);function Gz(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ro,mf,Za,F2,Yz=(F2=class extends Pf{constructor(t={}){super();Xe(this,Ro,void 0);Xe(this,mf,void 0);Xe(this,Za,void 0);this.config=t,Ve(this,Ro,[]),Ve(this,mf,0)}build(t,n,r){const o=new qz({mutationCache:this,mutationId:++Bh(this,mf)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){re(this,Ro).push(t),this.notify({type:"added",mutation:t})}remove(t){Ve(this,Ro,re(this,Ro).filter(n=>n!==t)),this.notify({type:"removed",mutation:t})}clear(){Xn.batch(()=>{re(this,Ro).forEach(t=>{this.remove(t)})})}getAll(){return re(this,Ro)}find(t){const n={exact:!0,...t};return re(this,Ro).find(r=>rR(n,r))}findAll(t={}){return re(this,Ro).filter(n=>rR(t,n))}notify(t){Xn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){return Ve(this,Za,(re(this,Za)??Promise.resolve()).then(()=>{const t=re(this,Ro).filter(n=>n.state.isPaused);return Xn.batch(()=>t.reduce((n,r)=>n.then(()=>r.continue().catch(Oo)),Promise.resolve()))}).then(()=>{Ve(this,Za,void 0)})),re(this,Za)}},Ro=new WeakMap,mf=new WeakMap,Za=new WeakMap,F2);function Kz(e){return{onFetch:(t,n)=>{const r=async()=>{var v,b,x,w,_;const o=t.options,i=(x=(b=(v=t.fetchOptions)==null?void 0:v.meta)==null?void 0:b.fetchMore)==null?void 0:x.direction,s=((w=t.state.data)==null?void 0:w.pages)||[],a=((_=t.state.data)==null?void 0:_.pageParams)||[],l={pages:[],pageParams:[]};let c=!1;const u=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(t.signal.aborted?c=!0:t.signal.addEventListener("abort",()=>{c=!0}),t.signal)})},f=t.options.queryFn||(()=>Promise.reject(new Error(`Missing queryFn: '${t.options.queryHash}'`))),h=async(S,R,C)=>{if(c)return Promise.reject();if(R==null&&S.pages.length)return Promise.resolve(S);const P={queryKey:t.queryKey,pageParam:R,direction:C?"backward":"forward",meta:t.options.meta};u(P);const A=await f(P),{maxPages:k}=t.options,D=C?jz:Fz;return{pages:D(S.pages,A,k),pageParams:D(S.pageParams,R,k)}};let g;if(i&&s.length){const S=i==="backward",R=S?Xz:sR,C={pages:s,pageParams:a},P=R(o,C);g=await h(C,P,S)}else{g=await h(l,a[0]??o.initialPageParam);const S=e??s.length;for(let R=1;R<S;R++){const C=sR(o,g);g=await h(g,C)}}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 sR(e,{pages:t,pageParams:n}){const r=t.length-1;return e.getNextPageParam(t[r],t,n[r],n)}function Xz(e,{pages:t,pageParams:n}){var r;return(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n)}var In,qs,Gs,$c,Ac,Ys,kc,Mc,j2,Qz=(j2=class{constructor(e={}){Xe(this,In,void 0);Xe(this,qs,void 0);Xe(this,Gs,void 0);Xe(this,$c,void 0);Xe(this,Ac,void 0);Xe(this,Ys,void 0);Xe(this,kc,void 0);Xe(this,Mc,void 0);Ve(this,In,e.queryCache||new pD),Ve(this,qs,e.mutationCache||new Yz),Ve(this,Gs,e.defaultOptions||{}),Ve(this,$c,new Map),Ve(this,Ac,new Map),Ve(this,Ys,0)}mount(){Bh(this,Ys)._++,re(this,Ys)===1&&(Ve(this,kc,pg.subscribe(()=>{pg.isFocused()&&(this.resumePausedMutations(),re(this,In).onFocus())})),Ve(this,Mc,gg.subscribe(()=>{gg.isOnline()&&(this.resumePausedMutations(),re(this,In).onOnline())})))}unmount(){var e,t;Bh(this,Ys)._--,re(this,Ys)===0&&((e=re(this,kc))==null||e.call(this),Ve(this,kc,void 0),(t=re(this,Mc))==null||t.call(this),Ve(this,Mc,void 0))}isFetching(e){return re(this,In).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return re(this,qs).findAll({...e,status:"pending"}).length}getQueryData(e){var t;return(t=re(this,In).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=re(this,In).find({queryKey:e}),o=r==null?void 0:r.state.data,i=Nz(t,o);if(typeof i>"u")return;const s=this.defaultQueryOptions({queryKey:e});return re(this,In).build(this,s).setData(i,{...n,manual:!0})}setQueriesData(e,t,n){return Xn.batch(()=>this.getQueryCache().findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var t;return(t=re(this,In).find({queryKey:e}))==null?void 0:t.state}removeQueries(e){const t=re(this,In);Xn.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=re(this,In),r={type:"active",...e};return Xn.batch(()=>(n.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries(r,t)))}cancelQueries(e={},t={}){const n={revert:!0,...t},r=Xn.batch(()=>re(this,In).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(Oo).catch(Oo)}invalidateQueries(e={},t={}){return Xn.batch(()=>{if(re(this,In).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=Xn.batch(()=>re(this,In).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(Oo)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Oo)}fetchQuery(e){const t=this.defaultQueryOptions(e);typeof t.retry>"u"&&(t.retry=!1);const n=re(this,In).build(this,t);return n.isStaleByTime(t.staleTime)?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Oo).catch(Oo)}fetchInfiniteQuery(e){return e.behavior=Kz(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Oo).catch(Oo)}resumePausedMutations(){return re(this,qs).resumePausedMutations()}getQueryCache(){return re(this,In)}getMutationCache(){return re(this,qs)}getDefaultOptions(){return re(this,Gs)}setDefaultOptions(e){Ve(this,Gs,e)}setQueryDefaults(e,t){re(this,$c).set(Td(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...re(this,$c).values()];let n={};return t.forEach(r=>{Dd(e,r.queryKey)&&(n={...n,...r.defaultOptions})}),n}setMutationDefaults(e,t){re(this,Ac).set(Td(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...re(this,Ac).values()];let n={};return t.forEach(r=>{Dd(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e!=null&&e._defaulted)return e;const t={...re(this,Gs).queries,...(e==null?void 0:e.queryKey)&&this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=xw(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:{...re(this,Gs).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){re(this,In).clear(),re(this,qs).clear()}},In=new WeakMap,qs=new WeakMap,Gs=new WeakMap,$c=new WeakMap,Ac=new WeakMap,Ys=new WeakMap,kc=new WeakMap,Mc=new WeakMap,j2),$r,fn,vf,vr,el,Ic,gi,bf,Nc,Lc,tl,nl,Ks,Fc,rl,Zu,yf,R0,xf,O0,wf,P0,_f,T0,Sf,D0,Cf,$0,Ef,A0,Jg,gD,z2,Jz=(z2=class extends Pf{constructor(t,n){super();Xe(this,rl);Xe(this,yf);Xe(this,xf);Xe(this,wf);Xe(this,_f);Xe(this,Sf);Xe(this,Cf);Xe(this,Ef);Xe(this,Jg);Xe(this,$r,void 0);Xe(this,fn,void 0);Xe(this,vf,void 0);Xe(this,vr,void 0);Xe(this,el,void 0);Xe(this,Ic,void 0);Xe(this,gi,void 0);Xe(this,bf,void 0);Xe(this,Nc,void 0);Xe(this,Lc,void 0);Xe(this,tl,void 0);Xe(this,nl,void 0);Xe(this,Ks,void 0);Xe(this,Fc,new Set);this.options=n,Ve(this,$r,t),Ve(this,gi,null),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(re(this,fn).addObserver(this),aR(re(this,fn),this.options)?Ct(this,rl,Zu).call(this):this.updateResult(),Ct(this,_f,T0).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return k0(re(this,fn),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return k0(re(this,fn),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ct(this,Sf,D0).call(this),Ct(this,Cf,$0).call(this),re(this,fn).removeObserver(this)}setOptions(t,n){const r=this.options,o=re(this,fn);if(this.options=re(this,$r).defaultQueryOptions(t),S0(r,this.options)||re(this,$r).getQueryCache().notify({type:"observerOptionsUpdated",query:re(this,fn),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),Ct(this,Ef,A0).call(this);const i=this.hasListeners();i&&lR(re(this,fn),o,this.options,r)&&Ct(this,rl,Zu).call(this),this.updateResult(n),i&&(re(this,fn)!==o||this.options.enabled!==r.enabled||this.options.staleTime!==r.staleTime)&&Ct(this,yf,R0).call(this);const s=Ct(this,xf,O0).call(this);i&&(re(this,fn)!==o||this.options.enabled!==r.enabled||s!==re(this,Ks))&&Ct(this,wf,P0).call(this,s)}getOptimisticResult(t){const n=re(this,$r).getQueryCache().build(re(this,$r),t),r=this.createResult(n,t);return eB(this,r)&&(Ve(this,vr,r),Ve(this,Ic,this.options),Ve(this,el,re(this,fn).state)),r}getCurrentResult(){return re(this,vr)}trackResult(t){const n={};return Object.keys(t).forEach(r=>{Object.defineProperty(n,r,{configurable:!1,enumerable:!0,get:()=>(re(this,Fc).add(r),t[r])})}),n}getCurrentQuery(){return re(this,fn)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=re(this,$r).defaultQueryOptions(t),r=re(this,$r).getQueryCache().build(re(this,$r),n);return r.isFetchingOptimistic=!0,r.fetch().then(()=>this.createResult(r,n))}fetch(t){return Ct(this,rl,Zu).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),re(this,vr)))}createResult(t,n){var P;const r=re(this,fn),o=this.options,i=re(this,vr),s=re(this,el),a=re(this,Ic),c=t!==r?t.state:re(this,vf),{state:u}=t;let{error:f,errorUpdatedAt:h,fetchStatus:g,status:v}=u,b=!1,x;if(n._optimisticResults){const A=this.hasListeners(),k=!A&&aR(t,n),D=A&&lR(t,r,n,o);(k||D)&&(g=om(t.options.networkMode)?"fetching":"paused",u.dataUpdatedAt||(v="pending")),n._optimisticResults==="isRestoring"&&(g="idle")}if(n.select&&typeof u.data<"u")if(i&&u.data===(s==null?void 0:s.data)&&n.select===re(this,bf))x=re(this,Nc);else try{Ve(this,bf,n.select),x=n.select(u.data),x=E0(i==null?void 0:i.data,x,n),Ve(this,Nc,x),Ve(this,gi,null)}catch(A){Ve(this,gi,A)}else x=u.data;if(typeof n.placeholderData<"u"&&typeof x>"u"&&v==="pending"){let A;if(i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData))A=i.data;else if(A=typeof n.placeholderData=="function"?n.placeholderData((P=re(this,Lc))==null?void 0:P.state.data,re(this,Lc)):n.placeholderData,n.select&&typeof A<"u")try{A=n.select(A),Ve(this,gi,null)}catch(k){Ve(this,gi,k)}typeof A<"u"&&(v="success",x=E0(i==null?void 0:i.data,A,n),b=!0)}re(this,gi)&&(f=re(this,gi),x=re(this,Nc),h=Date.now(),v="error");const w=g==="fetching",_=v==="pending",S=v==="error",R=_&&w;return{status:v,fetchStatus:g,isPending:_,isSuccess:v==="success",isError:S,isInitialLoading:R,isLoading:R,data:x,dataUpdatedAt:u.dataUpdatedAt,error:f,errorUpdatedAt:h,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>c.dataUpdateCount||u.errorUpdateCount>c.errorUpdateCount,isFetching:w,isRefetching:w&&!_,isLoadingError:S&&u.dataUpdatedAt===0,isPaused:g==="paused",isPlaceholderData:b,isRefetchError:S&&u.dataUpdatedAt!==0,isStale:ww(t,n),refetch:this.refetch}}updateResult(t){const n=re(this,vr),r=this.createResult(re(this,fn),this.options);if(Ve(this,el,re(this,fn).state),Ve(this,Ic,this.options),re(this,el).data!==void 0&&Ve(this,Lc,re(this,fn)),S0(r,n))return;Ve(this,vr,r);const o={},i=()=>{if(!n)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!re(this,Fc).size)return!0;const l=new Set(a??re(this,Fc));return this.options.throwOnError&&l.add("error"),Object.keys(re(this,vr)).some(c=>{const u=c;return re(this,vr)[u]!==n[u]&&l.has(u)})};(t==null?void 0:t.listeners)!==!1&&i()&&(o.listeners=!0),Ct(this,Jg,gD).call(this,{...o,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ct(this,_f,T0).call(this)}},$r=new WeakMap,fn=new WeakMap,vf=new WeakMap,vr=new WeakMap,el=new WeakMap,Ic=new WeakMap,gi=new WeakMap,bf=new WeakMap,Nc=new WeakMap,Lc=new WeakMap,tl=new WeakMap,nl=new WeakMap,Ks=new WeakMap,Fc=new WeakMap,rl=new WeakSet,Zu=function(t){Ct(this,Ef,A0).call(this);let n=re(this,fn).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Oo)),n},yf=new WeakSet,R0=function(){if(Ct(this,Sf,D0).call(this),Hc||re(this,vr).isStale||!_0(this.options.staleTime))return;const n=cD(re(this,vr).dataUpdatedAt,this.options.staleTime)+1;Ve(this,tl,setTimeout(()=>{re(this,vr).isStale||this.updateResult()},n))},xf=new WeakSet,O0=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(re(this,fn)):this.options.refetchInterval)??!1},wf=new WeakSet,P0=function(t){Ct(this,Cf,$0).call(this),Ve(this,Ks,t),!(Hc||this.options.enabled===!1||!_0(re(this,Ks))||re(this,Ks)===0)&&Ve(this,nl,setInterval(()=>{(this.options.refetchIntervalInBackground||pg.isFocused())&&Ct(this,rl,Zu).call(this)},re(this,Ks)))},_f=new WeakSet,T0=function(){Ct(this,yf,R0).call(this),Ct(this,wf,P0).call(this,Ct(this,xf,O0).call(this))},Sf=new WeakSet,D0=function(){re(this,tl)&&(clearTimeout(re(this,tl)),Ve(this,tl,void 0))},Cf=new WeakSet,$0=function(){re(this,nl)&&(clearInterval(re(this,nl)),Ve(this,nl,void 0))},Ef=new WeakSet,A0=function(){const t=re(this,$r).getQueryCache().build(re(this,$r),this.options);if(t===re(this,fn))return;const n=re(this,fn);Ve(this,fn,t),Ve(this,vf,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Jg=new WeakSet,gD=function(t){Xn.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(re(this,vr))}),re(this,$r).getQueryCache().notify({query:re(this,fn),type:"observerResultsUpdated"})})},z2);function Zz(e,t){return t.enabled!==!1&&!e.state.dataUpdatedAt&&!(e.state.status==="error"&&t.retryOnMount===!1)}function aR(e,t){return Zz(e,t)||e.state.dataUpdatedAt>0&&k0(e,t,t.refetchOnMount)}function k0(e,t,n){if(t.enabled!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&ww(e,t)}return!1}function lR(e,t,n,r){return n.enabled!==!1&&(e!==t||r.enabled===!1)&&(!n.suspense||e.state.status!=="error")&&ww(e,n)}function ww(e,t){return e.isStaleByTime(t.staleTime)}function eB(e,t){return!S0(e.getCurrentResult(),t)}var mD=V.createContext(void 0),vD=e=>{const t=V.useContext(mD);if(e)return e;if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},tB=({client:e,children:t})=>(V.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),V.createElement(mD.Provider,{value:e},t)),bD=V.createContext(!1),nB=()=>V.useContext(bD);bD.Provider;function rB(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var oB=V.createContext(rB()),iB=()=>V.useContext(oB);function sB(e,t){return typeof e=="function"?e(...t):!!e}var aB=(e,t)=>{(e.suspense||e.throwOnError)&&(t.isReset()||(e.retryOnMount=!1))},lB=e=>{V.useEffect(()=>{e.clearReset()},[e])},cB=({result:e,errorResetBoundary:t,throwOnError:n,query:r})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&sB(n,[e.error,r]),uB=e=>{e.suspense&&typeof e.staleTime!="number"&&(e.staleTime=1e3)},dB=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,fB=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function hB(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=vD(n),o=nB(),i=iB(),s=r.defaultQueryOptions(e);s._optimisticResults=o?"isRestoring":"optimistic",uB(s),aB(s,i),lB(i);const[a]=V.useState(()=>new t(r,s)),l=a.getOptimisticResult(s);if(V.useSyncExternalStore(V.useCallback(c=>{const u=o?()=>{}:a.subscribe(Xn.batchCalls(c));return a.updateResult(),u},[a,o]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),V.useEffect(()=>{a.setOptions(s,{listeners:!1})},[s,a]),dB(s,l))throw fB(s,a,i);if(cB({result:l,errorResetBoundary:i,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash)}))throw l.error;return s.notifyOnChangeProps?l:a.trackResult(l)}function Tf(e,t){return hB(e,Jz,t)}const pB={theme:"system",setTheme:()=>null},yD=m.createContext(pB);function gB({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 O.jsx(yD.Provider,{...r,value:s,children:e})}const xD=()=>{const e=m.useContext(yD);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e};async function mB(e){return await(await fetch("https://semaphor.cloud/api/v1/dashboard",{headers:{Authorization:`Bearer ${e}`}})).json()}function wD(e){return e==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e}function cR(e,t){const n=wD(e);return n==="dark"?ol.merge({...t==null?void 0:t.default},{...t==null?void 0:t.dark}):t==null?void 0:t.default}function vB({authToken:e,customStyle:t,currentTheme:n,onSave:r,onEvent:o}){const{data:i,refetch:s,isLoading:a,isError:l}=Tf({queryKey:["dashboard",e==null?void 0:e.accessToken],queryFn:()=>mB(e==null?void 0:e.accessToken),enabled:!1}),{theme:c,setTheme:u}=xD(),f=ke(A=>A.dashboard.globalStyle),{setDashboard:h,setSelectedSheetId:g,setStyle:v,setOnSaveFunction:b}=ke(A=>A.actions);ke(A=>A.actions.setCustomCards);const x=ke(A=>A.actions.setFilterValues),w=ke(A=>A.actions.setBookmarkKey),_=ke(A=>A.actions.setAuthToken),S=ke(A=>A.actions.setThemeStyle),R=ke(A=>A.actions.setDashboardTheme),C=ke(A=>A.actions.setOnEvent);m.useEffect(()=>{if(c){const A=wD(c);R(A)}},[c,R]),m.useEffect(()=>{n&&u(n)},[n,u]);function P(){const A=ol.cloneDeep(x0),k=ol.merge(A,f);if(t){const D=ol.merge(k,t),I=cR(c,D);S(I),v(D)}else{const D=cR(c,k);S(D),v(x0)}}return m.useEffect(()=>{i&&i.dashboard&&P()},[c,t,f]),m.useEffect(()=>{var F;if(!i||!i.dashboard)return;const A=i.dashboard,k=yL(A.id),D=JSON.parse(localStorage.getItem(k)||"[]"),I=D.find(B=>B.default===!0);if(I)h(I.template),P(),w(I.name),I.filterValues&&x(I.filterValues);else{h(A),P();const B=D.find(K=>(K==null?void 0:K.name)==="Original");B?B.template=A:D.push({name:"Original",template:A,default:!1}),localStorage.setItem(k,JSON.stringify(D))}g((F=A.sheets)==null?void 0:F[0].id)},[i,h,g,x,w]),m.useEffect(()=>{r&&b(r),o&&C(o)},[r,b,o,C]),m.useEffect(()=>{e&&e.accessToken&&(_(e),s())},[e,s,_]),{isLoading:a,isError:l}}function im({className:e,...t}){return O.jsx("div",{className:Ee("animate-pulse rounded-md bg-muted",e),...t})}const _w=V.forwardRef(({className:e,...t},n)=>O.jsx("div",{ref:n,className:Ee("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));_w.displayName="Card";const sm=V.forwardRef(({className:e,...t},n)=>O.jsx("div",{ref:n,className:Ee("flex flex-col space-y-1.5 p-6",e),...t}));sm.displayName="CardHeader";const Df=V.forwardRef(({className:e,...t},n)=>O.jsx("h3",{ref:n,className:Ee("text-2xl font-semibold leading-none tracking-tight",e),...t}));Df.displayName="CardTitle";const Sw=V.forwardRef(({className:e,...t},n)=>O.jsx("p",{ref:n,className:Ee("text-sm text-muted-foreground",e),...t}));Sw.displayName="CardDescription";const am=V.forwardRef(({className:e,...t},n)=>O.jsx("div",{ref:n,className:Ee("px-6 pt-0",e),...t}));am.displayName="CardContent";const Cw=V.forwardRef(({className:e,...t},n)=>O.jsx("div",{ref:n,className:Ee("flex items-center p-6 pt-0",e),...t}));Cw.displayName="CardFooter";function _D({className:e,customStyle:t,onSave:n,onEvent:r,LoadingComponent:o,ErrorComponent:i,onChartElementClicked:s,id:a,authToken:l,currentTheme:c,version:u,customCards:f,showAssistant:h,...g}){ke(_=>_.selectedSheetId);const v=ke(_=>_.themeStyle),b=ke(_=>_.isSessionExpired),{isLoading:x,isError:w}=vB({authToken:l,customStyle:t,currentTheme:c,onSave:n,onEvent:r});return x||!l?(r==null||r({type:"info",message:"Loading dashboard"}),o?O.jsx(o,{message:"loading"}):O.jsx("div",{className:"flex items-center gap-3",children:O.jsx(im,{className:"h-1 w-full dark:h-[2px]"})})):w?(r==null||r({type:"error",message:"Error fetching dashboard"}),i?(console.log("Error fetching dashboard"),O.jsx(i,{})):O.jsx("div",{children:"Error"})):b?(r==null||r({type:"error",message:"Session Expired"}),O.jsx("div",{className:"flex h-full items-center justify-center",children:O.jsxs("div",{className:"space-y-4 rounded-md border border-muted p-10",children:[O.jsx(Df,{children:"Session Expired"}),O.jsx("p",{className:"text-muted-foreground",children:"Please refresh your page to continue."})]})})):O.jsx("div",{className:Ee("flex h-full flex-col justify-between",v==null?void 0:v.dashboardPanel,e),role:"dashboard-panel",...g})}function he(){return he=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},he.apply(this,arguments)}function Me(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 Zn(e,t=[]){let n=[];function r(i,s){const a=m.createContext(s),l=n.length;n=[...n,s];function c(f){const{scope:h,children:g,...v}=f,b=(h==null?void 0:h[e][l])||a,x=m.useMemo(()=>v,Object.values(v));return m.createElement(b.Provider,{value:x},g)}function u(f,h){const g=(h==null?void 0:h[e][l])||a,v=m.useContext(g);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return c.displayName=i+"Provider",[c,u]}const o=()=>{const i=n.map(s=>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,bB(o,...t)]}function bB(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(i)[`__scope${c}`];return{...a,...f}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function yB(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function cs(...e){return t=>e.forEach(n=>yB(n,t))}function _t(...e){return m.useCallback(cs(...e),e)}const M0=m.forwardRef((e,t)=>{const{children:n,...r}=e,o=m.Children.toArray(n),i=o.find(wB);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(I0,he({},r,{ref:t}),m.isValidElement(s)?m.cloneElement(s,void 0,a):null)}return m.createElement(I0,he({},r,{ref:t}),n)});M0.displayName="Slot";const I0=m.forwardRef((e,t)=>{const{children:n,...r}=e;return m.isValidElement(n)?m.cloneElement(n,{..._B(r,n.props),ref:t?cs(t,n.ref):n.ref}):m.Children.count(n)>1?m.Children.only(null):null});I0.displayName="SlotClone";const xB=({children:e})=>m.createElement(m.Fragment,null,e);function wB(e){return m.isValidElement(e)&&e.type===xB}function _B(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 lm(e){const t=e+"CollectionProvider",[n,r]=Zn(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=g=>{const{scope:v,children:b}=g,x=m.useRef(null),w=m.useRef(new Map).current;return m.createElement(o,{scope:v,itemMap:w,collectionRef:x},b)},a=e+"CollectionSlot",l=m.forwardRef((g,v)=>{const{scope:b,children:x}=g,w=i(a,b),_=_t(v,w.collectionRef);return m.createElement(M0,{ref:_},x)}),c=e+"CollectionItemSlot",u="data-radix-collection-item",f=m.forwardRef((g,v)=>{const{scope:b,children:x,...w}=g,_=m.useRef(null),S=_t(v,_),R=i(c,b);return m.useEffect(()=>(R.itemMap.set(_,{ref:_,...w}),()=>void R.itemMap.delete(_))),m.createElement(M0,{[u]:"",ref:S},x)});function h(g){const v=i(e+"CollectionConsumer",g);return m.useCallback(()=>{const x=v.collectionRef.current;if(!x)return[];const w=Array.from(x.querySelectorAll(`[${u}]`));return Array.from(v.itemMap.values()).sort((R,C)=>w.indexOf(R.ref.current)-w.indexOf(C.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:s,Slot:l,ItemSlot:f},h,r]}const ur=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},SB=V.useId||(()=>{});let CB=0;function Jo(e){const[t,n]=V.useState(SB());return ur(()=>{e||n(r=>r??String(CB++))},[e]),e||(t?`radix-${t}`:"")}const SD=m.forwardRef((e,t)=>{const{children:n,...r}=e,o=m.Children.toArray(n),i=o.find(RB);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(N0,he({},r,{ref:t}),m.isValidElement(s)?m.cloneElement(s,void 0,a):null)}return m.createElement(N0,he({},r,{ref:t}),n)});SD.displayName="Slot";const N0=m.forwardRef((e,t)=>{const{children:n,...r}=e;return m.isValidElement(n)?m.cloneElement(n,{...OB(r,n.props),ref:t?cs(t,n.ref):n.ref}):m.Children.count(n)>1?m.Children.only(null):null});N0.displayName="SlotClone";const EB=({children:e})=>m.createElement(m.Fragment,null,e);function RB(e){return m.isValidElement(e)&&e.type===EB}function OB(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}const PB=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Qe=PB.reduce((e,t)=>{const n=m.forwardRef((r,o)=>{const{asChild:i,...s}=r,a=i?SD:t;return m.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),m.createElement(a,he({},s,{ref:o}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function CD(e,t){e&&ko.flushSync(()=>e.dispatchEvent(t))}function Ln(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 xr({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=TB({defaultProp:t,onChange:n}),i=e!==void 0,s=i?e:r,a=Ln(n),l=m.useCallback(c=>{if(i){const f=typeof c=="function"?c(e):c;f!==e&&a(f)}else o(c)},[i,e,o,a]);return[s,l]}function TB({defaultProp:e,onChange:t}){const n=m.useState(e),[r]=n,o=m.useRef(r),i=Ln(t);return m.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}const DB=m.createContext(void 0);function _l(e){const t=m.useContext(DB);return e||t||"ltr"}const Db="rovingFocusGroup.onEntryFocus",$B={bubbles:!1,cancelable:!0},Ew="RovingFocusGroup",[L0,ED,AB]=lm(Ew),[kB,ou]=Zn(Ew,[AB]),[MB,IB]=kB(Ew),NB=m.forwardRef((e,t)=>m.createElement(L0.Provider,{scope:e.__scopeRovingFocusGroup},m.createElement(L0.Slot,{scope:e.__scopeRovingFocusGroup},m.createElement(LB,he({},e,{ref:t}))))),LB=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,...u}=e,f=m.useRef(null),h=_t(t,f),g=_l(i),[v=null,b]=xr({prop:s,defaultProp:a,onChange:l}),[x,w]=m.useState(!1),_=Ln(c),S=ED(n),R=m.useRef(!1),[C,P]=m.useState(0);return m.useEffect(()=>{const A=f.current;if(A)return A.addEventListener(Db,_),()=>A.removeEventListener(Db,_)},[_]),m.createElement(MB,{scope:n,orientation:r,dir:g,loop:o,currentTabStopId:v,onItemFocus:m.useCallback(A=>b(A),[b]),onItemShiftTab:m.useCallback(()=>w(!0),[]),onFocusableItemAdd:m.useCallback(()=>P(A=>A+1),[]),onFocusableItemRemove:m.useCallback(()=>P(A=>A-1),[])},m.createElement(Qe.div,he({tabIndex:x||C===0?-1:0,"data-orientation":r},u,{ref:h,style:{outline:"none",...e.style},onMouseDown:Me(e.onMouseDown,()=>{R.current=!0}),onFocus:Me(e.onFocus,A=>{const k=!R.current;if(A.target===A.currentTarget&&k&&!x){const D=new CustomEvent(Db,$B);if(A.currentTarget.dispatchEvent(D),!D.defaultPrevented){const I=S().filter(z=>z.focusable),F=I.find(z=>z.active),B=I.find(z=>z.id===v),Z=[F,B,...I].filter(Boolean).map(z=>z.ref.current);RD(Z)}}R.current=!1}),onBlur:Me(e.onBlur,()=>w(!1))})))}),FB="RovingFocusGroupItem",jB=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,...s}=e,a=Jo(),l=i||a,c=IB(FB,n),u=c.currentTabStopId===l,f=ED(n),{onFocusableItemAdd:h,onFocusableItemRemove:g}=c;return m.useEffect(()=>{if(r)return h(),()=>g()},[r,h,g]),m.createElement(L0.ItemSlot,{scope:n,id:l,focusable:r,active:o},m.createElement(Qe.span,he({tabIndex:u?0:-1,"data-orientation":c.orientation},s,{ref:t,onMouseDown:Me(e.onMouseDown,v=>{r?c.onItemFocus(l):v.preventDefault()}),onFocus:Me(e.onFocus,()=>c.onItemFocus(l)),onKeyDown:Me(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){c.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const b=VB(v,c.orientation,c.dir);if(b!==void 0){v.preventDefault();let w=f().filter(_=>_.focusable).map(_=>_.ref.current);if(b==="last")w.reverse();else if(b==="prev"||b==="next"){b==="prev"&&w.reverse();const _=w.indexOf(v.currentTarget);w=c.loop?HB(w,_+1):w.slice(_+1)}setTimeout(()=>RD(w))}})})))}),zB={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function BB(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function VB(e,t,n){const r=BB(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return zB[r]}function RD(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function HB(e,t){return e.map((n,r)=>e[(t+r)%e.length])}const Rw=NB,Ow=jB;function WB(e,t){return m.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const er=e=>{const{present:t,children:n}=e,r=UB(t),o=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),i=_t(r.ref,o.ref);return typeof n=="function"||r.isPresent?m.cloneElement(o,{ref:i}):null};er.displayName="Presence";function UB(e){const[t,n]=m.useState(),r=m.useRef({}),o=m.useRef(e),i=m.useRef("none"),s=e?"mounted":"unmounted",[a,l]=WB(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const c=Uh(r.current);i.current=a==="mounted"?c:"none"},[a]),ur(()=>{const c=r.current,u=o.current;if(u!==e){const h=i.current,g=Uh(c);e?l("MOUNT"):g==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&h!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),ur(()=>{if(t){const c=f=>{const g=Uh(r.current).includes(f.animationName);f.target===t&&g&&ko.flushSync(()=>l("ANIMATION_END"))},u=f=>{f.target===t&&(i.current=Uh(r.current))};return t.addEventListener("animationstart",u),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{t.removeEventListener("animationstart",u),t.removeEventListener("animationcancel",c),t.removeEventListener("animationend",c)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:m.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function Uh(e){return(e==null?void 0:e.animationName)||"none"}const OD="Tabs",[qB,tye]=Zn(OD,[ou]),PD=ou(),[GB,Pw]=qB(OD),YB=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:l="automatic",...c}=e,u=_l(a),[f,h]=xr({prop:r,onChange:o,defaultProp:i});return m.createElement(GB,{scope:n,baseId:Jo(),value:f,onValueChange:h,orientation:s,dir:u,activationMode:l},m.createElement(Qe.div,he({dir:u,"data-orientation":s},c,{ref:t})))}),KB="TabsList",XB=m.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=Pw(KB,n),s=PD(n);return m.createElement(Rw,he({asChild:!0},s,{orientation:i.orientation,dir:i.dir,loop:r}),m.createElement(Qe.div,he({role:"tablist","aria-orientation":i.orientation},o,{ref:t})))}),QB="TabsTrigger",JB=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=Pw(QB,n),a=PD(n),l=TD(s.baseId,r),c=DD(s.baseId,r),u=r===s.value;return m.createElement(Ow,he({asChild:!0},a,{focusable:!o,active:u}),m.createElement(Qe.button,he({type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:l},i,{ref:t,onMouseDown:Me(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:Me(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:Me(e.onFocus,()=>{const f=s.activationMode!=="manual";!u&&!o&&f&&s.onValueChange(r)})})))}),ZB="TabsContent",eV=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=Pw(ZB,n),l=TD(a.baseId,r),c=DD(a.baseId,r),u=r===a.value,f=m.useRef(u);return m.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),m.createElement(er,{present:o||u},({present:h})=>m.createElement(Qe.div,he({"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!h,id:c,tabIndex:0},s,{ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0}}),h&&i))});function TD(e,t){return`${e}-trigger-${t}`}function DD(e,t){return`${e}-content-${t}`}const tV=YB,$D=XB,AD=JB,kD=eV,MD=tV,Tw=V.forwardRef(({className:e,...t},n)=>O.jsx($D,{ref:n,className:Ee("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Tw.displayName=$D.displayName;const Dw=V.forwardRef(({className:e,...t},n)=>O.jsx(AD,{ref:n,className:Ee("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}));Dw.displayName=AD.displayName;const $w=V.forwardRef(({className:e,...t},n)=>O.jsx(kD,{ref:n,className:Ee("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));$w.displayName=kD.displayName;var ID={exports:{}},$f={},F0={exports:{}};(function(e,t){(function(n,r){r(t)})(Vs,function(n){function r(ie){return function(ae,ye,G,be,_e,Pe,Te){return ie(ae,ye,Te)}}function o(ie){return function(ae,ye,G,be){if(!ae||!ye||typeof ae!="object"||typeof ye!="object")return ie(ae,ye,G,be);var _e=be.get(ae),Pe=be.get(ye);if(_e&&Pe)return _e===ye&&Pe===ae;be.set(ae,ye),be.set(ye,ae);var Te=ie(ae,ye,G,be);return be.delete(ae),be.delete(ye),Te}}function i(ie,te){var ae={};for(var ye in ie)ae[ye]=ie[ye];for(var ye in te)ae[ye]=te[ye];return ae}function s(ie){return ie.constructor===Object||ie.constructor==null}function a(ie){return typeof ie.then=="function"}function l(ie,te){return ie===te||ie!==ie&&te!==te}var c="[object Arguments]",u="[object Boolean]",f="[object Date]",h="[object RegExp]",g="[object Map]",v="[object Number]",b="[object Object]",x="[object Set]",w="[object String]",_=Object.prototype.toString;function S(ie){var te=ie.areArraysEqual,ae=ie.areDatesEqual,ye=ie.areMapsEqual,G=ie.areObjectsEqual,be=ie.areRegExpsEqual,_e=ie.areSetsEqual,Pe=ie.createIsNestedEqual,Te=Pe(Ue);function Ue(Be,Ie,Ke){if(Be===Ie)return!0;if(!Be||!Ie||typeof Be!="object"||typeof Ie!="object")return Be!==Be&&Ie!==Ie;if(s(Be)&&s(Ie))return G(Be,Ie,Te,Ke);var lt=Array.isArray(Be),It=Array.isArray(Ie);if(lt||It)return lt===It&&te(Be,Ie,Te,Ke);var $t=_.call(Be);return $t!==_.call(Ie)?!1:$t===f?ae(Be,Ie,Te,Ke):$t===h?be(Be,Ie,Te,Ke):$t===g?ye(Be,Ie,Te,Ke):$t===x?_e(Be,Ie,Te,Ke):$t===b||$t===c?a(Be)||a(Ie)?!1:G(Be,Ie,Te,Ke):$t===u||$t===v||$t===w?l(Be.valueOf(),Ie.valueOf()):!1}return Ue}function R(ie,te,ae,ye){var G=ie.length;if(te.length!==G)return!1;for(;G-- >0;)if(!ae(ie[G],te[G],G,G,ie,te,ye))return!1;return!0}var C=o(R);function P(ie,te){return l(ie.valueOf(),te.valueOf())}function A(ie,te,ae,ye){var G=ie.size===te.size;if(!G)return!1;if(!ie.size)return!0;var be={},_e=0;return ie.forEach(function(Pe,Te){if(G){var Ue=!1,Be=0;te.forEach(function(Ie,Ke){!Ue&&!be[Be]&&(Ue=ae(Te,Ke,_e,Be,ie,te,ye)&&ae(Pe,Ie,Te,Ke,ie,te,ye))&&(be[Be]=!0),Be++}),_e++,G=Ue}}),G}var k=o(A),D="_owner",I=Object.prototype.hasOwnProperty;function F(ie,te,ae,ye){var G=Object.keys(ie),be=G.length;if(Object.keys(te).length!==be)return!1;for(var _e;be-- >0;){if(_e=G[be],_e===D){var Pe=!!ie.$$typeof,Te=!!te.$$typeof;if((Pe||Te)&&Pe!==Te)return!1}if(!I.call(te,_e)||!ae(ie[_e],te[_e],_e,_e,ie,te,ye))return!1}return!0}var B=o(F);function K(ie,te){return ie.source===te.source&&ie.flags===te.flags}function Z(ie,te,ae,ye){var G=ie.size===te.size;if(!G)return!1;if(!ie.size)return!0;var be={};return ie.forEach(function(_e,Pe){if(G){var Te=!1,Ue=0;te.forEach(function(Be,Ie){!Te&&!be[Ue]&&(Te=ae(_e,Be,Pe,Ie,ie,te,ye))&&(be[Ue]=!0),Ue++}),G=Te}}),G}var z=o(Z),Q=Object.freeze({areArraysEqual:R,areDatesEqual:P,areMapsEqual:A,areObjectsEqual:F,areRegExpsEqual:K,areSetsEqual:Z,createIsNestedEqual:r}),W=Object.freeze({areArraysEqual:C,areDatesEqual:P,areMapsEqual:k,areObjectsEqual:B,areRegExpsEqual:K,areSetsEqual:z,createIsNestedEqual:r}),Y=S(Q);function oe(ie,te){return Y(ie,te,void 0)}var $=S(i(Q,{createIsNestedEqual:function(){return l}}));function H(ie,te){return $(ie,te,void 0)}var J=S(W);function N(ie,te){return J(ie,te,new WeakMap)}var ce=S(i(W,{createIsNestedEqual:function(){return l}}));function le(ie,te){return ce(ie,te,new WeakMap)}function de(ie){return S(i(Q,ie(Q)))}function pe(ie){var te=S(i(W,ie(W)));return function(ae,ye,G){return G===void 0&&(G=new WeakMap),te(ae,ye,G)}}n.circularDeepEqual=N,n.circularShallowEqual=le,n.createCustomCircularEqual=pe,n.createCustomEqual=de,n.deepEqual=oe,n.sameValueZeroEqual=l,n.shallowEqual=H,Object.defineProperty(n,"__esModule",{value:!0})})})(F0,F0.exports);var Aw=F0.exports;const kw=dw(yj);var Ot={},nV=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(Ot,"__esModule",{value:!0});Ot.bottom=Mw;Ot.childrenEqual=sV;Ot.cloneLayout=ND;Ot.cloneLayoutItem=il;Ot.collides=cm;Ot.compact=FD;Ot.compactItem=jD;Ot.compactType=xV;Ot.correctBounds=zD;Ot.fastPositionEqual=lV;Ot.fastRGLPropsEqual=void 0;Ot.getAllCollisions=BD;Ot.getFirstCollision=qa;Ot.getLayoutItem=Iw;Ot.getStatics=Nw;Ot.modifyLayout=LD;Ot.moveElement=td;Ot.moveElementAwayFromCollision=z0;Ot.noop=void 0;Ot.perc=uV;Ot.resizeItemInDirection=mV;Ot.setTopLeft=bV;Ot.setTransform=vV;Ot.sortLayoutItems=Vw;Ot.sortLayoutItemsByColRow=qD;Ot.sortLayoutItemsByRowCol=UD;Ot.synchronizeLayoutWithChildren=yV;Ot.validateLayout=GD;Ot.withLayoutItem=iV;var uR=Aw,ed=rV(m);function rV(e){return e&&e.__esModule?e:{default:e}}const oV=process.env.NODE_ENV==="production";function Mw(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 ND(e){const t=Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=il(e[n]);return t}function LD(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 iV(e,t,n){let r=Iw(e,t);return r?(r=n(il(r)),e=LD(e,r),[e,r]):[e,null]}function il(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 sV(e,t){return(0,uR.deepEqual)(ed.default.Children.map(e,n=>n==null?void 0:n.key),ed.default.Children.map(t,n=>n==null?void 0:n.key))&&(0,uR.deepEqual)(ed.default.Children.map(e,n=>n==null?void 0:n.props["data-grid"]),ed.default.Children.map(t,n=>n==null?void 0:n.props["data-grid"]))}const aV=nV;Ot.fastRGLPropsEqual=aV;function lV(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function cm(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 FD(e,t,n,r){const o=Nw(e),i=Vw(e,t),s=Array(e.length);for(let a=0,l=i.length;a<l;a++){let c=il(i[a]);c.static||(c=jD(o,c,t,n,i,r),o.push(c)),s[e.indexOf(i[a])]=c,c.moved=!1}return s}const cV={x:"w",y:"h"};function j0(e,t,n,r){const o=cV[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;cm(t,a)&&j0(e,a,n+t[o],r)}}t[r]=n}function jD(e,t,n,r,o,i){const s=n==="vertical",a=n==="horizontal";if(s)for(t.y=Math.min(Mw(e),t.y);t.y>0&&!qa(e,t);)t.y--;else if(a)for(;t.x>0&&!qa(e,t);)t.x--;let l;for(;(l=qa(e,t))&&!(n===null&&i);)if(a?j0(o,t,l.x+l.w,"x"):j0(o,t,l.y+l.h,"y"),a&&t.x+t.w>r)for(t.x=r-t.w,t.y++;t.x>0&&!qa(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function zD(e,t){const n=Nw(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(;qa(n,i);)i.y++}return e}function Iw(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function qa(e,t){for(let n=0,r=e.length;n<r;n++)if(cm(e[n],t))return e[n]}function BD(e,t){return e.filter(n=>cm(n,t))}function Nw(e){return e.filter(t=>t.static)}function td(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 c=t.x,u=t.y;typeof n=="number"&&(t.x=n),typeof r=="number"&&(t.y=r),t.moved=!0;let f=Vw(e,s);(s==="vertical"&&typeof r=="number"?u>=r:s==="horizontal"&&typeof n=="number"?c>=n:!1)&&(f=f.reverse());const g=BD(f,t),v=g.length>0;if(v&&l)return ND(e);if(v&&i)return"Collision prevented on ".concat(t.i,", reverting."),t.x=c,t.y=u,t.moved=!1,e;for(let b=0,x=g.length;b<x;b++){const w=g[b];"Resolving collision between ".concat(t.i," at [").concat(t.x,",").concat(t.y,"] and ").concat(w.i," at [").concat(w.x,",").concat(w.y,"]"),!w.moved&&(w.static?e=z0(e,w,t,o,s):e=z0(e,t,w,o,s))}return e}function z0(e,t,n,r,o,i){const s=o==="horizontal",a=o==="vertical",l=t.static;if(r){r=!1;const f={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"},h=qa(e,f),g=h&&h.y+h.h>t.y,v=h&&t.x+t.w>h.x;if(h){if(g&&a)return td(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(v&&s)return td(e,t,n.x,void 0,r,l,o)}else return"Doing reverse collision on ".concat(n.i," up to [").concat(f.x,",").concat(f.y,"]."),td(e,n,s?f.x:void 0,a?f.y:void 0,r,l,o)}const c=s?n.x+1:void 0,u=a?n.y+1:void 0;return c==null&&u==null?e:td(e,n,s?n.x+1:void 0,a?n.y+1:void 0,r,l,o)}function uV(e){return e*100+"%"}const VD=(e,t,n,r)=>e+n>r?t:n,HD=(e,t,n)=>e<0?t:n,WD=e=>Math.max(0,e),Lw=e=>Math.max(0,e),Fw=(e,t,n)=>{let{left:r,height:o,width:i}=t;const s=e.top-(o-e.height);return{left:r,width:i,height:HD(s,e.height,o),top:Lw(s)}},jw=(e,t,n)=>{let{top:r,left:o,height:i,width:s}=t;return{top:r,height:i,width:VD(e.left,e.width,s,n),left:WD(o)}},zw=(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:VD(e.left,e.width,i,n),top:Lw(r),left:WD(s)}},Bw=(e,t,n)=>{let{top:r,left:o,height:i,width:s}=t;return{width:s,left:o,height:HD(r,e.height,i),top:Lw(r)}},dV=function(){return Fw(arguments.length<=0?void 0:arguments[0],jw(...arguments))},fV=function(){return Fw(arguments.length<=0?void 0:arguments[0],zw(...arguments))},hV=function(){return Bw(arguments.length<=0?void 0:arguments[0],jw(...arguments))},pV=function(){return Bw(arguments.length<=0?void 0:arguments[0],zw(...arguments))},gV={n:Fw,ne:dV,e:jw,se:hV,s:Bw,sw:pV,w:zw,nw:fV};function mV(e,t,n,r){const o=gV[e];return o?o(t,{...t,...n},r):n}function vV(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 bV(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 Vw(e,t){return t==="horizontal"?qD(e):t==="vertical"?UD(e):e}function UD(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 qD(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 yV(e,t,n,r,o){e=e||[];const i=[];ed.default.Children.forEach(t,a=>{if((a==null?void 0:a.key)==null)return;const l=Iw(e,String(a.key)),c=a.props["data-grid"];l&&c==null?i.push(il(l)):c?(oV||GD([c],"ReactGridLayout.children"),i.push(il({...c,i:a.key}))):i.push(il({w:1,h:1,x:0,y:Mw(i),i:String(a.key)}))});const s=zD(i,{cols:n});return o?s:FD(s,r,n)}function GD(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 xV(e){const{verticalCompact:t,compactType:n}=e||{};return t===!1?null:n}const wV=()=>{};Ot.noop=wV;var Ri={};Object.defineProperty(Ri,"__esModule",{value:!0});Ri.calcGridColWidth=um;Ri.calcGridItemPosition=_V;Ri.calcGridItemWHPx=B0;Ri.calcWH=CV;Ri.calcXY=SV;Ri.clamp=Ga;function um(e){const{margin:t,containerPadding:n,containerWidth:r,cols:o}=e;return(r-t[0]*(o-1)-n[0]*2)/o}function B0(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function _V(e,t,n,r,o,i){const{margin:s,containerPadding:a,rowHeight:l}=e,c=um(e),u={};return i&&i.resizing?(u.width=Math.round(i.resizing.width),u.height=Math.round(i.resizing.height)):(u.width=B0(r,c,s[0]),u.height=B0(o,l,s[1])),i&&i.dragging?(u.top=Math.round(i.dragging.top),u.left=Math.round(i.dragging.left)):i&&i.resizing&&typeof i.resizing.top=="number"&&typeof i.resizing.left=="number"?(u.top=Math.round(i.resizing.top),u.left=Math.round(i.resizing.left)):(u.top=Math.round((l+s[1])*n+a[1]),u.left=Math.round((c+s[0])*t+a[0])),u}function SV(e,t,n,r,o){const{margin:i,cols:s,rowHeight:a,maxRows:l}=e,c=um(e);let u=Math.round((n-i[0])/(c+i[0])),f=Math.round((t-i[1])/(a+i[1]));return u=Ga(u,0,s-r),f=Ga(f,0,l-o),{x:u,y:f}}function CV(e,t,n,r,o,i){const{margin:s,maxRows:a,cols:l,rowHeight:c}=e,u=um(e);let f=Math.round((t+s[0])/(u+s[0])),h=Math.round((n+s[1])/(c+s[1])),g=Ga(f,0,l-r),v=Ga(h,0,a-o);return["sw","w","nw"].indexOf(i)!==-1&&(g=Ga(f,0,l)),["nw","n","ne"].indexOf(i)!==-1&&(v=Ga(h,0,a)),{w:g,h:v}}function Ga(e,t,n){return Math.max(Math.min(e,n),t)}var dm={},V0={exports:{}},$b,dR;function Hw(){if(dR)return $b;dR=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return $b=e,$b}var Ab,fR;function EV(){if(fR)return Ab;fR=1;var e=Hw();function t(){}function n(){}return n.resetWarningCache=t,Ab=function(){function r(s,a,l,c,u,f){if(f!==e){var h=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 h.name="Invariant Violation",h}}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},Ab}var qh={exports:{}},qt={};/** @license React v16.13.1
|
|
89
89
|
* react-is.development.js
|
|
90
90
|
*
|
|
91
91
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -250,7 +250,7 @@ Valid keys: `+JSON.stringify(Object.keys($),null," "));var G=ye(pe,ae,ce,le,de+
|
|
|
250
250
|
* This source code is licensed under the ISC license.
|
|
251
251
|
* See the LICENSE file in the root directory of this source tree.
|
|
252
252
|
*/const Pm=Dn("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),rQ=({data:e,filename:t="output.csv"})=>{const n=()=>{if(e.length===0)return;const r=[],o=Object.keys(e[0]);r.push(o.join(","));for(const c of e){const u=o.map(f=>`"${(""+c[f]).replace(/"/g,'""')}"`);r.push(u.join(","))}const i=r.join(`
|
|
253
|
-
`),s=new Blob([i],{type:"text/csv"}),a=window.URL.createObjectURL(s),l=document.createElement("a");l.setAttribute("hidden",""),l.setAttribute("href",a),l.setAttribute("download",t),document.body.appendChild(l),l.click(),document.body.removeChild(l)};return O.jsx(XX,{onClick:n,className:"h-[14px] w-[14px] text-foreground/30 hover:cursor-pointer hover:text-foreground/50"})};function oQ({frame:e}){var _;const t=ke(S=>S.isDashboardEditing),n=ke(S=>S.filterValues),r=ke(S=>S.isVisualEditing),o=ke(S=>S.selectedSheetId);ke(S=>S.currentBreakpoint);const{removeFrame:i}=ke(S=>S.actions),s=ke(S=>S.actions.setIsVisualEditing),a=Ar(S=>S.actions.setFilterValues),l=Ar(S=>S.actions.setApplyFilters),{setCard:c,setFrame:u,setQueryResultColumns:f}=Ar(S=>S.actions),h=Ar(S=>S.actions.setSelectedConnectionId),g=Ar(S=>S.actions.setSelectedDatabaseName),v=Ar(S=>S.actions.setSelectedSchemaName),b=Ar(S=>S.actions.setSelectedTableName),x=e.cards.find(S=>S.id===e.activeCardId);function w(){s(!r),c(x);const{dimensionKeys:S}=ar((x==null?void 0:x.data)||[]);f(S),u(e),x!=null&&x.connectionId&&h(x==null?void 0:x.connectionId),x!=null&&x.lastSelectedDatabase&&g(x==null?void 0:x.lastSelectedDatabase),x!=null&&x.lastSelectedSchema&&v(x==null?void 0:x.lastSelectedSchema),x!=null&&x.lastSelectedTable&&b(x==null?void 0:x.lastSelectedTable),n&&(a(n),l(!0))}return O.jsx("section",{className:"absolute right-2 top-2 z-10",children:O.jsxs("div",{className:"flex items-center gap-2",children:[t&&(r?O.jsx(_X,{onClick:()=>{s(!r)},className:"h-[14px] w-[14px] text-foreground/30 hover:cursor-pointer hover:text-foreground/50"}):O.jsx(CX,{role:"edit-visual",onClick:w,className:"h-[14px] w-[14px] text-foreground/30 hover:cursor-pointer hover:text-foreground/50"})),t&&O.jsx(TA,{onClick:()=>i(o,e.id),className:"h-[14px] w-[14px] text-foreground/30 hover:cursor-pointer hover:text-foreground/50"}),((_=x.preferences)==null?void 0:_.allowDownload)===!0&&O.jsx(rQ,{data:(x==null?void 0:x.data)||[],filename:x.title})]})})}function iQ(e,t=globalThis==null?void 0:globalThis.document){const n=Ln(e);m.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r),()=>t.removeEventListener("keydown",r)},[n,t])}const px="dismissableLayer.update",sQ="dismissableLayer.pointerDownOutside",aQ="dismissableLayer.focusOutside";let sP;const lQ=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ff=m.forwardRef((e,t)=>{var n;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:a,onDismiss:l,...c}=e,u=m.useContext(lQ),[f,h]=m.useState(null),g=(n=f==null?void 0:f.ownerDocument)!==null&&n!==void 0?n:globalThis==null?void 0:globalThis.document,[,v]=m.useState({}),b=_t(t,k=>h(k)),x=Array.from(u.layers),[w]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),_=x.indexOf(w),S=f?x.indexOf(f):-1,R=u.layersWithOutsidePointerEventsDisabled.size>0,C=S>=_,P=cQ(k=>{const D=k.target,I=[...u.branches].some(F=>F.contains(D));!C||I||(i==null||i(k),a==null||a(k),k.defaultPrevented||l==null||l())},g),A=uQ(k=>{const D=k.target;[...u.branches].some(F=>F.contains(D))||(s==null||s(k),a==null||a(k),k.defaultPrevented||l==null||l())},g);return iQ(k=>{S===u.layers.size-1&&(o==null||o(k),!k.defaultPrevented&&l&&(k.preventDefault(),l()))},g),m.useEffect(()=>{if(f)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(sP=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),aP(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=sP)}},[f,g,r,u]),m.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),aP())},[f,u]),m.useEffect(()=>{const k=()=>v({});return document.addEventListener(px,k),()=>document.removeEventListener(px,k)},[]),m.createElement(Qe.div,he({},c,{ref:b,style:{pointerEvents:R?C?"auto":"none":void 0,...e.style},onFocusCapture:Me(e.onFocusCapture,A.onFocusCapture),onBlurCapture:Me(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:Me(e.onPointerDownCapture,P.onPointerDownCapture)}))});function cQ(e,t=globalThis==null?void 0:globalThis.document){const n=Ln(e),r=m.useRef(!1),o=m.useRef(()=>{});return m.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let c=function(){NA(sQ,n,l,{discrete:!0})};const l={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function uQ(e,t=globalThis==null?void 0:globalThis.document){const n=Ln(e),r=m.useRef(!1);return m.useEffect(()=>{const o=i=>{i.target&&!r.current&&NA(aQ,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function aP(){const e=new CustomEvent(px);document.dispatchEvent(e)}function NA(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?CD(o,i):o.dispatchEvent(i)}const dQ=["top","right","bottom","left"],ca=Math.min,no=Math.max,Tg=Math.round,mp=Math.floor,ua=e=>({x:e,y:e}),fQ={left:"right",right:"left",bottom:"top",top:"bottom"},hQ={start:"end",end:"start"};function gx(e,t,n){return no(e,ca(t,n))}function ss(e,t){return typeof e=="function"?e(t):e}function as(e){return e.split("-")[0]}function iu(e){return e.split("-")[1]}function R1(e){return e==="x"?"y":"x"}function O1(e){return e==="y"?"height":"width"}function su(e){return["top","bottom"].includes(as(e))?"y":"x"}function P1(e){return R1(su(e))}function pQ(e,t,n){n===void 0&&(n=!1);const r=iu(e),o=P1(e),i=O1(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=Dg(s)),[s,Dg(s)]}function gQ(e){const t=Dg(e);return[mx(e),t,mx(t)]}function mx(e){return e.replace(/start|end/g,t=>hQ[t])}function mQ(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:s;default:return[]}}function vQ(e,t,n,r){const o=iu(e);let i=mQ(as(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(mx)))),i}function Dg(e){return e.replace(/left|right|bottom|top/g,t=>fQ[t])}function bQ(e){return{top:0,right:0,bottom:0,left:0,...e}}function LA(e){return typeof e!="number"?bQ(e):{top:e,right:e,bottom:e,left:e}}function $g(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function lP(e,t,n){let{reference:r,floating:o}=e;const i=su(t),s=P1(t),a=O1(s),l=as(t),c=i==="y",u=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,h=r[a]/2-o[a]/2;let g;switch(l){case"top":g={x:u,y:r.y-o.height};break;case"bottom":g={x:u,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:f};break;case"left":g={x:r.x-o.width,y:f};break;default:g={x:r.x,y:r.y}}switch(iu(t)){case"start":g[s]-=h*(n&&c?-1:1);break;case"end":g[s]+=h*(n&&c?-1:1);break}return g}const yQ=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=lP(c,r,l),h=r,g={},v=0;for(let b=0;b<a.length;b++){const{name:x,fn:w}=a[b],{x:_,y:S,data:R,reset:C}=await w({x:u,y:f,initialPlacement:r,placement:h,strategy:o,middlewareData:g,rects:c,platform:s,elements:{reference:e,floating:t}});if(u=_??u,f=S??f,g={...g,[x]:{...g[x],...R}},C&&v<=50){v++,typeof C=="object"&&(C.placement&&(h=C.placement),C.rects&&(c=C.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:u,y:f}=lP(c,h,l)),b=-1;continue}}return{x:u,y:f,placement:h,strategy:o,middlewareData:g}};async function Fd(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:g=0}=ss(t,e),v=LA(g),x=a[h?f==="floating"?"reference":"floating":f],w=$g(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(x)))==null||n?x:x.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),_=f==="floating"?{...s.floating,x:r,y:o}:s.reference,S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),R=await(i.isElement==null?void 0:i.isElement(S))?await(i.getScale==null?void 0:i.getScale(S))||{x:1,y:1}:{x:1,y:1},C=$g(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:_,offsetParent:S,strategy:l}):_);return{top:(w.top-C.top+v.top)/R.y,bottom:(C.bottom-w.bottom+v.bottom)/R.y,left:(w.left-C.left+v.left)/R.x,right:(C.right-w.right+v.right)/R.x}}const cP=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=ss(e,t)||{};if(c==null)return{};const f=LA(u),h={x:n,y:r},g=P1(o),v=O1(g),b=await s.getDimensions(c),x=g==="y",w=x?"top":"left",_=x?"bottom":"right",S=x?"clientHeight":"clientWidth",R=i.reference[v]+i.reference[g]-h[g]-i.floating[v],C=h[g]-i.reference[g],P=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let A=P?P[S]:0;(!A||!await(s.isElement==null?void 0:s.isElement(P)))&&(A=a.floating[S]||i.floating[v]);const k=R/2-C/2,D=A/2-b[v]/2-1,I=ca(f[w],D),F=ca(f[_],D),B=I,K=A-b[v]-F,Z=A/2-b[v]/2+k,z=gx(B,Z,K),Q=!l.arrow&&iu(o)!=null&&Z!=z&&i.reference[v]/2-(Z<B?I:F)-b[v]/2<0,W=Q?Z<B?Z-B:Z-K:0;return{[g]:h[g]+W,data:{[g]:z,centerOffset:Z-z-W,...Q&&{alignmentOffset:W}},reset:Q}}}),xQ=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:b=!0,...x}=ss(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const w=as(o),_=as(a)===a,S=await(l.isRTL==null?void 0:l.isRTL(c.floating)),R=h||(_||!b?[Dg(a)]:gQ(a));!h&&v!=="none"&&R.push(...vQ(a,b,v,S));const C=[a,...R],P=await Fd(t,x),A=[];let k=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&A.push(P[w]),f){const B=pQ(o,s,S);A.push(P[B[0]],P[B[1]])}if(k=[...k,{placement:o,overflows:A}],!A.every(B=>B<=0)){var D,I;const B=(((D=i.flip)==null?void 0:D.index)||0)+1,K=C[B];if(K)return{data:{index:B,overflows:k},reset:{placement:K}};let Z=(I=k.filter(z=>z.overflows[0]<=0).sort((z,Q)=>z.overflows[1]-Q.overflows[1])[0])==null?void 0:I.placement;if(!Z)switch(g){case"bestFit":{var F;const z=(F=k.map(Q=>[Q.placement,Q.overflows.filter(W=>W>0).reduce((W,Y)=>W+Y,0)]).sort((Q,W)=>Q[1]-W[1])[0])==null?void 0:F[0];z&&(Z=z);break}case"initialPlacement":Z=a;break}if(o!==Z)return{reset:{placement:Z}}}return{}}}};function uP(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function dP(e){return dQ.some(t=>e[t]>=0)}const wQ=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=ss(e,t);switch(r){case"referenceHidden":{const i=await Fd(t,{...o,elementContext:"reference"}),s=uP(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:dP(s)}}}case"escaped":{const i=await Fd(t,{...o,altBoundary:!0}),s=uP(i,n.floating);return{data:{escapedOffsets:s,escaped:dP(s)}}}default:return{}}}}};async function _Q(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=as(n),a=iu(n),l=su(n)==="y",c=["left","top"].includes(s)?-1:1,u=i&&l?-1:1,f=ss(t,e);let{mainAxis:h,crossAxis:g,alignmentAxis:v}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return a&&typeof v=="number"&&(g=a==="end"?v*-1:v),l?{x:g*u,y:h*c}:{x:h*c,y:g*u}}const SQ=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,l=await _Q(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},CQ=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:x=>{let{x:w,y:_}=x;return{x:w,y:_}}},...l}=ss(e,t),c={x:n,y:r},u=await Fd(t,l),f=su(as(o)),h=R1(f);let g=c[h],v=c[f];if(i){const x=h==="y"?"top":"left",w=h==="y"?"bottom":"right",_=g+u[x],S=g-u[w];g=gx(_,g,S)}if(s){const x=f==="y"?"top":"left",w=f==="y"?"bottom":"right",_=v+u[x],S=v-u[w];v=gx(_,v,S)}const b=a.fn({...t,[h]:g,[f]:v});return{...b,data:{x:b.x-n,y:b.y-r}}}}},EQ=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:s}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=ss(e,t),u={x:n,y:r},f=su(o),h=R1(f);let g=u[h],v=u[f];const b=ss(a,t),x=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(l){const S=h==="y"?"height":"width",R=i.reference[h]-i.floating[S]+x.mainAxis,C=i.reference[h]+i.reference[S]-x.mainAxis;g<R?g=R:g>C&&(g=C)}if(c){var w,_;const S=h==="y"?"width":"height",R=["top","left"].includes(as(o)),C=i.reference[f]-i.floating[S]+(R&&((w=s.offset)==null?void 0:w[f])||0)+(R?0:x.crossAxis),P=i.reference[f]+i.reference[S]+(R?0:((_=s.offset)==null?void 0:_[f])||0)-(R?x.crossAxis:0);v<C?v=C:v>P&&(v=P)}return{[h]:g,[f]:v}}}},RQ=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:i}=t,{apply:s=()=>{},...a}=ss(e,t),l=await Fd(t,a),c=as(n),u=iu(n),f=su(n)==="y",{width:h,height:g}=r.floating;let v,b;c==="top"||c==="bottom"?(v=c,b=u===(await(o.isRTL==null?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(b=c,v=u==="end"?"top":"bottom");const x=g-l[v],w=h-l[b],_=!t.middlewareData.shift;let S=x,R=w;if(f){const P=h-l.left-l.right;R=u||_?ca(w,P):P}else{const P=g-l.top-l.bottom;S=u||_?ca(x,P):P}if(_&&!u){const P=no(l.left,0),A=no(l.right,0),k=no(l.top,0),D=no(l.bottom,0);f?R=h-2*(P!==0||A!==0?P+A:no(l.left,l.right)):S=g-2*(k!==0||D!==0?k+D:no(l.top,l.bottom))}await s({...t,availableWidth:R,availableHeight:S});const C=await o.getDimensions(i.floating);return h!==C.width||g!==C.height?{reset:{rects:!0}}:{}}}};function da(e){return FA(e)?(e.nodeName||"").toLowerCase():"#document"}function so(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ds(e){var t;return(t=(FA(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function FA(e){return e instanceof Node||e instanceof so(e).Node}function ls(e){return e instanceof Element||e instanceof so(e).Element}function Si(e){return e instanceof HTMLElement||e instanceof so(e).HTMLElement}function fP(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof so(e).ShadowRoot}function jf(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=$o(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function OQ(e){return["table","td","th"].includes(da(e))}function T1(e){const t=D1(),n=$o(e);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function PQ(e){let t=Yc(e);for(;Si(t)&&!Tm(t);){if(T1(t))return t;t=Yc(t)}return null}function D1(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Tm(e){return["html","body","#document"].includes(da(e))}function $o(e){return so(e).getComputedStyle(e)}function Dm(e){return ls(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Yc(e){if(da(e)==="html")return e;const t=e.assignedSlot||e.parentNode||fP(e)&&e.host||ds(e);return fP(t)?t.host:t}function jA(e){const t=Yc(e);return Tm(t)?e.ownerDocument?e.ownerDocument.body:e.body:Si(t)&&jf(t)?t:jA(t)}function jd(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=jA(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=so(o);return i?t.concat(s,s.visualViewport||[],jf(o)?o:[],s.frameElement&&n?jd(s.frameElement):[]):t.concat(o,jd(o,[],n))}function zA(e){const t=$o(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Si(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=Tg(n)!==i||Tg(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function $1(e){return ls(e)?e:e.contextElement}function yc(e){const t=$1(e);if(!Si(t))return ua(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=zA(t);let s=(i?Tg(n.width):n.width)/r,a=(i?Tg(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const TQ=ua(0);function BA(e){const t=so(e);return!D1()||!t.visualViewport?TQ:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function DQ(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==so(e)?!1:t}function ml(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=$1(e);let s=ua(1);t&&(r?ls(r)&&(s=yc(r)):s=yc(e));const a=DQ(i,n,r)?BA(i):ua(0);let l=(o.left+a.x)/s.x,c=(o.top+a.y)/s.y,u=o.width/s.x,f=o.height/s.y;if(i){const h=so(i),g=r&&ls(r)?so(r):r;let v=h.frameElement;for(;v&&r&&g!==h;){const b=yc(v),x=v.getBoundingClientRect(),w=$o(v),_=x.left+(v.clientLeft+parseFloat(w.paddingLeft))*b.x,S=x.top+(v.clientTop+parseFloat(w.paddingTop))*b.y;l*=b.x,c*=b.y,u*=b.x,f*=b.y,l+=_,c+=S,v=so(v).frameElement}}return $g({width:u,height:f,x:l,y:c})}function $Q(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=Si(n),i=ds(n);if(n===i)return t;let s={scrollLeft:0,scrollTop:0},a=ua(1);const l=ua(0);if((o||!o&&r!=="fixed")&&((da(n)!=="body"||jf(i))&&(s=Dm(n)),Si(n))){const c=ml(n);a=yc(n),l.x=c.x+n.clientLeft,l.y=c.y+n.clientTop}return{width:t.width*a.x,height:t.height*a.y,x:t.x*a.x-s.scrollLeft*a.x+l.x,y:t.y*a.y-s.scrollTop*a.y+l.y}}function AQ(e){return Array.from(e.getClientRects())}function VA(e){return ml(ds(e)).left+Dm(e).scrollLeft}function kQ(e){const t=ds(e),n=Dm(e),r=e.ownerDocument.body,o=no(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=no(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+VA(e);const a=-n.scrollTop;return $o(r).direction==="rtl"&&(s+=no(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function MQ(e,t){const n=so(e),r=ds(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;const c=D1();(!c||c&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:i,height:s,x:a,y:l}}function IQ(e,t){const n=ml(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Si(e)?yc(e):ua(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,l=o*i.x,c=r*i.y;return{width:s,height:a,x:l,y:c}}function hP(e,t,n){let r;if(t==="viewport")r=MQ(e,n);else if(t==="document")r=kQ(ds(e));else if(ls(t))r=IQ(t,n);else{const o=BA(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return $g(r)}function HA(e,t){const n=Yc(e);return n===t||!ls(n)||Tm(n)?!1:$o(n).position==="fixed"||HA(n,t)}function NQ(e,t){const n=t.get(e);if(n)return n;let r=jd(e,[],!1).filter(a=>ls(a)&&da(a)!=="body"),o=null;const i=$o(e).position==="fixed";let s=i?Yc(e):e;for(;ls(s)&&!Tm(s);){const a=$o(s),l=T1(s);!l&&a.position==="fixed"&&(o=null),(i?!l&&!o:!l&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||jf(s)&&!l&&HA(e,s))?r=r.filter(u=>u!==s):o=a,s=Yc(s)}return t.set(e,r),r}function LQ(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?NQ(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,u)=>{const f=hP(t,u,o);return c.top=no(f.top,c.top),c.right=ca(f.right,c.right),c.bottom=ca(f.bottom,c.bottom),c.left=no(f.left,c.left),c},hP(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function FQ(e){return zA(e)}function jQ(e,t,n){const r=Si(t),o=ds(t),i=n==="fixed",s=ml(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=ua(0);if(r||!r&&!i)if((da(t)!=="body"||jf(o))&&(a=Dm(t)),r){const c=ml(t,!0,i,t);l.x=c.x+t.clientLeft,l.y=c.y+t.clientTop}else o&&(l.x=VA(o));return{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}function pP(e,t){return!Si(e)||$o(e).position==="fixed"?null:t?t(e):e.offsetParent}function WA(e,t){const n=so(e);if(!Si(e))return n;let r=pP(e,t);for(;r&&OQ(r)&&$o(r).position==="static";)r=pP(r,t);return r&&(da(r)==="html"||da(r)==="body"&&$o(r).position==="static"&&!T1(r))?n:r||PQ(e)||n}const zQ=async function(e){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||WA,i=this.getDimensions;return{reference:jQ(t,await o(n),r),floating:{x:0,y:0,...await i(n)}}};function BQ(e){return $o(e).direction==="rtl"}const VQ={convertOffsetParentRelativeRectToViewportRelativeRect:$Q,getDocumentElement:ds,getClippingRect:LQ,getOffsetParent:WA,getElementRects:zQ,getClientRects:AQ,getDimensions:FQ,getScale:yc,isElement:ls,isRTL:BQ};function HQ(e,t){let n=null,r;const o=ds(e);function i(){clearTimeout(r),n&&n.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const{left:c,top:u,width:f,height:h}=e.getBoundingClientRect();if(a||t(),!f||!h)return;const g=mp(u),v=mp(o.clientWidth-(c+f)),b=mp(o.clientHeight-(u+h)),x=mp(c),_={rootMargin:-g+"px "+-v+"px "+-b+"px "+-x+"px",threshold:no(0,ca(1,l))||1};let S=!0;function R(C){const P=C[0].intersectionRatio;if(P!==l){if(!S)return s();P?s(!1,P):r=setTimeout(()=>{s(!1,1e-7)},100)}S=!1}try{n=new IntersectionObserver(R,{..._,root:o.ownerDocument})}catch{n=new IntersectionObserver(R,_)}n.observe(e)}return s(!0),i}function WQ(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=$1(e),u=o||i?[...c?jd(c):[],...jd(t)]:[];u.forEach(w=>{o&&w.addEventListener("scroll",n,{passive:!0}),i&&w.addEventListener("resize",n)});const f=c&&a?HQ(c,n):null;let h=-1,g=null;s&&(g=new ResizeObserver(w=>{let[_]=w;_&&_.target===c&&g&&(g.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{g&&g.observe(t)})),n()}),c&&!l&&g.observe(c),g.observe(t));let v,b=l?ml(e):null;l&&x();function x(){const w=ml(e);b&&(w.x!==b.x||w.y!==b.y||w.width!==b.width||w.height!==b.height)&&n(),b=w,v=requestAnimationFrame(x)}return n(),()=>{u.forEach(w=>{o&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),f&&f(),g&&g.disconnect(),g=null,l&&cancelAnimationFrame(v)}}const UQ=(e,t,n)=>{const r=new Map,o={platform:VQ,...n},i={...o.platform,_c:r};return yQ(e,t,{...o,platform:i})},qQ=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?cP({element:r.current,padding:o}).fn(n):{}:r?cP({element:r,padding:o}).fn(n):{}}}};var og=typeof document<"u"?m.useLayoutEffect:m.useEffect;function Ag(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!Ag(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!Ag(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function UA(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function gP(e,t){const n=UA(e);return Math.round(t*n)/n}function mP(e){const t=V.useRef(e);return og(()=>{t.current=e}),t}function GQ(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,f]=V.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,g]=V.useState(r);Ag(h,r)||g(r);const[v,b]=V.useState(null),[x,w]=V.useState(null),_=V.useCallback(Q=>{Q!=P.current&&(P.current=Q,b(Q))},[b]),S=V.useCallback(Q=>{Q!==A.current&&(A.current=Q,w(Q))},[w]),R=i||v,C=s||x,P=V.useRef(null),A=V.useRef(null),k=V.useRef(u),D=mP(l),I=mP(o),F=V.useCallback(()=>{if(!P.current||!A.current)return;const Q={placement:t,strategy:n,middleware:h};I.current&&(Q.platform=I.current),UQ(P.current,A.current,Q).then(W=>{const Y={...W,isPositioned:!0};B.current&&!Ag(k.current,Y)&&(k.current=Y,uw.flushSync(()=>{f(Y)}))})},[h,t,n,I]);og(()=>{c===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,f(Q=>({...Q,isPositioned:!1})))},[c]);const B=V.useRef(!1);og(()=>(B.current=!0,()=>{B.current=!1}),[]),og(()=>{if(R&&(P.current=R),C&&(A.current=C),R&&C){if(D.current)return D.current(R,C,F);F()}},[R,C,F,D]);const K=V.useMemo(()=>({reference:P,floating:A,setReference:_,setFloating:S}),[_,S]),Z=V.useMemo(()=>({reference:R,floating:C}),[R,C]),z=V.useMemo(()=>{const Q={position:n,left:0,top:0};if(!Z.floating)return Q;const W=gP(Z.floating,u.x),Y=gP(Z.floating,u.y);return a?{...Q,transform:"translate("+W+"px, "+Y+"px)",...UA(Z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:Y}},[n,a,Z.floating,u.x,u.y]);return V.useMemo(()=>({...u,update:F,refs:K,elements:Z,floatingStyles:z}),[u,F,K,Z,z])}function $m(e){const[t,n]=m.useState(void 0);return ur(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,a;if("borderBoxSize"in i){const l=i.borderBoxSize,c=Array.isArray(l)?l[0]:l;s=c.inlineSize,a=c.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}const qA="Popper",[GA,Ti]=Zn(qA),[YQ,YA]=GA(qA),KQ=e=>{const{__scopePopper:t,children:n}=e,[r,o]=m.useState(null);return m.createElement(YQ,{scope:t,anchor:r,onAnchorChange:o},n)},XQ="PopperAnchor",QQ=m.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=YA(XQ,n),s=m.useRef(null),a=_t(t,s);return m.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:m.createElement(Qe.div,he({},o,{ref:a}))}),KA="PopperContent",[JQ,aye]=GA(KA),ZQ=m.forwardRef((e,t)=>{var n,r,o,i,s,a,l,c;const{__scopePopper:u,side:f="bottom",sideOffset:h=0,align:g="center",alignOffset:v=0,arrowPadding:b=0,avoidCollisions:x=!0,collisionBoundary:w=[],collisionPadding:_=0,sticky:S="partial",hideWhenDetached:R=!1,updatePositionStrategy:C="optimized",onPlaced:P,...A}=e,k=YA(KA,u),[D,I]=m.useState(null),F=_t(t,Pe=>I(Pe)),[B,K]=m.useState(null),Z=$m(B),z=(n=Z==null?void 0:Z.width)!==null&&n!==void 0?n:0,Q=(r=Z==null?void 0:Z.height)!==null&&r!==void 0?r:0,W=f+(g!=="center"?"-"+g:""),Y=typeof _=="number"?_:{top:0,right:0,bottom:0,left:0,..._},oe=Array.isArray(w)?w:[w],$=oe.length>0,H={padding:Y,boundary:oe.filter(eJ),altBoundary:$},{refs:J,floatingStyles:N,placement:ce,isPositioned:le,middlewareData:de}=GQ({strategy:"fixed",placement:W,whileElementsMounted:(...Pe)=>WQ(...Pe,{animationFrame:C==="always"}),elements:{reference:k.anchor},middleware:[SQ({mainAxis:h+Q,alignmentAxis:v}),x&&CQ({mainAxis:!0,crossAxis:!1,limiter:S==="partial"?EQ():void 0,...H}),x&&xQ({...H}),RQ({...H,apply:({elements:Pe,rects:Te,availableWidth:Ue,availableHeight:Be})=>{const{width:Ie,height:Ke}=Te.reference,lt=Pe.floating.style;lt.setProperty("--radix-popper-available-width",`${Ue}px`),lt.setProperty("--radix-popper-available-height",`${Be}px`),lt.setProperty("--radix-popper-anchor-width",`${Ie}px`),lt.setProperty("--radix-popper-anchor-height",`${Ke}px`)}}),B&&qQ({element:B,padding:b}),tJ({arrowWidth:z,arrowHeight:Q}),R&&wQ({strategy:"referenceHidden",...H})]}),[pe,ie]=XA(ce),te=Ln(P);ur(()=>{le&&(te==null||te())},[le,te]);const ae=(o=de.arrow)===null||o===void 0?void 0:o.x,ye=(i=de.arrow)===null||i===void 0?void 0:i.y,G=((s=de.arrow)===null||s===void 0?void 0:s.centerOffset)!==0,[be,_e]=m.useState();return ur(()=>{D&&_e(window.getComputedStyle(D).zIndex)},[D]),m.createElement("div",{ref:J.setFloating,"data-radix-popper-content-wrapper":"",style:{...N,transform:le?N.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:be,"--radix-popper-transform-origin":[(a=de.transformOrigin)===null||a===void 0?void 0:a.x,(l=de.transformOrigin)===null||l===void 0?void 0:l.y].join(" ")},dir:e.dir},m.createElement(JQ,{scope:u,placedSide:pe,onArrowChange:K,arrowX:ae,arrowY:ye,shouldHideArrow:G},m.createElement(Qe.div,he({"data-side":pe,"data-align":ie},A,{ref:F,style:{...A.style,animation:le?void 0:"none",opacity:(c=de.hide)!==null&&c!==void 0&&c.referenceHidden?0:void 0}}))))});function eJ(e){return e!==null}const tJ=e=>({name:"transformOrigin",options:e,fn(t){var n,r,o,i,s;const{placement:a,rects:l,middlewareData:c}=t,f=((n=c.arrow)===null||n===void 0?void 0:n.centerOffset)!==0,h=f?0:e.arrowWidth,g=f?0:e.arrowHeight,[v,b]=XA(a),x={start:"0%",center:"50%",end:"100%"}[b],w=((r=(o=c.arrow)===null||o===void 0?void 0:o.x)!==null&&r!==void 0?r:0)+h/2,_=((i=(s=c.arrow)===null||s===void 0?void 0:s.y)!==null&&i!==void 0?i:0)+g/2;let S="",R="";return v==="bottom"?(S=f?x:`${w}px`,R=`${-g}px`):v==="top"?(S=f?x:`${w}px`,R=`${l.floating.height+g}px`):v==="right"?(S=`${-g}px`,R=f?x:`${_}px`):v==="left"&&(S=`${l.floating.width+g}px`,R=f?x:`${_}px`),{data:{x:S,y:R}}}});function XA(e){const[t,n="center"]=e.split("-");return[t,n]}const zf=KQ,Bf=QQ,Vf=ZQ,A1=m.forwardRef((e,t)=>{var n;const{container:r=globalThis==null||(n=globalThis.document)===null||n===void 0?void 0:n.body,...o}=e;return r?ko.createPortal(m.createElement(Qe.div,he({},o,{ref:t})),r):null}),nJ=m.forwardRef((e,t)=>{const{children:n,...r}=e,o=m.Children.toArray(n),i=o.find(rJ);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(vx,he({},r,{ref:t}),m.isValidElement(s)?m.cloneElement(s,void 0,a):null)}return m.createElement(vx,he({},r,{ref:t}),n)});nJ.displayName="Slot";const vx=m.forwardRef((e,t)=>{const{children:n,...r}=e;return m.isValidElement(n)?m.cloneElement(n,{...oJ(r,n.props),ref:t?cs(t,n.ref):n.ref}):m.Children.count(n)>1?m.Children.only(null):null});vx.displayName="SlotClone";const QA=({children:e})=>m.createElement(m.Fragment,null,e);function rJ(e){return m.isValidElement(e)&&e.type===QA}function oJ(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}const JA=m.forwardRef((e,t)=>m.createElement(Qe.span,he({},e,{ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}))),iJ=JA,[Am,lye]=Zn("Tooltip",[Ti]),k1=Ti(),sJ="TooltipProvider",aJ=700,bx="tooltip.open",[lJ,M1]=Am(sJ),cJ=e=>{const{__scopeTooltip:t,delayDuration:n=aJ,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=e,[s,a]=m.useState(!0),l=m.useRef(!1),c=m.useRef(0);return m.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),m.createElement(lJ,{scope:t,isOpenDelayed:s,delayDuration:n,onOpen:m.useCallback(()=>{window.clearTimeout(c.current),a(!1)},[]),onClose:m.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a(!0),r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:m.useCallback(u=>{l.current=u},[]),disableHoverableContent:o},i)},I1="Tooltip",[uJ,km]=Am(I1),dJ=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o=!1,onOpenChange:i,disableHoverableContent:s,delayDuration:a}=e,l=M1(I1,e.__scopeTooltip),c=k1(t),[u,f]=m.useState(null),h=Jo(),g=m.useRef(0),v=s??l.disableHoverableContent,b=a??l.delayDuration,x=m.useRef(!1),[w=!1,_]=xr({prop:r,defaultProp:o,onChange:A=>{A?(l.onOpen(),document.dispatchEvent(new CustomEvent(bx))):l.onClose(),i==null||i(A)}}),S=m.useMemo(()=>w?x.current?"delayed-open":"instant-open":"closed",[w]),R=m.useCallback(()=>{window.clearTimeout(g.current),x.current=!1,_(!0)},[_]),C=m.useCallback(()=>{window.clearTimeout(g.current),_(!1)},[_]),P=m.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>{x.current=!0,_(!0)},b)},[b,_]);return m.useEffect(()=>()=>window.clearTimeout(g.current),[]),m.createElement(zf,c,m.createElement(uJ,{scope:t,contentId:h,open:w,stateAttribute:S,trigger:u,onTriggerChange:f,onTriggerEnter:m.useCallback(()=>{l.isOpenDelayed?P():R()},[l.isOpenDelayed,P,R]),onTriggerLeave:m.useCallback(()=>{v?C():window.clearTimeout(g.current)},[C,v]),onOpen:R,onClose:C,disableHoverableContent:v},n))},vP="TooltipTrigger",ZA=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=km(vP,n),i=M1(vP,n),s=k1(n),a=m.useRef(null),l=_t(t,a,o.onTriggerChange),c=m.useRef(!1),u=m.useRef(!1),f=m.useCallback(()=>c.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),m.createElement(Bf,he({asChild:!0},s),m.createElement(Qe.button,he({"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute},r,{ref:l,onPointerMove:Me(e.onPointerMove,h=>{h.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),u.current=!0)}),onPointerLeave:Me(e.onPointerLeave,()=>{o.onTriggerLeave(),u.current=!1}),onPointerDown:Me(e.onPointerDown,()=>{c.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Me(e.onFocus,()=>{c.current||o.onOpen()}),onBlur:Me(e.onBlur,o.onClose),onClick:Me(e.onClick,o.onClose)})))}),fJ="TooltipPortal",[cye,hJ]=Am(fJ,{forceMount:void 0}),zd="TooltipContent",pJ=m.forwardRef((e,t)=>{const n=hJ(zd,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...i}=e,s=km(zd,e.__scopeTooltip);return m.createElement(er,{present:r||s.open},s.disableHoverableContent?m.createElement(ek,he({side:o},i,{ref:t})):m.createElement(gJ,he({side:o},i,{ref:t})))}),gJ=m.forwardRef((e,t)=>{const n=km(zd,e.__scopeTooltip),r=M1(zd,e.__scopeTooltip),o=m.useRef(null),i=_t(t,o),[s,a]=m.useState(null),{trigger:l,onClose:c}=n,u=o.current,{onPointerInTransitChange:f}=r,h=m.useCallback(()=>{a(null),f(!1)},[f]),g=m.useCallback((v,b)=>{const x=v.currentTarget,w={x:v.clientX,y:v.clientY},_=vJ(w,x.getBoundingClientRect()),S=bJ(w,_),R=yJ(b.getBoundingClientRect()),C=wJ([...S,...R]);a(C),f(!0)},[f]);return m.useEffect(()=>()=>h(),[h]),m.useEffect(()=>{if(l&&u){const v=x=>g(x,u),b=x=>g(x,l);return l.addEventListener("pointerleave",v),u.addEventListener("pointerleave",b),()=>{l.removeEventListener("pointerleave",v),u.removeEventListener("pointerleave",b)}}},[l,u,g,h]),m.useEffect(()=>{if(s){const v=b=>{const x=b.target,w={x:b.clientX,y:b.clientY},_=(l==null?void 0:l.contains(x))||(u==null?void 0:u.contains(x)),S=!xJ(w,s);_?h():S&&(h(),c())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[l,u,s,c,h]),m.createElement(ek,he({},e,{ref:i}))}),[mJ,uye]=Am(I1,{isInside:!1}),ek=m.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:s,...a}=e,l=km(zd,n),c=k1(n),{onClose:u}=l;return m.useEffect(()=>(document.addEventListener(bx,u),()=>document.removeEventListener(bx,u)),[u]),m.useEffect(()=>{if(l.trigger){const f=h=>{const g=h.target;g!=null&&g.contains(l.trigger)&&u()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[l.trigger,u]),m.createElement(Ff,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:u},m.createElement(Vf,he({"data-state":l.stateAttribute},c,a,{ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"}}),m.createElement(QA,null,r),m.createElement(mJ,{scope:n,isInside:!0},m.createElement(iJ,{id:l.contentId,role:"tooltip"},o||r))))});function vJ(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function bJ(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function yJ(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function xJ(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const a=t[i].x,l=t[i].y,c=t[s].x,u=t[s].y;l>r!=u>r&&n<(c-a)*(r-l)/(u-l)+a&&(o=!o)}return o}function wJ(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),_J(t)}function _J(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const i=t[t.length-1],s=t[t.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const i=n[n.length-1],s=n[n.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}const SJ=cJ,CJ=dJ,EJ=ZA,tk=pJ,RJ=SJ,nk=CJ,rk=EJ,N1=V.forwardRef(({className:e,sideOffset:t=4,...n},r)=>O.jsx(tk,{ref:r,sideOffset:t,className:Ee("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n}));N1.displayName=tk.displayName;function ll({number:e,decimalPlaces:t=0,useSuffix:n=!1,customSuffix:r="",currency:o="",locale:i="en-US"}){let s=1,a=r,l=i;const c=t;n&&!r&&(e>=1e9?(s=1e9,a="B"):e>=1e7&&i==="en-IN"?(s=1e7,a="Cr"):e>=1e5&&i==="en-IN"?(s=1e5,a="L"):e>=1e6?(s=1e6,a="M"):e>=1e3&&(s=1e3,a="K"));const u=e/s,f={maximumFractionDigits:c,minimumFractionDigits:c};if(o){f.style="currency",f.currency=o;try{new Intl.NumberFormat(i,f).format(0)}catch{f.currency="USD"}}try{new Intl.NumberFormat(i,f).format(0)}catch{l="en-US"}let g=new Intl.NumberFormat(l,f).format(u);return n&&(g+=a),g}function ok(e,t){if(!t)return"";const n=t.find(r=>e>=r.start&&e<=r.end);return(n==null?void 0:n.color)||""}function ik({card:e,isLoading:t}){var w,_,S,R,C,P,A,k,D,I,F,B,K,Z,z,Q,W,Y,oe,$,H,J,N,ce;const n=ke(le=>le.actions.setCardTitle),r=ke(le=>le.actions.setCardDescription),o=ke(le=>le.isVisualEditing),i=Ar(le=>le.card),s=Ar(le=>le.actions.setCard);Ar(le=>le.actions.setNumberFormat);const a=ke(le=>le.selectedSheetId),l=e.data,c=(_=(w=e.preferences)==null?void 0:w.formatNumber)==null?void 0:_.colorRanges,{metricKeys:u}=ar(l||[]),f=(S=l==null?void 0:l[0])==null?void 0:S[u==null?void 0:u[0]],h=(R=l==null?void 0:l[0])==null?void 0:R[u==null?void 0:u[1]],g=!!e.data&&e.data.length>0;function v(le){o?s({...i,title:le}):n(a,e.id,le)}function b(le){o?s({...i,description:le}):r(a,e.id,le)}const x=h&&h-f!==0?(f-h)/h:null;return O.jsxs("div",{className:"kpi-card flex grow flex-col overflow-scroll",children:[O.jsxs(sm,{className:"grow pb-3",children:[O.jsx(is,{text:o?i.title:e.title,onSave:v,children:O.jsxs("div",{className:"flex items-center gap-2",children:[O.jsx(Df,{className:"text-base font-medium text-muted-foreground",children:e.title}),!e.refreshInterval&&t&&O.jsx(S1,{className:"h-4 w-4 animate-spin text-muted-foreground"})]})}),g&&O.jsxs("div",{className:"flex flex-wrap items-end gap-3 text-foreground",children:[O.jsx("p",{style:{color:ok(f,c)},className:"text-3xl font-semibold",children:ll({number:f,decimalPlaces:((P=(C=e.preferences)==null?void 0:C.formatNumber)==null?void 0:P.decimalPlaces)||0,useSuffix:!!((k=(A=e.preferences)==null?void 0:A.formatNumber)!=null&&k.suffix),customSuffix:((I=(D=e.preferences)==null?void 0:D.formatNumber)==null?void 0:I.suffix)||"",locale:((B=(F=e.preferences)==null?void 0:F.formatNumber)==null?void 0:B.locale)||"",currency:((Z=(K=e.preferences)==null?void 0:K.formatNumber)==null?void 0:Z.currency)||""})}),h&&O.jsxs("span",{className:"min-w-fit text-base font-normal text-muted-foreground",children:["from ",ll({number:h,decimalPlaces:((Q=(z=e.preferences)==null?void 0:z.formatNumber)==null?void 0:Q.decimalPlaces)||0,useSuffix:!!((Y=(W=e.preferences)==null?void 0:W.formatNumber)!=null&&Y.suffix),customSuffix:(($=(oe=e.preferences)==null?void 0:oe.formatNumber)==null?void 0:$.suffix)||"",locale:((J=(H=e.preferences)==null?void 0:H.formatNumber)==null?void 0:J.locale)||"",currency:((ce=(N=e.preferences)==null?void 0:N.formatNumber)==null?void 0:ce.currency)||""})]})]})]}),x&&O.jsxs(am,{className:"grow items-start gap-1 pb-4 text-sm",children:[O.jsx(OJ,{children:x}),O.jsxs("div",{className:"flex gap-1 text-muted-foreground",children:[x>0?"up ":"down ",O.jsx(is,{text:e.description||"",onSave:b,children:e.description})]})]})]})}function OJ({children:e}){const t=e>0?O.jsx(w1,{className:"h-4 w-4"}):O.jsx(x1,{className:"h-4 w-4"}),n=`${Math.abs(e*100).toFixed(0)}%`;return O.jsxs("div",{className:Ee("flex items-center",{"text-green-600":e>0,"text-destructive":e<0}),children:[t,O.jsx("span",{className:"ml-[1px]",children:n})]})}var Kc=1e3,Xc=Kc*60,Qc=Xc*60,vl=Qc*24,PJ=vl*7,TJ=vl*365.25,DJ=function(e,t){t=t||{};var n=typeof e;if(n==="string"&&e.length>0)return $J(e);if(n==="number"&&isFinite(e))return t.long?kJ(e):AJ(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function $J(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*TJ;case"weeks":case"week":case"w":return n*PJ;case"days":case"day":case"d":return n*vl;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Qc;case"minutes":case"minute":case"mins":case"min":case"m":return n*Xc;case"seconds":case"second":case"secs":case"sec":case"s":return n*Kc;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function AJ(e){var t=Math.abs(e);return t>=vl?Math.round(e/vl)+"d":t>=Qc?Math.round(e/Qc)+"h":t>=Xc?Math.round(e/Xc)+"m":t>=Kc?Math.round(e/Kc)+"s":e+"ms"}function kJ(e){var t=Math.abs(e);return t>=vl?vp(e,t,vl,"day"):t>=Qc?vp(e,t,Qc,"hour"):t>=Xc?vp(e,t,Xc,"minute"):t>=Kc?vp(e,t,Kc,"second"):e+" ms"}function vp(e,t,n,r){var o=t>=n*1.5;return Math.round(e/n)+" "+r+(o?"s":"")}const MJ=nu(DJ);function sk({children:e}){const{setIsSessionExpired:t}=Mo(),n=new Qz({queryCache:new pD({onError:r=>{console.error(`Something went wrong: ${r.message}`),r.message==="invalid token"&&t(!0)}}),defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1}}});return O.jsx(tB,{client:n,children:e})}const IJ={id:"",authToken:void 0},ak=m.createContext(IJ),lk=({children:e,dashboardProps:t})=>O.jsx(sk,{children:O.jsx(ak.Provider,{value:t,children:e})});function ma(){const e=m.useContext(ak);if(e===void 0)throw new Error("useApplicationContext must be used within a ApplicationContextProvider");return e}function NJ(e){ke(u=>u.bookmarkKey),ke(u=>u.selectedSheetId);const t=ke(u=>u.dashboard.baseQueries),n=ke(u=>u.actions.getCardSheet),{authToken:r}=ma(),o=ke(u=>u.authToken),i=ke(u=>u.filterValues),s=ke(u=>u.isDashboardEditing),a=MJ((e==null?void 0:e.refreshInterval)||"0");n(e.id);const l=Y2(e.sql,t);return Tf({queryKey:[e.id,l],queryFn:()=>Rf("https://semaphor.cloud/api/v1/query",(r==null?void 0:r.accessToken)||(o==null?void 0:o.accessToken)||"",{connection_id:e.connectionId,sql:l,python:e.python===aD?"":e.python,active_filters:i}),refetchInterval:a,enabled:!!e.connectionId&&!s})}function Ia({data:e,cfg:t,customCfg:n,preferences:r}){const{dimensionKeys:o,metricKeys:i}=ar(e),s=zX(i,e,r),a=rg(s,n),l=o[0],c=fx(e,l);L1(r,t),ck(r);const u=uk(t,r),f=qo((t==null?void 0:t.options)||{},r==null?void 0:r.chartOptions),h=qo(u,f),g=qo(h,(n==null?void 0:n.options)||{});return{type:(n==null?void 0:n.type)||(t==null?void 0:t.type)||"bar",data:{labels:c,datasets:a},options:g}}function L1(e,t){var o,i,s;const n=((o=t==null?void 0:t.options)==null?void 0:o.indexAxis)==="y"?"x":"y";return(i=e==null?void 0:e.chartOptions)!=null&&i.indexAxis?((s=e==null?void 0:e.chartOptions)==null?void 0:s.indexAxis)==="x"?"y":"x":n}function ck(e){var n,r;return(n=e==null?void 0:e.chartOptions)!=null&&n.indexAxis?((r=e==null?void 0:e.chartOptions)==null?void 0:r.indexAxis)==="x"?"x":"y":"x"}function uk(e,t){var i,s,a,l,c,u,f,h,g,v,b,x;const n=L1(t,e),r=ck(t);return{...e==null?void 0:e.options,scales:{...(i=e==null?void 0:e.options)==null?void 0:i.scales,[n]:{...(a=(s=e==null?void 0:e.options)==null?void 0:s.scales)==null?void 0:a[n],ticks:{...(u=(c=(l=e==null?void 0:e.options)==null?void 0:l.scales)==null?void 0:c[n])==null?void 0:u.ticks,callback:w=>{var _,S,R,C;return ll({number:Number(w),decimalPlaces:((_=t==null?void 0:t.numberAxisFormat)==null?void 0:_.decimalPlaces)||0,useSuffix:!!((S=t==null?void 0:t.numberAxisFormat)!=null&&S.suffix),customSuffix:"",locale:((R=t==null?void 0:t.numberAxisFormat)==null?void 0:R.locale)||"",currency:((C=t==null?void 0:t.numberAxisFormat)==null?void 0:C.currency)||""})}}},[r]:{...(g=(h=(f=e==null?void 0:e.options)==null?void 0:f.scales)==null?void 0:h[r])==null?void 0:g.ticks,callback:null}},plugins:{...(v=e==null?void 0:e.options)==null?void 0:v.plugins,datalabels:{...(x=(b=e==null?void 0:e.options)==null?void 0:b.plugins)==null?void 0:x.datalabels,formatter:function(w){var _,S,R,C;return ll({number:Number(w),decimalPlaces:((_=t==null?void 0:t.numberAxisFormat)==null?void 0:_.decimalPlaces)||0,useSuffix:!!((S=t==null?void 0:t.numberAxisFormat)!=null&&S.suffix),customSuffix:"",locale:((R=t==null?void 0:t.numberAxisFormat)==null?void 0:R.locale)||"",currency:((C=t==null?void 0:t.numberAxisFormat)==null?void 0:C.currency)||""})}}}}}function LJ(e){return{...e,type:"bar",options:{...e==null?void 0:e.options,indexAxis:"y",scales:{x:{display:!0},y:{display:!0}}}}}function FJ(e){return{...e,type:"bar",options:{...e==null?void 0:e.options,indexAxis:"y",scales:{x:{beginAtZero:!0,stack:1,reverse:!0},y:{stacked:!0,beginAtZero:!0}}}}}function jJ(e){return{...e,type:"bar",options:{...e==null?void 0:e.options,scales:{x:{display:!0},y:{display:!0}}}}}function zJ(e,t=!1){return{...e,type:"bar",options:{...e==null?void 0:e.options,indexAxis:"y",scales:{x:{display:!0,beginAtZero:!1},y:{display:!0,stacked:t}}}}}function BJ(e,t){var r,o,i,s;return{...e,type:t==="stackedBar"?"bar":"line",options:{...e==null?void 0:e.options,scales:{x:{...(o=(r=e==null?void 0:e.options)==null?void 0:r.scales)==null?void 0:o.x,display:!0,stacked:!0},y:{...(s=(i=e==null?void 0:e.options)==null?void 0:i.scales)==null?void 0:s.y,display:!0,stacked:!0}}}}}function VJ(e){return{...e,type:"line",options:{...e==null?void 0:e.options,scales:{x:{display:!0},y:{display:!0}}}}}function HJ(e,t){var r;return{...t,type:e,options:{...t==null?void 0:t.options,scales:{x:{display:!1},y:{display:!1}},plugins:{...(r=t==null?void 0:t.options)==null?void 0:r.plugins,legend:{position:"top",align:"center",maxHeight:0,labels:{useBorderRadius:!0,borderRadius:2}}},borderRadius:0}}}function WJ(e){return{...e,type:"radar",options:{...e==null?void 0:e.options,scales:{x:{display:!1},y:{display:!1}}}}}function UJ(e){const n=new Function("getDatalabelColor",e)(w0);return{options:n==null?void 0:n.options,plugins:(n==null?void 0:n.plugins)||[]}}function F1({data:e,cardType:t="bar",cfg:n,customCfg:r,provider:o="chartjs",userSettings:i,preferences:s}){var a,l,c;if(t==="bar"){const u=jJ(n);return Ia({data:e,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="horizontalBar"){const u=LJ(n);return Ia({data:e,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="pyramid"){const u=FJ(n),{dimensionKeys:f,metricKeys:h}=ar(e),g=Pg({dataArray:e,groupKey:f[0],pivotKey:f[1],valueKey:h[0]}),v=Ia({data:g,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s}),b="x2";return{...v,data:{...v.data,datasets:v.data.datasets.map((w,_)=>_===1?{...w,xAxisID:b}:w)},options:{...v.options,scales:{...(a=v==null?void 0:v.options)==null?void 0:a.scales,[b]:{beginAtZero:!0,stack:1}}}}}if(t==="stackedBar"||t==="stackedLine"){const u=BJ(n,t),{dimensionKeys:f,metricKeys:h}=ar(e),g=Pg({dataArray:e,groupKey:f[0],pivotKey:f[1],valueKey:h[0]});return Ia({data:g,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="line"){const u=VJ(n);return Ia({data:e,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="range"){const u=zJ(n),f=HX(e),h=rg(f,r),{plugins:g,options:v}=UJ((s==null?void 0:s.customVisualCode)||""),b=qo((u==null?void 0:u.options)||{},(n==null?void 0:n.options)||{}),x=qo(b,(s==null?void 0:s.chartOptions)||{}),w=qo(x,(r==null?void 0:r.options)||{}),_=qo(w,v),S=uk(n,s),R=qo(_,S),C={...R,plugins:{...R==null?void 0:R.plugins,datalabels:{...(l=R==null?void 0:R.plugins)==null?void 0:l.datalabels,formatter:(I,F)=>I.map(K=>{var Z,z,Q,W;return ll({number:Number(K),decimalPlaces:((Z=s==null?void 0:s.numberAxisFormat)==null?void 0:Z.decimalPlaces)||0,useSuffix:!!((z=s==null?void 0:s.numberAxisFormat)!=null&&z.suffix),customSuffix:"",locale:((Q=s==null?void 0:s.numberAxisFormat)==null?void 0:Q.locale)||"",currency:((W=s==null?void 0:s.numberAxisFormat)==null?void 0:W.currency)||""})}).slice(0,2).join(" - ")}}},{dimensionKeys:P}=ar(e),A=P[0];return{type:"bar",data:{labels:[...new Set(fx(e,A))],datasets:h},options:C,plugins:[...g]}}if(t==="pie"||t==="doughnut"||t==="polarArea"){const u=HJ(t,n),{dimensionKeys:f,metricKeys:h}=ar(e),g=WX(h,e),v=rg(g,r),b=f[0],x=fx(e,b),w=qo((u==null?void 0:u.options)||{},(r==null?void 0:r.options)||{}),_=qo(w,(s==null?void 0:s.chartOptions)||{}),S={..._,plugins:{..._.plugins,datalabels:{...(c=_.plugins)==null?void 0:c.datalabels,formatter:(P,A)=>{var k,D,I,F;return ll({number:Number(P),decimalPlaces:((k=s==null?void 0:s.numberAxisFormat)==null?void 0:k.decimalPlaces)||0,useSuffix:!!((D=s==null?void 0:s.numberAxisFormat)!=null&&D.suffix),customSuffix:"",locale:((I=s==null?void 0:s.numberAxisFormat)==null?void 0:I.locale)||"",currency:((F=s==null?void 0:s.numberAxisFormat)==null?void 0:F.currency)||""})}}}};return{type:t,data:{labels:x,datasets:v},options:S,plugins:[t==="doughnut"?{id:"doughnutLabel",beforeDatasetsDraw:function(P,A,k){var Q,W,Y,oe;const{ctx:D,data:I}=P;D.save();const F=P.getDatasetMeta(0).data[0].x,B=P.getDatasetMeta(0).data[0].y,K=Bc(Od());D.font="1.2rem Arial",D.fontWeight="bolder",D.fillStyle=K,D.textAlign="center",D.textBaseline="middle";const Z=I.datasets[0].data.reduce(($,H)=>$+H,0),z=ll({number:Number(Z),decimalPlaces:((Q=s==null?void 0:s.numberAxisFormat)==null?void 0:Q.decimalPlaces)||0,useSuffix:!!((W=s==null?void 0:s.numberAxisFormat)!=null&&W.suffix),customSuffix:"",locale:((Y=s==null?void 0:s.numberAxisFormat)==null?void 0:Y.locale)||"",currency:((oe=s==null?void 0:s.numberAxisFormat)==null?void 0:oe.currency)||""});D.fillText(z,F,B)}}:""]}}if(t==="radar"){const u=WJ(n);return Ia({data:e,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="bubble"||t==="scatter"){const{metricKeys:u}=ar(e);if(u.length<3){console.log("Bubble charts require 3 numeric columns");return}const f=VX(e),h=rg(f,r),g={plugins:{datalabels:{display:!0}},scales:{x:{title:{display:!0,text:u[0]},beginAtZero:!0,ticks:{precision:0}},y:{title:{display:!0,text:u[1]},beginAtZero:!0,ticks:{precision:0}}}},v=qo(g,(r==null?void 0:r.options)||{});return{type:t,data:{datasets:h},options:v}}return Ia({data:e,cfg:n,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}function qJ({chart:e,elementIndex:t,datasetIndex:n,cardType:r,cfg:o,apply:i}){const s=ke.getState().theme;if(!o)return;const a=s==="dark"?"rgb(238,238,238,0.2)":"rgb(238,238,238,0.8)";["bar","line","horizontalBar","bubble","scatter"].includes(r)&&YJ(e,t,o,i,a),["pie","doughnut","polarArea"].includes(r)&&KJ(e,t,o,i,a),["stackedBar","pyramid"].includes(r)&&GJ({chart:e,elementIndex:t,datasetIndex:n,cfg:o,apply:i,blurColor:a})}function GJ(e){var a,l,c,u;const{chart:t,elementIndex:n,datasetIndex:r,cfg:o,apply:i,blurColor:s}=e;i?(l=(a=t==null?void 0:t.data)==null?void 0:a.datasets)==null||l.forEach((f,h)=>{var g,v;typeof f.backgroundColor=="string"&&(f.backgroundColor=new Array(f.data.length).fill(f.backgroundColor),f.borderColor=new Array(f.data.length).fill(f.borderColor)),f.backgroundColor=(g=f==null?void 0:f.backgroundColor)==null?void 0:g.map((b,x)=>x===n&&h===r?b:s),f.borderColor=(v=f==null?void 0:f.borderColor)==null?void 0:v.map((b,x)=>x===n&&h===r?b:s)}):(u=(c=t==null?void 0:t.data)==null?void 0:c.datasets)==null||u.forEach((f,h)=>{var g,v,b,x,w,_;f.backgroundColor=new Array(f.data.length).fill((b=(v=(g=o==null?void 0:o.data)==null?void 0:g.datasets)==null?void 0:v[h])==null?void 0:b.backgroundColor),f.borderColor=new Array(f.data.length).fill((_=(w=(x=o==null?void 0:o.data)==null?void 0:x.datasets)==null?void 0:w[h])==null?void 0:_.borderColor)}),t==null||t.update()}function YJ(e,t,n,r,o){var i,s,a,l;console.log("clicked index",t),r?(s=(i=e==null?void 0:e.data)==null?void 0:i.datasets)==null||s.forEach(c=>{var u,f;typeof c.backgroundColor=="string"&&(c.backgroundColor=new Array(c.data.length).fill(c.backgroundColor),c.borderColor=new Array(c.data.length).fill(c.borderColor)),c.backgroundColor=(u=c==null?void 0:c.backgroundColor)==null?void 0:u.map((h,g)=>g===t?h:o),c.borderColor=(f=c==null?void 0:c.borderColor)==null?void 0:f.map((h,g)=>g===t?h:o)}):(l=(a=e==null?void 0:e.data)==null?void 0:a.datasets)==null||l.forEach((c,u)=>{var f,h,g,v,b,x;c.backgroundColor=new Array(c.data.length).fill((g=(h=(f=n==null?void 0:n.data)==null?void 0:f.datasets)==null?void 0:h[u])==null?void 0:g.backgroundColor),c.borderColor=new Array(c.data.length).fill((x=(b=(v=n==null?void 0:n.data)==null?void 0:v.datasets)==null?void 0:b[u])==null?void 0:x.borderColor)}),e==null||e.update()}function KJ(e,t,n,r,o){var i,s,a,l;r?(s=(i=e==null?void 0:e.data)==null?void 0:i.datasets)==null||s.forEach(c=>{var u,f;c.backgroundColor=(u=c==null?void 0:c.backgroundColor)==null?void 0:u.map((h,g)=>g===t?h:o),c.borderColor=(f=c==null?void 0:c.borderColor)==null?void 0:f.map((h,g)=>g===t?h:o)}):(l=(a=e==null?void 0:e.data)==null?void 0:a.datasets)==null||l.forEach((c,u)=>{var f,h,g,v,b,x,w,_;typeof c.backgroundColor=="string"&&(c.backgroundColor=(g=(h=(f=n==null?void 0:n.data)==null?void 0:f.datasets)==null?void 0:h[u])==null?void 0:g.backgroundColor,c.borderColor=(x=(b=(v=n==null?void 0:n.data)==null?void 0:v.datasets)==null?void 0:b[u])==null?void 0:x.borderColor),c.backgroundColor=(w=c==null?void 0:c.backgroundColor)==null?void 0:w.map((S,R)=>{var C;return(C=n.data.datasets[u].backgroundColor)==null?void 0:C[R]}),c.borderColor=(_=c==null?void 0:c.borderColor)==null?void 0:_.map((S,R)=>{var C;return(C=n.data.datasets[u].borderColor)==null?void 0:C[R]})}),e==null||e.update()}function XJ(e,t,n,r){var o,i;try{if(!e||!e.data)return;const{dimensionKeys:s,metricKeys:a}=ar(e.data);if(["bar","horizontalBar","line","pie","doughnut","radar","polarArea"].includes(e.type)){const l=s[0],c=(o=e.data[n])==null?void 0:o[l];return[{columnName:l,columnValue:c,metric:a[t],value:r}]}if(["stackedBar","pyramid"].includes(e.type)){const l=Pg({dataArray:e.data,groupKey:s[0],pivotKey:s[1],valueKey:a[0]}),c=s[0],u=(i=l[n])==null?void 0:i[c],f=s[1],{metricKeys:h}=ar(l),g=h[t];return[{columnName:c,columnValue:u,metric:a[0],value:r},{columnName:f,columnValue:g,metric:a[0],value:r}]}if(e.type==="bubble"||e.type==="scatter"){const l=s[0],c=r.label;return[{columnName:l,columnValue:c,metric1:a[0],value1:r.x,metric2:a[1],value2:r.y,metric3:a==null?void 0:a[2],value3:r==null?void 0:r.r}]}}catch(s){console.error("Error in getAdhocFilter",s)}}function QJ(e){var s,a;const[t]=m.useState({id:"",title:"",type:"bar",data:[]}),{getCard:n}=Mo(),r=n(e),o=j1(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 j1(e){var B,K,Z;const{onChartElementClicked:t}=ma(),[n,r]=m.useState(0),o=((B=e==null?void 0:e.preferences)==null?void 0:B.filterOnClickColumnIndex)===void 0?0:(K=e.preferences)==null?void 0:K.filterOnClickColumnIndex,i=ke(z=>z.bookmarkKey);ke(z=>z.isVisualEditing);const s=ke(z=>z.filteringCards),a=ke(z=>z.selectedSheetId);ke(z=>z.selectedCardId),ke(z=>z.isDashboardEditing);const l=ke(z=>z.themeStyle),c=ke(z=>z.filterValues),u=m.useRef(c),f=(Z=e==null?void 0:e.preferences)==null?void 0:Z.onClickFilter,{addFrame:h,addFilteringCard:g,setFrameCardData:v,getSelectedFrame:b,addOrUpdateFilterValue:x,addOrUpdateFilterValues:w,removeFilterValue:_,removeFilteringCard:S}=Mo(),{data:R,isLoading:C,isFetching:P,isError:A,refetch:k}=NJ(e),D=s==null?void 0:s.find(z=>z.id===e.id);let I;e.data&&e.data.length>0&&(I=F1({data:e.data,cardType:e.type,cfg:e.cfg,customCfg:e.customCfg,preferences:e.preferences})),m.useEffect(()=>{!R||!R.records||v(a,e.id,(R==null?void 0:R.records)||[])},[R,a,e.id,v,c]),m.useEffect(()=>{e.data&&r(n+1)},[e.data,e.type,e.cfg,e.customCfg,e.preferences,l]),m.useEffect(()=>{e.connectionId&&!D&&(k(),u.current=c)},[c,i]);function F(z,Q,W,Y){var H,J;let oe=!1;if(!e.data)return;const $=XJ(e,Q,W,Y);if(console.log("fieldValues",$),t==null||t(e,$),!!(((H=e==null?void 0:e.preferences)==null?void 0:H.onClickFilter)??[]).length){if(D){const N=e.id;_(N),S(e)}else{if(oe=!0,!$)return;const N=[];$.forEach((ce,le)=>{const de=f==null?void 0:f.find(ie=>ie.columnIndex===le);if(!de)return;const pe={filterId:e.id+"-"+ce.columnName,connectionId:e==null?void 0:e.connectionId,tableName:e.lastSelectedTable,name:ce.columnName,expression:de.expression,valueType:Pd($[de.columnIndex].columnValue),operation:"=",values:[$[de.columnIndex].columnValue]};N.push(pe)}),e.id,e==null||e.connectionId,e.lastSelectedTable,$[o].columnName,(J=e.preferences)==null||J.filterOnClickField,Pd($[o].columnValue),$[o].columnValue,w(N),g(e)}qJ({chart:z,elementIndex:W,datasetIndex:Q,cardType:e.type,cfg:I,apply:oe})}}return{isError:A,isLoading:C,isFetching:P,data:R,visualKey:n,handleDatapointClick:F,cfg:I}}var JJ=e=>{switch(e){case"success":return tZ;case"info":return rZ;case"warning":return nZ;case"error":return oZ;default:return null}},ZJ=Array(12).fill(0),eZ=({visible:e})=>m.createElement("div",{className:"sonner-loading-wrapper","data-visible":e},m.createElement("div",{className:"sonner-spinner"},ZJ.map((t,n)=>m.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),tZ=m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},m.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),nZ=m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},m.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),rZ=m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},m.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),oZ=m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},m.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),iZ=()=>{let[e,t]=m.useState(document.hidden);return m.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},yx=1,sZ=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;let{message:r,...o}=t,i=typeof(t==null?void 0:t.id)=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:yx++,s=this.toasts.find(l=>l.id===i),a=t.dismissible===void 0?!0:t.dismissible;return s?this.toasts=this.toasts.map(l=>l.id===i?(this.publish({...l,...t,id:i,title:r}),{...l,...t,id:i,dismissible:a,title:r}):l):this.addToast({title:r,...o,dismissible:a,id:i}),i},this.dismiss=t=>(t||this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),this.subscribers.forEach(n=>n({id:t,dismiss:!0})),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));let o=t instanceof Promise?t:t(),i=r!==void 0;return o.then(async s=>{if(lZ(s)&&!s.ok){i=!1;let a=typeof n.error=="function"?await n.error(`HTTP error! status: ${s.status}`):n.error,l=typeof n.description=="function"?await n.description(`HTTP error! status: ${s.status}`):n.description;this.create({id:r,type:"error",message:a,description:l})}else if(n.success!==void 0){i=!1;let a=typeof n.success=="function"?await n.success(s):n.success,l=typeof n.description=="function"?await n.description(s):n.description;this.create({id:r,type:"success",message:a,description:l})}}).catch(async s=>{if(n.error!==void 0){i=!1;let a=typeof n.error=="function"?await n.error(s):n.error,l=typeof n.description=="function"?await n.description(s):n.description;this.create({id:r,type:"error",message:a,description:l})}}).finally(()=>{var s;i&&(this.dismiss(r),r=void 0),(s=n.finally)==null||s.call(n)}),r},this.custom=(t,n)=>{let r=(n==null?void 0:n.id)||yx++;return this.create({jsx:t(r),id:r,...n}),r},this.subscribers=[],this.toasts=[]}},Qr=new sZ,aZ=(e,t)=>{let n=(t==null?void 0:t.id)||yx++;return Qr.addToast({title:e,...t,id:n}),n},lZ=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",cZ=aZ,uZ=()=>Qr.toasts,dk=Object.assign(cZ,{success:Qr.success,info:Qr.info,warning:Qr.warning,error:Qr.error,custom:Qr.custom,message:Qr.message,promise:Qr.promise,dismiss:Qr.dismiss,loading:Qr.loading},{getHistory:uZ});function dZ(e,{insertAt:t}={}){if(!e||typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}dZ(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999}:where([data-sonner-toaster][data-x-position="right"]){right:max(var(--offset),env(safe-area-inset-right))}:where([data-sonner-toaster][data-x-position="left"]){left:max(var(--offset),env(safe-area-inset-left))}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:max(var(--offset),env(safe-area-inset-top))}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:max(var(--offset),env(safe-area-inset-bottom))}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;background:var(--gray1);color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:0;right:0;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount, 0px));transition:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation:swipe-out .2s ease-out forwards}@keyframes swipe-out{0%{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount)));opacity:1}to{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;--mobile-offset: 16px;right:var(--mobile-offset);left:var(--mobile-offset);width:100%}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset)}[data-sonner-toaster][data-y-position=bottom]{bottom:20px}[data-sonner-toaster][data-y-position=top]{top:20px}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset);right:var(--mobile-offset);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
|
|
253
|
+
`),s=new Blob([i],{type:"text/csv"}),a=window.URL.createObjectURL(s),l=document.createElement("a");l.setAttribute("hidden",""),l.setAttribute("href",a),l.setAttribute("download",t),document.body.appendChild(l),l.click(),document.body.removeChild(l)};return O.jsx(XX,{onClick:n,className:"h-[14px] w-[14px] text-foreground/30 hover:cursor-pointer hover:text-foreground/50"})};function oQ({frame:e}){var _;const t=ke(S=>S.isDashboardEditing),n=ke(S=>S.filterValues),r=ke(S=>S.isVisualEditing),o=ke(S=>S.selectedSheetId);ke(S=>S.currentBreakpoint);const{removeFrame:i}=ke(S=>S.actions),s=ke(S=>S.actions.setIsVisualEditing),a=Ar(S=>S.actions.setFilterValues),l=Ar(S=>S.actions.setApplyFilters),{setCard:c,setFrame:u,setQueryResultColumns:f}=Ar(S=>S.actions),h=Ar(S=>S.actions.setSelectedConnectionId),g=Ar(S=>S.actions.setSelectedDatabaseName),v=Ar(S=>S.actions.setSelectedSchemaName),b=Ar(S=>S.actions.setSelectedTableName),x=e.cards.find(S=>S.id===e.activeCardId);function w(){s(!r),c(x);const{dimensionKeys:S}=ar((x==null?void 0:x.data)||[]);f(S),u(e),x!=null&&x.connectionId&&h(x==null?void 0:x.connectionId),x!=null&&x.lastSelectedDatabase&&g(x==null?void 0:x.lastSelectedDatabase),x!=null&&x.lastSelectedSchema&&v(x==null?void 0:x.lastSelectedSchema),x!=null&&x.lastSelectedTable&&b(x==null?void 0:x.lastSelectedTable),n&&(a(n),l(!0))}return O.jsx("section",{className:"absolute right-2 top-2 z-10",children:O.jsxs("div",{className:"flex items-center gap-2",children:[t&&(r?O.jsx(_X,{onClick:()=>{s(!r)},className:"h-[14px] w-[14px] text-foreground/30 hover:cursor-pointer hover:text-foreground/50"}):O.jsx(CX,{role:"edit-visual",onClick:w,className:"h-[14px] w-[14px] text-foreground/30 hover:cursor-pointer hover:text-foreground/50"})),t&&O.jsx(TA,{onClick:()=>i(o,e.id),className:"h-[14px] w-[14px] text-foreground/30 hover:cursor-pointer hover:text-foreground/50"}),((_=x.preferences)==null?void 0:_.allowDownload)===!0&&O.jsx(rQ,{data:(x==null?void 0:x.data)||[],filename:x.title})]})})}function iQ(e,t=globalThis==null?void 0:globalThis.document){const n=Ln(e);m.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r),()=>t.removeEventListener("keydown",r)},[n,t])}const px="dismissableLayer.update",sQ="dismissableLayer.pointerDownOutside",aQ="dismissableLayer.focusOutside";let sP;const lQ=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ff=m.forwardRef((e,t)=>{var n;const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:a,onDismiss:l,...c}=e,u=m.useContext(lQ),[f,h]=m.useState(null),g=(n=f==null?void 0:f.ownerDocument)!==null&&n!==void 0?n:globalThis==null?void 0:globalThis.document,[,v]=m.useState({}),b=_t(t,k=>h(k)),x=Array.from(u.layers),[w]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),_=x.indexOf(w),S=f?x.indexOf(f):-1,R=u.layersWithOutsidePointerEventsDisabled.size>0,C=S>=_,P=cQ(k=>{const D=k.target,I=[...u.branches].some(F=>F.contains(D));!C||I||(i==null||i(k),a==null||a(k),k.defaultPrevented||l==null||l())},g),A=uQ(k=>{const D=k.target;[...u.branches].some(F=>F.contains(D))||(s==null||s(k),a==null||a(k),k.defaultPrevented||l==null||l())},g);return iQ(k=>{S===u.layers.size-1&&(o==null||o(k),!k.defaultPrevented&&l&&(k.preventDefault(),l()))},g),m.useEffect(()=>{if(f)return r&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(sP=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),aP(),()=>{r&&u.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=sP)}},[f,g,r,u]),m.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),aP())},[f,u]),m.useEffect(()=>{const k=()=>v({});return document.addEventListener(px,k),()=>document.removeEventListener(px,k)},[]),m.createElement(Qe.div,he({},c,{ref:b,style:{pointerEvents:R?C?"auto":"none":void 0,...e.style},onFocusCapture:Me(e.onFocusCapture,A.onFocusCapture),onBlurCapture:Me(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:Me(e.onPointerDownCapture,P.onPointerDownCapture)}))});function cQ(e,t=globalThis==null?void 0:globalThis.document){const n=Ln(e),r=m.useRef(!1),o=m.useRef(()=>{});return m.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let c=function(){NA(sQ,n,l,{discrete:!0})};const l={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function uQ(e,t=globalThis==null?void 0:globalThis.document){const n=Ln(e),r=m.useRef(!1);return m.useEffect(()=>{const o=i=>{i.target&&!r.current&&NA(aQ,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function aP(){const e=new CustomEvent(px);document.dispatchEvent(e)}function NA(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?CD(o,i):o.dispatchEvent(i)}const dQ=["top","right","bottom","left"],ca=Math.min,no=Math.max,Tg=Math.round,mp=Math.floor,ua=e=>({x:e,y:e}),fQ={left:"right",right:"left",bottom:"top",top:"bottom"},hQ={start:"end",end:"start"};function gx(e,t,n){return no(e,ca(t,n))}function ss(e,t){return typeof e=="function"?e(t):e}function as(e){return e.split("-")[0]}function iu(e){return e.split("-")[1]}function R1(e){return e==="x"?"y":"x"}function O1(e){return e==="y"?"height":"width"}function su(e){return["top","bottom"].includes(as(e))?"y":"x"}function P1(e){return R1(su(e))}function pQ(e,t,n){n===void 0&&(n=!1);const r=iu(e),o=P1(e),i=O1(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=Dg(s)),[s,Dg(s)]}function gQ(e){const t=Dg(e);return[mx(e),t,mx(t)]}function mx(e){return e.replace(/start|end/g,t=>hQ[t])}function mQ(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:s;default:return[]}}function vQ(e,t,n,r){const o=iu(e);let i=mQ(as(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(mx)))),i}function Dg(e){return e.replace(/left|right|bottom|top/g,t=>fQ[t])}function bQ(e){return{top:0,right:0,bottom:0,left:0,...e}}function LA(e){return typeof e!="number"?bQ(e):{top:e,right:e,bottom:e,left:e}}function $g(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function lP(e,t,n){let{reference:r,floating:o}=e;const i=su(t),s=P1(t),a=O1(s),l=as(t),c=i==="y",u=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,h=r[a]/2-o[a]/2;let g;switch(l){case"top":g={x:u,y:r.y-o.height};break;case"bottom":g={x:u,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:f};break;case"left":g={x:r.x-o.width,y:f};break;default:g={x:r.x,y:r.y}}switch(iu(t)){case"start":g[s]-=h*(n&&c?-1:1);break;case"end":g[s]+=h*(n&&c?-1:1);break}return g}const yQ=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=lP(c,r,l),h=r,g={},v=0;for(let b=0;b<a.length;b++){const{name:x,fn:w}=a[b],{x:_,y:S,data:R,reset:C}=await w({x:u,y:f,initialPlacement:r,placement:h,strategy:o,middlewareData:g,rects:c,platform:s,elements:{reference:e,floating:t}});if(u=_??u,f=S??f,g={...g,[x]:{...g[x],...R}},C&&v<=50){v++,typeof C=="object"&&(C.placement&&(h=C.placement),C.rects&&(c=C.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:u,y:f}=lP(c,h,l)),b=-1;continue}}return{x:u,y:f,placement:h,strategy:o,middlewareData:g}};async function Fd(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:h=!1,padding:g=0}=ss(t,e),v=LA(g),x=a[h?f==="floating"?"reference":"floating":f],w=$g(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(x)))==null||n?x:x.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),_=f==="floating"?{...s.floating,x:r,y:o}:s.reference,S=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),R=await(i.isElement==null?void 0:i.isElement(S))?await(i.getScale==null?void 0:i.getScale(S))||{x:1,y:1}:{x:1,y:1},C=$g(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:_,offsetParent:S,strategy:l}):_);return{top:(w.top-C.top+v.top)/R.y,bottom:(C.bottom-w.bottom+v.bottom)/R.y,left:(w.left-C.left+v.left)/R.x,right:(C.right-w.right+v.right)/R.x}}const cP=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=ss(e,t)||{};if(c==null)return{};const f=LA(u),h={x:n,y:r},g=P1(o),v=O1(g),b=await s.getDimensions(c),x=g==="y",w=x?"top":"left",_=x?"bottom":"right",S=x?"clientHeight":"clientWidth",R=i.reference[v]+i.reference[g]-h[g]-i.floating[v],C=h[g]-i.reference[g],P=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let A=P?P[S]:0;(!A||!await(s.isElement==null?void 0:s.isElement(P)))&&(A=a.floating[S]||i.floating[v]);const k=R/2-C/2,D=A/2-b[v]/2-1,I=ca(f[w],D),F=ca(f[_],D),B=I,K=A-b[v]-F,Z=A/2-b[v]/2+k,z=gx(B,Z,K),Q=!l.arrow&&iu(o)!=null&&Z!=z&&i.reference[v]/2-(Z<B?I:F)-b[v]/2<0,W=Q?Z<B?Z-B:Z-K:0;return{[g]:h[g]+W,data:{[g]:z,centerOffset:Z-z-W,...Q&&{alignmentOffset:W}},reset:Q}}}),xQ=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:b=!0,...x}=ss(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const w=as(o),_=as(a)===a,S=await(l.isRTL==null?void 0:l.isRTL(c.floating)),R=h||(_||!b?[Dg(a)]:gQ(a));!h&&v!=="none"&&R.push(...vQ(a,b,v,S));const C=[a,...R],P=await Fd(t,x),A=[];let k=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&A.push(P[w]),f){const B=pQ(o,s,S);A.push(P[B[0]],P[B[1]])}if(k=[...k,{placement:o,overflows:A}],!A.every(B=>B<=0)){var D,I;const B=(((D=i.flip)==null?void 0:D.index)||0)+1,K=C[B];if(K)return{data:{index:B,overflows:k},reset:{placement:K}};let Z=(I=k.filter(z=>z.overflows[0]<=0).sort((z,Q)=>z.overflows[1]-Q.overflows[1])[0])==null?void 0:I.placement;if(!Z)switch(g){case"bestFit":{var F;const z=(F=k.map(Q=>[Q.placement,Q.overflows.filter(W=>W>0).reduce((W,Y)=>W+Y,0)]).sort((Q,W)=>Q[1]-W[1])[0])==null?void 0:F[0];z&&(Z=z);break}case"initialPlacement":Z=a;break}if(o!==Z)return{reset:{placement:Z}}}return{}}}};function uP(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function dP(e){return dQ.some(t=>e[t]>=0)}const wQ=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=ss(e,t);switch(r){case"referenceHidden":{const i=await Fd(t,{...o,elementContext:"reference"}),s=uP(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:dP(s)}}}case"escaped":{const i=await Fd(t,{...o,altBoundary:!0}),s=uP(i,n.floating);return{data:{escapedOffsets:s,escaped:dP(s)}}}default:return{}}}}};async function _Q(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=as(n),a=iu(n),l=su(n)==="y",c=["left","top"].includes(s)?-1:1,u=i&&l?-1:1,f=ss(t,e);let{mainAxis:h,crossAxis:g,alignmentAxis:v}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return a&&typeof v=="number"&&(g=a==="end"?v*-1:v),l?{x:g*u,y:h*c}:{x:h*c,y:g*u}}const SQ=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,l=await _Q(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},CQ=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:x=>{let{x:w,y:_}=x;return{x:w,y:_}}},...l}=ss(e,t),c={x:n,y:r},u=await Fd(t,l),f=su(as(o)),h=R1(f);let g=c[h],v=c[f];if(i){const x=h==="y"?"top":"left",w=h==="y"?"bottom":"right",_=g+u[x],S=g-u[w];g=gx(_,g,S)}if(s){const x=f==="y"?"top":"left",w=f==="y"?"bottom":"right",_=v+u[x],S=v-u[w];v=gx(_,v,S)}const b=a.fn({...t,[h]:g,[f]:v});return{...b,data:{x:b.x-n,y:b.y-r}}}}},EQ=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:s}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=ss(e,t),u={x:n,y:r},f=su(o),h=R1(f);let g=u[h],v=u[f];const b=ss(a,t),x=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(l){const S=h==="y"?"height":"width",R=i.reference[h]-i.floating[S]+x.mainAxis,C=i.reference[h]+i.reference[S]-x.mainAxis;g<R?g=R:g>C&&(g=C)}if(c){var w,_;const S=h==="y"?"width":"height",R=["top","left"].includes(as(o)),C=i.reference[f]-i.floating[S]+(R&&((w=s.offset)==null?void 0:w[f])||0)+(R?0:x.crossAxis),P=i.reference[f]+i.reference[S]+(R?0:((_=s.offset)==null?void 0:_[f])||0)-(R?x.crossAxis:0);v<C?v=C:v>P&&(v=P)}return{[h]:g,[f]:v}}}},RQ=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:i}=t,{apply:s=()=>{},...a}=ss(e,t),l=await Fd(t,a),c=as(n),u=iu(n),f=su(n)==="y",{width:h,height:g}=r.floating;let v,b;c==="top"||c==="bottom"?(v=c,b=u===(await(o.isRTL==null?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(b=c,v=u==="end"?"top":"bottom");const x=g-l[v],w=h-l[b],_=!t.middlewareData.shift;let S=x,R=w;if(f){const P=h-l.left-l.right;R=u||_?ca(w,P):P}else{const P=g-l.top-l.bottom;S=u||_?ca(x,P):P}if(_&&!u){const P=no(l.left,0),A=no(l.right,0),k=no(l.top,0),D=no(l.bottom,0);f?R=h-2*(P!==0||A!==0?P+A:no(l.left,l.right)):S=g-2*(k!==0||D!==0?k+D:no(l.top,l.bottom))}await s({...t,availableWidth:R,availableHeight:S});const C=await o.getDimensions(i.floating);return h!==C.width||g!==C.height?{reset:{rects:!0}}:{}}}};function da(e){return FA(e)?(e.nodeName||"").toLowerCase():"#document"}function so(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ds(e){var t;return(t=(FA(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function FA(e){return e instanceof Node||e instanceof so(e).Node}function ls(e){return e instanceof Element||e instanceof so(e).Element}function Si(e){return e instanceof HTMLElement||e instanceof so(e).HTMLElement}function fP(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof so(e).ShadowRoot}function jf(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=$o(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function OQ(e){return["table","td","th"].includes(da(e))}function T1(e){const t=D1(),n=$o(e);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function PQ(e){let t=Yc(e);for(;Si(t)&&!Tm(t);){if(T1(t))return t;t=Yc(t)}return null}function D1(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Tm(e){return["html","body","#document"].includes(da(e))}function $o(e){return so(e).getComputedStyle(e)}function Dm(e){return ls(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Yc(e){if(da(e)==="html")return e;const t=e.assignedSlot||e.parentNode||fP(e)&&e.host||ds(e);return fP(t)?t.host:t}function jA(e){const t=Yc(e);return Tm(t)?e.ownerDocument?e.ownerDocument.body:e.body:Si(t)&&jf(t)?t:jA(t)}function jd(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=jA(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=so(o);return i?t.concat(s,s.visualViewport||[],jf(o)?o:[],s.frameElement&&n?jd(s.frameElement):[]):t.concat(o,jd(o,[],n))}function zA(e){const t=$o(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Si(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=Tg(n)!==i||Tg(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function $1(e){return ls(e)?e:e.contextElement}function yc(e){const t=$1(e);if(!Si(t))return ua(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=zA(t);let s=(i?Tg(n.width):n.width)/r,a=(i?Tg(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const TQ=ua(0);function BA(e){const t=so(e);return!D1()||!t.visualViewport?TQ:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function DQ(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==so(e)?!1:t}function ml(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=$1(e);let s=ua(1);t&&(r?ls(r)&&(s=yc(r)):s=yc(e));const a=DQ(i,n,r)?BA(i):ua(0);let l=(o.left+a.x)/s.x,c=(o.top+a.y)/s.y,u=o.width/s.x,f=o.height/s.y;if(i){const h=so(i),g=r&&ls(r)?so(r):r;let v=h.frameElement;for(;v&&r&&g!==h;){const b=yc(v),x=v.getBoundingClientRect(),w=$o(v),_=x.left+(v.clientLeft+parseFloat(w.paddingLeft))*b.x,S=x.top+(v.clientTop+parseFloat(w.paddingTop))*b.y;l*=b.x,c*=b.y,u*=b.x,f*=b.y,l+=_,c+=S,v=so(v).frameElement}}return $g({width:u,height:f,x:l,y:c})}function $Q(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=Si(n),i=ds(n);if(n===i)return t;let s={scrollLeft:0,scrollTop:0},a=ua(1);const l=ua(0);if((o||!o&&r!=="fixed")&&((da(n)!=="body"||jf(i))&&(s=Dm(n)),Si(n))){const c=ml(n);a=yc(n),l.x=c.x+n.clientLeft,l.y=c.y+n.clientTop}return{width:t.width*a.x,height:t.height*a.y,x:t.x*a.x-s.scrollLeft*a.x+l.x,y:t.y*a.y-s.scrollTop*a.y+l.y}}function AQ(e){return Array.from(e.getClientRects())}function VA(e){return ml(ds(e)).left+Dm(e).scrollLeft}function kQ(e){const t=ds(e),n=Dm(e),r=e.ownerDocument.body,o=no(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=no(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+VA(e);const a=-n.scrollTop;return $o(r).direction==="rtl"&&(s+=no(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function MQ(e,t){const n=so(e),r=ds(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;const c=D1();(!c||c&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:i,height:s,x:a,y:l}}function IQ(e,t){const n=ml(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Si(e)?yc(e):ua(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,l=o*i.x,c=r*i.y;return{width:s,height:a,x:l,y:c}}function hP(e,t,n){let r;if(t==="viewport")r=MQ(e,n);else if(t==="document")r=kQ(ds(e));else if(ls(t))r=IQ(t,n);else{const o=BA(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return $g(r)}function HA(e,t){const n=Yc(e);return n===t||!ls(n)||Tm(n)?!1:$o(n).position==="fixed"||HA(n,t)}function NQ(e,t){const n=t.get(e);if(n)return n;let r=jd(e,[],!1).filter(a=>ls(a)&&da(a)!=="body"),o=null;const i=$o(e).position==="fixed";let s=i?Yc(e):e;for(;ls(s)&&!Tm(s);){const a=$o(s),l=T1(s);!l&&a.position==="fixed"&&(o=null),(i?!l&&!o:!l&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||jf(s)&&!l&&HA(e,s))?r=r.filter(u=>u!==s):o=a,s=Yc(s)}return t.set(e,r),r}function LQ(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?NQ(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,u)=>{const f=hP(t,u,o);return c.top=no(f.top,c.top),c.right=ca(f.right,c.right),c.bottom=ca(f.bottom,c.bottom),c.left=no(f.left,c.left),c},hP(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function FQ(e){return zA(e)}function jQ(e,t,n){const r=Si(t),o=ds(t),i=n==="fixed",s=ml(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=ua(0);if(r||!r&&!i)if((da(t)!=="body"||jf(o))&&(a=Dm(t)),r){const c=ml(t,!0,i,t);l.x=c.x+t.clientLeft,l.y=c.y+t.clientTop}else o&&(l.x=VA(o));return{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}function pP(e,t){return!Si(e)||$o(e).position==="fixed"?null:t?t(e):e.offsetParent}function WA(e,t){const n=so(e);if(!Si(e))return n;let r=pP(e,t);for(;r&&OQ(r)&&$o(r).position==="static";)r=pP(r,t);return r&&(da(r)==="html"||da(r)==="body"&&$o(r).position==="static"&&!T1(r))?n:r||PQ(e)||n}const zQ=async function(e){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||WA,i=this.getDimensions;return{reference:jQ(t,await o(n),r),floating:{x:0,y:0,...await i(n)}}};function BQ(e){return $o(e).direction==="rtl"}const VQ={convertOffsetParentRelativeRectToViewportRelativeRect:$Q,getDocumentElement:ds,getClippingRect:LQ,getOffsetParent:WA,getElementRects:zQ,getClientRects:AQ,getDimensions:FQ,getScale:yc,isElement:ls,isRTL:BQ};function HQ(e,t){let n=null,r;const o=ds(e);function i(){clearTimeout(r),n&&n.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const{left:c,top:u,width:f,height:h}=e.getBoundingClientRect();if(a||t(),!f||!h)return;const g=mp(u),v=mp(o.clientWidth-(c+f)),b=mp(o.clientHeight-(u+h)),x=mp(c),_={rootMargin:-g+"px "+-v+"px "+-b+"px "+-x+"px",threshold:no(0,ca(1,l))||1};let S=!0;function R(C){const P=C[0].intersectionRatio;if(P!==l){if(!S)return s();P?s(!1,P):r=setTimeout(()=>{s(!1,1e-7)},100)}S=!1}try{n=new IntersectionObserver(R,{..._,root:o.ownerDocument})}catch{n=new IntersectionObserver(R,_)}n.observe(e)}return s(!0),i}function WQ(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=$1(e),u=o||i?[...c?jd(c):[],...jd(t)]:[];u.forEach(w=>{o&&w.addEventListener("scroll",n,{passive:!0}),i&&w.addEventListener("resize",n)});const f=c&&a?HQ(c,n):null;let h=-1,g=null;s&&(g=new ResizeObserver(w=>{let[_]=w;_&&_.target===c&&g&&(g.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{g&&g.observe(t)})),n()}),c&&!l&&g.observe(c),g.observe(t));let v,b=l?ml(e):null;l&&x();function x(){const w=ml(e);b&&(w.x!==b.x||w.y!==b.y||w.width!==b.width||w.height!==b.height)&&n(),b=w,v=requestAnimationFrame(x)}return n(),()=>{u.forEach(w=>{o&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),f&&f(),g&&g.disconnect(),g=null,l&&cancelAnimationFrame(v)}}const UQ=(e,t,n)=>{const r=new Map,o={platform:VQ,...n},i={...o.platform,_c:r};return yQ(e,t,{...o,platform:i})},qQ=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?cP({element:r.current,padding:o}).fn(n):{}:r?cP({element:r,padding:o}).fn(n):{}}}};var og=typeof document<"u"?m.useLayoutEffect:m.useEffect;function Ag(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!Ag(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!Ag(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function UA(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function gP(e,t){const n=UA(e);return Math.round(t*n)/n}function mP(e){const t=V.useRef(e);return og(()=>{t.current=e}),t}function GQ(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,f]=V.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,g]=V.useState(r);Ag(h,r)||g(r);const[v,b]=V.useState(null),[x,w]=V.useState(null),_=V.useCallback(Q=>{Q!=P.current&&(P.current=Q,b(Q))},[b]),S=V.useCallback(Q=>{Q!==A.current&&(A.current=Q,w(Q))},[w]),R=i||v,C=s||x,P=V.useRef(null),A=V.useRef(null),k=V.useRef(u),D=mP(l),I=mP(o),F=V.useCallback(()=>{if(!P.current||!A.current)return;const Q={placement:t,strategy:n,middleware:h};I.current&&(Q.platform=I.current),UQ(P.current,A.current,Q).then(W=>{const Y={...W,isPositioned:!0};B.current&&!Ag(k.current,Y)&&(k.current=Y,uw.flushSync(()=>{f(Y)}))})},[h,t,n,I]);og(()=>{c===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,f(Q=>({...Q,isPositioned:!1})))},[c]);const B=V.useRef(!1);og(()=>(B.current=!0,()=>{B.current=!1}),[]),og(()=>{if(R&&(P.current=R),C&&(A.current=C),R&&C){if(D.current)return D.current(R,C,F);F()}},[R,C,F,D]);const K=V.useMemo(()=>({reference:P,floating:A,setReference:_,setFloating:S}),[_,S]),Z=V.useMemo(()=>({reference:R,floating:C}),[R,C]),z=V.useMemo(()=>{const Q={position:n,left:0,top:0};if(!Z.floating)return Q;const W=gP(Z.floating,u.x),Y=gP(Z.floating,u.y);return a?{...Q,transform:"translate("+W+"px, "+Y+"px)",...UA(Z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:Y}},[n,a,Z.floating,u.x,u.y]);return V.useMemo(()=>({...u,update:F,refs:K,elements:Z,floatingStyles:z}),[u,F,K,Z,z])}function $m(e){const[t,n]=m.useState(void 0);return ur(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,a;if("borderBoxSize"in i){const l=i.borderBoxSize,c=Array.isArray(l)?l[0]:l;s=c.inlineSize,a=c.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}const qA="Popper",[GA,Ti]=Zn(qA),[YQ,YA]=GA(qA),KQ=e=>{const{__scopePopper:t,children:n}=e,[r,o]=m.useState(null);return m.createElement(YQ,{scope:t,anchor:r,onAnchorChange:o},n)},XQ="PopperAnchor",QQ=m.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=YA(XQ,n),s=m.useRef(null),a=_t(t,s);return m.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:m.createElement(Qe.div,he({},o,{ref:a}))}),KA="PopperContent",[JQ,aye]=GA(KA),ZQ=m.forwardRef((e,t)=>{var n,r,o,i,s,a,l,c;const{__scopePopper:u,side:f="bottom",sideOffset:h=0,align:g="center",alignOffset:v=0,arrowPadding:b=0,avoidCollisions:x=!0,collisionBoundary:w=[],collisionPadding:_=0,sticky:S="partial",hideWhenDetached:R=!1,updatePositionStrategy:C="optimized",onPlaced:P,...A}=e,k=YA(KA,u),[D,I]=m.useState(null),F=_t(t,Pe=>I(Pe)),[B,K]=m.useState(null),Z=$m(B),z=(n=Z==null?void 0:Z.width)!==null&&n!==void 0?n:0,Q=(r=Z==null?void 0:Z.height)!==null&&r!==void 0?r:0,W=f+(g!=="center"?"-"+g:""),Y=typeof _=="number"?_:{top:0,right:0,bottom:0,left:0,..._},oe=Array.isArray(w)?w:[w],$=oe.length>0,H={padding:Y,boundary:oe.filter(eJ),altBoundary:$},{refs:J,floatingStyles:N,placement:ce,isPositioned:le,middlewareData:de}=GQ({strategy:"fixed",placement:W,whileElementsMounted:(...Pe)=>WQ(...Pe,{animationFrame:C==="always"}),elements:{reference:k.anchor},middleware:[SQ({mainAxis:h+Q,alignmentAxis:v}),x&&CQ({mainAxis:!0,crossAxis:!1,limiter:S==="partial"?EQ():void 0,...H}),x&&xQ({...H}),RQ({...H,apply:({elements:Pe,rects:Te,availableWidth:Ue,availableHeight:Be})=>{const{width:Ie,height:Ke}=Te.reference,lt=Pe.floating.style;lt.setProperty("--radix-popper-available-width",`${Ue}px`),lt.setProperty("--radix-popper-available-height",`${Be}px`),lt.setProperty("--radix-popper-anchor-width",`${Ie}px`),lt.setProperty("--radix-popper-anchor-height",`${Ke}px`)}}),B&&qQ({element:B,padding:b}),tJ({arrowWidth:z,arrowHeight:Q}),R&&wQ({strategy:"referenceHidden",...H})]}),[pe,ie]=XA(ce),te=Ln(P);ur(()=>{le&&(te==null||te())},[le,te]);const ae=(o=de.arrow)===null||o===void 0?void 0:o.x,ye=(i=de.arrow)===null||i===void 0?void 0:i.y,G=((s=de.arrow)===null||s===void 0?void 0:s.centerOffset)!==0,[be,_e]=m.useState();return ur(()=>{D&&_e(window.getComputedStyle(D).zIndex)},[D]),m.createElement("div",{ref:J.setFloating,"data-radix-popper-content-wrapper":"",style:{...N,transform:le?N.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:be,"--radix-popper-transform-origin":[(a=de.transformOrigin)===null||a===void 0?void 0:a.x,(l=de.transformOrigin)===null||l===void 0?void 0:l.y].join(" ")},dir:e.dir},m.createElement(JQ,{scope:u,placedSide:pe,onArrowChange:K,arrowX:ae,arrowY:ye,shouldHideArrow:G},m.createElement(Qe.div,he({"data-side":pe,"data-align":ie},A,{ref:F,style:{...A.style,animation:le?void 0:"none",opacity:(c=de.hide)!==null&&c!==void 0&&c.referenceHidden?0:void 0}}))))});function eJ(e){return e!==null}const tJ=e=>({name:"transformOrigin",options:e,fn(t){var n,r,o,i,s;const{placement:a,rects:l,middlewareData:c}=t,f=((n=c.arrow)===null||n===void 0?void 0:n.centerOffset)!==0,h=f?0:e.arrowWidth,g=f?0:e.arrowHeight,[v,b]=XA(a),x={start:"0%",center:"50%",end:"100%"}[b],w=((r=(o=c.arrow)===null||o===void 0?void 0:o.x)!==null&&r!==void 0?r:0)+h/2,_=((i=(s=c.arrow)===null||s===void 0?void 0:s.y)!==null&&i!==void 0?i:0)+g/2;let S="",R="";return v==="bottom"?(S=f?x:`${w}px`,R=`${-g}px`):v==="top"?(S=f?x:`${w}px`,R=`${l.floating.height+g}px`):v==="right"?(S=`${-g}px`,R=f?x:`${_}px`):v==="left"&&(S=`${l.floating.width+g}px`,R=f?x:`${_}px`),{data:{x:S,y:R}}}});function XA(e){const[t,n="center"]=e.split("-");return[t,n]}const zf=KQ,Bf=QQ,Vf=ZQ,A1=m.forwardRef((e,t)=>{var n;const{container:r=globalThis==null||(n=globalThis.document)===null||n===void 0?void 0:n.body,...o}=e;return r?ko.createPortal(m.createElement(Qe.div,he({},o,{ref:t})),r):null}),nJ=m.forwardRef((e,t)=>{const{children:n,...r}=e,o=m.Children.toArray(n),i=o.find(rJ);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(vx,he({},r,{ref:t}),m.isValidElement(s)?m.cloneElement(s,void 0,a):null)}return m.createElement(vx,he({},r,{ref:t}),n)});nJ.displayName="Slot";const vx=m.forwardRef((e,t)=>{const{children:n,...r}=e;return m.isValidElement(n)?m.cloneElement(n,{...oJ(r,n.props),ref:t?cs(t,n.ref):n.ref}):m.Children.count(n)>1?m.Children.only(null):null});vx.displayName="SlotClone";const QA=({children:e})=>m.createElement(m.Fragment,null,e);function rJ(e){return m.isValidElement(e)&&e.type===QA}function oJ(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}const JA=m.forwardRef((e,t)=>m.createElement(Qe.span,he({},e,{ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}))),iJ=JA,[Am,lye]=Zn("Tooltip",[Ti]),k1=Ti(),sJ="TooltipProvider",aJ=700,bx="tooltip.open",[lJ,M1]=Am(sJ),cJ=e=>{const{__scopeTooltip:t,delayDuration:n=aJ,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=e,[s,a]=m.useState(!0),l=m.useRef(!1),c=m.useRef(0);return m.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),m.createElement(lJ,{scope:t,isOpenDelayed:s,delayDuration:n,onOpen:m.useCallback(()=>{window.clearTimeout(c.current),a(!1)},[]),onClose:m.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a(!0),r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:m.useCallback(u=>{l.current=u},[]),disableHoverableContent:o},i)},I1="Tooltip",[uJ,km]=Am(I1),dJ=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o=!1,onOpenChange:i,disableHoverableContent:s,delayDuration:a}=e,l=M1(I1,e.__scopeTooltip),c=k1(t),[u,f]=m.useState(null),h=Jo(),g=m.useRef(0),v=s??l.disableHoverableContent,b=a??l.delayDuration,x=m.useRef(!1),[w=!1,_]=xr({prop:r,defaultProp:o,onChange:A=>{A?(l.onOpen(),document.dispatchEvent(new CustomEvent(bx))):l.onClose(),i==null||i(A)}}),S=m.useMemo(()=>w?x.current?"delayed-open":"instant-open":"closed",[w]),R=m.useCallback(()=>{window.clearTimeout(g.current),x.current=!1,_(!0)},[_]),C=m.useCallback(()=>{window.clearTimeout(g.current),_(!1)},[_]),P=m.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>{x.current=!0,_(!0)},b)},[b,_]);return m.useEffect(()=>()=>window.clearTimeout(g.current),[]),m.createElement(zf,c,m.createElement(uJ,{scope:t,contentId:h,open:w,stateAttribute:S,trigger:u,onTriggerChange:f,onTriggerEnter:m.useCallback(()=>{l.isOpenDelayed?P():R()},[l.isOpenDelayed,P,R]),onTriggerLeave:m.useCallback(()=>{v?C():window.clearTimeout(g.current)},[C,v]),onOpen:R,onClose:C,disableHoverableContent:v},n))},vP="TooltipTrigger",ZA=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=km(vP,n),i=M1(vP,n),s=k1(n),a=m.useRef(null),l=_t(t,a,o.onTriggerChange),c=m.useRef(!1),u=m.useRef(!1),f=m.useCallback(()=>c.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),m.createElement(Bf,he({asChild:!0},s),m.createElement(Qe.button,he({"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute},r,{ref:l,onPointerMove:Me(e.onPointerMove,h=>{h.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),u.current=!0)}),onPointerLeave:Me(e.onPointerLeave,()=>{o.onTriggerLeave(),u.current=!1}),onPointerDown:Me(e.onPointerDown,()=>{c.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Me(e.onFocus,()=>{c.current||o.onOpen()}),onBlur:Me(e.onBlur,o.onClose),onClick:Me(e.onClick,o.onClose)})))}),fJ="TooltipPortal",[cye,hJ]=Am(fJ,{forceMount:void 0}),zd="TooltipContent",pJ=m.forwardRef((e,t)=>{const n=hJ(zd,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...i}=e,s=km(zd,e.__scopeTooltip);return m.createElement(er,{present:r||s.open},s.disableHoverableContent?m.createElement(ek,he({side:o},i,{ref:t})):m.createElement(gJ,he({side:o},i,{ref:t})))}),gJ=m.forwardRef((e,t)=>{const n=km(zd,e.__scopeTooltip),r=M1(zd,e.__scopeTooltip),o=m.useRef(null),i=_t(t,o),[s,a]=m.useState(null),{trigger:l,onClose:c}=n,u=o.current,{onPointerInTransitChange:f}=r,h=m.useCallback(()=>{a(null),f(!1)},[f]),g=m.useCallback((v,b)=>{const x=v.currentTarget,w={x:v.clientX,y:v.clientY},_=vJ(w,x.getBoundingClientRect()),S=bJ(w,_),R=yJ(b.getBoundingClientRect()),C=wJ([...S,...R]);a(C),f(!0)},[f]);return m.useEffect(()=>()=>h(),[h]),m.useEffect(()=>{if(l&&u){const v=x=>g(x,u),b=x=>g(x,l);return l.addEventListener("pointerleave",v),u.addEventListener("pointerleave",b),()=>{l.removeEventListener("pointerleave",v),u.removeEventListener("pointerleave",b)}}},[l,u,g,h]),m.useEffect(()=>{if(s){const v=b=>{const x=b.target,w={x:b.clientX,y:b.clientY},_=(l==null?void 0:l.contains(x))||(u==null?void 0:u.contains(x)),S=!xJ(w,s);_?h():S&&(h(),c())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[l,u,s,c,h]),m.createElement(ek,he({},e,{ref:i}))}),[mJ,uye]=Am(I1,{isInside:!1}),ek=m.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:s,...a}=e,l=km(zd,n),c=k1(n),{onClose:u}=l;return m.useEffect(()=>(document.addEventListener(bx,u),()=>document.removeEventListener(bx,u)),[u]),m.useEffect(()=>{if(l.trigger){const f=h=>{const g=h.target;g!=null&&g.contains(l.trigger)&&u()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[l.trigger,u]),m.createElement(Ff,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:u},m.createElement(Vf,he({"data-state":l.stateAttribute},c,a,{ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"}}),m.createElement(QA,null,r),m.createElement(mJ,{scope:n,isInside:!0},m.createElement(iJ,{id:l.contentId,role:"tooltip"},o||r))))});function vJ(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function bJ(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function yJ(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function xJ(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const a=t[i].x,l=t[i].y,c=t[s].x,u=t[s].y;l>r!=u>r&&n<(c-a)*(r-l)/(u-l)+a&&(o=!o)}return o}function wJ(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),_J(t)}function _J(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const i=t[t.length-1],s=t[t.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const i=n[n.length-1],s=n[n.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}const SJ=cJ,CJ=dJ,EJ=ZA,tk=pJ,RJ=SJ,nk=CJ,rk=EJ,N1=V.forwardRef(({className:e,sideOffset:t=4,...n},r)=>O.jsx(tk,{ref:r,sideOffset:t,className:Ee("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n}));N1.displayName=tk.displayName;function ll({number:e,decimalPlaces:t=0,useSuffix:n=!1,customSuffix:r="",currency:o="",locale:i="en-US"}){let s=1,a=r,l=i;const c=t;n&&!r&&(e>=1e9?(s=1e9,a="B"):e>=1e7&&i==="en-IN"?(s=1e7,a="Cr"):e>=1e5&&i==="en-IN"?(s=1e5,a="L"):e>=1e6?(s=1e6,a="M"):e>=1e3&&(s=1e3,a="K"));const u=e/s,f={maximumFractionDigits:c,minimumFractionDigits:c};if(o){f.style="currency",f.currency=o;try{new Intl.NumberFormat(i,f).format(0)}catch{f.currency="USD"}}try{new Intl.NumberFormat(i,f).format(0)}catch{l="en-US"}let g=new Intl.NumberFormat(l,f).format(u);return n&&(g+=a),g}function ok(e,t){if(!t)return"";const n=t.find(r=>e>=r.start&&e<=r.end);return(n==null?void 0:n.color)||""}function ik({card:e,isLoading:t}){var w,_,S,R,C,P,A,k,D,I,F,B,K,Z,z,Q,W,Y,oe,$,H,J,N,ce;const n=ke(le=>le.actions.setCardTitle),r=ke(le=>le.actions.setCardDescription),o=ke(le=>le.isVisualEditing),i=Ar(le=>le.card),s=Ar(le=>le.actions.setCard);Ar(le=>le.actions.setNumberFormat);const a=ke(le=>le.selectedSheetId),l=e.data,c=(_=(w=e.preferences)==null?void 0:w.formatNumber)==null?void 0:_.colorRanges,{metricKeys:u}=ar(l||[]),f=(S=l==null?void 0:l[0])==null?void 0:S[u==null?void 0:u[0]],h=(R=l==null?void 0:l[0])==null?void 0:R[u==null?void 0:u[1]],g=!!e.data&&e.data.length>0;function v(le){o?s({...i,title:le}):n(a,e.id,le)}function b(le){o?s({...i,description:le}):r(a,e.id,le)}const x=h&&h-f!==0?(f-h)/h:null;return O.jsxs("div",{className:"kpi-card flex grow flex-col overflow-scroll",children:[O.jsxs(sm,{className:"grow pb-3",children:[O.jsx(is,{text:o?i.title:e.title,onSave:v,children:O.jsxs("div",{className:"flex items-center gap-2",children:[O.jsx(Df,{className:"text-base font-medium text-muted-foreground",children:e.title}),!e.refreshInterval&&t&&O.jsx(S1,{className:"h-4 w-4 animate-spin text-muted-foreground"})]})}),g&&O.jsxs("div",{className:"flex flex-wrap items-end gap-3 text-foreground",children:[O.jsx("p",{style:{color:ok(f,c)},className:"text-3xl font-semibold",children:ll({number:f,decimalPlaces:((P=(C=e.preferences)==null?void 0:C.formatNumber)==null?void 0:P.decimalPlaces)||0,useSuffix:!!((k=(A=e.preferences)==null?void 0:A.formatNumber)!=null&&k.suffix),customSuffix:((I=(D=e.preferences)==null?void 0:D.formatNumber)==null?void 0:I.suffix)||"",locale:((B=(F=e.preferences)==null?void 0:F.formatNumber)==null?void 0:B.locale)||"",currency:((Z=(K=e.preferences)==null?void 0:K.formatNumber)==null?void 0:Z.currency)||""})}),h&&O.jsxs("span",{className:"min-w-fit text-base font-normal text-muted-foreground",children:["from ",ll({number:h,decimalPlaces:((Q=(z=e.preferences)==null?void 0:z.formatNumber)==null?void 0:Q.decimalPlaces)||0,useSuffix:!!((Y=(W=e.preferences)==null?void 0:W.formatNumber)!=null&&Y.suffix),customSuffix:(($=(oe=e.preferences)==null?void 0:oe.formatNumber)==null?void 0:$.suffix)||"",locale:((J=(H=e.preferences)==null?void 0:H.formatNumber)==null?void 0:J.locale)||"",currency:((ce=(N=e.preferences)==null?void 0:N.formatNumber)==null?void 0:ce.currency)||""})]})]})]}),x&&O.jsxs(am,{className:"grow items-start gap-1 pb-4 text-sm",children:[O.jsx(OJ,{children:x}),O.jsxs("div",{className:"flex gap-1 text-muted-foreground",children:[x>0?"up ":"down ",O.jsx(is,{text:e.description||"",onSave:b,children:e.description})]})]})]})}function OJ({children:e}){const t=e>0?O.jsx(w1,{className:"h-4 w-4"}):O.jsx(x1,{className:"h-4 w-4"}),n=`${Math.abs(e*100).toFixed(0)}%`;return O.jsxs("div",{className:Ee("flex items-center",{"text-green-600":e>0,"text-destructive":e<0}),children:[t,O.jsx("span",{className:"ml-[1px]",children:n})]})}var Kc=1e3,Xc=Kc*60,Qc=Xc*60,vl=Qc*24,PJ=vl*7,TJ=vl*365.25,DJ=function(e,t){t=t||{};var n=typeof e;if(n==="string"&&e.length>0)return $J(e);if(n==="number"&&isFinite(e))return t.long?kJ(e):AJ(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function $J(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*TJ;case"weeks":case"week":case"w":return n*PJ;case"days":case"day":case"d":return n*vl;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Qc;case"minutes":case"minute":case"mins":case"min":case"m":return n*Xc;case"seconds":case"second":case"secs":case"sec":case"s":return n*Kc;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function AJ(e){var t=Math.abs(e);return t>=vl?Math.round(e/vl)+"d":t>=Qc?Math.round(e/Qc)+"h":t>=Xc?Math.round(e/Xc)+"m":t>=Kc?Math.round(e/Kc)+"s":e+"ms"}function kJ(e){var t=Math.abs(e);return t>=vl?vp(e,t,vl,"day"):t>=Qc?vp(e,t,Qc,"hour"):t>=Xc?vp(e,t,Xc,"minute"):t>=Kc?vp(e,t,Kc,"second"):e+" ms"}function vp(e,t,n,r){var o=t>=n*1.5;return Math.round(e/n)+" "+r+(o?"s":"")}const MJ=nu(DJ);function sk({children:e}){const{setIsSessionExpired:t}=Mo(),n=new Qz({queryCache:new pD({onError:r=>{console.error(`Something went wrong: ${r.message}`),r.message==="invalid token"&&t(!0)}}),defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1}}});return O.jsx(tB,{client:n,children:e})}const IJ={id:"",authToken:void 0},ak=m.createContext(IJ),lk=({children:e,dashboardProps:t})=>O.jsx(sk,{children:O.jsx(ak.Provider,{value:t,children:O.jsx("div",{style:{height:"100%"},id:"semaphor-scope",children:e})})});function ma(){const e=m.useContext(ak);if(e===void 0)throw new Error("useApplicationContext must be used within a ApplicationContextProvider");return e}function NJ(e){ke(u=>u.bookmarkKey),ke(u=>u.selectedSheetId);const t=ke(u=>u.dashboard.baseQueries),n=ke(u=>u.actions.getCardSheet),{authToken:r}=ma(),o=ke(u=>u.authToken),i=ke(u=>u.filterValues),s=ke(u=>u.isDashboardEditing),a=MJ((e==null?void 0:e.refreshInterval)||"0");n(e.id);const l=Y2(e.sql,t);return Tf({queryKey:[e.id,l],queryFn:()=>Rf("https://semaphor.cloud/api/v1/query",(r==null?void 0:r.accessToken)||(o==null?void 0:o.accessToken)||"",{connection_id:e.connectionId,sql:l,python:e.python===aD?"":e.python,active_filters:i}),refetchInterval:a,enabled:!!e.connectionId&&!s})}function Ia({data:e,cfg:t,customCfg:n,preferences:r}){const{dimensionKeys:o,metricKeys:i}=ar(e),s=zX(i,e,r),a=rg(s,n),l=o[0],c=fx(e,l);L1(r,t),ck(r);const u=uk(t,r),f=qo((t==null?void 0:t.options)||{},r==null?void 0:r.chartOptions),h=qo(u,f),g=qo(h,(n==null?void 0:n.options)||{});return{type:(n==null?void 0:n.type)||(t==null?void 0:t.type)||"bar",data:{labels:c,datasets:a},options:g}}function L1(e,t){var o,i,s;const n=((o=t==null?void 0:t.options)==null?void 0:o.indexAxis)==="y"?"x":"y";return(i=e==null?void 0:e.chartOptions)!=null&&i.indexAxis?((s=e==null?void 0:e.chartOptions)==null?void 0:s.indexAxis)==="x"?"y":"x":n}function ck(e){var n,r;return(n=e==null?void 0:e.chartOptions)!=null&&n.indexAxis?((r=e==null?void 0:e.chartOptions)==null?void 0:r.indexAxis)==="x"?"x":"y":"x"}function uk(e,t){var i,s,a,l,c,u,f,h,g,v,b,x;const n=L1(t,e),r=ck(t);return{...e==null?void 0:e.options,scales:{...(i=e==null?void 0:e.options)==null?void 0:i.scales,[n]:{...(a=(s=e==null?void 0:e.options)==null?void 0:s.scales)==null?void 0:a[n],ticks:{...(u=(c=(l=e==null?void 0:e.options)==null?void 0:l.scales)==null?void 0:c[n])==null?void 0:u.ticks,callback:w=>{var _,S,R,C;return ll({number:Number(w),decimalPlaces:((_=t==null?void 0:t.numberAxisFormat)==null?void 0:_.decimalPlaces)||0,useSuffix:!!((S=t==null?void 0:t.numberAxisFormat)!=null&&S.suffix),customSuffix:"",locale:((R=t==null?void 0:t.numberAxisFormat)==null?void 0:R.locale)||"",currency:((C=t==null?void 0:t.numberAxisFormat)==null?void 0:C.currency)||""})}}},[r]:{...(g=(h=(f=e==null?void 0:e.options)==null?void 0:f.scales)==null?void 0:h[r])==null?void 0:g.ticks,callback:null}},plugins:{...(v=e==null?void 0:e.options)==null?void 0:v.plugins,datalabels:{...(x=(b=e==null?void 0:e.options)==null?void 0:b.plugins)==null?void 0:x.datalabels,formatter:function(w){var _,S,R,C;return ll({number:Number(w),decimalPlaces:((_=t==null?void 0:t.numberAxisFormat)==null?void 0:_.decimalPlaces)||0,useSuffix:!!((S=t==null?void 0:t.numberAxisFormat)!=null&&S.suffix),customSuffix:"",locale:((R=t==null?void 0:t.numberAxisFormat)==null?void 0:R.locale)||"",currency:((C=t==null?void 0:t.numberAxisFormat)==null?void 0:C.currency)||""})}}}}}function LJ(e){return{...e,type:"bar",options:{...e==null?void 0:e.options,indexAxis:"y",scales:{x:{display:!0},y:{display:!0}}}}}function FJ(e){return{...e,type:"bar",options:{...e==null?void 0:e.options,indexAxis:"y",scales:{x:{beginAtZero:!0,stack:1,reverse:!0},y:{stacked:!0,beginAtZero:!0}}}}}function jJ(e){return{...e,type:"bar",options:{...e==null?void 0:e.options,scales:{x:{display:!0},y:{display:!0}}}}}function zJ(e,t=!1){return{...e,type:"bar",options:{...e==null?void 0:e.options,indexAxis:"y",scales:{x:{display:!0,beginAtZero:!1},y:{display:!0,stacked:t}}}}}function BJ(e,t){var r,o,i,s;return{...e,type:t==="stackedBar"?"bar":"line",options:{...e==null?void 0:e.options,scales:{x:{...(o=(r=e==null?void 0:e.options)==null?void 0:r.scales)==null?void 0:o.x,display:!0,stacked:!0},y:{...(s=(i=e==null?void 0:e.options)==null?void 0:i.scales)==null?void 0:s.y,display:!0,stacked:!0}}}}}function VJ(e){return{...e,type:"line",options:{...e==null?void 0:e.options,scales:{x:{display:!0},y:{display:!0}}}}}function HJ(e,t){var r;return{...t,type:e,options:{...t==null?void 0:t.options,scales:{x:{display:!1},y:{display:!1}},plugins:{...(r=t==null?void 0:t.options)==null?void 0:r.plugins,legend:{position:"top",align:"center",maxHeight:0,labels:{useBorderRadius:!0,borderRadius:2}}},borderRadius:0}}}function WJ(e){return{...e,type:"radar",options:{...e==null?void 0:e.options,scales:{x:{display:!1},y:{display:!1}}}}}function UJ(e){const n=new Function("getDatalabelColor",e)(w0);return{options:n==null?void 0:n.options,plugins:(n==null?void 0:n.plugins)||[]}}function F1({data:e,cardType:t="bar",cfg:n,customCfg:r,provider:o="chartjs",userSettings:i,preferences:s}){var a,l,c;if(t==="bar"){const u=jJ(n);return Ia({data:e,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="horizontalBar"){const u=LJ(n);return Ia({data:e,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="pyramid"){const u=FJ(n),{dimensionKeys:f,metricKeys:h}=ar(e),g=Pg({dataArray:e,groupKey:f[0],pivotKey:f[1],valueKey:h[0]}),v=Ia({data:g,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s}),b="x2";return{...v,data:{...v.data,datasets:v.data.datasets.map((w,_)=>_===1?{...w,xAxisID:b}:w)},options:{...v.options,scales:{...(a=v==null?void 0:v.options)==null?void 0:a.scales,[b]:{beginAtZero:!0,stack:1}}}}}if(t==="stackedBar"||t==="stackedLine"){const u=BJ(n,t),{dimensionKeys:f,metricKeys:h}=ar(e),g=Pg({dataArray:e,groupKey:f[0],pivotKey:f[1],valueKey:h[0]});return Ia({data:g,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="line"){const u=VJ(n);return Ia({data:e,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="range"){const u=zJ(n),f=HX(e),h=rg(f,r),{plugins:g,options:v}=UJ((s==null?void 0:s.customVisualCode)||""),b=qo((u==null?void 0:u.options)||{},(n==null?void 0:n.options)||{}),x=qo(b,(s==null?void 0:s.chartOptions)||{}),w=qo(x,(r==null?void 0:r.options)||{}),_=qo(w,v),S=uk(n,s),R=qo(_,S),C={...R,plugins:{...R==null?void 0:R.plugins,datalabels:{...(l=R==null?void 0:R.plugins)==null?void 0:l.datalabels,formatter:(I,F)=>I.map(K=>{var Z,z,Q,W;return ll({number:Number(K),decimalPlaces:((Z=s==null?void 0:s.numberAxisFormat)==null?void 0:Z.decimalPlaces)||0,useSuffix:!!((z=s==null?void 0:s.numberAxisFormat)!=null&&z.suffix),customSuffix:"",locale:((Q=s==null?void 0:s.numberAxisFormat)==null?void 0:Q.locale)||"",currency:((W=s==null?void 0:s.numberAxisFormat)==null?void 0:W.currency)||""})}).slice(0,2).join(" - ")}}},{dimensionKeys:P}=ar(e),A=P[0];return{type:"bar",data:{labels:[...new Set(fx(e,A))],datasets:h},options:C,plugins:[...g]}}if(t==="pie"||t==="doughnut"||t==="polarArea"){const u=HJ(t,n),{dimensionKeys:f,metricKeys:h}=ar(e),g=WX(h,e),v=rg(g,r),b=f[0],x=fx(e,b),w=qo((u==null?void 0:u.options)||{},(r==null?void 0:r.options)||{}),_=qo(w,(s==null?void 0:s.chartOptions)||{}),S={..._,plugins:{..._.plugins,datalabels:{...(c=_.plugins)==null?void 0:c.datalabels,formatter:(P,A)=>{var k,D,I,F;return ll({number:Number(P),decimalPlaces:((k=s==null?void 0:s.numberAxisFormat)==null?void 0:k.decimalPlaces)||0,useSuffix:!!((D=s==null?void 0:s.numberAxisFormat)!=null&&D.suffix),customSuffix:"",locale:((I=s==null?void 0:s.numberAxisFormat)==null?void 0:I.locale)||"",currency:((F=s==null?void 0:s.numberAxisFormat)==null?void 0:F.currency)||""})}}}};return{type:t,data:{labels:x,datasets:v},options:S,plugins:[t==="doughnut"?{id:"doughnutLabel",beforeDatasetsDraw:function(P,A,k){var Q,W,Y,oe;const{ctx:D,data:I}=P;D.save();const F=P.getDatasetMeta(0).data[0].x,B=P.getDatasetMeta(0).data[0].y,K=Bc(Od());D.font="1.2rem Arial",D.fontWeight="bolder",D.fillStyle=K,D.textAlign="center",D.textBaseline="middle";const Z=I.datasets[0].data.reduce(($,H)=>$+H,0),z=ll({number:Number(Z),decimalPlaces:((Q=s==null?void 0:s.numberAxisFormat)==null?void 0:Q.decimalPlaces)||0,useSuffix:!!((W=s==null?void 0:s.numberAxisFormat)!=null&&W.suffix),customSuffix:"",locale:((Y=s==null?void 0:s.numberAxisFormat)==null?void 0:Y.locale)||"",currency:((oe=s==null?void 0:s.numberAxisFormat)==null?void 0:oe.currency)||""});D.fillText(z,F,B)}}:""]}}if(t==="radar"){const u=WJ(n);return Ia({data:e,cfg:u,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}if(t==="bubble"||t==="scatter"){const{metricKeys:u}=ar(e);if(u.length<3){console.log("Bubble charts require 3 numeric columns");return}const f=VX(e),h=rg(f,r),g={plugins:{datalabels:{display:!0}},scales:{x:{title:{display:!0,text:u[0]},beginAtZero:!0,ticks:{precision:0}},y:{title:{display:!0,text:u[1]},beginAtZero:!0,ticks:{precision:0}}}},v=qo(g,(r==null?void 0:r.options)||{});return{type:t,data:{datasets:h},options:v}}return Ia({data:e,cfg:n,customCfg:r,cardType:t,userSettings:i,provider:o,preferences:s})}function qJ({chart:e,elementIndex:t,datasetIndex:n,cardType:r,cfg:o,apply:i}){const s=ke.getState().theme;if(!o)return;const a=s==="dark"?"rgb(238,238,238,0.2)":"rgb(238,238,238,0.8)";["bar","line","horizontalBar","bubble","scatter"].includes(r)&&YJ(e,t,o,i,a),["pie","doughnut","polarArea"].includes(r)&&KJ(e,t,o,i,a),["stackedBar","pyramid"].includes(r)&&GJ({chart:e,elementIndex:t,datasetIndex:n,cfg:o,apply:i,blurColor:a})}function GJ(e){var a,l,c,u;const{chart:t,elementIndex:n,datasetIndex:r,cfg:o,apply:i,blurColor:s}=e;i?(l=(a=t==null?void 0:t.data)==null?void 0:a.datasets)==null||l.forEach((f,h)=>{var g,v;typeof f.backgroundColor=="string"&&(f.backgroundColor=new Array(f.data.length).fill(f.backgroundColor),f.borderColor=new Array(f.data.length).fill(f.borderColor)),f.backgroundColor=(g=f==null?void 0:f.backgroundColor)==null?void 0:g.map((b,x)=>x===n&&h===r?b:s),f.borderColor=(v=f==null?void 0:f.borderColor)==null?void 0:v.map((b,x)=>x===n&&h===r?b:s)}):(u=(c=t==null?void 0:t.data)==null?void 0:c.datasets)==null||u.forEach((f,h)=>{var g,v,b,x,w,_;f.backgroundColor=new Array(f.data.length).fill((b=(v=(g=o==null?void 0:o.data)==null?void 0:g.datasets)==null?void 0:v[h])==null?void 0:b.backgroundColor),f.borderColor=new Array(f.data.length).fill((_=(w=(x=o==null?void 0:o.data)==null?void 0:x.datasets)==null?void 0:w[h])==null?void 0:_.borderColor)}),t==null||t.update()}function YJ(e,t,n,r,o){var i,s,a,l;console.log("clicked index",t),r?(s=(i=e==null?void 0:e.data)==null?void 0:i.datasets)==null||s.forEach(c=>{var u,f;typeof c.backgroundColor=="string"&&(c.backgroundColor=new Array(c.data.length).fill(c.backgroundColor),c.borderColor=new Array(c.data.length).fill(c.borderColor)),c.backgroundColor=(u=c==null?void 0:c.backgroundColor)==null?void 0:u.map((h,g)=>g===t?h:o),c.borderColor=(f=c==null?void 0:c.borderColor)==null?void 0:f.map((h,g)=>g===t?h:o)}):(l=(a=e==null?void 0:e.data)==null?void 0:a.datasets)==null||l.forEach((c,u)=>{var f,h,g,v,b,x;c.backgroundColor=new Array(c.data.length).fill((g=(h=(f=n==null?void 0:n.data)==null?void 0:f.datasets)==null?void 0:h[u])==null?void 0:g.backgroundColor),c.borderColor=new Array(c.data.length).fill((x=(b=(v=n==null?void 0:n.data)==null?void 0:v.datasets)==null?void 0:b[u])==null?void 0:x.borderColor)}),e==null||e.update()}function KJ(e,t,n,r,o){var i,s,a,l;r?(s=(i=e==null?void 0:e.data)==null?void 0:i.datasets)==null||s.forEach(c=>{var u,f;c.backgroundColor=(u=c==null?void 0:c.backgroundColor)==null?void 0:u.map((h,g)=>g===t?h:o),c.borderColor=(f=c==null?void 0:c.borderColor)==null?void 0:f.map((h,g)=>g===t?h:o)}):(l=(a=e==null?void 0:e.data)==null?void 0:a.datasets)==null||l.forEach((c,u)=>{var f,h,g,v,b,x,w,_;typeof c.backgroundColor=="string"&&(c.backgroundColor=(g=(h=(f=n==null?void 0:n.data)==null?void 0:f.datasets)==null?void 0:h[u])==null?void 0:g.backgroundColor,c.borderColor=(x=(b=(v=n==null?void 0:n.data)==null?void 0:v.datasets)==null?void 0:b[u])==null?void 0:x.borderColor),c.backgroundColor=(w=c==null?void 0:c.backgroundColor)==null?void 0:w.map((S,R)=>{var C;return(C=n.data.datasets[u].backgroundColor)==null?void 0:C[R]}),c.borderColor=(_=c==null?void 0:c.borderColor)==null?void 0:_.map((S,R)=>{var C;return(C=n.data.datasets[u].borderColor)==null?void 0:C[R]})}),e==null||e.update()}function XJ(e,t,n,r){var o,i;try{if(!e||!e.data)return;const{dimensionKeys:s,metricKeys:a}=ar(e.data);if(["bar","horizontalBar","line","pie","doughnut","radar","polarArea"].includes(e.type)){const l=s[0],c=(o=e.data[n])==null?void 0:o[l];return[{columnName:l,columnValue:c,metric:a[t],value:r}]}if(["stackedBar","pyramid"].includes(e.type)){const l=Pg({dataArray:e.data,groupKey:s[0],pivotKey:s[1],valueKey:a[0]}),c=s[0],u=(i=l[n])==null?void 0:i[c],f=s[1],{metricKeys:h}=ar(l),g=h[t];return[{columnName:c,columnValue:u,metric:a[0],value:r},{columnName:f,columnValue:g,metric:a[0],value:r}]}if(e.type==="bubble"||e.type==="scatter"){const l=s[0],c=r.label;return[{columnName:l,columnValue:c,metric1:a[0],value1:r.x,metric2:a[1],value2:r.y,metric3:a==null?void 0:a[2],value3:r==null?void 0:r.r}]}}catch(s){console.error("Error in getAdhocFilter",s)}}function QJ(e){var s,a;const[t]=m.useState({id:"",title:"",type:"bar",data:[]}),{getCard:n}=Mo(),r=n(e),o=j1(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 j1(e){var B,K,Z;const{onChartElementClicked:t}=ma(),[n,r]=m.useState(0),o=((B=e==null?void 0:e.preferences)==null?void 0:B.filterOnClickColumnIndex)===void 0?0:(K=e.preferences)==null?void 0:K.filterOnClickColumnIndex,i=ke(z=>z.bookmarkKey);ke(z=>z.isVisualEditing);const s=ke(z=>z.filteringCards),a=ke(z=>z.selectedSheetId);ke(z=>z.selectedCardId),ke(z=>z.isDashboardEditing);const l=ke(z=>z.themeStyle),c=ke(z=>z.filterValues),u=m.useRef(c),f=(Z=e==null?void 0:e.preferences)==null?void 0:Z.onClickFilter,{addFrame:h,addFilteringCard:g,setFrameCardData:v,getSelectedFrame:b,addOrUpdateFilterValue:x,addOrUpdateFilterValues:w,removeFilterValue:_,removeFilteringCard:S}=Mo(),{data:R,isLoading:C,isFetching:P,isError:A,refetch:k}=NJ(e),D=s==null?void 0:s.find(z=>z.id===e.id);let I;e.data&&e.data.length>0&&(I=F1({data:e.data,cardType:e.type,cfg:e.cfg,customCfg:e.customCfg,preferences:e.preferences})),m.useEffect(()=>{!R||!R.records||v(a,e.id,(R==null?void 0:R.records)||[])},[R,a,e.id,v,c]),m.useEffect(()=>{e.data&&r(n+1)},[e.data,e.type,e.cfg,e.customCfg,e.preferences,l]),m.useEffect(()=>{e.connectionId&&!D&&(k(),u.current=c)},[c,i]);function F(z,Q,W,Y){var H,J;let oe=!1;if(!e.data)return;const $=XJ(e,Q,W,Y);if(console.log("fieldValues",$),t==null||t(e,$),!!(((H=e==null?void 0:e.preferences)==null?void 0:H.onClickFilter)??[]).length){if(D){const N=e.id;_(N),S(e)}else{if(oe=!0,!$)return;const N=[];$.forEach((ce,le)=>{const de=f==null?void 0:f.find(ie=>ie.columnIndex===le);if(!de)return;const pe={filterId:e.id+"-"+ce.columnName,connectionId:e==null?void 0:e.connectionId,tableName:e.lastSelectedTable,name:ce.columnName,expression:de.expression,valueType:Pd($[de.columnIndex].columnValue),operation:"=",values:[$[de.columnIndex].columnValue]};N.push(pe)}),e.id,e==null||e.connectionId,e.lastSelectedTable,$[o].columnName,(J=e.preferences)==null||J.filterOnClickField,Pd($[o].columnValue),$[o].columnValue,w(N),g(e)}qJ({chart:z,elementIndex:W,datasetIndex:Q,cardType:e.type,cfg:I,apply:oe})}}return{isError:A,isLoading:C,isFetching:P,data:R,visualKey:n,handleDatapointClick:F,cfg:I}}var JJ=e=>{switch(e){case"success":return tZ;case"info":return rZ;case"warning":return nZ;case"error":return oZ;default:return null}},ZJ=Array(12).fill(0),eZ=({visible:e})=>m.createElement("div",{className:"sonner-loading-wrapper","data-visible":e},m.createElement("div",{className:"sonner-spinner"},ZJ.map((t,n)=>m.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),tZ=m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},m.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),nZ=m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},m.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),rZ=m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},m.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),oZ=m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},m.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),iZ=()=>{let[e,t]=m.useState(document.hidden);return m.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},yx=1,sZ=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;let{message:r,...o}=t,i=typeof(t==null?void 0:t.id)=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:yx++,s=this.toasts.find(l=>l.id===i),a=t.dismissible===void 0?!0:t.dismissible;return s?this.toasts=this.toasts.map(l=>l.id===i?(this.publish({...l,...t,id:i,title:r}),{...l,...t,id:i,dismissible:a,title:r}):l):this.addToast({title:r,...o,dismissible:a,id:i}),i},this.dismiss=t=>(t||this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),this.subscribers.forEach(n=>n({id:t,dismiss:!0})),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));let o=t instanceof Promise?t:t(),i=r!==void 0;return o.then(async s=>{if(lZ(s)&&!s.ok){i=!1;let a=typeof n.error=="function"?await n.error(`HTTP error! status: ${s.status}`):n.error,l=typeof n.description=="function"?await n.description(`HTTP error! status: ${s.status}`):n.description;this.create({id:r,type:"error",message:a,description:l})}else if(n.success!==void 0){i=!1;let a=typeof n.success=="function"?await n.success(s):n.success,l=typeof n.description=="function"?await n.description(s):n.description;this.create({id:r,type:"success",message:a,description:l})}}).catch(async s=>{if(n.error!==void 0){i=!1;let a=typeof n.error=="function"?await n.error(s):n.error,l=typeof n.description=="function"?await n.description(s):n.description;this.create({id:r,type:"error",message:a,description:l})}}).finally(()=>{var s;i&&(this.dismiss(r),r=void 0),(s=n.finally)==null||s.call(n)}),r},this.custom=(t,n)=>{let r=(n==null?void 0:n.id)||yx++;return this.create({jsx:t(r),id:r,...n}),r},this.subscribers=[],this.toasts=[]}},Qr=new sZ,aZ=(e,t)=>{let n=(t==null?void 0:t.id)||yx++;return Qr.addToast({title:e,...t,id:n}),n},lZ=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",cZ=aZ,uZ=()=>Qr.toasts,dk=Object.assign(cZ,{success:Qr.success,info:Qr.info,warning:Qr.warning,error:Qr.error,custom:Qr.custom,message:Qr.message,promise:Qr.promise,dismiss:Qr.dismiss,loading:Qr.loading},{getHistory:uZ});function dZ(e,{insertAt:t}={}){if(!e||typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}dZ(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999}:where([data-sonner-toaster][data-x-position="right"]){right:max(var(--offset),env(safe-area-inset-right))}:where([data-sonner-toaster][data-x-position="left"]){left:max(var(--offset),env(safe-area-inset-left))}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:max(var(--offset),env(safe-area-inset-top))}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:max(var(--offset),env(safe-area-inset-bottom))}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;background:var(--gray1);color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:0;right:0;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount, 0px));transition:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation:swipe-out .2s ease-out forwards}@keyframes swipe-out{0%{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount)));opacity:1}to{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;--mobile-offset: 16px;right:var(--mobile-offset);left:var(--mobile-offset);width:100%}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset)}[data-sonner-toaster][data-y-position=bottom]{bottom:20px}[data-sonner-toaster][data-y-position=top]{top:20px}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset);right:var(--mobile-offset);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
|
|
254
254
|
`);function bp(e){return e.label!==void 0}var fZ=3,hZ="32px",pZ=4e3,gZ=356,mZ=14,vZ=20,bZ=200;function yZ(...e){return e.filter(Boolean).join(" ")}var xZ=e=>{var t,n,r,o,i,s,a,l,c,u;let{invert:f,toast:h,unstyled:g,interacting:v,setHeights:b,visibleToasts:x,heights:w,index:_,toasts:S,expanded:R,removeToast:C,defaultRichColors:P,closeButton:A,style:k,cancelButtonStyle:D,actionButtonStyle:I,className:F="",descriptionClassName:B="",duration:K,position:Z,gap:z,loadingIcon:Q,expandByDefault:W,classNames:Y,icons:oe,closeButtonAriaLabel:$="Close toast",pauseWhenPageIsHidden:H,cn:J}=e,[N,ce]=m.useState(!1),[le,de]=m.useState(!1),[pe,ie]=m.useState(!1),[te,ae]=m.useState(!1),[ye,G]=m.useState(0),[be,_e]=m.useState(0),Pe=m.useRef(null),Te=m.useRef(null),Ue=_===0,Be=_+1<=x,Ie=h.type,Ke=h.dismissible!==!1,lt=h.className||"",It=h.descriptionClassName||"",$t=m.useMemo(()=>w.findIndex(nt=>nt.toastId===h.id)||0,[w,h.id]),Ht=m.useMemo(()=>{var nt;return(nt=h.closeButton)!=null?nt:A},[h.closeButton,A]),fe=m.useMemo(()=>h.duration||K||pZ,[h.duration,K]),Ce=m.useRef(0),Le=m.useRef(0),Ge=m.useRef(0),Ze=m.useRef(null),[Wt,Zt]=Z.split("-"),Kt=m.useMemo(()=>w.reduce((nt,ht,At)=>At>=$t?nt:nt+ht.height,0),[w,$t]),vn=iZ(),ln=h.invert||f,Lt=Ie==="loading";Le.current=m.useMemo(()=>$t*z+Kt,[$t,Kt]),m.useEffect(()=>{ce(!0)},[]),m.useLayoutEffect(()=>{if(!N)return;let nt=Te.current,ht=nt.style.height;nt.style.height="auto";let At=nt.getBoundingClientRect().height;nt.style.height=ht,_e(At),b(Xt=>Xt.find(bt=>bt.toastId===h.id)?Xt.map(bt=>bt.toastId===h.id?{...bt,height:At}:bt):[{toastId:h.id,height:At,position:h.position},...Xt])},[N,h.title,h.description,b,h.id]);let tn=m.useCallback(()=>{de(!0),G(Le.current),b(nt=>nt.filter(ht=>ht.toastId!==h.id)),setTimeout(()=>{C(h)},bZ)},[h,C,b,Le]);m.useEffect(()=>{if(h.promise&&Ie==="loading"||h.duration===1/0||h.type==="loading")return;let nt,ht=fe;return R||v||H&&vn?(()=>{if(Ge.current<Ce.current){let At=new Date().getTime()-Ce.current;ht=ht-At}Ge.current=new Date().getTime()})():ht!==1/0&&(Ce.current=new Date().getTime(),nt=setTimeout(()=>{var At;(At=h.onAutoClose)==null||At.call(h,h),tn()},ht)),()=>clearTimeout(nt)},[R,v,W,h,fe,tn,h.promise,Ie,H,vn]),m.useEffect(()=>{let nt=Te.current;if(nt){let ht=nt.getBoundingClientRect().height;return _e(ht),b(At=>[{toastId:h.id,height:ht,position:h.position},...At]),()=>b(At=>At.filter(Xt=>Xt.toastId!==h.id))}},[b,h.id]),m.useEffect(()=>{h.delete&&tn()},[tn,h.delete]);function xn(){return oe!=null&&oe.loading?m.createElement("div",{className:"sonner-loader","data-visible":Ie==="loading"},oe.loading):Q?m.createElement("div",{className:"sonner-loader","data-visible":Ie==="loading"},Q):m.createElement(eZ,{visible:Ie==="loading"})}return m.createElement("li",{"aria-live":h.important?"assertive":"polite","aria-atomic":"true",role:"status",tabIndex:0,ref:Te,className:J(F,lt,Y==null?void 0:Y.toast,(t=h==null?void 0:h.classNames)==null?void 0:t.toast,Y==null?void 0:Y.default,Y==null?void 0:Y[Ie],(n=h==null?void 0:h.classNames)==null?void 0:n[Ie]),"data-sonner-toast":"","data-rich-colors":(r=h.richColors)!=null?r:P,"data-styled":!(h.jsx||h.unstyled||g),"data-mounted":N,"data-promise":!!h.promise,"data-removed":le,"data-visible":Be,"data-y-position":Wt,"data-x-position":Zt,"data-index":_,"data-front":Ue,"data-swiping":pe,"data-dismissible":Ke,"data-type":Ie,"data-invert":ln,"data-swipe-out":te,"data-expanded":!!(R||W&&N),style:{"--index":_,"--toasts-before":_,"--z-index":S.length-_,"--offset":`${le?ye:Le.current}px`,"--initial-height":W?"auto":`${be}px`,...k,...h.style},onPointerDown:nt=>{Lt||!Ke||(Pe.current=new Date,G(Le.current),nt.target.setPointerCapture(nt.pointerId),nt.target.tagName!=="BUTTON"&&(ie(!0),Ze.current={x:nt.clientX,y:nt.clientY}))},onPointerUp:()=>{var nt,ht,At,Xt;if(te||!Ke)return;Ze.current=null;let bt=Number(((nt=Te.current)==null?void 0:nt.style.getPropertyValue("--swipe-amount").replace("px",""))||0),Rn=new Date().getTime()-((ht=Pe.current)==null?void 0:ht.getTime()),Lo=Math.abs(bt)/Rn;if(Math.abs(bt)>=vZ||Lo>.11){G(Le.current),(At=h.onDismiss)==null||At.call(h,h),tn(),ae(!0);return}(Xt=Te.current)==null||Xt.style.setProperty("--swipe-amount","0px"),ie(!1)},onPointerMove:nt=>{var ht;if(!Ze.current||!Ke)return;let At=nt.clientY-Ze.current.y,Xt=nt.clientX-Ze.current.x,bt=(Wt==="top"?Math.min:Math.max)(0,At),Rn=nt.pointerType==="touch"?10:2;Math.abs(bt)>Rn?(ht=Te.current)==null||ht.style.setProperty("--swipe-amount",`${At}px`):Math.abs(Xt)>Rn&&(Ze.current=null)}},Ht&&!h.jsx?m.createElement("button",{"aria-label":$,"data-disabled":Lt,"data-close-button":!0,onClick:Lt||!Ke?()=>{}:()=>{var nt;tn(),(nt=h.onDismiss)==null||nt.call(h,h)},className:J(Y==null?void 0:Y.closeButton,(o=h==null?void 0:h.classNames)==null?void 0:o.closeButton)},m.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},m.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),m.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))):null,h.jsx||m.isValidElement(h.title)?h.jsx||h.title:m.createElement(m.Fragment,null,Ie||h.icon||h.promise?m.createElement("div",{"data-icon":"",className:J(Y==null?void 0:Y.icon,(i=h==null?void 0:h.classNames)==null?void 0:i.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||xn():null,h.type!=="loading"?h.icon||(oe==null?void 0:oe[Ie])||JJ(Ie):null):null,m.createElement("div",{"data-content":"",className:J(Y==null?void 0:Y.content,(s=h==null?void 0:h.classNames)==null?void 0:s.content)},m.createElement("div",{"data-title":"",className:J(Y==null?void 0:Y.title,(a=h==null?void 0:h.classNames)==null?void 0:a.title)},h.title),h.description?m.createElement("div",{"data-description":"",className:J(B,It,Y==null?void 0:Y.description,(l=h==null?void 0:h.classNames)==null?void 0:l.description)},h.description):null),m.isValidElement(h.cancel)?h.cancel:h.cancel&&bp(h.cancel)?m.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||D,onClick:nt=>{var ht,At;bp(h.cancel)&&Ke&&((At=(ht=h.cancel).onClick)==null||At.call(ht,nt),tn())},className:J(Y==null?void 0:Y.cancelButton,(c=h==null?void 0:h.classNames)==null?void 0:c.cancelButton)},h.cancel.label):null,m.isValidElement(h.action)?h.action:h.action&&bp(h.action)?m.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||I,onClick:nt=>{var ht,At;bp(h.action)&&(nt.defaultPrevented||((At=(ht=h.action).onClick)==null||At.call(ht,nt),tn()))},className:J(Y==null?void 0:Y.actionButton,(u=h==null?void 0:h.classNames)==null?void 0:u.actionButton)},h.action.label):null))};function bP(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}var wZ=e=>{let{invert:t,position:n="bottom-right",hotkey:r=["altKey","KeyT"],expand:o,closeButton:i,className:s,offset:a,theme:l="light",richColors:c,duration:u,style:f,visibleToasts:h=fZ,toastOptions:g,dir:v=bP(),gap:b=mZ,loadingIcon:x,icons:w,containerAriaLabel:_="Notifications",pauseWhenPageIsHidden:S,cn:R=yZ}=e,[C,P]=m.useState([]),A=m.useMemo(()=>Array.from(new Set([n].concat(C.filter(H=>H.position).map(H=>H.position)))),[C,n]),[k,D]=m.useState([]),[I,F]=m.useState(!1),[B,K]=m.useState(!1),[Z,z]=m.useState(l!=="system"?l:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Q=m.useRef(null),W=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),Y=m.useRef(null),oe=m.useRef(!1),$=m.useCallback(H=>{var J;(J=C.find(N=>N.id===H.id))!=null&&J.delete||Qr.dismiss(H.id),P(N=>N.filter(({id:ce})=>ce!==H.id))},[C]);return m.useEffect(()=>Qr.subscribe(H=>{if(H.dismiss){P(J=>J.map(N=>N.id===H.id?{...N,delete:!0}:N));return}setTimeout(()=>{ko.flushSync(()=>{P(J=>{let N=J.findIndex(ce=>ce.id===H.id);return N!==-1?[...J.slice(0,N),{...J[N],...H},...J.slice(N+1)]:[H,...J]})})})}),[]),m.useEffect(()=>{if(l!=="system"){z(l);return}l==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?z("dark"):z("light")),typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",({matches:H})=>{z(H?"dark":"light")})},[l]),m.useEffect(()=>{C.length<=1&&F(!1)},[C]),m.useEffect(()=>{let H=J=>{var N,ce;r.every(le=>J[le]||J.code===le)&&(F(!0),(N=Q.current)==null||N.focus()),J.code==="Escape"&&(document.activeElement===Q.current||(ce=Q.current)!=null&&ce.contains(document.activeElement))&&F(!1)};return document.addEventListener("keydown",H),()=>document.removeEventListener("keydown",H)},[r]),m.useEffect(()=>{if(Q.current)return()=>{Y.current&&(Y.current.focus({preventScroll:!0}),Y.current=null,oe.current=!1)}},[Q.current]),C.length?m.createElement("section",{"aria-label":`${_} ${W}`,tabIndex:-1},A.map((H,J)=>{var N;let[ce,le]=H.split("-");return m.createElement("ol",{key:H,dir:v==="auto"?bP():v,tabIndex:-1,ref:Q,className:s,"data-sonner-toaster":!0,"data-theme":Z,"data-y-position":ce,"data-x-position":le,style:{"--front-toast-height":`${((N=k[0])==null?void 0:N.height)||0}px`,"--offset":typeof a=="number"?`${a}px`:a||hZ,"--width":`${gZ}px`,"--gap":`${b}px`,...f},onBlur:de=>{oe.current&&!de.currentTarget.contains(de.relatedTarget)&&(oe.current=!1,Y.current&&(Y.current.focus({preventScroll:!0}),Y.current=null))},onFocus:de=>{de.target instanceof HTMLElement&&de.target.dataset.dismissible==="false"||oe.current||(oe.current=!0,Y.current=de.relatedTarget)},onMouseEnter:()=>F(!0),onMouseMove:()=>F(!0),onMouseLeave:()=>{B||F(!1)},onPointerDown:de=>{de.target instanceof HTMLElement&&de.target.dataset.dismissible==="false"||K(!0)},onPointerUp:()=>K(!1)},C.filter(de=>!de.position&&J===0||de.position===H).map((de,pe)=>{var ie,te;return m.createElement(xZ,{key:de.id,icons:w,index:pe,toast:de,defaultRichColors:c,duration:(ie=g==null?void 0:g.duration)!=null?ie:u,className:g==null?void 0:g.className,descriptionClassName:g==null?void 0:g.descriptionClassName,invert:t,visibleToasts:h,closeButton:(te=g==null?void 0:g.closeButton)!=null?te:i,interacting:B,position:H,style:g==null?void 0:g.style,unstyled:g==null?void 0:g.unstyled,classNames:g==null?void 0:g.classNames,cancelButtonStyle:g==null?void 0:g.cancelButtonStyle,actionButtonStyle:g==null?void 0:g.actionButtonStyle,removeToast:$,toasts:C.filter(ae=>ae.position==de.position),heights:k.filter(ae=>ae.position==de.position),setHeights:D,expandByDefault:o,gap:b,loadingIcon:x,expanded:I,pauseWhenPageIsHidden:S,cn:R})}))})):null};function _Z(e,t){const n=ke(u=>u.selectedSheetId),r=ke(u=>u.selectedFrameId),o=ke(u=>u.isDashboardEditing),i=ke(u=>u.isVisualEditing),{addFrame:s,getSelectedFrame:a,setSelectedFrameId:l}=ke(u=>u.actions);m.useEffect(()=>{const u=h=>{if(o&&((h.metaKey||h.ctrlKey)&&h.key==="c"&&(navigator.clipboard.writeText(JSON.stringify(a())),dk.success("Card copied to clipboard")),(h.ctrlKey||h.metaKey)&&h.key==="v")){console.log("Ctrl+V has been pressed");try{navigator.clipboard.readText().then(g=>{try{const v=JSON.parse(g);if(v&&v.id){v.id=la();const b=v.activeCardId;v.cards.forEach(x=>{const w=x.id;x.id=la(),w===b&&(v.activeCardId=x.id,x.title=`${x.title} (Copy)`)}),s(n,v),l(v.id)}}catch(v){console.error("Failed to parse clipboard contents: ",v)}})}catch(g){console.error("Failed to read clipboard contents: ",g)}}},f=t==null?void 0:t.current;return f==null||f.addEventListener("keydown",u),()=>{f==null||f.removeEventListener("keydown",u)}},[o,n,a,s,t,l]),m.useEffect(()=>{r===e.id&&o&&!i&&c()},[r,e.id,o,i]);function c(){const u=t==null?void 0:t.current;u==null||u.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}}let ry;const fk="HoverCard",[hk,fye]=Zn(fk,[Ti]),z1=Ti(),[SZ,B1]=hk(fk),CZ=e=>{const{__scopeHoverCard:t,children:n,open:r,defaultOpen:o,onOpenChange:i,openDelay:s=700,closeDelay:a=300}=e,l=z1(t),c=m.useRef(0),u=m.useRef(0),f=m.useRef(!1),h=m.useRef(!1),[g=!1,v]=xr({prop:r,defaultProp:o,onChange:i}),b=m.useCallback(()=>{clearTimeout(u.current),c.current=window.setTimeout(()=>v(!0),s)},[s,v]),x=m.useCallback(()=>{clearTimeout(c.current),!f.current&&!h.current&&(u.current=window.setTimeout(()=>v(!1),a))},[a,v]),w=m.useCallback(()=>v(!1),[v]);return m.useEffect(()=>()=>{clearTimeout(c.current),clearTimeout(u.current)},[]),m.createElement(SZ,{scope:t,open:g,onOpenChange:v,onOpen:b,onClose:x,onDismiss:w,hasSelectionRef:f,isPointerDownOnContentRef:h},m.createElement(zf,l,n))},EZ="HoverCardTrigger",RZ=m.forwardRef((e,t)=>{const{__scopeHoverCard:n,...r}=e,o=B1(EZ,n),i=z1(n);return m.createElement(Bf,he({asChild:!0},i),m.createElement(Qe.a,he({"data-state":o.open?"open":"closed"},r,{ref:t,onPointerEnter:Me(e.onPointerEnter,kg(o.onOpen)),onPointerLeave:Me(e.onPointerLeave,kg(o.onClose)),onFocus:Me(e.onFocus,o.onOpen),onBlur:Me(e.onBlur,o.onClose),onTouchStart:Me(e.onTouchStart,s=>s.preventDefault())})))}),OZ="HoverCardPortal",[hye,PZ]=hk(OZ,{forceMount:void 0}),xx="HoverCardContent",TZ=m.forwardRef((e,t)=>{const n=PZ(xx,e.__scopeHoverCard),{forceMount:r=n.forceMount,...o}=e,i=B1(xx,e.__scopeHoverCard);return m.createElement(er,{present:r||i.open},m.createElement(DZ,he({"data-state":i.open?"open":"closed"},o,{onPointerEnter:Me(e.onPointerEnter,kg(i.onOpen)),onPointerLeave:Me(e.onPointerLeave,kg(i.onClose)),ref:t})))}),DZ=m.forwardRef((e,t)=>{const{__scopeHoverCard:n,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,...a}=e,l=B1(xx,n),c=z1(n),u=m.useRef(null),f=_t(t,u),[h,g]=m.useState(!1);return m.useEffect(()=>{if(h){const v=document.body;return ry=v.style.userSelect||v.style.webkitUserSelect,v.style.userSelect="none",v.style.webkitUserSelect="none",()=>{v.style.userSelect=ry,v.style.webkitUserSelect=ry}}},[h]),m.useEffect(()=>{if(u.current){const v=()=>{g(!1),l.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var b;((b=document.getSelection())===null||b===void 0?void 0:b.toString())!==""&&(l.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",v),()=>{document.removeEventListener("pointerup",v),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!1}}},[l.isPointerDownOnContentRef,l.hasSelectionRef]),m.useEffect(()=>{u.current&&$Z(u.current).forEach(b=>b.setAttribute("tabindex","-1"))}),m.createElement(Ff,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:s,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:Me(i,v=>{v.preventDefault()}),onDismiss:l.onDismiss},m.createElement(Vf,he({},c,a,{onPointerDown:Me(a.onPointerDown,v=>{v.currentTarget.contains(v.target)&&g(!0),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!0}),ref:f,style:{...a.style,userSelect:h?"text":void 0,WebkitUserSelect:h?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})))});function kg(e){return t=>t.pointerType==="touch"?void 0:e()}function $Z(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 AZ=CZ,kZ=RZ,pk=TZ,V1=AZ,H1=kZ,Mm=V.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>O.jsx(pk,{ref:o,align:t,sideOffset:n,className:Ee("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}));Mm.displayName=pk.displayName;function MZ({card:e}){const{setCardInfo:t}=Mo();return O.jsxs(V1,{openDelay:0,children:[O.jsx(H1,{children:O.jsx(JX,{className:"size-4 text-muted-foreground/40"})}),O.jsx(Mm,{align:"start",className:"w-[300px]",onMouseDown:n=>n.stopPropagation(),children:O.jsx(is,{type:"textarea",text:e.info||"",onSave:n=>t(e.id,n),children:O.jsx("p",{className:"text-sm text-muted-foreground",children:e.info||"Double-click to add info"})})})]})}const W1=V.forwardRef(({className:e,containerClassName:t,containerStyle:n,...r},o)=>O.jsx("div",{style:n,className:Ee("relative w-full overflow-auto",t),children:O.jsx("table",{ref:o,className:Ee("w-full caption-bottom text-sm",e),...r})}));W1.displayName="Table";const U1=V.forwardRef(({className:e,...t},n)=>O.jsx("thead",{ref:n,className:Ee("[&_tr]:border-b",e),...t}));U1.displayName="TableHeader";const q1=V.forwardRef(({className:e,...t},n)=>O.jsx("tbody",{ref:n,className:Ee("[&_tr:last-child]:border-0",e),...t}));q1.displayName="TableBody";const IZ=V.forwardRef(({className:e,...t},n)=>O.jsx("tfoot",{ref:n,className:Ee("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));IZ.displayName="TableFooter";const bd=V.forwardRef(({className:e,...t},n)=>O.jsx("tr",{ref:n,className:Ee("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));bd.displayName="TableRow";const G1=V.forwardRef(({className:e,...t},n)=>O.jsx("th",{ref:n,className:Ee("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));G1.displayName="TableHead";const Mg=V.forwardRef(({className:e,...t},n)=>O.jsx("td",{ref:n,className:Ee("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));Mg.displayName="TableCell";const NZ=V.forwardRef(({className:e,...t},n)=>O.jsx("caption",{ref:n,className:Ee("mt-4 text-sm text-muted-foreground",e),...t}));NZ.displayName="TableCaption";/**
|
|
255
255
|
* table-core
|
|
256
256
|
*
|
|
@@ -394,7 +394,7 @@ Check the top-level render call using <`+ue+">.")}return ee}}function ni(T,ee){{
|
|
|
394
394
|
*/var Jie=typeof document<"u"?V.useLayoutEffect:V.useEffect;function Zie(e){var t=V.useReducer(function(){return{}},{})[1],n=jg({},e,{onChange:function(s,a){a?ko.flushSync(t):t(),e.onChange==null||e.onChange(s,a)}}),r=V.useState(function(){return new Xie(n)}),o=r[0];return o.setOptions(n),V.useEffect(function(){return o._didMount()},[]),Jie(function(){return o._willUpdate()}),o}function ese(e){return Zie(jg({observeElementRect:qie,observeElementOffset:Gie,scrollToFn:Kie},e))}var tse=Object.defineProperty,nse=(e,t,n)=>t in e?tse(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Dy=(e,t,n)=>(nse(e,typeof t!="symbol"?t+"":t,n),n);let rse=class{constructor(){Dy(this,"current",this.detect()),Dy(this,"handoffState","pending"),Dy(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},cl=new rse,Fn=(e,t)=>{cl.isServer?m.useEffect(e,t):m.useLayoutEffect(e,t)};function wi(e){let t=m.useRef(e);return Fn(()=>{t.current=e},[e]),t}function x_(e,t){let[n,r]=m.useState(e),o=wi(e);return Fn(()=>r(o.current),[o,r,...t]),n}let Et=function(e){let t=wi(e);return m.useCallback((...n)=>t.current(...n),[t])};function ose(e,t,n){let[r,o]=m.useState(n),i=e!==void 0,s=m.useRef(i),a=m.useRef(!1),l=m.useRef(!1);return i&&!s.current&&!a.current?(a.current=!0,s.current=i,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!i&&s.current&&!l.current&&(l.current=!0,s.current=i,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[i?e:r,Et(c=>(i||o(c),t==null?void 0:t(c)))]}function ise(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function yl(){let e=[],t={addEventListener(n,r,o,i){return n.addEventListener(r,o,i),t.add(()=>n.removeEventListener(r,o,i))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return t.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return ise(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,o){let i=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:o}),this.add(()=>{Object.assign(n.style,{[r]:i})})},group(n){let r=yl();return n(r),this.add(()=>r.dispose())},add(n){return e.push(n),()=>{let r=e.indexOf(n);if(r>=0)for(let o of e.splice(r,1))o()}},dispose(){for(let n of e.splice(0))n()}};return t}function Yf(){let[e]=m.useState(yl);return m.useEffect(()=>()=>e.dispose(),[e]),e}function sse(){let e=typeof document>"u";return"useSyncExternalStore"in V?(t=>t.useSyncExternalStore)(V)(()=>()=>{},()=>!1,()=>!e):!1}function w_(){let e=sse(),[t,n]=V.useState(cl.isHandoffComplete);return t&&cl.isHandoffComplete===!1&&n(!1),V.useEffect(()=>{t!==!0&&n(!0)},[t]),V.useEffect(()=>cl.handoff(),[]),e?!1:t}var rT;let Kf=(rT=m.useId)!=null?rT:function(){let e=w_(),[t,n]=m.useState(e?()=>cl.nextId():null);return Fn(()=>{t===null&&n(cl.nextId())},[t]),t!=null?""+t:void 0};function Qn(e,t,...n){if(e in t){let o=t[e];return typeof o=="function"?o(...n):o}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(o=>`"${o}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Qn),r}function __(e){return cl.isServer?null:e instanceof Node?e.ownerDocument:e!=null&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}let oT=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var ase=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e))(ase||{}),lse=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(lse||{}),cse=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(cse||{}),qM=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(qM||{});function use(e,t=0){var n;return e===((n=__(e))==null?void 0:n.body)?!1:Qn(t,{0(){return e.matches(oT)},1(){let r=e;for(;r!==null;){if(r.matches(oT))return!0;r=r.parentElement}return!1}})}var dse=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(dse||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function fse(e,t=n=>n){return e.slice().sort((n,r)=>{let o=t(n),i=t(r);if(o===null||i===null)return 0;let s=o.compareDocumentPosition(i);return s&Node.DOCUMENT_POSITION_FOLLOWING?-1:s&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function hse(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function pse(){return/Android/gi.test(window.navigator.userAgent)}function GM(){return hse()||pse()}function Tp(e,t,n){let r=wi(t);m.useEffect(()=>{function o(i){r.current(i)}return document.addEventListener(e,o,n),()=>document.removeEventListener(e,o,n)},[e,n])}function gse(e,t,n){let r=wi(t);m.useEffect(()=>{function o(i){r.current(i)}return window.addEventListener(e,o,n),()=>window.removeEventListener(e,o,n)},[e,n])}function mse(e,t,n=!0){let r=m.useRef(!1);m.useEffect(()=>{requestAnimationFrame(()=>{r.current=n})},[n]);function o(s,a){if(!r.current||s.defaultPrevented)return;let l=a(s);if(l===null||!l.getRootNode().contains(l)||!l.isConnected)return;let c=function u(f){return typeof f=="function"?u(f()):Array.isArray(f)||f instanceof Set?f:[f]}(e);for(let u of c){if(u===null)continue;let f=u instanceof HTMLElement?u:u.current;if(f!=null&&f.contains(l)||s.composed&&s.composedPath().includes(f))return}return!use(l,qM.Loose)&&l.tabIndex!==-1&&s.preventDefault(),t(s,l)}let i=m.useRef(null);Tp("pointerdown",s=>{var a,l;r.current&&(i.current=((l=(a=s.composedPath)==null?void 0:a.call(s))==null?void 0:l[0])||s.target)},!0),Tp("mousedown",s=>{var a,l;r.current&&(i.current=((l=(a=s.composedPath)==null?void 0:a.call(s))==null?void 0:l[0])||s.target)},!0),Tp("click",s=>{GM()||i.current&&(o(s,()=>i.current),i.current=null)},!0),Tp("touchend",s=>o(s,()=>s.target instanceof HTMLElement?s.target:null),!0),gse("blur",s=>o(s,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function vse(...e){return m.useMemo(()=>__(...e),[...e])}function iT(e){var t;if(e.type)return e.type;let n=(t=e.as)!=null?t:"button";if(typeof n=="string"&&n.toLowerCase()==="button")return"button"}function bse(e,t){let[n,r]=m.useState(()=>iT(e));return Fn(()=>{r(iT(e))},[e.type,e.as]),Fn(()=>{n||t.current&&t.current instanceof HTMLButtonElement&&!t.current.hasAttribute("type")&&r("button")},[n,t]),n}let yse=Symbol();function Pl(...e){let t=m.useRef(e);m.useEffect(()=>{t.current=e},[e]);let n=Et(r=>{for(let o of t.current)o!=null&&(typeof o=="function"?o(r):o.current=r)});return e.every(r=>r==null||(r==null?void 0:r[yse]))?void 0:n}function sT(e){return[e.screenX,e.screenY]}function xse(){let e=m.useRef([-1,-1]);return{wasMoved(t){let n=sT(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=sT(t)}}}function wse({container:e,accept:t,walk:n,enabled:r=!0}){let o=m.useRef(t),i=m.useRef(n);m.useEffect(()=>{o.current=t,i.current=n},[t,n]),Fn(()=>{if(!e||!r)return;let s=__(e);if(!s)return;let a=o.current,l=i.current,c=Object.assign(f=>a(f),{acceptNode:a}),u=s.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,c,!1);for(;u.nextNode();)l(u.currentNode)},[e,r,o,i])}function aT(e,t){let n=m.useRef([]),r=Et(e);m.useEffect(()=>{let o=[...n.current];for(let[i,s]of t.entries())if(n.current[i]!==s){let a=r(t,o);return n.current=t,a}},[r,...t])}function Bg(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}var Vg=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Vg||{}),ta=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(ta||{});function fs({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:i=!0,name:s,mergeRefs:a}){a=a??_se;let l=YM(t,e);if(i)return Dp(l,n,r,s,a);let c=o??0;if(c&2){let{static:u=!1,...f}=l;if(u)return Dp(f,n,r,s,a)}if(c&1){let{unmount:u=!0,...f}=l;return Qn(u?0:1,{0(){return null},1(){return Dp({...f,hidden:!0,style:{display:"none"}},n,r,s,a)}})}return Dp(l,n,r,s,a)}function Dp(e,t={},n,r,o){let{as:i=n,children:s,refName:a="ref",...l}=$y(e,["unmount","static"]),c=e.ref!==void 0?{[a]:e.ref}:{},u=typeof s=="function"?s(t):s;"className"in l&&l.className&&typeof l.className=="function"&&(l.className=l.className(t));let f={};if(t){let h=!1,g=[];for(let[v,b]of Object.entries(t))typeof b=="boolean"&&(h=!0),b===!0&&g.push(v);h&&(f["data-headlessui-state"]=g.join(" "))}if(i===m.Fragment&&Object.keys(jx(l)).length>0){if(!m.isValidElement(u)||Array.isArray(u)&&u.length>1)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(l).map(b=>` - ${b}`).join(`
|
|
395
395
|
`),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(b=>` - ${b}`).join(`
|
|
396
396
|
`)].join(`
|
|
397
|
-
`));let h=u.props,g=typeof(h==null?void 0:h.className)=="function"?(...b)=>Bg(h==null?void 0:h.className(...b),l.className):Bg(h==null?void 0:h.className,l.className),v=g?{className:g}:{};return m.cloneElement(u,Object.assign({},YM(u.props,jx($y(l,["ref"]))),f,c,{ref:o(u.ref,c.ref)},v))}return m.createElement(i,Object.assign({},$y(l,["ref"]),i!==m.Fragment&&c,i!==m.Fragment&&f),u)}function _se(...e){return e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}function YM(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(n).map(r=>[r,void 0])));for(let r in n)Object.assign(t,{[r](o,...i){let s=n[r];for(let a of s){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;a(o,...i)}}});return t}function Di(e){var t;return Object.assign(m.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function jx(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function $y(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}let Sse="div";var KM=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(KM||{});function Cse(e,t){var n;let{features:r=1,...o}=e,i={ref:t,"aria-hidden":(r&2)===2?!0:(n=o["aria-hidden"])!=null?n:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return fs({ourProps:i,theirProps:o,slot:{},defaultTag:Sse,name:"Hidden"})}let Ese=Di(Cse),S_=m.createContext(null);S_.displayName="OpenClosedContext";var ro=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(ro||{});function C_(){return m.useContext(S_)}function XM({value:e,children:t}){return m.createElement(S_.Provider,{value:e},t)}function Rse(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let Ha=[];Rse(()=>{function e(t){t.target instanceof HTMLElement&&t.target!==document.body&&Ha[0]!==t.target&&(Ha.unshift(t.target),Ha=Ha.filter(n=>n!=null&&n.isConnected),Ha.splice(10))}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})});function Ose(e){let t=e.parentElement,n=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&Pse(n)?!1:r}function Pse(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}function Tse(e){throw new Error("Unexpected object: "+e)}var Nn=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(Nn||{});function lT(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),o=r??-1;switch(e.focus){case 0:{for(let i=0;i<n.length;++i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 1:{for(let i=o-1;i>=0;--i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 2:{for(let i=o+1;i<n.length;++i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 3:{for(let i=n.length-1;i>=0;--i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 4:{for(let i=0;i<n.length;++i)if(t.resolveId(n[i],i,n)===e.id)return i;return r}case 5:return null;default:Tse(e)}}function QM(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))ZM(n,JM(t,r),o);return n}function JM(e,t){return e?e+"["+t+"]":t}function ZM(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())ZM(e,JM(t,r.toString()),o);else n instanceof Date?e.push([t,n.toISOString()]):typeof n=="boolean"?e.push([t,n?"1":"0"]):typeof n=="string"?e.push([t,n]):typeof n=="number"?e.push([t,`${n}`]):n==null?e.push([t,""]):QM(n,t,e)}var Jr=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(Jr||{}),Dse=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Dse||{}),$se=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))($se||{}),Ase=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))(Ase||{}),kse=(e=>(e[e.OpenCombobox=0]="OpenCombobox",e[e.CloseCombobox=1]="CloseCombobox",e[e.GoToOption=2]="GoToOption",e[e.RegisterOption=3]="RegisterOption",e[e.UnregisterOption=4]="UnregisterOption",e[e.RegisterLabel=5]="RegisterLabel",e[e.SetActivationTrigger=6]="SetActivationTrigger",e[e.UpdateVirtualOptions=7]="UpdateVirtualOptions",e))(kse||{});function Ay(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=t(e.options.slice()),o=r.length>0&&r[0].dataRef.current.order!==null?r.sort((s,a)=>s.dataRef.current.order-a.dataRef.current.order):fse(r,s=>s.dataRef.current.domRef.current),i=n?o.indexOf(n):null;return i===-1&&(i=null),{options:o,activeOptionIndex:i}}let Mse={1(e){var t;return(t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===1?e:{...e,activeOptionIndex:null,comboboxState:1}},0(e){var t,n;if((t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===0)return e;if((n=e.dataRef.current)!=null&&n.value){let r=e.dataRef.current.calculateIndex(e.dataRef.current.value);if(r!==-1)return{...e,activeOptionIndex:r,comboboxState:0}}return{...e,comboboxState:0}},2(e,t){var n,r,o,i,s;if((n=e.dataRef.current)!=null&&n.disabled||(r=e.dataRef.current)!=null&&r.optionsRef.current&&!((o=e.dataRef.current)!=null&&o.optionsPropsRef.current.static)&&e.comboboxState===1)return e;if(e.virtual){let u=t.focus===Nn.Specific?t.idx:lT(t,{resolveItems:()=>e.virtual.options,resolveActiveIndex:()=>{var h,g;return(g=(h=e.activeOptionIndex)!=null?h:e.virtual.options.findIndex(v=>!e.virtual.disabled(v)))!=null?g:null},resolveDisabled:e.virtual.disabled,resolveId(){throw new Error("Function not implemented.")}}),f=(i=t.trigger)!=null?i:2;return e.activeOptionIndex===u&&e.activationTrigger===f?e:{...e,activeOptionIndex:u,activationTrigger:f}}let a=Ay(e);if(a.activeOptionIndex===null){let u=a.options.findIndex(f=>!f.dataRef.current.disabled);u!==-1&&(a.activeOptionIndex=u)}let l=t.focus===Nn.Specific?t.idx:lT(t,{resolveItems:()=>a.options,resolveActiveIndex:()=>a.activeOptionIndex,resolveId:u=>u.id,resolveDisabled:u=>u.dataRef.current.disabled}),c=(s=t.trigger)!=null?s:2;return e.activeOptionIndex===l&&e.activationTrigger===c?e:{...e,...a,activeOptionIndex:l,activationTrigger:c}},3:(e,t)=>{var n,r,o;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:[...e.options,t.payload]};let i=t.payload,s=Ay(e,l=>(l.push(i),l));e.activeOptionIndex===null&&(r=e.dataRef.current)!=null&&r.isSelected(t.payload.dataRef.current.value)&&(s.activeOptionIndex=s.options.indexOf(i));let a={...e,...s,activationTrigger:2};return(o=e.dataRef.current)!=null&&o.__demoMode&&e.dataRef.current.value===void 0&&(a.activeOptionIndex=0),a},4:(e,t)=>{var n;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:e.options.filter(o=>o.id!==t.id)};let r=Ay(e,o=>{let i=o.findIndex(s=>s.id===t.id);return i!==-1&&o.splice(i,1),o});return{...e,...r,activationTrigger:2}},5:(e,t)=>e.labelId===t.id?e:{...e,labelId:t.id},6:(e,t)=>e.activationTrigger===t.trigger?e:{...e,activationTrigger:t.trigger},7:(e,t)=>{var n;if(((n=e.virtual)==null?void 0:n.options)===t.options)return e;let r=e.activeOptionIndex;if(e.activeOptionIndex!==null){let o=t.options.indexOf(e.virtual.options[e.activeOptionIndex]);o!==-1?r=o:r=null}return{...e,activeOptionIndex:r,virtual:Object.assign({},e.virtual,{options:t.options})}}},E_=m.createContext(null);E_.displayName="ComboboxActionsContext";function Xf(e){let t=m.useContext(E_);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Xf),n}return t}let eI=m.createContext(null);function Ise(e){var t;let n=Tl("VirtualProvider"),[r,o]=m.useMemo(()=>{let l=n.optionsRef.current;if(!l)return[0,0];let c=window.getComputedStyle(l);return[parseFloat(c.paddingBlockStart||c.paddingTop),parseFloat(c.paddingBlockEnd||c.paddingBottom)]},[n.optionsRef.current]),i=ese({scrollPaddingStart:r,scrollPaddingEnd:o,count:n.virtual.options.length,estimateSize(){return 40},getScrollElement(){var l;return(l=n.optionsRef.current)!=null?l:null},overscan:12}),[s,a]=m.useState(0);return Fn(()=>{a(l=>l+1)},[(t=n.virtual)==null?void 0:t.options]),m.createElement(eI.Provider,{value:i},m.createElement("div",{style:{position:"relative",width:"100%",height:`${i.getTotalSize()}px`},ref:l=>{if(l){if(typeof process<"u"&&process.env.JEST_WORKER_ID!==void 0||n.activationTrigger===0)return;n.activeOptionIndex!==null&&n.virtual.options.length>n.activeOptionIndex&&i.scrollToIndex(n.activeOptionIndex)}}},i.getVirtualItems().map(l=>{var c;return m.createElement(m.Fragment,{key:l.key},m.cloneElement((c=e.children)==null?void 0:c.call(e,{option:n.virtual.options[l.index],open:n.comboboxState===0}),{key:`${s}-${l.key}`,"data-index":l.index,"aria-setsize":n.virtual.options.length,"aria-posinset":l.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${l.start}px)`,overflowAnchor:"none"}}))})))}let R_=m.createContext(null);R_.displayName="ComboboxDataContext";function Tl(e){let t=m.useContext(R_);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Tl),n}return t}function Nse(e,t){return Qn(t.type,Mse,e,t)}let Lse=m.Fragment;function Fse(e,t){let{value:n,defaultValue:r,onChange:o,form:i,name:s,by:a=null,disabled:l=!1,__demoMode:c=!1,nullable:u=!1,multiple:f=!1,immediate:h=!1,virtual:g=null,...v}=e,b=!1,x=null,[w=f?[]:void 0,_]=ose(n,o,r),[S,R]=m.useReducer(Nse,{dataRef:m.createRef(),comboboxState:c?0:1,options:[],virtual:null,activeOptionIndex:null,activationTrigger:2,labelId:null}),C=m.useRef(!1),P=m.useRef({static:!1,hold:!1}),A=m.useRef(null),k=m.useRef(null),D=m.useRef(null),I=m.useRef(null),F=Et(typeof a=="string"?(te,ae)=>{let ye=a;return(te==null?void 0:te[ye])===(ae==null?void 0:ae[ye])}:a??((te,ae)=>te===ae)),B=Et(te=>S.options.findIndex(ae=>F(ae.dataRef.current.value,te))),K=m.useCallback(te=>Qn(z.mode,{1:()=>w.some(ae=>F(ae,te)),0:()=>F(w,te)}),[w]),Z=Et(te=>S.activeOptionIndex===B(te)),z=m.useMemo(()=>({...S,immediate:b,optionsPropsRef:P,labelRef:A,inputRef:k,buttonRef:D,optionsRef:I,value:w,defaultValue:r,disabled:l,mode:f?1:0,virtual:S.virtual,get activeOptionIndex(){if(C.current&&S.activeOptionIndex===null&&S.options.length>0){let te=S.options.findIndex(ae=>!ae.dataRef.current.disabled);if(te!==-1)return te}return S.activeOptionIndex},calculateIndex:B,compare:F,isSelected:K,isActive:Z,nullable:u,__demoMode:c}),[w,r,l,f,u,c,S,x]);Fn(()=>{},[x,void 0]),Fn(()=>{S.dataRef.current=z},[z]),mse([z.buttonRef,z.inputRef,z.optionsRef],()=>le.closeCombobox(),z.comboboxState===0);let Q=m.useMemo(()=>{var te,ae,ye;return{open:z.comboboxState===0,disabled:l,activeIndex:z.activeOptionIndex,activeOption:z.activeOptionIndex===null?null:z.virtual?z.virtual.options[(te=z.activeOptionIndex)!=null?te:0]:(ye=(ae=z.options[z.activeOptionIndex])==null?void 0:ae.dataRef.current.value)!=null?ye:null,value:w}},[z,l,w]),W=Et(()=>{if(z.activeOptionIndex!==null){if(z.virtual)N(z.virtual.options[z.activeOptionIndex]);else{let{dataRef:te}=z.options[z.activeOptionIndex];N(te.current.value)}le.goToOption(Nn.Specific,z.activeOptionIndex)}}),Y=Et(()=>{R({type:0}),C.current=!0}),oe=Et(()=>{R({type:1}),C.current=!1}),$=Et((te,ae,ye)=>(C.current=!1,te===Nn.Specific?R({type:2,focus:Nn.Specific,idx:ae,trigger:ye}):R({type:2,focus:te,trigger:ye}))),H=Et((te,ae)=>(R({type:3,payload:{id:te,dataRef:ae}}),()=>{z.isActive(ae.current.value)&&(C.current=!0),R({type:4,id:te})})),J=Et(te=>(R({type:5,id:te}),()=>R({type:5,id:null}))),N=Et(te=>Qn(z.mode,{0(){return _==null?void 0:_(te)},1(){let ae=z.value.slice(),ye=ae.findIndex(G=>F(G,te));return ye===-1?ae.push(te):ae.splice(ye,1),_==null?void 0:_(ae)}})),ce=Et(te=>{R({type:6,trigger:te})}),le=m.useMemo(()=>({onChange:N,registerOption:H,registerLabel:J,goToOption:$,closeCombobox:oe,openCombobox:Y,setActivationTrigger:ce,selectActiveOption:W}),[]),de=t===null?{}:{ref:t},pe=m.useRef(null),ie=Yf();return m.useEffect(()=>{pe.current&&r!==void 0&&ie.addEventListener(pe.current,"reset",()=>{_==null||_(r)})},[pe,_]),m.createElement(E_.Provider,{value:le},m.createElement(R_.Provider,{value:z},m.createElement(XM,{value:Qn(z.comboboxState,{0:ro.Open,1:ro.Closed})},s!=null&&w!=null&&QM({[s]:w}).map(([te,ae],ye)=>m.createElement(Ese,{features:KM.Hidden,ref:ye===0?G=>{var be;pe.current=(be=G==null?void 0:G.closest("form"))!=null?be:null}:void 0,...jx({key:te,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:i,name:te,value:ae})})),fs({ourProps:de,theirProps:v,slot:Q,defaultTag:Lse,name:"Combobox"}))))}let jse="input";function zse(e,t){var n,r,o,i,s;let a=Kf(),{id:l=`headlessui-combobox-input-${a}`,onChange:c,displayValue:u,type:f="text",...h}=e,g=Tl("Combobox.Input"),v=Xf("Combobox.Input"),b=Pl(g.inputRef,t),x=vse(g.inputRef),w=m.useRef(!1),_=Yf(),S=Et(()=>{v.onChange(null),g.optionsRef.current&&(g.optionsRef.current.scrollTop=0),v.goToOption(Nn.Nothing)}),R=function(){var z;return typeof u=="function"&&g.value!==void 0?(z=u(g.value))!=null?z:"":typeof g.value=="string"?g.value:""}();aT(([z,Q],[W,Y])=>{if(w.current)return;let oe=g.inputRef.current;oe&&((Y===0&&Q===1||z!==W)&&(oe.value=z),requestAnimationFrame(()=>{if(w.current||!oe||(x==null?void 0:x.activeElement)!==oe)return;let{selectionStart:$,selectionEnd:H}=oe;Math.abs((H??0)-($??0))===0&&$===0&&oe.setSelectionRange(oe.value.length,oe.value.length)}))},[R,g.comboboxState,x]),aT(([z],[Q])=>{if(z===0&&Q===1){if(w.current)return;let W=g.inputRef.current;if(!W)return;let Y=W.value,{selectionStart:oe,selectionEnd:$,selectionDirection:H}=W;W.value="",W.value=Y,H!==null?W.setSelectionRange(oe,$,H):W.setSelectionRange(oe,$)}},[g.comboboxState]);let C=m.useRef(!1),P=Et(()=>{C.current=!0}),A=Et(()=>{_.nextFrame(()=>{C.current=!1})}),k=Et(z=>{switch(w.current=!0,z.key){case Jr.Enter:if(w.current=!1,g.comboboxState!==0||C.current)return;if(z.preventDefault(),z.stopPropagation(),g.activeOptionIndex===null){v.closeCombobox();return}v.selectActiveOption(),g.mode===0&&v.closeCombobox();break;case Jr.ArrowDown:return w.current=!1,z.preventDefault(),z.stopPropagation(),Qn(g.comboboxState,{0:()=>v.goToOption(Nn.Next),1:()=>v.openCombobox()});case Jr.ArrowUp:return w.current=!1,z.preventDefault(),z.stopPropagation(),Qn(g.comboboxState,{0:()=>v.goToOption(Nn.Previous),1:()=>{v.openCombobox(),_.nextFrame(()=>{g.value||v.goToOption(Nn.Last)})}});case Jr.Home:if(z.shiftKey)break;return w.current=!1,z.preventDefault(),z.stopPropagation(),v.goToOption(Nn.First);case Jr.PageUp:return w.current=!1,z.preventDefault(),z.stopPropagation(),v.goToOption(Nn.First);case Jr.End:if(z.shiftKey)break;return w.current=!1,z.preventDefault(),z.stopPropagation(),v.goToOption(Nn.Last);case Jr.PageDown:return w.current=!1,z.preventDefault(),z.stopPropagation(),v.goToOption(Nn.Last);case Jr.Escape:return w.current=!1,g.comboboxState!==0?void 0:(z.preventDefault(),g.optionsRef.current&&!g.optionsPropsRef.current.static&&z.stopPropagation(),g.nullable&&g.mode===0&&g.value===null&&S(),v.closeCombobox());case Jr.Tab:if(w.current=!1,g.comboboxState!==0)return;g.mode===0&&g.activationTrigger!==1&&v.selectActiveOption(),v.closeCombobox();break}}),D=Et(z=>{c==null||c(z),g.nullable&&g.mode===0&&z.target.value===""&&S(),v.openCombobox()}),I=Et(z=>{var Q,W,Y;let oe=(Q=z.relatedTarget)!=null?Q:Ha.find($=>$!==z.currentTarget);if(w.current=!1,!((W=g.optionsRef.current)!=null&&W.contains(oe))&&!((Y=g.buttonRef.current)!=null&&Y.contains(oe))&&g.comboboxState===0)return z.preventDefault(),g.mode===0&&(g.nullable&&g.value===null?S():g.activationTrigger!==1&&v.selectActiveOption()),v.closeCombobox()}),F=Et(z=>{var Q,W,Y;let oe=(Q=z.relatedTarget)!=null?Q:Ha.find($=>$!==z.currentTarget);(W=g.buttonRef.current)!=null&&W.contains(oe)||(Y=g.optionsRef.current)!=null&&Y.contains(oe)||g.disabled||g.immediate&&g.comboboxState!==0&&(v.openCombobox(),_.nextFrame(()=>{v.setActivationTrigger(1)}))}),B=x_(()=>{if(g.labelId)return[g.labelId].join(" ")},[g.labelId]),K=m.useMemo(()=>({open:g.comboboxState===0,disabled:g.disabled}),[g]),Z={ref:b,id:l,role:"combobox",type:f,"aria-controls":(n=g.optionsRef.current)==null?void 0:n.id,"aria-expanded":g.comboboxState===0,"aria-activedescendant":g.activeOptionIndex===null?void 0:g.virtual?(r=g.options.find(z=>{var Q;return!((Q=g.virtual)!=null&&Q.disabled(z.dataRef.current.value))&&g.compare(z.dataRef.current.value,g.virtual.options[g.activeOptionIndex])}))==null?void 0:r.id:(o=g.options[g.activeOptionIndex])==null?void 0:o.id,"aria-labelledby":B,"aria-autocomplete":"list",defaultValue:(s=(i=e.defaultValue)!=null?i:g.defaultValue!==void 0?u==null?void 0:u(g.defaultValue):null)!=null?s:g.defaultValue,disabled:g.disabled,onCompositionStart:P,onCompositionEnd:A,onKeyDown:k,onChange:D,onFocus:F,onBlur:I};return fs({ourProps:Z,theirProps:h,slot:K,defaultTag:jse,name:"Combobox.Input"})}let Bse="button";function Vse(e,t){var n;let r=Tl("Combobox.Button"),o=Xf("Combobox.Button"),i=Pl(r.buttonRef,t),s=Kf(),{id:a=`headlessui-combobox-button-${s}`,...l}=e,c=Yf(),u=Et(b=>{switch(b.key){case Jr.ArrowDown:return b.preventDefault(),b.stopPropagation(),r.comboboxState===1&&o.openCombobox(),c.nextFrame(()=>{var x;return(x=r.inputRef.current)==null?void 0:x.focus({preventScroll:!0})});case Jr.ArrowUp:return b.preventDefault(),b.stopPropagation(),r.comboboxState===1&&(o.openCombobox(),c.nextFrame(()=>{r.value||o.goToOption(Nn.Last)})),c.nextFrame(()=>{var x;return(x=r.inputRef.current)==null?void 0:x.focus({preventScroll:!0})});case Jr.Escape:return r.comboboxState!==0?void 0:(b.preventDefault(),r.optionsRef.current&&!r.optionsPropsRef.current.static&&b.stopPropagation(),o.closeCombobox(),c.nextFrame(()=>{var x;return(x=r.inputRef.current)==null?void 0:x.focus({preventScroll:!0})}));default:return}}),f=Et(b=>{if(Ose(b.currentTarget))return b.preventDefault();r.comboboxState===0?o.closeCombobox():(b.preventDefault(),o.openCombobox()),c.nextFrame(()=>{var x;return(x=r.inputRef.current)==null?void 0:x.focus({preventScroll:!0})})}),h=x_(()=>{if(r.labelId)return[r.labelId,a].join(" ")},[r.labelId,a]),g=m.useMemo(()=>({open:r.comboboxState===0,disabled:r.disabled,value:r.value}),[r]),v={ref:i,id:a,type:bse(e,r.buttonRef),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":(n=r.optionsRef.current)==null?void 0:n.id,"aria-expanded":r.comboboxState===0,"aria-labelledby":h,disabled:r.disabled,onClick:f,onKeyDown:u};return fs({ourProps:v,theirProps:l,slot:g,defaultTag:Bse,name:"Combobox.Button"})}let Hse="label";function Wse(e,t){let n=Kf(),{id:r=`headlessui-combobox-label-${n}`,...o}=e,i=Tl("Combobox.Label"),s=Xf("Combobox.Label"),a=Pl(i.labelRef,t);Fn(()=>s.registerLabel(r),[r]);let l=Et(()=>{var u;return(u=i.inputRef.current)==null?void 0:u.focus({preventScroll:!0})}),c=m.useMemo(()=>({open:i.comboboxState===0,disabled:i.disabled}),[i]);return fs({ourProps:{ref:a,id:r,onClick:l},theirProps:o,slot:c,defaultTag:Hse,name:"Combobox.Label"})}let Use="ul",qse=Vg.RenderStrategy|Vg.Static;function Gse(e,t){let n=Kf(),{id:r=`headlessui-combobox-options-${n}`,hold:o=!1,...i}=e,s=Tl("Combobox.Options"),a=Pl(s.optionsRef,t),l=C_(),c=l!==null?(l&ro.Open)===ro.Open:s.comboboxState===0;Fn(()=>{var g;s.optionsPropsRef.current.static=(g=e.static)!=null?g:!1},[s.optionsPropsRef,e.static]),Fn(()=>{s.optionsPropsRef.current.hold=o},[s.optionsPropsRef,o]),wse({container:s.optionsRef.current,enabled:s.comboboxState===0,accept(g){return g.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:g.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(g){g.setAttribute("role","none")}});let u=x_(()=>{var g,v;return(v=s.labelId)!=null?v:(g=s.buttonRef.current)==null?void 0:g.id},[s.labelId,s.buttonRef.current]),f=m.useMemo(()=>({open:s.comboboxState===0,option:void 0}),[s]),h={"aria-labelledby":u,role:"listbox","aria-multiselectable":s.mode===1?!0:void 0,id:r,ref:a};return s.virtual&&s.comboboxState===0&&Object.assign(i,{children:m.createElement(Ise,null,i.children)}),fs({ourProps:h,theirProps:i,slot:f,defaultTag:Use,features:qse,visible:c,name:"Combobox.Options"})}let Yse="li";function Kse(e,t){var n;let r=Kf(),{id:o=`headlessui-combobox-option-${r}`,disabled:i=!1,value:s,order:a=null,...l}=e,c=Tl("Combobox.Option"),u=Xf("Combobox.Option"),f=c.virtual?c.activeOptionIndex===c.calculateIndex(s):c.activeOptionIndex===null?!1:((n=c.options[c.activeOptionIndex])==null?void 0:n.id)===o,h=c.isSelected(s),g=m.useRef(null),v=wi({disabled:i,value:s,domRef:g,order:a}),b=m.useContext(eI),x=Pl(t,g,b?b.measureElement:null),w=Et(()=>u.onChange(s));Fn(()=>u.registerOption(o,v),[v,o]);let _=m.useRef(!(c.virtual||c.__demoMode));Fn(()=>{if(!c.virtual||!c.__demoMode)return;let I=yl();return I.requestAnimationFrame(()=>{_.current=!0}),I.dispose},[c.virtual,c.__demoMode]),Fn(()=>{if(!_.current||c.comboboxState!==0||!f||c.activationTrigger===0)return;let I=yl();return I.requestAnimationFrame(()=>{var F,B;(B=(F=g.current)==null?void 0:F.scrollIntoView)==null||B.call(F,{block:"nearest"})}),I.dispose},[g,f,c.comboboxState,c.activationTrigger,c.activeOptionIndex]);let S=Et(I=>{var F;if(i||(F=c.virtual)!=null&&F.disabled(s))return I.preventDefault();w(),GM()||requestAnimationFrame(()=>{var B;return(B=c.inputRef.current)==null?void 0:B.focus({preventScroll:!0})}),c.mode===0&&requestAnimationFrame(()=>u.closeCombobox())}),R=Et(()=>{var I;if(i||(I=c.virtual)!=null&&I.disabled(s))return u.goToOption(Nn.Nothing);let F=c.calculateIndex(s);u.goToOption(Nn.Specific,F)}),C=xse(),P=Et(I=>C.update(I)),A=Et(I=>{var F;if(!C.wasMoved(I)||i||(F=c.virtual)!=null&&F.disabled(s)||f)return;let B=c.calculateIndex(s);u.goToOption(Nn.Specific,B,0)}),k=Et(I=>{var F;C.wasMoved(I)&&(i||(F=c.virtual)!=null&&F.disabled(s)||f&&(c.optionsPropsRef.current.hold||u.goToOption(Nn.Nothing)))}),D=m.useMemo(()=>({active:f,selected:h,disabled:i}),[f,h,i]);return fs({ourProps:{id:o,ref:x,role:"option",tabIndex:i===!0?void 0:-1,"aria-disabled":i===!0?!0:void 0,"aria-selected":h,disabled:void 0,onClick:S,onFocus:R,onPointerEnter:P,onMouseEnter:P,onPointerMove:A,onMouseMove:A,onPointerLeave:k,onMouseLeave:k},theirProps:l,slot:D,defaultTag:Yse,name:"Combobox.Option"})}let Xse=Di(Fse),Qse=Di(Vse),Jse=Di(zse),Zse=Di(Wse),eae=Di(Gse),tae=Di(Kse),oc=Object.assign(Xse,{Input:Jse,Button:Qse,Label:Zse,Options:eae,Option:tae});function O_(){let e=m.useRef(!1);return Fn(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function nae(e=0){let[t,n]=m.useState(e),r=O_(),o=m.useCallback(l=>{r.current&&n(c=>c|l)},[t,r]),i=m.useCallback(l=>!!(t&l),[t]),s=m.useCallback(l=>{r.current&&n(c=>c&~l)},[n,r]),a=m.useCallback(l=>{r.current&&n(c=>c^l)},[n]);return{flags:t,addFlag:o,hasFlag:i,removeFlag:s,toggleFlag:a}}function rae(e){let t={called:!1};return(...n)=>{if(!t.called)return t.called=!0,e(...n)}}function ky(e,...t){e&&t.length>0&&e.classList.add(...t)}function My(e,...t){e&&t.length>0&&e.classList.remove(...t)}function oae(e,t){let n=yl();if(!e)return n.dispose;let{transitionDuration:r,transitionDelay:o}=getComputedStyle(e),[i,s]=[r,o].map(l=>{let[c=0]=l.split(",").filter(Boolean).map(u=>u.includes("ms")?parseFloat(u):parseFloat(u)*1e3).sort((u,f)=>f-u);return c}),a=i+s;if(a!==0){n.group(c=>{c.setTimeout(()=>{t(),c.dispose()},a),c.addEventListener(e,"transitionrun",u=>{u.target===u.currentTarget&&c.dispose()})});let l=n.addEventListener(e,"transitionend",c=>{c.target===c.currentTarget&&(t(),l())})}else t();return n.add(()=>t()),n.dispose}function iae(e,t,n,r){let o=n?"enter":"leave",i=yl(),s=r!==void 0?rae(r):()=>{};o==="enter"&&(e.removeAttribute("hidden"),e.style.display="");let a=Qn(o,{enter:()=>t.enter,leave:()=>t.leave}),l=Qn(o,{enter:()=>t.enterTo,leave:()=>t.leaveTo}),c=Qn(o,{enter:()=>t.enterFrom,leave:()=>t.leaveFrom});return My(e,...t.base,...t.enter,...t.enterTo,...t.enterFrom,...t.leave,...t.leaveFrom,...t.leaveTo,...t.entered),ky(e,...t.base,...a,...c),i.nextFrame(()=>{My(e,...t.base,...a,...c),ky(e,...t.base,...a,...l),oae(e,()=>(My(e,...t.base,...a),ky(e,...t.base,...t.entered),s()))}),i.dispose}function sae({immediate:e,container:t,direction:n,classes:r,onStart:o,onStop:i}){let s=O_(),a=Yf(),l=wi(n);Fn(()=>{e&&(l.current="enter")},[e]),Fn(()=>{let c=yl();a.add(c.dispose);let u=t.current;if(u&&l.current!=="idle"&&s.current)return c.dispose(),o.current(l.current),c.add(iae(u,r.current,l.current==="enter",()=>{c.dispose(),i.current(l.current)})),c.dispose},[n])}function Ms(e=""){return e.split(/\s+/).filter(t=>t.length>1)}let qm=m.createContext(null);qm.displayName="TransitionContext";var aae=(e=>(e.Visible="visible",e.Hidden="hidden",e))(aae||{});function lae(){let e=m.useContext(qm);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function cae(){let e=m.useContext(Gm);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let Gm=m.createContext(null);Gm.displayName="NestingContext";function Ym(e){return"children"in e?Ym(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function tI(e,t){let n=wi(e),r=m.useRef([]),o=O_(),i=Yf(),s=Et((g,v=ta.Hidden)=>{let b=r.current.findIndex(({el:x})=>x===g);b!==-1&&(Qn(v,{[ta.Unmount](){r.current.splice(b,1)},[ta.Hidden](){r.current[b].state="hidden"}}),i.microTask(()=>{var x;!Ym(r)&&o.current&&((x=n.current)==null||x.call(n))}))}),a=Et(g=>{let v=r.current.find(({el:b})=>b===g);return v?v.state!=="visible"&&(v.state="visible"):r.current.push({el:g,state:"visible"}),()=>s(g,ta.Unmount)}),l=m.useRef([]),c=m.useRef(Promise.resolve()),u=m.useRef({enter:[],leave:[],idle:[]}),f=Et((g,v,b)=>{l.current.splice(0),t&&(t.chains.current[v]=t.chains.current[v].filter(([x])=>x!==g)),t==null||t.chains.current[v].push([g,new Promise(x=>{l.current.push(x)})]),t==null||t.chains.current[v].push([g,new Promise(x=>{Promise.all(u.current[v].map(([w,_])=>_)).then(()=>x())})]),v==="enter"?c.current=c.current.then(()=>t==null?void 0:t.wait.current).then(()=>b(v)):b(v)}),h=Et((g,v,b)=>{Promise.all(u.current[v].splice(0).map(([x,w])=>w)).then(()=>{var x;(x=l.current.shift())==null||x()}).then(()=>b(v))});return m.useMemo(()=>({children:r,register:a,unregister:s,onStart:f,onStop:h,wait:c,chains:u}),[a,s,r,f,h,u,c])}function uae(){}let dae=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function cT(e){var t;let n={};for(let r of dae)n[r]=(t=e[r])!=null?t:uae;return n}function fae(e){let t=m.useRef(cT(e));return m.useEffect(()=>{t.current=cT(e)},[e]),t}let hae="div",nI=Vg.RenderStrategy;function pae(e,t){var n,r;let{beforeEnter:o,afterEnter:i,beforeLeave:s,afterLeave:a,enter:l,enterFrom:c,enterTo:u,entered:f,leave:h,leaveFrom:g,leaveTo:v,...b}=e,x=m.useRef(null),w=Pl(x,t),_=(n=b.unmount)==null||n?ta.Unmount:ta.Hidden,{show:S,appear:R,initial:C}=lae(),[P,A]=m.useState(S?"visible":"hidden"),k=cae(),{register:D,unregister:I}=k;m.useEffect(()=>D(x),[D,x]),m.useEffect(()=>{if(_===ta.Hidden&&x.current){if(S&&P!=="visible"){A("visible");return}return Qn(P,{hidden:()=>I(x),visible:()=>D(x)})}},[P,x,D,I,S,_]);let F=wi({base:Ms(b.className),enter:Ms(l),enterFrom:Ms(c),enterTo:Ms(u),entered:Ms(f),leave:Ms(h),leaveFrom:Ms(g),leaveTo:Ms(v)}),B=fae({beforeEnter:o,afterEnter:i,beforeLeave:s,afterLeave:a}),K=w_();m.useEffect(()=>{if(K&&P==="visible"&&x.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[x,P,K]);let Z=C&&!R,z=R&&S&&C,Q=!K||Z?"idle":S?"enter":"leave",W=nae(0),Y=Et(ce=>Qn(ce,{enter:()=>{W.addFlag(ro.Opening),B.current.beforeEnter()},leave:()=>{W.addFlag(ro.Closing),B.current.beforeLeave()},idle:()=>{}})),oe=Et(ce=>Qn(ce,{enter:()=>{W.removeFlag(ro.Opening),B.current.afterEnter()},leave:()=>{W.removeFlag(ro.Closing),B.current.afterLeave()},idle:()=>{}})),$=tI(()=>{A("hidden"),I(x)},k),H=m.useRef(!1);sae({immediate:z,container:x,classes:F,direction:Q,onStart:wi(ce=>{H.current=!0,$.onStart(x,ce,Y)}),onStop:wi(ce=>{H.current=!1,$.onStop(x,ce,oe),ce==="leave"&&!Ym($)&&(A("hidden"),I(x))})});let J=b,N={ref:w};return z?J={...J,className:Bg(b.className,...F.current.enter,...F.current.enterFrom)}:H.current&&(J.className=Bg(b.className,(r=x.current)==null?void 0:r.className),J.className===""&&delete J.className),m.createElement(Gm.Provider,{value:$},m.createElement(XM,{value:Qn(P,{visible:ro.Open,hidden:ro.Closed})|W.flags},fs({ourProps:N,theirProps:J,defaultTag:hae,features:nI,visible:P==="visible",name:"Transition.Child"})))}function gae(e,t){let{show:n,appear:r=!1,unmount:o=!0,...i}=e,s=m.useRef(null),a=Pl(s,t);w_();let l=C_();if(n===void 0&&l!==null&&(n=(l&ro.Open)===ro.Open),![!0,!1].includes(n))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[c,u]=m.useState(n?"visible":"hidden"),f=tI(()=>{u("hidden")}),[h,g]=m.useState(!0),v=m.useRef([n]);Fn(()=>{h!==!1&&v.current[v.current.length-1]!==n&&(v.current.push(n),g(!1))},[v,n]);let b=m.useMemo(()=>({show:n,appear:r,initial:h}),[n,r,h]);m.useEffect(()=>{if(n)u("visible");else if(!Ym(f))u("hidden");else{let S=s.current;if(!S)return;let R=S.getBoundingClientRect();R.x===0&&R.y===0&&R.width===0&&R.height===0&&u("hidden")}},[n,f]);let x={unmount:o},w=Et(()=>{var S;h&&g(!1),(S=e.beforeEnter)==null||S.call(e)}),_=Et(()=>{var S;h&&g(!1),(S=e.beforeLeave)==null||S.call(e)});return m.createElement(Gm.Provider,{value:f},m.createElement(qm.Provider,{value:b},fs({ourProps:{...x,as:m.Fragment,children:m.createElement(rI,{ref:a,...x,...i,beforeEnter:w,beforeLeave:_})},theirProps:{},defaultTag:m.Fragment,features:nI,visible:c==="visible",name:"Transition"})))}function mae(e,t){let n=m.useContext(qm)!==null,r=C_()!==null;return m.createElement(m.Fragment,null,!n&&r?m.createElement(zx,{ref:t,...e}):m.createElement(rI,{ref:t,...e}))}let zx=Di(gae),rI=Di(pae),vae=Di(mae),bae=Object.assign(zx,{Child:vae,Root:zx});function yae(e){const t=/(>=|<=|>|<|=)/,n=e.match(t);if(n){const r=n[0],[o,i]=e.split(r);return{operation:r,value:i.trim()}}else return null}function xae(e,t,n){const r=`SELECT ${n}, COUNT(*) FROM ${t} {{ filters | where }} GROUP BY ${n} ORDER BY ${n} ASC LIMIT 50`,o=`SELECT min(${n}) as min, max(${n}) as max FROM ${t} {{ filters | where }}`;return Of.includes(e)?o:r}function wae({filter:e}){const[t,n]=m.useState([]),[r,o]=m.useState(""),[i,s]=m.useState(""),a=m.useRef(null),{authToken:l}=ma(),c=ke(D=>D.filterValues),u=ke(D=>D.selectedSheetId),f=ke(D=>D.actions.addOrUpdateFilterValue),h=ke(D=>D.actions.removeFilterValue),g=R(c),{data:v,isLoading:b,isFetching:x,isError:w,refetch:_}=Tf({queryKey:["filter",e.id,e.sql,JSON.stringify(g)],queryFn:()=>Rf("https://semaphor.cloud/api/v1/query",(l==null?void 0:l.accessToken)||"",{connection_id:e.connectionId,sql:e.sql,active_filters:g}),enabled:!!e.sql&&!!e.connectionId}),S=m.useMemo(()=>{var D;return(D=v==null?void 0:v.records)==null?void 0:D.map(I=>{let F=e.column.split(".").slice(-1)[0].replace(/"/g,"");return I[F]===void 0&&(F=F.toLowerCase()),{id:I[F],value:I[F]}})},[v,e.column]);m.useEffect(()=>{if(c){const D=c.find(I=>I.filterId===e.id);if(!D){n([]);return}if(D.operation==="in"){const I=S==null?void 0:S.filter(F=>D.values.includes(F.value));I&&n(I)}else o(`${D.operation} ${D.values[0]}`)}},[v,u]),m.useEffect(()=>{if(c&&!c.find(I=>I.filterId===e.id)){n([]);return}},[c,e.id]);function R(D){return D?D.filter(I=>{const B=I.name.split(".");if(B.slice(0,B.length-1).join(".")===e.table&&I.name!==e.column)return!0}):[]}function C(D){const I=yae(D[0].toString());if(!(I!=null&&I.value)||!(I!=null&&I.operation))return;const F={filterId:e.id,connectionType:e.database==="NA"?"api":"database",valueType:fg(e),name:e.column,operation:I.operation,values:[Number(I.value)]};f(F)}function P(D){if(console.log("onComboBoxChange",D),D.length===1&&S.find(F=>F.value===D[0].value)===void 0){C(D);return}if(n(D),D.length===0){h(e.id);return}const I={filterId:e.id,connectionType:e.database==="NA"?"api":"database",name:e.column,valueType:fg(e),operation:e.operation,values:D.map(F=>F.value)};f(I)}function A(){var D;o(""),h(e.id),console.log(e.id),(D=a.current)==null||D.click()}if(b)return O.jsx("div",{children:O.jsx(im,{className:"h-8 w-full bg-foreground/10"})});if(w)return O.jsx("div",{className:"flex h-8 w-full items-center bg-muted px-2 text-sm",children:"Error"});let k=[];return Vc.includes(e.dataType)?k=S:k=i===""?S:S==null?void 0:S.filter(D=>D.value.toLowerCase().replace(/\s+/g,"").includes(i.toLowerCase().replace(/\s+/g,""))),O.jsx("div",{className:"w-full",children:O.jsx(oc,{value:t,onChange:P,multiple:!0,children:O.jsxs("div",{className:"relative",children:[O.jsxs("div",{className:"relative w-full cursor-default overflow-hidden rounded-sm border bg-background text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-background/75 focus-visible:ring-offset-2 sm:text-sm",children:[O.jsx(oc.Input,{className:"flex h-8 w-full rounded border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0 disabled:cursor-not-allowed disabled:opacity-50",displayValue:D=>D.map(F=>F.value).join(", ")||r,onChange:D=>{o(D.target.value),s(D.target.value)}}),O.jsx(oc.Button,{ref:a,className:"absolute inset-y-0 right-0 flex items-center bg-background pl-1 pr-2",children:O.jsx(gX,{className:"h-5 w-5 text-gray-400","aria-hidden":"true"})})]}),O.jsx(bae,{as:m.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",afterLeave:()=>s(""),children:O.jsxs(oc.Options,{className:"absolute z-10 mt-1 max-h-60 w-full overflow-auto rounded-sm border bg-background py-1 text-base shadow-lg ring-1 ring-black/5 focus:outline-none sm:text-sm",children:[Vc.includes(e.dataType)&&O.jsxs(oc.Option,{value:r,className:"flex items-center justify-between gap-2 px-3 py-2",children:[O.jsxs("div",{className:"flex items-center gap-2",children:[O.jsx("span",{className:"font-thin",children:"#"}),O.jsx("span",{children:r})]}),r&&O.jsx(yr,{variant:"link",className:"h-4 w-3 cursor-pointer text-foreground/50 hover:text-foreground/100",onClick:D=>{D.stopPropagation(),A()},children:"Clear"})]},"custom"),(k==null?void 0:k.length)===0&&i!==""?O.jsx("div",{className:"relative cursor-default select-none px-4 py-2 text-gray-700",children:"Nothing found."}):k==null?void 0:k.map(D=>O.jsx(oc.Option,{className:({active:I})=>`relative cursor-default select-none border-b border-muted py-2 pl-10 pr-4 ${I?"bg-muted":"text-foreground-900"}`,value:D,children:({selected:I,active:F})=>O.jsxs("div",{className:"",children:[O.jsx("span",{className:`block ${I?"font-medium":"font-normal"}`,children:typeof D.value=="boolean"?D.value?"True":"False":D.value}),I?O.jsx("span",{className:"absolute inset-y-0 left-0 flex items-center pl-3 text-foreground",children:O.jsx(PA,{className:"h-5 w-5","aria-hidden":"true"})}):null]})},D.value))]})})]})})})}const _ae=AR.WidthProvider(AR.Responsive);function Sae(){var P,A;const e=ke(k=>k.isDashboardEditing);ke(k=>k.currentBreakpoint);const t=ke(k=>k.themeStyle),n=ke(k=>k.selectedSheetId),r=(P=ke(k=>{var D,I;return(I=(D=k.dashboard)==null?void 0:D.sheets)==null?void 0:I.filter(F=>F.id===n)}))==null?void 0:P[0].layouts,o=ke(k=>k.dashboard.filters),i=ke(k=>{var D,I,F;return(F=(I=(D=k.dashboard)==null?void 0:D.sheets)==null?void 0:I.find(B=>B.id===n))==null?void 0:F.frames}),{getSelectedSheet:s,getSelectedSheetLayout:a,getSelectedSheetLayouts:l,setSheetLayout:c,setSheetLayouts:u,setCurrentBreakpoint:f,removeFilter:h,updateFilter:g,removeFilterValue:v}=ke(k=>k.actions),b=s(),x=m.useCallback(k=>{f(k)},[]),w=m.useCallback((k,D)=>{b!=null&&b.id&&u(b.id,D)},[b==null?void 0:b.id,u]);if(!n)return null;const _=(k,D)=>O.jsx(oI,{className:"after:content-none",ref:D,handleAxis:k}),S=k=>Of.includes(k.dataType)?O.jsx(Vie,{filter:k}):O.jsx(wae,{filter:k});function R(){return o==null?void 0:o.map(k=>{var D,I,F,B;return O.jsxs("div",{style:{borderRadius:(I=(D=t==null?void 0:t.chart)==null?void 0:D.options)==null?void 0:I.borderRadius,fontFamily:(B=(F=t==null?void 0:t.chart)==null?void 0:F.font)==null?void 0:B.family},className:Ee("group z-50 flex w-full flex-col rounded-md border px-3 py-2"),children:[O.jsx(is,{className:"my-1",text:k.title||k.column,onSave:K=>g({...k,title:K}),children:O.jsxs("div",{className:"group mb-1 flex grow items-center justify-between",children:[O.jsxs("div",{className:"flex grow items-center gap-2",children:[O.jsx(Wn,{className:"inline-block text-sm",children:k.title}),e&&O.jsx(Jne,{filter:k})]}),O.jsxs("div",{className:"flex items-center gap-2",children:[O.jsx("div",{onClick:()=>v(k.id),className:"invisible cursor-pointer text-xs text-muted-foreground hover:text-foreground hover:underline group-hover:visible",children:"Clear"}),e&&O.jsx(tQ,{onClick:()=>{v(k.id),h(k.id)},className:"invisible h-3 w-3 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"})]})]})}),S(k)]},k.id)})}function C(){return i==null?void 0:i.map(k=>O.jsx("div",{role:"dashboard-frame-container",className:Ee("group overflow-hidden",t==null?void 0:t.dashboardCardContainer),children:O.jsx(Kne,{frame:k})},k.id))}return O.jsx(O.Fragment,{children:O.jsxs(_ae,{margin:[10,10],isDraggable:e,resizeHandles:e?["sw","nw","ne","se","e","w"]:[],className:Ee((A=t==null?void 0:t.gridLayout)==null?void 0:A.className),layouts:r,cols:{lg:48,md:36,sm:24,xs:12,xxs:6},rowHeight:1,onBreakpointChange:x,onLayoutChange:w,resizeHandle:_,children:[R(),C()]})})}const oI=m.forwardRef(({className:e,handleAxis:t,...n},r)=>(ke(o=>o.themeStyle),O.jsx("div",{ref:r,className:Ee(`react-resizable-handle z-10 react-resizable-handle-${t} absolute border-foreground/40`,{"border-foreground/40 group-hover:border-2 group-hover:border-b-0 group-hover:border-r-0":t==="nw","border-foreground/40 group-hover:border-2 group-hover:border-b-0 group-hover:border-l-0":t==="ne","border-foreground/40 group-hover:border-2 group-hover:border-r-0 group-hover:border-t-0":t==="sw","border-foreground/40 group-hover:border-2 group-hover:border-l-0 group-hover:border-t-0":t==="se","border-foreground/40 group-hover:border-2 group-hover:border-b-0 group-hover:border-l-0 group-hover:border-t-0":t==="e","border-foreground/40 group-hover:border-2 group-hover:border-b-0 group-hover:border-r-0 group-hover:border-t-0":t==="w"},e),...n})));oI.displayName="ResizeHandle";let Cae=(e,t=21)=>(n=t)=>{let r="",o=n;for(;o--;)r+=e[Math.random()*e.length|0];return r};var cu={exports:{}};const Eae=typeof Buffer<"u",uT=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,dT=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function iI(e,t,n){n==null&&t!==null&&typeof t=="object"&&(n=t,t=void 0),Eae&&Buffer.isBuffer(e)&&(e=e.toString()),e&&e.charCodeAt(0)===65279&&(e=e.slice(1));const r=JSON.parse(e,t);if(r===null||typeof r!="object")return r;const o=n&&n.protoAction||"error",i=n&&n.constructorAction||"error";if(o==="ignore"&&i==="ignore")return r;if(o!=="ignore"&&i!=="ignore"){if(uT.test(e)===!1&&dT.test(e)===!1)return r}else if(o!=="ignore"&&i==="ignore"){if(uT.test(e)===!1)return r}else if(dT.test(e)===!1)return r;return sI(r,{protoAction:o,constructorAction:i,safe:n&&n.safe})}function sI(e,{protoAction:t="error",constructorAction:n="error",safe:r}={}){let o=[e];for(;o.length;){const i=o;o=[];for(const s of i){if(t!=="ignore"&&Object.prototype.hasOwnProperty.call(s,"__proto__")){if(r===!0)return null;if(t==="error")throw new SyntaxError("Object contains forbidden prototype property");delete s.__proto__}if(n!=="ignore"&&Object.prototype.hasOwnProperty.call(s,"constructor")&&Object.prototype.hasOwnProperty.call(s.constructor,"prototype")){if(r===!0)return null;if(n==="error")throw new SyntaxError("Object contains forbidden prototype property");delete s.constructor}for(const a in s){const l=s[a];l&&typeof l=="object"&&o.push(l)}}}return e}function P_(e,t,n){const r=Error.stackTraceLimit;Error.stackTraceLimit=0;try{return iI(e,t,n)}finally{Error.stackTraceLimit=r}}function Rae(e,t){const n=Error.stackTraceLimit;Error.stackTraceLimit=0;try{return iI(e,t,{safe:!0})}catch{return null}finally{Error.stackTraceLimit=n}}cu.exports=P_;cu.exports.default=P_;cu.exports.parse=P_;cu.exports.safeParse=Rae;cu.exports.scan=sI;var Oae=cu.exports;const fT=nu(Oae);var aI=Cae("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7);function Pae(e){const t=["ROOT"];let n=-1,r=null;function o(l,c,u){switch(l){case'"':{n=c,t.pop(),t.push(u),t.push("INSIDE_STRING");break}case"f":case"t":case"n":{n=c,r=c,t.pop(),t.push(u),t.push("INSIDE_LITERAL");break}case"-":{t.pop(),t.push(u),t.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=c,t.pop(),t.push(u),t.push("INSIDE_NUMBER");break}case"{":{n=c,t.pop(),t.push(u),t.push("INSIDE_OBJECT_START");break}case"[":{n=c,t.pop(),t.push(u),t.push("INSIDE_ARRAY_START");break}}}function i(l,c){switch(l){case",":{t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{n=c,t.pop();break}}}function s(l,c){switch(l){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=c,t.pop();break}}}for(let l=0;l<e.length;l++){const c=e[l];switch(t[t.length-1]){case"ROOT":o(c,l,"FINISH");break;case"INSIDE_OBJECT_START":{switch(c){case'"':{t.pop(),t.push("INSIDE_OBJECT_KEY");break}case"}":{n=l,t.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{switch(c){case'"':{t.pop(),t.push("INSIDE_OBJECT_KEY");break}}break}case"INSIDE_OBJECT_KEY":{switch(c){case'"':{t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY");break}}break}case"INSIDE_OBJECT_AFTER_KEY":{switch(c){case":":{t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE");break}}break}case"INSIDE_OBJECT_BEFORE_VALUE":{o(c,l,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{i(c,l);break}case"INSIDE_STRING":{switch(c){case'"':{t.pop(),n=l;break}case"\\":{t.push("INSIDE_STRING_ESCAPE");break}default:n=l}break}case"INSIDE_ARRAY_START":{switch(c){case"]":{n=l,t.pop();break}default:{n=l,o(c,l,"INSIDE_ARRAY_AFTER_VALUE");break}}break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(c){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=l,t.pop();break}default:{n=l;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{o(c,l,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{t.pop(),n=l;break}case"INSIDE_NUMBER":{switch(c){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=l;break}case"e":case"E":case"-":case".":break;case",":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(c,l),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&i(c,l);break}case"}":{t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&i(c,l);break}case"]":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(c,l);break}default:{t.pop();break}}break}case"INSIDE_LITERAL":{const f=e.substring(r,l+1);!"false".startsWith(f)&&!"true".startsWith(f)&&!"null".startsWith(f)?(t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?i(c,l):t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(c,l)):n=l;break}}}let a=e.slice(0,n+1);for(let l=t.length-1;l>=0;l--)switch(t[l]){case"INSIDE_STRING":{a+='"';break}case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":{a+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{a+="]";break}case"INSIDE_LITERAL":{const u=e.substring(r,e.length);"true".startsWith(u)?a+="true".slice(u.length):"false".startsWith(u)?a+="false".slice(u.length):"null".startsWith(u)&&(a+="null".slice(u.length))}}return a}function Tae(e){if(e!=null)try{return fT.parse(e)}catch{try{const n=Pae(e);return fT.parse(n)}catch{}}}var Wd={code:"0",name:"text",parse:e=>{if(typeof e!="string")throw new Error('"text" parts expect a string value.');return{type:"text",value:e}}},Ud={code:"1",name:"function_call",parse:e=>{if(e==null||typeof e!="object"||!("function_call"in e)||typeof e.function_call!="object"||e.function_call==null||!("name"in e.function_call)||!("arguments"in e.function_call)||typeof e.function_call.name!="string"||typeof e.function_call.arguments!="string")throw new Error('"function_call" parts expect an object with a "function_call" property.');return{type:"function_call",value:e}}},qd={code:"2",name:"data",parse:e=>{if(!Array.isArray(e))throw new Error('"data" parts expect an array value.');return{type:"data",value:e}}},Gd={code:"3",name:"error",parse:e=>{if(typeof e!="string")throw new Error('"error" parts expect a string value.');return{type:"error",value:e}}},Yd={code:"4",name:"assistant_message",parse:e=>{if(e==null||typeof e!="object"||!("id"in e)||!("role"in e)||!("content"in e)||typeof e.id!="string"||typeof e.role!="string"||e.role!=="assistant"||!Array.isArray(e.content)||!e.content.every(t=>t!=null&&typeof t=="object"&&"type"in t&&t.type==="text"&&"text"in t&&t.text!=null&&typeof t.text=="object"&&"value"in t.text&&typeof t.text.value=="string"))throw new Error('"assistant_message" parts expect an object with an "id", "role", and "content" property.');return{type:"assistant_message",value:e}}},Kd={code:"5",name:"assistant_control_data",parse:e=>{if(e==null||typeof e!="object"||!("threadId"in e)||!("messageId"in e)||typeof e.threadId!="string"||typeof e.messageId!="string")throw new Error('"assistant_control_data" parts expect an object with a "threadId" and "messageId" property.');return{type:"assistant_control_data",value:{threadId:e.threadId,messageId:e.messageId}}}},Xd={code:"6",name:"data_message",parse:e=>{if(e==null||typeof e!="object"||!("role"in e)||!("data"in e)||typeof e.role!="string"||e.role!=="data")throw new Error('"data_message" parts expect an object with a "role" and "data" property.');return{type:"data_message",value:e}}},Qd={code:"7",name:"tool_calls",parse:e=>{if(e==null||typeof e!="object"||!("tool_calls"in e)||typeof e.tool_calls!="object"||e.tool_calls==null||!Array.isArray(e.tool_calls)||e.tool_calls.some(t=>t==null||typeof t!="object"||!("id"in t)||typeof t.id!="string"||!("type"in t)||typeof t.type!="string"||!("function"in t)||t.function==null||typeof t.function!="object"||!("arguments"in t.function)||typeof t.function.name!="string"||typeof t.function.arguments!="string"))throw new Error('"tool_calls" parts expect an object with a ToolCallPayload.');return{type:"tool_calls",value:e}}},Jd={code:"8",name:"message_annotations",parse:e=>{if(!Array.isArray(e))throw new Error('"message_annotations" parts expect an array value.');return{type:"message_annotations",value:e}}},Zd={code:"9",name:"tool_call",parse:e=>{if(e==null||typeof e!="object"||!("toolCallId"in e)||typeof e.toolCallId!="string"||!("toolName"in e)||typeof e.toolName!="string"||!("args"in e)||typeof e.args!="object")throw new Error('"tool_call" parts expect an object with a "toolCallId", "toolName", and "args" property.');return{type:"tool_call",value:e}}},ef={code:"a",name:"tool_result",parse:e=>{if(e==null||typeof e!="object"||!("toolCallId"in e)||typeof e.toolCallId!="string"||!("result"in e))throw new Error('"tool_result" parts expect an object with a "toolCallId" and a "result" property.');return{type:"tool_result",value:e}}},tf={code:"b",name:"tool_call_streaming_start",parse:e=>{if(e==null||typeof e!="object"||!("toolCallId"in e)||typeof e.toolCallId!="string"||!("toolName"in e)||typeof e.toolName!="string")throw new Error('"tool_call_streaming_start" parts expect an object with a "toolCallId" and "toolName" property.');return{type:"tool_call_streaming_start",value:e}}},nf={code:"c",name:"tool_call_delta",parse:e=>{if(e==null||typeof e!="object"||!("toolCallId"in e)||typeof e.toolCallId!="string"||!("argsTextDelta"in e)||typeof e.argsTextDelta!="string")throw new Error('"tool_call_delta" parts expect an object with a "toolCallId" and "argsTextDelta" property.');return{type:"tool_call_delta",value:e}}},rf={code:"d",name:"finish_message",parse:e=>{if(e==null||typeof e!="object"||!("finishReason"in e)||typeof e.finishReason!="string"||!("usage"in e)||e.usage==null||typeof e.usage!="object"||!("promptTokens"in e.usage)||!("completionTokens"in e.usage))throw new Error('"finish_message" parts expect an object with a "finishReason" and "usage" property.');return typeof e.usage.promptTokens!="number"&&(e.usage.promptTokens=Number.NaN),typeof e.usage.completionTokens!="number"&&(e.usage.completionTokens=Number.NaN),{type:"finish_message",value:e}}},Dae=[Wd,Ud,qd,Gd,Yd,Kd,Xd,Qd,Jd,Zd,ef,tf,nf,rf],$ae={[Wd.code]:Wd,[Ud.code]:Ud,[qd.code]:qd,[Gd.code]:Gd,[Yd.code]:Yd,[Kd.code]:Kd,[Xd.code]:Xd,[Qd.code]:Qd,[Jd.code]:Jd,[Zd.code]:Zd,[ef.code]:ef,[tf.code]:tf,[nf.code]:nf,[rf.code]:rf};Wd.name+"",Wd.code,Ud.name+"",Ud.code,qd.name+"",qd.code,Gd.name+"",Gd.code,Yd.name+"",Yd.code,Kd.name+"",Kd.code,Xd.name+"",Xd.code,Qd.name+"",Qd.code,Jd.name+"",Jd.code,Zd.name+"",Zd.code,ef.name+"",ef.code,tf.name+"",tf.code,nf.name+"",nf.code,rf.name+"",rf.code;var Aae=Dae.map(e=>e.code),lI=e=>{const t=e.indexOf(":");if(t===-1)throw new Error("Failed to parse stream string. No separator found.");const n=e.slice(0,t);if(!Aae.includes(n))throw new Error(`Failed to parse stream string. Invalid code ${n}.`);const r=n,o=e.slice(t+1),i=JSON.parse(o);return $ae[r].parse(i)},kae=10;function Mae(e,t){const n=new Uint8Array(t);let r=0;for(const o of e)n.set(o,r),r+=o.length;return e.length=0,n}async function*Iae(e,{isAborted:t}={}){const n=new TextDecoder,r=[];let o=0;for(;;){const{value:i}=await e.read();if(i&&(r.push(i),o+=i.length,i[i.length-1]!==kae))continue;if(r.length===0)break;const s=Mae(r,o);o=0;const a=n.decode(s,{stream:!0}).split(`
|
|
397
|
+
`));let h=u.props,g=typeof(h==null?void 0:h.className)=="function"?(...b)=>Bg(h==null?void 0:h.className(...b),l.className):Bg(h==null?void 0:h.className,l.className),v=g?{className:g}:{};return m.cloneElement(u,Object.assign({},YM(u.props,jx($y(l,["ref"]))),f,c,{ref:o(u.ref,c.ref)},v))}return m.createElement(i,Object.assign({},$y(l,["ref"]),i!==m.Fragment&&c,i!==m.Fragment&&f),u)}function _se(...e){return e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}function YM(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(n).map(r=>[r,void 0])));for(let r in n)Object.assign(t,{[r](o,...i){let s=n[r];for(let a of s){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;a(o,...i)}}});return t}function Di(e){var t;return Object.assign(m.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function jx(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function $y(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}let Sse="div";var KM=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(KM||{});function Cse(e,t){var n;let{features:r=1,...o}=e,i={ref:t,"aria-hidden":(r&2)===2?!0:(n=o["aria-hidden"])!=null?n:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return fs({ourProps:i,theirProps:o,slot:{},defaultTag:Sse,name:"Hidden"})}let Ese=Di(Cse),S_=m.createContext(null);S_.displayName="OpenClosedContext";var ro=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(ro||{});function C_(){return m.useContext(S_)}function XM({value:e,children:t}){return m.createElement(S_.Provider,{value:e},t)}function Rse(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let Ha=[];Rse(()=>{function e(t){t.target instanceof HTMLElement&&t.target!==document.body&&Ha[0]!==t.target&&(Ha.unshift(t.target),Ha=Ha.filter(n=>n!=null&&n.isConnected),Ha.splice(10))}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})});function Ose(e){let t=e.parentElement,n=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&Pse(n)?!1:r}function Pse(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}function Tse(e){throw new Error("Unexpected object: "+e)}var Nn=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(Nn||{});function lT(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),o=r??-1;switch(e.focus){case 0:{for(let i=0;i<n.length;++i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 1:{for(let i=o-1;i>=0;--i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 2:{for(let i=o+1;i<n.length;++i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 3:{for(let i=n.length-1;i>=0;--i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 4:{for(let i=0;i<n.length;++i)if(t.resolveId(n[i],i,n)===e.id)return i;return r}case 5:return null;default:Tse(e)}}function QM(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))ZM(n,JM(t,r),o);return n}function JM(e,t){return e?e+"["+t+"]":t}function ZM(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())ZM(e,JM(t,r.toString()),o);else n instanceof Date?e.push([t,n.toISOString()]):typeof n=="boolean"?e.push([t,n?"1":"0"]):typeof n=="string"?e.push([t,n]):typeof n=="number"?e.push([t,`${n}`]):n==null?e.push([t,""]):QM(n,t,e)}var Jr=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(Jr||{}),Dse=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Dse||{}),$se=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))($se||{}),Ase=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))(Ase||{}),kse=(e=>(e[e.OpenCombobox=0]="OpenCombobox",e[e.CloseCombobox=1]="CloseCombobox",e[e.GoToOption=2]="GoToOption",e[e.RegisterOption=3]="RegisterOption",e[e.UnregisterOption=4]="UnregisterOption",e[e.RegisterLabel=5]="RegisterLabel",e[e.SetActivationTrigger=6]="SetActivationTrigger",e[e.UpdateVirtualOptions=7]="UpdateVirtualOptions",e))(kse||{});function Ay(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=t(e.options.slice()),o=r.length>0&&r[0].dataRef.current.order!==null?r.sort((s,a)=>s.dataRef.current.order-a.dataRef.current.order):fse(r,s=>s.dataRef.current.domRef.current),i=n?o.indexOf(n):null;return i===-1&&(i=null),{options:o,activeOptionIndex:i}}let Mse={1(e){var t;return(t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===1?e:{...e,activeOptionIndex:null,comboboxState:1}},0(e){var t,n;if((t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===0)return e;if((n=e.dataRef.current)!=null&&n.value){let r=e.dataRef.current.calculateIndex(e.dataRef.current.value);if(r!==-1)return{...e,activeOptionIndex:r,comboboxState:0}}return{...e,comboboxState:0}},2(e,t){var n,r,o,i,s;if((n=e.dataRef.current)!=null&&n.disabled||(r=e.dataRef.current)!=null&&r.optionsRef.current&&!((o=e.dataRef.current)!=null&&o.optionsPropsRef.current.static)&&e.comboboxState===1)return e;if(e.virtual){let u=t.focus===Nn.Specific?t.idx:lT(t,{resolveItems:()=>e.virtual.options,resolveActiveIndex:()=>{var h,g;return(g=(h=e.activeOptionIndex)!=null?h:e.virtual.options.findIndex(v=>!e.virtual.disabled(v)))!=null?g:null},resolveDisabled:e.virtual.disabled,resolveId(){throw new Error("Function not implemented.")}}),f=(i=t.trigger)!=null?i:2;return e.activeOptionIndex===u&&e.activationTrigger===f?e:{...e,activeOptionIndex:u,activationTrigger:f}}let a=Ay(e);if(a.activeOptionIndex===null){let u=a.options.findIndex(f=>!f.dataRef.current.disabled);u!==-1&&(a.activeOptionIndex=u)}let l=t.focus===Nn.Specific?t.idx:lT(t,{resolveItems:()=>a.options,resolveActiveIndex:()=>a.activeOptionIndex,resolveId:u=>u.id,resolveDisabled:u=>u.dataRef.current.disabled}),c=(s=t.trigger)!=null?s:2;return e.activeOptionIndex===l&&e.activationTrigger===c?e:{...e,...a,activeOptionIndex:l,activationTrigger:c}},3:(e,t)=>{var n,r,o;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:[...e.options,t.payload]};let i=t.payload,s=Ay(e,l=>(l.push(i),l));e.activeOptionIndex===null&&(r=e.dataRef.current)!=null&&r.isSelected(t.payload.dataRef.current.value)&&(s.activeOptionIndex=s.options.indexOf(i));let a={...e,...s,activationTrigger:2};return(o=e.dataRef.current)!=null&&o.__demoMode&&e.dataRef.current.value===void 0&&(a.activeOptionIndex=0),a},4:(e,t)=>{var n;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:e.options.filter(o=>o.id!==t.id)};let r=Ay(e,o=>{let i=o.findIndex(s=>s.id===t.id);return i!==-1&&o.splice(i,1),o});return{...e,...r,activationTrigger:2}},5:(e,t)=>e.labelId===t.id?e:{...e,labelId:t.id},6:(e,t)=>e.activationTrigger===t.trigger?e:{...e,activationTrigger:t.trigger},7:(e,t)=>{var n;if(((n=e.virtual)==null?void 0:n.options)===t.options)return e;let r=e.activeOptionIndex;if(e.activeOptionIndex!==null){let o=t.options.indexOf(e.virtual.options[e.activeOptionIndex]);o!==-1?r=o:r=null}return{...e,activeOptionIndex:r,virtual:Object.assign({},e.virtual,{options:t.options})}}},E_=m.createContext(null);E_.displayName="ComboboxActionsContext";function Xf(e){let t=m.useContext(E_);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Xf),n}return t}let eI=m.createContext(null);function Ise(e){var t;let n=Tl("VirtualProvider"),[r,o]=m.useMemo(()=>{let l=n.optionsRef.current;if(!l)return[0,0];let c=window.getComputedStyle(l);return[parseFloat(c.paddingBlockStart||c.paddingTop),parseFloat(c.paddingBlockEnd||c.paddingBottom)]},[n.optionsRef.current]),i=ese({scrollPaddingStart:r,scrollPaddingEnd:o,count:n.virtual.options.length,estimateSize(){return 40},getScrollElement(){var l;return(l=n.optionsRef.current)!=null?l:null},overscan:12}),[s,a]=m.useState(0);return Fn(()=>{a(l=>l+1)},[(t=n.virtual)==null?void 0:t.options]),m.createElement(eI.Provider,{value:i},m.createElement("div",{style:{position:"relative",width:"100%",height:`${i.getTotalSize()}px`},ref:l=>{if(l){if(typeof process<"u"&&process.env.JEST_WORKER_ID!==void 0||n.activationTrigger===0)return;n.activeOptionIndex!==null&&n.virtual.options.length>n.activeOptionIndex&&i.scrollToIndex(n.activeOptionIndex)}}},i.getVirtualItems().map(l=>{var c;return m.createElement(m.Fragment,{key:l.key},m.cloneElement((c=e.children)==null?void 0:c.call(e,{option:n.virtual.options[l.index],open:n.comboboxState===0}),{key:`${s}-${l.key}`,"data-index":l.index,"aria-setsize":n.virtual.options.length,"aria-posinset":l.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${l.start}px)`,overflowAnchor:"none"}}))})))}let R_=m.createContext(null);R_.displayName="ComboboxDataContext";function Tl(e){let t=m.useContext(R_);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Tl),n}return t}function Nse(e,t){return Qn(t.type,Mse,e,t)}let Lse=m.Fragment;function Fse(e,t){let{value:n,defaultValue:r,onChange:o,form:i,name:s,by:a=null,disabled:l=!1,__demoMode:c=!1,nullable:u=!1,multiple:f=!1,immediate:h=!1,virtual:g=null,...v}=e,b=!1,x=null,[w=f?[]:void 0,_]=ose(n,o,r),[S,R]=m.useReducer(Nse,{dataRef:m.createRef(),comboboxState:c?0:1,options:[],virtual:null,activeOptionIndex:null,activationTrigger:2,labelId:null}),C=m.useRef(!1),P=m.useRef({static:!1,hold:!1}),A=m.useRef(null),k=m.useRef(null),D=m.useRef(null),I=m.useRef(null),F=Et(typeof a=="string"?(te,ae)=>{let ye=a;return(te==null?void 0:te[ye])===(ae==null?void 0:ae[ye])}:a??((te,ae)=>te===ae)),B=Et(te=>S.options.findIndex(ae=>F(ae.dataRef.current.value,te))),K=m.useCallback(te=>Qn(z.mode,{1:()=>w.some(ae=>F(ae,te)),0:()=>F(w,te)}),[w]),Z=Et(te=>S.activeOptionIndex===B(te)),z=m.useMemo(()=>({...S,immediate:b,optionsPropsRef:P,labelRef:A,inputRef:k,buttonRef:D,optionsRef:I,value:w,defaultValue:r,disabled:l,mode:f?1:0,virtual:S.virtual,get activeOptionIndex(){if(C.current&&S.activeOptionIndex===null&&S.options.length>0){let te=S.options.findIndex(ae=>!ae.dataRef.current.disabled);if(te!==-1)return te}return S.activeOptionIndex},calculateIndex:B,compare:F,isSelected:K,isActive:Z,nullable:u,__demoMode:c}),[w,r,l,f,u,c,S,x]);Fn(()=>{},[x,void 0]),Fn(()=>{S.dataRef.current=z},[z]),mse([z.buttonRef,z.inputRef,z.optionsRef],()=>le.closeCombobox(),z.comboboxState===0);let Q=m.useMemo(()=>{var te,ae,ye;return{open:z.comboboxState===0,disabled:l,activeIndex:z.activeOptionIndex,activeOption:z.activeOptionIndex===null?null:z.virtual?z.virtual.options[(te=z.activeOptionIndex)!=null?te:0]:(ye=(ae=z.options[z.activeOptionIndex])==null?void 0:ae.dataRef.current.value)!=null?ye:null,value:w}},[z,l,w]),W=Et(()=>{if(z.activeOptionIndex!==null){if(z.virtual)N(z.virtual.options[z.activeOptionIndex]);else{let{dataRef:te}=z.options[z.activeOptionIndex];N(te.current.value)}le.goToOption(Nn.Specific,z.activeOptionIndex)}}),Y=Et(()=>{R({type:0}),C.current=!0}),oe=Et(()=>{R({type:1}),C.current=!1}),$=Et((te,ae,ye)=>(C.current=!1,te===Nn.Specific?R({type:2,focus:Nn.Specific,idx:ae,trigger:ye}):R({type:2,focus:te,trigger:ye}))),H=Et((te,ae)=>(R({type:3,payload:{id:te,dataRef:ae}}),()=>{z.isActive(ae.current.value)&&(C.current=!0),R({type:4,id:te})})),J=Et(te=>(R({type:5,id:te}),()=>R({type:5,id:null}))),N=Et(te=>Qn(z.mode,{0(){return _==null?void 0:_(te)},1(){let ae=z.value.slice(),ye=ae.findIndex(G=>F(G,te));return ye===-1?ae.push(te):ae.splice(ye,1),_==null?void 0:_(ae)}})),ce=Et(te=>{R({type:6,trigger:te})}),le=m.useMemo(()=>({onChange:N,registerOption:H,registerLabel:J,goToOption:$,closeCombobox:oe,openCombobox:Y,setActivationTrigger:ce,selectActiveOption:W}),[]),de=t===null?{}:{ref:t},pe=m.useRef(null),ie=Yf();return m.useEffect(()=>{pe.current&&r!==void 0&&ie.addEventListener(pe.current,"reset",()=>{_==null||_(r)})},[pe,_]),m.createElement(E_.Provider,{value:le},m.createElement(R_.Provider,{value:z},m.createElement(XM,{value:Qn(z.comboboxState,{0:ro.Open,1:ro.Closed})},s!=null&&w!=null&&QM({[s]:w}).map(([te,ae],ye)=>m.createElement(Ese,{features:KM.Hidden,ref:ye===0?G=>{var be;pe.current=(be=G==null?void 0:G.closest("form"))!=null?be:null}:void 0,...jx({key:te,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:i,name:te,value:ae})})),fs({ourProps:de,theirProps:v,slot:Q,defaultTag:Lse,name:"Combobox"}))))}let jse="input";function zse(e,t){var n,r,o,i,s;let a=Kf(),{id:l=`headlessui-combobox-input-${a}`,onChange:c,displayValue:u,type:f="text",...h}=e,g=Tl("Combobox.Input"),v=Xf("Combobox.Input"),b=Pl(g.inputRef,t),x=vse(g.inputRef),w=m.useRef(!1),_=Yf(),S=Et(()=>{v.onChange(null),g.optionsRef.current&&(g.optionsRef.current.scrollTop=0),v.goToOption(Nn.Nothing)}),R=function(){var z;return typeof u=="function"&&g.value!==void 0?(z=u(g.value))!=null?z:"":typeof g.value=="string"?g.value:""}();aT(([z,Q],[W,Y])=>{if(w.current)return;let oe=g.inputRef.current;oe&&((Y===0&&Q===1||z!==W)&&(oe.value=z),requestAnimationFrame(()=>{if(w.current||!oe||(x==null?void 0:x.activeElement)!==oe)return;let{selectionStart:$,selectionEnd:H}=oe;Math.abs((H??0)-($??0))===0&&$===0&&oe.setSelectionRange(oe.value.length,oe.value.length)}))},[R,g.comboboxState,x]),aT(([z],[Q])=>{if(z===0&&Q===1){if(w.current)return;let W=g.inputRef.current;if(!W)return;let Y=W.value,{selectionStart:oe,selectionEnd:$,selectionDirection:H}=W;W.value="",W.value=Y,H!==null?W.setSelectionRange(oe,$,H):W.setSelectionRange(oe,$)}},[g.comboboxState]);let C=m.useRef(!1),P=Et(()=>{C.current=!0}),A=Et(()=>{_.nextFrame(()=>{C.current=!1})}),k=Et(z=>{switch(w.current=!0,z.key){case Jr.Enter:if(w.current=!1,g.comboboxState!==0||C.current)return;if(z.preventDefault(),z.stopPropagation(),g.activeOptionIndex===null){v.closeCombobox();return}v.selectActiveOption(),g.mode===0&&v.closeCombobox();break;case Jr.ArrowDown:return w.current=!1,z.preventDefault(),z.stopPropagation(),Qn(g.comboboxState,{0:()=>v.goToOption(Nn.Next),1:()=>v.openCombobox()});case Jr.ArrowUp:return w.current=!1,z.preventDefault(),z.stopPropagation(),Qn(g.comboboxState,{0:()=>v.goToOption(Nn.Previous),1:()=>{v.openCombobox(),_.nextFrame(()=>{g.value||v.goToOption(Nn.Last)})}});case Jr.Home:if(z.shiftKey)break;return w.current=!1,z.preventDefault(),z.stopPropagation(),v.goToOption(Nn.First);case Jr.PageUp:return w.current=!1,z.preventDefault(),z.stopPropagation(),v.goToOption(Nn.First);case Jr.End:if(z.shiftKey)break;return w.current=!1,z.preventDefault(),z.stopPropagation(),v.goToOption(Nn.Last);case Jr.PageDown:return w.current=!1,z.preventDefault(),z.stopPropagation(),v.goToOption(Nn.Last);case Jr.Escape:return w.current=!1,g.comboboxState!==0?void 0:(z.preventDefault(),g.optionsRef.current&&!g.optionsPropsRef.current.static&&z.stopPropagation(),g.nullable&&g.mode===0&&g.value===null&&S(),v.closeCombobox());case Jr.Tab:if(w.current=!1,g.comboboxState!==0)return;g.mode===0&&g.activationTrigger!==1&&v.selectActiveOption(),v.closeCombobox();break}}),D=Et(z=>{c==null||c(z),g.nullable&&g.mode===0&&z.target.value===""&&S(),v.openCombobox()}),I=Et(z=>{var Q,W,Y;let oe=(Q=z.relatedTarget)!=null?Q:Ha.find($=>$!==z.currentTarget);if(w.current=!1,!((W=g.optionsRef.current)!=null&&W.contains(oe))&&!((Y=g.buttonRef.current)!=null&&Y.contains(oe))&&g.comboboxState===0)return z.preventDefault(),g.mode===0&&(g.nullable&&g.value===null?S():g.activationTrigger!==1&&v.selectActiveOption()),v.closeCombobox()}),F=Et(z=>{var Q,W,Y;let oe=(Q=z.relatedTarget)!=null?Q:Ha.find($=>$!==z.currentTarget);(W=g.buttonRef.current)!=null&&W.contains(oe)||(Y=g.optionsRef.current)!=null&&Y.contains(oe)||g.disabled||g.immediate&&g.comboboxState!==0&&(v.openCombobox(),_.nextFrame(()=>{v.setActivationTrigger(1)}))}),B=x_(()=>{if(g.labelId)return[g.labelId].join(" ")},[g.labelId]),K=m.useMemo(()=>({open:g.comboboxState===0,disabled:g.disabled}),[g]),Z={ref:b,id:l,role:"combobox",type:f,"aria-controls":(n=g.optionsRef.current)==null?void 0:n.id,"aria-expanded":g.comboboxState===0,"aria-activedescendant":g.activeOptionIndex===null?void 0:g.virtual?(r=g.options.find(z=>{var Q;return!((Q=g.virtual)!=null&&Q.disabled(z.dataRef.current.value))&&g.compare(z.dataRef.current.value,g.virtual.options[g.activeOptionIndex])}))==null?void 0:r.id:(o=g.options[g.activeOptionIndex])==null?void 0:o.id,"aria-labelledby":B,"aria-autocomplete":"list",defaultValue:(s=(i=e.defaultValue)!=null?i:g.defaultValue!==void 0?u==null?void 0:u(g.defaultValue):null)!=null?s:g.defaultValue,disabled:g.disabled,onCompositionStart:P,onCompositionEnd:A,onKeyDown:k,onChange:D,onFocus:F,onBlur:I};return fs({ourProps:Z,theirProps:h,slot:K,defaultTag:jse,name:"Combobox.Input"})}let Bse="button";function Vse(e,t){var n;let r=Tl("Combobox.Button"),o=Xf("Combobox.Button"),i=Pl(r.buttonRef,t),s=Kf(),{id:a=`headlessui-combobox-button-${s}`,...l}=e,c=Yf(),u=Et(b=>{switch(b.key){case Jr.ArrowDown:return b.preventDefault(),b.stopPropagation(),r.comboboxState===1&&o.openCombobox(),c.nextFrame(()=>{var x;return(x=r.inputRef.current)==null?void 0:x.focus({preventScroll:!0})});case Jr.ArrowUp:return b.preventDefault(),b.stopPropagation(),r.comboboxState===1&&(o.openCombobox(),c.nextFrame(()=>{r.value||o.goToOption(Nn.Last)})),c.nextFrame(()=>{var x;return(x=r.inputRef.current)==null?void 0:x.focus({preventScroll:!0})});case Jr.Escape:return r.comboboxState!==0?void 0:(b.preventDefault(),r.optionsRef.current&&!r.optionsPropsRef.current.static&&b.stopPropagation(),o.closeCombobox(),c.nextFrame(()=>{var x;return(x=r.inputRef.current)==null?void 0:x.focus({preventScroll:!0})}));default:return}}),f=Et(b=>{if(Ose(b.currentTarget))return b.preventDefault();r.comboboxState===0?o.closeCombobox():(b.preventDefault(),o.openCombobox()),c.nextFrame(()=>{var x;return(x=r.inputRef.current)==null?void 0:x.focus({preventScroll:!0})})}),h=x_(()=>{if(r.labelId)return[r.labelId,a].join(" ")},[r.labelId,a]),g=m.useMemo(()=>({open:r.comboboxState===0,disabled:r.disabled,value:r.value}),[r]),v={ref:i,id:a,type:bse(e,r.buttonRef),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":(n=r.optionsRef.current)==null?void 0:n.id,"aria-expanded":r.comboboxState===0,"aria-labelledby":h,disabled:r.disabled,onClick:f,onKeyDown:u};return fs({ourProps:v,theirProps:l,slot:g,defaultTag:Bse,name:"Combobox.Button"})}let Hse="label";function Wse(e,t){let n=Kf(),{id:r=`headlessui-combobox-label-${n}`,...o}=e,i=Tl("Combobox.Label"),s=Xf("Combobox.Label"),a=Pl(i.labelRef,t);Fn(()=>s.registerLabel(r),[r]);let l=Et(()=>{var u;return(u=i.inputRef.current)==null?void 0:u.focus({preventScroll:!0})}),c=m.useMemo(()=>({open:i.comboboxState===0,disabled:i.disabled}),[i]);return fs({ourProps:{ref:a,id:r,onClick:l},theirProps:o,slot:c,defaultTag:Hse,name:"Combobox.Label"})}let Use="ul",qse=Vg.RenderStrategy|Vg.Static;function Gse(e,t){let n=Kf(),{id:r=`headlessui-combobox-options-${n}`,hold:o=!1,...i}=e,s=Tl("Combobox.Options"),a=Pl(s.optionsRef,t),l=C_(),c=l!==null?(l&ro.Open)===ro.Open:s.comboboxState===0;Fn(()=>{var g;s.optionsPropsRef.current.static=(g=e.static)!=null?g:!1},[s.optionsPropsRef,e.static]),Fn(()=>{s.optionsPropsRef.current.hold=o},[s.optionsPropsRef,o]),wse({container:s.optionsRef.current,enabled:s.comboboxState===0,accept(g){return g.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:g.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(g){g.setAttribute("role","none")}});let u=x_(()=>{var g,v;return(v=s.labelId)!=null?v:(g=s.buttonRef.current)==null?void 0:g.id},[s.labelId,s.buttonRef.current]),f=m.useMemo(()=>({open:s.comboboxState===0,option:void 0}),[s]),h={"aria-labelledby":u,role:"listbox","aria-multiselectable":s.mode===1?!0:void 0,id:r,ref:a};return s.virtual&&s.comboboxState===0&&Object.assign(i,{children:m.createElement(Ise,null,i.children)}),fs({ourProps:h,theirProps:i,slot:f,defaultTag:Use,features:qse,visible:c,name:"Combobox.Options"})}let Yse="li";function Kse(e,t){var n;let r=Kf(),{id:o=`headlessui-combobox-option-${r}`,disabled:i=!1,value:s,order:a=null,...l}=e,c=Tl("Combobox.Option"),u=Xf("Combobox.Option"),f=c.virtual?c.activeOptionIndex===c.calculateIndex(s):c.activeOptionIndex===null?!1:((n=c.options[c.activeOptionIndex])==null?void 0:n.id)===o,h=c.isSelected(s),g=m.useRef(null),v=wi({disabled:i,value:s,domRef:g,order:a}),b=m.useContext(eI),x=Pl(t,g,b?b.measureElement:null),w=Et(()=>u.onChange(s));Fn(()=>u.registerOption(o,v),[v,o]);let _=m.useRef(!(c.virtual||c.__demoMode));Fn(()=>{if(!c.virtual||!c.__demoMode)return;let I=yl();return I.requestAnimationFrame(()=>{_.current=!0}),I.dispose},[c.virtual,c.__demoMode]),Fn(()=>{if(!_.current||c.comboboxState!==0||!f||c.activationTrigger===0)return;let I=yl();return I.requestAnimationFrame(()=>{var F,B;(B=(F=g.current)==null?void 0:F.scrollIntoView)==null||B.call(F,{block:"nearest"})}),I.dispose},[g,f,c.comboboxState,c.activationTrigger,c.activeOptionIndex]);let S=Et(I=>{var F;if(i||(F=c.virtual)!=null&&F.disabled(s))return I.preventDefault();w(),GM()||requestAnimationFrame(()=>{var B;return(B=c.inputRef.current)==null?void 0:B.focus({preventScroll:!0})}),c.mode===0&&requestAnimationFrame(()=>u.closeCombobox())}),R=Et(()=>{var I;if(i||(I=c.virtual)!=null&&I.disabled(s))return u.goToOption(Nn.Nothing);let F=c.calculateIndex(s);u.goToOption(Nn.Specific,F)}),C=xse(),P=Et(I=>C.update(I)),A=Et(I=>{var F;if(!C.wasMoved(I)||i||(F=c.virtual)!=null&&F.disabled(s)||f)return;let B=c.calculateIndex(s);u.goToOption(Nn.Specific,B,0)}),k=Et(I=>{var F;C.wasMoved(I)&&(i||(F=c.virtual)!=null&&F.disabled(s)||f&&(c.optionsPropsRef.current.hold||u.goToOption(Nn.Nothing)))}),D=m.useMemo(()=>({active:f,selected:h,disabled:i}),[f,h,i]);return fs({ourProps:{id:o,ref:x,role:"option",tabIndex:i===!0?void 0:-1,"aria-disabled":i===!0?!0:void 0,"aria-selected":h,disabled:void 0,onClick:S,onFocus:R,onPointerEnter:P,onMouseEnter:P,onPointerMove:A,onMouseMove:A,onPointerLeave:k,onMouseLeave:k},theirProps:l,slot:D,defaultTag:Yse,name:"Combobox.Option"})}let Xse=Di(Fse),Qse=Di(Vse),Jse=Di(zse),Zse=Di(Wse),eae=Di(Gse),tae=Di(Kse),oc=Object.assign(Xse,{Input:Jse,Button:Qse,Label:Zse,Options:eae,Option:tae});function O_(){let e=m.useRef(!1);return Fn(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function nae(e=0){let[t,n]=m.useState(e),r=O_(),o=m.useCallback(l=>{r.current&&n(c=>c|l)},[t,r]),i=m.useCallback(l=>!!(t&l),[t]),s=m.useCallback(l=>{r.current&&n(c=>c&~l)},[n,r]),a=m.useCallback(l=>{r.current&&n(c=>c^l)},[n]);return{flags:t,addFlag:o,hasFlag:i,removeFlag:s,toggleFlag:a}}function rae(e){let t={called:!1};return(...n)=>{if(!t.called)return t.called=!0,e(...n)}}function ky(e,...t){e&&t.length>0&&e.classList.add(...t)}function My(e,...t){e&&t.length>0&&e.classList.remove(...t)}function oae(e,t){let n=yl();if(!e)return n.dispose;let{transitionDuration:r,transitionDelay:o}=getComputedStyle(e),[i,s]=[r,o].map(l=>{let[c=0]=l.split(",").filter(Boolean).map(u=>u.includes("ms")?parseFloat(u):parseFloat(u)*1e3).sort((u,f)=>f-u);return c}),a=i+s;if(a!==0){n.group(c=>{c.setTimeout(()=>{t(),c.dispose()},a),c.addEventListener(e,"transitionrun",u=>{u.target===u.currentTarget&&c.dispose()})});let l=n.addEventListener(e,"transitionend",c=>{c.target===c.currentTarget&&(t(),l())})}else t();return n.add(()=>t()),n.dispose}function iae(e,t,n,r){let o=n?"enter":"leave",i=yl(),s=r!==void 0?rae(r):()=>{};o==="enter"&&(e.removeAttribute("hidden"),e.style.display="");let a=Qn(o,{enter:()=>t.enter,leave:()=>t.leave}),l=Qn(o,{enter:()=>t.enterTo,leave:()=>t.leaveTo}),c=Qn(o,{enter:()=>t.enterFrom,leave:()=>t.leaveFrom});return My(e,...t.base,...t.enter,...t.enterTo,...t.enterFrom,...t.leave,...t.leaveFrom,...t.leaveTo,...t.entered),ky(e,...t.base,...a,...c),i.nextFrame(()=>{My(e,...t.base,...a,...c),ky(e,...t.base,...a,...l),oae(e,()=>(My(e,...t.base,...a),ky(e,...t.base,...t.entered),s()))}),i.dispose}function sae({immediate:e,container:t,direction:n,classes:r,onStart:o,onStop:i}){let s=O_(),a=Yf(),l=wi(n);Fn(()=>{e&&(l.current="enter")},[e]),Fn(()=>{let c=yl();a.add(c.dispose);let u=t.current;if(u&&l.current!=="idle"&&s.current)return c.dispose(),o.current(l.current),c.add(iae(u,r.current,l.current==="enter",()=>{c.dispose(),i.current(l.current)})),c.dispose},[n])}function Ms(e=""){return e.split(/\s+/).filter(t=>t.length>1)}let qm=m.createContext(null);qm.displayName="TransitionContext";var aae=(e=>(e.Visible="visible",e.Hidden="hidden",e))(aae||{});function lae(){let e=m.useContext(qm);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function cae(){let e=m.useContext(Gm);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let Gm=m.createContext(null);Gm.displayName="NestingContext";function Ym(e){return"children"in e?Ym(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function tI(e,t){let n=wi(e),r=m.useRef([]),o=O_(),i=Yf(),s=Et((g,v=ta.Hidden)=>{let b=r.current.findIndex(({el:x})=>x===g);b!==-1&&(Qn(v,{[ta.Unmount](){r.current.splice(b,1)},[ta.Hidden](){r.current[b].state="hidden"}}),i.microTask(()=>{var x;!Ym(r)&&o.current&&((x=n.current)==null||x.call(n))}))}),a=Et(g=>{let v=r.current.find(({el:b})=>b===g);return v?v.state!=="visible"&&(v.state="visible"):r.current.push({el:g,state:"visible"}),()=>s(g,ta.Unmount)}),l=m.useRef([]),c=m.useRef(Promise.resolve()),u=m.useRef({enter:[],leave:[],idle:[]}),f=Et((g,v,b)=>{l.current.splice(0),t&&(t.chains.current[v]=t.chains.current[v].filter(([x])=>x!==g)),t==null||t.chains.current[v].push([g,new Promise(x=>{l.current.push(x)})]),t==null||t.chains.current[v].push([g,new Promise(x=>{Promise.all(u.current[v].map(([w,_])=>_)).then(()=>x())})]),v==="enter"?c.current=c.current.then(()=>t==null?void 0:t.wait.current).then(()=>b(v)):b(v)}),h=Et((g,v,b)=>{Promise.all(u.current[v].splice(0).map(([x,w])=>w)).then(()=>{var x;(x=l.current.shift())==null||x()}).then(()=>b(v))});return m.useMemo(()=>({children:r,register:a,unregister:s,onStart:f,onStop:h,wait:c,chains:u}),[a,s,r,f,h,u,c])}function uae(){}let dae=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function cT(e){var t;let n={};for(let r of dae)n[r]=(t=e[r])!=null?t:uae;return n}function fae(e){let t=m.useRef(cT(e));return m.useEffect(()=>{t.current=cT(e)},[e]),t}let hae="div",nI=Vg.RenderStrategy;function pae(e,t){var n,r;let{beforeEnter:o,afterEnter:i,beforeLeave:s,afterLeave:a,enter:l,enterFrom:c,enterTo:u,entered:f,leave:h,leaveFrom:g,leaveTo:v,...b}=e,x=m.useRef(null),w=Pl(x,t),_=(n=b.unmount)==null||n?ta.Unmount:ta.Hidden,{show:S,appear:R,initial:C}=lae(),[P,A]=m.useState(S?"visible":"hidden"),k=cae(),{register:D,unregister:I}=k;m.useEffect(()=>D(x),[D,x]),m.useEffect(()=>{if(_===ta.Hidden&&x.current){if(S&&P!=="visible"){A("visible");return}return Qn(P,{hidden:()=>I(x),visible:()=>D(x)})}},[P,x,D,I,S,_]);let F=wi({base:Ms(b.className),enter:Ms(l),enterFrom:Ms(c),enterTo:Ms(u),entered:Ms(f),leave:Ms(h),leaveFrom:Ms(g),leaveTo:Ms(v)}),B=fae({beforeEnter:o,afterEnter:i,beforeLeave:s,afterLeave:a}),K=w_();m.useEffect(()=>{if(K&&P==="visible"&&x.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[x,P,K]);let Z=C&&!R,z=R&&S&&C,Q=!K||Z?"idle":S?"enter":"leave",W=nae(0),Y=Et(ce=>Qn(ce,{enter:()=>{W.addFlag(ro.Opening),B.current.beforeEnter()},leave:()=>{W.addFlag(ro.Closing),B.current.beforeLeave()},idle:()=>{}})),oe=Et(ce=>Qn(ce,{enter:()=>{W.removeFlag(ro.Opening),B.current.afterEnter()},leave:()=>{W.removeFlag(ro.Closing),B.current.afterLeave()},idle:()=>{}})),$=tI(()=>{A("hidden"),I(x)},k),H=m.useRef(!1);sae({immediate:z,container:x,classes:F,direction:Q,onStart:wi(ce=>{H.current=!0,$.onStart(x,ce,Y)}),onStop:wi(ce=>{H.current=!1,$.onStop(x,ce,oe),ce==="leave"&&!Ym($)&&(A("hidden"),I(x))})});let J=b,N={ref:w};return z?J={...J,className:Bg(b.className,...F.current.enter,...F.current.enterFrom)}:H.current&&(J.className=Bg(b.className,(r=x.current)==null?void 0:r.className),J.className===""&&delete J.className),m.createElement(Gm.Provider,{value:$},m.createElement(XM,{value:Qn(P,{visible:ro.Open,hidden:ro.Closed})|W.flags},fs({ourProps:N,theirProps:J,defaultTag:hae,features:nI,visible:P==="visible",name:"Transition.Child"})))}function gae(e,t){let{show:n,appear:r=!1,unmount:o=!0,...i}=e,s=m.useRef(null),a=Pl(s,t);w_();let l=C_();if(n===void 0&&l!==null&&(n=(l&ro.Open)===ro.Open),![!0,!1].includes(n))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[c,u]=m.useState(n?"visible":"hidden"),f=tI(()=>{u("hidden")}),[h,g]=m.useState(!0),v=m.useRef([n]);Fn(()=>{h!==!1&&v.current[v.current.length-1]!==n&&(v.current.push(n),g(!1))},[v,n]);let b=m.useMemo(()=>({show:n,appear:r,initial:h}),[n,r,h]);m.useEffect(()=>{if(n)u("visible");else if(!Ym(f))u("hidden");else{let S=s.current;if(!S)return;let R=S.getBoundingClientRect();R.x===0&&R.y===0&&R.width===0&&R.height===0&&u("hidden")}},[n,f]);let x={unmount:o},w=Et(()=>{var S;h&&g(!1),(S=e.beforeEnter)==null||S.call(e)}),_=Et(()=>{var S;h&&g(!1),(S=e.beforeLeave)==null||S.call(e)});return m.createElement(Gm.Provider,{value:f},m.createElement(qm.Provider,{value:b},fs({ourProps:{...x,as:m.Fragment,children:m.createElement(rI,{ref:a,...x,...i,beforeEnter:w,beforeLeave:_})},theirProps:{},defaultTag:m.Fragment,features:nI,visible:c==="visible",name:"Transition"})))}function mae(e,t){let n=m.useContext(qm)!==null,r=C_()!==null;return m.createElement(m.Fragment,null,!n&&r?m.createElement(zx,{ref:t,...e}):m.createElement(rI,{ref:t,...e}))}let zx=Di(gae),rI=Di(pae),vae=Di(mae),bae=Object.assign(zx,{Child:vae,Root:zx});function yae(e){const t=/(>=|<=|>|<|=)/,n=e.match(t);if(n){const r=n[0],[o,i]=e.split(r);return{operation:r,value:i.trim()}}else return null}function xae(e,t,n){const r=`SELECT ${n}, COUNT(*) FROM ${t} {{ filters | where }} GROUP BY ${n} ORDER BY ${n} ASC LIMIT 50`,o=`SELECT min(${n}) as min, max(${n}) as max FROM ${t} {{ filters | where }}`;return Of.includes(e)?o:r}function wae({filter:e}){const[t,n]=m.useState([]),[r,o]=m.useState(""),[i,s]=m.useState(""),a=m.useRef(null),{authToken:l}=ma(),c=ke(D=>D.filterValues),u=ke(D=>D.selectedSheetId),f=ke(D=>D.actions.addOrUpdateFilterValue),h=ke(D=>D.actions.removeFilterValue),g=R(c),{data:v,isLoading:b,isFetching:x,isError:w,refetch:_}=Tf({queryKey:["filter",e.id,e.sql,JSON.stringify(g)],queryFn:()=>Rf("https://semaphor.cloud/api/v1/query",(l==null?void 0:l.accessToken)||"",{connection_id:e.connectionId,sql:e.sql,active_filters:g}),enabled:!!e.sql&&!!e.connectionId}),S=m.useMemo(()=>{var D;return(D=v==null?void 0:v.records)==null?void 0:D.map(I=>{let F=e.column.split(".").slice(-1)[0].replace(/"/g,"");return I[F]===void 0&&(F=F.toLowerCase()),{id:I[F],value:I[F]}})},[v,e.column]);m.useEffect(()=>{if(c){const D=c.find(I=>I.filterId===e.id);if(!D){n([]);return}if(D.operation==="in"){const I=S==null?void 0:S.filter(F=>D.values.includes(F.value));I&&n(I)}else o(`${D.operation} ${D.values[0]}`)}},[v,u]),m.useEffect(()=>{if(c&&!c.find(I=>I.filterId===e.id)){n([]);return}},[c,e.id]);function R(D){return D?D.filter(I=>{const B=I.name.split(".");if(B.slice(0,B.length-1).join(".")===e.table&&I.name!==e.column)return!0}):[]}function C(D){const I=yae(D[0].toString());if(!(I!=null&&I.value)||!(I!=null&&I.operation))return;const F={filterId:e.id,connectionType:e.database==="NA"?"api":"database",valueType:fg(e),name:e.column,operation:I.operation,values:[Number(I.value)]};f(F)}function P(D){if(console.log("onComboBoxChange",D),D.length===1&&S.find(F=>F.value===D[0].value)===void 0){C(D);return}if(n(D),D.length===0){h(e.id);return}const I={filterId:e.id,connectionType:e.database==="NA"?"api":"database",name:e.column,valueType:fg(e),operation:e.operation,values:D.map(F=>F.value)};f(I)}function A(){var D;o(""),h(e.id),console.log(e.id),(D=a.current)==null||D.click()}if(b)return O.jsx("div",{children:O.jsx(im,{className:"h-8 w-full bg-foreground/10"})});if(w)return O.jsx("div",{className:"flex h-8 w-full items-center bg-muted px-2 text-sm",children:"Error"});let k=[];return Vc.includes(e.dataType)?k=S:k=i===""?S:S==null?void 0:S.filter(D=>D.value.toLowerCase().replace(/\s+/g,"").includes(i.toLowerCase().replace(/\s+/g,""))),O.jsx("div",{className:"w-full",children:O.jsx(oc,{value:t,onChange:P,multiple:!0,children:O.jsxs("div",{className:"relative",children:[O.jsxs("div",{className:"relative w-full cursor-default overflow-hidden rounded-sm border bg-background text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-background/75 focus-visible:ring-offset-2 sm:text-sm",children:[O.jsx(oc.Input,{className:"flex h-8 w-full rounded border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0 disabled:cursor-not-allowed disabled:opacity-50",displayValue:D=>D.map(F=>F.value).join(", ")||r,onChange:D=>{o(D.target.value),s(D.target.value)}}),O.jsx(oc.Button,{ref:a,className:"absolute inset-y-0 right-0 flex items-center bg-background pl-1 pr-2",children:O.jsx(gX,{className:"h-5 w-5 text-gray-400","aria-hidden":"true"})})]}),O.jsx(bae,{as:m.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",afterLeave:()=>s(""),children:O.jsxs(oc.Options,{className:"absolute z-10 mt-1 max-h-60 w-full overflow-auto rounded-sm border bg-background py-1 text-base shadow-lg ring-1 ring-black/5 focus:outline-none sm:text-sm",children:[Vc.includes(e.dataType)&&O.jsxs(oc.Option,{value:r,className:"flex items-center justify-between gap-2 px-3 py-2",children:[O.jsxs("div",{className:"flex items-center gap-2",children:[O.jsx("span",{className:"font-thin",children:"#"}),O.jsx("span",{children:r})]}),r&&O.jsx(yr,{variant:"link",className:"h-4 w-3 cursor-pointer text-foreground/50 hover:text-foreground/100",onClick:D=>{D.stopPropagation(),A()},children:"Clear"})]},"custom"),(k==null?void 0:k.length)===0&&i!==""?O.jsx("div",{className:"relative cursor-default select-none px-4 py-2 text-gray-700",children:"Nothing found."}):k==null?void 0:k.map(D=>O.jsx(oc.Option,{className:({active:I})=>`relative cursor-default select-none border-b border-muted py-2 pl-10 pr-4 ${I?"bg-muted":"text-foreground-900"}`,value:D,children:({selected:I,active:F})=>O.jsxs("div",{className:"",children:[O.jsx("span",{className:`block ${I?"font-medium":"font-normal"}`,children:typeof D.value=="boolean"?D.value?"True":"False":D.value}),I?O.jsx("span",{className:"absolute inset-y-0 left-0 flex items-center pl-3 text-foreground",children:O.jsx(PA,{className:"h-5 w-5","aria-hidden":"true"})}):null]})},D.value))]})})]})})})}const _ae=AR.WidthProvider(AR.Responsive);function Sae(){var P,A;const e=ke(k=>k.isDashboardEditing);ke(k=>k.currentBreakpoint);const t=ke(k=>k.themeStyle),n=ke(k=>k.selectedSheetId),r=(P=ke(k=>{var D,I;return(I=(D=k.dashboard)==null?void 0:D.sheets)==null?void 0:I.filter(F=>F.id===n)}))==null?void 0:P[0].layouts,o=ke(k=>k.dashboard.filters),i=ke(k=>{var D,I,F;return(F=(I=(D=k.dashboard)==null?void 0:D.sheets)==null?void 0:I.find(B=>B.id===n))==null?void 0:F.frames}),{getSelectedSheet:s,getSelectedSheetLayout:a,getSelectedSheetLayouts:l,setSheetLayout:c,setSheetLayouts:u,setCurrentBreakpoint:f,removeFilter:h,updateFilter:g,removeFilterValue:v}=ke(k=>k.actions),b=s(),x=m.useCallback(k=>{f(k)},[]),w=m.useCallback((k,D)=>{b!=null&&b.id&&u(b.id,D)},[b==null?void 0:b.id,u]);if(!n)return null;const _=(k,D)=>O.jsx(oI,{className:"after:content-none",ref:D,handleAxis:k}),S=k=>Of.includes(k.dataType)?O.jsx(Vie,{filter:k}):O.jsx(wae,{filter:k});function R(){return o==null?void 0:o.map(k=>{var D,I,F,B;return O.jsxs("div",{style:{borderRadius:(I=(D=t==null?void 0:t.chart)==null?void 0:D.options)==null?void 0:I.borderRadius,fontFamily:(B=(F=t==null?void 0:t.chart)==null?void 0:F.font)==null?void 0:B.family},className:Ee("group z-50 flex w-full flex-col rounded-md border bg-background px-3 py-2"),children:[O.jsx(is,{className:"my-1",text:k.title||k.column,onSave:K=>g({...k,title:K}),children:O.jsxs("div",{className:"group mb-1 flex grow items-center justify-between",children:[O.jsxs("div",{className:"flex grow items-center gap-2",children:[O.jsx(Wn,{className:"inline-block text-sm",children:k.title}),e&&O.jsx(Jne,{filter:k})]}),O.jsxs("div",{className:"flex items-center gap-2",children:[O.jsx("div",{onClick:()=>v(k.id),className:"invisible cursor-pointer text-xs text-muted-foreground hover:text-foreground hover:underline group-hover:visible",children:"Clear"}),e&&O.jsx(tQ,{onClick:()=>{v(k.id),h(k.id)},className:"invisible h-3 w-3 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"})]})]})}),S(k)]},k.id)})}function C(){return i==null?void 0:i.map(k=>O.jsx("div",{role:"dashboard-frame-container",className:Ee("group overflow-hidden",t==null?void 0:t.dashboardCardContainer),children:O.jsx(Kne,{frame:k})},k.id))}return O.jsx(O.Fragment,{children:O.jsxs(_ae,{margin:[10,10],isDraggable:e,resizeHandles:e?["sw","nw","ne","se","e","w"]:[],className:Ee((A=t==null?void 0:t.gridLayout)==null?void 0:A.className),layouts:r,cols:{lg:48,md:36,sm:24,xs:12,xxs:6},rowHeight:1,onBreakpointChange:x,onLayoutChange:w,resizeHandle:_,children:[R(),C()]})})}const oI=m.forwardRef(({className:e,handleAxis:t,...n},r)=>(ke(o=>o.themeStyle),O.jsx("div",{ref:r,className:Ee(`react-resizable-handle z-10 react-resizable-handle-${t} absolute border-foreground/40`,{"border-foreground/40 group-hover:border-2 group-hover:border-b-0 group-hover:border-r-0":t==="nw","border-foreground/40 group-hover:border-2 group-hover:border-b-0 group-hover:border-l-0":t==="ne","border-foreground/40 group-hover:border-2 group-hover:border-r-0 group-hover:border-t-0":t==="sw","border-foreground/40 group-hover:border-2 group-hover:border-l-0 group-hover:border-t-0":t==="se","border-foreground/40 group-hover:border-2 group-hover:border-b-0 group-hover:border-l-0 group-hover:border-t-0":t==="e","border-foreground/40 group-hover:border-2 group-hover:border-b-0 group-hover:border-r-0 group-hover:border-t-0":t==="w"},e),...n})));oI.displayName="ResizeHandle";let Cae=(e,t=21)=>(n=t)=>{let r="",o=n;for(;o--;)r+=e[Math.random()*e.length|0];return r};var cu={exports:{}};const Eae=typeof Buffer<"u",uT=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,dT=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function iI(e,t,n){n==null&&t!==null&&typeof t=="object"&&(n=t,t=void 0),Eae&&Buffer.isBuffer(e)&&(e=e.toString()),e&&e.charCodeAt(0)===65279&&(e=e.slice(1));const r=JSON.parse(e,t);if(r===null||typeof r!="object")return r;const o=n&&n.protoAction||"error",i=n&&n.constructorAction||"error";if(o==="ignore"&&i==="ignore")return r;if(o!=="ignore"&&i!=="ignore"){if(uT.test(e)===!1&&dT.test(e)===!1)return r}else if(o!=="ignore"&&i==="ignore"){if(uT.test(e)===!1)return r}else if(dT.test(e)===!1)return r;return sI(r,{protoAction:o,constructorAction:i,safe:n&&n.safe})}function sI(e,{protoAction:t="error",constructorAction:n="error",safe:r}={}){let o=[e];for(;o.length;){const i=o;o=[];for(const s of i){if(t!=="ignore"&&Object.prototype.hasOwnProperty.call(s,"__proto__")){if(r===!0)return null;if(t==="error")throw new SyntaxError("Object contains forbidden prototype property");delete s.__proto__}if(n!=="ignore"&&Object.prototype.hasOwnProperty.call(s,"constructor")&&Object.prototype.hasOwnProperty.call(s.constructor,"prototype")){if(r===!0)return null;if(n==="error")throw new SyntaxError("Object contains forbidden prototype property");delete s.constructor}for(const a in s){const l=s[a];l&&typeof l=="object"&&o.push(l)}}}return e}function P_(e,t,n){const r=Error.stackTraceLimit;Error.stackTraceLimit=0;try{return iI(e,t,n)}finally{Error.stackTraceLimit=r}}function Rae(e,t){const n=Error.stackTraceLimit;Error.stackTraceLimit=0;try{return iI(e,t,{safe:!0})}catch{return null}finally{Error.stackTraceLimit=n}}cu.exports=P_;cu.exports.default=P_;cu.exports.parse=P_;cu.exports.safeParse=Rae;cu.exports.scan=sI;var Oae=cu.exports;const fT=nu(Oae);var aI=Cae("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7);function Pae(e){const t=["ROOT"];let n=-1,r=null;function o(l,c,u){switch(l){case'"':{n=c,t.pop(),t.push(u),t.push("INSIDE_STRING");break}case"f":case"t":case"n":{n=c,r=c,t.pop(),t.push(u),t.push("INSIDE_LITERAL");break}case"-":{t.pop(),t.push(u),t.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=c,t.pop(),t.push(u),t.push("INSIDE_NUMBER");break}case"{":{n=c,t.pop(),t.push(u),t.push("INSIDE_OBJECT_START");break}case"[":{n=c,t.pop(),t.push(u),t.push("INSIDE_ARRAY_START");break}}}function i(l,c){switch(l){case",":{t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{n=c,t.pop();break}}}function s(l,c){switch(l){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=c,t.pop();break}}}for(let l=0;l<e.length;l++){const c=e[l];switch(t[t.length-1]){case"ROOT":o(c,l,"FINISH");break;case"INSIDE_OBJECT_START":{switch(c){case'"':{t.pop(),t.push("INSIDE_OBJECT_KEY");break}case"}":{n=l,t.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{switch(c){case'"':{t.pop(),t.push("INSIDE_OBJECT_KEY");break}}break}case"INSIDE_OBJECT_KEY":{switch(c){case'"':{t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY");break}}break}case"INSIDE_OBJECT_AFTER_KEY":{switch(c){case":":{t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE");break}}break}case"INSIDE_OBJECT_BEFORE_VALUE":{o(c,l,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{i(c,l);break}case"INSIDE_STRING":{switch(c){case'"':{t.pop(),n=l;break}case"\\":{t.push("INSIDE_STRING_ESCAPE");break}default:n=l}break}case"INSIDE_ARRAY_START":{switch(c){case"]":{n=l,t.pop();break}default:{n=l,o(c,l,"INSIDE_ARRAY_AFTER_VALUE");break}}break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(c){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=l,t.pop();break}default:{n=l;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{o(c,l,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{t.pop(),n=l;break}case"INSIDE_NUMBER":{switch(c){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=l;break}case"e":case"E":case"-":case".":break;case",":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(c,l),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&i(c,l);break}case"}":{t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&i(c,l);break}case"]":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(c,l);break}default:{t.pop();break}}break}case"INSIDE_LITERAL":{const f=e.substring(r,l+1);!"false".startsWith(f)&&!"true".startsWith(f)&&!"null".startsWith(f)?(t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?i(c,l):t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(c,l)):n=l;break}}}let a=e.slice(0,n+1);for(let l=t.length-1;l>=0;l--)switch(t[l]){case"INSIDE_STRING":{a+='"';break}case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":{a+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{a+="]";break}case"INSIDE_LITERAL":{const u=e.substring(r,e.length);"true".startsWith(u)?a+="true".slice(u.length):"false".startsWith(u)?a+="false".slice(u.length):"null".startsWith(u)&&(a+="null".slice(u.length))}}return a}function Tae(e){if(e!=null)try{return fT.parse(e)}catch{try{const n=Pae(e);return fT.parse(n)}catch{}}}var Wd={code:"0",name:"text",parse:e=>{if(typeof e!="string")throw new Error('"text" parts expect a string value.');return{type:"text",value:e}}},Ud={code:"1",name:"function_call",parse:e=>{if(e==null||typeof e!="object"||!("function_call"in e)||typeof e.function_call!="object"||e.function_call==null||!("name"in e.function_call)||!("arguments"in e.function_call)||typeof e.function_call.name!="string"||typeof e.function_call.arguments!="string")throw new Error('"function_call" parts expect an object with a "function_call" property.');return{type:"function_call",value:e}}},qd={code:"2",name:"data",parse:e=>{if(!Array.isArray(e))throw new Error('"data" parts expect an array value.');return{type:"data",value:e}}},Gd={code:"3",name:"error",parse:e=>{if(typeof e!="string")throw new Error('"error" parts expect a string value.');return{type:"error",value:e}}},Yd={code:"4",name:"assistant_message",parse:e=>{if(e==null||typeof e!="object"||!("id"in e)||!("role"in e)||!("content"in e)||typeof e.id!="string"||typeof e.role!="string"||e.role!=="assistant"||!Array.isArray(e.content)||!e.content.every(t=>t!=null&&typeof t=="object"&&"type"in t&&t.type==="text"&&"text"in t&&t.text!=null&&typeof t.text=="object"&&"value"in t.text&&typeof t.text.value=="string"))throw new Error('"assistant_message" parts expect an object with an "id", "role", and "content" property.');return{type:"assistant_message",value:e}}},Kd={code:"5",name:"assistant_control_data",parse:e=>{if(e==null||typeof e!="object"||!("threadId"in e)||!("messageId"in e)||typeof e.threadId!="string"||typeof e.messageId!="string")throw new Error('"assistant_control_data" parts expect an object with a "threadId" and "messageId" property.');return{type:"assistant_control_data",value:{threadId:e.threadId,messageId:e.messageId}}}},Xd={code:"6",name:"data_message",parse:e=>{if(e==null||typeof e!="object"||!("role"in e)||!("data"in e)||typeof e.role!="string"||e.role!=="data")throw new Error('"data_message" parts expect an object with a "role" and "data" property.');return{type:"data_message",value:e}}},Qd={code:"7",name:"tool_calls",parse:e=>{if(e==null||typeof e!="object"||!("tool_calls"in e)||typeof e.tool_calls!="object"||e.tool_calls==null||!Array.isArray(e.tool_calls)||e.tool_calls.some(t=>t==null||typeof t!="object"||!("id"in t)||typeof t.id!="string"||!("type"in t)||typeof t.type!="string"||!("function"in t)||t.function==null||typeof t.function!="object"||!("arguments"in t.function)||typeof t.function.name!="string"||typeof t.function.arguments!="string"))throw new Error('"tool_calls" parts expect an object with a ToolCallPayload.');return{type:"tool_calls",value:e}}},Jd={code:"8",name:"message_annotations",parse:e=>{if(!Array.isArray(e))throw new Error('"message_annotations" parts expect an array value.');return{type:"message_annotations",value:e}}},Zd={code:"9",name:"tool_call",parse:e=>{if(e==null||typeof e!="object"||!("toolCallId"in e)||typeof e.toolCallId!="string"||!("toolName"in e)||typeof e.toolName!="string"||!("args"in e)||typeof e.args!="object")throw new Error('"tool_call" parts expect an object with a "toolCallId", "toolName", and "args" property.');return{type:"tool_call",value:e}}},ef={code:"a",name:"tool_result",parse:e=>{if(e==null||typeof e!="object"||!("toolCallId"in e)||typeof e.toolCallId!="string"||!("result"in e))throw new Error('"tool_result" parts expect an object with a "toolCallId" and a "result" property.');return{type:"tool_result",value:e}}},tf={code:"b",name:"tool_call_streaming_start",parse:e=>{if(e==null||typeof e!="object"||!("toolCallId"in e)||typeof e.toolCallId!="string"||!("toolName"in e)||typeof e.toolName!="string")throw new Error('"tool_call_streaming_start" parts expect an object with a "toolCallId" and "toolName" property.');return{type:"tool_call_streaming_start",value:e}}},nf={code:"c",name:"tool_call_delta",parse:e=>{if(e==null||typeof e!="object"||!("toolCallId"in e)||typeof e.toolCallId!="string"||!("argsTextDelta"in e)||typeof e.argsTextDelta!="string")throw new Error('"tool_call_delta" parts expect an object with a "toolCallId" and "argsTextDelta" property.');return{type:"tool_call_delta",value:e}}},rf={code:"d",name:"finish_message",parse:e=>{if(e==null||typeof e!="object"||!("finishReason"in e)||typeof e.finishReason!="string"||!("usage"in e)||e.usage==null||typeof e.usage!="object"||!("promptTokens"in e.usage)||!("completionTokens"in e.usage))throw new Error('"finish_message" parts expect an object with a "finishReason" and "usage" property.');return typeof e.usage.promptTokens!="number"&&(e.usage.promptTokens=Number.NaN),typeof e.usage.completionTokens!="number"&&(e.usage.completionTokens=Number.NaN),{type:"finish_message",value:e}}},Dae=[Wd,Ud,qd,Gd,Yd,Kd,Xd,Qd,Jd,Zd,ef,tf,nf,rf],$ae={[Wd.code]:Wd,[Ud.code]:Ud,[qd.code]:qd,[Gd.code]:Gd,[Yd.code]:Yd,[Kd.code]:Kd,[Xd.code]:Xd,[Qd.code]:Qd,[Jd.code]:Jd,[Zd.code]:Zd,[ef.code]:ef,[tf.code]:tf,[nf.code]:nf,[rf.code]:rf};Wd.name+"",Wd.code,Ud.name+"",Ud.code,qd.name+"",qd.code,Gd.name+"",Gd.code,Yd.name+"",Yd.code,Kd.name+"",Kd.code,Xd.name+"",Xd.code,Qd.name+"",Qd.code,Jd.name+"",Jd.code,Zd.name+"",Zd.code,ef.name+"",ef.code,tf.name+"",tf.code,nf.name+"",nf.code,rf.name+"",rf.code;var Aae=Dae.map(e=>e.code),lI=e=>{const t=e.indexOf(":");if(t===-1)throw new Error("Failed to parse stream string. No separator found.");const n=e.slice(0,t);if(!Aae.includes(n))throw new Error(`Failed to parse stream string. Invalid code ${n}.`);const r=n,o=e.slice(t+1),i=JSON.parse(o);return $ae[r].parse(i)},kae=10;function Mae(e,t){const n=new Uint8Array(t);let r=0;for(const o of e)n.set(o,r),r+=o.length;return e.length=0,n}async function*Iae(e,{isAborted:t}={}){const n=new TextDecoder,r=[];let o=0;for(;;){const{value:i}=await e.read();if(i&&(r.push(i),o+=i.length,i[i.length-1]!==kae))continue;if(r.length===0)break;const s=Mae(r,o);o=0;const a=n.decode(s,{stream:!0}).split(`
|
|
398
398
|
`).filter(l=>l!=="").map(lI);for(const l of a)yield l;if(t!=null&&t()){e.cancel();break}}}function $p(e,t){return!e||!t||!t.length?e:{...e,annotations:[...t]}}async function Nae({reader:e,abortControllerRef:t,update:n,onToolCall:r,onFinish:o,generateId:i=aI,getCurrentDate:s=()=>new Date}){var a;const l=s(),c={data:[]};let u;const f={};let h={completionTokens:NaN,promptTokens:NaN,totalTokens:NaN},g="unknown";for await(const{type:v,value:b}of Iae(e,{isAborted:()=>(t==null?void 0:t.current)===null})){if(v==="text"&&(c.text?c.text={...c.text,content:(c.text.content||"")+b}:c.text={id:i(),role:"assistant",content:b,createdAt:l}),v==="finish_message"){const{completionTokens:R,promptTokens:C}=b.usage;g=b.finishReason,h={completionTokens:R,promptTokens:C,totalTokens:R+C}}if(v==="tool_call_streaming_start")c.text==null&&(c.text={id:i(),role:"assistant",content:"",createdAt:l}),c.text.toolInvocations==null&&(c.text.toolInvocations=[]),f[b.toolCallId]={text:"",toolName:b.toolName,prefixMapIndex:c.text.toolInvocations.length},c.text.toolInvocations.push({state:"partial-call",toolCallId:b.toolCallId,toolName:b.toolName,args:void 0});else if(v==="tool_call_delta"){const R=f[b.toolCallId];R.text+=b.argsTextDelta,c.text.toolInvocations[R.prefixMapIndex]={state:"partial-call",toolCallId:b.toolCallId,toolName:R.toolName,args:Tae(R.text)},c.text.internalUpdateId=i()}else if(v==="tool_call"){if(f[b.toolCallId]!=null?c.text.toolInvocations[f[b.toolCallId].prefixMapIndex]={state:"call",...b}:(c.text==null&&(c.text={id:i(),role:"assistant",content:"",createdAt:l}),c.text.toolInvocations==null&&(c.text.toolInvocations=[]),c.text.toolInvocations.push({state:"call",...b})),c.text.internalUpdateId=i(),r){const R=await r({toolCall:b});R!=null&&(c.text.toolInvocations[c.text.toolInvocations.length-1]={state:"result",...b,result:R})}}else if(v==="tool_result"){const R=(a=c.text)==null?void 0:a.toolInvocations;if(R==null)throw new Error("tool_result must be preceded by a tool_call");const C=R.findIndex(P=>P.toolCallId===b.toolCallId);if(C===-1)throw new Error("tool_result must be preceded by a tool_call with the same toolCallId");R[C]={...R[C],state:"result",...b}}let x=null;v==="function_call"&&(c.function_call={id:i(),role:"assistant",content:"",function_call:b.function_call,name:b.function_call.name,createdAt:l},x=c.function_call);let w=null;v==="tool_calls"&&(c.tool_calls={id:i(),role:"assistant",content:"",tool_calls:b.tool_calls,createdAt:l},w=c.tool_calls),v==="data"&&c.data.push(...b);let _=c.text;v==="message_annotations"&&(u?u.push(...b):u=[...b],x=$p(c.function_call,u),w=$p(c.tool_calls,u),_=$p(c.text,u)),u!=null&&u.length&&["text","function_call","tool_calls"].forEach(C=>{c[C]&&(c[C].annotations=[...u])});const S=[x,w,_].filter(Boolean).map(R=>({...$p(R,u)}));n(S,[...c.data])}return o==null||o({prefixMap:c,finishReason:g,usage:h}),{messages:[c.text,c.function_call,c.tool_calls].filter(Boolean),data:c.data}}var Lae=()=>fetch;async function Fae({api:e,body:t,streamProtocol:n="data",credentials:r,headers:o,abortController:i,restoreMessagesOnFailure:s,onResponse:a,onUpdate:l,onFinish:c,onToolCall:u,generateId:f,fetch:h=Lae()}){var g,v;const b=await h(e,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json",...o},signal:(g=i==null?void 0:i())==null?void 0:g.signal,credentials:r}).catch(w=>{throw s(),w});if(a)try{await a(b)}catch(w){throw w}if(!b.ok)throw s(),new Error((v=await b.text())!=null?v:"Failed to fetch the chat response.");if(!b.body)throw new Error("The response body is empty.");const x=b.body.getReader();switch(n){case"text":{const w=jae(),_={id:f(),createdAt:new Date,role:"assistant",content:""};for(;;){const{done:S,value:R}=await x.read();if(S)break;if(_.content+=w(R),l([{..._}],[]),(i==null?void 0:i())===null){x.cancel();break}}return c==null||c(_,{usage:{completionTokens:NaN,promptTokens:NaN,totalTokens:NaN},finishReason:"unknown"}),{messages:[_],data:[]}}case"data":return await Nae({reader:x,abortControllerRef:i!=null?{current:i()}:void 0,update:l,onToolCall:u,onFinish({prefixMap:w,finishReason:_,usage:S}){c&&w.text!=null&&c(w.text,{usage:S,finishReason:_})},generateId:f});default:{const w=n;throw new Error(`Unknown stream protocol: ${w}`)}}}function jae(e){const t=new TextDecoder;return e?function(n){return t.decode(n,{stream:!0}).split(`
|
|
399
399
|
`).filter(o=>o!=="").map(lI).filter(Boolean)}:function(n){return n?t.decode(n,{stream:!0}):""}}async function zae({getStreamedResponse:e,experimental_onFunctionCall:t,experimental_onToolCall:n,updateChatRequest:r,getCurrentMessages:o}){for(;;){const i=await e();if("messages"in i){let s=!1;for(const a of i.messages)if(!((a.function_call===void 0||typeof a.function_call=="string")&&(a.tool_calls===void 0||typeof a.tool_calls=="string"))){if(s=!0,t){const l=a.function_call;if(typeof l!="object"){console.warn("experimental_onFunctionCall should not be defined when using tools");continue}const c=await t(o(),l);if(c===void 0){s=!1;break}r(c)}if(n){const l=a.tool_calls;if(!Array.isArray(l)||l.some(u=>typeof u!="object")){console.warn("experimental_onToolCall should not be defined when using tools");continue}const c=await n(o(),l);if(c===void 0){s=!1;break}r(c)}}if(!s)break}else{let s=function(l){for(const c of l.messages){if(c.tool_calls!==void 0)for(const u of c.tool_calls)typeof u=="object"&&u.function.arguments&&typeof u.function.arguments!="string"&&(u.function.arguments=JSON.stringify(u.function.arguments));c.function_call!==void 0&&typeof c.function_call=="object"&&c.function_call.arguments&&typeof c.function_call.arguments!="string"&&(c.function_call.arguments=JSON.stringify(c.function_call.arguments))}};const a=i;if((a.function_call===void 0||typeof a.function_call=="string")&&(a.tool_calls===void 0||typeof a.tool_calls=="string"))break;if(t){const l=a.function_call;if(typeof l!="object"){console.warn("experimental_onFunctionCall should not be defined when using tools");continue}const c=await t(o(),l);if(c===void 0)break;s(c),r(c)}if(n){const l=a.tool_calls;if(typeof l!="object"){console.warn("experimental_onToolCall should not be defined when using functions");continue}const c=await n(o(),l);if(c===void 0)break;s(c),r(c)}}}}var Bae=hw();const na=()=>{},kr=na(),Iy=Object,Ft=e=>e===kr,mi=e=>typeof e=="function",ha=(e,t)=>({...e,...t}),Vae=e=>mi(e.then),Ap=new WeakMap;let Hae=0;const of=e=>{const t=typeof e,n=e&&e.constructor,r=n==Date;let o,i;if(Iy(e)===e&&!r&&n!=RegExp){if(o=Ap.get(e),o)return o;if(o=++Hae+"~",Ap.set(e,o),n==Array){for(o="@",i=0;i<e.length;i++)o+=of(e[i])+",";Ap.set(e,o)}if(n==Iy){o="#";const s=Iy.keys(e).sort();for(;!Ft(i=s.pop());)Ft(e[i])||(o+=i+":"+of(e[i])+",");Ap.set(e,o)}}else o=r?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return o},Zi=new WeakMap,Ny={},kp={},T_="undefined",Km=typeof window!=T_,Bx=typeof document!=T_,Wae=()=>Km&&typeof window.requestAnimationFrame!=T_,cI=(e,t)=>{const n=Zi.get(e);return[()=>!Ft(t)&&e.get(t)||Ny,r=>{if(!Ft(t)){const o=e.get(t);t in kp||(kp[t]=o),n[5](t,ha(o,r),o||Ny)}},n[6],()=>!Ft(t)&&t in kp?kp[t]:!Ft(t)&&e.get(t)||Ny]};let Vx=!0;const Uae=()=>Vx,[Hx,Wx]=Km&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[na,na],qae=()=>{const e=Bx&&document.visibilityState;return Ft(e)||e!=="hidden"},Gae=e=>(Bx&&document.addEventListener("visibilitychange",e),Hx("focus",e),()=>{Bx&&document.removeEventListener("visibilitychange",e),Wx("focus",e)}),Yae=e=>{const t=()=>{Vx=!0,e()},n=()=>{Vx=!1};return Hx("online",t),Hx("offline",n),()=>{Wx("online",t),Wx("offline",n)}},Kae={isOnline:Uae,isVisible:qae},Xae={initFocus:Gae,initReconnect:Yae},hT=!m.useId,sf=!Km||"Deno"in window,Qae=e=>Wae()?window.requestAnimationFrame(e):setTimeout(e,1),Ly=sf?m.useEffect:m.useLayoutEffect,Fy=typeof navigator<"u"&&navigator.connection,pT=!sf&&Fy&&(["slow-2g","2g"].includes(Fy.effectiveType)||Fy.saveData),D_=e=>{if(mi(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?of(e):"",[e,t]};let Jae=0;const Ux=()=>++Jae,uI=0,dI=1,fI=2,Zae=3;var Qu={__proto__:null,ERROR_REVALIDATE_EVENT:Zae,FOCUS_EVENT:uI,MUTATE_EVENT:fI,RECONNECT_EVENT:dI};async function hI(...e){const[t,n,r,o]=e,i=ha({populateCache:!0,throwOnError:!0},typeof o=="boolean"?{revalidate:o}:o||{});let s=i.populateCache;const a=i.rollbackOnError;let l=i.optimisticData;const c=h=>typeof a=="function"?a(h):a!==!1,u=i.throwOnError;if(mi(n)){const h=n,g=[],v=t.keys();for(const b of v)!/^\$(inf|sub)\$/.test(b)&&h(t.get(b)._k)&&g.push(b);return Promise.all(g.map(f))}return f(n);async function f(h){const[g]=D_(h);if(!g)return;const[v,b]=cI(t,g),[x,w,_,S]=Zi.get(t),R=()=>{const K=x[g];return(mi(i.revalidate)?i.revalidate(v().data,h):i.revalidate!==!1)&&(delete _[g],delete S[g],K&&K[0])?K[0](fI).then(()=>v().data):v().data};if(e.length<3)return R();let C=r,P;const A=Ux();w[g]=[A,0];const k=!Ft(l),D=v(),I=D.data,F=D._c,B=Ft(F)?I:F;if(k&&(l=mi(l)?l(B,I):l,b({data:l,_c:B})),mi(C))try{C=C(B)}catch(K){P=K}if(C&&Vae(C))if(C=await C.catch(K=>{P=K}),A!==w[g][0]){if(P)throw P;return C}else P&&k&&c(P)&&(s=!0,b({data:B,_c:kr}));if(s&&!P)if(mi(s)){const K=s(C,B);b({data:K,error:kr,_c:kr})}else b({data:C,error:kr,_c:kr});if(w[g][1]=Ux(),Promise.resolve(R()).then(()=>{b({_c:kr})}),P){if(u)throw P;return}return C}}const gT=(e,t)=>{for(const n in e)e[n][0]&&e[n][0](t)},ele=(e,t)=>{if(!Zi.has(e)){const n=ha(Xae,t),r={},o=hI.bind(kr,e);let i=na;const s={},a=(u,f)=>{const h=s[u]||[];return s[u]=h,h.push(f),()=>h.splice(h.indexOf(f),1)},l=(u,f,h)=>{e.set(u,f);const g=s[u];if(g)for(const v of g)v(f,h)},c=()=>{if(!Zi.has(e)&&(Zi.set(e,[r,{},{},{},o,l,a]),!sf)){const u=n.initFocus(setTimeout.bind(kr,gT.bind(kr,r,uI))),f=n.initReconnect(setTimeout.bind(kr,gT.bind(kr,r,dI)));i=()=>{u&&u(),f&&f(),Zi.delete(e)}}};return c(),[e,o,c,i]}return[e,Zi.get(e)[4]]},tle=(e,t,n,r,o)=>{const i=n.errorRetryCount,s=o.retryCount,a=~~((Math.random()+.5)*(1<<(s<8?s:8)))*n.errorRetryInterval;!Ft(i)&&s>i||setTimeout(r,a,o)},nle=(e,t)=>of(e)==of(t),[pI,rle]=ele(new Map),ole=ha({onLoadingSlow:na,onSuccess:na,onError:na,onErrorRetry:tle,onDiscarded:na,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:pT?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:pT?5e3:3e3,compare:nle,isPaused:()=>!1,cache:pI,mutate:rle,fallback:{}},Kae),ile=(e,t)=>{const n=ha(e,t);if(t){const{use:r,fallback:o}=e,{use:i,fallback:s}=t;r&&i&&(n.use=r.concat(i)),o&&s&&(n.fallback=ha(o,s))}return n},sle=m.createContext({}),ale="$inf$",gI=Km&&window.__SWR_DEVTOOLS_USE__,lle=gI?window.__SWR_DEVTOOLS_USE__:[],cle=()=>{gI&&(window.__SWR_DEVTOOLS_REACT__=m)},ule=e=>mi(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],dle=()=>ha(ole,m.useContext(sle)),fle=e=>(t,n,r)=>e(t,n&&((...i)=>{const[s]=D_(t),[,,,a]=Zi.get(pI);if(s.startsWith(ale))return n(...i);const l=a[s];return Ft(l)?n(...i):(delete a[s],l)}),r),hle=lle.concat(fle),ple=e=>function(...n){const r=dle(),[o,i,s]=ule(n),a=ile(r,s);let l=e;const{use:c}=a,u=(c||[]).concat(hle);for(let f=u.length;f--;)l=u[f](l);return l(o,i||a.fetcher||null,a)},gle=(e,t,n)=>{const r=t[e]||(t[e]=[]);return r.push(n),()=>{const o=r.indexOf(n);o>=0&&(r[o]=r[r.length-1],r.pop())}};cle();const mT=m.use||(e=>{if(e.status==="pending")throw e;if(e.status==="fulfilled")return e.value;throw e.status==="rejected"?e.reason:(e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e)}),jy={dedupe:!0},mle=(e,t,n)=>{const{cache:r,compare:o,suspense:i,fallbackData:s,revalidateOnMount:a,revalidateIfStale:l,refreshInterval:c,refreshWhenHidden:u,refreshWhenOffline:f,keepPreviousData:h}=n,[g,v,b,x]=Zi.get(r),[w,_]=D_(e),S=m.useRef(!1),R=m.useRef(!1),C=m.useRef(w),P=m.useRef(t),A=m.useRef(n),k=()=>A.current,D=()=>k().isVisible()&&k().isOnline(),[I,F,B,K]=cI(r,w),Z=m.useRef({}).current,z=Ft(s)?n.fallback[w]:s,Q=(G,be)=>{for(const _e in Z){const Pe=_e;if(Pe==="data"){if(!o(G[Pe],be[Pe])&&(!Ft(G[Pe])||!o(le,be[Pe])))return!1}else if(be[Pe]!==G[Pe])return!1}return!0},W=m.useMemo(()=>{const G=!w||!t?!1:Ft(a)?k().isPaused()||i?!1:Ft(l)?!0:l:a,be=Ie=>{const Ke=ha(Ie);return delete Ke._k,G?{isValidating:!0,isLoading:!0,...Ke}:Ke},_e=I(),Pe=K(),Te=be(_e),Ue=_e===Pe?Te:be(Pe);let Be=Te;return[()=>{const Ie=be(I());return Q(Ie,Be)?(Be.data=Ie.data,Be.isLoading=Ie.isLoading,Be.isValidating=Ie.isValidating,Be.error=Ie.error,Be):(Be=Ie,Ie)},()=>Ue]},[r,w]),Y=Bae.useSyncExternalStore(m.useCallback(G=>B(w,(be,_e)=>{Q(_e,be)||G()}),[r,w]),W[0],W[1]),oe=!S.current,$=g[w]&&g[w].length>0,H=Y.data,J=Ft(H)?z:H,N=Y.error,ce=m.useRef(J),le=h?Ft(H)?ce.current:H:J,de=$&&!Ft(N)?!1:oe&&!Ft(a)?a:k().isPaused()?!1:i?Ft(J)?!1:l:Ft(J)||l,pe=!!(w&&t&&oe&&de),ie=Ft(Y.isValidating)?pe:Y.isValidating,te=Ft(Y.isLoading)?pe:Y.isLoading,ae=m.useCallback(async G=>{const be=P.current;if(!w||!be||R.current||k().isPaused())return!1;let _e,Pe,Te=!0;const Ue=G||{},Be=!b[w]||!Ue.dedupe,Ie=()=>hT?!R.current&&w===C.current&&S.current:w===C.current,Ke={isValidating:!1,isLoading:!1},lt=()=>{F(Ke)},It=()=>{const Ht=b[w];Ht&&Ht[1]===Pe&&delete b[w]},$t={isValidating:!0};Ft(I().data)&&($t.isLoading=!0);try{if(Be&&(F($t),n.loadingTimeout&&Ft(I().data)&&setTimeout(()=>{Te&&Ie()&&k().onLoadingSlow(w,n)},n.loadingTimeout),b[w]=[be(_),Ux()]),[_e,Pe]=b[w],_e=await _e,Be&&setTimeout(It,n.dedupingInterval),!b[w]||b[w][1]!==Pe)return Be&&Ie()&&k().onDiscarded(w),!1;Ke.error=kr;const Ht=v[w];if(!Ft(Ht)&&(Pe<=Ht[0]||Pe<=Ht[1]||Ht[1]===0))return lt(),Be&&Ie()&&k().onDiscarded(w),!1;const fe=I().data;Ke.data=o(fe,_e)?fe:_e,Be&&Ie()&&k().onSuccess(_e,w,n)}catch(Ht){It();const fe=k(),{shouldRetryOnError:Ce}=fe;fe.isPaused()||(Ke.error=Ht,Be&&Ie()&&(fe.onError(Ht,w,fe),(Ce===!0||mi(Ce)&&Ce(Ht))&&(!k().revalidateOnFocus||!k().revalidateOnReconnect||D())&&fe.onErrorRetry(Ht,w,fe,Le=>{const Ge=g[w];Ge&&Ge[0]&&Ge[0](Qu.ERROR_REVALIDATE_EVENT,Le)},{retryCount:(Ue.retryCount||0)+1,dedupe:!0})))}return Te=!1,lt(),!0},[w,r]),ye=m.useCallback((...G)=>hI(r,C.current,...G),[]);if(Ly(()=>{P.current=t,A.current=n,Ft(H)||(ce.current=H)}),Ly(()=>{if(!w)return;const G=ae.bind(kr,jy);let be=0;const Pe=gle(w,g,(Te,Ue={})=>{if(Te==Qu.FOCUS_EVENT){const Be=Date.now();k().revalidateOnFocus&&Be>be&&D()&&(be=Be+k().focusThrottleInterval,G())}else if(Te==Qu.RECONNECT_EVENT)k().revalidateOnReconnect&&D()&&G();else{if(Te==Qu.MUTATE_EVENT)return ae();if(Te==Qu.ERROR_REVALIDATE_EVENT)return ae(Ue)}});return R.current=!1,C.current=w,S.current=!0,F({_k:_}),de&&(Ft(J)||sf?G():Qae(G)),()=>{R.current=!0,Pe()}},[w]),Ly(()=>{let G;function be(){const Pe=mi(c)?c(I().data):c;Pe&&G!==-1&&(G=setTimeout(_e,Pe))}function _e(){!I().error&&(u||k().isVisible())&&(f||k().isOnline())?ae(jy).then(be):be()}return be(),()=>{G&&(clearTimeout(G),G=-1)}},[c,u,f,w]),m.useDebugValue(le),i&&Ft(J)&&w){if(!hT&&sf)throw new Error("Fallback data is required when using suspense in SSR.");P.current=t,A.current=n,R.current=!1;const G=x[w];if(!Ft(G)){const be=ye(G);mT(be)}if(Ft(N)){const be=ae(jy);Ft(le)||(be.status="fulfilled",be.value=!0),mT(be)}else throw N}return{mutate:ye,get data(){return Z.data=!0,le},get error(){return Z.error=!0,N},get isValidating(){return Z.isValidating=!0,ie},get isLoading(){return Z.isLoading=!0,te}}},Mp=ple(mle);var vle=async(e,t,n,r,o,i,s,a,l,c,u,f,h,g,v,b,x)=>{var w;const _=s.current;n(t.messages,!1);const S=g?t.messages:t.messages.map(({role:R,content:C,experimental_attachments:P,name:A,data:k,annotations:D,toolInvocations:I,function_call:F,tool_calls:B,tool_call_id:K})=>({role:R,content:C,...P!==void 0&&{experimental_attachments:P},...A!==void 0&&{name:A},...k!==void 0&&{data:k},...D!==void 0&&{annotations:D},...I!==void 0&&{toolInvocations:I},tool_call_id:K,...F!==void 0&&{function_call:F},...B!==void 0&&{tool_calls:B}}));return await Fae({api:e,body:(w=v==null?void 0:v({messages:t.messages,requestData:t.data,requestBody:t.body}))!=null?w:{messages:S,data:t.data,...i.current.body,...t.body,...t.functions!==void 0&&{functions:t.functions},...t.function_call!==void 0&&{function_call:t.function_call},...t.tools!==void 0&&{tools:t.tools},...t.tool_choice!==void 0&&{tool_choice:t.tool_choice}},streamProtocol:c,credentials:i.current.credentials,headers:{...i.current.headers,...t.headers},abortController:()=>a.current,restoreMessagesOnFailure(){x||n(_,!1)},onResponse:f,onUpdate(R,C){n([...t.messages,...R],!1),r([...o||[],...C||[]],!1)},onToolCall:h,onFinish:u,generateId:l,fetch:b})};function ble({api:e="/api/chat",id:t,initialMessages:n,initialInput:r="",sendExtraMessageFields:o,experimental_onFunctionCall:i,experimental_onToolCall:s,onToolCall:a,experimental_prepareRequestBody:l,experimental_maxAutomaticRoundtrips:c=0,maxAutomaticRoundtrips:u=c,maxToolRoundtrips:f=u,streamMode:h,streamProtocol:g,onResponse:v,onFinish:b,onError:x,credentials:w,headers:_,body:S,generateId:R=aI,fetch:C,keepLastMessageOnError:P=!1}={}){h&&(g??(g=h==="text"?"text":void 0));const A=m.useId(),k=t??A,D=typeof e=="string"?[e,k]:k,[I]=m.useState([]),{data:F,mutate:B}=Mp([D,"messages"],null,{fallbackData:n??I}),{data:K=!1,mutate:Z}=Mp([D,"loading"],null),{data:z,mutate:Q}=Mp([D,"streamData"],null),{data:W=void 0,mutate:Y}=Mp([D,"error"],null),oe=m.useRef(F||[]);m.useEffect(()=>{oe.current=F||[]},[F]);const $=m.useRef(null),H=m.useRef({credentials:w,headers:_,body:S});m.useEffect(()=>{H.current={credentials:w,headers:_,body:S}},[w,_,S]);const J=m.useCallback(async G=>{const be=oe.current.length;try{Z(!0),Y(void 0);const Te=new AbortController;$.current=Te,await zae({getStreamedResponse:()=>vle(e,G,B,Q,z,H,oe,$,R,g,b,v,a,o,l,C,P),experimental_onFunctionCall:i,experimental_onToolCall:s,updateChatRequest:Ue=>{G=Ue},getCurrentMessages:()=>oe.current}),$.current=null}catch(Te){if(Te.name==="AbortError")return $.current=null,null;x&&Te instanceof Error&&x(Te),Y(Te)}finally{Z(!1)}const _e=oe.current,Pe=_e[_e.length-1];_e.length>be&&Pe!=null&&f>0&&vT(Pe)&&yle(_e)<=f&&await J({messages:_e})},[B,Z,e,H,v,b,x,Y,Q,z,g,o,i,s,l,a,f,oe,$,R,C,P]),N=m.useCallback(async(G,{options:be,functions:_e,function_call:Pe,tools:Te,tool_choice:Ue,data:Be,headers:Ie,body:Ke}={})=>{G.id||(G.id=R());const lt={headers:Ie??(be==null?void 0:be.headers),body:Ke??(be==null?void 0:be.body)},It={messages:oe.current.concat(G),options:lt,headers:lt.headers,body:lt.body,data:Be,..._e!==void 0&&{functions:_e},...Pe!==void 0&&{function_call:Pe},...Te!==void 0&&{tools:Te},...Ue!==void 0&&{tool_choice:Ue}};return J(It)},[J,R]),ce=m.useCallback(async({options:G,functions:be,function_call:_e,tools:Pe,tool_choice:Te,data:Ue,headers:Be,body:Ie}={})=>{if(oe.current.length===0)return null;const Ke={headers:Be??(G==null?void 0:G.headers),body:Ie??(G==null?void 0:G.body)};if(oe.current[oe.current.length-1].role==="assistant"){const $t={messages:oe.current.slice(0,-1),options:Ke,headers:Ke.headers,body:Ke.body,data:Ue,...be!==void 0&&{functions:be},..._e!==void 0&&{function_call:_e},...Pe!==void 0&&{tools:Pe},...Te!==void 0&&{tool_choice:Te}};return J($t)}const It={messages:oe.current,options:Ke,headers:Ke.headers,body:Ke.body,data:Ue,...be!==void 0&&{functions:be},..._e!==void 0&&{function_call:_e},...Pe!==void 0&&{tools:Pe},...Te!==void 0&&{tool_choice:Te}};return J(It)},[J]),le=m.useCallback(()=>{$.current&&($.current.abort(),$.current=null)},[]),de=m.useCallback(G=>{typeof G=="function"&&(G=G(oe.current)),B(G,!1),oe.current=G},[B]),[pe,ie]=m.useState(r),te=m.useCallback(async(G,be={},_e)=>{var Pe,Te,Ue,Be,Ie;if((Pe=G==null?void 0:G.preventDefault)==null||Pe.call(G),!pe&&!be.allowEmptySubmit)return;_e&&(H.current={...H.current,..._e});const Ke=[],lt=be.experimental_attachments;if(lt)if(lt instanceof FileList)for(const fe of Array.from(lt)){const{name:Ce,type:Le}=fe,Ge=await new Promise((Ze,Wt)=>{const Zt=new FileReader;Zt.onload=Kt=>{var vn;Ze((vn=Kt.target)==null?void 0:vn.result)},Zt.onerror=Kt=>Wt(Kt),Zt.readAsDataURL(fe)});Ke.push({name:Ce,contentType:Le,url:Ge})}else if(Array.isArray(lt))for(const fe of lt){const{name:Ce,url:Le,contentType:Ge}=fe;Ke.push({name:Ce,contentType:Ge,url:Le})}else throw new Error("Invalid attachments type");const It={headers:(Ue=be.headers)!=null?Ue:(Te=be.options)==null?void 0:Te.headers,body:(Ie=be.body)!=null?Ie:(Be=be.options)==null?void 0:Be.body},Ht={messages:!pe&&be.allowEmptySubmit?oe.current:oe.current.concat({id:R(),createdAt:new Date,role:"user",content:pe,experimental_attachments:Ke.length>0?Ke:void 0}),options:It,headers:It.headers,body:It.body,data:be.data};J(Ht),ie("")},[pe,R,J]),ae=G=>{ie(G.target.value)},ye=({toolCallId:G,result:be})=>{const _e=oe.current.map((Te,Ue,Be)=>Ue===Be.length-1&&Te.role==="assistant"&&Te.toolInvocations?{...Te,toolInvocations:Te.toolInvocations.map(Ie=>Ie.toolCallId===G?{...Ie,result:be}:Ie)}:Te);B(_e,!1);const Pe=_e[_e.length-1];vT(Pe)&&J({messages:_e})};return{messages:F||[],error:W,append:N,reload:ce,stop:le,setMessages:de,input:pe,setInput:ie,handleInputChange:ae,handleSubmit:te,isLoading:K,data:z,addToolResult:ye,experimental_addToolResult:ye}}function vT(e){return e.role==="assistant"&&e.toolInvocations&&e.toolInvocations.length>0&&e.toolInvocations.every(t=>"result"in t)}function yle(e){let t=0;for(let n=e.length-1;n>=0&&e[n].role==="assistant";n--)t++;return t}function xle(e,t){return m.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const mI="ScrollArea",[vI,vye]=Zn(mI),[wle,Io]=vI(mI),bI=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:i=600,...s}=e,[a,l]=m.useState(null),[c,u]=m.useState(null),[f,h]=m.useState(null),[g,v]=m.useState(null),[b,x]=m.useState(null),[w,_]=m.useState(0),[S,R]=m.useState(0),[C,P]=m.useState(!1),[A,k]=m.useState(!1),D=_t(t,F=>l(F)),I=_l(o);return m.createElement(wle,{scope:n,type:r,dir:I,scrollHideDelay:i,scrollArea:a,viewport:c,onViewportChange:u,content:f,onContentChange:h,scrollbarX:g,onScrollbarXChange:v,scrollbarXEnabled:C,onScrollbarXEnabledChange:P,scrollbarY:b,onScrollbarYChange:x,scrollbarYEnabled:A,onScrollbarYEnabledChange:k,onCornerWidthChange:_,onCornerHeightChange:R},m.createElement(Qe.div,he({dir:I},s,{ref:D,style:{position:"relative","--radix-scroll-area-corner-width":w+"px","--radix-scroll-area-corner-height":S+"px",...e.style}})))}),_le="ScrollAreaViewport",Sle=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,...o}=e,i=Io(_le,n),s=m.useRef(null),a=_t(t,s,i.onViewportChange);return m.createElement(m.Fragment,null,m.createElement("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"}}),m.createElement(Qe.div,he({"data-radix-scroll-area-viewport":""},o,{ref:a,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style}}),m.createElement("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"}},r)))}),hs="ScrollAreaScrollbar",yI=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Io(hs,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:s}=o,a=e.orientation==="horizontal";return m.useEffect(()=>(a?i(!0):s(!0),()=>{a?i(!1):s(!1)}),[a,i,s]),o.type==="hover"?m.createElement(Cle,he({},r,{ref:t,forceMount:n})):o.type==="scroll"?m.createElement(Ele,he({},r,{ref:t,forceMount:n})):o.type==="auto"?m.createElement(xI,he({},r,{ref:t,forceMount:n})):o.type==="always"?m.createElement($_,he({},r,{ref:t})):null}),Cle=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Io(hs,e.__scopeScrollArea),[i,s]=m.useState(!1);return m.useEffect(()=>{const a=o.scrollArea;let l=0;if(a){const c=()=>{window.clearTimeout(l),s(!0)},u=()=>{l=window.setTimeout(()=>s(!1),o.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",u),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",u)}}},[o.scrollArea,o.scrollHideDelay]),m.createElement(er,{present:n||i},m.createElement(xI,he({"data-state":i?"visible":"hidden"},r,{ref:t})))}),Ele=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Io(hs,e.__scopeScrollArea),i=e.orientation==="horizontal",s=Qm(()=>l("SCROLL_END"),100),[a,l]=xle("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return m.useEffect(()=>{if(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,o.scrollHideDelay,l]),m.useEffect(()=>{const c=o.viewport,u=i?"scrollLeft":"scrollTop";if(c){let f=c[u];const h=()=>{const g=c[u];f!==g&&(l("SCROLL"),s()),f=g};return c.addEventListener("scroll",h),()=>c.removeEventListener("scroll",h)}},[o.viewport,i,l,s]),m.createElement(er,{present:n||a!=="hidden"},m.createElement($_,he({"data-state":a==="hidden"?"hidden":"visible"},r,{ref:t,onPointerEnter:Me(e.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:Me(e.onPointerLeave,()=>l("POINTER_LEAVE"))})))}),xI=m.forwardRef((e,t)=>{const n=Io(hs,e.__scopeScrollArea),{forceMount:r,...o}=e,[i,s]=m.useState(!1),a=e.orientation==="horizontal",l=Qm(()=>{if(n.viewport){const c=n.viewport.offsetWidth<n.viewport.scrollWidth,u=n.viewport.offsetHeight<n.viewport.scrollHeight;s(a?c:u)}},10);return eu(n.viewport,l),eu(n.content,l),m.createElement(er,{present:r||i},m.createElement($_,he({"data-state":i?"visible":"hidden"},o,{ref:t})))}),$_=m.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,o=Io(hs,e.__scopeScrollArea),i=m.useRef(null),s=m.useRef(0),[a,l]=m.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=CI(a.viewport,a.content),u={...r,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:h=>i.current=h,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:h=>s.current=h};function f(h,g){return kle(h,s.current,a,g)}return n==="horizontal"?m.createElement(Rle,he({},u,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const h=o.viewport.scrollLeft,g=bT(h,a,o.dir);i.current.style.transform=`translate3d(${g}px, 0, 0)`}},onWheelScroll:h=>{o.viewport&&(o.viewport.scrollLeft=h)},onDragScroll:h=>{o.viewport&&(o.viewport.scrollLeft=f(h,o.dir))}})):n==="vertical"?m.createElement(Ole,he({},u,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const h=o.viewport.scrollTop,g=bT(h,a);i.current.style.transform=`translate3d(0, ${g}px, 0)`}},onWheelScroll:h=>{o.viewport&&(o.viewport.scrollTop=h)},onDragScroll:h=>{o.viewport&&(o.viewport.scrollTop=f(h))}})):null}),Rle=m.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,i=Io(hs,e.__scopeScrollArea),[s,a]=m.useState(),l=m.useRef(null),c=_t(t,l,i.onScrollbarXChange);return m.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),m.createElement(_I,he({"data-orientation":"horizontal"},o,{ref:c,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Xm(n)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.x),onDragScroll:u=>e.onDragScroll(u.x),onWheelScroll:(u,f)=>{if(i.viewport){const h=i.viewport.scrollLeft+u.deltaX;e.onWheelScroll(h),RI(h,f)&&u.preventDefault()}},onResize:()=>{l.current&&i.viewport&&s&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:Hg(s.paddingLeft),paddingEnd:Hg(s.paddingRight)}})}}))}),Ole=m.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,i=Io(hs,e.__scopeScrollArea),[s,a]=m.useState(),l=m.useRef(null),c=_t(t,l,i.onScrollbarYChange);return m.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),m.createElement(_I,he({"data-orientation":"vertical"},o,{ref:c,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Xm(n)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.y),onDragScroll:u=>e.onDragScroll(u.y),onWheelScroll:(u,f)=>{if(i.viewport){const h=i.viewport.scrollTop+u.deltaY;e.onWheelScroll(h),RI(h,f)&&u.preventDefault()}},onResize:()=>{l.current&&i.viewport&&s&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:Hg(s.paddingTop),paddingEnd:Hg(s.paddingBottom)}})}}))}),[Ple,wI]=vI(hs),_I=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:i,onThumbPointerUp:s,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:u,onResize:f,...h}=e,g=Io(hs,n),[v,b]=m.useState(null),x=_t(t,D=>b(D)),w=m.useRef(null),_=m.useRef(""),S=g.viewport,R=r.content-r.viewport,C=Ln(u),P=Ln(l),A=Qm(f,10);function k(D){if(w.current){const I=D.clientX-w.current.left,F=D.clientY-w.current.top;c({x:I,y:F})}}return m.useEffect(()=>{const D=I=>{const F=I.target;(v==null?void 0:v.contains(F))&&C(I,R)};return document.addEventListener("wheel",D,{passive:!1}),()=>document.removeEventListener("wheel",D,{passive:!1})},[S,v,R,C]),m.useEffect(P,[r,P]),eu(v,A),eu(g.content,A),m.createElement(Ple,{scope:n,scrollbar:v,hasThumb:o,onThumbChange:Ln(i),onThumbPointerUp:Ln(s),onThumbPositionChange:P,onThumbPointerDown:Ln(a)},m.createElement(Qe.div,he({},h,{ref:x,style:{position:"absolute",...h.style},onPointerDown:Me(e.onPointerDown,D=>{D.button===0&&(D.target.setPointerCapture(D.pointerId),w.current=v.getBoundingClientRect(),_.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",g.viewport&&(g.viewport.style.scrollBehavior="auto"),k(D))}),onPointerMove:Me(e.onPointerMove,k),onPointerUp:Me(e.onPointerUp,D=>{const I=D.target;I.hasPointerCapture(D.pointerId)&&I.releasePointerCapture(D.pointerId),document.body.style.webkitUserSelect=_.current,g.viewport&&(g.viewport.style.scrollBehavior=""),w.current=null})})))}),qx="ScrollAreaThumb",Tle=m.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=wI(qx,e.__scopeScrollArea);return m.createElement(er,{present:n||o.hasThumb},m.createElement(Dle,he({ref:t},r)))}),Dle=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,i=Io(qx,n),s=wI(qx,n),{onThumbPositionChange:a}=s,l=_t(t,f=>s.onThumbChange(f)),c=m.useRef(),u=Qm(()=>{c.current&&(c.current(),c.current=void 0)},100);return m.useEffect(()=>{const f=i.viewport;if(f){const h=()=>{if(u(),!c.current){const g=Mle(f,a);c.current=g,a()}};return a(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[i.viewport,u,a]),m.createElement(Qe.div,he({"data-state":s.hasThumb?"visible":"hidden"},o,{ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Me(e.onPointerDownCapture,f=>{const g=f.target.getBoundingClientRect(),v=f.clientX-g.left,b=f.clientY-g.top;s.onThumbPointerDown({x:v,y:b})}),onPointerUp:Me(e.onPointerUp,s.onThumbPointerUp)}))}),SI="ScrollAreaCorner",$le=m.forwardRef((e,t)=>{const n=Io(SI,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?m.createElement(Ale,he({},e,{ref:t})):null}),Ale=m.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=Io(SI,n),[i,s]=m.useState(0),[a,l]=m.useState(0),c=!!(i&&a);return eu(o.scrollbarX,()=>{var u;const f=((u=o.scrollbarX)===null||u===void 0?void 0:u.offsetHeight)||0;o.onCornerHeightChange(f),l(f)}),eu(o.scrollbarY,()=>{var u;const f=((u=o.scrollbarY)===null||u===void 0?void 0:u.offsetWidth)||0;o.onCornerWidthChange(f),s(f)}),c?m.createElement(Qe.div,he({},r,{ref:t,style:{width:i,height:a,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}})):null});function Hg(e){return e?parseInt(e,10):0}function CI(e,t){const n=e/t;return isNaN(n)?0:n}function Xm(e){const t=CI(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function kle(e,t,n,r="ltr"){const o=Xm(n),i=o/2,s=t||i,a=o-s,l=n.scrollbar.paddingStart+s,c=n.scrollbar.size-n.scrollbar.paddingEnd-a,u=n.content-n.viewport,f=r==="ltr"?[0,u]:[u*-1,0];return EI([l,c],f)(e)}function bT(e,t,n="ltr"){const r=Xm(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-o,s=t.content-t.viewport,a=i-r,l=n==="ltr"?[0,s]:[s*-1,0],c=Ox(e,l);return EI([0,s],[0,a])(c)}function EI(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function RI(e,t){return e>0&&e<t}const Mle=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function o(){const i={left:e.scrollLeft,top:e.scrollTop},s=n.left!==i.left,a=n.top!==i.top;(s||a)&&t(),n=i,r=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(r)};function Qm(e,t){const n=Ln(e),r=m.useRef(0);return m.useEffect(()=>()=>window.clearTimeout(r.current),[]),m.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function eu(e,t){const n=Ln(t);ur(()=>{let r=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return o.observe(e),()=>{window.cancelAnimationFrame(r),o.unobserve(e)}}},[e,n])}const OI=bI,Ile=Sle,Nle=$le,A_=V.forwardRef(({className:e,children:t,...n},r)=>O.jsxs(OI,{ref:r,className:Ee("relative overflow-hidden",e),...n,children:[O.jsx(Ile,{className:"h-full w-full rounded-[inherit]",children:t}),O.jsx(Jm,{}),O.jsx(Nle,{})]}));A_.displayName=OI.displayName;const Jm=V.forwardRef(({className:e,orientation:t="vertical",...n},r)=>O.jsx(yI,{ref:r,orientation:t,className:Ee("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:O.jsx(Tle,{className:"relative flex-1 rounded-full bg-border"})}));Jm.displayName=yI.displayName;const PI="Switch",[Lle,bye]=Zn(PI),[Fle,jle]=Lle(PI),zle=m.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:l="on",onCheckedChange:c,...u}=e,[f,h]=m.useState(null),g=_t(t,_=>h(_)),v=m.useRef(!1),b=f?!!f.closest("form"):!0,[x=!1,w]=xr({prop:o,defaultProp:i,onChange:c});return m.createElement(Fle,{scope:n,checked:x,disabled:a},m.createElement(Qe.button,he({type:"button",role:"switch","aria-checked":x,"aria-required":s,"data-state":TI(x),"data-disabled":a?"":void 0,disabled:a,value:l},u,{ref:g,onClick:Me(e.onClick,_=>{w(S=>!S),b&&(v.current=_.isPropagationStopped(),v.current||_.stopPropagation())})})),b&&m.createElement(Hle,{control:f,bubbles:!v.current,name:r,value:l,checked:x,required:s,disabled:a,style:{transform:"translateX(-100%)"}}))}),Ble="SwitchThumb",Vle=m.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,o=jle(Ble,n);return m.createElement(Qe.span,he({"data-state":TI(o.checked),"data-disabled":o.disabled?"":void 0},r,{ref:t}))}),Hle=e=>{const{control:t,checked:n,bubbles:r=!0,...o}=e,i=m.useRef(null),s=Im(n),a=$m(t);return m.useEffect(()=>{const l=i.current,c=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(c,"checked").set;if(s!==n&&f){const h=new Event("click",{bubbles:r});f.call(l,n),l.dispatchEvent(h)}},[s,n,r]),m.createElement("input",he({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 TI(e){return e?"checked":"unchecked"}const Zm=zle,DI=Vle,$I=V.forwardRef(({className:e,...t},n)=>O.jsx(Zm,{className:Ee("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:O.jsx(DI,{className:Ee("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")})}));$I.displayName=Zm.displayName;const Wle=V.forwardRef(({className:e,...t},n)=>O.jsx(Zm,{className:Ee("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:O.jsx(DI,{className:Ee("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")})}));Wle.displayName=Zm.displayName;function Ule(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const qle=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Gle=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Yle={};function yT(e,t){return((t||Yle).jsx?Gle:qle).test(e)}const Kle=/[ \t\n\f\r]/g;function Xle(e){return typeof e=="object"?e.type==="text"?xT(e.value):!1:xT(e)}function xT(e){return e.replace(Kle,"")===""}class Qf{constructor(t,n,r){this.property=t,this.normal=n,r&&(this.space=r)}}Qf.prototype.property={};Qf.prototype.normal={};Qf.prototype.space=null;function AI(e,t){const n={},r={};let o=-1;for(;++o<e.length;)Object.assign(n,e[o].property),Object.assign(r,e[o].normal);return new Qf(n,r,t)}function Gx(e){return e.toLowerCase()}class No{constructor(t,n){this.property=t,this.attribute=n}}No.prototype.space=null;No.prototype.boolean=!1;No.prototype.booleanish=!1;No.prototype.overloadedBoolean=!1;No.prototype.number=!1;No.prototype.commaSeparated=!1;No.prototype.spaceSeparated=!1;No.prototype.commaOrSpaceSeparated=!1;No.prototype.mustUseProperty=!1;No.prototype.defined=!1;let Qle=0;const mt=Dl(),$n=Dl(),kI=Dl(),De=Dl(),on=Dl(),wc=Dl(),Gr=Dl();function Dl(){return 2**++Qle}const Yx=Object.freeze(Object.defineProperty({__proto__:null,boolean:mt,booleanish:$n,commaOrSpaceSeparated:Gr,commaSeparated:wc,number:De,overloadedBoolean:kI,spaceSeparated:on},Symbol.toStringTag,{value:"Module"})),zy=Object.keys(Yx);class k_ extends No{constructor(t,n,r,o){let i=-1;if(super(t,n),wT(this,"space",o),typeof r=="number")for(;++i<zy.length;){const s=zy[i];wT(this,zy[i],(r&Yx[s])===Yx[s])}}}k_.prototype.defined=!0;function wT(e,t,n){n&&(e[t]=n)}const Jle={}.hasOwnProperty;function uu(e){const t={},n={};let r;for(r in e.properties)if(Jle.call(e.properties,r)){const o=e.properties[r],i=new k_(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[Gx(r)]=r,n[Gx(i.attribute)]=r}return new Qf(t,n,e.space)}const MI=uu({space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()},properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}}),II=uu({space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()},properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function NI(e,t){return t in e?e[t]:t}function LI(e,t){return NI(e,t.toLowerCase())}const FI=uu({space:"xmlns",attributes:{xmlnsxlink:"xmlns:xlink"},transform:LI,properties:{xmlns:null,xmlnsXLink:null}}),jI=uu({transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:$n,ariaAutoComplete:null,ariaBusy:$n,ariaChecked:$n,ariaColCount:De,ariaColIndex:De,ariaColSpan:De,ariaControls:on,ariaCurrent:null,ariaDescribedBy:on,ariaDetails:null,ariaDisabled:$n,ariaDropEffect:on,ariaErrorMessage:null,ariaExpanded:$n,ariaFlowTo:on,ariaGrabbed:$n,ariaHasPopup:null,ariaHidden:$n,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:on,ariaLevel:De,ariaLive:null,ariaModal:$n,ariaMultiLine:$n,ariaMultiSelectable:$n,ariaOrientation:null,ariaOwns:on,ariaPlaceholder:null,ariaPosInSet:De,ariaPressed:$n,ariaReadOnly:$n,ariaRelevant:null,ariaRequired:$n,ariaRoleDescription:on,ariaRowCount:De,ariaRowIndex:De,ariaRowSpan:De,ariaSelected:$n,ariaSetSize:De,ariaSort:null,ariaValueMax:De,ariaValueMin:De,ariaValueNow:De,ariaValueText:null,role:null}}),Zle=uu({space:"html",attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},transform:LI,mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:wc,acceptCharset:on,accessKey:on,action:null,allow:null,allowFullScreen:mt,allowPaymentRequest:mt,allowUserMedia:mt,alt:null,as:null,async:mt,autoCapitalize:null,autoComplete:on,autoFocus:mt,autoPlay:mt,blocking:on,capture:null,charSet:null,checked:mt,cite:null,className:on,cols:De,colSpan:null,content:null,contentEditable:$n,controls:mt,controlsList:on,coords:De|wc,crossOrigin:null,data:null,dateTime:null,decoding:null,default:mt,defer:mt,dir:null,dirName:null,disabled:mt,download:kI,draggable:$n,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:mt,formTarget:null,headers:on,height:De,hidden:mt,high:De,href:null,hrefLang:null,htmlFor:on,httpEquiv:on,id:null,imageSizes:null,imageSrcSet:null,inert:mt,inputMode:null,integrity:null,is:null,isMap:mt,itemId:null,itemProp:on,itemRef:on,itemScope:mt,itemType:on,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:mt,low:De,manifest:null,max:null,maxLength:De,media:null,method:null,min:null,minLength:De,multiple:mt,muted:mt,name:null,nonce:null,noModule:mt,noValidate:mt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:mt,optimum:De,pattern:null,ping:on,placeholder:null,playsInline:mt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:mt,referrerPolicy:null,rel:on,required:mt,reversed:mt,rows:De,rowSpan:De,sandbox:on,scope:null,scoped:mt,seamless:mt,selected:mt,shadowRootDelegatesFocus:mt,shadowRootMode:null,shape:null,size:De,sizes:null,slot:null,span:De,spellCheck:$n,src:null,srcDoc:null,srcLang:null,srcSet:null,start:De,step:null,style:null,tabIndex:De,target:null,title:null,translate:null,type:null,typeMustMatch:mt,useMap:null,value:$n,width:De,wrap:null,align:null,aLink:null,archive:on,axis:null,background:null,bgColor:null,border:De,borderColor:null,bottomMargin:De,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:mt,declare:mt,event:null,face:null,frame:null,frameBorder:null,hSpace:De,leftMargin:De,link:null,longDesc:null,lowSrc:null,marginHeight:De,marginWidth:De,noResize:mt,noHref:mt,noShade:mt,noWrap:mt,object:null,profile:null,prompt:null,rev:null,rightMargin:De,rules:null,scheme:null,scrolling:$n,standby:null,summary:null,text:null,topMargin:De,valueType:null,version:null,vAlign:null,vLink:null,vSpace:De,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:mt,disableRemotePlayback:mt,prefix:null,property:null,results:De,security:null,unselectable:null}}),ece=uu({space:"svg",attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},transform:NI,properties:{about:Gr,accentHeight:De,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:De,amplitude:De,arabicForm:null,ascent:De,attributeName:null,attributeType:null,azimuth:De,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:De,by:null,calcMode:null,capHeight:De,className:on,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:De,diffuseConstant:De,direction:null,display:null,dur:null,divisor:De,dominantBaseline:null,download:mt,dx:null,dy:null,edgeMode:null,editable:null,elevation:De,enableBackground:null,end:null,event:null,exponent:De,externalResourcesRequired:null,fill:null,fillOpacity:De,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:wc,g2:wc,glyphName:wc,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:De,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:De,horizOriginX:De,horizOriginY:De,id:null,ideographic:De,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:De,k:De,k1:De,k2:De,k3:De,k4:De,kernelMatrix:Gr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:De,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:De,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:De,overlineThickness:De,paintOrder:null,panose1:null,path:null,pathLength:De,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:on,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:De,pointsAtY:De,pointsAtZ:De,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Gr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Gr,rev:Gr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Gr,requiredFeatures:Gr,requiredFonts:Gr,requiredFormats:Gr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:De,specularExponent:De,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:De,strikethroughThickness:De,string:null,stroke:null,strokeDashArray:Gr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:De,strokeOpacity:De,strokeWidth:null,style:null,surfaceScale:De,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Gr,tabIndex:De,tableValues:null,target:null,targetX:De,targetY:De,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Gr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:De,underlineThickness:De,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:De,values:null,vAlphabetic:De,vMathematical:De,vectorEffect:null,vHanging:De,vIdeographic:De,version:null,vertAdvY:De,vertOriginX:De,vertOriginY:De,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:De,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}}),tce=/^data[-\w.:]+$/i,_T=/-[a-z]/g,nce=/[A-Z]/g;function rce(e,t){const n=Gx(t);let r=t,o=No;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&tce.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(_T,ice);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!_T.test(i)){let s=i.replace(nce,oce);s.charAt(0)!=="-"&&(s="-"+s),t="data"+s}}o=k_}return new o(r,t)}function oce(e){return"-"+e.toLowerCase()}function ice(e){return e.charAt(1).toUpperCase()}const sce={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},ace=AI([II,MI,FI,jI,Zle],"html"),M_=AI([II,MI,FI,jI,ece],"svg");function lce(e){return e.join(" ").trim()}var zI={},ST=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,cce=/\n/g,uce=/^\s*/,dce=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,fce=/^:\s*/,hce=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,pce=/^[;\s]*/,gce=/^\s+|\s+$/g,mce=`
|
|
400
400
|
`,CT="/",ET="*",Wa="",vce="comment",bce="declaration",yce=function(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function o(v){var b=v.match(cce);b&&(n+=b.length);var x=v.lastIndexOf(mce);r=~x?v.length-x:r+v.length}function i(){var v={line:n,column:r};return function(b){return b.position=new s(v),c(),b}}function s(v){this.start=v,this.end={line:n,column:r},this.source=t.source}s.prototype.content=e;function a(v){var b=new Error(t.source+":"+n+":"+r+": "+v);if(b.reason=v,b.filename=t.source,b.line=n,b.column=r,b.source=e,!t.silent)throw b}function l(v){var b=v.exec(e);if(b){var x=b[0];return o(x),e=e.slice(x.length),b}}function c(){l(uce)}function u(v){var b;for(v=v||[];b=f();)b!==!1&&v.push(b);return v}function f(){var v=i();if(!(CT!=e.charAt(0)||ET!=e.charAt(1))){for(var b=2;Wa!=e.charAt(b)&&(ET!=e.charAt(b)||CT!=e.charAt(b+1));)++b;if(b+=2,Wa===e.charAt(b-1))return a("End of comment missing");var x=e.slice(2,b-2);return r+=2,o(x),e=e.slice(b),r+=2,v({type:vce,comment:x})}}function h(){var v=i(),b=l(dce);if(b){if(f(),!l(fce))return a("property missing ':'");var x=l(hce),w=v({type:bce,property:RT(b[0].replace(ST,Wa)),value:x?RT(x[0].replace(ST,Wa)):Wa});return l(pce),w}}function g(){var v=[];u(v);for(var b;b=h();)b!==!1&&(v.push(b),u(v));return v}return c(),g()};function RT(e){return e?e.replace(gce,Wa):Wa}var xce=Vs&&Vs.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(zI,"__esModule",{value:!0});var wce=xce(yce);function _ce(e,t){var n=null;if(!e||typeof e!="string")return n;var r=(0,wce.default)(e),o=typeof t=="function";return r.forEach(function(i){if(i.type==="declaration"){var s=i.property,a=i.value;o?t(s,a,i):a&&(n=n||{},n[s]=a)}}),n}var OT=zI.default=_ce;const Sce=OT.default||OT,BI=VI("end"),I_=VI("start");function VI(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function Cce(e){const t=I_(e),n=BI(e);if(t&&n)return{start:t,end:n}}function wd(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?PT(e.position):"start"in e||"end"in e?PT(e):"line"in e||"column"in e?Kx(e):""}function Kx(e){return TT(e&&e.line)+":"+TT(e&&e.column)}function PT(e){return Kx(e&&e.start)+"-"+Kx(e&&e.end)}function TT(e){return e&&typeof e=="number"?e:1}class dr extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let o="",i={},s=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?o=t:!i.cause&&t&&(s=!0,o=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const a=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file,this.message=o,this.line=a?a.line:void 0,this.name=wd(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual,this.expected,this.note,this.url}}dr.prototype.file="";dr.prototype.name="";dr.prototype.reason="";dr.prototype.message="";dr.prototype.stack="";dr.prototype.column=void 0;dr.prototype.line=void 0;dr.prototype.ancestors=void 0;dr.prototype.cause=void 0;dr.prototype.fatal=void 0;dr.prototype.place=void 0;dr.prototype.ruleId=void 0;dr.prototype.source=void 0;const N_={}.hasOwnProperty,Ece=new Map,Rce=/[A-Z]/g,Oce=/-([a-z])/g,Pce=new Set(["table","tbody","thead","tfoot","tr"]),Tce=new Set(["td","th"]),HI="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Dce(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Fce(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=Lce(n,t.jsx,t.jsxs)}const o={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?M_:ace,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=WI(o,e,void 0);return i&&typeof i!="string"?i:o.create(e,o.Fragment,{children:i||void 0},void 0)}function WI(e,t,n){if(t.type==="element")return $ce(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Ace(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Mce(e,t,n);if(t.type==="mdxjsEsm")return kce(e,t);if(t.type==="root")return Ice(e,t,n);if(t.type==="text")return Nce(e,t)}function $ce(e,t,n){const r=e.schema;let o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=M_,e.schema=o),e.ancestors.push(t);const i=qI(e,t.tagName,!1),s=jce(e,t);let a=F_(e,t);return Pce.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!Xle(l):!0})),UI(e,s,i,t),L_(s,a),e.ancestors.pop(),e.schema=r,e.create(t,i,s,n)}function Ace(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}af(e,t.position)}function kce(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);af(e,t.position)}function Mce(e,t,n){const r=e.schema;let o=r;t.name==="svg"&&r.space==="html"&&(o=M_,e.schema=o),e.ancestors.push(t);const i=t.name===null?e.Fragment:qI(e,t.name,!0),s=zce(e,t),a=F_(e,t);return UI(e,s,i,t),L_(s,a),e.ancestors.pop(),e.schema=r,e.create(t,i,s,n)}function Ice(e,t,n){const r={};return L_(r,F_(e,t)),e.create(t,e.Fragment,r,n)}function Nce(e,t){return t.value}function UI(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function L_(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Lce(e,t,n){return r;function r(o,i,s,a){const c=Array.isArray(s.children)?n:t;return a?c(i,s,a):c(i,s)}}function Fce(e,t){return n;function n(r,o,i,s){const a=Array.isArray(i.children),l=I_(r);return t(o,i,s,a,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function jce(e,t){const n={};let r,o;for(o in t.properties)if(o!=="children"&&N_.call(t.properties,o)){const i=Bce(e,o,t.properties[o]);if(i){const[s,a]=i;e.tableCellAlignToStyle&&s==="align"&&typeof a=="string"&&Tce.has(t.tagName)?r=a:n[s]=a}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function zce(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const s=i.expression;s.type;const a=s.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else af(e,t.position);else{const o=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,i=e.evaluater.evaluateExpression(a.expression)}else af(e,t.position);else i=r.value===null?!0:r.value;n[o]=i}return n}function F_(e,t){const n=[];let r=-1;const o=e.passKeys?new Map:Ece;for(;++r<t.children.length;){const i=t.children[r];let s;if(e.passKeys){const l=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(l){const c=o.get(l)||0;s=l+"-"+c,o.set(l,c+1)}}const a=WI(e,i,s);a!==void 0&&n.push(a)}return n}function Bce(e,t,n){const r=rce(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Ule(n):lce(n)),r.property==="style"){let o=typeof n=="object"?n:Vce(e,String(n));return e.stylePropertyNameCase==="css"&&(o=Hce(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?sce[r.property]||r.property:r.attribute,n]}}function Vce(e,t){const n={};try{Sce(t,r)}catch(o){if(!e.ignoreInvalidStyle){const i=o,s=new dr("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=HI+"#cannot-parse-style-attribute",s}}return n;function r(o,i){let s=o;s.slice(0,2)!=="--"&&(s.slice(0,4)==="-ms-"&&(s="ms-"+s.slice(4)),s=s.replace(Oce,Uce)),n[s]=i}}function qI(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const o=t.split(".");let i=-1,s;for(;++i<o.length;){const a=yT(o[i])?{type:"Identifier",name:o[i]}:{type:"Literal",value:o[i]};s=s?{type:"MemberExpression",object:s,property:a,computed:!!(i&&a.type==="Literal"),optional:!1}:a}r=s}else r=yT(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const o=r.value;return N_.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);af(e)}function af(e,t){const n=new dr("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=HI+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Hce(e){const t={};let n;for(n in e)N_.call(e,n)&&(t[Wce(n)]=e[n]);return t}function Wce(e){let t=e.replace(Rce,qce);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Uce(e,t){return t.toUpperCase()}function qce(e){return"-"+e.toLowerCase()}const By={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Gce={};function Yce(e,t){const n=t||Gce,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return GI(e,r,o)}function GI(e,t,n){if(Kce(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return DT(e.children,t,n)}return Array.isArray(e)?DT(e,t,n):""}function DT(e,t,n){const r=[];let o=-1;for(;++o<e.length;)r[o]=GI(e[o],t,n);return r.join("")}function Kce(e){return!!(e&&typeof e=="object")}const $T=document.createElement("i");function j_(e){const t="&"+e+";";$T.innerHTML=t;const n=$T.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ei(e,t,n,r){const o=e.length;let i=0,s;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);i<r.length;)s=r.slice(i,i+1e4),s.unshift(t,0),e.splice(...s),i+=1e4,t+=1e4}function To(e,t){return e.length>0?(Ei(e,e.length,0,t),e):t}const AT={}.hasOwnProperty;function Xce(e){const t={};let n=-1;for(;++n<e.length;)Qce(t,e[n]);return t}function Qce(e,t){let n;for(n in t){const o=(AT.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){AT.call(o,s)||(o[s]=[]);const a=i[s];Jce(o[s],Array.isArray(a)?a:a?[a]:[])}}}function Jce(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Ei(e,0,0,r)}function YI(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function _c(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Zce=va(new RegExp("\\p{P}","u")),vi=va(/[A-Za-z]/),oo=va(/[\dA-Za-z]/),eue=va(/[#-'*+\--9=?A-Z^-~]/);function Xx(e){return e!==null&&(e<32||e===127)}const Qx=va(/\d/),tue=va(/[\dA-Fa-f]/),KI=va(/[!-/:-@[-`{-~]/);function ot(e){return e!==null&&e<-2}function Fr(e){return e!==null&&(e<0||e===32)}function Vt(e){return e===-2||e===-1||e===32}function nue(e){return KI(e)||Zce(e)}const rue=va(/\s/);function va(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function du(e){const t=[];let n=-1,r=0,o=0;for(;++n<e.length;){const i=e.charCodeAt(n);let s="";if(i===37&&oo(e.charCodeAt(n+1))&&oo(e.charCodeAt(n+2)))o=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(s=String.fromCharCode(i));else if(i>55295&&i<57344){const a=e.charCodeAt(n+1);i<56320&&a>56319&&a<57344?(s=String.fromCharCode(i,a),o=1):s="�"}else s=String.fromCharCode(i);s&&(t.push(e.slice(r,n),encodeURIComponent(s)),r=n+o+1,s=""),o&&(n+=o,o=0)}return t.join("")+e.slice(r)}function sn(e,t,n,r){const o=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(l){return Vt(l)?(e.enter(n),a(l)):t(l)}function a(l){return Vt(l)&&i++<o?(e.consume(l),a):(e.exit(n),t(l))}}const oue={tokenize:iue};function iue(e){const t=e.attempt(this.parser.constructs.contentInitial,r,o);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),sn(e,t,"linePrefix")}function o(a){return e.enter("paragraph"),i(a)}function i(a){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,s(a)}function s(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return ot(a)?(e.consume(a),e.exit("chunkText"),i):(e.consume(a),s)}}const sue={tokenize:aue},kT={tokenize:lue};function aue(e){const t=this,n=[];let r=0,o,i,s;return a;function a(S){if(r<n.length){const R=n[r];return t.containerState=R[1],e.attempt(R[0].continuation,l,c)(S)}return c(S)}function l(S){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&_();const R=t.events.length;let C=R,P;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){P=t.events[C][1].end;break}w(r);let A=R;for(;A<t.events.length;)t.events[A][1].end=Object.assign({},P),A++;return Ei(t.events,C+1,0,t.events.slice(R)),t.events.length=A,c(S)}return a(S)}function c(S){if(r===n.length){if(!o)return h(S);if(o.currentConstruct&&o.currentConstruct.concrete)return v(S);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(kT,u,f)(S)}function u(S){return o&&_(),w(r),h(S)}function f(S){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,v(S)}function h(S){return t.containerState={},e.attempt(kT,g,v)(S)}function g(S){return r++,n.push([t.currentConstruct,t.containerState]),h(S)}function v(S){if(S===null){o&&_(),w(0),e.consume(S);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{contentType:"flow",previous:i,_tokenizer:o}),b(S)}function b(S){if(S===null){x(e.exit("chunkFlow"),!0),w(0),e.consume(S);return}return ot(S)?(e.consume(S),x(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(S),b)}function x(S,R){const C=t.sliceStream(S);if(R&&C.push(null),S.previous=i,i&&(i.next=S),i=S,o.defineSkip(S.start),o.write(C),t.parser.lazy[S.start.line]){let P=o.events.length;for(;P--;)if(o.events[P][1].start.offset<s&&(!o.events[P][1].end||o.events[P][1].end.offset>s))return;const A=t.events.length;let k=A,D,I;for(;k--;)if(t.events[k][0]==="exit"&&t.events[k][1].type==="chunkFlow"){if(D){I=t.events[k][1].end;break}D=!0}for(w(r),P=A;P<t.events.length;)t.events[P][1].end=Object.assign({},I),P++;Ei(t.events,k+1,0,t.events.slice(A)),t.events.length=P}}function w(S){let R=n.length;for(;R-- >S;){const C=n[R];t.containerState=C[1],C[0].exit.call(t,e)}n.length=S}function _(){o.write([null]),i=void 0,o=void 0,t.containerState._closeFlow=void 0}}function lue(e,t,n){return sn(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function MT(e){if(e===null||Fr(e)||rue(e))return 1;if(nue(e))return 2}function z_(e,t,n){const r=[];let o=-1;for(;++o<e.length;){const i=e[o].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const Jx={name:"attention",tokenize:uue,resolveAll:cue};function cue(e,t){let n=-1,r,o,i,s,a,l,c,u;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f=Object.assign({},e[r][1].end),h=Object.assign({},e[n][1].start);IT(f,-l),IT(h,l),s={type:l>1?"strongSequence":"emphasisSequence",start:f,end:Object.assign({},e[r][1].end)},a={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},e[n][1].start),end:h},i={type:l>1?"strongText":"emphasisText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o={type:l>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},a.end)},e[r][1].end=Object.assign({},s.start),e[n][1].start=Object.assign({},a.end),c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=To(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=To(c,[["enter",o,t],["enter",s,t],["exit",s,t],["enter",i,t]]),c=To(c,z_(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=To(c,[["exit",i,t],["enter",a,t],["exit",a,t],["exit",o,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,c=To(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,Ei(e,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function uue(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=MT(r);let i;return s;function s(l){return i=l,e.enter("attentionSequence"),a(l)}function a(l){if(l===i)return e.consume(l),a;const c=e.exit("attentionSequence"),u=MT(l),f=!u||u===2&&o||n.includes(l),h=!o||o===2&&u||n.includes(r);return c._open=!!(i===42?f:f&&(o||!h)),c._close=!!(i===42?h:h&&(u||!f)),t(l)}}function IT(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const due={name:"autolink",tokenize:fue};function fue(e,t,n){let r=0;return o;function o(g){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(g),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(g){return vi(g)?(e.consume(g),s):c(g)}function s(g){return g===43||g===45||g===46||oo(g)?(r=1,a(g)):c(g)}function a(g){return g===58?(e.consume(g),r=0,l):(g===43||g===45||g===46||oo(g))&&r++<32?(e.consume(g),a):(r=0,c(g))}function l(g){return g===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(g),e.exit("autolinkMarker"),e.exit("autolink"),t):g===null||g===32||g===60||Xx(g)?n(g):(e.consume(g),l)}function c(g){return g===64?(e.consume(g),u):eue(g)?(e.consume(g),c):n(g)}function u(g){return oo(g)?f(g):n(g)}function f(g){return g===46?(e.consume(g),r=0,u):g===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(g),e.exit("autolinkMarker"),e.exit("autolink"),t):h(g)}function h(g){if((g===45||oo(g))&&r++<63){const v=g===45?h:f;return e.consume(g),v}return n(g)}}const ev={tokenize:hue,partial:!0};function hue(e,t,n){return r;function r(i){return Vt(i)?sn(e,o,"linePrefix")(i):o(i)}function o(i){return i===null||ot(i)?t(i):n(i)}}const XI={name:"blockQuote",tokenize:pue,continuation:{tokenize:gue},exit:mue};function pue(e,t,n){const r=this;return o;function o(s){if(s===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(s),e.exit("blockQuoteMarker"),i}return n(s)}function i(s){return Vt(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function gue(e,t,n){const r=this;return o;function o(s){return Vt(s)?sn(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(XI,t,n)(s)}}function mue(e){e.exit("blockQuote")}const QI={name:"characterEscape",tokenize:vue};function vue(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),o}function o(i){return KI(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const JI={name:"characterReference",tokenize:bue};function bue(e,t,n){const r=this;let o=0,i,s;return a;function a(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),l}function l(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),i=31,s=oo,u(f))}function c(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=tue,u):(e.enter("characterReferenceValue"),i=7,s=Qx,u(f))}function u(f){if(f===59&&o){const h=e.exit("characterReferenceValue");return s===oo&&!j_(r.sliceSerialize(h))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(f)&&o++<i?(e.consume(f),u):n(f)}}const NT={tokenize:xue,partial:!0},LT={name:"codeFenced",tokenize:yue,concrete:!0};function yue(e,t,n){const r=this,o={tokenize:C,partial:!0};let i=0,s=0,a;return l;function l(P){return c(P)}function c(P){const A=r.events[r.events.length-1];return i=A&&A[1].type==="linePrefix"?A[2].sliceSerialize(A[1],!0).length:0,a=P,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(P)}function u(P){return P===a?(s++,e.consume(P),u):s<3?n(P):(e.exit("codeFencedFenceSequence"),Vt(P)?sn(e,f,"whitespace")(P):f(P))}function f(P){return P===null||ot(P)?(e.exit("codeFencedFence"),r.interrupt?t(P):e.check(NT,b,R)(P)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(P))}function h(P){return P===null||ot(P)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(P)):Vt(P)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),sn(e,g,"whitespace")(P)):P===96&&P===a?n(P):(e.consume(P),h)}function g(P){return P===null||ot(P)?f(P):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),v(P))}function v(P){return P===null||ot(P)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(P)):P===96&&P===a?n(P):(e.consume(P),v)}function b(P){return e.attempt(o,R,x)(P)}function x(P){return e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),w}function w(P){return i>0&&Vt(P)?sn(e,_,"linePrefix",i+1)(P):_(P)}function _(P){return P===null||ot(P)?e.check(NT,b,R)(P):(e.enter("codeFlowValue"),S(P))}function S(P){return P===null||ot(P)?(e.exit("codeFlowValue"),_(P)):(e.consume(P),S)}function R(P){return e.exit("codeFenced"),t(P)}function C(P,A,k){let D=0;return I;function I(z){return P.enter("lineEnding"),P.consume(z),P.exit("lineEnding"),F}function F(z){return P.enter("codeFencedFence"),Vt(z)?sn(P,B,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):B(z)}function B(z){return z===a?(P.enter("codeFencedFenceSequence"),K(z)):k(z)}function K(z){return z===a?(D++,P.consume(z),K):D>=s?(P.exit("codeFencedFenceSequence"),Vt(z)?sn(P,Z,"whitespace")(z):Z(z)):k(z)}function Z(z){return z===null||ot(z)?(P.exit("codeFencedFence"),A(z)):k(z)}}}function xue(e,t,n){const r=this;return o;function o(s){return s===null?n(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}const Vy={name:"codeIndented",tokenize:_ue},wue={tokenize:Sue,partial:!0};function _ue(e,t,n){const r=this;return o;function o(c){return e.enter("codeIndented"),sn(e,i,"linePrefix",5)(c)}function i(c){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?s(c):n(c)}function s(c){return c===null?l(c):ot(c)?e.attempt(wue,s,l)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||ot(c)?(e.exit("codeFlowValue"),s(c)):(e.consume(c),a)}function l(c){return e.exit("codeIndented"),t(c)}}function Sue(e,t,n){const r=this;return o;function o(s){return r.parser.lazy[r.now().line]?n(s):ot(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),o):sn(e,i,"linePrefix",5)(s)}function i(s){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(s):ot(s)?o(s):n(s)}}const Cue={name:"codeText",tokenize:Oue,resolve:Eue,previous:Rue};function Eue(e){let t=e.length-4,n=3,r,o;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)o===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(o=r):(r===t||e[r][1].type==="lineEnding")&&(e[o][1].type="codeTextData",r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),t-=r-o-2,r=o+2),o=void 0);return e}function Rue(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Oue(e,t,n){let r=0,o,i;return s;function s(f){return e.enter("codeText"),e.enter("codeTextSequence"),a(f)}function a(f){return f===96?(e.consume(f),r++,a):(e.exit("codeTextSequence"),l(f))}function l(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),l):f===96?(i=e.enter("codeTextSequence"),o=0,u(f)):ot(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(f))}function c(f){return f===null||f===32||f===96||ot(f)?(e.exit("codeTextData"),l(f)):(e.consume(f),c)}function u(f){return f===96?(e.consume(f),o++,u):o===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(i.type="codeTextData",c(f))}}function ZI(e){const t={};let n=-1,r,o,i,s,a,l,c;for(;++n<e.length;){for(;n in t;)n=t[n];if(r=e[n],n&&r[1].type==="chunkFlow"&&e[n-1][1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,Pue(e,n)),n=t[n],c=!0);else if(r[1]._container){for(i=n,o=void 0;i--&&(s=e[i],s[1].type==="lineEnding"||s[1].type==="lineEndingBlank");)s[0]==="enter"&&(o&&(e[o][1].type="lineEndingBlank"),s[1].type="lineEnding",o=i);o&&(r[1].end=Object.assign({},e[o][1].start),a=e.slice(o,n),a.unshift(r),Ei(e,o,n-o+1,a))}}return!c}function Pue(e,t){const n=e[t][1],r=e[t][2];let o=t-1;const i=[],s=n._tokenizer||r.parser[n.contentType](n.start),a=s.events,l=[],c={};let u,f,h=-1,g=n,v=0,b=0;const x=[b];for(;g;){for(;e[++o][1]!==g;);i.push(o),g._tokenizer||(u=r.sliceStream(g),g.next||u.push(null),f&&s.defineSkip(g.start),g._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(u),g._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=void 0)),f=g,g=g.next}for(g=n;++h<a.length;)a[h][0]==="exit"&&a[h-1][0]==="enter"&&a[h][1].type===a[h-1][1].type&&a[h][1].start.line!==a[h][1].end.line&&(b=h+1,x.push(b),g._tokenizer=void 0,g.previous=void 0,g=g.next);for(s.events=[],g?(g._tokenizer=void 0,g.previous=void 0):x.pop(),h=x.length;h--;){const w=a.slice(x[h],x[h+1]),_=i.pop();l.unshift([_,_+w.length-1]),Ei(e,_,2,w)}for(h=-1;++h<l.length;)c[v+l[h][0]]=v+l[h][1],v+=l[h][1]-l[h][0]-1;return c}const Tue={tokenize:Aue,resolve:$ue},Due={tokenize:kue,partial:!0};function $ue(e){return ZI(e),e}function Aue(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),o(a)}function o(a){return a===null?i(a):ot(a)?e.check(Due,s,i)(a):(e.consume(a),o)}function i(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function s(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}function kue(e,t,n){const r=this;return o;function o(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),sn(e,i,"linePrefix")}function i(s){if(s===null||ot(s))return n(s);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(s):e.interrupt(r.parser.constructs.flow,n,t)(s)}}function eN(e,t,n,r,o,i,s,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return f;function f(w){return w===60?(e.enter(r),e.enter(o),e.enter(i),e.consume(w),e.exit(i),h):w===null||w===32||w===41||Xx(w)?n(w):(e.enter(r),e.enter(s),e.enter(a),e.enter("chunkString",{contentType:"string"}),b(w))}function h(w){return w===62?(e.enter(i),e.consume(w),e.exit(i),e.exit(o),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),g(w))}function g(w){return w===62?(e.exit("chunkString"),e.exit(a),h(w)):w===null||w===60||ot(w)?n(w):(e.consume(w),w===92?v:g)}function v(w){return w===60||w===62||w===92?(e.consume(w),g):g(w)}function b(w){return!u&&(w===null||w===41||Fr(w))?(e.exit("chunkString"),e.exit(a),e.exit(s),e.exit(r),t(w)):u<c&&w===40?(e.consume(w),u++,b):w===41?(e.consume(w),u--,b):w===null||w===32||w===40||Xx(w)?n(w):(e.consume(w),w===92?x:b)}function x(w){return w===40||w===41||w===92?(e.consume(w),b):b(w)}}function tN(e,t,n,r,o,i){const s=this;let a=0,l;return c;function c(g){return e.enter(r),e.enter(o),e.consume(g),e.exit(o),e.enter(i),u}function u(g){return a>999||g===null||g===91||g===93&&!l||g===94&&!a&&"_hiddenFootnoteSupport"in s.parser.constructs?n(g):g===93?(e.exit(i),e.enter(o),e.consume(g),e.exit(o),e.exit(r),t):ot(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),f(g))}function f(g){return g===null||g===91||g===93||ot(g)||a++>999?(e.exit("chunkString"),u(g)):(e.consume(g),l||(l=!Vt(g)),g===92?h:f)}function h(g){return g===91||g===92||g===93?(e.consume(g),a++,f):f(g)}}function nN(e,t,n,r,o,i){let s;return a;function a(h){return h===34||h===39||h===40?(e.enter(r),e.enter(o),e.consume(h),e.exit(o),s=h===40?41:h,l):n(h)}function l(h){return h===s?(e.enter(o),e.consume(h),e.exit(o),e.exit(r),t):(e.enter(i),c(h))}function c(h){return h===s?(e.exit(i),l(s)):h===null?n(h):ot(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),sn(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(h))}function u(h){return h===s||h===null||ot(h)?(e.exit("chunkString"),c(h)):(e.consume(h),h===92?f:u)}function f(h){return h===s||h===92?(e.consume(h),u):u(h)}}function _d(e,t){let n;return r;function r(o){return ot(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):Vt(o)?sn(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}const Mue={name:"definition",tokenize:Nue},Iue={tokenize:Lue,partial:!0};function Nue(e,t,n){const r=this;let o;return i;function i(g){return e.enter("definition"),s(g)}function s(g){return tN.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(g)}function a(g){return o=_c(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),g===58?(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),l):n(g)}function l(g){return Fr(g)?_d(e,c)(g):c(g)}function c(g){return eN(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(g)}function u(g){return e.attempt(Iue,f,f)(g)}function f(g){return Vt(g)?sn(e,h,"whitespace")(g):h(g)}function h(g){return g===null||ot(g)?(e.exit("definition"),r.parser.defined.push(o),t(g)):n(g)}}function Lue(e,t,n){return r;function r(a){return Fr(a)?_d(e,o)(a):n(a)}function o(a){return nN(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return Vt(a)?sn(e,s,"whitespace")(a):s(a)}function s(a){return a===null||ot(a)?t(a):n(a)}}const Fue={name:"hardBreakEscape",tokenize:jue};function jue(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),o}function o(i){return ot(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const zue={name:"headingAtx",tokenize:Vue,resolve:Bue};function Bue(e,t){let n=e.length-2,r=3,o,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(o={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Ei(e,r,n-r+1,[["enter",o,t],["enter",i,t],["exit",i,t],["exit",o,t]])),e}function Vue(e,t,n){let r=0;return o;function o(u){return e.enter("atxHeading"),i(u)}function i(u){return e.enter("atxHeadingSequence"),s(u)}function s(u){return u===35&&r++<6?(e.consume(u),s):u===null||Fr(u)?(e.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||ot(u)?(e.exit("atxHeading"),t(u)):Vt(u)?sn(e,a,"whitespace")(u):(e.enter("atxHeadingText"),c(u))}function l(u){return u===35?(e.consume(u),l):(e.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||Fr(u)?(e.exit("atxHeadingText"),a(u)):(e.consume(u),c)}}const Hue=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],FT=["pre","script","style","textarea"],Wue={name:"htmlFlow",tokenize:Yue,resolveTo:Gue,concrete:!0},Uue={tokenize:Xue,partial:!0},que={tokenize:Kue,partial:!0};function Gue(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Yue(e,t,n){const r=this;let o,i,s,a,l;return c;function c(N){return u(N)}function u(N){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(N),f}function f(N){return N===33?(e.consume(N),h):N===47?(e.consume(N),i=!0,b):N===63?(e.consume(N),o=3,r.interrupt?t:$):vi(N)?(e.consume(N),s=String.fromCharCode(N),x):n(N)}function h(N){return N===45?(e.consume(N),o=2,g):N===91?(e.consume(N),o=5,a=0,v):vi(N)?(e.consume(N),o=4,r.interrupt?t:$):n(N)}function g(N){return N===45?(e.consume(N),r.interrupt?t:$):n(N)}function v(N){const ce="CDATA[";return N===ce.charCodeAt(a++)?(e.consume(N),a===ce.length?r.interrupt?t:B:v):n(N)}function b(N){return vi(N)?(e.consume(N),s=String.fromCharCode(N),x):n(N)}function x(N){if(N===null||N===47||N===62||Fr(N)){const ce=N===47,le=s.toLowerCase();return!ce&&!i&&FT.includes(le)?(o=1,r.interrupt?t(N):B(N)):Hue.includes(s.toLowerCase())?(o=6,ce?(e.consume(N),w):r.interrupt?t(N):B(N)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(N):i?_(N):S(N))}return N===45||oo(N)?(e.consume(N),s+=String.fromCharCode(N),x):n(N)}function w(N){return N===62?(e.consume(N),r.interrupt?t:B):n(N)}function _(N){return Vt(N)?(e.consume(N),_):I(N)}function S(N){return N===47?(e.consume(N),I):N===58||N===95||vi(N)?(e.consume(N),R):Vt(N)?(e.consume(N),S):I(N)}function R(N){return N===45||N===46||N===58||N===95||oo(N)?(e.consume(N),R):C(N)}function C(N){return N===61?(e.consume(N),P):Vt(N)?(e.consume(N),C):S(N)}function P(N){return N===null||N===60||N===61||N===62||N===96?n(N):N===34||N===39?(e.consume(N),l=N,A):Vt(N)?(e.consume(N),P):k(N)}function A(N){return N===l?(e.consume(N),l=null,D):N===null||ot(N)?n(N):(e.consume(N),A)}function k(N){return N===null||N===34||N===39||N===47||N===60||N===61||N===62||N===96||Fr(N)?C(N):(e.consume(N),k)}function D(N){return N===47||N===62||Vt(N)?S(N):n(N)}function I(N){return N===62?(e.consume(N),F):n(N)}function F(N){return N===null||ot(N)?B(N):Vt(N)?(e.consume(N),F):n(N)}function B(N){return N===45&&o===2?(e.consume(N),Q):N===60&&o===1?(e.consume(N),W):N===62&&o===4?(e.consume(N),H):N===63&&o===3?(e.consume(N),$):N===93&&o===5?(e.consume(N),oe):ot(N)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(Uue,J,K)(N)):N===null||ot(N)?(e.exit("htmlFlowData"),K(N)):(e.consume(N),B)}function K(N){return e.check(que,Z,J)(N)}function Z(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),z}function z(N){return N===null||ot(N)?K(N):(e.enter("htmlFlowData"),B(N))}function Q(N){return N===45?(e.consume(N),$):B(N)}function W(N){return N===47?(e.consume(N),s="",Y):B(N)}function Y(N){if(N===62){const ce=s.toLowerCase();return FT.includes(ce)?(e.consume(N),H):B(N)}return vi(N)&&s.length<8?(e.consume(N),s+=String.fromCharCode(N),Y):B(N)}function oe(N){return N===93?(e.consume(N),$):B(N)}function $(N){return N===62?(e.consume(N),H):N===45&&o===2?(e.consume(N),$):B(N)}function H(N){return N===null||ot(N)?(e.exit("htmlFlowData"),J(N)):(e.consume(N),H)}function J(N){return e.exit("htmlFlow"),t(N)}}function Kue(e,t,n){const r=this;return o;function o(s){return ot(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):n(s)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function Xue(e,t,n){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(ev,t,n)}}const Que={name:"htmlText",tokenize:Jue};function Jue(e,t,n){const r=this;let o,i,s;return a;function a($){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume($),l}function l($){return $===33?(e.consume($),c):$===47?(e.consume($),C):$===63?(e.consume($),S):vi($)?(e.consume($),k):n($)}function c($){return $===45?(e.consume($),u):$===91?(e.consume($),i=0,v):vi($)?(e.consume($),_):n($)}function u($){return $===45?(e.consume($),g):n($)}function f($){return $===null?n($):$===45?(e.consume($),h):ot($)?(s=f,W($)):(e.consume($),f)}function h($){return $===45?(e.consume($),g):f($)}function g($){return $===62?Q($):$===45?h($):f($)}function v($){const H="CDATA[";return $===H.charCodeAt(i++)?(e.consume($),i===H.length?b:v):n($)}function b($){return $===null?n($):$===93?(e.consume($),x):ot($)?(s=b,W($)):(e.consume($),b)}function x($){return $===93?(e.consume($),w):b($)}function w($){return $===62?Q($):$===93?(e.consume($),w):b($)}function _($){return $===null||$===62?Q($):ot($)?(s=_,W($)):(e.consume($),_)}function S($){return $===null?n($):$===63?(e.consume($),R):ot($)?(s=S,W($)):(e.consume($),S)}function R($){return $===62?Q($):S($)}function C($){return vi($)?(e.consume($),P):n($)}function P($){return $===45||oo($)?(e.consume($),P):A($)}function A($){return ot($)?(s=A,W($)):Vt($)?(e.consume($),A):Q($)}function k($){return $===45||oo($)?(e.consume($),k):$===47||$===62||Fr($)?D($):n($)}function D($){return $===47?(e.consume($),Q):$===58||$===95||vi($)?(e.consume($),I):ot($)?(s=D,W($)):Vt($)?(e.consume($),D):Q($)}function I($){return $===45||$===46||$===58||$===95||oo($)?(e.consume($),I):F($)}function F($){return $===61?(e.consume($),B):ot($)?(s=F,W($)):Vt($)?(e.consume($),F):D($)}function B($){return $===null||$===60||$===61||$===62||$===96?n($):$===34||$===39?(e.consume($),o=$,K):ot($)?(s=B,W($)):Vt($)?(e.consume($),B):(e.consume($),Z)}function K($){return $===o?(e.consume($),o=void 0,z):$===null?n($):ot($)?(s=K,W($)):(e.consume($),K)}function Z($){return $===null||$===34||$===39||$===60||$===61||$===96?n($):$===47||$===62||Fr($)?D($):(e.consume($),Z)}function z($){return $===47||$===62||Fr($)?D($):n($)}function Q($){return $===62?(e.consume($),e.exit("htmlTextData"),e.exit("htmlText"),t):n($)}function W($){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume($),e.exit("lineEnding"),Y}function Y($){return Vt($)?sn(e,oe,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):oe($)}function oe($){return e.enter("htmlTextData"),s($)}}const B_={name:"labelEnd",tokenize:ode,resolveTo:rde,resolveAll:nde},Zue={tokenize:ide},ede={tokenize:sde},tde={tokenize:ade};function nde(e){let t=-1;for(;++t<e.length;){const n=e[t][1];(n.type==="labelImage"||n.type==="labelLink"||n.type==="labelEnd")&&(e.splice(t+1,n.type==="labelImage"?4:2),n.type="data",t++)}return e}function rde(e,t){let n=e.length,r=0,o,i,s,a;for(;n--;)if(o=e[n][1],i){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[n][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(i=n,o.type!=="labelLink")){r=2;break}}else o.type==="labelEnd"&&(s=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:Object.assign({},e[i][1].start),end:Object.assign({},e[e.length-1][1].end)},c={type:"label",start:Object.assign({},e[i][1].start),end:Object.assign({},e[s][1].end)},u={type:"labelText",start:Object.assign({},e[i+r+2][1].end),end:Object.assign({},e[s-2][1].start)};return a=[["enter",l,t],["enter",c,t]],a=To(a,e.slice(i+1,i+r+3)),a=To(a,[["enter",u,t]]),a=To(a,z_(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),a=To(a,[["exit",u,t],e[s-2],e[s-1],["exit",c,t]]),a=To(a,e.slice(s+1)),a=To(a,[["exit",l,t]]),Ei(e,i,e.length,a),e}function ode(e,t,n){const r=this;let o=r.events.length,i,s;for(;o--;)if((r.events[o][1].type==="labelImage"||r.events[o][1].type==="labelLink")&&!r.events[o][1]._balanced){i=r.events[o][1];break}return a;function a(h){return i?i._inactive?f(h):(s=r.parser.defined.includes(_c(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),l):n(h)}function l(h){return h===40?e.attempt(Zue,u,s?u:f)(h):h===91?e.attempt(ede,u,s?c:f)(h):s?u(h):f(h)}function c(h){return e.attempt(tde,u,f)(h)}function u(h){return t(h)}function f(h){return i._balanced=!0,n(h)}}function ide(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),o}function o(f){return Fr(f)?_d(e,i)(f):i(f)}function i(f){return f===41?u(f):eN(e,s,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function s(f){return Fr(f)?_d(e,l)(f):u(f)}function a(f){return n(f)}function l(f){return f===34||f===39||f===40?nN(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):u(f)}function c(f){return Fr(f)?_d(e,u)(f):u(f)}function u(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function sde(e,t,n){const r=this;return o;function o(a){return tN.call(r,e,i,s,"reference","referenceMarker","referenceString")(a)}function i(a){return r.parser.defined.includes(_c(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function s(a){return n(a)}}function ade(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),o}function o(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const lde={name:"labelStartImage",tokenize:cde,resolveAll:B_.resolveAll};function cde(e,t,n){const r=this;return o;function o(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),i}function i(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),s):n(a)}function s(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const ude={name:"labelStartLink",tokenize:dde,resolveAll:B_.resolveAll};function dde(e,t,n){const r=this;return o;function o(s){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelLink"),i}function i(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const Hy={name:"lineEnding",tokenize:fde};function fde(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),sn(e,t,"linePrefix")}}const ag={name:"thematicBreak",tokenize:hde};function hde(e,t,n){let r=0,o;return i;function i(c){return e.enter("thematicBreak"),s(c)}function s(c){return o=c,a(c)}function a(c){return c===o?(e.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||ot(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===o?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),Vt(c)?sn(e,a,"whitespace")(c):a(c))}}const Tr={name:"list",tokenize:mde,continuation:{tokenize:vde},exit:yde},pde={tokenize:xde,partial:!0},gde={tokenize:bde,partial:!0};function mde(e,t,n){const r=this,o=r.events[r.events.length-1];let i=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,s=0;return a;function a(g){const v=r.containerState.type||(g===42||g===43||g===45?"listUnordered":"listOrdered");if(v==="listUnordered"?!r.containerState.marker||g===r.containerState.marker:Qx(g)){if(r.containerState.type||(r.containerState.type=v,e.enter(v,{_container:!0})),v==="listUnordered")return e.enter("listItemPrefix"),g===42||g===45?e.check(ag,n,c)(g):c(g);if(!r.interrupt||g===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(g)}return n(g)}function l(g){return Qx(g)&&++s<10?(e.consume(g),l):(!r.interrupt||s<2)&&(r.containerState.marker?g===r.containerState.marker:g===41||g===46)?(e.exit("listItemValue"),c(g)):n(g)}function c(g){return e.enter("listItemMarker"),e.consume(g),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||g,e.check(ev,r.interrupt?n:u,e.attempt(pde,h,f))}function u(g){return r.containerState.initialBlankLine=!0,i++,h(g)}function f(g){return Vt(g)?(e.enter("listItemPrefixWhitespace"),e.consume(g),e.exit("listItemPrefixWhitespace"),h):n(g)}function h(g){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(g)}}function vde(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(ev,o,i);function o(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,sn(e,t,"listItemIndent",r.containerState.size+1)(a)}function i(a){return r.containerState.furtherBlankLines||!Vt(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(gde,t,s)(a))}function s(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,sn(e,e.attempt(Tr,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function bde(e,t,n){const r=this;return sn(e,o,"listItemIndent",r.containerState.size+1);function o(i){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(i):n(i)}}function yde(e){e.exit(this.containerState.type)}function xde(e,t,n){const r=this;return sn(e,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(i){const s=r.events[r.events.length-1];return!Vt(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const jT={name:"setextUnderline",tokenize:_de,resolveTo:wde};function wde(e,t){let n=e.length,r,o,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(o=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const s={type:"setextHeading",start:Object.assign({},e[o][1].start),end:Object.assign({},e[e.length-1][1].end)};return e[o][1].type="setextHeadingText",i?(e.splice(o,0,["enter",s,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end=Object.assign({},e[i][1].end)):e[r][1]=s,e.push(["exit",s,t]),e}function _de(e,t,n){const r=this;let o;return i;function i(c){let u=r.events.length,f;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){f=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),o=c,s(c)):n(c)}function s(c){return e.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===o?(e.consume(c),a):(e.exit("setextHeadingLineSequence"),Vt(c)?sn(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||ot(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const Sde={tokenize:Cde};function Cde(e){const t=this,n=e.attempt(ev,r,e.attempt(this.parser.constructs.flowInitial,o,sn(e,e.attempt(this.parser.constructs.flow,o,e.attempt(Tue,o)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function o(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const Ede={resolveAll:oN()},Rde=rN("string"),Ode=rN("text");function rN(e){return{tokenize:t,resolveAll:oN(e==="text"?Pde:void 0)};function t(n){const r=this,o=this.parser.constructs[e],i=n.attempt(o,s,a);return s;function s(u){return c(u)?i(u):a(u)}function a(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),l}function l(u){return c(u)?(n.exit("data"),i(u)):(n.consume(u),l)}function c(u){if(u===null)return!0;const f=o[u];let h=-1;if(f)for(;++h<f.length;){const g=f[h];if(!g.previous||g.previous.call(r,r.previous))return!0}return!1}}}function oN(e){return t;function t(n,r){let o=-1,i;for(;++o<=n.length;)i===void 0?n[o]&&n[o][1].type==="data"&&(i=o,o++):(!n[o]||n[o][1].type!=="data")&&(o!==i+2&&(n[i][1].end=n[o-1][1].end,n.splice(i+2,o-i-2),o=i+2),i=void 0);return e?e(n,r):n}}function Pde(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],o=t.sliceStream(r);let i=o.length,s=-1,a=0,l;for(;i--;){const c=o[i];if(typeof c=="string"){for(s=c.length;c.charCodeAt(s-1)===32;)a++,s--;if(s)break;s=-1}else if(c===-2)l=!0,a++;else if(c!==-1){i++;break}}if(a){const c={type:n===e.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{line:r.end.line,column:r.end.column-a,offset:r.end.offset-a,_index:r.start._index+i,_bufferIndex:i?s:r.start._bufferIndex+s},end:Object.assign({},r.end)};r.end=Object.assign({},c.start),r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}function Tde(e,t,n){let r=Object.assign(n?Object.assign({},n):{line:1,column:1,offset:0},{_index:0,_bufferIndex:-1});const o={},i=[];let s=[],a=[];const l={consume:_,enter:S,exit:R,attempt:A(C),check:A(P),interrupt:A(P,{interrupt:!0})},c={previous:null,code:null,containerState:{},events:[],parser:e,sliceStream:g,sliceSerialize:h,now:v,defineSkip:b,write:f};let u=t.tokenize.call(c,l);return t.resolveAll&&i.push(t),c;function f(F){return s=To(s,F),x(),s[s.length-1]!==null?[]:(k(t,0),c.events=z_(i,c.events,c),c.events)}function h(F,B){return $de(g(F),B)}function g(F){return Dde(s,F)}function v(){const{line:F,column:B,offset:K,_index:Z,_bufferIndex:z}=r;return{line:F,column:B,offset:K,_index:Z,_bufferIndex:z}}function b(F){o[F.line]=F.column,I()}function x(){let F;for(;r._index<s.length;){const B=s[r._index];if(typeof B=="string")for(F=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===F&&r._bufferIndex<B.length;)w(B.charCodeAt(r._bufferIndex));else w(B)}}function w(F){u=u(F)}function _(F){ot(F)?(r.line++,r.column=1,r.offset+=F===-3?2:1,I()):F!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=F}function S(F,B){const K=B||{};return K.type=F,K.start=v(),c.events.push(["enter",K,c]),a.push(K),K}function R(F){const B=a.pop();return B.end=v(),c.events.push(["exit",B,c]),B}function C(F,B){k(F,B.from)}function P(F,B){B.restore()}function A(F,B){return K;function K(Z,z,Q){let W,Y,oe,$;return Array.isArray(Z)?J(Z):"tokenize"in Z?J([Z]):H(Z);function H(de){return pe;function pe(ie){const te=ie!==null&&de[ie],ae=ie!==null&&de.null,ye=[...Array.isArray(te)?te:te?[te]:[],...Array.isArray(ae)?ae:ae?[ae]:[]];return J(ye)(ie)}}function J(de){return W=de,Y=0,de.length===0?Q:N(de[Y])}function N(de){return pe;function pe(ie){return $=D(),oe=de,de.partial||(c.currentConstruct=de),de.name&&c.parser.constructs.disable.null.includes(de.name)?le():de.tokenize.call(B?Object.assign(Object.create(c),B):c,l,ce,le)(ie)}}function ce(de){return F(oe,$),z}function le(de){return $.restore(),++Y<W.length?N(W[Y]):Q}}}function k(F,B){F.resolveAll&&!i.includes(F)&&i.push(F),F.resolve&&Ei(c.events,B,c.events.length-B,F.resolve(c.events.slice(B),c)),F.resolveTo&&(c.events=F.resolveTo(c.events,c))}function D(){const F=v(),B=c.previous,K=c.currentConstruct,Z=c.events.length,z=Array.from(a);return{restore:Q,from:Z};function Q(){r=F,c.previous=B,c.currentConstruct=K,c.events.length=Z,a=z,I()}}function I(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function Dde(e,t){const n=t.start._index,r=t.start._bufferIndex,o=t.end._index,i=t.end._bufferIndex;let s;if(n===o)s=[e[n].slice(r,i)];else{if(s=e.slice(n,o),r>-1){const a=s[0];typeof a=="string"?s[0]=a.slice(r):s.shift()}i>0&&s.push(e[o].slice(0,i))}return s}function $de(e,t){let n=-1;const r=[];let o;for(;++n<e.length;){const i=e[n];let s;if(typeof i=="string")s=i;else switch(i){case-5:{s="\r";break}case-4:{s=`
|