react-semaphor 0.0.322 → 0.0.323

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.
@@ -88,7 +88,7 @@ __p += '`),kt&&(Se+=`' +
88
88
  function print() { __p += __j.call(arguments, '') }
89
89
  `:`;
90
90
  `)+Se+`return __p
91
- }`;var gt=$T(function(){return Vt(V,He+"return "+Se).apply(n,X)});if(gt.source=Se,Jv(gt))throw gt;return gt}function dq(f){return qt(f).toLowerCase()}function fq(f){return qt(f).toUpperCase()}function hq(f,g,w){if(f=qt(f),f&&(w||g===n))return Y2(f);if(!f||!(g=Si(g)))return f;var T=po(f),k=po(g),V=K2(T,k),X=X2(T,k)+1;return ha(T,V,X).join("")}function pq(f,g,w){if(f=qt(f),f&&(w||g===n))return f.slice(0,J2(f)+1);if(!f||!(g=Si(g)))return f;var T=po(f),k=X2(T,po(g))+1;return ha(T,0,k).join("")}function gq(f,g,w){if(f=qt(f),f&&(w||g===n))return f.replace(mn,"");if(!f||!(g=Si(g)))return f;var T=po(f),k=K2(T,po(g));return ha(T,k).join("")}function mq(f,g){var w=j,T=F;if(Pn(g)){var k="separator"in g?g.separator:k;w="length"in g?ut(g.length):w,T="omission"in g?Si(g.omission):T}f=qt(f);var V=f.length;if(Hc(f)){var X=po(f);V=X.length}if(w>=V)return f;var re=w-Vc(T);if(re<1)return T;var ue=X?ha(X,0,re).join(""):f.slice(0,re);if(k===n)return ue+T;if(X&&(re+=ue.length-re),Zv(k)){if(f.slice(re).search(k)){var ye,xe=ue;for(k.global||(k=gv(k.source,qt(jt.exec(k))+"g")),k.lastIndex=0;ye=k.exec(xe);)var Se=ye.index;ue=ue.slice(0,Se===n?re:Se)}}else if(f.indexOf(Si(k),re)!=re){var Ie=ue.lastIndexOf(k);Ie>-1&&(ue=ue.slice(0,Ie))}return ue+T}function bq(f){return f=qt(f),f&&kr.test(f)?f.replace(Lo,GB):f}var yq=Xc(function(f,g,w){return f+(w?" ":"")+g.toUpperCase()}),nx=zP("toUpperCase");function jT(f,g,w){return f=qt(f),g=w?n:g,g===n?BB(f)?KB(f):AB(f):f.match(g)||[]}var $T=wt(function(f,g){try{return xi(f,n,g)}catch(w){return Jv(w)?w:new ot(w)}}),vq=Es(function(f,g){return Ui(g,function(w){w=$o(w),_s(f,w,Xv(f[w],f))}),f});function xq(f){var g=f==null?0:f.length,w=We();return f=g?Rn(f,function(T){if(typeof T[1]!="function")throw new Gi(s);return[w(T[0]),T[1]]}):[],wt(function(T){for(var k=-1;++k<g;){var V=f[k];if(xi(V[0],this,T))return xi(V[1],this,T)}})}function wq(f){return GH(Yi(f,d))}function rx(f){return function(){return f}}function Sq(f,g){return f==null||f!==f?g:f}var _q=HP(),Cq=HP(!0);function ni(f){return f}function ix(f){return yP(typeof f=="function"?f:Yi(f,d))}function Eq(f){return xP(Yi(f,d))}function Rq(f,g){return wP(f,Yi(g,d))}var Pq=wt(function(f,g){return function(w){return Kd(w,f,g)}}),Tq=wt(function(f,g){return function(w){return Kd(f,w,g)}});function ox(f,g,w){var T=ir(g),k=bg(g,T);w==null&&!(Pn(g)&&(k.length||!T.length))&&(w=g,g=f,f=this,k=bg(g,ir(g)));var V=!(Pn(w)&&"chain"in w)||!!w.chain,X=Ps(f);return Ui(k,function(re){var ue=g[re];f[re]=ue,X&&(f.prototype[re]=function(){var ye=this.__chain__;if(V||ye){var xe=f(this.__wrapped__),Se=xe.__actions__=Zr(this.__actions__);return Se.push({func:ue,args:arguments,thisArg:f}),xe.__chain__=ye,xe}return ue.apply(f,aa([this.value()],arguments))})}),f}function Mq(){return dr._===this&&(dr._=tH),this}function sx(){}function Oq(f){return f=ut(f),wt(function(g){return SP(g,f)})}var Dq=Fv(Rn),Aq=Fv(V2),Iq=Fv(lv);function zT(f){return Wv(f)?cv($o(f)):cV(f)}function kq(f){return function(g){return f==null?n:hl(f,g)}}var Nq=WP(),Lq=WP(!0);function ax(){return[]}function lx(){return!1}function Fq(){return{}}function jq(){return""}function $q(){return!0}function zq(f,g){if(f=ut(f),f<1||f>U)return[];var w=Q,T=xr(f,Q);g=We(g),f-=Q;for(var k=fv(T,g);++w<f;)g(w);return k}function Bq(f){return at(f)?Rn(f,$o):_i(f)?[f]:Zr(sT(qt(f)))}function Hq(f){var g=++ZB;return qt(f)+g}var Vq=_g(function(f,g){return f+g},0),Wq=jv("ceil"),Uq=_g(function(f,g){return f/g},1),Gq=jv("floor");function qq(f){return f&&f.length?mg(f,ni,_v):n}function Yq(f,g){return f&&f.length?mg(f,We(g,2),_v):n}function Kq(f){return G2(f,ni)}function Xq(f,g){return G2(f,We(g,2))}function Qq(f){return f&&f.length?mg(f,ni,Pv):n}function Jq(f,g){return f&&f.length?mg(f,We(g,2),Pv):n}var Zq=_g(function(f,g){return f*g},1),eY=jv("round"),tY=_g(function(f,g){return f-g},0);function nY(f){return f&&f.length?dv(f,ni):0}function rY(f,g){return f&&f.length?dv(f,We(g,2)):0}return z.after=EU,z.ary=bT,z.assign=fG,z.assignIn=DT,z.assignInWith=Lg,z.assignWith=hG,z.at=pG,z.before=yT,z.bind=Xv,z.bindAll=vq,z.bindKey=vT,z.castArray=FU,z.chain=pT,z.chunk=GV,z.compact=qV,z.concat=YV,z.cond=xq,z.conforms=wq,z.constant=rx,z.countBy=nU,z.create=gG,z.curry=xT,z.curryRight=wT,z.debounce=ST,z.defaults=mG,z.defaultsDeep=bG,z.defer=RU,z.delay=PU,z.difference=KV,z.differenceBy=XV,z.differenceWith=QV,z.drop=JV,z.dropRight=ZV,z.dropRightWhile=eW,z.dropWhile=tW,z.fill=nW,z.filter=iU,z.flatMap=aU,z.flatMapDeep=lU,z.flatMapDepth=cU,z.flatten=uT,z.flattenDeep=rW,z.flattenDepth=iW,z.flip=TU,z.flow=_q,z.flowRight=Cq,z.fromPairs=oW,z.functions=CG,z.functionsIn=EG,z.groupBy=uU,z.initial=aW,z.intersection=lW,z.intersectionBy=cW,z.intersectionWith=uW,z.invert=PG,z.invertBy=TG,z.invokeMap=fU,z.iteratee=ix,z.keyBy=hU,z.keys=ir,z.keysIn=ti,z.map=Og,z.mapKeys=OG,z.mapValues=DG,z.matches=Eq,z.matchesProperty=Rq,z.memoize=Ag,z.merge=AG,z.mergeWith=AT,z.method=Pq,z.methodOf=Tq,z.mixin=ox,z.negate=Ig,z.nthArg=Oq,z.omit=IG,z.omitBy=kG,z.once=MU,z.orderBy=pU,z.over=Dq,z.overArgs=OU,z.overEvery=Aq,z.overSome=Iq,z.partial=Qv,z.partialRight=_T,z.partition=gU,z.pick=NG,z.pickBy=IT,z.property=zT,z.propertyOf=kq,z.pull=pW,z.pullAll=fT,z.pullAllBy=gW,z.pullAllWith=mW,z.pullAt=bW,z.range=Nq,z.rangeRight=Lq,z.rearg=DU,z.reject=yU,z.remove=yW,z.rest=AU,z.reverse=Yv,z.sampleSize=xU,z.set=FG,z.setWith=jG,z.shuffle=wU,z.slice=vW,z.sortBy=CU,z.sortedUniq=RW,z.sortedUniqBy=PW,z.split=aq,z.spread=IU,z.tail=TW,z.take=MW,z.takeRight=OW,z.takeRightWhile=DW,z.takeWhile=AW,z.tap=qW,z.throttle=kU,z.thru=Mg,z.toArray=TT,z.toPairs=kT,z.toPairsIn=NT,z.toPath=Bq,z.toPlainObject=OT,z.transform=$G,z.unary=NU,z.union=IW,z.unionBy=kW,z.unionWith=NW,z.uniq=LW,z.uniqBy=FW,z.uniqWith=jW,z.unset=zG,z.unzip=Kv,z.unzipWith=hT,z.update=BG,z.updateWith=HG,z.values=Zc,z.valuesIn=VG,z.without=$W,z.words=jT,z.wrap=LU,z.xor=zW,z.xorBy=BW,z.xorWith=HW,z.zip=VW,z.zipObject=WW,z.zipObjectDeep=UW,z.zipWith=GW,z.entries=kT,z.entriesIn=NT,z.extend=DT,z.extendWith=Lg,ox(z,z),z.add=Vq,z.attempt=$T,z.camelCase=qG,z.capitalize=LT,z.ceil=Wq,z.clamp=WG,z.clone=jU,z.cloneDeep=zU,z.cloneDeepWith=BU,z.cloneWith=$U,z.conformsTo=HU,z.deburr=FT,z.defaultTo=Sq,z.divide=Uq,z.endsWith=YG,z.eq=mo,z.escape=KG,z.escapeRegExp=XG,z.every=rU,z.find=oU,z.findIndex=lT,z.findKey=yG,z.findLast=sU,z.findLastIndex=cT,z.findLastKey=vG,z.floor=Gq,z.forEach=gT,z.forEachRight=mT,z.forIn=xG,z.forInRight=wG,z.forOwn=SG,z.forOwnRight=_G,z.get=ex,z.gt=VU,z.gte=WU,z.has=RG,z.hasIn=tx,z.head=dT,z.identity=ni,z.includes=dU,z.indexOf=sW,z.inRange=UG,z.invoke=MG,z.isArguments=ml,z.isArray=at,z.isArrayBuffer=UU,z.isArrayLike=ei,z.isArrayLikeObject=jn,z.isBoolean=GU,z.isBuffer=pa,z.isDate=qU,z.isElement=YU,z.isEmpty=KU,z.isEqual=XU,z.isEqualWith=QU,z.isError=Jv,z.isFinite=JU,z.isFunction=Ps,z.isInteger=CT,z.isLength=kg,z.isMap=ET,z.isMatch=ZU,z.isMatchWith=eG,z.isNaN=tG,z.isNative=nG,z.isNil=iG,z.isNull=rG,z.isNumber=RT,z.isObject=Pn,z.isObjectLike=On,z.isPlainObject=tf,z.isRegExp=Zv,z.isSafeInteger=oG,z.isSet=PT,z.isString=Ng,z.isSymbol=_i,z.isTypedArray=Jc,z.isUndefined=sG,z.isWeakMap=aG,z.isWeakSet=lG,z.join=dW,z.kebabCase=QG,z.last=Xi,z.lastIndexOf=fW,z.lowerCase=JG,z.lowerFirst=ZG,z.lt=cG,z.lte=uG,z.max=qq,z.maxBy=Yq,z.mean=Kq,z.meanBy=Xq,z.min=Qq,z.minBy=Jq,z.stubArray=ax,z.stubFalse=lx,z.stubObject=Fq,z.stubString=jq,z.stubTrue=$q,z.multiply=Zq,z.nth=hW,z.noConflict=Mq,z.noop=sx,z.now=Dg,z.pad=eq,z.padEnd=tq,z.padStart=nq,z.parseInt=rq,z.random=GG,z.reduce=mU,z.reduceRight=bU,z.repeat=iq,z.replace=oq,z.result=LG,z.round=eY,z.runInContext=le,z.sample=vU,z.size=SU,z.snakeCase=sq,z.some=_U,z.sortedIndex=xW,z.sortedIndexBy=wW,z.sortedIndexOf=SW,z.sortedLastIndex=_W,z.sortedLastIndexBy=CW,z.sortedLastIndexOf=EW,z.startCase=lq,z.startsWith=cq,z.subtract=tY,z.sum=nY,z.sumBy=rY,z.template=uq,z.times=zq,z.toFinite=Ts,z.toInteger=ut,z.toLength=MT,z.toLower=dq,z.toNumber=Qi,z.toSafeInteger=dG,z.toString=qt,z.toUpper=fq,z.trim=hq,z.trimEnd=pq,z.trimStart=gq,z.truncate=mq,z.unescape=bq,z.uniqueId=Hq,z.upperCase=yq,z.upperFirst=nx,z.each=gT,z.eachRight=mT,z.first=dT,ox(z,function(){var f={};return Fo(z,function(g,w){en.call(z.prototype,w)||(f[w]=g)}),f}(),{chain:!1}),z.VERSION=r,Ui(["bind","bindKey","curry","curryRight","partial","partialRight"],function(f){z[f].placeholder=z}),Ui(["drop","take"],function(f,g){At.prototype[f]=function(w){w=w===n?1:Jn(ut(w),0);var T=this.__filtered__&&!g?new At(this):this.clone();return T.__filtered__?T.__takeCount__=xr(w,T.__takeCount__):T.__views__.push({size:xr(w,Q),type:f+(T.__dir__<0?"Right":"")}),T},At.prototype[f+"Right"]=function(w){return this.reverse()[f](w).reverse()}}),Ui(["filter","map","takeWhile"],function(f,g){var w=g+1,T=w==H||w==W;At.prototype[f]=function(k){var V=this.clone();return V.__iteratees__.push({iteratee:We(k,3),type:w}),V.__filtered__=V.__filtered__||T,V}}),Ui(["head","last"],function(f,g){var w="take"+(g?"Right":"");At.prototype[f]=function(){return this[w](1).value()[0]}}),Ui(["initial","tail"],function(f,g){var w="drop"+(g?"":"Right");At.prototype[f]=function(){return this.__filtered__?new At(this):this[w](1)}}),At.prototype.compact=function(){return this.filter(ni)},At.prototype.find=function(f){return this.filter(f).head()},At.prototype.findLast=function(f){return this.reverse().find(f)},At.prototype.invokeMap=wt(function(f,g){return typeof f=="function"?new At(this):this.map(function(w){return Kd(w,f,g)})}),At.prototype.reject=function(f){return this.filter(Ig(We(f)))},At.prototype.slice=function(f,g){f=ut(f);var w=this;return w.__filtered__&&(f>0||g<0)?new At(w):(f<0?w=w.takeRight(-f):f&&(w=w.drop(f)),g!==n&&(g=ut(g),w=g<0?w.dropRight(-g):w.take(g-f)),w)},At.prototype.takeRightWhile=function(f){return this.reverse().takeWhile(f).reverse()},At.prototype.toArray=function(){return this.take(Q)},Fo(At.prototype,function(f,g){var w=/^(?:filter|find|map|reject)|While$/.test(g),T=/^(?:head|last)$/.test(g),k=z[T?"take"+(g=="last"?"Right":""):g],V=T||/^find/.test(g);k&&(z.prototype[g]=function(){var X=this.__wrapped__,re=T?[1]:arguments,ue=X instanceof At,ye=re[0],xe=ue||at(X),Se=function(Rt){var kt=k.apply(z,aa([Rt],re));return T&&Ie?kt[0]:kt};xe&&w&&typeof ye=="function"&&ye.length!=1&&(ue=xe=!1);var Ie=this.__chain__,He=!!this.__actions__.length,Ue=V&&!Ie,gt=ue&&!He;if(!V&&xe){X=gt?X:new At(this);var Ge=f.apply(X,re);return Ge.__actions__.push({func:Mg,args:[Se],thisArg:n}),new qi(Ge,Ie)}return Ue&&gt?f.apply(this,re):(Ge=this.thru(Se),Ue?T?Ge.value()[0]:Ge.value():Ge)})}),Ui(["pop","push","shift","sort","splice","unshift"],function(f){var g=tg[f],w=/^(?:push|sort|unshift)$/.test(f)?"tap":"thru",T=/^(?:pop|shift)$/.test(f);z.prototype[f]=function(){var k=arguments;if(T&&!this.__chain__){var V=this.value();return g.apply(at(V)?V:[],k)}return this[w](function(X){return g.apply(at(X)?X:[],k)})}}),Fo(At.prototype,function(f,g){var w=z[g];if(w){var T=w.name+"";en.call(qc,T)||(qc[T]=[]),qc[T].push({name:g,func:w})}}),qc[Sg(n,x).name]=[{name:"wrapper",func:n}],At.prototype.clone=bH,At.prototype.reverse=yH,At.prototype.value=vH,z.prototype.at=YW,z.prototype.chain=KW,z.prototype.commit=XW,z.prototype.next=QW,z.prototype.plant=ZW,z.prototype.reverse=eU,z.prototype.toJSON=z.prototype.valueOf=z.prototype.value=tU,z.prototype.first=z.prototype.head,Hd&&(z.prototype[Hd]=JW),z},Wc=XB();ll?((ll.exports=Wc)._=Wc,iv._=Wc):dr._=Wc}).call(Ca)})(bb,bb.exports);var Of=bb.exports;const Ql=Tc(Of);function sM({id:e,layouts:t,initialHeight:n,y:r,x:i,w:o,minH:s}){const a={i:e,x:i??0,y:r??1/0,w:o||20,h:n||35,minW:6,minH:s||10},l=t?{...t}:{};return V_.forEach(c=>{l[c]||(l[c]=[]);const u=l[c].reduce((d,p)=>Math.max(d,p.y+p.h),0);a.y=a.y===1/0?u:a.y,l[c].push({...a})}),l}function aM(e,t){if(!t)return;const n={...t};return V_.forEach(r=>{n[r]&&(n[r]=n[r].filter(i=>i.i!==e))}),n}function G_(e){return ve.getState().dashboard.globalCacheConfig}const ve=Qk()(iN((e,t)=>({isSessionExpired:!1,currentBreakpoint:"lg",dashboard:{id:"",style:mb},showContext:!1,selectedSheetId:null,selectedCardId:null,selectedFrameId:null,selectedCard:null,showFilters:!1,isDashboardEditing:!1,isVisualEditing:!1,showDashboardJSON:!1,filteringCards:[],actions:{setInitStore:()=>{e(n=>{n.isSessionExpired=!1,n.currentBreakpoint="lg",n.dashboard={id:"",style:mb},n.showContext=!1,n.selectedSheetId=null,n.selectedCardId=null,n.selectedFrameId=null,n.selectedCard=null,n.showFilters=!1,n.isDashboardEditing=!1,n.isVisualEditing=!1,n.showDashboardJSON=!1,n.filteringCards=[],n.selectedLensId=void 0,n.filterValues=void 0})},setGlobalCacheConfig:n=>{e(r=>{r.dashboard.globalCacheConfig=n})},setLenses:n=>{e(r=>{r.lenses=n})},setSelectedLensId:n=>{e(r=>{r.selectedLensId=n})},deleteSheet:n=>{e(r=>{var o,s,a,l,c,u,d,p;const i=(o=r.dashboard.sheets)==null?void 0:o.findIndex(h=>h.id===n);if(i!==void 0&&i>-1){(s=r.dashboard.sheets)==null||s.splice(i,1);const h=(a=r.dashboard.filters)==null?void 0:a.filter(b=>b.sheetId===n),m=(l=r.filterValues)==null?void 0:l.filter(b=>h==null?void 0:h.some(v=>v.id===b.filterId));r.filterValues=(c=r.filterValues)==null?void 0:c.filter(b=>!(m!=null&&m.some(v=>v.filterId===b.filterId))),r.dashboard.filters=(u=r.dashboard.filters)==null?void 0:u.filter(b=>b.sheetId!==n),r.selectedSheetId=(p=(d=r.dashboard.sheets)==null?void 0:d[0])==null?void 0:p.id}})},addSheet:n=>{e(r=>{r.dashboard.sheets||(r.dashboard.sheets=[]);const i=r.dashboard.filters;let o={};i==null||i.forEach(a=>{V_.forEach(l=>{o!=null&&o[l]||(o={...o,[l]:[]});const c={i:a.id,x:0,y:0,w:10,h:8};o[l].push(c)})});const s={...n,layouts:o};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(i=>{var s,a;const o=(a=(s=i.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===i.selectedSheetId);o&&Of.forEach(o.frames,l=>{var u;const c=(u=l.cards)==null?void 0:u.find(d=>d.id===n);c&&(c.python=r)})})},addBaseQuery:n=>{e(r=>{var i;r.dashboard.baseQueries||(r.dashboard.baseQueries=[]),(i=r.dashboard.baseQueries)==null||i.push(n)})},removeBaseQuery:n=>{e(r=>{var o,s;const i=(o=r.dashboard.baseQueries)==null?void 0:o.findIndex(a=>a.id===n);i!=null&&i>-1&&((s=r.dashboard.baseQueries)==null||s.splice(i,1))})},setBaseQueries:n=>{e(r=>{r.dashboard.baseQueries=n})},setCurrentBreakpoint:n=>{e(()=>({currentBreakpoint:n}))},setFilteringCards:n=>{e(()=>({filteringCards:n}))},addFilteringCard:n=>{e(r=>{var i;(i=r.filteringCards)==null||i.push(n)})},removeFilteringCard:n=>{e(r=>{var o,s;const i=(o=r.filteringCards)==null?void 0:o.findIndex(a=>a.id===n.id);i!==void 0&&i>-1&&((s=r.filteringCards)==null||s.splice(i,1))})},setCustomCards:n=>{e(r=>{r.dashboard.customCards=n})},setAuthToken:n=>{e(()=>({authToken:n}))},setThemeStyle:n=>{e(()=>({themeStyle:n}))},setDashboard:n=>e({dashboard:n}),setDashboardWithFilterValues:(n,r)=>{e(i=>{i.dashboard=n,i.filterValues=r})},setDashboardTheme:n=>{e(r=>{r.theme=n})},setSheets:n=>{e(r=>{r.dashboard&&(r.dashboard.sheets=n)})},setSheetTitle:(n,r)=>{e(i=>{var s,a;const o=(a=(s=i.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);o&&(o.title=r)})},setCardTitle:(n,r,i)=>{e(o=>{var a,l;const s=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(c=>c.id===n);s&&Of.forEach(s.frames,c=>{var d;const u=(d=c.cards)==null?void 0:d.find(p=>p.id===r);u&&(u.title=i)})})},setCardInfo:(n,r)=>{e(i=>{var s,a;const o=(a=(s=i.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===i.selectedSheetId);o&&Of.forEach(o.frames,l=>{var u;const c=(u=l.cards)==null?void 0:u.find(d=>d.id===n);c&&(c.info=r)})})},setCardDescription:(n,r,i)=>{e(o=>{var a,l;const s=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(c=>c.id===n);s&&Of.forEach(s.frames,c=>{var d;const u=(d=c.cards)==null?void 0:d.find(p=>p.id===r);u&&(u.description=i)})})},setCardSql:(n,r,i)=>{e(o=>{var a,l,c,u;const s=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(d=>d.id===n);if(s){const d=(c=s.cards)==null?void 0:c.find(p=>p.id===r);d&&(d.sql=i,(u=o.onUpdateCard)==null||u.call(o,d,n))}})},setSheetLayout:(n,r)=>{e(i=>{var s,a;const o=(a=(s=i.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);o&&(o.layout=r)})},setSheetLayouts:(n,r)=>{e(i=>{var s,a;const o=(a=(s=i.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);o&&(o.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 i=r.filterValues.findIndex(o=>o.filterId===n.filterId);i>-1?r.filterValues.splice(i,1,n):r.filterValues.push(n)}else r.filterValues=[n]})},addOrUpdateFilterValues:n=>{e(r=>{r.filterValues?n.forEach(i=>{var s,a,l;const o=(s=r==null?void 0:r.filterValues)==null?void 0:s.findIndex(c=>c.filterId===i.filterId);o!==void 0&&o>-1?(a=r.filterValues)==null||a.splice(o,1,i):(l=r.filterValues)==null||l.push(i)}):r.filterValues=n})},removeFilterValue:n=>{e(r=>{if(r.filterValues){const i=r.filterValues.filter(o=>o.filterId!==n&&!o.filterId.startsWith(n));r.filterValues=i}})},replaceFilterValue:n=>{e(r=>{if(r.filterValues){const i=r.filterValues.findIndex(o=>o.filterId===n.filterId);i>-1&&r.filterValues.splice(i,1,n)}})},addFilter:n=>{e(r=>{var o,s;r.dashboard.filters?(o=r.dashboard.filters)==null||o.push(n):r.dashboard.filters=[n],(s=r.dashboard.sheets)==null||s.find(a=>a.id===r.selectedSheetId);const i=r.dashboard.sheets;i==null||i.forEach(a=>{sM({id:n.id,layouts:a.layouts,y:0,initialHeight:8,minH:7,w:10})})})},removeFilter:n=>{e(r=>{var i,o,s;if(r.dashboard.filters){const a=(i=r.dashboard.filters)==null?void 0:i.findIndex(l=>l.id===n);if(a>-1){(o=r.dashboard.filters)==null||o.splice(a,1),(s=r.dashboard.sheets)==null||s.find(c=>c.id===r.selectedSheetId);const l=r.dashboard.sheets;l==null||l.forEach(c=>{const u=aM(n,c.layouts);c.layouts=u})}}})},updateFrameCard:(n,r,i)=>{e(o=>{var l,c,u,d,p;const s=(c=(l=o.dashboard)==null?void 0:l.sheets)==null?void 0:c.find(h=>h.id===n);if(!s)return;const a=(u=s==null?void 0:s.frames)==null?void 0:u.find(h=>h.id===r);if(a){const h=(d=a.cards)==null?void 0:d.findIndex(m=>m.id===i.id);h>-1&&((p=a.cards)==null||p.splice(h,1,i))}})},updateFilter:n=>{e(r=>{var i,o;if(r.dashboard.filters){const s=(i=r.dashboard.filters)==null?void 0:i.findIndex(a=>a.id===n.id);s>-1&&((o=r.dashboard.filters)==null||o.splice(s,1,n))}})},setIsDashboardEditing:n=>{e(()=>({isDashboardEditing:n}))},setShowDashboardJSON:n=>{e(()=>({showDashboardJSON:n}))},setIsVisualEditing:n=>{e(()=>({isVisualEditing:n}))},addFrame:(n,r,i)=>{e(o=>{var a,l,c,u;const s=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(d=>d.id===n);if(s){s.frames||(s.frames=[]),(c=s.frames)==null||c.push(r);let d=1/0;const p=0;i==="start"&&(d=0);const h=sM({id:r.id,layouts:s.layouts,minH:10,x:p,y:d});s.layouts=h,(u=o.onAddFrame)==null||u.call(o,r,n)}})},removeFrame:(n,r)=>{e(i=>{var s,a,l,c,u;const o=(a=(s=i.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(d=>d.id===n);if(o){const d=(l=o.frames)==null?void 0:l.findIndex(p=>p.id===r);console.log(d),typeof d=="number"&&d>-1&&((c=o.frames)==null||c.splice(d,1),(u=o.layout)==null||u.splice(d,1),aM(r,o.layouts))}})},updateFrame:(n,r)=>{e(i=>{var a,l,c,u,d;const o=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(p=>p.id===n),s=(c=o==null?void 0:o.frames)==null?void 0:c.findIndex(p=>p.id===r.id);o&&((u=o.frames)==null||u.splice(s,1,r)),(d=i.onAcceptChanges)==null||d.call(i,r,i.dashboard)})},updateCard:(n,r)=>{e(i=>{var a,l,c,u,d;const o=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(p=>p.id===n),s=(c=o==null?void 0:o.cards)==null?void 0:c.findIndex(p=>p.id===r.id);o&&((u=o.cards)==null||u.splice(s,1,r),(d=i.onUpdateCard)==null||d.call(i,r,n))})},removeCard:(n,r)=>{e(i=>{var a,l,c,u,d,p;const o=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(h=>h.id===n),s=(c=o==null?void 0:o.cards)==null?void 0:c.findIndex(h=>h.id===r.id);o&&((u=o.cards)==null||u.splice(s,1),(d=o.layout)==null||d.splice(s,1),(p=i.onRemoveCard)==null||p.call(i,r,n))})},setStyle:n=>{e(r=>{r.dashboard&&(r.dashboard.style=n)})},setSelectedCardId:(n,r)=>{e(i=>{var s,a,l;const o=(a=(s=i.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(c=>c.id===n);o&&(((l=o.cards)==null?void 0:l.find(u=>u.id===r))?i.selectedCardId=r:i.selectedCardId=null)})},setSelectedFrameId:n=>{e(r=>{var o,s;((s=(o=r.dashboard)==null?void 0:o.sheets)==null?void 0:s.find(a=>a.id===r.selectedSheetId))&&(r.selectedFrameId=n)})},setSelectedSheetId:n=>{e(r=>{var o,s;((s=(o=r.dashboard)==null?void 0:o.sheets)==null?void 0:s.find(a=>a.id===n))&&(r.selectedSheetId=n)})},setOnSaveFunction:n=>{e(()=>({onSaveFunction:n}))},setOnAddCard:n=>{e(()=>({onAddCard:n}))},setOnAcceptChanges:n=>{e(()=>({onAcceptChanges: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(i=>i.id===t().selectedSheetId)},getCardFrame:n=>{var i,o;const r=(i=t().dashboard)==null?void 0:i.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((o=a[l].cards)==null?void 0:o.find(u=>u.id===n))return a[l]}}},getSelectedFrame:()=>{var r,i,o;const n=(i=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:i.find(s=>s.id===t().selectedSheetId);return(o=n==null?void 0:n.frames)==null?void 0:o.find(s=>s.id===t().selectedFrameId)},getCard:n=>{var i,o;const r=(i=t().dashboard)==null?void 0:i.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=(o=a[l].cards)==null?void 0:o.find(u=>u.id===n);if(c)return c}}},getSelectedSheetLayout:()=>{var r,i;const n=(i=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:i.find(o=>o.id===t().selectedSheetId);return n==null?void 0:n.layout},getSelectedSheetLayouts:()=>{var r,i;const n=(i=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:i.find(o=>o.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 i,o;const r=(i=t().dashboard)==null?void 0:i.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((o=a[l].cards)==null?void 0:o.find(u=>u.id===n))return r[s]}}},handleDataPointClickAction:(n,r)=>{AK({card:n,dataPoint:r,set:e,get:t})}}}))),lr=()=>ve(e=>e.actions),IK={theme:"system",setTheme:()=>null},dN=P.createContext(IK);function kK({children:e,defaultTheme:t="system",storageKey:n="vite-ui-theme",...r}){const[i,o]=P.useState(()=>localStorage.getItem(n)||t);P.useEffect(()=>{const a=window.document.documentElement;if(a.classList.remove("light","dark"),i==="system"){const l=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";a.classList.add(l);return}a.classList.add(i)},[i]);const s={theme:i,setTheme:a=>{localStorage.setItem(n,a),o(a)}};return y.jsx(dN.Provider,{...r,value:s,children:e})}const fN=()=>{const e=P.useContext(dN);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e};var pp=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(){}},pc=typeof window>"u"||"Deno"in globalThis;function eo(){}function NK(e,t){return typeof e=="function"?e(t):e}function S1(e){return typeof e=="number"&&e>=0&&e!==1/0}function hN(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Eu(e,t){return typeof e=="function"?e(t):e}function Co(e,t){return typeof e=="function"?e(t):e}function lM(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:o,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==q_(s,t.options))return!1}else if(!vh(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||i&&i!==t.state.fetchStatus||o&&!o(t))}function cM(e,t){const{exact:n,status:r,predicate:i,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(yh(t.options.mutationKey)!==yh(o))return!1}else if(!vh(t.options.mutationKey,o))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function q_(e,t){return((t==null?void 0:t.queryKeyHashFn)||yh)(e)}function yh(e){return JSON.stringify(e,(t,n)=>E1(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function vh(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!vh(e[n],t[n])):!1}function _1(e,t){if(e===t)return e;const n=uM(e)&&uM(t);if(n||E1(e)&&E1(t)){const r=n?e:Object.keys(e),i=r.length,o=n?t:Object.keys(t),s=o.length,a=n?[]:{};let l=0;for(let c=0;c<s;c++){const u=n?c:o[c];(!n&&r.includes(u)||n)&&e[u]===void 0&&t[u]===void 0?(a[u]=void 0,l++):(a[u]=_1(e[u],t[u]),a[u]===e[u]&&e[u]!==void 0&&l++)}return i===s&&l===i?e:a}return t}function C1(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function uM(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function E1(e){if(!dM(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!dM(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function dM(e){return Object.prototype.toString.call(e)==="[object Object]"}function LK(e){return new Promise(t=>{setTimeout(t,e)})}function R1(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return _1(e,t)}catch(r){console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`)}return _1(e,t)}return t}function FK(e){return e}function jK(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function $K(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var yb=Symbol();function pN(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===yb&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===yb?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var Wl,Ra,ju,kk,zK=(kk=class extends pp{constructor(){super();Ze(this,Wl);Ze(this,Ra);Ze(this,ju);je(this,ju,t=>{if(!pc&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){se(this,Ra)||this.setEventListener(se(this,ju))}onUnsubscribe(){var t;this.hasListeners()||((t=se(this,Ra))==null||t.call(this),je(this,Ra,void 0))}setEventListener(t){var n;je(this,ju,t),(n=se(this,Ra))==null||n.call(this),je(this,Ra,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){se(this,Wl)!==t&&(je(this,Wl,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof se(this,Wl)=="boolean"?se(this,Wl):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Wl=new WeakMap,Ra=new WeakMap,ju=new WeakMap,kk),Y_=new zK,$u,Pa,zu,Nk,BK=(Nk=class extends pp{constructor(){super();Ze(this,$u,!0);Ze(this,Pa);Ze(this,zu);je(this,zu,t=>{if(!pc&&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(){se(this,Pa)||this.setEventListener(se(this,zu))}onUnsubscribe(){var t;this.hasListeners()||((t=se(this,Pa))==null||t.call(this),je(this,Pa,void 0))}setEventListener(t){var n;je(this,zu,t),(n=se(this,Pa))==null||n.call(this),je(this,Pa,t(this.setOnline.bind(this)))}setOnline(t){se(this,$u)!==t&&(je(this,$u,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return se(this,$u)}},$u=new WeakMap,Pa=new WeakMap,zu=new WeakMap,Nk),vb=new BK;function P1(){let e,t;const n=new Promise((i,o)=>{e=i,t=o});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),e(i)},n.reject=i=>{r({status:"rejected",reason:i}),t(i)},n}function HK(e){return Math.min(1e3*2**e,3e4)}function gN(e){return(e??"online")==="online"?vb.isOnline():!0}var mN=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function yx(e){return e instanceof mN}function bN(e){let t=!1,n=0,r=!1,i;const o=P1(),s=b=>{var v;r||(p(new mN(b)),(v=e.abort)==null||v.call(e))},a=()=>{t=!0},l=()=>{t=!1},c=()=>Y_.isFocused()&&(e.networkMode==="always"||vb.isOnline())&&e.canRun(),u=()=>gN(e.networkMode)&&e.canRun(),d=b=>{var v;r||(r=!0,(v=e.onSuccess)==null||v.call(e,b),i==null||i(),o.resolve(b))},p=b=>{var v;r||(r=!0,(v=e.onError)==null||v.call(e,b),i==null||i(),o.reject(b))},h=()=>new Promise(b=>{var v;i=x=>{(r||c())&&b(x)},(v=e.onPause)==null||v.call(e)}).then(()=>{var b;i=void 0,r||(b=e.onContinue)==null||b.call(e)}),m=()=>{if(r)return;let b;const v=n===0?e.initialPromise:void 0;try{b=v??e.fn()}catch(x){b=Promise.reject(x)}Promise.resolve(b).then(d).catch(x=>{var M;if(r)return;const S=e.retry??(pc?0:3),_=e.retryDelay??HK,E=typeof _=="function"?_(n,x):_,C=S===!0||typeof S=="number"&&n<S||typeof S=="function"&&S(n,x);if(t||!C){p(x);return}n++,(M=e.onFail)==null||M.call(e,n,x),LK(E).then(()=>c()?void 0:h()).then(()=>{t?p(x):m()})})};return{promise:o,cancel:s,continue:()=>(i==null||i(),o),cancelRetry:a,continueRetry:l,canStart:u,start:()=>(u()?m():h().then(m),o)}}function VK(){let e=[],t=0,n=a=>{a()},r=a=>{a()},i=a=>setTimeout(a,0);const o=a=>{t?e.push(a):i(()=>{n(a)})},s=()=>{const a=e;e=[],a.length&&i(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||s()}return l},batchCalls:a=>(...l)=>{o(()=>{a(...l)})},schedule:o,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{i=a}}}var gr=VK(),Ul,Lk,yN=(Lk=class{constructor(){Ze(this,Ul)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),S1(this.gcTime)&&je(this,Ul,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(pc?1/0:5*60*1e3))}clearGcTimeout(){se(this,Ul)&&(clearTimeout(se(this,Ul)),je(this,Ul,void 0))}},Ul=new WeakMap,Lk),Bu,Hu,Zi,Er,cp,Gl,So,ks,Fk,WK=(Fk=class extends yN{constructor(t){super();Ze(this,So);Ze(this,Bu);Ze(this,Hu);Ze(this,Zi);Ze(this,Er);Ze(this,cp);Ze(this,Gl);je(this,Gl,!1),je(this,cp,t.defaultOptions),this.setOptions(t.options),this.observers=[],je(this,Zi,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,je(this,Bu,UK(this.options)),this.state=t.state??se(this,Bu),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=se(this,Er))==null?void 0:t.promise}setOptions(t){this.options={...se(this,cp),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&se(this,Zi).remove(this)}setData(t,n){const r=R1(this.state.data,t,this.options);return Nt(this,So,ks).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){Nt(this,So,ks).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,i;const n=(r=se(this,Er))==null?void 0:r.promise;return(i=se(this,Er))==null||i.cancel(t),n?n.then(eo).catch(eo):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(se(this,Bu))}isActive(){return this.observers.some(t=>Co(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===yb||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!hN(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=se(this,Er))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=se(this,Er))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),se(this,Zi).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(se(this,Er)&&(se(this,Gl)?se(this,Er).cancel({revert:!0}):se(this,Er).cancelRetry()),this.scheduleGc()),se(this,Zi).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Nt(this,So,ks).call(this,{type:"invalidate"})}fetch(t,n){var l,c,u;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(se(this,Er))return se(this,Er).continueRetry(),se(this,Er).promise}if(t&&this.setOptions(t),!this.options.queryFn){const d=this.observers.find(p=>p.options.queryFn);d&&this.setOptions(d.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,i=d=>{Object.defineProperty(d,"signal",{enumerable:!0,get:()=>(je(this,Gl,!0),r.signal)})},o=()=>{const d=pN(this.options,n),p={queryKey:this.queryKey,meta:this.meta};return i(p),je(this,Gl,!1),this.options.persister?this.options.persister(d,p,this):d(p)},s={fetchOptions:n,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:o};i(s),(l=this.options.behavior)==null||l.onFetch(s,this),je(this,Hu,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((c=s.fetchOptions)==null?void 0:c.meta))&&Nt(this,So,ks).call(this,{type:"fetch",meta:(u=s.fetchOptions)==null?void 0:u.meta});const a=d=>{var p,h,m,b;yx(d)&&d.silent||Nt(this,So,ks).call(this,{type:"error",error:d}),yx(d)||((h=(p=se(this,Zi).config).onError)==null||h.call(p,d,this),(b=(m=se(this,Zi).config).onSettled)==null||b.call(m,this.state.data,d,this)),this.scheduleGc()};return je(this,Er,bN({initialPromise:n==null?void 0:n.initialPromise,fn:s.fetchFn,abort:r.abort.bind(r),onSuccess:d=>{var p,h,m,b;if(d===void 0){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}`),a(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(d)}catch(v){a(v);return}(h=(p=se(this,Zi).config).onSuccess)==null||h.call(p,d,this),(b=(m=se(this,Zi).config).onSettled)==null||b.call(m,d,this.state.error,this),this.scheduleGc()},onError:a,onFail:(d,p)=>{Nt(this,So,ks).call(this,{type:"failed",failureCount:d,error:p})},onPause:()=>{Nt(this,So,ks).call(this,{type:"pause"})},onContinue:()=>{Nt(this,So,ks).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),se(this,Er).start()}},Bu=new WeakMap,Hu=new WeakMap,Zi=new WeakMap,Er=new WeakMap,cp=new WeakMap,Gl=new WeakMap,So=new WeakSet,ks=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,...vN(r.data,this.options),fetchMeta:t.meta??null};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 i=t.error;return yx(i)&&i.revert&&se(this,Hu)?{...se(this,Hu),fetchStatus:"idle"}:{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),gr.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),se(this,Zi).notify({query:this,type:"updated",action:t})})},Fk);function vN(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:gN(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function UK(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Uo,jk,xN=(jk=class extends pp{constructor(t={}){super();Ze(this,Uo);this.config=t,je(this,Uo,new Map)}build(t,n,r){const i=n.queryKey,o=n.queryHash??q_(i,n);let s=this.get(o);return s||(s=new WK({cache:this,queryKey:i,queryHash:o,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(i)}),this.add(s)),s}add(t){se(this,Uo).has(t.queryHash)||(se(this,Uo).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=se(this,Uo).get(t.queryHash);n&&(t.destroy(),n===t&&se(this,Uo).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){gr.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return se(this,Uo).get(t)}getAll(){return[...se(this,Uo).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>lM(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>lM(t,r)):n}notify(t){gr.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){gr.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){gr.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Uo=new WeakMap,jk),Go,Br,ql,qo,wa,$k,GK=($k=class extends yN{constructor(t){super();Ze(this,qo);Ze(this,Go);Ze(this,Br);Ze(this,ql);this.mutationId=t.mutationId,je(this,Br,t.mutationCache),je(this,Go,[]),this.state=t.state||qK(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){se(this,Go).includes(t)||(se(this,Go).push(t),this.clearGcTimeout(),se(this,Br).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){je(this,Go,se(this,Go).filter(n=>n!==t)),this.scheduleGc(),se(this,Br).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){se(this,Go).length||(this.state.status==="pending"?this.scheduleGc():se(this,Br).remove(this))}continue(){var t;return((t=se(this,ql))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,o,s,a,l,c,u,d,p,h,m,b,v,x,S,_,E,C,M,O;je(this,ql,bN({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(N,A)=>{Nt(this,qo,wa).call(this,{type:"failed",failureCount:N,error:A})},onPause:()=>{Nt(this,qo,wa).call(this,{type:"pause"})},onContinue:()=>{Nt(this,qo,wa).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>se(this,Br).canRun(this)}));const n=this.state.status==="pending",r=!se(this,ql).canStart();try{if(!n){Nt(this,qo,wa).call(this,{type:"pending",variables:t,isPaused:r}),await((o=(i=se(this,Br).config).onMutate)==null?void 0:o.call(i,t,this));const A=await((a=(s=this.options).onMutate)==null?void 0:a.call(s,t));A!==this.state.context&&Nt(this,qo,wa).call(this,{type:"pending",context:A,variables:t,isPaused:r})}const N=await se(this,ql).start();return await((c=(l=se(this,Br).config).onSuccess)==null?void 0:c.call(l,N,t,this.state.context,this)),await((d=(u=this.options).onSuccess)==null?void 0:d.call(u,N,t,this.state.context)),await((h=(p=se(this,Br).config).onSettled)==null?void 0:h.call(p,N,null,this.state.variables,this.state.context,this)),await((b=(m=this.options).onSettled)==null?void 0:b.call(m,N,null,t,this.state.context)),Nt(this,qo,wa).call(this,{type:"success",data:N}),N}catch(N){try{throw await((x=(v=se(this,Br).config).onError)==null?void 0:x.call(v,N,t,this.state.context,this)),await((_=(S=this.options).onError)==null?void 0:_.call(S,N,t,this.state.context)),await((C=(E=se(this,Br).config).onSettled)==null?void 0:C.call(E,void 0,N,this.state.variables,this.state.context,this)),await((O=(M=this.options).onSettled)==null?void 0:O.call(M,void 0,N,t,this.state.context)),N}finally{Nt(this,qo,wa).call(this,{type:"error",error:N})}}finally{se(this,Br).runNext(this)}}},Go=new WeakMap,Br=new WeakMap,ql=new WeakMap,qo=new WeakSet,wa=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:t.isPaused,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),gr.batch(()=>{se(this,Go).forEach(r=>{r.onMutationUpdate(t)}),se(this,Br).notify({mutation:this,type:"updated",action:t})})},$k);function qK(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Bs,_o,up,zk,YK=(zk=class extends pp{constructor(t={}){super();Ze(this,Bs);Ze(this,_o);Ze(this,up);this.config=t,je(this,Bs,new Set),je(this,_o,new Map),je(this,up,0)}build(t,n,r){const i=new GK({mutationCache:this,mutationId:++Fg(this,up)._,options:t.defaultMutationOptions(n),state:r});return this.add(i),i}add(t){se(this,Bs).add(t);const n=zg(t);if(typeof n=="string"){const r=se(this,_o).get(n);r?r.push(t):se(this,_o).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(se(this,Bs).delete(t)){const n=zg(t);if(typeof n=="string"){const r=se(this,_o).get(n);if(r)if(r.length>1){const i=r.indexOf(t);i!==-1&&r.splice(i,1)}else r[0]===t&&se(this,_o).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=zg(t);if(typeof n=="string"){const r=se(this,_o).get(n),i=r==null?void 0:r.find(o=>o.state.status==="pending");return!i||i===t}else return!0}runNext(t){var r;const n=zg(t);if(typeof n=="string"){const i=(r=se(this,_o).get(n))==null?void 0:r.find(o=>o!==t&&o.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){gr.batch(()=>{se(this,Bs).forEach(t=>{this.notify({type:"removed",mutation:t})}),se(this,Bs).clear(),se(this,_o).clear()})}getAll(){return Array.from(se(this,Bs))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>cM(n,r))}findAll(t={}){return this.getAll().filter(n=>cM(t,n))}notify(t){gr.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return gr.batch(()=>Promise.all(t.map(n=>n.continue().catch(eo))))}},Bs=new WeakMap,_o=new WeakMap,up=new WeakMap,zk);function zg(e){var t;return(t=e.options.scope)==null?void 0:t.id}function fM(e){return{onFetch:(t,n)=>{var u,d,p,h,m;const r=t.options,i=(p=(d=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:d.fetchMore)==null?void 0:p.direction,o=((h=t.state.data)==null?void 0:h.pages)||[],s=((m=t.state.data)==null?void 0:m.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let b=!1;const v=_=>{Object.defineProperty(_,"signal",{enumerable:!0,get:()=>(t.signal.aborted?b=!0:t.signal.addEventListener("abort",()=>{b=!0}),t.signal)})},x=pN(t.options,t.fetchOptions),S=async(_,E,C)=>{if(b)return Promise.reject();if(E==null&&_.pages.length)return Promise.resolve(_);const M={queryKey:t.queryKey,pageParam:E,direction:C?"backward":"forward",meta:t.options.meta};v(M);const O=await x(M),{maxPages:N}=t.options,A=C?$K:jK;return{pages:A(_.pages,O,N),pageParams:A(_.pageParams,E,N)}};if(i&&o.length){const _=i==="backward",E=_?KK:hM,C={pages:o,pageParams:s},M=E(r,C);a=await S(C,M,_)}else{const _=e??o.length;do{const E=l===0?s[0]??r.initialPageParam:hM(r,a);if(l>0&&E==null)break;a=await S(a,E),l++}while(l<_)}return a};t.options.persister?t.fetchFn=()=>{var b,v;return(v=(b=t.options).persister)==null?void 0:v.call(b,c,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=c}}}function hM(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function KK(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var Dn,Ta,Ma,Vu,Wu,Oa,Uu,Gu,Bk,XK=(Bk=class{constructor(e={}){Ze(this,Dn);Ze(this,Ta);Ze(this,Ma);Ze(this,Vu);Ze(this,Wu);Ze(this,Oa);Ze(this,Uu);Ze(this,Gu);je(this,Dn,e.queryCache||new xN),je(this,Ta,e.mutationCache||new YK),je(this,Ma,e.defaultOptions||{}),je(this,Vu,new Map),je(this,Wu,new Map),je(this,Oa,0)}mount(){Fg(this,Oa)._++,se(this,Oa)===1&&(je(this,Uu,Y_.subscribe(async e=>{e&&(await this.resumePausedMutations(),se(this,Dn).onFocus())})),je(this,Gu,vb.subscribe(async e=>{e&&(await this.resumePausedMutations(),se(this,Dn).onOnline())})))}unmount(){var e,t;Fg(this,Oa)._--,se(this,Oa)===0&&((e=se(this,Uu))==null||e.call(this),je(this,Uu,void 0),(t=se(this,Gu))==null||t.call(this),je(this,Gu,void 0))}isFetching(e){return se(this,Dn).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return se(this,Ta).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=se(this,Dn).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=se(this,Dn).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Eu(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return se(this,Dn).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),i=se(this,Dn).get(r.queryHash),o=i==null?void 0:i.state.data,s=NK(t,o);if(s!==void 0)return se(this,Dn).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return gr.batch(()=>se(this,Dn).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=se(this,Dn).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=se(this,Dn);gr.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=se(this,Dn),r={type:"active",...e};return gr.batch(()=>(n.findAll(e).forEach(i=>{i.reset()}),this.refetchQueries(r,t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=gr.batch(()=>se(this,Dn).findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(eo).catch(eo)}invalidateQueries(e,t={}){return gr.batch(()=>{if(se(this,Dn).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none")return Promise.resolve();const n={...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"};return this.refetchQueries(n,t)})}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=gr.batch(()=>se(this,Dn).findAll(e).filter(i=>!i.isDisabled()).map(i=>{let o=i.fetch(void 0,n);return n.throwOnError||(o=o.catch(eo)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(eo)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=se(this,Dn).build(this,t);return n.isStaleByTime(Eu(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(eo).catch(eo)}fetchInfiniteQuery(e){return e.behavior=fM(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(eo).catch(eo)}ensureInfiniteQueryData(e){return e.behavior=fM(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return vb.isOnline()?se(this,Ta).resumePausedMutations():Promise.resolve()}getQueryCache(){return se(this,Dn)}getMutationCache(){return se(this,Ta)}getDefaultOptions(){return se(this,Ma)}setDefaultOptions(e){je(this,Ma,e)}setQueryDefaults(e,t){se(this,Vu).set(yh(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...se(this,Vu).values()],n={};return t.forEach(r=>{vh(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){se(this,Wu).set(yh(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...se(this,Wu).values()];let n={};return t.forEach(r=>{vh(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...se(this,Ma).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=q_(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===yb&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...se(this,Ma).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){se(this,Dn).clear(),se(this,Ta).clear()}},Dn=new WeakMap,Ta=new WeakMap,Ma=new WeakMap,Vu=new WeakMap,Wu=new WeakMap,Oa=new WeakMap,Uu=new WeakMap,Gu=new WeakMap,Bk),ci,Lt,dp,Hr,Yl,qu,Da,Yo,fp,Yu,Ku,Kl,Xl,Aa,Xu,Qt,Df,T1,M1,O1,D1,A1,I1,k1,wN,Hk,QK=(Hk=class extends pp{constructor(t,n){super();Ze(this,Qt);Ze(this,ci);Ze(this,Lt);Ze(this,dp);Ze(this,Hr);Ze(this,Yl);Ze(this,qu);Ze(this,Da);Ze(this,Yo);Ze(this,fp);Ze(this,Yu);Ze(this,Ku);Ze(this,Kl);Ze(this,Xl);Ze(this,Aa);Ze(this,Xu,new Set);this.options=n,je(this,ci,t),je(this,Yo,null),je(this,Da,P1()),this.options.experimental_prefetchInRender||se(this,Da).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(se(this,Lt).addObserver(this),pM(se(this,Lt),this.options)?Nt(this,Qt,Df).call(this):this.updateResult(),Nt(this,Qt,D1).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return N1(se(this,Lt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return N1(se(this,Lt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Nt(this,Qt,A1).call(this),Nt(this,Qt,I1).call(this),se(this,Lt).removeObserver(this)}setOptions(t,n){const r=this.options,i=se(this,Lt);if(this.options=se(this,ci).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Co(this.options.enabled,se(this,Lt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Nt(this,Qt,k1).call(this),se(this,Lt).setOptions(this.options),r._defaulted&&!C1(this.options,r)&&se(this,ci).getQueryCache().notify({type:"observerOptionsUpdated",query:se(this,Lt),observer:this});const o=this.hasListeners();o&&gM(se(this,Lt),i,this.options,r)&&Nt(this,Qt,Df).call(this),this.updateResult(n),o&&(se(this,Lt)!==i||Co(this.options.enabled,se(this,Lt))!==Co(r.enabled,se(this,Lt))||Eu(this.options.staleTime,se(this,Lt))!==Eu(r.staleTime,se(this,Lt)))&&Nt(this,Qt,T1).call(this);const s=Nt(this,Qt,M1).call(this);o&&(se(this,Lt)!==i||Co(this.options.enabled,se(this,Lt))!==Co(r.enabled,se(this,Lt))||s!==se(this,Aa))&&Nt(this,Qt,O1).call(this,s)}getOptimisticResult(t){const n=se(this,ci).getQueryCache().build(se(this,ci),t),r=this.createResult(n,t);return ZK(this,r)&&(je(this,Hr,r),je(this,qu,this.options),je(this,Yl,se(this,Lt).state)),r}getCurrentResult(){return se(this,Hr)}trackResult(t,n){const r={};return Object.keys(t).forEach(i=>{Object.defineProperty(r,i,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(i),n==null||n(i),t[i])})}),r}trackProp(t){se(this,Xu).add(t)}getCurrentQuery(){return se(this,Lt)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=se(this,ci).defaultQueryOptions(t),r=se(this,ci).getQueryCache().build(se(this,ci),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return Nt(this,Qt,Df).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),se(this,Hr)))}createResult(t,n){var N;const r=se(this,Lt),i=this.options,o=se(this,Hr),s=se(this,Yl),a=se(this,qu),c=t!==r?t.state:se(this,dp),{state:u}=t;let d={...u},p=!1,h;if(n._optimisticResults){const A=this.hasListeners(),j=!A&&pM(t,n),F=A&&gM(t,r,n,i);(j||F)&&(d={...d,...vN(u.data,t.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:m,errorUpdatedAt:b,status:v}=d;if(n.select&&d.data!==void 0)if(o&&d.data===(s==null?void 0:s.data)&&n.select===se(this,fp))h=se(this,Yu);else try{je(this,fp,n.select),h=n.select(d.data),h=R1(o==null?void 0:o.data,h,n),je(this,Yu,h),je(this,Yo,null)}catch(A){je(this,Yo,A)}else h=d.data;if(n.placeholderData!==void 0&&h===void 0&&v==="pending"){let A;if(o!=null&&o.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData))A=o.data;else if(A=typeof n.placeholderData=="function"?n.placeholderData((N=se(this,Ku))==null?void 0:N.state.data,se(this,Ku)):n.placeholderData,n.select&&A!==void 0)try{A=n.select(A),je(this,Yo,null)}catch(j){je(this,Yo,j)}A!==void 0&&(v="success",h=R1(o==null?void 0:o.data,A,n),p=!0)}se(this,Yo)&&(m=se(this,Yo),h=se(this,Yu),b=Date.now(),v="error");const x=d.fetchStatus==="fetching",S=v==="pending",_=v==="error",E=S&&x,C=h!==void 0,O={status:v,fetchStatus:d.fetchStatus,isPending:S,isSuccess:v==="success",isError:_,isInitialLoading:E,isLoading:E,data:h,dataUpdatedAt:d.dataUpdatedAt,error:m,errorUpdatedAt:b,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>c.dataUpdateCount||d.errorUpdateCount>c.errorUpdateCount,isFetching:x,isRefetching:x&&!S,isLoadingError:_&&!C,isPaused:d.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:_&&C,isStale:K_(t,n),refetch:this.refetch,promise:se(this,Da)};if(this.options.experimental_prefetchInRender){const A=$=>{O.status==="error"?$.reject(O.error):O.data!==void 0&&$.resolve(O.data)},j=()=>{const $=je(this,Da,O.promise=P1());A($)},F=se(this,Da);switch(F.status){case"pending":t.queryHash===r.queryHash&&A(F);break;case"fulfilled":(O.status==="error"||O.data!==F.value)&&j();break;case"rejected":(O.status!=="error"||O.error!==F.reason)&&j();break}}return O}updateResult(t){const n=se(this,Hr),r=this.createResult(se(this,Lt),this.options);if(je(this,Yl,se(this,Lt).state),je(this,qu,this.options),se(this,Yl).data!==void 0&&je(this,Ku,se(this,Lt)),C1(r,n))return;je(this,Hr,r);const i={},o=()=>{if(!n)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!se(this,Xu).size)return!0;const l=new Set(a??se(this,Xu));return this.options.throwOnError&&l.add("error"),Object.keys(se(this,Hr)).some(c=>{const u=c;return se(this,Hr)[u]!==n[u]&&l.has(u)})};(t==null?void 0:t.listeners)!==!1&&o()&&(i.listeners=!0),Nt(this,Qt,wN).call(this,{...i,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Nt(this,Qt,D1).call(this)}},ci=new WeakMap,Lt=new WeakMap,dp=new WeakMap,Hr=new WeakMap,Yl=new WeakMap,qu=new WeakMap,Da=new WeakMap,Yo=new WeakMap,fp=new WeakMap,Yu=new WeakMap,Ku=new WeakMap,Kl=new WeakMap,Xl=new WeakMap,Aa=new WeakMap,Xu=new WeakMap,Qt=new WeakSet,Df=function(t){Nt(this,Qt,k1).call(this);let n=se(this,Lt).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(eo)),n},T1=function(){Nt(this,Qt,A1).call(this);const t=Eu(this.options.staleTime,se(this,Lt));if(pc||se(this,Hr).isStale||!S1(t))return;const r=hN(se(this,Hr).dataUpdatedAt,t)+1;je(this,Kl,setTimeout(()=>{se(this,Hr).isStale||this.updateResult()},r))},M1=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(se(this,Lt)):this.options.refetchInterval)??!1},O1=function(t){Nt(this,Qt,I1).call(this),je(this,Aa,t),!(pc||Co(this.options.enabled,se(this,Lt))===!1||!S1(se(this,Aa))||se(this,Aa)===0)&&je(this,Xl,setInterval(()=>{(this.options.refetchIntervalInBackground||Y_.isFocused())&&Nt(this,Qt,Df).call(this)},se(this,Aa)))},D1=function(){Nt(this,Qt,T1).call(this),Nt(this,Qt,O1).call(this,Nt(this,Qt,M1).call(this))},A1=function(){se(this,Kl)&&(clearTimeout(se(this,Kl)),je(this,Kl,void 0))},I1=function(){se(this,Xl)&&(clearInterval(se(this,Xl)),je(this,Xl,void 0))},k1=function(){const t=se(this,ci).getQueryCache().build(se(this,ci),this.options);if(t===se(this,Lt))return;const n=se(this,Lt);je(this,Lt,t),je(this,dp,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},wN=function(t){gr.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(se(this,Hr))}),se(this,ci).getQueryCache().notify({query:se(this,Lt),type:"observerResultsUpdated"})})},Hk);function JK(e,t){return Co(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function pM(e,t){return JK(e,t)||e.state.data!==void 0&&N1(e,t,t.refetchOnMount)}function N1(e,t,n){if(Co(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&K_(e,t)}return!1}function gM(e,t,n,r){return(e!==t||Co(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&K_(e,n)}function K_(e,t){return Co(t.enabled,e)!==!1&&e.isStaleByTime(Eu(t.staleTime,e))}function ZK(e,t){return!C1(e.getCurrentResult(),t)}var SN=R.createContext(void 0),X_=e=>{const t=R.useContext(SN);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},eX=({client:e,children:t})=>(R.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),y.jsx(SN.Provider,{value:e,children:t})),_N=R.createContext(!1),tX=()=>R.useContext(_N);_N.Provider;function nX(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var rX=R.createContext(nX()),iX=()=>R.useContext(rX);function oX(e,t){return typeof e=="function"?e(...t):!!e}function mM(){}var sX=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},aX=e=>{R.useEffect(()=>{e.clearReset()},[e])},lX=({result:e,errorResetBoundary:t,throwOnError:n,query:r})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&oX(n,[e.error,r]),cX=e=>{const t=e.staleTime;e.suspense&&(e.staleTime=typeof t=="function"?(...n)=>Math.max(t(...n),1e3):Math.max(t??1e3,1e3),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3)))},uX=(e,t)=>e.isLoading&&e.isFetching&&!t,dX=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,bM=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function fX(e,t,n){var d,p,h,m,b;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=X_(),i=tX(),o=iX(),s=r.defaultQueryOptions(e);(p=(d=r.getDefaultOptions().queries)==null?void 0:d._experimental_beforeQuery)==null||p.call(d,s),s._optimisticResults=i?"isRestoring":"optimistic",cX(s),sX(s,o),aX(o);const a=!r.getQueryCache().get(s.queryHash),[l]=R.useState(()=>new t(r,s)),c=l.getOptimisticResult(s),u=!i&&e.subscribed!==!1;if(R.useSyncExternalStore(R.useCallback(v=>{const x=u?l.subscribe(gr.batchCalls(v)):mM;return l.updateResult(),x},[l,u]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),R.useEffect(()=>{l.setOptions(s,{listeners:!1})},[s,l]),dX(s,c))throw bM(s,l,o);if(lX({result:c,errorResetBoundary:o,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash)}))throw c.error;if((m=(h=r.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||m.call(h,s,c),s.experimental_prefetchInRender&&!pc&&uX(c,i)){const v=a?bM(s,l,o):(b=r.getQueryCache().get(s.queryHash))==null?void 0:b.promise;v==null||v.catch(mM).finally(()=>{l.updateResult()})}return s.notifyOnChangeProps?c:l.trackResult(c)}function gp(e,t){return fX(e,QK)}function CN({children:e}){const{setIsSessionExpired:t}=lr(),n=new XK({queryCache:new xN({onError:r=>{console.error(`Something went wrong: ${r.message}`),r.message==="invalid token"&&t(!0)}}),defaultOptions:{queries:{gcTime:1e3*60*10,staleTime:1e3*60*5,refetchOnWindowFocus:!1,retry:1}}});return y.jsx(eX,{client:n,children:e})}const Mc=P.forwardRef(({children:e,className:t,...n},r)=>y.jsx("div",{className:be("semaphor-scope",t),ref:r,...n,children:e})),hX={id:"",authToken:void 0},EN=P.createContext(hX),RN=({children:e,dashboardProps:t})=>y.jsx(CN,{children:y.jsx(EN.Provider,{value:t,children:y.jsx(Mc,{style:{height:"100%"},children:e})})});function uo(){const e=P.useContext(EN);if(e===void 0)throw new Error("useApplicationContext must be used within a ApplicationContextProvider");return e}function pX(){const{authToken:e,version:t}=uo(),n=ve(a=>a.selectedLensId),{data:r,isLoading:i,isFetching:o,isError:s}=gp({queryKey:["dashboard",n,e==null?void 0:e.accessToken],queryFn:()=>QY(e==null?void 0:e.accessToken,{lensId:n,version:t})});return{data:r,isLoading:i,isFetching:o,isError:s}}function PN(e){return e==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e}function yM(e,t){const n=PN(e);return n==="dark"?Ql.merge({...t==null?void 0:t.default},{...t==null?void 0:t.dark}):t==null?void 0:t.default}function gX({customStyle:e,currentTheme:t,onSave:n,onEvent:r,defaultFilterValues:i,onFilterValuesChange:o}){const{authToken:s}=uo(),a=ve(L=>L.selectedLensId),{data:l,isLoading:c,isFetching:u,isError:d}=pX(),[p,h]=P.useState(i||[]),{theme:m,setTheme:b}=fN(),v=ve(L=>L.dashboard.globalStyle),{setDashboard:x,setDashboardWithFilterValues:S,setSelectedSheetId:_,setStyle:E,setOnSaveFunction:C,setLenses:M,setSelectedLensId:O,setInitStore:N}=ve(L=>L.actions);ve(L=>L.actions.setCustomCards);const A=ve(L=>L.actions.setFilterValues),j=ve(L=>L.filterValues),F=ve(L=>L.actions.setThemeStyle),$=ve(L=>L.actions.setDashboardTheme),K=ve(L=>L.actions.setOnEvent);P.useEffect(()=>{s&&N()},[s,N]),P.useEffect(()=>{if(m){const L=PN(m);$(L)}},[m,$]),P.useEffect(()=>{t&&b(t)},[t,b]);const H=P.useCallback(()=>{const L=Ql.cloneDeep(mb),W=Ql.merge(L,v);if(e){const B=Ql.merge(W,e),U=yM(m,B);F(U),E(B)}else{const B=yM(m,W);F(B),E(mb)}},[m,e,v,F,E]);return P.useEffect(()=>{l&&l.dashboard&&H()},[m,e,v,H,l]),P.useEffect(()=>{var Q,G;function L(D,ee){const q=D.filters||[],oe=[];for(const J of ee){const Z=q.find(ae=>ae.id===J.filterId);Z&&oe.push({filterId:J.filterId,connectionType:Z.database==="NA"?"api":"database",name:Z.column,operation:Z.operation,valueType:Cu(Z),values:J.values})}return oe}if(!l||!l.dashboard)return;const{dashboard:W,filterValues:B,defaultLensId:U,lenses:Y}=l,I=L(W,p||[]);S(W,((B==null?void 0:B.length)===0?I:B)||[]),U&&O(U),Y&&M(Y),_(((G=(Q=W==null?void 0:W.sheets)==null?void 0:Q[0])==null?void 0:G.id)||null)},[l,x,_,A,a,M,S,O,p]),P.useEffect(()=>{o&&j&&o(j)},[j,o]),P.useEffect(()=>{n&&C(n),r&&K(r)},[n,C,r,K]),{isFetching:u,isLoading:c,isError:d}}function Ru({className:e,...t}){return y.jsx("div",{className:be("animate-pulse rounded-md bg-muted",e),...t})}const TN=R.forwardRef(({className:e,...t},n)=>y.jsx("div",{ref:n,className:be("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));TN.displayName="Card";const Ry=R.forwardRef(({className:e,...t},n)=>y.jsx("div",{ref:n,className:be("flex flex-col space-y-1.5 p-6",e),...t}));Ry.displayName="CardHeader";const _d=R.forwardRef(({className:e,...t},n)=>y.jsx("h3",{ref:n,className:be("text-2xl font-semibold leading-none tracking-tight",e),...t}));_d.displayName="CardTitle";const Q_=R.forwardRef(({className:e,...t},n)=>y.jsx("p",{ref:n,className:be("text-sm text-muted-foreground",e),...t}));Q_.displayName="CardDescription";const Py=R.forwardRef(({className:e,...t},n)=>y.jsx("div",{ref:n,className:be("px-6 pt-0",e),...t}));Py.displayName="CardContent";const MN=R.forwardRef(({className:e,...t},n)=>y.jsx("div",{ref:n,className:be("flex items-center p-6 pt-0",e),...t}));MN.displayName="CardFooter";function ON({className:e,customStyle:t,onSave:n,onEvent:r,LoadingComponent:i,ErrorComponent:o,onChartElementClicked:s,id:a,authToken:l,currentTheme:c,version:u,customCards:d,showAssistant:p,defaultFilterValues:h,onFilterValuesChange:m,...b}){ve(C=>C.selectedSheetId);const v=ve(C=>C.themeStyle),x=ve(C=>C.isSessionExpired),{isLoading:S,isError:_,isFetching:E}=gX({authToken:l,customStyle:t,currentTheme:c,onSave:n,onEvent:r,defaultFilterValues:h,onFilterValuesChange:m});return S||!l?(r==null||r({type:"info",message:"Loading dashboard"}),i?y.jsx(i,{message:"loading"}):y.jsx("div",{className:"flex items-center gap-3",children:y.jsx(Ru,{className:"h-1 w-full dark:h-[2px]"})})):_?(r==null||r({type:"error",message:"Error fetching dashboard"}),o?(console.log("Error fetching dashboard"),y.jsx(o,{})):y.jsx("div",{children:"Error"})):x?(r==null||r({type:"error",message:"Session Expired"}),y.jsx("div",{className:"flex h-full items-center justify-center",children:y.jsxs("div",{className:"space-y-4 rounded-md border border-muted p-10",children:[y.jsx(_d,{children:"Session Expired"}),y.jsx("p",{className:"text-muted-foreground",children:"Please refresh your page to continue."})]})})):y.jsx("div",{className:be("flex h-full flex-col justify-between",v==null?void 0:v.dashboardPanel,e),style:{},role:"dashboard-panel",...b})}function Re(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function mX(e,t){const n=R.createContext(t),r=o=>{const{children:s,...a}=o,l=R.useMemo(()=>a,Object.values(a));return y.jsx(n.Provider,{value:l,children:s})};r.displayName=e+"Provider";function i(o){const s=R.useContext(n);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[r,i]}function er(e,t=[]){let n=[];function r(o,s){const a=R.createContext(s),l=n.length;n=[...n,s];const c=d=>{var x;const{scope:p,children:h,...m}=d,b=((x=p==null?void 0:p[e])==null?void 0:x[l])||a,v=R.useMemo(()=>m,Object.values(m));return y.jsx(b.Provider,{value:v,children:h})};c.displayName=o+"Provider";function u(d,p){var b;const h=((b=p==null?void 0:p[e])==null?void 0:b[l])||a,m=R.useContext(h);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${o}\``)}return[c,u]}const i=()=>{const o=n.map(s=>R.createContext(s));return function(a){const l=(a==null?void 0:a[e])||o;return R.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,bX(i,...t)]}function bX(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(o)[`__scope${c}`];return{...a,...d}},{});return R.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function vM(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ty(...e){return t=>{let n=!1;const r=e.map(i=>{const o=vM(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i<r.length;i++){const o=r[i];typeof o=="function"?o():vM(e[i],null)}}}}function rt(...e){return R.useCallback(Ty(...e),e)}var Js=R.forwardRef((e,t)=>{const{children:n,...r}=e,i=R.Children.toArray(n),o=i.find(yX);if(o){const s=o.props.children,a=i.map(l=>l===o?R.Children.count(s)>1?R.Children.only(null):R.isValidElement(s)?s.props.children:null:l);return y.jsx(L1,{...r,ref:t,children:R.isValidElement(s)?R.cloneElement(s,void 0,a):null})}return y.jsx(L1,{...r,ref:t,children:n})});Js.displayName="Slot";var L1=R.forwardRef((e,t)=>{const{children:n,...r}=e;if(R.isValidElement(n)){const i=xX(n);return R.cloneElement(n,{...vX(r,n.props),ref:t?Ty(t,i):i})}return R.Children.count(n)>1?R.Children.only(null):null});L1.displayName="SlotClone";var J_=({children:e})=>y.jsx(y.Fragment,{children:e});function yX(e){return R.isValidElement(e)&&e.type===J_}function vX(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{o(...a),i(...a)}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function xX(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function My(e){const t=e+"CollectionProvider",[n,r]=er(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=h=>{const{scope:m,children:b}=h,v=P.useRef(null),x=P.useRef(new Map).current;return y.jsx(i,{scope:m,itemMap:x,collectionRef:v,children:b})};s.displayName=t;const a=e+"CollectionSlot",l=P.forwardRef((h,m)=>{const{scope:b,children:v}=h,x=o(a,b),S=rt(m,x.collectionRef);return y.jsx(Js,{ref:S,children:v})});l.displayName=a;const c=e+"CollectionItemSlot",u="data-radix-collection-item",d=P.forwardRef((h,m)=>{const{scope:b,children:v,...x}=h,S=P.useRef(null),_=rt(m,S),E=o(c,b);return P.useEffect(()=>(E.itemMap.set(S,{ref:S,...x}),()=>void E.itemMap.delete(S))),y.jsx(Js,{[u]:"",ref:_,children:v})});d.displayName=c;function p(h){const m=o(e+"CollectionConsumer",h);return P.useCallback(()=>{const v=m.collectionRef.current;if(!v)return[];const x=Array.from(v.querySelectorAll(`[${u}]`));return Array.from(m.itemMap.values()).sort((E,C)=>x.indexOf(E.ref.current)-x.indexOf(C.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:s,Slot:l,ItemSlot:d},p,r]}var mr=globalThis!=null&&globalThis.document?R.useLayoutEffect:()=>{},wX=R.useId||(()=>{}),SX=0;function Gn(e){const[t,n]=R.useState(wX());return mr(()=>{e||n(r=>r??String(SX++))},[e]),e||(t?`radix-${t}`:"")}var _X=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Ne=_X.reduce((e,t)=>{const n=R.forwardRef((r,i)=>{const{asChild:o,...s}=r,a=o?Js:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),y.jsx(a,{...s,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function DN(e,t){e&&dc.flushSync(()=>e.dispatchEvent(t))}function Zn(e){const t=R.useRef(e);return R.useEffect(()=>{t.current=e}),R.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function Ar({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,i]=CX({defaultProp:t,onChange:n}),o=e!==void 0,s=o?e:r,a=Zn(n),l=R.useCallback(c=>{if(o){const d=typeof c=="function"?c(e):c;d!==e&&a(d)}else i(c)},[o,e,i,a]);return[s,l]}function CX({defaultProp:e,onChange:t}){const n=R.useState(e),[r]=n,i=R.useRef(r),o=Zn(t);return R.useEffect(()=>{i.current!==r&&(o(r),i.current=r)},[r,i,o]),n}var EX=R.createContext(void 0);function Oc(e){const t=R.useContext(EX);return e||t||"ltr"}var vx="rovingFocusGroup.onEntryFocus",RX={bubbles:!1,cancelable:!0},Oy="RovingFocusGroup",[F1,AN,PX]=My(Oy),[TX,Cd]=er(Oy,[PX]),[MX,OX]=TX(Oy),IN=R.forwardRef((e,t)=>y.jsx(F1.Provider,{scope:e.__scopeRovingFocusGroup,children:y.jsx(F1.Slot,{scope:e.__scopeRovingFocusGroup,children:y.jsx(DX,{...e,ref:t})})}));IN.displayName=Oy;var DX=R.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=e,p=R.useRef(null),h=rt(t,p),m=Oc(o),[b=null,v]=Ar({prop:s,defaultProp:a,onChange:l}),[x,S]=R.useState(!1),_=Zn(c),E=AN(n),C=R.useRef(!1),[M,O]=R.useState(0);return R.useEffect(()=>{const N=p.current;if(N)return N.addEventListener(vx,_),()=>N.removeEventListener(vx,_)},[_]),y.jsx(MX,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:b,onItemFocus:R.useCallback(N=>v(N),[v]),onItemShiftTab:R.useCallback(()=>S(!0),[]),onFocusableItemAdd:R.useCallback(()=>O(N=>N+1),[]),onFocusableItemRemove:R.useCallback(()=>O(N=>N-1),[]),children:y.jsx(Ne.div,{tabIndex:x||M===0?-1:0,"data-orientation":r,...d,ref:h,style:{outline:"none",...e.style},onMouseDown:Re(e.onMouseDown,()=>{C.current=!0}),onFocus:Re(e.onFocus,N=>{const A=!C.current;if(N.target===N.currentTarget&&A&&!x){const j=new CustomEvent(vx,RX);if(N.currentTarget.dispatchEvent(j),!j.defaultPrevented){const F=E().filter(W=>W.focusable),$=F.find(W=>W.active),K=F.find(W=>W.id===b),L=[$,K,...F].filter(Boolean).map(W=>W.ref.current);LN(L,u)}}C.current=!1}),onBlur:Re(e.onBlur,()=>S(!1))})})}),kN="RovingFocusGroupItem",NN=R.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,...s}=e,a=Gn(),l=o||a,c=OX(kN,n),u=c.currentTabStopId===l,d=AN(n),{onFocusableItemAdd:p,onFocusableItemRemove:h}=c;return R.useEffect(()=>{if(r)return p(),()=>h()},[r,p,h]),y.jsx(F1.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:y.jsx(Ne.span,{tabIndex:u?0:-1,"data-orientation":c.orientation,...s,ref:t,onMouseDown:Re(e.onMouseDown,m=>{r?c.onItemFocus(l):m.preventDefault()}),onFocus:Re(e.onFocus,()=>c.onItemFocus(l)),onKeyDown:Re(e.onKeyDown,m=>{if(m.key==="Tab"&&m.shiftKey){c.onItemShiftTab();return}if(m.target!==m.currentTarget)return;const b=kX(m,c.orientation,c.dir);if(b!==void 0){if(m.metaKey||m.ctrlKey||m.altKey||m.shiftKey)return;m.preventDefault();let x=d().filter(S=>S.focusable).map(S=>S.ref.current);if(b==="last")x.reverse();else if(b==="prev"||b==="next"){b==="prev"&&x.reverse();const S=x.indexOf(m.currentTarget);x=c.loop?NX(x,S+1):x.slice(S+1)}setTimeout(()=>LN(x))}})})})});NN.displayName=kN;var AX={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function IX(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function kX(e,t,n){const r=IX(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return AX[r]}function LN(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function NX(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Z_=IN,eC=NN;function LX(e,t){return R.useReducer((n,r)=>t[n][r]??n,e)}var qn=e=>{const{present:t,children:n}=e,r=FX(t),i=typeof n=="function"?n({present:r.isPresent}):R.Children.only(n),o=rt(r.ref,jX(i));return typeof n=="function"||r.isPresent?R.cloneElement(i,{ref:o}):null};qn.displayName="Presence";function FX(e){const[t,n]=R.useState(),r=R.useRef({}),i=R.useRef(e),o=R.useRef("none"),s=e?"mounted":"unmounted",[a,l]=LX(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return R.useEffect(()=>{const c=Bg(r.current);o.current=a==="mounted"?c:"none"},[a]),mr(()=>{const c=r.current,u=i.current;if(u!==e){const p=o.current,h=Bg(c);e?l("MOUNT"):h==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&p!==h?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),mr(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,d=h=>{const b=Bg(r.current).includes(h.animationName);if(h.target===t&&b&&(l("ANIMATION_END"),!i.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},p=h=>{h.target===t&&(o.current=Bg(r.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{u.clearTimeout(c),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:R.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function Bg(e){return(e==null?void 0:e.animationName)||"none"}function jX(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var tC="Tabs",[$X,RTe]=er(tC,[Cd]),FN=Cd(),[zX,nC]=$X(tC),jN=R.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:s="horizontal",dir:a,activationMode:l="automatic",...c}=e,u=Oc(a),[d,p]=Ar({prop:r,onChange:i,defaultProp:o});return y.jsx(zX,{scope:n,baseId:Gn(),value:d,onValueChange:p,orientation:s,dir:u,activationMode:l,children:y.jsx(Ne.div,{dir:u,"data-orientation":s,...c,ref:t})})});jN.displayName=tC;var $N="TabsList",zN=R.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,o=nC($N,n),s=FN(n);return y.jsx(Z_,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:r,children:y.jsx(Ne.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:t})})});zN.displayName=$N;var BN="TabsTrigger",HN=R.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...o}=e,s=nC(BN,n),a=FN(n),l=UN(s.baseId,r),c=GN(s.baseId,r),u=r===s.value;return y.jsx(eC,{asChild:!0,...a,focusable:!i,active:u,children:y.jsx(Ne.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:l,...o,ref:t,onMouseDown:Re(e.onMouseDown,d=>{!i&&d.button===0&&d.ctrlKey===!1?s.onValueChange(r):d.preventDefault()}),onKeyDown:Re(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&s.onValueChange(r)}),onFocus:Re(e.onFocus,()=>{const d=s.activationMode!=="manual";!u&&!i&&d&&s.onValueChange(r)})})})});HN.displayName=BN;var VN="TabsContent",WN=R.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:o,...s}=e,a=nC(VN,n),l=UN(a.baseId,r),c=GN(a.baseId,r),u=r===a.value,d=R.useRef(u);return R.useEffect(()=>{const p=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(p)},[]),y.jsx(qn,{present:i||u,children:({present:p})=>y.jsx(Ne.div,{"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!p,id:c,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:p&&o})})});WN.displayName=VN;function UN(e,t){return`${e}-trigger-${t}`}function GN(e,t){return`${e}-content-${t}`}var BX=jN,qN=zN,YN=HN,KN=WN;const rC=BX,Dy=R.forwardRef(({className:e,...t},n)=>y.jsx(qN,{ref:n,className:be("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Dy.displayName=qN.displayName;const Ay=R.forwardRef(({className:e,...t},n)=>y.jsx(YN,{ref:n,className:be("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}));Ay.displayName=YN.displayName;const iC=R.forwardRef(({className:e,...t},n)=>y.jsx(KN,{ref:n,className:be("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));iC.displayName=KN.displayName;var XN={exports:{}},mp={},j1={exports:{}};(function(e,t){(function(n,r){r(t)})(Ca,function(n){function r(Z){return function(ce,ge,ie,pe,de,Ee,De){return Z(ce,ge,De)}}function i(Z){return function(ce,ge,ie,pe){if(!ce||!ge||typeof ce!="object"||typeof ge!="object")return Z(ce,ge,ie,pe);var de=pe.get(ce),Ee=pe.get(ge);if(de&&Ee)return de===ge&&Ee===ce;pe.set(ce,ge),pe.set(ge,ce);var De=Z(ce,ge,ie,pe);return pe.delete(ce),pe.delete(ge),De}}function o(Z,ae){var ce={};for(var ge in Z)ce[ge]=Z[ge];for(var ge in ae)ce[ge]=ae[ge];return ce}function s(Z){return Z.constructor===Object||Z.constructor==null}function a(Z){return typeof Z.then=="function"}function l(Z,ae){return Z===ae||Z!==Z&&ae!==ae}var c="[object Arguments]",u="[object Boolean]",d="[object Date]",p="[object RegExp]",h="[object Map]",m="[object Number]",b="[object Object]",v="[object Set]",x="[object String]",S=Object.prototype.toString;function _(Z){var ae=Z.areArraysEqual,ce=Z.areDatesEqual,ge=Z.areMapsEqual,ie=Z.areObjectsEqual,pe=Z.areRegExpsEqual,de=Z.areSetsEqual,Ee=Z.createIsNestedEqual,De=Ee($e);function $e(Te,ze,yt){if(Te===ze)return!0;if(!Te||!ze||typeof Te!="object"||typeof ze!="object")return Te!==Te&&ze!==ze;if(s(Te)&&s(ze))return ie(Te,ze,De,yt);var Mt=Array.isArray(Te),gn=Array.isArray(ze);if(Mt||gn)return Mt===gn&&ae(Te,ze,De,yt);var Ot=S.call(Te);return Ot!==S.call(ze)?!1:Ot===d?ce(Te,ze,De,yt):Ot===p?pe(Te,ze,De,yt):Ot===h?ge(Te,ze,De,yt):Ot===v?de(Te,ze,De,yt):Ot===b||Ot===c?a(Te)||a(ze)?!1:ie(Te,ze,De,yt):Ot===u||Ot===m||Ot===x?l(Te.valueOf(),ze.valueOf()):!1}return $e}function E(Z,ae,ce,ge){var ie=Z.length;if(ae.length!==ie)return!1;for(;ie-- >0;)if(!ce(Z[ie],ae[ie],ie,ie,Z,ae,ge))return!1;return!0}var C=i(E);function M(Z,ae){return l(Z.valueOf(),ae.valueOf())}function O(Z,ae,ce,ge){var ie=Z.size===ae.size;if(!ie)return!1;if(!Z.size)return!0;var pe={},de=0;return Z.forEach(function(Ee,De){if(ie){var $e=!1,Te=0;ae.forEach(function(ze,yt){!$e&&!pe[Te]&&($e=ce(De,yt,de,Te,Z,ae,ge)&&ce(Ee,ze,De,yt,Z,ae,ge))&&(pe[Te]=!0),Te++}),de++,ie=$e}}),ie}var N=i(O),A="_owner",j=Object.prototype.hasOwnProperty;function F(Z,ae,ce,ge){var ie=Object.keys(Z),pe=ie.length;if(Object.keys(ae).length!==pe)return!1;for(var de;pe-- >0;){if(de=ie[pe],de===A){var Ee=!!Z.$$typeof,De=!!ae.$$typeof;if((Ee||De)&&Ee!==De)return!1}if(!j.call(ae,de)||!ce(Z[de],ae[de],de,de,Z,ae,ge))return!1}return!0}var $=i(F);function K(Z,ae){return Z.source===ae.source&&Z.flags===ae.flags}function H(Z,ae,ce,ge){var ie=Z.size===ae.size;if(!ie)return!1;if(!Z.size)return!0;var pe={};return Z.forEach(function(de,Ee){if(ie){var De=!1,$e=0;ae.forEach(function(Te,ze){!De&&!pe[$e]&&(De=ce(de,Te,Ee,ze,Z,ae,ge))&&(pe[$e]=!0),$e++}),ie=De}}),ie}var L=i(H),W=Object.freeze({areArraysEqual:E,areDatesEqual:M,areMapsEqual:O,areObjectsEqual:F,areRegExpsEqual:K,areSetsEqual:H,createIsNestedEqual:r}),B=Object.freeze({areArraysEqual:C,areDatesEqual:M,areMapsEqual:N,areObjectsEqual:$,areRegExpsEqual:K,areSetsEqual:L,createIsNestedEqual:r}),U=_(W);function Y(Z,ae){return U(Z,ae,void 0)}var I=_(o(W,{createIsNestedEqual:function(){return l}}));function Q(Z,ae){return I(Z,ae,void 0)}var G=_(B);function D(Z,ae){return G(Z,ae,new WeakMap)}var ee=_(o(B,{createIsNestedEqual:function(){return l}}));function q(Z,ae){return ee(Z,ae,new WeakMap)}function oe(Z){return _(o(W,Z(W)))}function J(Z){var ae=_(o(B,Z(B)));return function(ce,ge,ie){return ie===void 0&&(ie=new WeakMap),ae(ce,ge,ie)}}n.circularDeepEqual=D,n.circularShallowEqual=q,n.createCustomCircularEqual=J,n.createCustomEqual=oe,n.deepEqual=Y,n.sameValueZeroEqual=l,n.shallowEqual=Q,Object.defineProperty(n,"__esModule",{value:!0})})})(j1,j1.exports);var oC=j1.exports;const sC=L_(lY);var Ct={},HX=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(Ct,"__esModule",{value:!0});Ct.bottom=aC;Ct.childrenEqual=GX;Ct.cloneLayout=QN;Ct.cloneLayoutItem=Jl;Ct.collides=Iy;Ct.compact=ZN;Ct.compactItem=e5;Ct.compactType=oQ;Ct.correctBounds=t5;Ct.fastPositionEqual=qX;Ct.fastRGLPropsEqual=void 0;Ct.getAllCollisions=n5;Ct.getFirstCollision=Ll;Ct.getLayoutItem=lC;Ct.getStatics=cC;Ct.modifyLayout=JN;Ct.moveElement=If;Ct.moveElementAwayFromCollision=z1;Ct.noop=void 0;Ct.perc=KX;Ct.resizeItemInDirection=tQ;Ct.setTopLeft=rQ;Ct.setTransform=nQ;Ct.sortLayoutItems=gC;Ct.sortLayoutItemsByColRow=a5;Ct.sortLayoutItemsByRowCol=s5;Ct.synchronizeLayoutWithChildren=iQ;Ct.validateLayout=l5;Ct.withLayoutItem=UX;var xM=oC,Af=VX(P);function VX(e){return e&&e.__esModule?e:{default:e}}const WX=process.env.NODE_ENV==="production";function aC(e){let t=0,n;for(let r=0,i=e.length;r<i;r++)n=e[r].y+e[r].h,n>t&&(t=n);return t}function QN(e){const t=Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=Jl(e[n]);return t}function JN(e,t){const n=Array(e.length);for(let r=0,i=e.length;r<i;r++)t.i===e[r].i?n[r]=t:n[r]=e[r];return n}function UX(e,t,n){let r=lC(e,t);return r?(r=n(Jl(r)),e=JN(e,r),[e,r]):[e,null]}function Jl(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 GX(e,t){return(0,xM.deepEqual)(Af.default.Children.map(e,n=>n==null?void 0:n.key),Af.default.Children.map(t,n=>n==null?void 0:n.key))&&(0,xM.deepEqual)(Af.default.Children.map(e,n=>n==null?void 0:n.props["data-grid"]),Af.default.Children.map(t,n=>n==null?void 0:n.props["data-grid"]))}Ct.fastRGLPropsEqual=HX;function qX(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function Iy(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 ZN(e,t,n,r){const i=cC(e),o=gC(e,t),s=Array(e.length);for(let a=0,l=o.length;a<l;a++){let c=Jl(o[a]);c.static||(c=e5(i,c,t,n,o,r),i.push(c)),s[e.indexOf(o[a])]=c,c.moved=!1}return s}const YX={x:"w",y:"h"};function $1(e,t,n,r){const i=YX[r];t[r]+=1;const o=e.map(s=>s.i).indexOf(t.i);for(let s=o+1;s<e.length;s++){const a=e[s];if(!a.static){if(a.y>t.y+t.h)break;Iy(t,a)&&$1(e,a,n+t[i],r)}}t[r]=n}function e5(e,t,n,r,i,o){const s=n==="vertical",a=n==="horizontal";if(s)for(t.y=Math.min(aC(e),t.y);t.y>0&&!Ll(e,t);)t.y--;else if(a)for(;t.x>0&&!Ll(e,t);)t.x--;let l;for(;(l=Ll(e,t))&&!(n===null&&o);)if(a?$1(i,t,l.x+l.w,"x"):$1(i,t,l.y+l.h,"y"),a&&t.x+t.w>r)for(t.x=r-t.w,t.y++;t.x>0&&!Ll(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function t5(e,t){const n=cC(e);for(let r=0,i=e.length;r<i;r++){const o=e[r];if(o.x+o.w>t.cols&&(o.x=t.cols-o.w),o.x<0&&(o.x=0,o.w=t.cols),!o.static)n.push(o);else for(;Ll(n,o);)o.y++}return e}function lC(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function Ll(e,t){for(let n=0,r=e.length;n<r;n++)if(Iy(e[n],t))return e[n]}function n5(e,t){return e.filter(n=>Iy(n,t))}function cC(e){return e.filter(t=>t.static)}function If(e,t,n,r,i,o,s,a,l){if(t.static&&t.isDraggable!==!0||t.y===r&&t.x===n)return e;`${t.i}${String(n)}${String(r)}${t.x}${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 d=gC(e,s);(s==="vertical"&&typeof r=="number"?u>=r:s==="horizontal"&&typeof n=="number"?c>=n:!1)&&(d=d.reverse());const h=n5(d,t),m=h.length>0;if(m&&l)return QN(e);if(m&&o)return`${t.i}`,t.x=c,t.y=u,t.moved=!1,e;for(let b=0,v=h.length;b<v;b++){const x=h[b];`${t.i}${t.x}${t.y}${x.i}${x.x}${x.y}`,!x.moved&&(x.static?e=z1(e,x,t,i,s):e=z1(e,t,x,i,s))}return e}function z1(e,t,n,r,i,o){const s=i==="horizontal",a=i==="vertical",l=t.static;if(r){r=!1;const d={x:s?Math.max(t.x-n.w,0):n.x,y:a?Math.max(t.y-n.h,0):n.y,w:n.w,h:n.h,i:"-1"},p=Ll(e,d),h=p&&p.y+p.h>t.y,m=p&&t.x+t.w>p.x;if(p){if(h&&a)return If(e,n,void 0,t.y+1,r,l,i);if(h&&i==null)return t.y=n.y,n.y=n.y+n.h,e;if(m&&s)return If(e,t,n.x,void 0,r,l,i)}else return`${n.i}${d.x}${d.y}`,If(e,n,s?d.x:void 0,a?d.y:void 0,r,l,i)}const c=s?n.x+1:void 0,u=a?n.y+1:void 0;return c==null&&u==null?e:If(e,n,s?n.x+1:void 0,a?n.y+1:void 0,r,l,i)}function KX(e){return e*100+"%"}const r5=(e,t,n,r)=>e+n>r?t:n,i5=(e,t,n)=>e<0?t:n,o5=e=>Math.max(0,e),uC=e=>Math.max(0,e),dC=(e,t,n)=>{let{left:r,height:i,width:o}=t;const s=e.top-(i-e.height);return{left:r,width:o,height:i5(s,e.height,i),top:uC(s)}},fC=(e,t,n)=>{let{top:r,left:i,height:o,width:s}=t;return{top:r,height:o,width:r5(e.left,e.width,s,n),left:o5(i)}},hC=(e,t,n)=>{let{top:r,height:i,width:o}=t;const s=e.left-(o-e.width);return{height:i,width:s<0?e.width:r5(e.left,e.width,o,n),top:uC(r),left:o5(s)}},pC=(e,t,n)=>{let{top:r,left:i,height:o,width:s}=t;return{width:s,left:i,height:i5(r,e.height,o),top:uC(r)}},XX=function(){return dC(arguments.length<=0?void 0:arguments[0],fC(...arguments))},QX=function(){return dC(arguments.length<=0?void 0:arguments[0],hC(...arguments))},JX=function(){return pC(arguments.length<=0?void 0:arguments[0],fC(...arguments))},ZX=function(){return pC(arguments.length<=0?void 0:arguments[0],hC(...arguments))},eQ={n:dC,ne:XX,e:fC,se:JX,s:pC,sw:ZX,w:hC,nw:QX};function tQ(e,t,n,r){const i=eQ[e];return i?i(t,{...t,...n},r):n}function nQ(e){let{top:t,left:n,width:r,height:i}=e;const o=`translate(${n}px,${t}px)`;return{transform:o,WebkitTransform:o,MozTransform:o,msTransform:o,OTransform:o,width:`${r}px`,height:`${i}px`,position:"absolute"}}function rQ(e){let{top:t,left:n,width:r,height:i}=e;return{top:`${t}px`,left:`${n}px`,width:`${r}px`,height:`${i}px`,position:"absolute"}}function gC(e,t){return t==="horizontal"?a5(e):t==="vertical"?s5(e):e}function s5(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 a5(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 iQ(e,t,n,r,i){e=e||[];const o=[];Af.default.Children.forEach(t,a=>{if((a==null?void 0:a.key)==null)return;const l=lC(e,String(a.key)),c=a.props["data-grid"];l&&c==null?o.push(Jl(l)):c?(WX||l5([c],"ReactGridLayout.children"),o.push(Jl({...c,i:a.key}))):o.push(Jl({w:1,h:1,x:0,y:aC(o),i:String(a.key)}))});const s=t5(o,{cols:n});return i?s:ZN(s,r,n)}function l5(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,i=e.length;r<i;r++){const o=e[r];for(let s=0;s<n.length;s++){const a=n[s],l=o[a];if(typeof l!="number"||Number.isNaN(l))throw new Error(`ReactGridLayout: ${t}[${r}].${a} must be a number! Received: ${l} (${typeof l})`)}if(typeof o.i<"u"&&typeof o.i!="string")throw new Error(`ReactGridLayout: ${t}[${r}].i must be a string! Received: ${o.i} (${typeof o.i})`)}}function oQ(e){const{verticalCompact:t,compactType:n}=e||{};return t===!1?null:n}const sQ=()=>{};Ct.noop=sQ;var hs={};Object.defineProperty(hs,"__esModule",{value:!0});hs.calcGridColWidth=ky;hs.calcGridItemPosition=aQ;hs.calcGridItemWHPx=B1;hs.calcWH=cQ;hs.calcXY=lQ;hs.clamp=Fl;function ky(e){const{margin:t,containerPadding:n,containerWidth:r,cols:i}=e;return(r-t[0]*(i-1)-n[0]*2)/i}function B1(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function aQ(e,t,n,r,i,o){const{margin:s,containerPadding:a,rowHeight:l}=e,c=ky(e),u={};return o&&o.resizing?(u.width=Math.round(o.resizing.width),u.height=Math.round(o.resizing.height)):(u.width=B1(r,c,s[0]),u.height=B1(i,l,s[1])),o&&o.dragging?(u.top=Math.round(o.dragging.top),u.left=Math.round(o.dragging.left)):o&&o.resizing&&typeof o.resizing.top=="number"&&typeof o.resizing.left=="number"?(u.top=Math.round(o.resizing.top),u.left=Math.round(o.resizing.left)):(u.top=Math.round((l+s[1])*n+a[1]),u.left=Math.round((c+s[0])*t+a[0])),u}function lQ(e,t,n,r,i){const{margin:o,containerPadding:s,cols:a,rowHeight:l,maxRows:c}=e,u=ky(e);let d=Math.round((n-s[0])/(u+o[0])),p=Math.round((t-s[1])/(l+o[1]));return d=Fl(d,0,a-r),p=Fl(p,0,c-i),{x:d,y:p}}function cQ(e,t,n,r,i,o){const{margin:s,maxRows:a,cols:l,rowHeight:c}=e,u=ky(e);let d=Math.round((t+s[0])/(u+s[0])),p=Math.round((n+s[1])/(c+s[1])),h=Fl(d,0,l-r),m=Fl(p,0,a-i);return["sw","w","nw"].indexOf(o)!==-1&&(h=Fl(d,0,l)),["nw","n","ne"].indexOf(o)!==-1&&(m=Fl(p,0,a)),{w:h,h:m}}function Fl(e,t,n){return Math.max(Math.min(e,n),t)}var Ny={},H1={exports:{}},Hg={exports:{}},Yt={};/** @license React v16.13.1
91
+ }`;var gt=$T(function(){return Vt(V,He+"return "+Se).apply(n,X)});if(gt.source=Se,Jv(gt))throw gt;return gt}function dq(f){return qt(f).toLowerCase()}function fq(f){return qt(f).toUpperCase()}function hq(f,g,w){if(f=qt(f),f&&(w||g===n))return Y2(f);if(!f||!(g=Si(g)))return f;var T=po(f),k=po(g),V=K2(T,k),X=X2(T,k)+1;return ha(T,V,X).join("")}function pq(f,g,w){if(f=qt(f),f&&(w||g===n))return f.slice(0,J2(f)+1);if(!f||!(g=Si(g)))return f;var T=po(f),k=X2(T,po(g))+1;return ha(T,0,k).join("")}function gq(f,g,w){if(f=qt(f),f&&(w||g===n))return f.replace(mn,"");if(!f||!(g=Si(g)))return f;var T=po(f),k=K2(T,po(g));return ha(T,k).join("")}function mq(f,g){var w=j,T=F;if(Pn(g)){var k="separator"in g?g.separator:k;w="length"in g?ut(g.length):w,T="omission"in g?Si(g.omission):T}f=qt(f);var V=f.length;if(Hc(f)){var X=po(f);V=X.length}if(w>=V)return f;var re=w-Vc(T);if(re<1)return T;var ue=X?ha(X,0,re).join(""):f.slice(0,re);if(k===n)return ue+T;if(X&&(re+=ue.length-re),Zv(k)){if(f.slice(re).search(k)){var ye,xe=ue;for(k.global||(k=gv(k.source,qt(jt.exec(k))+"g")),k.lastIndex=0;ye=k.exec(xe);)var Se=ye.index;ue=ue.slice(0,Se===n?re:Se)}}else if(f.indexOf(Si(k),re)!=re){var Ie=ue.lastIndexOf(k);Ie>-1&&(ue=ue.slice(0,Ie))}return ue+T}function bq(f){return f=qt(f),f&&kr.test(f)?f.replace(Lo,GB):f}var yq=Xc(function(f,g,w){return f+(w?" ":"")+g.toUpperCase()}),nx=zP("toUpperCase");function jT(f,g,w){return f=qt(f),g=w?n:g,g===n?BB(f)?KB(f):AB(f):f.match(g)||[]}var $T=wt(function(f,g){try{return xi(f,n,g)}catch(w){return Jv(w)?w:new ot(w)}}),vq=Es(function(f,g){return Ui(g,function(w){w=$o(w),_s(f,w,Xv(f[w],f))}),f});function xq(f){var g=f==null?0:f.length,w=We();return f=g?Rn(f,function(T){if(typeof T[1]!="function")throw new Gi(s);return[w(T[0]),T[1]]}):[],wt(function(T){for(var k=-1;++k<g;){var V=f[k];if(xi(V[0],this,T))return xi(V[1],this,T)}})}function wq(f){return GH(Yi(f,d))}function rx(f){return function(){return f}}function Sq(f,g){return f==null||f!==f?g:f}var _q=HP(),Cq=HP(!0);function ni(f){return f}function ix(f){return yP(typeof f=="function"?f:Yi(f,d))}function Eq(f){return xP(Yi(f,d))}function Rq(f,g){return wP(f,Yi(g,d))}var Pq=wt(function(f,g){return function(w){return Kd(w,f,g)}}),Tq=wt(function(f,g){return function(w){return Kd(f,w,g)}});function ox(f,g,w){var T=ir(g),k=bg(g,T);w==null&&!(Pn(g)&&(k.length||!T.length))&&(w=g,g=f,f=this,k=bg(g,ir(g)));var V=!(Pn(w)&&"chain"in w)||!!w.chain,X=Ps(f);return Ui(k,function(re){var ue=g[re];f[re]=ue,X&&(f.prototype[re]=function(){var ye=this.__chain__;if(V||ye){var xe=f(this.__wrapped__),Se=xe.__actions__=Zr(this.__actions__);return Se.push({func:ue,args:arguments,thisArg:f}),xe.__chain__=ye,xe}return ue.apply(f,aa([this.value()],arguments))})}),f}function Mq(){return dr._===this&&(dr._=tH),this}function sx(){}function Oq(f){return f=ut(f),wt(function(g){return SP(g,f)})}var Dq=Fv(Rn),Aq=Fv(V2),Iq=Fv(lv);function zT(f){return Wv(f)?cv($o(f)):cV(f)}function kq(f){return function(g){return f==null?n:hl(f,g)}}var Nq=WP(),Lq=WP(!0);function ax(){return[]}function lx(){return!1}function Fq(){return{}}function jq(){return""}function $q(){return!0}function zq(f,g){if(f=ut(f),f<1||f>U)return[];var w=Q,T=xr(f,Q);g=We(g),f-=Q;for(var k=fv(T,g);++w<f;)g(w);return k}function Bq(f){return at(f)?Rn(f,$o):_i(f)?[f]:Zr(sT(qt(f)))}function Hq(f){var g=++ZB;return qt(f)+g}var Vq=_g(function(f,g){return f+g},0),Wq=jv("ceil"),Uq=_g(function(f,g){return f/g},1),Gq=jv("floor");function qq(f){return f&&f.length?mg(f,ni,_v):n}function Yq(f,g){return f&&f.length?mg(f,We(g,2),_v):n}function Kq(f){return G2(f,ni)}function Xq(f,g){return G2(f,We(g,2))}function Qq(f){return f&&f.length?mg(f,ni,Pv):n}function Jq(f,g){return f&&f.length?mg(f,We(g,2),Pv):n}var Zq=_g(function(f,g){return f*g},1),eY=jv("round"),tY=_g(function(f,g){return f-g},0);function nY(f){return f&&f.length?dv(f,ni):0}function rY(f,g){return f&&f.length?dv(f,We(g,2)):0}return z.after=EU,z.ary=bT,z.assign=fG,z.assignIn=DT,z.assignInWith=Lg,z.assignWith=hG,z.at=pG,z.before=yT,z.bind=Xv,z.bindAll=vq,z.bindKey=vT,z.castArray=FU,z.chain=pT,z.chunk=GV,z.compact=qV,z.concat=YV,z.cond=xq,z.conforms=wq,z.constant=rx,z.countBy=nU,z.create=gG,z.curry=xT,z.curryRight=wT,z.debounce=ST,z.defaults=mG,z.defaultsDeep=bG,z.defer=RU,z.delay=PU,z.difference=KV,z.differenceBy=XV,z.differenceWith=QV,z.drop=JV,z.dropRight=ZV,z.dropRightWhile=eW,z.dropWhile=tW,z.fill=nW,z.filter=iU,z.flatMap=aU,z.flatMapDeep=lU,z.flatMapDepth=cU,z.flatten=uT,z.flattenDeep=rW,z.flattenDepth=iW,z.flip=TU,z.flow=_q,z.flowRight=Cq,z.fromPairs=oW,z.functions=CG,z.functionsIn=EG,z.groupBy=uU,z.initial=aW,z.intersection=lW,z.intersectionBy=cW,z.intersectionWith=uW,z.invert=PG,z.invertBy=TG,z.invokeMap=fU,z.iteratee=ix,z.keyBy=hU,z.keys=ir,z.keysIn=ti,z.map=Og,z.mapKeys=OG,z.mapValues=DG,z.matches=Eq,z.matchesProperty=Rq,z.memoize=Ag,z.merge=AG,z.mergeWith=AT,z.method=Pq,z.methodOf=Tq,z.mixin=ox,z.negate=Ig,z.nthArg=Oq,z.omit=IG,z.omitBy=kG,z.once=MU,z.orderBy=pU,z.over=Dq,z.overArgs=OU,z.overEvery=Aq,z.overSome=Iq,z.partial=Qv,z.partialRight=_T,z.partition=gU,z.pick=NG,z.pickBy=IT,z.property=zT,z.propertyOf=kq,z.pull=pW,z.pullAll=fT,z.pullAllBy=gW,z.pullAllWith=mW,z.pullAt=bW,z.range=Nq,z.rangeRight=Lq,z.rearg=DU,z.reject=yU,z.remove=yW,z.rest=AU,z.reverse=Yv,z.sampleSize=xU,z.set=FG,z.setWith=jG,z.shuffle=wU,z.slice=vW,z.sortBy=CU,z.sortedUniq=RW,z.sortedUniqBy=PW,z.split=aq,z.spread=IU,z.tail=TW,z.take=MW,z.takeRight=OW,z.takeRightWhile=DW,z.takeWhile=AW,z.tap=qW,z.throttle=kU,z.thru=Mg,z.toArray=TT,z.toPairs=kT,z.toPairsIn=NT,z.toPath=Bq,z.toPlainObject=OT,z.transform=$G,z.unary=NU,z.union=IW,z.unionBy=kW,z.unionWith=NW,z.uniq=LW,z.uniqBy=FW,z.uniqWith=jW,z.unset=zG,z.unzip=Kv,z.unzipWith=hT,z.update=BG,z.updateWith=HG,z.values=Zc,z.valuesIn=VG,z.without=$W,z.words=jT,z.wrap=LU,z.xor=zW,z.xorBy=BW,z.xorWith=HW,z.zip=VW,z.zipObject=WW,z.zipObjectDeep=UW,z.zipWith=GW,z.entries=kT,z.entriesIn=NT,z.extend=DT,z.extendWith=Lg,ox(z,z),z.add=Vq,z.attempt=$T,z.camelCase=qG,z.capitalize=LT,z.ceil=Wq,z.clamp=WG,z.clone=jU,z.cloneDeep=zU,z.cloneDeepWith=BU,z.cloneWith=$U,z.conformsTo=HU,z.deburr=FT,z.defaultTo=Sq,z.divide=Uq,z.endsWith=YG,z.eq=mo,z.escape=KG,z.escapeRegExp=XG,z.every=rU,z.find=oU,z.findIndex=lT,z.findKey=yG,z.findLast=sU,z.findLastIndex=cT,z.findLastKey=vG,z.floor=Gq,z.forEach=gT,z.forEachRight=mT,z.forIn=xG,z.forInRight=wG,z.forOwn=SG,z.forOwnRight=_G,z.get=ex,z.gt=VU,z.gte=WU,z.has=RG,z.hasIn=tx,z.head=dT,z.identity=ni,z.includes=dU,z.indexOf=sW,z.inRange=UG,z.invoke=MG,z.isArguments=ml,z.isArray=at,z.isArrayBuffer=UU,z.isArrayLike=ei,z.isArrayLikeObject=jn,z.isBoolean=GU,z.isBuffer=pa,z.isDate=qU,z.isElement=YU,z.isEmpty=KU,z.isEqual=XU,z.isEqualWith=QU,z.isError=Jv,z.isFinite=JU,z.isFunction=Ps,z.isInteger=CT,z.isLength=kg,z.isMap=ET,z.isMatch=ZU,z.isMatchWith=eG,z.isNaN=tG,z.isNative=nG,z.isNil=iG,z.isNull=rG,z.isNumber=RT,z.isObject=Pn,z.isObjectLike=On,z.isPlainObject=tf,z.isRegExp=Zv,z.isSafeInteger=oG,z.isSet=PT,z.isString=Ng,z.isSymbol=_i,z.isTypedArray=Jc,z.isUndefined=sG,z.isWeakMap=aG,z.isWeakSet=lG,z.join=dW,z.kebabCase=QG,z.last=Xi,z.lastIndexOf=fW,z.lowerCase=JG,z.lowerFirst=ZG,z.lt=cG,z.lte=uG,z.max=qq,z.maxBy=Yq,z.mean=Kq,z.meanBy=Xq,z.min=Qq,z.minBy=Jq,z.stubArray=ax,z.stubFalse=lx,z.stubObject=Fq,z.stubString=jq,z.stubTrue=$q,z.multiply=Zq,z.nth=hW,z.noConflict=Mq,z.noop=sx,z.now=Dg,z.pad=eq,z.padEnd=tq,z.padStart=nq,z.parseInt=rq,z.random=GG,z.reduce=mU,z.reduceRight=bU,z.repeat=iq,z.replace=oq,z.result=LG,z.round=eY,z.runInContext=le,z.sample=vU,z.size=SU,z.snakeCase=sq,z.some=_U,z.sortedIndex=xW,z.sortedIndexBy=wW,z.sortedIndexOf=SW,z.sortedLastIndex=_W,z.sortedLastIndexBy=CW,z.sortedLastIndexOf=EW,z.startCase=lq,z.startsWith=cq,z.subtract=tY,z.sum=nY,z.sumBy=rY,z.template=uq,z.times=zq,z.toFinite=Ts,z.toInteger=ut,z.toLength=MT,z.toLower=dq,z.toNumber=Qi,z.toSafeInteger=dG,z.toString=qt,z.toUpper=fq,z.trim=hq,z.trimEnd=pq,z.trimStart=gq,z.truncate=mq,z.unescape=bq,z.uniqueId=Hq,z.upperCase=yq,z.upperFirst=nx,z.each=gT,z.eachRight=mT,z.first=dT,ox(z,function(){var f={};return Fo(z,function(g,w){en.call(z.prototype,w)||(f[w]=g)}),f}(),{chain:!1}),z.VERSION=r,Ui(["bind","bindKey","curry","curryRight","partial","partialRight"],function(f){z[f].placeholder=z}),Ui(["drop","take"],function(f,g){At.prototype[f]=function(w){w=w===n?1:Jn(ut(w),0);var T=this.__filtered__&&!g?new At(this):this.clone();return T.__filtered__?T.__takeCount__=xr(w,T.__takeCount__):T.__views__.push({size:xr(w,Q),type:f+(T.__dir__<0?"Right":"")}),T},At.prototype[f+"Right"]=function(w){return this.reverse()[f](w).reverse()}}),Ui(["filter","map","takeWhile"],function(f,g){var w=g+1,T=w==H||w==W;At.prototype[f]=function(k){var V=this.clone();return V.__iteratees__.push({iteratee:We(k,3),type:w}),V.__filtered__=V.__filtered__||T,V}}),Ui(["head","last"],function(f,g){var w="take"+(g?"Right":"");At.prototype[f]=function(){return this[w](1).value()[0]}}),Ui(["initial","tail"],function(f,g){var w="drop"+(g?"":"Right");At.prototype[f]=function(){return this.__filtered__?new At(this):this[w](1)}}),At.prototype.compact=function(){return this.filter(ni)},At.prototype.find=function(f){return this.filter(f).head()},At.prototype.findLast=function(f){return this.reverse().find(f)},At.prototype.invokeMap=wt(function(f,g){return typeof f=="function"?new At(this):this.map(function(w){return Kd(w,f,g)})}),At.prototype.reject=function(f){return this.filter(Ig(We(f)))},At.prototype.slice=function(f,g){f=ut(f);var w=this;return w.__filtered__&&(f>0||g<0)?new At(w):(f<0?w=w.takeRight(-f):f&&(w=w.drop(f)),g!==n&&(g=ut(g),w=g<0?w.dropRight(-g):w.take(g-f)),w)},At.prototype.takeRightWhile=function(f){return this.reverse().takeWhile(f).reverse()},At.prototype.toArray=function(){return this.take(Q)},Fo(At.prototype,function(f,g){var w=/^(?:filter|find|map|reject)|While$/.test(g),T=/^(?:head|last)$/.test(g),k=z[T?"take"+(g=="last"?"Right":""):g],V=T||/^find/.test(g);k&&(z.prototype[g]=function(){var X=this.__wrapped__,re=T?[1]:arguments,ue=X instanceof At,ye=re[0],xe=ue||at(X),Se=function(Rt){var kt=k.apply(z,aa([Rt],re));return T&&Ie?kt[0]:kt};xe&&w&&typeof ye=="function"&&ye.length!=1&&(ue=xe=!1);var Ie=this.__chain__,He=!!this.__actions__.length,Ue=V&&!Ie,gt=ue&&!He;if(!V&&xe){X=gt?X:new At(this);var Ge=f.apply(X,re);return Ge.__actions__.push({func:Mg,args:[Se],thisArg:n}),new qi(Ge,Ie)}return Ue&&gt?f.apply(this,re):(Ge=this.thru(Se),Ue?T?Ge.value()[0]:Ge.value():Ge)})}),Ui(["pop","push","shift","sort","splice","unshift"],function(f){var g=tg[f],w=/^(?:push|sort|unshift)$/.test(f)?"tap":"thru",T=/^(?:pop|shift)$/.test(f);z.prototype[f]=function(){var k=arguments;if(T&&!this.__chain__){var V=this.value();return g.apply(at(V)?V:[],k)}return this[w](function(X){return g.apply(at(X)?X:[],k)})}}),Fo(At.prototype,function(f,g){var w=z[g];if(w){var T=w.name+"";en.call(qc,T)||(qc[T]=[]),qc[T].push({name:g,func:w})}}),qc[Sg(n,x).name]=[{name:"wrapper",func:n}],At.prototype.clone=bH,At.prototype.reverse=yH,At.prototype.value=vH,z.prototype.at=YW,z.prototype.chain=KW,z.prototype.commit=XW,z.prototype.next=QW,z.prototype.plant=ZW,z.prototype.reverse=eU,z.prototype.toJSON=z.prototype.valueOf=z.prototype.value=tU,z.prototype.first=z.prototype.head,Hd&&(z.prototype[Hd]=JW),z},Wc=XB();ll?((ll.exports=Wc)._=Wc,iv._=Wc):dr._=Wc}).call(Ca)})(bb,bb.exports);var Of=bb.exports;const Ql=Tc(Of);function sM({id:e,layouts:t,initialHeight:n,y:r,x:i,w:o,minH:s}){const a={i:e,x:i??0,y:r??1/0,w:o||20,h:n||35,minW:6,minH:s||10},l=t?{...t}:{};return V_.forEach(c=>{l[c]||(l[c]=[]);const u=l[c].reduce((d,p)=>Math.max(d,p.y+p.h),0);a.y=a.y===1/0?u:a.y,l[c].push({...a})}),l}function aM(e,t){if(!t)return;const n={...t};return V_.forEach(r=>{n[r]&&(n[r]=n[r].filter(i=>i.i!==e))}),n}function G_(e){return ve.getState().dashboard.globalCacheConfig}const ve=Qk()(iN((e,t)=>({isSessionExpired:!1,currentBreakpoint:"lg",dashboard:{id:"",style:mb},showContext:!1,selectedSheetId:null,selectedCardId:null,selectedFrameId:null,selectedCard:null,showFilters:!1,isDashboardEditing:!1,isVisualEditing:!1,showDashboardJSON:!1,filteringCards:[],actions:{setInitStore:()=>{e(n=>{n.isSessionExpired=!1,n.currentBreakpoint="lg",n.dashboard={id:"",style:mb},n.showContext=!1,n.selectedSheetId=null,n.selectedCardId=null,n.selectedFrameId=null,n.selectedCard=null,n.showFilters=!1,n.isDashboardEditing=!1,n.isVisualEditing=!1,n.showDashboardJSON=!1,n.filteringCards=[],n.selectedLensId=void 0,n.filterValues=void 0})},setGlobalCacheConfig:n=>{e(r=>{r.dashboard.globalCacheConfig=n})},setLenses:n=>{e(r=>{r.lenses=n})},setSelectedLensId:n=>{e(r=>{r.selectedLensId=n})},deleteSheet:n=>{e(r=>{var o,s,a,l,c,u,d,p;const i=(o=r.dashboard.sheets)==null?void 0:o.findIndex(h=>h.id===n);if(i!==void 0&&i>-1){(s=r.dashboard.sheets)==null||s.splice(i,1);const h=(a=r.dashboard.filters)==null?void 0:a.filter(b=>b.sheetId===n),m=(l=r.filterValues)==null?void 0:l.filter(b=>h==null?void 0:h.some(v=>v.id===b.filterId));r.filterValues=(c=r.filterValues)==null?void 0:c.filter(b=>!(m!=null&&m.some(v=>v.filterId===b.filterId))),r.dashboard.filters=(u=r.dashboard.filters)==null?void 0:u.filter(b=>b.sheetId!==n),r.selectedSheetId=(p=(d=r.dashboard.sheets)==null?void 0:d[0])==null?void 0:p.id}})},addSheet:n=>{e(r=>{r.dashboard.sheets||(r.dashboard.sheets=[]);const i=r.dashboard.filters;let o={};i==null||i.forEach(a=>{V_.forEach(l=>{o!=null&&o[l]||(o={...o,[l]:[]});const c={i:a.id,x:0,y:0,w:10,h:8};o[l].push(c)})});const s={...n,layouts:o};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(i=>{var s,a;const o=(a=(s=i.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===i.selectedSheetId);o&&Of.forEach(o.frames,l=>{var u;const c=(u=l.cards)==null?void 0:u.find(d=>d.id===n);c&&(c.python=r)})})},addBaseQuery:n=>{e(r=>{var i;r.dashboard.baseQueries||(r.dashboard.baseQueries=[]),(i=r.dashboard.baseQueries)==null||i.push(n)})},removeBaseQuery:n=>{e(r=>{var o,s;const i=(o=r.dashboard.baseQueries)==null?void 0:o.findIndex(a=>a.id===n);i!=null&&i>-1&&((s=r.dashboard.baseQueries)==null||s.splice(i,1))})},setBaseQueries:n=>{e(r=>{r.dashboard.baseQueries=n})},setCurrentBreakpoint:n=>{e(()=>({currentBreakpoint:n}))},setFilteringCards:n=>{e(()=>({filteringCards:n}))},addFilteringCard:n=>{e(r=>{var i;(i=r.filteringCards)==null||i.push(n)})},removeFilteringCard:n=>{e(r=>{var o,s;const i=(o=r.filteringCards)==null?void 0:o.findIndex(a=>a.id===n.id);i!==void 0&&i>-1&&((s=r.filteringCards)==null||s.splice(i,1))})},setCustomCards:n=>{e(r=>{r.dashboard.customCards=n})},setAuthToken:n=>{e(()=>({authToken:n}))},setThemeStyle:n=>{e(()=>({themeStyle:n}))},setDashboard:n=>e({dashboard:n}),setDashboardWithFilterValues:(n,r)=>{e(i=>{i.dashboard=n,i.filterValues=r})},setDashboardTheme:n=>{e(r=>{r.theme=n})},setSheets:n=>{e(r=>{r.dashboard&&(r.dashboard.sheets=n)})},setSheetTitle:(n,r)=>{e(i=>{var s,a;const o=(a=(s=i.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);o&&(o.title=r)})},setCardTitle:(n,r,i)=>{e(o=>{var a,l;const s=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(c=>c.id===n);s&&Of.forEach(s.frames,c=>{var d;const u=(d=c.cards)==null?void 0:d.find(p=>p.id===r);u&&(u.title=i)})})},setCardInfo:(n,r)=>{e(i=>{var s,a;const o=(a=(s=i.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===i.selectedSheetId);o&&Of.forEach(o.frames,l=>{var u;const c=(u=l.cards)==null?void 0:u.find(d=>d.id===n);c&&(c.info=r)})})},setCardDescription:(n,r,i)=>{e(o=>{var a,l;const s=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(c=>c.id===n);s&&Of.forEach(s.frames,c=>{var d;const u=(d=c.cards)==null?void 0:d.find(p=>p.id===r);u&&(u.description=i)})})},setCardSql:(n,r,i)=>{e(o=>{var a,l,c,u;const s=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(d=>d.id===n);if(s){const d=(c=s.cards)==null?void 0:c.find(p=>p.id===r);d&&(d.sql=i,(u=o.onUpdateCard)==null||u.call(o,d,n))}})},setSheetLayout:(n,r)=>{e(i=>{var s,a;const o=(a=(s=i.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);o&&(o.layout=r)})},setSheetLayouts:(n,r)=>{e(i=>{var s,a;const o=(a=(s=i.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);o&&(o.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 i=r.filterValues.findIndex(o=>o.filterId===n.filterId);i>-1?r.filterValues.splice(i,1,n):r.filterValues.push(n)}else r.filterValues=[n]})},addOrUpdateFilterValues:n=>{e(r=>{r.filterValues?n.forEach(i=>{var s,a,l;const o=(s=r==null?void 0:r.filterValues)==null?void 0:s.findIndex(c=>c.filterId===i.filterId);o!==void 0&&o>-1?(a=r.filterValues)==null||a.splice(o,1,i):(l=r.filterValues)==null||l.push(i)}):r.filterValues=n})},removeFilterValue:n=>{e(r=>{if(r.filterValues){const i=r.filterValues.filter(o=>o.filterId!==n&&!o.filterId.startsWith(n));r.filterValues=i}})},replaceFilterValue:n=>{e(r=>{if(r.filterValues){const i=r.filterValues.findIndex(o=>o.filterId===n.filterId);i>-1&&r.filterValues.splice(i,1,n)}})},addFilter:n=>{e(r=>{var o,s;r.dashboard.filters?(o=r.dashboard.filters)==null||o.push(n):r.dashboard.filters=[n],(s=r.dashboard.sheets)==null||s.find(a=>a.id===r.selectedSheetId);const i=r.dashboard.sheets;i==null||i.forEach(a=>{sM({id:n.id,layouts:a.layouts,y:0,initialHeight:8,minH:7,w:10})})})},removeFilter:n=>{e(r=>{var i,o,s;if(r.dashboard.filters){const a=(i=r.dashboard.filters)==null?void 0:i.findIndex(l=>l.id===n);if(a>-1){(o=r.dashboard.filters)==null||o.splice(a,1),(s=r.dashboard.sheets)==null||s.find(c=>c.id===r.selectedSheetId);const l=r.dashboard.sheets;l==null||l.forEach(c=>{const u=aM(n,c.layouts);c.layouts=u})}}})},updateFrameCard:(n,r,i)=>{e(o=>{var l,c,u,d,p;const s=(c=(l=o.dashboard)==null?void 0:l.sheets)==null?void 0:c.find(h=>h.id===n);if(!s)return;const a=(u=s==null?void 0:s.frames)==null?void 0:u.find(h=>h.id===r);if(a){const h=(d=a.cards)==null?void 0:d.findIndex(m=>m.id===i.id);h>-1&&((p=a.cards)==null||p.splice(h,1,i))}})},updateFilter:n=>{e(r=>{var i,o;if(r.dashboard.filters){const s=(i=r.dashboard.filters)==null?void 0:i.findIndex(a=>a.id===n.id);s>-1&&((o=r.dashboard.filters)==null||o.splice(s,1,n))}})},setIsDashboardEditing:n=>{e(()=>({isDashboardEditing:n}))},setShowDashboardJSON:n=>{e(()=>({showDashboardJSON:n}))},setIsVisualEditing:n=>{e(()=>({isVisualEditing:n}))},addFrame:(n,r,i)=>{e(o=>{var a,l,c,u;const s=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(d=>d.id===n);if(s){s.frames||(s.frames=[]),(c=s.frames)==null||c.push(r);let d=1/0;const p=0;i==="start"&&(d=0);const h=sM({id:r.id,layouts:s.layouts,minH:10,x:p,y:d});s.layouts=h,(u=o.onAddFrame)==null||u.call(o,r,n)}})},removeFrame:(n,r)=>{e(i=>{var s,a,l,c,u;const o=(a=(s=i.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(d=>d.id===n);if(o){const d=(l=o.frames)==null?void 0:l.findIndex(p=>p.id===r);console.log(d),typeof d=="number"&&d>-1&&((c=o.frames)==null||c.splice(d,1),(u=o.layout)==null||u.splice(d,1),aM(r,o.layouts))}})},updateFrame:(n,r)=>{e(i=>{var a,l,c,u,d;const o=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(p=>p.id===n),s=(c=o==null?void 0:o.frames)==null?void 0:c.findIndex(p=>p.id===r.id);o&&((u=o.frames)==null||u.splice(s,1,r)),(d=i.onAcceptChanges)==null||d.call(i,r,i.dashboard)})},updateCard:(n,r)=>{e(i=>{var a,l,c,u,d;const o=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(p=>p.id===n),s=(c=o==null?void 0:o.cards)==null?void 0:c.findIndex(p=>p.id===r.id);o&&((u=o.cards)==null||u.splice(s,1,r),(d=i.onUpdateCard)==null||d.call(i,r,n))})},removeCard:(n,r)=>{e(i=>{var a,l,c,u,d,p;const o=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(h=>h.id===n),s=(c=o==null?void 0:o.cards)==null?void 0:c.findIndex(h=>h.id===r.id);o&&((u=o.cards)==null||u.splice(s,1),(d=o.layout)==null||d.splice(s,1),(p=i.onRemoveCard)==null||p.call(i,r,n))})},setStyle:n=>{e(r=>{r.dashboard&&(r.dashboard.style=n)})},setSelectedCardId:(n,r)=>{e(i=>{var s,a,l;const o=(a=(s=i.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(c=>c.id===n);o&&(((l=o.cards)==null?void 0:l.find(u=>u.id===r))?i.selectedCardId=r:i.selectedCardId=null)})},setSelectedFrameId:n=>{e(r=>{var o,s;((s=(o=r.dashboard)==null?void 0:o.sheets)==null?void 0:s.find(a=>a.id===r.selectedSheetId))&&(r.selectedFrameId=n)})},setSelectedSheetId:n=>{e(r=>{var o,s;((s=(o=r.dashboard)==null?void 0:o.sheets)==null?void 0:s.find(a=>a.id===n))&&(r.selectedSheetId=n)})},setOnSaveFunction:n=>{e(()=>({onSaveFunction:n}))},setOnAddCard:n=>{e(()=>({onAddCard:n}))},setOnAcceptChanges:n=>{e(()=>({onAcceptChanges: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(i=>i.id===t().selectedSheetId)},getCardFrame:n=>{var i,o;const r=(i=t().dashboard)==null?void 0:i.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((o=a[l].cards)==null?void 0:o.find(u=>u.id===n))return a[l]}}},getSelectedFrame:()=>{var r,i,o;const n=(i=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:i.find(s=>s.id===t().selectedSheetId);return(o=n==null?void 0:n.frames)==null?void 0:o.find(s=>s.id===t().selectedFrameId)},getCard:n=>{var i,o;const r=(i=t().dashboard)==null?void 0:i.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=(o=a[l].cards)==null?void 0:o.find(u=>u.id===n);if(c)return c}}},getSelectedSheetLayout:()=>{var r,i;const n=(i=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:i.find(o=>o.id===t().selectedSheetId);return n==null?void 0:n.layout},getSelectedSheetLayouts:()=>{var r,i;const n=(i=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:i.find(o=>o.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 i,o;const r=(i=t().dashboard)==null?void 0:i.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((o=a[l].cards)==null?void 0:o.find(u=>u.id===n))return r[s]}}},handleDataPointClickAction:(n,r)=>{AK({card:n,dataPoint:r,set:e,get:t})}}}))),lr=()=>ve(e=>e.actions),IK={theme:"system",setTheme:()=>null},dN=P.createContext(IK);function kK({children:e,defaultTheme:t="system",storageKey:n="vite-ui-theme",...r}){const[i,o]=P.useState(()=>localStorage.getItem(n)||t);P.useEffect(()=>{const a=window.document.documentElement;if(a.classList.remove("light","dark"),i==="system"){const l=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";a.classList.add(l);return}a.classList.add(i)},[i]);const s={theme:i,setTheme:a=>{localStorage.setItem(n,a),o(a)}};return y.jsx(dN.Provider,{...r,value:s,children:e})}const fN=()=>{const e=P.useContext(dN);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e};var pp=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(){}},pc=typeof window>"u"||"Deno"in globalThis;function eo(){}function NK(e,t){return typeof e=="function"?e(t):e}function S1(e){return typeof e=="number"&&e>=0&&e!==1/0}function hN(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Eu(e,t){return typeof e=="function"?e(t):e}function Co(e,t){return typeof e=="function"?e(t):e}function lM(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:o,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==q_(s,t.options))return!1}else if(!vh(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||i&&i!==t.state.fetchStatus||o&&!o(t))}function cM(e,t){const{exact:n,status:r,predicate:i,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(yh(t.options.mutationKey)!==yh(o))return!1}else if(!vh(t.options.mutationKey,o))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function q_(e,t){return((t==null?void 0:t.queryKeyHashFn)||yh)(e)}function yh(e){return JSON.stringify(e,(t,n)=>E1(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function vh(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!vh(e[n],t[n])):!1}function _1(e,t){if(e===t)return e;const n=uM(e)&&uM(t);if(n||E1(e)&&E1(t)){const r=n?e:Object.keys(e),i=r.length,o=n?t:Object.keys(t),s=o.length,a=n?[]:{};let l=0;for(let c=0;c<s;c++){const u=n?c:o[c];(!n&&r.includes(u)||n)&&e[u]===void 0&&t[u]===void 0?(a[u]=void 0,l++):(a[u]=_1(e[u],t[u]),a[u]===e[u]&&e[u]!==void 0&&l++)}return i===s&&l===i?e:a}return t}function C1(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function uM(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function E1(e){if(!dM(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!dM(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function dM(e){return Object.prototype.toString.call(e)==="[object Object]"}function LK(e){return new Promise(t=>{setTimeout(t,e)})}function R1(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return _1(e,t)}catch(r){console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`)}return _1(e,t)}return t}function FK(e){return e}function jK(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function $K(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var yb=Symbol();function pN(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===yb&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===yb?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var Wl,Ra,ju,kk,zK=(kk=class extends pp{constructor(){super();Ze(this,Wl);Ze(this,Ra);Ze(this,ju);je(this,ju,t=>{if(!pc&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){se(this,Ra)||this.setEventListener(se(this,ju))}onUnsubscribe(){var t;this.hasListeners()||((t=se(this,Ra))==null||t.call(this),je(this,Ra,void 0))}setEventListener(t){var n;je(this,ju,t),(n=se(this,Ra))==null||n.call(this),je(this,Ra,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){se(this,Wl)!==t&&(je(this,Wl,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof se(this,Wl)=="boolean"?se(this,Wl):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Wl=new WeakMap,Ra=new WeakMap,ju=new WeakMap,kk),Y_=new zK,$u,Pa,zu,Nk,BK=(Nk=class extends pp{constructor(){super();Ze(this,$u,!0);Ze(this,Pa);Ze(this,zu);je(this,zu,t=>{if(!pc&&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(){se(this,Pa)||this.setEventListener(se(this,zu))}onUnsubscribe(){var t;this.hasListeners()||((t=se(this,Pa))==null||t.call(this),je(this,Pa,void 0))}setEventListener(t){var n;je(this,zu,t),(n=se(this,Pa))==null||n.call(this),je(this,Pa,t(this.setOnline.bind(this)))}setOnline(t){se(this,$u)!==t&&(je(this,$u,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return se(this,$u)}},$u=new WeakMap,Pa=new WeakMap,zu=new WeakMap,Nk),vb=new BK;function P1(){let e,t;const n=new Promise((i,o)=>{e=i,t=o});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),e(i)},n.reject=i=>{r({status:"rejected",reason:i}),t(i)},n}function HK(e){return Math.min(1e3*2**e,3e4)}function gN(e){return(e??"online")==="online"?vb.isOnline():!0}var mN=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function yx(e){return e instanceof mN}function bN(e){let t=!1,n=0,r=!1,i;const o=P1(),s=b=>{var v;r||(p(new mN(b)),(v=e.abort)==null||v.call(e))},a=()=>{t=!0},l=()=>{t=!1},c=()=>Y_.isFocused()&&(e.networkMode==="always"||vb.isOnline())&&e.canRun(),u=()=>gN(e.networkMode)&&e.canRun(),d=b=>{var v;r||(r=!0,(v=e.onSuccess)==null||v.call(e,b),i==null||i(),o.resolve(b))},p=b=>{var v;r||(r=!0,(v=e.onError)==null||v.call(e,b),i==null||i(),o.reject(b))},h=()=>new Promise(b=>{var v;i=x=>{(r||c())&&b(x)},(v=e.onPause)==null||v.call(e)}).then(()=>{var b;i=void 0,r||(b=e.onContinue)==null||b.call(e)}),m=()=>{if(r)return;let b;const v=n===0?e.initialPromise:void 0;try{b=v??e.fn()}catch(x){b=Promise.reject(x)}Promise.resolve(b).then(d).catch(x=>{var M;if(r)return;const S=e.retry??(pc?0:3),_=e.retryDelay??HK,E=typeof _=="function"?_(n,x):_,C=S===!0||typeof S=="number"&&n<S||typeof S=="function"&&S(n,x);if(t||!C){p(x);return}n++,(M=e.onFail)==null||M.call(e,n,x),LK(E).then(()=>c()?void 0:h()).then(()=>{t?p(x):m()})})};return{promise:o,cancel:s,continue:()=>(i==null||i(),o),cancelRetry:a,continueRetry:l,canStart:u,start:()=>(u()?m():h().then(m),o)}}function VK(){let e=[],t=0,n=a=>{a()},r=a=>{a()},i=a=>setTimeout(a,0);const o=a=>{t?e.push(a):i(()=>{n(a)})},s=()=>{const a=e;e=[],a.length&&i(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||s()}return l},batchCalls:a=>(...l)=>{o(()=>{a(...l)})},schedule:o,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{i=a}}}var gr=VK(),Ul,Lk,yN=(Lk=class{constructor(){Ze(this,Ul)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),S1(this.gcTime)&&je(this,Ul,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(pc?1/0:5*60*1e3))}clearGcTimeout(){se(this,Ul)&&(clearTimeout(se(this,Ul)),je(this,Ul,void 0))}},Ul=new WeakMap,Lk),Bu,Hu,Zi,Er,cp,Gl,So,ks,Fk,WK=(Fk=class extends yN{constructor(t){super();Ze(this,So);Ze(this,Bu);Ze(this,Hu);Ze(this,Zi);Ze(this,Er);Ze(this,cp);Ze(this,Gl);je(this,Gl,!1),je(this,cp,t.defaultOptions),this.setOptions(t.options),this.observers=[],je(this,Zi,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,je(this,Bu,UK(this.options)),this.state=t.state??se(this,Bu),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=se(this,Er))==null?void 0:t.promise}setOptions(t){this.options={...se(this,cp),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&se(this,Zi).remove(this)}setData(t,n){const r=R1(this.state.data,t,this.options);return Nt(this,So,ks).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){Nt(this,So,ks).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,i;const n=(r=se(this,Er))==null?void 0:r.promise;return(i=se(this,Er))==null||i.cancel(t),n?n.then(eo).catch(eo):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(se(this,Bu))}isActive(){return this.observers.some(t=>Co(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===yb||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!hN(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=se(this,Er))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=se(this,Er))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),se(this,Zi).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(se(this,Er)&&(se(this,Gl)?se(this,Er).cancel({revert:!0}):se(this,Er).cancelRetry()),this.scheduleGc()),se(this,Zi).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Nt(this,So,ks).call(this,{type:"invalidate"})}fetch(t,n){var l,c,u;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(se(this,Er))return se(this,Er).continueRetry(),se(this,Er).promise}if(t&&this.setOptions(t),!this.options.queryFn){const d=this.observers.find(p=>p.options.queryFn);d&&this.setOptions(d.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,i=d=>{Object.defineProperty(d,"signal",{enumerable:!0,get:()=>(je(this,Gl,!0),r.signal)})},o=()=>{const d=pN(this.options,n),p={queryKey:this.queryKey,meta:this.meta};return i(p),je(this,Gl,!1),this.options.persister?this.options.persister(d,p,this):d(p)},s={fetchOptions:n,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:o};i(s),(l=this.options.behavior)==null||l.onFetch(s,this),je(this,Hu,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((c=s.fetchOptions)==null?void 0:c.meta))&&Nt(this,So,ks).call(this,{type:"fetch",meta:(u=s.fetchOptions)==null?void 0:u.meta});const a=d=>{var p,h,m,b;yx(d)&&d.silent||Nt(this,So,ks).call(this,{type:"error",error:d}),yx(d)||((h=(p=se(this,Zi).config).onError)==null||h.call(p,d,this),(b=(m=se(this,Zi).config).onSettled)==null||b.call(m,this.state.data,d,this)),this.scheduleGc()};return je(this,Er,bN({initialPromise:n==null?void 0:n.initialPromise,fn:s.fetchFn,abort:r.abort.bind(r),onSuccess:d=>{var p,h,m,b;if(d===void 0){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}`),a(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(d)}catch(v){a(v);return}(h=(p=se(this,Zi).config).onSuccess)==null||h.call(p,d,this),(b=(m=se(this,Zi).config).onSettled)==null||b.call(m,d,this.state.error,this),this.scheduleGc()},onError:a,onFail:(d,p)=>{Nt(this,So,ks).call(this,{type:"failed",failureCount:d,error:p})},onPause:()=>{Nt(this,So,ks).call(this,{type:"pause"})},onContinue:()=>{Nt(this,So,ks).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),se(this,Er).start()}},Bu=new WeakMap,Hu=new WeakMap,Zi=new WeakMap,Er=new WeakMap,cp=new WeakMap,Gl=new WeakMap,So=new WeakSet,ks=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,...vN(r.data,this.options),fetchMeta:t.meta??null};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 i=t.error;return yx(i)&&i.revert&&se(this,Hu)?{...se(this,Hu),fetchStatus:"idle"}:{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),gr.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),se(this,Zi).notify({query:this,type:"updated",action:t})})},Fk);function vN(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:gN(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function UK(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Uo,jk,xN=(jk=class extends pp{constructor(t={}){super();Ze(this,Uo);this.config=t,je(this,Uo,new Map)}build(t,n,r){const i=n.queryKey,o=n.queryHash??q_(i,n);let s=this.get(o);return s||(s=new WK({cache:this,queryKey:i,queryHash:o,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(i)}),this.add(s)),s}add(t){se(this,Uo).has(t.queryHash)||(se(this,Uo).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=se(this,Uo).get(t.queryHash);n&&(t.destroy(),n===t&&se(this,Uo).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){gr.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return se(this,Uo).get(t)}getAll(){return[...se(this,Uo).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>lM(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>lM(t,r)):n}notify(t){gr.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){gr.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){gr.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Uo=new WeakMap,jk),Go,Br,ql,qo,wa,$k,GK=($k=class extends yN{constructor(t){super();Ze(this,qo);Ze(this,Go);Ze(this,Br);Ze(this,ql);this.mutationId=t.mutationId,je(this,Br,t.mutationCache),je(this,Go,[]),this.state=t.state||qK(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){se(this,Go).includes(t)||(se(this,Go).push(t),this.clearGcTimeout(),se(this,Br).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){je(this,Go,se(this,Go).filter(n=>n!==t)),this.scheduleGc(),se(this,Br).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){se(this,Go).length||(this.state.status==="pending"?this.scheduleGc():se(this,Br).remove(this))}continue(){var t;return((t=se(this,ql))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,o,s,a,l,c,u,d,p,h,m,b,v,x,S,_,E,C,M,O;je(this,ql,bN({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(N,A)=>{Nt(this,qo,wa).call(this,{type:"failed",failureCount:N,error:A})},onPause:()=>{Nt(this,qo,wa).call(this,{type:"pause"})},onContinue:()=>{Nt(this,qo,wa).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>se(this,Br).canRun(this)}));const n=this.state.status==="pending",r=!se(this,ql).canStart();try{if(!n){Nt(this,qo,wa).call(this,{type:"pending",variables:t,isPaused:r}),await((o=(i=se(this,Br).config).onMutate)==null?void 0:o.call(i,t,this));const A=await((a=(s=this.options).onMutate)==null?void 0:a.call(s,t));A!==this.state.context&&Nt(this,qo,wa).call(this,{type:"pending",context:A,variables:t,isPaused:r})}const N=await se(this,ql).start();return await((c=(l=se(this,Br).config).onSuccess)==null?void 0:c.call(l,N,t,this.state.context,this)),await((d=(u=this.options).onSuccess)==null?void 0:d.call(u,N,t,this.state.context)),await((h=(p=se(this,Br).config).onSettled)==null?void 0:h.call(p,N,null,this.state.variables,this.state.context,this)),await((b=(m=this.options).onSettled)==null?void 0:b.call(m,N,null,t,this.state.context)),Nt(this,qo,wa).call(this,{type:"success",data:N}),N}catch(N){try{throw await((x=(v=se(this,Br).config).onError)==null?void 0:x.call(v,N,t,this.state.context,this)),await((_=(S=this.options).onError)==null?void 0:_.call(S,N,t,this.state.context)),await((C=(E=se(this,Br).config).onSettled)==null?void 0:C.call(E,void 0,N,this.state.variables,this.state.context,this)),await((O=(M=this.options).onSettled)==null?void 0:O.call(M,void 0,N,t,this.state.context)),N}finally{Nt(this,qo,wa).call(this,{type:"error",error:N})}}finally{se(this,Br).runNext(this)}}},Go=new WeakMap,Br=new WeakMap,ql=new WeakMap,qo=new WeakSet,wa=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:t.isPaused,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),gr.batch(()=>{se(this,Go).forEach(r=>{r.onMutationUpdate(t)}),se(this,Br).notify({mutation:this,type:"updated",action:t})})},$k);function qK(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Bs,_o,up,zk,YK=(zk=class extends pp{constructor(t={}){super();Ze(this,Bs);Ze(this,_o);Ze(this,up);this.config=t,je(this,Bs,new Set),je(this,_o,new Map),je(this,up,0)}build(t,n,r){const i=new GK({mutationCache:this,mutationId:++Fg(this,up)._,options:t.defaultMutationOptions(n),state:r});return this.add(i),i}add(t){se(this,Bs).add(t);const n=zg(t);if(typeof n=="string"){const r=se(this,_o).get(n);r?r.push(t):se(this,_o).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(se(this,Bs).delete(t)){const n=zg(t);if(typeof n=="string"){const r=se(this,_o).get(n);if(r)if(r.length>1){const i=r.indexOf(t);i!==-1&&r.splice(i,1)}else r[0]===t&&se(this,_o).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=zg(t);if(typeof n=="string"){const r=se(this,_o).get(n),i=r==null?void 0:r.find(o=>o.state.status==="pending");return!i||i===t}else return!0}runNext(t){var r;const n=zg(t);if(typeof n=="string"){const i=(r=se(this,_o).get(n))==null?void 0:r.find(o=>o!==t&&o.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){gr.batch(()=>{se(this,Bs).forEach(t=>{this.notify({type:"removed",mutation:t})}),se(this,Bs).clear(),se(this,_o).clear()})}getAll(){return Array.from(se(this,Bs))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>cM(n,r))}findAll(t={}){return this.getAll().filter(n=>cM(t,n))}notify(t){gr.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return gr.batch(()=>Promise.all(t.map(n=>n.continue().catch(eo))))}},Bs=new WeakMap,_o=new WeakMap,up=new WeakMap,zk);function zg(e){var t;return(t=e.options.scope)==null?void 0:t.id}function fM(e){return{onFetch:(t,n)=>{var u,d,p,h,m;const r=t.options,i=(p=(d=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:d.fetchMore)==null?void 0:p.direction,o=((h=t.state.data)==null?void 0:h.pages)||[],s=((m=t.state.data)==null?void 0:m.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let b=!1;const v=_=>{Object.defineProperty(_,"signal",{enumerable:!0,get:()=>(t.signal.aborted?b=!0:t.signal.addEventListener("abort",()=>{b=!0}),t.signal)})},x=pN(t.options,t.fetchOptions),S=async(_,E,C)=>{if(b)return Promise.reject();if(E==null&&_.pages.length)return Promise.resolve(_);const M={queryKey:t.queryKey,pageParam:E,direction:C?"backward":"forward",meta:t.options.meta};v(M);const O=await x(M),{maxPages:N}=t.options,A=C?$K:jK;return{pages:A(_.pages,O,N),pageParams:A(_.pageParams,E,N)}};if(i&&o.length){const _=i==="backward",E=_?KK:hM,C={pages:o,pageParams:s},M=E(r,C);a=await S(C,M,_)}else{const _=e??o.length;do{const E=l===0?s[0]??r.initialPageParam:hM(r,a);if(l>0&&E==null)break;a=await S(a,E),l++}while(l<_)}return a};t.options.persister?t.fetchFn=()=>{var b,v;return(v=(b=t.options).persister)==null?void 0:v.call(b,c,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=c}}}function hM(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function KK(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var Dn,Ta,Ma,Vu,Wu,Oa,Uu,Gu,Bk,XK=(Bk=class{constructor(e={}){Ze(this,Dn);Ze(this,Ta);Ze(this,Ma);Ze(this,Vu);Ze(this,Wu);Ze(this,Oa);Ze(this,Uu);Ze(this,Gu);je(this,Dn,e.queryCache||new xN),je(this,Ta,e.mutationCache||new YK),je(this,Ma,e.defaultOptions||{}),je(this,Vu,new Map),je(this,Wu,new Map),je(this,Oa,0)}mount(){Fg(this,Oa)._++,se(this,Oa)===1&&(je(this,Uu,Y_.subscribe(async e=>{e&&(await this.resumePausedMutations(),se(this,Dn).onFocus())})),je(this,Gu,vb.subscribe(async e=>{e&&(await this.resumePausedMutations(),se(this,Dn).onOnline())})))}unmount(){var e,t;Fg(this,Oa)._--,se(this,Oa)===0&&((e=se(this,Uu))==null||e.call(this),je(this,Uu,void 0),(t=se(this,Gu))==null||t.call(this),je(this,Gu,void 0))}isFetching(e){return se(this,Dn).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return se(this,Ta).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=se(this,Dn).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=se(this,Dn).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Eu(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return se(this,Dn).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),i=se(this,Dn).get(r.queryHash),o=i==null?void 0:i.state.data,s=NK(t,o);if(s!==void 0)return se(this,Dn).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return gr.batch(()=>se(this,Dn).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=se(this,Dn).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=se(this,Dn);gr.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=se(this,Dn),r={type:"active",...e};return gr.batch(()=>(n.findAll(e).forEach(i=>{i.reset()}),this.refetchQueries(r,t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=gr.batch(()=>se(this,Dn).findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(eo).catch(eo)}invalidateQueries(e,t={}){return gr.batch(()=>{if(se(this,Dn).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none")return Promise.resolve();const n={...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"};return this.refetchQueries(n,t)})}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=gr.batch(()=>se(this,Dn).findAll(e).filter(i=>!i.isDisabled()).map(i=>{let o=i.fetch(void 0,n);return n.throwOnError||(o=o.catch(eo)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(eo)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=se(this,Dn).build(this,t);return n.isStaleByTime(Eu(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(eo).catch(eo)}fetchInfiniteQuery(e){return e.behavior=fM(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(eo).catch(eo)}ensureInfiniteQueryData(e){return e.behavior=fM(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return vb.isOnline()?se(this,Ta).resumePausedMutations():Promise.resolve()}getQueryCache(){return se(this,Dn)}getMutationCache(){return se(this,Ta)}getDefaultOptions(){return se(this,Ma)}setDefaultOptions(e){je(this,Ma,e)}setQueryDefaults(e,t){se(this,Vu).set(yh(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...se(this,Vu).values()],n={};return t.forEach(r=>{vh(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){se(this,Wu).set(yh(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...se(this,Wu).values()];let n={};return t.forEach(r=>{vh(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...se(this,Ma).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=q_(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===yb&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...se(this,Ma).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){se(this,Dn).clear(),se(this,Ta).clear()}},Dn=new WeakMap,Ta=new WeakMap,Ma=new WeakMap,Vu=new WeakMap,Wu=new WeakMap,Oa=new WeakMap,Uu=new WeakMap,Gu=new WeakMap,Bk),ci,Lt,dp,Hr,Yl,qu,Da,Yo,fp,Yu,Ku,Kl,Xl,Aa,Xu,Qt,Df,T1,M1,O1,D1,A1,I1,k1,wN,Hk,QK=(Hk=class extends pp{constructor(t,n){super();Ze(this,Qt);Ze(this,ci);Ze(this,Lt);Ze(this,dp);Ze(this,Hr);Ze(this,Yl);Ze(this,qu);Ze(this,Da);Ze(this,Yo);Ze(this,fp);Ze(this,Yu);Ze(this,Ku);Ze(this,Kl);Ze(this,Xl);Ze(this,Aa);Ze(this,Xu,new Set);this.options=n,je(this,ci,t),je(this,Yo,null),je(this,Da,P1()),this.options.experimental_prefetchInRender||se(this,Da).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(se(this,Lt).addObserver(this),pM(se(this,Lt),this.options)?Nt(this,Qt,Df).call(this):this.updateResult(),Nt(this,Qt,D1).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return N1(se(this,Lt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return N1(se(this,Lt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Nt(this,Qt,A1).call(this),Nt(this,Qt,I1).call(this),se(this,Lt).removeObserver(this)}setOptions(t,n){const r=this.options,i=se(this,Lt);if(this.options=se(this,ci).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Co(this.options.enabled,se(this,Lt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Nt(this,Qt,k1).call(this),se(this,Lt).setOptions(this.options),r._defaulted&&!C1(this.options,r)&&se(this,ci).getQueryCache().notify({type:"observerOptionsUpdated",query:se(this,Lt),observer:this});const o=this.hasListeners();o&&gM(se(this,Lt),i,this.options,r)&&Nt(this,Qt,Df).call(this),this.updateResult(n),o&&(se(this,Lt)!==i||Co(this.options.enabled,se(this,Lt))!==Co(r.enabled,se(this,Lt))||Eu(this.options.staleTime,se(this,Lt))!==Eu(r.staleTime,se(this,Lt)))&&Nt(this,Qt,T1).call(this);const s=Nt(this,Qt,M1).call(this);o&&(se(this,Lt)!==i||Co(this.options.enabled,se(this,Lt))!==Co(r.enabled,se(this,Lt))||s!==se(this,Aa))&&Nt(this,Qt,O1).call(this,s)}getOptimisticResult(t){const n=se(this,ci).getQueryCache().build(se(this,ci),t),r=this.createResult(n,t);return ZK(this,r)&&(je(this,Hr,r),je(this,qu,this.options),je(this,Yl,se(this,Lt).state)),r}getCurrentResult(){return se(this,Hr)}trackResult(t,n){const r={};return Object.keys(t).forEach(i=>{Object.defineProperty(r,i,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(i),n==null||n(i),t[i])})}),r}trackProp(t){se(this,Xu).add(t)}getCurrentQuery(){return se(this,Lt)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=se(this,ci).defaultQueryOptions(t),r=se(this,ci).getQueryCache().build(se(this,ci),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return Nt(this,Qt,Df).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),se(this,Hr)))}createResult(t,n){var N;const r=se(this,Lt),i=this.options,o=se(this,Hr),s=se(this,Yl),a=se(this,qu),c=t!==r?t.state:se(this,dp),{state:u}=t;let d={...u},p=!1,h;if(n._optimisticResults){const A=this.hasListeners(),j=!A&&pM(t,n),F=A&&gM(t,r,n,i);(j||F)&&(d={...d,...vN(u.data,t.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:m,errorUpdatedAt:b,status:v}=d;if(n.select&&d.data!==void 0)if(o&&d.data===(s==null?void 0:s.data)&&n.select===se(this,fp))h=se(this,Yu);else try{je(this,fp,n.select),h=n.select(d.data),h=R1(o==null?void 0:o.data,h,n),je(this,Yu,h),je(this,Yo,null)}catch(A){je(this,Yo,A)}else h=d.data;if(n.placeholderData!==void 0&&h===void 0&&v==="pending"){let A;if(o!=null&&o.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData))A=o.data;else if(A=typeof n.placeholderData=="function"?n.placeholderData((N=se(this,Ku))==null?void 0:N.state.data,se(this,Ku)):n.placeholderData,n.select&&A!==void 0)try{A=n.select(A),je(this,Yo,null)}catch(j){je(this,Yo,j)}A!==void 0&&(v="success",h=R1(o==null?void 0:o.data,A,n),p=!0)}se(this,Yo)&&(m=se(this,Yo),h=se(this,Yu),b=Date.now(),v="error");const x=d.fetchStatus==="fetching",S=v==="pending",_=v==="error",E=S&&x,C=h!==void 0,O={status:v,fetchStatus:d.fetchStatus,isPending:S,isSuccess:v==="success",isError:_,isInitialLoading:E,isLoading:E,data:h,dataUpdatedAt:d.dataUpdatedAt,error:m,errorUpdatedAt:b,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>c.dataUpdateCount||d.errorUpdateCount>c.errorUpdateCount,isFetching:x,isRefetching:x&&!S,isLoadingError:_&&!C,isPaused:d.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:_&&C,isStale:K_(t,n),refetch:this.refetch,promise:se(this,Da)};if(this.options.experimental_prefetchInRender){const A=$=>{O.status==="error"?$.reject(O.error):O.data!==void 0&&$.resolve(O.data)},j=()=>{const $=je(this,Da,O.promise=P1());A($)},F=se(this,Da);switch(F.status){case"pending":t.queryHash===r.queryHash&&A(F);break;case"fulfilled":(O.status==="error"||O.data!==F.value)&&j();break;case"rejected":(O.status!=="error"||O.error!==F.reason)&&j();break}}return O}updateResult(t){const n=se(this,Hr),r=this.createResult(se(this,Lt),this.options);if(je(this,Yl,se(this,Lt).state),je(this,qu,this.options),se(this,Yl).data!==void 0&&je(this,Ku,se(this,Lt)),C1(r,n))return;je(this,Hr,r);const i={},o=()=>{if(!n)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!se(this,Xu).size)return!0;const l=new Set(a??se(this,Xu));return this.options.throwOnError&&l.add("error"),Object.keys(se(this,Hr)).some(c=>{const u=c;return se(this,Hr)[u]!==n[u]&&l.has(u)})};(t==null?void 0:t.listeners)!==!1&&o()&&(i.listeners=!0),Nt(this,Qt,wN).call(this,{...i,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Nt(this,Qt,D1).call(this)}},ci=new WeakMap,Lt=new WeakMap,dp=new WeakMap,Hr=new WeakMap,Yl=new WeakMap,qu=new WeakMap,Da=new WeakMap,Yo=new WeakMap,fp=new WeakMap,Yu=new WeakMap,Ku=new WeakMap,Kl=new WeakMap,Xl=new WeakMap,Aa=new WeakMap,Xu=new WeakMap,Qt=new WeakSet,Df=function(t){Nt(this,Qt,k1).call(this);let n=se(this,Lt).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(eo)),n},T1=function(){Nt(this,Qt,A1).call(this);const t=Eu(this.options.staleTime,se(this,Lt));if(pc||se(this,Hr).isStale||!S1(t))return;const r=hN(se(this,Hr).dataUpdatedAt,t)+1;je(this,Kl,setTimeout(()=>{se(this,Hr).isStale||this.updateResult()},r))},M1=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(se(this,Lt)):this.options.refetchInterval)??!1},O1=function(t){Nt(this,Qt,I1).call(this),je(this,Aa,t),!(pc||Co(this.options.enabled,se(this,Lt))===!1||!S1(se(this,Aa))||se(this,Aa)===0)&&je(this,Xl,setInterval(()=>{(this.options.refetchIntervalInBackground||Y_.isFocused())&&Nt(this,Qt,Df).call(this)},se(this,Aa)))},D1=function(){Nt(this,Qt,T1).call(this),Nt(this,Qt,O1).call(this,Nt(this,Qt,M1).call(this))},A1=function(){se(this,Kl)&&(clearTimeout(se(this,Kl)),je(this,Kl,void 0))},I1=function(){se(this,Xl)&&(clearInterval(se(this,Xl)),je(this,Xl,void 0))},k1=function(){const t=se(this,ci).getQueryCache().build(se(this,ci),this.options);if(t===se(this,Lt))return;const n=se(this,Lt);je(this,Lt,t),je(this,dp,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},wN=function(t){gr.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(se(this,Hr))}),se(this,ci).getQueryCache().notify({query:se(this,Lt),type:"observerResultsUpdated"})})},Hk);function JK(e,t){return Co(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function pM(e,t){return JK(e,t)||e.state.data!==void 0&&N1(e,t,t.refetchOnMount)}function N1(e,t,n){if(Co(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&K_(e,t)}return!1}function gM(e,t,n,r){return(e!==t||Co(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&K_(e,n)}function K_(e,t){return Co(t.enabled,e)!==!1&&e.isStaleByTime(Eu(t.staleTime,e))}function ZK(e,t){return!C1(e.getCurrentResult(),t)}var SN=R.createContext(void 0),X_=e=>{const t=R.useContext(SN);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},eX=({client:e,children:t})=>(R.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),y.jsx(SN.Provider,{value:e,children:t})),_N=R.createContext(!1),tX=()=>R.useContext(_N);_N.Provider;function nX(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var rX=R.createContext(nX()),iX=()=>R.useContext(rX);function oX(e,t){return typeof e=="function"?e(...t):!!e}function mM(){}var sX=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},aX=e=>{R.useEffect(()=>{e.clearReset()},[e])},lX=({result:e,errorResetBoundary:t,throwOnError:n,query:r})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&oX(n,[e.error,r]),cX=e=>{const t=e.staleTime;e.suspense&&(e.staleTime=typeof t=="function"?(...n)=>Math.max(t(...n),1e3):Math.max(t??1e3,1e3),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3)))},uX=(e,t)=>e.isLoading&&e.isFetching&&!t,dX=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,bM=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function fX(e,t,n){var d,p,h,m,b;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=X_(),i=tX(),o=iX(),s=r.defaultQueryOptions(e);(p=(d=r.getDefaultOptions().queries)==null?void 0:d._experimental_beforeQuery)==null||p.call(d,s),s._optimisticResults=i?"isRestoring":"optimistic",cX(s),sX(s,o),aX(o);const a=!r.getQueryCache().get(s.queryHash),[l]=R.useState(()=>new t(r,s)),c=l.getOptimisticResult(s),u=!i&&e.subscribed!==!1;if(R.useSyncExternalStore(R.useCallback(v=>{const x=u?l.subscribe(gr.batchCalls(v)):mM;return l.updateResult(),x},[l,u]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),R.useEffect(()=>{l.setOptions(s,{listeners:!1})},[s,l]),dX(s,c))throw bM(s,l,o);if(lX({result:c,errorResetBoundary:o,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash)}))throw c.error;if((m=(h=r.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||m.call(h,s,c),s.experimental_prefetchInRender&&!pc&&uX(c,i)){const v=a?bM(s,l,o):(b=r.getQueryCache().get(s.queryHash))==null?void 0:b.promise;v==null||v.catch(mM).finally(()=>{l.updateResult()})}return s.notifyOnChangeProps?c:l.trackResult(c)}function gp(e,t){return fX(e,QK)}function CN({children:e}){const{setIsSessionExpired:t}=lr(),n=new XK({queryCache:new xN({onError:r=>{console.error(`Something went wrong: ${r.message}`),r.message==="invalid token"&&t(!0)}}),defaultOptions:{queries:{gcTime:1e3*60*10,staleTime:1e3*60*5,refetchOnWindowFocus:!1,retry:1}}});return y.jsx(eX,{client:n,children:e})}const Mc=P.forwardRef(({children:e,className:t,...n},r)=>y.jsx("div",{className:be("semaphor-scope",t),ref:r,...n,children:e})),hX={id:"",authToken:void 0},EN=P.createContext(hX),RN=({children:e,dashboardProps:t})=>y.jsx(CN,{children:y.jsx(EN.Provider,{value:t,children:y.jsx(Mc,{style:{height:"100%"},children:e})})});function uo(){const e=P.useContext(EN);if(e===void 0)throw new Error("useApplicationContext must be used within a ApplicationContextProvider");return e}function pX(){const{authToken:e,version:t}=uo(),n=ve(a=>a.selectedLensId),{data:r,isLoading:i,isFetching:o,isError:s}=gp({queryKey:["dashboard",n,e==null?void 0:e.accessToken],queryFn:()=>QY(e==null?void 0:e.accessToken,{lensId:n,version:t})});return{data:r,isLoading:i,isFetching:o,isError:s}}function PN(e){return e==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e}function yM(e,t){const n=PN(e);return n==="dark"?Ql.merge({...t==null?void 0:t.default},{...t==null?void 0:t.dark}):t==null?void 0:t.default}function gX({customStyle:e,currentTheme:t,onSave:n,onEvent:r,defaultFilterValues:i,onFilterValuesChange:o}){const{authToken:s}=uo(),a=ve(L=>L.selectedLensId),{data:l,isLoading:c,isFetching:u,isError:d}=pX(),[p,h]=P.useState(i||[]),{theme:m,setTheme:b}=fN(),v=ve(L=>L.dashboard.globalStyle),{setDashboard:x,setDashboardWithFilterValues:S,setSelectedSheetId:_,setStyle:E,setOnSaveFunction:C,setLenses:M,setSelectedLensId:O,setInitStore:N}=ve(L=>L.actions);ve(L=>L.actions.setCustomCards);const A=ve(L=>L.actions.setFilterValues),j=ve(L=>L.filterValues),F=ve(L=>L.actions.setThemeStyle),$=ve(L=>L.actions.setDashboardTheme),K=ve(L=>L.actions.setOnEvent);P.useEffect(()=>{s&&N()},[s,N]),P.useEffect(()=>{if(m){const L=PN(m);$(L)}},[m,$]),P.useEffect(()=>{t&&b(t)},[t,b]);const H=P.useCallback(()=>{const L=Ql.cloneDeep(mb),W=Ql.merge(L,v);if(e){const B=Ql.merge(W,e),U=yM(m,B);F(U),E(B)}else{const B=yM(m,W);F(B),E(mb)}},[m,e,v,F,E]);return P.useEffect(()=>{l&&l.dashboard&&H()},[m,e,v,H,l]),P.useEffect(()=>{var Q,G;function L(D,ee){const q=D.filters||[],oe=[];for(const J of ee){const Z=q.find(ae=>ae.id===J.filterId);Z&&oe.push({filterId:J.filterId,connectionType:Z.database==="NA"?"api":"database",name:Z.column,operation:Z.operation,valueType:Cu(Z),values:J.values})}return oe}if(!l||!l.dashboard)return;const{dashboard:W,filterValues:B,defaultLensId:U,lenses:Y}=l,I=L(W,p||[]);S(W,(!B||(B==null?void 0:B.length)===0?I:B)||[]),U&&O(U),Y&&M(Y),_(((G=(Q=W==null?void 0:W.sheets)==null?void 0:Q[0])==null?void 0:G.id)||null)},[l,x,_,A,a,M,S,O,p]),P.useEffect(()=>{o&&j&&o(j)},[j,o]),P.useEffect(()=>{n&&C(n),r&&K(r)},[n,C,r,K]),{isFetching:u,isLoading:c,isError:d}}function Ru({className:e,...t}){return y.jsx("div",{className:be("animate-pulse rounded-md bg-muted",e),...t})}const TN=R.forwardRef(({className:e,...t},n)=>y.jsx("div",{ref:n,className:be("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));TN.displayName="Card";const Ry=R.forwardRef(({className:e,...t},n)=>y.jsx("div",{ref:n,className:be("flex flex-col space-y-1.5 p-6",e),...t}));Ry.displayName="CardHeader";const _d=R.forwardRef(({className:e,...t},n)=>y.jsx("h3",{ref:n,className:be("text-2xl font-semibold leading-none tracking-tight",e),...t}));_d.displayName="CardTitle";const Q_=R.forwardRef(({className:e,...t},n)=>y.jsx("p",{ref:n,className:be("text-sm text-muted-foreground",e),...t}));Q_.displayName="CardDescription";const Py=R.forwardRef(({className:e,...t},n)=>y.jsx("div",{ref:n,className:be("px-6 pt-0",e),...t}));Py.displayName="CardContent";const MN=R.forwardRef(({className:e,...t},n)=>y.jsx("div",{ref:n,className:be("flex items-center p-6 pt-0",e),...t}));MN.displayName="CardFooter";function ON({className:e,customStyle:t,onSave:n,onEvent:r,LoadingComponent:i,ErrorComponent:o,onChartElementClicked:s,id:a,authToken:l,currentTheme:c,version:u,customCards:d,showAssistant:p,defaultFilterValues:h,onFilterValuesChange:m,...b}){ve(C=>C.selectedSheetId);const v=ve(C=>C.themeStyle),x=ve(C=>C.isSessionExpired),{isLoading:S,isError:_,isFetching:E}=gX({authToken:l,customStyle:t,currentTheme:c,onSave:n,onEvent:r,defaultFilterValues:h,onFilterValuesChange:m});return S||!l?(r==null||r({type:"info",message:"Loading dashboard"}),i?y.jsx(i,{message:"loading"}):y.jsx("div",{className:"flex items-center gap-3",children:y.jsx(Ru,{className:"h-1 w-full dark:h-[2px]"})})):_?(r==null||r({type:"error",message:"Error fetching dashboard"}),o?(console.log("Error fetching dashboard"),y.jsx(o,{})):y.jsx("div",{children:"Error"})):x?(r==null||r({type:"error",message:"Session Expired"}),y.jsx("div",{className:"flex h-full items-center justify-center",children:y.jsxs("div",{className:"space-y-4 rounded-md border border-muted p-10",children:[y.jsx(_d,{children:"Session Expired"}),y.jsx("p",{className:"text-muted-foreground",children:"Please refresh your page to continue."})]})})):y.jsx("div",{className:be("flex h-full flex-col justify-between",v==null?void 0:v.dashboardPanel,e),style:{},role:"dashboard-panel",...b})}function Re(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function mX(e,t){const n=R.createContext(t),r=o=>{const{children:s,...a}=o,l=R.useMemo(()=>a,Object.values(a));return y.jsx(n.Provider,{value:l,children:s})};r.displayName=e+"Provider";function i(o){const s=R.useContext(n);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[r,i]}function er(e,t=[]){let n=[];function r(o,s){const a=R.createContext(s),l=n.length;n=[...n,s];const c=d=>{var x;const{scope:p,children:h,...m}=d,b=((x=p==null?void 0:p[e])==null?void 0:x[l])||a,v=R.useMemo(()=>m,Object.values(m));return y.jsx(b.Provider,{value:v,children:h})};c.displayName=o+"Provider";function u(d,p){var b;const h=((b=p==null?void 0:p[e])==null?void 0:b[l])||a,m=R.useContext(h);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${o}\``)}return[c,u]}const i=()=>{const o=n.map(s=>R.createContext(s));return function(a){const l=(a==null?void 0:a[e])||o;return R.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,bX(i,...t)]}function bX(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(o)[`__scope${c}`];return{...a,...d}},{});return R.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function vM(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ty(...e){return t=>{let n=!1;const r=e.map(i=>{const o=vM(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i<r.length;i++){const o=r[i];typeof o=="function"?o():vM(e[i],null)}}}}function rt(...e){return R.useCallback(Ty(...e),e)}var Js=R.forwardRef((e,t)=>{const{children:n,...r}=e,i=R.Children.toArray(n),o=i.find(yX);if(o){const s=o.props.children,a=i.map(l=>l===o?R.Children.count(s)>1?R.Children.only(null):R.isValidElement(s)?s.props.children:null:l);return y.jsx(L1,{...r,ref:t,children:R.isValidElement(s)?R.cloneElement(s,void 0,a):null})}return y.jsx(L1,{...r,ref:t,children:n})});Js.displayName="Slot";var L1=R.forwardRef((e,t)=>{const{children:n,...r}=e;if(R.isValidElement(n)){const i=xX(n);return R.cloneElement(n,{...vX(r,n.props),ref:t?Ty(t,i):i})}return R.Children.count(n)>1?R.Children.only(null):null});L1.displayName="SlotClone";var J_=({children:e})=>y.jsx(y.Fragment,{children:e});function yX(e){return R.isValidElement(e)&&e.type===J_}function vX(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{o(...a),i(...a)}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function xX(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function My(e){const t=e+"CollectionProvider",[n,r]=er(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=h=>{const{scope:m,children:b}=h,v=P.useRef(null),x=P.useRef(new Map).current;return y.jsx(i,{scope:m,itemMap:x,collectionRef:v,children:b})};s.displayName=t;const a=e+"CollectionSlot",l=P.forwardRef((h,m)=>{const{scope:b,children:v}=h,x=o(a,b),S=rt(m,x.collectionRef);return y.jsx(Js,{ref:S,children:v})});l.displayName=a;const c=e+"CollectionItemSlot",u="data-radix-collection-item",d=P.forwardRef((h,m)=>{const{scope:b,children:v,...x}=h,S=P.useRef(null),_=rt(m,S),E=o(c,b);return P.useEffect(()=>(E.itemMap.set(S,{ref:S,...x}),()=>void E.itemMap.delete(S))),y.jsx(Js,{[u]:"",ref:_,children:v})});d.displayName=c;function p(h){const m=o(e+"CollectionConsumer",h);return P.useCallback(()=>{const v=m.collectionRef.current;if(!v)return[];const x=Array.from(v.querySelectorAll(`[${u}]`));return Array.from(m.itemMap.values()).sort((E,C)=>x.indexOf(E.ref.current)-x.indexOf(C.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:s,Slot:l,ItemSlot:d},p,r]}var mr=globalThis!=null&&globalThis.document?R.useLayoutEffect:()=>{},wX=R.useId||(()=>{}),SX=0;function Gn(e){const[t,n]=R.useState(wX());return mr(()=>{e||n(r=>r??String(SX++))},[e]),e||(t?`radix-${t}`:"")}var _X=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Ne=_X.reduce((e,t)=>{const n=R.forwardRef((r,i)=>{const{asChild:o,...s}=r,a=o?Js:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),y.jsx(a,{...s,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function DN(e,t){e&&dc.flushSync(()=>e.dispatchEvent(t))}function Zn(e){const t=R.useRef(e);return R.useEffect(()=>{t.current=e}),R.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function Ar({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,i]=CX({defaultProp:t,onChange:n}),o=e!==void 0,s=o?e:r,a=Zn(n),l=R.useCallback(c=>{if(o){const d=typeof c=="function"?c(e):c;d!==e&&a(d)}else i(c)},[o,e,i,a]);return[s,l]}function CX({defaultProp:e,onChange:t}){const n=R.useState(e),[r]=n,i=R.useRef(r),o=Zn(t);return R.useEffect(()=>{i.current!==r&&(o(r),i.current=r)},[r,i,o]),n}var EX=R.createContext(void 0);function Oc(e){const t=R.useContext(EX);return e||t||"ltr"}var vx="rovingFocusGroup.onEntryFocus",RX={bubbles:!1,cancelable:!0},Oy="RovingFocusGroup",[F1,AN,PX]=My(Oy),[TX,Cd]=er(Oy,[PX]),[MX,OX]=TX(Oy),IN=R.forwardRef((e,t)=>y.jsx(F1.Provider,{scope:e.__scopeRovingFocusGroup,children:y.jsx(F1.Slot,{scope:e.__scopeRovingFocusGroup,children:y.jsx(DX,{...e,ref:t})})}));IN.displayName=Oy;var DX=R.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=e,p=R.useRef(null),h=rt(t,p),m=Oc(o),[b=null,v]=Ar({prop:s,defaultProp:a,onChange:l}),[x,S]=R.useState(!1),_=Zn(c),E=AN(n),C=R.useRef(!1),[M,O]=R.useState(0);return R.useEffect(()=>{const N=p.current;if(N)return N.addEventListener(vx,_),()=>N.removeEventListener(vx,_)},[_]),y.jsx(MX,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:b,onItemFocus:R.useCallback(N=>v(N),[v]),onItemShiftTab:R.useCallback(()=>S(!0),[]),onFocusableItemAdd:R.useCallback(()=>O(N=>N+1),[]),onFocusableItemRemove:R.useCallback(()=>O(N=>N-1),[]),children:y.jsx(Ne.div,{tabIndex:x||M===0?-1:0,"data-orientation":r,...d,ref:h,style:{outline:"none",...e.style},onMouseDown:Re(e.onMouseDown,()=>{C.current=!0}),onFocus:Re(e.onFocus,N=>{const A=!C.current;if(N.target===N.currentTarget&&A&&!x){const j=new CustomEvent(vx,RX);if(N.currentTarget.dispatchEvent(j),!j.defaultPrevented){const F=E().filter(W=>W.focusable),$=F.find(W=>W.active),K=F.find(W=>W.id===b),L=[$,K,...F].filter(Boolean).map(W=>W.ref.current);LN(L,u)}}C.current=!1}),onBlur:Re(e.onBlur,()=>S(!1))})})}),kN="RovingFocusGroupItem",NN=R.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,...s}=e,a=Gn(),l=o||a,c=OX(kN,n),u=c.currentTabStopId===l,d=AN(n),{onFocusableItemAdd:p,onFocusableItemRemove:h}=c;return R.useEffect(()=>{if(r)return p(),()=>h()},[r,p,h]),y.jsx(F1.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:y.jsx(Ne.span,{tabIndex:u?0:-1,"data-orientation":c.orientation,...s,ref:t,onMouseDown:Re(e.onMouseDown,m=>{r?c.onItemFocus(l):m.preventDefault()}),onFocus:Re(e.onFocus,()=>c.onItemFocus(l)),onKeyDown:Re(e.onKeyDown,m=>{if(m.key==="Tab"&&m.shiftKey){c.onItemShiftTab();return}if(m.target!==m.currentTarget)return;const b=kX(m,c.orientation,c.dir);if(b!==void 0){if(m.metaKey||m.ctrlKey||m.altKey||m.shiftKey)return;m.preventDefault();let x=d().filter(S=>S.focusable).map(S=>S.ref.current);if(b==="last")x.reverse();else if(b==="prev"||b==="next"){b==="prev"&&x.reverse();const S=x.indexOf(m.currentTarget);x=c.loop?NX(x,S+1):x.slice(S+1)}setTimeout(()=>LN(x))}})})})});NN.displayName=kN;var AX={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function IX(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function kX(e,t,n){const r=IX(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return AX[r]}function LN(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function NX(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Z_=IN,eC=NN;function LX(e,t){return R.useReducer((n,r)=>t[n][r]??n,e)}var qn=e=>{const{present:t,children:n}=e,r=FX(t),i=typeof n=="function"?n({present:r.isPresent}):R.Children.only(n),o=rt(r.ref,jX(i));return typeof n=="function"||r.isPresent?R.cloneElement(i,{ref:o}):null};qn.displayName="Presence";function FX(e){const[t,n]=R.useState(),r=R.useRef({}),i=R.useRef(e),o=R.useRef("none"),s=e?"mounted":"unmounted",[a,l]=LX(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return R.useEffect(()=>{const c=Bg(r.current);o.current=a==="mounted"?c:"none"},[a]),mr(()=>{const c=r.current,u=i.current;if(u!==e){const p=o.current,h=Bg(c);e?l("MOUNT"):h==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&p!==h?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),mr(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,d=h=>{const b=Bg(r.current).includes(h.animationName);if(h.target===t&&b&&(l("ANIMATION_END"),!i.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},p=h=>{h.target===t&&(o.current=Bg(r.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{u.clearTimeout(c),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:R.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function Bg(e){return(e==null?void 0:e.animationName)||"none"}function jX(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var tC="Tabs",[$X,RTe]=er(tC,[Cd]),FN=Cd(),[zX,nC]=$X(tC),jN=R.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:s="horizontal",dir:a,activationMode:l="automatic",...c}=e,u=Oc(a),[d,p]=Ar({prop:r,onChange:i,defaultProp:o});return y.jsx(zX,{scope:n,baseId:Gn(),value:d,onValueChange:p,orientation:s,dir:u,activationMode:l,children:y.jsx(Ne.div,{dir:u,"data-orientation":s,...c,ref:t})})});jN.displayName=tC;var $N="TabsList",zN=R.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,o=nC($N,n),s=FN(n);return y.jsx(Z_,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:r,children:y.jsx(Ne.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:t})})});zN.displayName=$N;var BN="TabsTrigger",HN=R.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...o}=e,s=nC(BN,n),a=FN(n),l=UN(s.baseId,r),c=GN(s.baseId,r),u=r===s.value;return y.jsx(eC,{asChild:!0,...a,focusable:!i,active:u,children:y.jsx(Ne.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:l,...o,ref:t,onMouseDown:Re(e.onMouseDown,d=>{!i&&d.button===0&&d.ctrlKey===!1?s.onValueChange(r):d.preventDefault()}),onKeyDown:Re(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&s.onValueChange(r)}),onFocus:Re(e.onFocus,()=>{const d=s.activationMode!=="manual";!u&&!i&&d&&s.onValueChange(r)})})})});HN.displayName=BN;var VN="TabsContent",WN=R.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:o,...s}=e,a=nC(VN,n),l=UN(a.baseId,r),c=GN(a.baseId,r),u=r===a.value,d=R.useRef(u);return R.useEffect(()=>{const p=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(p)},[]),y.jsx(qn,{present:i||u,children:({present:p})=>y.jsx(Ne.div,{"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!p,id:c,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:p&&o})})});WN.displayName=VN;function UN(e,t){return`${e}-trigger-${t}`}function GN(e,t){return`${e}-content-${t}`}var BX=jN,qN=zN,YN=HN,KN=WN;const rC=BX,Dy=R.forwardRef(({className:e,...t},n)=>y.jsx(qN,{ref:n,className:be("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Dy.displayName=qN.displayName;const Ay=R.forwardRef(({className:e,...t},n)=>y.jsx(YN,{ref:n,className:be("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}));Ay.displayName=YN.displayName;const iC=R.forwardRef(({className:e,...t},n)=>y.jsx(KN,{ref:n,className:be("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));iC.displayName=KN.displayName;var XN={exports:{}},mp={},j1={exports:{}};(function(e,t){(function(n,r){r(t)})(Ca,function(n){function r(Z){return function(ce,ge,ie,pe,de,Ee,De){return Z(ce,ge,De)}}function i(Z){return function(ce,ge,ie,pe){if(!ce||!ge||typeof ce!="object"||typeof ge!="object")return Z(ce,ge,ie,pe);var de=pe.get(ce),Ee=pe.get(ge);if(de&&Ee)return de===ge&&Ee===ce;pe.set(ce,ge),pe.set(ge,ce);var De=Z(ce,ge,ie,pe);return pe.delete(ce),pe.delete(ge),De}}function o(Z,ae){var ce={};for(var ge in Z)ce[ge]=Z[ge];for(var ge in ae)ce[ge]=ae[ge];return ce}function s(Z){return Z.constructor===Object||Z.constructor==null}function a(Z){return typeof Z.then=="function"}function l(Z,ae){return Z===ae||Z!==Z&&ae!==ae}var c="[object Arguments]",u="[object Boolean]",d="[object Date]",p="[object RegExp]",h="[object Map]",m="[object Number]",b="[object Object]",v="[object Set]",x="[object String]",S=Object.prototype.toString;function _(Z){var ae=Z.areArraysEqual,ce=Z.areDatesEqual,ge=Z.areMapsEqual,ie=Z.areObjectsEqual,pe=Z.areRegExpsEqual,de=Z.areSetsEqual,Ee=Z.createIsNestedEqual,De=Ee($e);function $e(Te,ze,yt){if(Te===ze)return!0;if(!Te||!ze||typeof Te!="object"||typeof ze!="object")return Te!==Te&&ze!==ze;if(s(Te)&&s(ze))return ie(Te,ze,De,yt);var Mt=Array.isArray(Te),gn=Array.isArray(ze);if(Mt||gn)return Mt===gn&&ae(Te,ze,De,yt);var Ot=S.call(Te);return Ot!==S.call(ze)?!1:Ot===d?ce(Te,ze,De,yt):Ot===p?pe(Te,ze,De,yt):Ot===h?ge(Te,ze,De,yt):Ot===v?de(Te,ze,De,yt):Ot===b||Ot===c?a(Te)||a(ze)?!1:ie(Te,ze,De,yt):Ot===u||Ot===m||Ot===x?l(Te.valueOf(),ze.valueOf()):!1}return $e}function E(Z,ae,ce,ge){var ie=Z.length;if(ae.length!==ie)return!1;for(;ie-- >0;)if(!ce(Z[ie],ae[ie],ie,ie,Z,ae,ge))return!1;return!0}var C=i(E);function M(Z,ae){return l(Z.valueOf(),ae.valueOf())}function O(Z,ae,ce,ge){var ie=Z.size===ae.size;if(!ie)return!1;if(!Z.size)return!0;var pe={},de=0;return Z.forEach(function(Ee,De){if(ie){var $e=!1,Te=0;ae.forEach(function(ze,yt){!$e&&!pe[Te]&&($e=ce(De,yt,de,Te,Z,ae,ge)&&ce(Ee,ze,De,yt,Z,ae,ge))&&(pe[Te]=!0),Te++}),de++,ie=$e}}),ie}var N=i(O),A="_owner",j=Object.prototype.hasOwnProperty;function F(Z,ae,ce,ge){var ie=Object.keys(Z),pe=ie.length;if(Object.keys(ae).length!==pe)return!1;for(var de;pe-- >0;){if(de=ie[pe],de===A){var Ee=!!Z.$$typeof,De=!!ae.$$typeof;if((Ee||De)&&Ee!==De)return!1}if(!j.call(ae,de)||!ce(Z[de],ae[de],de,de,Z,ae,ge))return!1}return!0}var $=i(F);function K(Z,ae){return Z.source===ae.source&&Z.flags===ae.flags}function H(Z,ae,ce,ge){var ie=Z.size===ae.size;if(!ie)return!1;if(!Z.size)return!0;var pe={};return Z.forEach(function(de,Ee){if(ie){var De=!1,$e=0;ae.forEach(function(Te,ze){!De&&!pe[$e]&&(De=ce(de,Te,Ee,ze,Z,ae,ge))&&(pe[$e]=!0),$e++}),ie=De}}),ie}var L=i(H),W=Object.freeze({areArraysEqual:E,areDatesEqual:M,areMapsEqual:O,areObjectsEqual:F,areRegExpsEqual:K,areSetsEqual:H,createIsNestedEqual:r}),B=Object.freeze({areArraysEqual:C,areDatesEqual:M,areMapsEqual:N,areObjectsEqual:$,areRegExpsEqual:K,areSetsEqual:L,createIsNestedEqual:r}),U=_(W);function Y(Z,ae){return U(Z,ae,void 0)}var I=_(o(W,{createIsNestedEqual:function(){return l}}));function Q(Z,ae){return I(Z,ae,void 0)}var G=_(B);function D(Z,ae){return G(Z,ae,new WeakMap)}var ee=_(o(B,{createIsNestedEqual:function(){return l}}));function q(Z,ae){return ee(Z,ae,new WeakMap)}function oe(Z){return _(o(W,Z(W)))}function J(Z){var ae=_(o(B,Z(B)));return function(ce,ge,ie){return ie===void 0&&(ie=new WeakMap),ae(ce,ge,ie)}}n.circularDeepEqual=D,n.circularShallowEqual=q,n.createCustomCircularEqual=J,n.createCustomEqual=oe,n.deepEqual=Y,n.sameValueZeroEqual=l,n.shallowEqual=Q,Object.defineProperty(n,"__esModule",{value:!0})})})(j1,j1.exports);var oC=j1.exports;const sC=L_(lY);var Ct={},HX=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(Ct,"__esModule",{value:!0});Ct.bottom=aC;Ct.childrenEqual=GX;Ct.cloneLayout=QN;Ct.cloneLayoutItem=Jl;Ct.collides=Iy;Ct.compact=ZN;Ct.compactItem=e5;Ct.compactType=oQ;Ct.correctBounds=t5;Ct.fastPositionEqual=qX;Ct.fastRGLPropsEqual=void 0;Ct.getAllCollisions=n5;Ct.getFirstCollision=Ll;Ct.getLayoutItem=lC;Ct.getStatics=cC;Ct.modifyLayout=JN;Ct.moveElement=If;Ct.moveElementAwayFromCollision=z1;Ct.noop=void 0;Ct.perc=KX;Ct.resizeItemInDirection=tQ;Ct.setTopLeft=rQ;Ct.setTransform=nQ;Ct.sortLayoutItems=gC;Ct.sortLayoutItemsByColRow=a5;Ct.sortLayoutItemsByRowCol=s5;Ct.synchronizeLayoutWithChildren=iQ;Ct.validateLayout=l5;Ct.withLayoutItem=UX;var xM=oC,Af=VX(P);function VX(e){return e&&e.__esModule?e:{default:e}}const WX=process.env.NODE_ENV==="production";function aC(e){let t=0,n;for(let r=0,i=e.length;r<i;r++)n=e[r].y+e[r].h,n>t&&(t=n);return t}function QN(e){const t=Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=Jl(e[n]);return t}function JN(e,t){const n=Array(e.length);for(let r=0,i=e.length;r<i;r++)t.i===e[r].i?n[r]=t:n[r]=e[r];return n}function UX(e,t,n){let r=lC(e,t);return r?(r=n(Jl(r)),e=JN(e,r),[e,r]):[e,null]}function Jl(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 GX(e,t){return(0,xM.deepEqual)(Af.default.Children.map(e,n=>n==null?void 0:n.key),Af.default.Children.map(t,n=>n==null?void 0:n.key))&&(0,xM.deepEqual)(Af.default.Children.map(e,n=>n==null?void 0:n.props["data-grid"]),Af.default.Children.map(t,n=>n==null?void 0:n.props["data-grid"]))}Ct.fastRGLPropsEqual=HX;function qX(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function Iy(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 ZN(e,t,n,r){const i=cC(e),o=gC(e,t),s=Array(e.length);for(let a=0,l=o.length;a<l;a++){let c=Jl(o[a]);c.static||(c=e5(i,c,t,n,o,r),i.push(c)),s[e.indexOf(o[a])]=c,c.moved=!1}return s}const YX={x:"w",y:"h"};function $1(e,t,n,r){const i=YX[r];t[r]+=1;const o=e.map(s=>s.i).indexOf(t.i);for(let s=o+1;s<e.length;s++){const a=e[s];if(!a.static){if(a.y>t.y+t.h)break;Iy(t,a)&&$1(e,a,n+t[i],r)}}t[r]=n}function e5(e,t,n,r,i,o){const s=n==="vertical",a=n==="horizontal";if(s)for(t.y=Math.min(aC(e),t.y);t.y>0&&!Ll(e,t);)t.y--;else if(a)for(;t.x>0&&!Ll(e,t);)t.x--;let l;for(;(l=Ll(e,t))&&!(n===null&&o);)if(a?$1(i,t,l.x+l.w,"x"):$1(i,t,l.y+l.h,"y"),a&&t.x+t.w>r)for(t.x=r-t.w,t.y++;t.x>0&&!Ll(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function t5(e,t){const n=cC(e);for(let r=0,i=e.length;r<i;r++){const o=e[r];if(o.x+o.w>t.cols&&(o.x=t.cols-o.w),o.x<0&&(o.x=0,o.w=t.cols),!o.static)n.push(o);else for(;Ll(n,o);)o.y++}return e}function lC(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function Ll(e,t){for(let n=0,r=e.length;n<r;n++)if(Iy(e[n],t))return e[n]}function n5(e,t){return e.filter(n=>Iy(n,t))}function cC(e){return e.filter(t=>t.static)}function If(e,t,n,r,i,o,s,a,l){if(t.static&&t.isDraggable!==!0||t.y===r&&t.x===n)return e;`${t.i}${String(n)}${String(r)}${t.x}${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 d=gC(e,s);(s==="vertical"&&typeof r=="number"?u>=r:s==="horizontal"&&typeof n=="number"?c>=n:!1)&&(d=d.reverse());const h=n5(d,t),m=h.length>0;if(m&&l)return QN(e);if(m&&o)return`${t.i}`,t.x=c,t.y=u,t.moved=!1,e;for(let b=0,v=h.length;b<v;b++){const x=h[b];`${t.i}${t.x}${t.y}${x.i}${x.x}${x.y}`,!x.moved&&(x.static?e=z1(e,x,t,i,s):e=z1(e,t,x,i,s))}return e}function z1(e,t,n,r,i,o){const s=i==="horizontal",a=i==="vertical",l=t.static;if(r){r=!1;const d={x:s?Math.max(t.x-n.w,0):n.x,y:a?Math.max(t.y-n.h,0):n.y,w:n.w,h:n.h,i:"-1"},p=Ll(e,d),h=p&&p.y+p.h>t.y,m=p&&t.x+t.w>p.x;if(p){if(h&&a)return If(e,n,void 0,t.y+1,r,l,i);if(h&&i==null)return t.y=n.y,n.y=n.y+n.h,e;if(m&&s)return If(e,t,n.x,void 0,r,l,i)}else return`${n.i}${d.x}${d.y}`,If(e,n,s?d.x:void 0,a?d.y:void 0,r,l,i)}const c=s?n.x+1:void 0,u=a?n.y+1:void 0;return c==null&&u==null?e:If(e,n,s?n.x+1:void 0,a?n.y+1:void 0,r,l,i)}function KX(e){return e*100+"%"}const r5=(e,t,n,r)=>e+n>r?t:n,i5=(e,t,n)=>e<0?t:n,o5=e=>Math.max(0,e),uC=e=>Math.max(0,e),dC=(e,t,n)=>{let{left:r,height:i,width:o}=t;const s=e.top-(i-e.height);return{left:r,width:o,height:i5(s,e.height,i),top:uC(s)}},fC=(e,t,n)=>{let{top:r,left:i,height:o,width:s}=t;return{top:r,height:o,width:r5(e.left,e.width,s,n),left:o5(i)}},hC=(e,t,n)=>{let{top:r,height:i,width:o}=t;const s=e.left-(o-e.width);return{height:i,width:s<0?e.width:r5(e.left,e.width,o,n),top:uC(r),left:o5(s)}},pC=(e,t,n)=>{let{top:r,left:i,height:o,width:s}=t;return{width:s,left:i,height:i5(r,e.height,o),top:uC(r)}},XX=function(){return dC(arguments.length<=0?void 0:arguments[0],fC(...arguments))},QX=function(){return dC(arguments.length<=0?void 0:arguments[0],hC(...arguments))},JX=function(){return pC(arguments.length<=0?void 0:arguments[0],fC(...arguments))},ZX=function(){return pC(arguments.length<=0?void 0:arguments[0],hC(...arguments))},eQ={n:dC,ne:XX,e:fC,se:JX,s:pC,sw:ZX,w:hC,nw:QX};function tQ(e,t,n,r){const i=eQ[e];return i?i(t,{...t,...n},r):n}function nQ(e){let{top:t,left:n,width:r,height:i}=e;const o=`translate(${n}px,${t}px)`;return{transform:o,WebkitTransform:o,MozTransform:o,msTransform:o,OTransform:o,width:`${r}px`,height:`${i}px`,position:"absolute"}}function rQ(e){let{top:t,left:n,width:r,height:i}=e;return{top:`${t}px`,left:`${n}px`,width:`${r}px`,height:`${i}px`,position:"absolute"}}function gC(e,t){return t==="horizontal"?a5(e):t==="vertical"?s5(e):e}function s5(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 a5(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 iQ(e,t,n,r,i){e=e||[];const o=[];Af.default.Children.forEach(t,a=>{if((a==null?void 0:a.key)==null)return;const l=lC(e,String(a.key)),c=a.props["data-grid"];l&&c==null?o.push(Jl(l)):c?(WX||l5([c],"ReactGridLayout.children"),o.push(Jl({...c,i:a.key}))):o.push(Jl({w:1,h:1,x:0,y:aC(o),i:String(a.key)}))});const s=t5(o,{cols:n});return i?s:ZN(s,r,n)}function l5(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,i=e.length;r<i;r++){const o=e[r];for(let s=0;s<n.length;s++){const a=n[s],l=o[a];if(typeof l!="number"||Number.isNaN(l))throw new Error(`ReactGridLayout: ${t}[${r}].${a} must be a number! Received: ${l} (${typeof l})`)}if(typeof o.i<"u"&&typeof o.i!="string")throw new Error(`ReactGridLayout: ${t}[${r}].i must be a string! Received: ${o.i} (${typeof o.i})`)}}function oQ(e){const{verticalCompact:t,compactType:n}=e||{};return t===!1?null:n}const sQ=()=>{};Ct.noop=sQ;var hs={};Object.defineProperty(hs,"__esModule",{value:!0});hs.calcGridColWidth=ky;hs.calcGridItemPosition=aQ;hs.calcGridItemWHPx=B1;hs.calcWH=cQ;hs.calcXY=lQ;hs.clamp=Fl;function ky(e){const{margin:t,containerPadding:n,containerWidth:r,cols:i}=e;return(r-t[0]*(i-1)-n[0]*2)/i}function B1(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function aQ(e,t,n,r,i,o){const{margin:s,containerPadding:a,rowHeight:l}=e,c=ky(e),u={};return o&&o.resizing?(u.width=Math.round(o.resizing.width),u.height=Math.round(o.resizing.height)):(u.width=B1(r,c,s[0]),u.height=B1(i,l,s[1])),o&&o.dragging?(u.top=Math.round(o.dragging.top),u.left=Math.round(o.dragging.left)):o&&o.resizing&&typeof o.resizing.top=="number"&&typeof o.resizing.left=="number"?(u.top=Math.round(o.resizing.top),u.left=Math.round(o.resizing.left)):(u.top=Math.round((l+s[1])*n+a[1]),u.left=Math.round((c+s[0])*t+a[0])),u}function lQ(e,t,n,r,i){const{margin:o,containerPadding:s,cols:a,rowHeight:l,maxRows:c}=e,u=ky(e);let d=Math.round((n-s[0])/(u+o[0])),p=Math.round((t-s[1])/(l+o[1]));return d=Fl(d,0,a-r),p=Fl(p,0,c-i),{x:d,y:p}}function cQ(e,t,n,r,i,o){const{margin:s,maxRows:a,cols:l,rowHeight:c}=e,u=ky(e);let d=Math.round((t+s[0])/(u+s[0])),p=Math.round((n+s[1])/(c+s[1])),h=Fl(d,0,l-r),m=Fl(p,0,a-i);return["sw","w","nw"].indexOf(o)!==-1&&(h=Fl(d,0,l)),["nw","n","ne"].indexOf(o)!==-1&&(m=Fl(p,0,a)),{w:h,h:m}}function Fl(e,t,n){return Math.max(Math.min(e,n),t)}var Ny={},H1={exports:{}},Hg={exports:{}},Yt={};/** @license React v16.13.1
92
92
  * react-is.production.min.js
93
93
  *
94
94
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -327,7 +327,7 @@ Valid keys: `+JSON.stringify(Object.keys(I),null," "));var ie=ge(J,ce,ee,q,oe+"
327
327
  font-size: .6rem;
328
328
  font-weight: bold;
329
329
  color: hsl(${Math.max(0,Math.min(120-120*b,120))}deg 100% 31%);`,n==null?void 0:n.key)}return(l=n==null?void 0:n.onChange)==null||l.call(n,i),i}}function Iw(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const Ybe=(e,t)=>Math.abs(e-t)<1,Kbe=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},Xbe=e=>e,Qbe=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let i=t;i<=n;i++)r.push(i);return r},Jbe=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const i=s=>{const{width:a,height:l}=s;t({width:Math.round(a),height:Math.round(l)})};if(i(n.getBoundingClientRect()),!r.ResizeObserver)return()=>{};const o=new r.ResizeObserver(s=>{const a=s[0];if(a!=null&&a.borderBoxSize){const l=a.borderBoxSize[0];if(l){i({width:l.inlineSize,height:l.blockSize});return}}i(n.getBoundingClientRect())});return o.observe(n,{box:"border-box"}),()=>{o.unobserve(n)}},qA={passive:!0},Zbe=typeof window>"u"?!0:"onscrollend"in window,eye=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let i=0;const o=e.options.useScrollendEvent&&Zbe?()=>{}:Kbe(r,()=>{t(i,!1)},e.options.isScrollingResetDelay),s=c=>()=>{const{horizontal:u,isRtl:d}=e.options;i=u?n.scrollLeft*(d&&-1||1):n.scrollTop,o(),t(i,c)},a=s(!0),l=s(!1);return l(),n.addEventListener("scroll",a,qA),n.addEventListener("scrollend",l,qA),()=>{n.removeEventListener("scroll",a),n.removeEventListener("scrollend",l)}},tye=(e,t,n)=>{if(t!=null&&t.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return Math.round(e.getBoundingClientRect()[n.options.horizontal?"width":"height"])},nye=(e,{adjustments:t=0,behavior:n},r)=>{var i,o;const s=e+t;(o=(i=r.scrollElement)==null?void 0:i.scrollTo)==null||o.call(i,{[r.options.horizontal?"left":"top"]:s,behavior:n})};class rye{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(i=>{i.forEach(o=>{this._measureElement(o.target,o)})}));return{disconnect:()=>{var i;(i=r())==null||i.disconnect(),n=null},observe:i=>{var o;return(o=r())==null?void 0:o.observe(i,{box:"border-box"})},unobserve:i=>{var o;return(o=r())==null?void 0:o.unobserve(i)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,i])=>{typeof i>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Xbe,rangeExtractor:Qbe,onChange:()=>{},measureElement:tye,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!0,...n}},this.notify=n=>{var r,i;(i=(r=this.options).onChange)==null||i.call(r,this,n)},this.maybeNotify=cu(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=o,this.maybeNotify()}))}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const i=new Map,o=new Map;for(let s=r-1;s>=0;s--){const a=n[s];if(i.has(a.lane))continue;const l=o.get(a.lane);if(l==null||a.end>l.end?o.set(a.lane,a):a.end<l.end&&i.set(a.lane,!0),i.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((s,a)=>s.end===a.end?s.index-a.index:s.end-a.end)[0]:void 0},this.getMeasurementOptions=cu(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(n,r,i,o,s)=>(this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:r,scrollMargin:i,getItemKey:o,enabled:s}),{key:!1}),this.getMeasurements=cu(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:i,getItemKey:o,enabled:s},a)=>{if(!s)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(u=>{this.itemSizeCache.set(u.key,u.size)}));const l=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const c=this.measurementsCache.slice(0,l);for(let u=l;u<n;u++){const d=o(u),p=this.options.lanes===1?c[u-1]:this.getFurthestMeasurement(c,u),h=p?p.end+this.options.gap:r+i,m=a.get(d),b=typeof m=="number"?m:this.options.estimateSize(u),v=h+b,x=p?p.lane:u%this.options.lanes;c[u]={index:u,start:h,size:b,end:v,key:d,lane:x}}return this.measurementsCache=c,c},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=cu(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset()],(n,r,i)=>this.range=n.length>0&&r>0?iye({measurements:n,outerSize:r,scrollOffset:i}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getIndexes=cu(()=>[this.options.rangeExtractor,this.calculateRange(),this.options.overscan,this.options.count],(n,r,i,o)=>r===null?[]:n({startIndex:r.startIndex,endIndex:r.endIndex,overscan:i,count:o}),{key:process.env.NODE_ENV!=="production"&&"getIndexes",debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,i=n.getAttribute(r);return i?parseInt(i,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(n,r)=>{const i=this.indexFromElement(n),o=this.measurementsCache[i];if(!o)return;const s=o.key,a=this.elementsCache.get(s);a!==n&&(a&&this.observer.unobserve(a),this.observer.observe(n),this.elementsCache.set(s,n)),n.isConnected&&this.resizeItem(i,this.options.measureElement(n,r,this))},this.resizeItem=(n,r)=>{const i=this.measurementsCache[n];if(!i)return;const o=this.itemSizeCache.get(i.key)??i.size,s=r-o;s!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(i,s,this):i.start<this.getScrollOffset()+this.scrollAdjustments)&&(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",s),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=s,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(i.index),this.itemSizeCache=new Map(this.itemSizeCache.set(i.key,r)),this.notify(!1))},this.measureElement=n=>{if(!n){this.elementsCache.forEach((r,i)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(i))});return}this._measureElement(n,void 0)},this.getVirtualItems=cu(()=>[this.getIndexes(),this.getMeasurements()],(n,r)=>{const i=[];for(let o=0,s=n.length;o<s;o++){const a=n[o],l=r[a];i.push(l)}return i},{key:process.env.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return Iw(r[k8(0,r.length-1,i=>Iw(r[i]).start,n)])},this.getOffsetForAlignment=(n,r)=>{const i=this.getSize(),o=this.getScrollOffset();r==="auto"&&n>=o+i&&(r="end"),r==="end"&&(n-=i);const s=this.options.horizontal?"scrollWidth":"scrollHeight",l=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[s]:this.scrollElement[s]:0)-i;return Math.max(Math.min(l,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const i=this.measurementsCache[n];if(!i)return;const o=this.getSize(),s=this.getScrollOffset();if(r==="auto")if(i.end>=s+o-this.options.scrollPaddingEnd)r="end";else if(i.start<=s+this.options.scrollPaddingStart)r="start";else return[s,r];const a=i.start-this.options.scrollPaddingStart+(i.size-o)/2;switch(r){case"center":return[this.getOffsetForAlignment(a,r),r];case"end":return[this.getOffsetForAlignment(i.end+this.options.scrollPaddingEnd,r),r];default:return[this.getOffsetForAlignment(i.start-this.options.scrollPaddingStart,r),r]}},this.isDynamicMode=()=>this.elementsCache.size>0,this.cancelScrollToIndex=()=>{this.scrollToIndexTimeoutId!==null&&this.targetWindow&&(this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId),this.scrollToIndexTimeoutId=null)},this.scrollToOffset=(n,{align:r="start",behavior:i}={})=>{this.cancelScrollToIndex(),i==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,r),{adjustments:void 0,behavior:i})},this.scrollToIndex=(n,{align:r="auto",behavior:i}={})=>{n=Math.max(0,Math.min(n,this.options.count-1)),this.cancelScrollToIndex(),i==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");const o=this.getOffsetForIndex(n,r);if(!o)return;const[s,a]=o;this._scrollToOffset(s,{adjustments:void 0,behavior:i}),i!=="smooth"&&this.isDynamicMode()&&this.targetWindow&&(this.scrollToIndexTimeoutId=this.targetWindow.setTimeout(()=>{if(this.scrollToIndexTimeoutId=null,this.elementsCache.has(this.options.getItemKey(n))){const[c]=Iw(this.getOffsetForIndex(n,a));Ybe(c,this.getScrollOffset())||this.scrollToIndex(n,{align:a,behavior:i})}else this.scrollToIndex(n,{align:a,behavior:i})}))},this.scrollBy=(n,{behavior:r}={})=>{this.cancelScrollToIndex(),r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+n,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let i;return r.length===0?i=this.options.paddingStart:i=this.options.lanes===1?((n=r[r.length-1])==null?void 0:n.end)??0:Math.max(...r.slice(-this.options.lanes).map(o=>o.end)),Math.max(i-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:r,behavior:i})=>{this.options.scrollToFn(n,{behavior:i,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(t)}}const k8=(e,t,n,r)=>{for(;e<=t;){const i=(e+t)/2|0,o=n(i);if(o<r)e=i+1;else if(o>r)t=i-1;else return i}return e>0?e-1:0};function iye({measurements:e,outerSize:t,scrollOffset:n}){const r=e.length-1,o=k8(0,r,a=>e[a].start,n);let s=o;for(;s<r&&e[s].end<n+t;)s++;return{startIndex:o,endIndex:s}}const YA=typeof document<"u"?R.useLayoutEffect:R.useEffect;function oye(e){const t=R.useReducer(()=>({}),{})[1],n={...e,onChange:(i,o)=>{var s;o?Tr.flushSync(t):t(),(s=e.onChange)==null||s.call(e,i,o)}},[r]=R.useState(()=>new rye(n));return r.setOptions(n),YA(()=>r._didMount(),[]),YA(()=>r._willUpdate()),r}function sye(e){return oye({observeElementRect:Jbe,observeElementOffset:eye,scrollToFn:nye,...e})}function aye(e,t){return e!==null&&t!==null&&typeof e=="object"&&typeof t=="object"&&"id"in e&&"id"in t?e.id===t.id:e===t}function lye(e=aye){return P.useCallback((t,n)=>{if(typeof e=="string"){let r=e;return(t==null?void 0:t[r])===(n==null?void 0:n[r])}return e(t,n)},[e])}function cye(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function KA(e,t=!1){let[n,r]=P.useReducer(()=>({}),{}),i=P.useMemo(()=>cye(e),[e,n]);return nn(()=>{if(!e)return;let o=new ResizeObserver(r);return o.observe(e),()=>{o.disconnect()}},[e]),t?{width:`${i.width}px`,height:`${i.height}px`}:i}let uye=class extends Map{constructor(t){super(),this.factory=t}get(t){let n=super.get(t);return n===void 0&&(n=this.factory(t),this.set(t,n)),n}};function N8(e,t){let n=e(),r=new Set;return{getSnapshot(){return n},subscribe(i){return r.add(i),()=>r.delete(i)},dispatch(i,...o){let s=t[i].call(n,...o);s&&(n=s,r.forEach(a=>a()))}}}function L8(e){return P.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}let dye=new uye(()=>N8(()=>[],{ADD(e){return this.includes(e)?this:[...this,e]},REMOVE(e){let t=this.indexOf(e);if(t===-1)return this;let n=this.slice();return n.splice(t,1),n}}));function fR(e,t){let n=dye.get(t),r=P.useId(),i=L8(n);if(nn(()=>{if(e)return n.dispatch("ADD",r),()=>n.dispatch("REMOVE",r)},[n,e]),!e)return!1;let o=i.indexOf(r),s=i.length;return o===-1&&(o=s,s+=1),o===s-1}let o_=new Map,dh=new Map;function XA(e){var t;let n=(t=dh.get(e))!=null?t:0;return dh.set(e,n+1),n!==0?()=>QA(e):(o_.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>QA(e))}function QA(e){var t;let n=(t=dh.get(e))!=null?t:1;if(n===1?dh.delete(e):dh.set(e,n-1),n!==1)return;let r=o_.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,o_.delete(e))}function fye(e,{allowed:t,disallowed:n}={}){let r=fR(e,"inert-others");nn(()=>{var i,o;if(!r)return;let s=ds();for(let l of(i=n==null?void 0:n())!=null?i:[])l&&s.add(XA(l));let a=(o=t==null?void 0:t())!=null?o:[];for(let l of a){if(!l)continue;let c=Hp(l);if(!c)continue;let u=l.parentElement;for(;u&&u!==c.body;){for(let d of u.children)a.some(p=>d.contains(p))||s.add(XA(d));u=u.parentElement}}return s.dispose},[r,t,n])}function hye(e,t,n){let r=ol(i=>{let o=i.getBoundingClientRect();o.x===0&&o.y===0&&o.width===0&&o.height===0&&n()});P.useEffect(()=>{if(!e)return;let i=t===null?null:t instanceof HTMLElement?t:t.current;if(!i)return;let o=ds();if(typeof ResizeObserver<"u"){let s=new ResizeObserver(()=>r.current(i));s.observe(i),o.add(()=>s.disconnect())}if(typeof IntersectionObserver<"u"){let s=new IntersectionObserver(()=>r.current(i));s.observe(i),o.add(()=>s.disconnect())}return()=>o.dispose()},[t,r,e])}let s_=["[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 pye=(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[e.AutoFocus=64]="AutoFocus",e))(pye||{}),gye=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(gye||{}),mye=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(mye||{}),F8=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(F8||{});function bye(e,t=0){var n;return e===((n=Hp(e))==null?void 0:n.body)?!1:Mo(t,{0(){return e.matches(s_)},1(){let r=e;for(;r!==null;){if(r.matches(s_))return!0;r=r.parentElement}return!1}})}var yye=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(yye||{});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 vye(e,t=n=>n){return e.slice().sort((n,r)=>{let i=t(n),o=t(r);if(i===null||o===null)return 0;let s=i.compareDocumentPosition(o);return s&Node.DOCUMENT_POSITION_FOLLOWING?-1:s&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function j8(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function xye(){return/Android/gi.test(window.navigator.userAgent)}function $8(){return j8()||xye()}function _f(e,t,n,r){let i=ol(n);P.useEffect(()=>{if(!e)return;function o(s){i.current(s)}return document.addEventListener(t,o,r),()=>document.removeEventListener(t,o,r)},[e,t,r])}function wye(e,t,n,r){let i=ol(n);P.useEffect(()=>{if(!e)return;function o(s){i.current(s)}return window.addEventListener(t,o,r),()=>window.removeEventListener(t,o,r)},[e,t,r])}const JA=30;function Sye(e,t,n){let r=fR(e,"outside-click"),i=ol(n),o=P.useCallback(function(l,c){if(l.defaultPrevented)return;let u=c(l);if(u===null||!u.getRootNode().contains(u)||!u.isConnected)return;let d=function p(h){return typeof h=="function"?p(h()):Array.isArray(h)||h instanceof Set?h:[h]}(t);for(let p of d)if(p!==null&&(p.contains(u)||l.composed&&l.composedPath().includes(p)))return;return!bye(u,F8.Loose)&&u.tabIndex!==-1&&l.preventDefault(),i.current(l,u)},[i,t]),s=P.useRef(null);_f(r,"pointerdown",l=>{var c,u;s.current=((u=(c=l.composedPath)==null?void 0:c.call(l))==null?void 0:u[0])||l.target},!0),_f(r,"mousedown",l=>{var c,u;s.current=((u=(c=l.composedPath)==null?void 0:c.call(l))==null?void 0:u[0])||l.target},!0),_f(r,"click",l=>{$8()||s.current&&(o(l,()=>s.current),s.current=null)},!0);let a=P.useRef({x:0,y:0});_f(r,"touchstart",l=>{a.current.x=l.touches[0].clientX,a.current.y=l.touches[0].clientY},!0),_f(r,"touchend",l=>{let c={x:l.changedTouches[0].clientX,y:l.changedTouches[0].clientY};if(!(Math.abs(c.x-a.current.x)>=JA||Math.abs(c.y-a.current.y)>=JA))return o(l,()=>l.target instanceof HTMLElement?l.target:null)},!0),wye(r,"blur",l=>o(l,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function D0(...e){return P.useMemo(()=>Hp(...e),[...e])}function _ye(e,t,n,r){let i=ol(n);P.useEffect(()=>{e=e??window;function o(s){i.current(s)}return e.addEventListener(t,o,r),()=>e.removeEventListener(t,o,r)},[e,t,r])}function z8(e){let t=P.useRef({value:"",selectionStart:null,selectionEnd:null});return _ye(e,"blur",n=>{let r=n.target;r instanceof HTMLInputElement&&(t.current={value:r.value,selectionStart:r.selectionStart,selectionEnd:r.selectionEnd})}),qe(()=>{if(document.activeElement!==e&&e instanceof HTMLInputElement&&e.isConnected){if(e.focus({preventScroll:!0}),e.value!==t.current.value)e.setSelectionRange(e.value.length,e.value.length);else{let{selectionStart:n,selectionEnd:r}=t.current;n!==null&&r!==null&&e.setSelectionRange(n,r)}t.current={value:"",selectionStart:null,selectionEnd:null}}})}function Cye(e,t){return P.useMemo(()=>{var n;if(e.type)return e.type;let r=(n=e.as)!=null?n:"button";if(typeof r=="string"&&r.toLowerCase()==="button"||(t==null?void 0:t.tagName)==="BUTTON"&&!t.hasAttribute("type"))return"button"},[e.type,e.as,t])}function Eye(){let e;return{before({doc:t}){var n;let r=t.documentElement,i=(n=t.defaultView)!=null?n:window;e=Math.max(0,i.innerWidth-r.clientWidth)},after({doc:t,d:n}){let r=t.documentElement,i=Math.max(0,r.clientWidth-r.offsetWidth),o=Math.max(0,e-i);n.style(r,"paddingRight",`${o}px`)}}}function Rye(){return j8()?{before({doc:e,d:t,meta:n}){function r(i){return n.containers.flatMap(o=>o()).some(o=>o.contains(i))}t.microTask(()=>{var i;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let a=ds();a.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>a.dispose()))}let o=(i=window.scrollY)!=null?i:window.pageYOffset,s=null;t.addEventListener(e,"click",a=>{if(a.target instanceof HTMLElement)try{let l=a.target.closest("a");if(!l)return;let{hash:c}=new URL(l.href),u=e.querySelector(c);u&&!r(u)&&(s=u)}catch{}},!0),t.addEventListener(e,"touchstart",a=>{if(a.target instanceof HTMLElement)if(r(a.target)){let l=a.target;for(;l.parentElement&&r(l.parentElement);)l=l.parentElement;t.style(l,"overscrollBehavior","contain")}else t.style(a.target,"touchAction","none")}),t.addEventListener(e,"touchmove",a=>{if(a.target instanceof HTMLElement){if(a.target.tagName==="INPUT")return;if(r(a.target)){let l=a.target;for(;l.parentElement&&l.dataset.headlessuiPortal!==""&&!(l.scrollHeight>l.clientHeight||l.scrollWidth>l.clientWidth);)l=l.parentElement;l.dataset.headlessuiPortal===""&&a.preventDefault()}else a.preventDefault()}},{passive:!1}),t.add(()=>{var a;let l=(a=window.scrollY)!=null?a:window.pageYOffset;o!==l&&window.scrollTo(0,o),s&&s.isConnected&&(s.scrollIntoView({block:"nearest"}),s=null)})})}}:{}}function Pye(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function Tye(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let Bl=N8(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:ds(),meta:new Set};return r.count++,r.meta.add(t),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t)),this},SCROLL_PREVENT({doc:e,d:t,meta:n}){let r={doc:e,d:t,meta:Tye(n)},i=[Rye(),Eye(),Pye()];i.forEach(({before:o})=>o==null?void 0:o(r)),i.forEach(({after:o})=>o==null?void 0:o(r))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});Bl.subscribe(()=>{let e=Bl.getSnapshot(),t=new Map;for(let[n]of e)t.set(n,n.documentElement.style.overflow);for(let n of e.values()){let r=t.get(n.doc)==="hidden",i=n.count!==0;(i&&!r||!i&&r)&&Bl.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&Bl.dispatch("TEARDOWN",n)}});function Mye(e,t,n=()=>({containers:[]})){let r=L8(Bl),i=t?r.get(t):void 0,o=i?i.count>0:!1;return nn(()=>{if(!(!t||!e))return Bl.dispatch("PUSH",t,n),()=>Bl.dispatch("POP",t,n)},[e,t]),o}function Oye(e,t,n=()=>[document.body]){let r=fR(e,"scroll-lock");Mye(r,t,i=>{var o;return{containers:[...(o=i.containers)!=null?o:[],n]}})}function ZA(e){return[e.screenX,e.screenY]}function Dye(){let e=P.useRef([-1,-1]);return{wasMoved(t){let n=ZA(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=ZA(t)}}}function Aye(e=0){let[t,n]=P.useState(e),r=P.useCallback(l=>n(l),[t]),i=P.useCallback(l=>n(c=>c|l),[t]),o=P.useCallback(l=>(t&l)===l,[t]),s=P.useCallback(l=>n(c=>c&~l),[n]),a=P.useCallback(l=>n(c=>c^l),[n]);return{flags:t,setFlag:r,addFlag:i,hasFlag:o,removeFlag:s,toggleFlag:a}}var eI,tI;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((eI=process==null?void 0:process.env)==null?void 0:eI.NODE_ENV)==="test"&&typeof((tI=Element==null?void 0:Element.prototype)==null?void 0:tI.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
330
- `)),[]});var Iye=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(Iye||{});function B8(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function H8(e,t,n,r){let[i,o]=P.useState(n),{hasFlag:s,addFlag:a,removeFlag:l}=Aye(e&&i?3:0),c=P.useRef(!1),u=P.useRef(!1),d=kd();return nn(()=>{var p;if(e){if(n&&o(!0),!t){n&&a(3);return}return(p=r==null?void 0:r.start)==null||p.call(r,n),kye(t,{inFlight:c,prepare(){u.current?u.current=!1:u.current=c.current,c.current=!0,!u.current&&(n?(a(3),l(4)):(a(4),l(2)))},run(){u.current?n?(l(3),a(4)):(l(4),a(3)):n?l(1):a(1)},done(){var h;u.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(c.current=!1,l(7),n||o(!1),(h=r==null?void 0:r.end)==null||h.call(r,n))}})}},[e,n,t,d]),e?[i,{closed:s(1),enter:s(2),leave:s(4),transition:s(2)||s(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function kye(e,{prepare:t,run:n,done:r,inFlight:i}){let o=ds();return Lye(e,{prepare:t,inFlight:i}),o.nextFrame(()=>{n(),o.requestAnimationFrame(()=>{o.add(Nye(e,r))})}),o.dispose}function Nye(e,t){var n,r;let i=ds();if(!e)return i.dispose;let o=!1;i.add(()=>{o=!0});let s=(r=(n=e.getAnimations)==null?void 0:n.call(e).filter(a=>a instanceof CSSTransition))!=null?r:[];return s.length===0?(t(),i.dispose):(Promise.allSettled(s.map(a=>a.finished)).then(()=>{o||t()}),i.dispose)}function Lye(e,{inFlight:t,prepare:n}){if(t!=null&&t.current){n();return}let r=e.style.transition;e.style.transition="none",n(),e.offsetHeight,e.style.transition=r}function Fye(e,{container:t,accept:n,walk:r}){let i=P.useRef(n),o=P.useRef(r);P.useEffect(()=>{i.current=n,o.current=r},[n,r]),nn(()=>{if(!t||!e)return;let s=Hp(t);if(!s)return;let a=i.current,l=o.current,c=Object.assign(d=>a(d),{acceptNode:a}),u=s.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,c,!1);for(;u.nextNode();)l(u.currentNode)},[t,e,i,o])}function nI(e,t){let n=P.useRef([]),r=qe(e);P.useEffect(()=>{let i=[...n.current];for(let[o,s]of t.entries())if(n.current[o]!==s){let a=r(t,i);return n.current=t,a}},[r,...t])}function jye(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}const V8={...R},$ye=V8.useInsertionEffect,zye=$ye||(e=>e());function W8(e){const t=R.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return zye(()=>{t.current=e}),R.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.current==null?void 0:t.current(...r)},[])}var a_=typeof document<"u"?P.useLayoutEffect:P.useEffect;let rI=!1,Bye=0;const iI=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Bye++;function Hye(){const[e,t]=R.useState(()=>rI?iI():void 0);return a_(()=>{e==null&&t(iI())},[]),R.useEffect(()=>{rI=!0},[]),e}const Vye=V8.useId,Wye=Vye||Hye;let Lh;process.env.NODE_ENV!=="production"&&(Lh=new Set);function Uye(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const i="Floating UI: "+n.join(" ");if(!((e=Lh)!=null&&e.has(i))){var o;(o=Lh)==null||o.add(i),console.warn(i)}}function Gye(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const i="Floating UI: "+n.join(" ");if(!((e=Lh)!=null&&e.has(i))){var o;(o=Lh)==null||o.add(i),console.error(i)}}function qye(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(i=>i(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,((r=e.get(t))==null?void 0:r.filter(i=>i!==n))||[])}}}const Yye=R.createContext(null),Kye=R.createContext(null),Xye=()=>{var e;return((e=R.useContext(Yye))==null?void 0:e.id)||null},Qye=()=>R.useContext(Kye),Jye="data-floating-ui-focusable";function Zye(e){const{open:t=!1,onOpenChange:n,elements:r}=e,i=Wye(),o=R.useRef({}),[s]=R.useState(()=>qye()),a=Xye()!=null;if(process.env.NODE_ENV!=="production"){const h=r.reference;h&&!Dr(h)&&Gye("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[l,c]=R.useState(r.reference),u=W8((h,m,b)=>{o.current.openEvent=h?m:void 0,s.emit("openchange",{open:h,event:m,reason:b,nested:a}),n==null||n(h,m,b)}),d=R.useMemo(()=>({setPositionReference:c}),[]),p=R.useMemo(()=>({reference:l||r.reference||null,floating:r.floating||null,domReference:r.reference}),[l,r.reference,r.floating]);return R.useMemo(()=>({dataRef:o,open:t,onOpenChange:u,elements:p,events:s,floatingId:i,refs:d}),[t,u,p,s,i,d])}function e0e(e){e===void 0&&(e={});const{nodeId:t}=e,n=Zye({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,i=r.elements,[o,s]=R.useState(null),[a,l]=R.useState(null),u=(i==null?void 0:i.domReference)||o,d=R.useRef(null),p=Qye();a_(()=>{u&&(d.current=u)},[u]);const h=b3({...e,elements:{...i,...a&&{reference:a}}}),m=R.useCallback(_=>{const E=Dr(_)?{getBoundingClientRect:()=>_.getBoundingClientRect(),contextElement:_}:_;l(E),h.refs.setReference(E)},[h.refs]),b=R.useCallback(_=>{(Dr(_)||_===null)&&(d.current=_,s(_)),(Dr(h.refs.reference.current)||h.refs.reference.current===null||_!==null&&!Dr(_))&&h.refs.setReference(_)},[h.refs]),v=R.useMemo(()=>({...h.refs,setReference:b,setPositionReference:m,domReference:d}),[h.refs,b,m]),x=R.useMemo(()=>({...h.elements,domReference:u}),[h.elements,u]),S=R.useMemo(()=>({...h,...r,refs:v,elements:x,nodeId:t}),[h,v,x,t,r]);return a_(()=>{r.dataRef.current.floatingContext=S;const _=p==null?void 0:p.nodesRef.current.find(E=>E.id===t);_&&(_.context=S)}),R.useMemo(()=>({...h,context:S,refs:v,elements:x}),[h,v,x,S])}const oI="active",sI="selected";function kw(e,t,n){const r=new Map,i=n==="item";let o=e;if(i&&e){const{[oI]:s,[sI]:a,...l}=e;o=l}return{...n==="floating"&&{tabIndex:-1,[Jye]:""},...o,...t.map(s=>{const a=s?s[n]:null;return typeof a=="function"?e?a(e):null:a}).concat(e).reduce((s,a)=>(a&&Object.entries(a).forEach(l=>{let[c,u]=l;if(!(i&&[oI,sI].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof u=="function"){var d;(d=r.get(c))==null||d.push(u),s[c]=function(){for(var p,h=arguments.length,m=new Array(h),b=0;b<h;b++)m[b]=arguments[b];return(p=r.get(c))==null?void 0:p.map(v=>v(...m)).find(v=>v!==void 0)}}}else s[c]=u}),s),{})}}function t0e(e){e===void 0&&(e=[]);const t=e.map(a=>a==null?void 0:a.reference),n=e.map(a=>a==null?void 0:a.floating),r=e.map(a=>a==null?void 0:a.item),i=R.useCallback(a=>kw(a,e,"reference"),t),o=R.useCallback(a=>kw(a,e,"floating"),n),s=R.useCallback(a=>kw(a,e,"item"),r);return R.useMemo(()=>({getReferenceProps:i,getFloatingProps:o,getItemProps:s}),[i,o,s])}function aI(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const n0e=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:i,offset:o=0,index:s=0,minItemsVisible:a=4,referenceOverflowThreshold:l=0,scrollRef:c,...u}=ls(e,t),{rects:d,elements:{floating:p}}=t,h=n.current[s],m=(c==null?void 0:c.current)||p,b=p.clientTop||m.clientTop,v=p.clientTop!==0,x=m.clientTop!==0,S=p===m;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||Uye('`placement` side must be "bottom" when using the `inner`',"middleware.")),!h)return{};const _={...t,...await wE(-h.offsetTop-p.clientTop-d.reference.height/2-h.offsetHeight/2-o).fn(t)},E=await ew(aI(_,m.scrollHeight+b+p.clientTop),u),C=await ew(_,{...u,elementContext:"reference"}),M=Pr(0,E.top),O=_.y+M,j=(m.scrollHeight>m.clientHeight?F=>F:Dh)(Pr(0,m.scrollHeight+(v&&S||x?b*2:0)-M-Pr(0,E.bottom)));if(m.style.maxHeight=j+"px",m.scrollTop=M,i){const F=m.offsetHeight<h.offsetHeight*ea(a,n.current.length)-1||C.top>=-l||C.bottom>=-l;dc.flushSync(()=>i(F))}return r&&(r.current=await ew(aI({..._,y:O},m.offsetHeight+b+p.clientTop),u)),{y:O}}});function r0e(e,t){const{open:n,elements:r}=e,{enabled:i=!0,overflowRef:o,scrollRef:s,onChange:a}=t,l=W8(a),c=R.useRef(!1),u=R.useRef(null),d=R.useRef(null);R.useEffect(()=>{if(!i)return;function h(b){if(b.ctrlKey||!m||o.current==null)return;const v=b.deltaY,x=o.current.top>=-.5,S=o.current.bottom>=-.5,_=m.scrollHeight-m.clientHeight,E=v<0?-1:1,C=v<0?"max":"min";m.scrollHeight<=m.clientHeight||(!x&&v>0||!S&&v<0?(b.preventDefault(),dc.flushSync(()=>{l(M=>M+Math[C](v,_*E))})):/firefox/i.test(jye())&&(m.scrollTop+=v))}const m=(s==null?void 0:s.current)||r.floating;if(n&&m)return m.addEventListener("wheel",h),requestAnimationFrame(()=>{u.current=m.scrollTop,o.current!=null&&(d.current={...o.current})}),()=>{u.current=null,d.current=null,m.removeEventListener("wheel",h)}},[i,n,r.floating,o,s,l]);const p=R.useMemo(()=>({onKeyDown(){c.current=!0},onWheel(){c.current=!1},onPointerMove(){c.current=!1},onScroll(){const h=(s==null?void 0:s.current)||r.floating;if(!(!o.current||!h||!c.current)){if(u.current!==null){const m=h.scrollTop-u.current;(o.current.bottom<-.5&&m<-1||o.current.top<-.5&&m>1)&&dc.flushSync(()=>l(b=>b+m))}requestAnimationFrame(()=>{u.current=h.scrollTop})}}}),[r.floating,l,o,s]);return R.useMemo(()=>i?{floating:p}:{},[i,p])}let Vp=P.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Vp.displayName="FloatingContext";let hR=P.createContext(null);hR.displayName="PlacementContext";function i0e(e){return P.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function o0e(){return P.useContext(Vp).setReference}function s0e(){let{getFloatingProps:e,slot:t}=P.useContext(Vp);return P.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function a0e(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=P.useContext(hR),n=P.useMemo(()=>e,[JSON.stringify(e,(i,o)=>{var s;return(s=o==null?void 0:o.outerHTML)!=null?s:o})]);nn(()=>{t==null||t(n??null)},[t,n]);let r=P.useContext(Vp);return P.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let lI=4;function l0e({children:e,enabled:t=!0}){let[n,r]=P.useState(null),[i,o]=P.useState(0),s=P.useRef(null),[a,l]=P.useState(null);c0e(a);let c=t&&n!==null&&a!==null,{to:u="bottom",gap:d=0,offset:p=0,padding:h=0,inner:m}=u0e(n,a),[b,v="center"]=u.split(" ");nn(()=>{c&&o(0)},[c]);let{refs:x,floatingStyles:S,context:_}=e0e({open:c,placement:b==="selection"?v==="center"?"bottom":`bottom-${v}`:v==="center"?`${b}`:`${b}-${v}`,strategy:"absolute",transform:!1,middleware:[wE({mainAxis:b==="selection"?0:d,crossAxis:p}),y3({padding:h}),b!=="selection"&&v3({padding:h}),b==="selection"&&m?n0e({...m,padding:h,overflowRef:s,offset:i,minItemsVisible:lI,referenceOverflowThreshold:h,onFallbackChange(F){var $,K;if(!F)return;let H=_.elements.floating;if(!H)return;let L=parseFloat(getComputedStyle(H).scrollPaddingBottom)||0,W=Math.min(lI,H.childElementCount),B=0,U=0;for(let Y of(K=($=_.elements.floating)==null?void 0:$.childNodes)!=null?K:[])if(Y instanceof HTMLElement){let I=Y.offsetTop,Q=I+Y.clientHeight+L,G=H.scrollTop,D=G+H.clientHeight;if(I>=G&&Q<=D)W--;else{U=Math.max(0,Math.min(Q,D)-Math.max(I,G)),B=Y.clientHeight;break}}W>=1&&o(Y=>{let I=B*W-U+L;return Y>=I?Y:I})}}):null,x3({padding:h,apply({availableWidth:F,availableHeight:$,elements:K}){Object.assign(K.floating.style,{overflow:"auto",maxWidth:`${F}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${$}px)`})}})].filter(Boolean),whileElementsMounted:g3}),[E=b,C=v]=_.placement.split("-");b==="selection"&&(E="selection");let M=P.useMemo(()=>({anchor:[E,C].filter(Boolean).join(" ")}),[E,C]),O=r0e(_,{overflowRef:s,onChange:o}),{getReferenceProps:N,getFloatingProps:A}=t0e([O]),j=qe(F=>{l(F),x.setFloating(F)});return R.createElement(hR.Provider,{value:r},R.createElement(Vp.Provider,{value:{setFloating:j,setReference:x.setReference,styles:S,getReferenceProps:N,getFloatingProps:A,slot:M}},e))}function c0e(e){nn(()=>{if(!e)return;let t=new MutationObserver(()=>{let n=window.getComputedStyle(e).maxHeight,r=parseFloat(n);if(isNaN(r))return;let i=parseInt(n);isNaN(i)||r!==i&&(e.style.maxHeight=`${Math.ceil(r)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}function u0e(e,t){var n,r,i;let o=Nw((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),s=Nw((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),a=Nw((i=e==null?void 0:e.padding)!=null?i:"var(--anchor-padding, 0)",t);return{...e,gap:o,offset:s,padding:a}}function Nw(e,t,n=void 0){let r=kd(),i=qe((l,c)=>{if(l==null)return[n,null];if(typeof l=="number")return[l,null];if(typeof l=="string"){if(!c)return[n,null];let u=cI(l,c);return[u,d=>{let p=U8(l);{let h=p.map(m=>window.getComputedStyle(c).getPropertyValue(m));r.requestAnimationFrame(function m(){r.nextFrame(m);let b=!1;for(let[x,S]of p.entries()){let _=window.getComputedStyle(c).getPropertyValue(S);if(h[x]!==_){h[x]=_,b=!0;break}}if(!b)return;let v=cI(l,c);u!==v&&(d(v),u=v)})}return r.dispose}]}return[n,null]}),o=P.useMemo(()=>i(e,t)[0],[e,t]),[s=o,a]=P.useState();return nn(()=>{let[l,c]=i(e,t);if(a(l),!!c)return c(a)},[e,t]),s}function U8(e){let t=/var\((.*)\)/.exec(e);if(t){let n=t[1].indexOf(",");if(n===-1)return[t[1]];let r=t[1].slice(0,n).trim(),i=t[1].slice(n+1).trim();return i?[r,...U8(i)]:[r]}return[]}function cI(e,t){let n=document.createElement("div");t.appendChild(n),n.style.setProperty("margin-top","0px","important"),n.style.setProperty("margin-top",e,"important");let r=parseFloat(window.getComputedStyle(n).marginTop)||0;return t.removeChild(n),r}function d0e({children:e,freeze:t}){let n=l_(t,e);return P.createElement(P.Fragment,null,n)}function l_(e,t){let[n,r]=P.useState(t);return!e&&n!==t&&r(t),e?n:t}let pR=P.createContext(null);pR.displayName="OpenClosedContext";var Po=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Po||{});function gR(){return P.useContext(pR)}function G8({value:e,children:t}){return P.createElement(pR.Provider,{value:e},t)}function f0e(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let Il=[];f0e(()=>{function e(t){if(!(t.target instanceof HTMLElement)||t.target===document.body||Il[0]===t.target)return;let n=t.target;n=n.closest(s_),Il.unshift(n??t.target),Il=Il.filter(r=>r!=null&&r.isConnected),Il.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 h0e(e){throw new Error("Unexpected object: "+e)}var Wn=(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))(Wn||{});function uI(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),i=r??-1;switch(e.focus){case 0:{for(let o=0;o<n.length;++o)if(!t.resolveDisabled(n[o],o,n))return o;return r}case 1:{i===-1&&(i=n.length);for(let o=i-1;o>=0;--o)if(!t.resolveDisabled(n[o],o,n))return o;return r}case 2:{for(let o=i+1;o<n.length;++o)if(!t.resolveDisabled(n[o],o,n))return o;return r}case 3:{for(let o=n.length-1;o>=0;--o)if(!t.resolveDisabled(n[o],o,n))return o;return r}case 4:{for(let o=0;o<n.length;++o)if(t.resolveId(n[o],o,n)===e.id)return o;return r}case 5:return null;default:h0e(e)}}var mR=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(mR||{});function p0e(e){let t=qe(e),n=P.useRef(!1);P.useEffect(()=>(n.current=!1,()=>{n.current=!0,C8(()=>{n.current&&t()})}),[t])}function g0e(){let e=typeof document>"u";return"useSyncExternalStore"in R?(t=>t.useSyncExternalStore)(R)(()=>()=>{},()=>!1,()=>!e):!1}function bR(){let e=g0e(),[t,n]=R.useState(lc.isHandoffComplete);return t&&lc.isHandoffComplete===!1&&n(!1),R.useEffect(()=>{t!==!0&&n(!0)},[t]),R.useEffect(()=>lc.handoff(),[]),e?!1:t}let m0e=P.createContext(!1);function b0e(){return P.useContext(m0e)}function y0e(e){let t=b0e(),n=P.useContext(Y8),r=D0(e),[i,o]=P.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(lc.isServer)return null;let a=r==null?void 0:r.getElementById("headlessui-portal-root");if(a)return a;if(r===null)return null;let l=r.createElement("div");return l.setAttribute("id","headlessui-portal-root"),r.body.appendChild(l)});return P.useEffect(()=>{i!==null&&(r!=null&&r.body.contains(i)||r==null||r.body.appendChild(i))},[i,r]),P.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),i}let q8=P.Fragment,v0e=yi(function(e,t){let n=e,r=P.useRef(null),i=ko(jbe(d=>{r.current=d}),t),o=D0(r),s=y0e(r),[a]=P.useState(()=>{var d;return lc.isServer?null:(d=o==null?void 0:o.createElement("div"))!=null?d:null}),l=P.useContext(_0e),c=bR();nn(()=>{!s||!a||s.contains(a)||(a.setAttribute("data-headlessui-portal",""),s.appendChild(a))},[s,a]),nn(()=>{if(a&&l)return l.register(a)},[l,a]),p0e(()=>{var d;!s||!a||(a instanceof Node&&s.contains(a)&&s.removeChild(a),s.childNodes.length<=0&&((d=s.parentElement)==null||d.removeChild(s)))});let u=Hi();return c?!s||!a?null:Tr.createPortal(u({ourProps:{ref:i},theirProps:n,slot:{},defaultTag:q8,name:"Portal"}),a):null});function x0e(e,t){let n=ko(t),{enabled:r=!0,...i}=e,o=Hi();return r?P.createElement(v0e,{...i,ref:n}):o({ourProps:{ref:n},theirProps:i,slot:{},defaultTag:q8,name:"Portal"})}let w0e=P.Fragment,Y8=P.createContext(null);function S0e(e,t){let{target:n,...r}=e,i={ref:ko(t)},o=Hi();return P.createElement(Y8.Provider,{value:n},o({ourProps:i,theirProps:r,defaultTag:w0e,name:"Popover.Group"}))}let _0e=P.createContext(null),C0e=yi(x0e),E0e=yi(S0e),R0e=Object.assign(C0e,{Group:E0e});var P0e=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(P0e||{}),T0e=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(T0e||{}),M0e=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))(M0e||{}),O0e=(e=>(e[e.OpenCombobox=0]="OpenCombobox",e[e.CloseCombobox=1]="CloseCombobox",e[e.GoToOption=2]="GoToOption",e[e.SetTyping=3]="SetTyping",e[e.RegisterOption=4]="RegisterOption",e[e.UnregisterOption=5]="UnregisterOption",e[e.SetActivationTrigger=6]="SetActivationTrigger",e[e.UpdateVirtualConfiguration=7]="UpdateVirtualConfiguration",e[e.SetInputElement=8]="SetInputElement",e[e.SetButtonElement=9]="SetButtonElement",e[e.SetOptionsElement=10]="SetOptionsElement",e))(O0e||{});function Lw(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=t(e.options.slice()),i=r.length>0&&r[0].dataRef.current.order!==null?r.sort((s,a)=>s.dataRef.current.order-a.dataRef.current.order):vye(r,s=>s.dataRef.current.domRef.current),o=n?i.indexOf(n):null;return o===-1&&(o=null),{options:i,activeOptionIndex:o}}let D0e={1(e){var t;return(t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===1?e:{...e,activeOptionIndex:null,comboboxState:1,isTyping:!1,activationTrigger:2,__demoMode:!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,__demoMode:!1}}return{...e,comboboxState:0,__demoMode:!1}},3(e,t){return e.isTyping===t.isTyping?e:{...e,isTyping:t.isTyping}},2(e,t){var n,r,i,o;if((n=e.dataRef.current)!=null&&n.disabled||e.optionsElement&&!((r=e.dataRef.current)!=null&&r.optionsPropsRef.current.static)&&e.comboboxState===1)return e;if(e.virtual){let{options:c,disabled:u}=e.virtual,d=t.focus===Wn.Specific?t.idx:uI(t,{resolveItems:()=>c,resolveActiveIndex:()=>{var h,m;return(m=(h=e.activeOptionIndex)!=null?h:c.findIndex(b=>!u(b)))!=null?m:null},resolveDisabled:u,resolveId(){throw new Error("Function not implemented.")}}),p=(i=t.trigger)!=null?i:2;return e.activeOptionIndex===d&&e.activationTrigger===p?e:{...e,activeOptionIndex:d,activationTrigger:p,isTyping:!1,__demoMode:!1}}let s=Lw(e);if(s.activeOptionIndex===null){let c=s.options.findIndex(u=>!u.dataRef.current.disabled);c!==-1&&(s.activeOptionIndex=c)}let a=t.focus===Wn.Specific?t.idx:uI(t,{resolveItems:()=>s.options,resolveActiveIndex:()=>s.activeOptionIndex,resolveId:c=>c.id,resolveDisabled:c=>c.dataRef.current.disabled}),l=(o=t.trigger)!=null?o:2;return e.activeOptionIndex===a&&e.activationTrigger===l?e:{...e,...s,isTyping:!1,activeOptionIndex:a,activationTrigger:l,__demoMode:!1}},4:(e,t)=>{var n,r,i;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:[...e.options,t.payload]};let o=t.payload,s=Lw(e,l=>(l.push(o),l));e.activeOptionIndex===null&&(r=e.dataRef.current)!=null&&r.isSelected(t.payload.dataRef.current.value)&&(s.activeOptionIndex=s.options.indexOf(o));let a={...e,...s,activationTrigger:2};return(i=e.dataRef.current)!=null&&i.__demoMode&&e.dataRef.current.value===void 0&&(a.activeOptionIndex=0),a},5:(e,t)=>{var n;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:e.options.filter(i=>i.id!==t.id)};let r=Lw(e,i=>{let o=i.findIndex(s=>s.id===t.id);return o!==-1&&i.splice(o,1),i});return{...e,...r,activationTrigger:2}},6:(e,t)=>e.activationTrigger===t.trigger?e:{...e,activationTrigger:t.trigger},7:(e,t)=>{var n,r;if(e.virtual===null)return{...e,virtual:{options:t.options,disabled:(n=t.disabled)!=null?n:()=>!1}};if(e.virtual.options===t.options&&e.virtual.disabled===t.disabled)return e;let i=e.activeOptionIndex;if(e.activeOptionIndex!==null){let o=t.options.indexOf(e.virtual.options[e.activeOptionIndex]);o!==-1?i=o:i=null}return{...e,activeOptionIndex:i,virtual:{options:t.options,disabled:(r=t.disabled)!=null?r:()=>!1}}},8:(e,t)=>e.inputElement===t.element?e:{...e,inputElement:t.element},9:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},10:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element}},yR=P.createContext(null);yR.displayName="ComboboxActionsContext";function Wp(e){let t=P.useContext(yR);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Wp),n}return t}let K8=P.createContext(null);function A0e(e){let t=Nd("VirtualProvider"),{options:n}=t.virtual,[r,i]=P.useMemo(()=>{let c=t.optionsElement;if(!c)return[0,0];let u=window.getComputedStyle(c);return[parseFloat(u.paddingBlockStart||u.paddingTop),parseFloat(u.paddingBlockEnd||u.paddingBottom)]},[t.optionsElement]),o=sye({enabled:n.length!==0,scrollPaddingStart:r,scrollPaddingEnd:i,count:n.length,estimateSize(){return 40},getScrollElement(){return t.optionsElement},overscan:12}),[s,a]=P.useState(0);nn(()=>{a(c=>c+1)},[n]);let l=o.getVirtualItems();return l.length===0?null:P.createElement(K8.Provider,{value:o},P.createElement("div",{style:{position:"relative",width:"100%",height:`${o.getTotalSize()}px`},ref:c=>{c&&t.activationTrigger!==0&&t.activeOptionIndex!==null&&n.length>t.activeOptionIndex&&o.scrollToIndex(t.activeOptionIndex)}},l.map(c=>{var u;return P.createElement(P.Fragment,{key:c.key},P.cloneElement((u=e.children)==null?void 0:u.call(e,{...e.slot,option:n[c.index]}),{key:`${s}-${c.key}`,"data-index":c.index,"aria-setsize":n.length,"aria-posinset":c.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${c.start}px)`,overflowAnchor:"none"}}))})))}let Fh=P.createContext(null);Fh.displayName="ComboboxDataContext";function Nd(e){let t=P.useContext(Fh);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Nd),n}return t}function I0e(e,t){return Mo(t.type,D0e,e,t)}let k0e=P.Fragment;function N0e(e,t){var n,r;let i=lR(),{value:o,defaultValue:s,onChange:a,form:l,name:c,by:u,disabled:d=i||!1,onClose:p,__demoMode:h=!1,multiple:m=!1,immediate:b=!1,virtual:v=null,nullable:x,...S}=e,_=Tbe(s),[E=m?[]:void 0,C]=Pbe(o,a,_),[M,O]=P.useReducer(I0e,{dataRef:P.createRef(),comboboxState:h?0:1,isTyping:!1,options:[],virtual:v?{options:v.options,disabled:(n=v.disabled)!=null?n:()=>!1}:null,activeOptionIndex:null,activationTrigger:2,inputElement:null,buttonElement:null,optionsElement:null,__demoMode:h}),N=P.useRef(!1),A=P.useRef({static:!1,hold:!1}),j=lye(u),F=qe(de=>v?u===null?v.options.indexOf(de):v.options.findIndex(Ee=>j(Ee,de)):M.options.findIndex(Ee=>j(Ee.dataRef.current.value,de))),$=P.useCallback(de=>Mo(H.mode,{1:()=>E.some(Ee=>j(Ee,de)),0:()=>j(E,de)}),[E]),K=qe(de=>M.activeOptionIndex===F(de)),H=P.useMemo(()=>({...M,immediate:b,optionsPropsRef:A,value:E,defaultValue:_,disabled:d,mode:m?1:0,virtual:v?M.virtual:null,get activeOptionIndex(){if(N.current&&M.activeOptionIndex===null&&(v?v.options.length>0:M.options.length>0)){if(v){let Ee=v.options.findIndex(De=>{var $e,Te;return!((Te=($e=v.disabled)==null?void 0:$e.call(v,De))!=null&&Te)});if(Ee!==-1)return Ee}let de=M.options.findIndex(Ee=>!Ee.dataRef.current.disabled);if(de!==-1)return de}return M.activeOptionIndex},calculateIndex:F,compare:j,isSelected:$,isActive:K}),[E,_,d,m,h,M,v]);nn(()=>{var de;v&&O({type:7,options:v.options,disabled:(de=v.disabled)!=null?de:null})},[v,v==null?void 0:v.options,v==null?void 0:v.disabled]),nn(()=>{M.dataRef.current=H},[H]);let L=H.comboboxState===0;Sye(L,[H.buttonElement,H.inputElement,H.optionsElement],()=>Z.closeCombobox());let W=P.useMemo(()=>{var de,Ee,De;return{open:H.comboboxState===0,disabled:d,activeIndex:H.activeOptionIndex,activeOption:H.activeOptionIndex===null?null:H.virtual?H.virtual.options[(de=H.activeOptionIndex)!=null?de:0]:(De=(Ee=H.options[H.activeOptionIndex])==null?void 0:Ee.dataRef.current.value)!=null?De:null,value:E}},[H,d,E]),B=qe(()=>{if(H.activeOptionIndex!==null){if(Z.setIsTyping(!1),H.virtual)D(H.virtual.options[H.activeOptionIndex]);else{let{dataRef:de}=H.options[H.activeOptionIndex];D(de.current.value)}Z.goToOption(Wn.Specific,H.activeOptionIndex)}}),U=qe(()=>{O({type:0}),N.current=!0}),Y=qe(()=>{O({type:1}),N.current=!1,p==null||p()}),I=qe(de=>{O({type:3,isTyping:de})}),Q=qe((de,Ee,De)=>(N.current=!1,de===Wn.Specific?O({type:2,focus:Wn.Specific,idx:Ee,trigger:De}):O({type:2,focus:de,trigger:De}))),G=qe((de,Ee)=>(O({type:4,payload:{id:de,dataRef:Ee}}),()=>{H.isActive(Ee.current.value)&&(N.current=!0),O({type:5,id:de})})),D=qe(de=>Mo(H.mode,{0(){return C==null?void 0:C(de)},1(){let Ee=H.value.slice(),De=Ee.findIndex($e=>j($e,de));return De===-1?Ee.push(de):Ee.splice(De,1),C==null?void 0:C(Ee)}})),ee=qe(de=>{O({type:6,trigger:de})}),q=qe(de=>{O({type:8,element:de})}),oe=qe(de=>{O({type:9,element:de})}),J=qe(de=>{O({type:10,element:de})}),Z=P.useMemo(()=>({onChange:D,registerOption:G,goToOption:Q,setIsTyping:I,closeCombobox:Y,openCombobox:U,setActivationTrigger:ee,selectActiveOption:B,setInputElement:q,setButtonElement:oe,setOptionsElement:J}),[]),[ae,ce]=Vbe(),ge=t===null?{}:{ref:t},ie=P.useCallback(()=>{if(_!==void 0)return C==null?void 0:C(_)},[C,_]),pe=Hi();return P.createElement(ce,{value:ae,props:{htmlFor:(r=H.inputElement)==null?void 0:r.id},slot:{open:H.comboboxState===0,disabled:d}},P.createElement(l0e,null,P.createElement(yR.Provider,{value:Z},P.createElement(Fh.Provider,{value:H},P.createElement(G8,{value:Mo(H.comboboxState,{0:Po.Open,1:Po.Closed})},c!=null&&P.createElement(Ibe,{disabled:d,data:E!=null?{[c]:E}:{},form:l,onReset:ie}),pe({ourProps:ge,theirProps:S,slot:W,defaultTag:k0e,name:"Combobox"}))))))}let L0e="input";function F0e(e,t){var n,r,i,o,s;let a=Nd("Combobox.Input"),l=Wp("Combobox.Input"),c=P.useId(),u=O8(),{id:d=u||`headlessui-combobox-input-${c}`,onChange:p,displayValue:h,disabled:m=a.disabled||!1,autoFocus:b=!1,type:v="text",...x}=e,S=P.useRef(null),_=ko(S,t,o0e(),l.setInputElement),E=D0(a.inputElement),C=kd(),M=qe(()=>{l.onChange(null),a.optionsElement&&(a.optionsElement.scrollTop=0),l.goToOption(Wn.Nothing)}),O=P.useMemo(()=>{var D;return typeof h=="function"&&a.value!==void 0?(D=h(a.value))!=null?D:"":typeof a.value=="string"?a.value:""},[a.value,h]);nI(([D,ee],[q,oe])=>{if(a.isTyping)return;let J=S.current;J&&((oe===0&&ee===1||D!==q)&&(J.value=D),requestAnimationFrame(()=>{if(a.isTyping||!J||(E==null?void 0:E.activeElement)!==J)return;let{selectionStart:Z,selectionEnd:ae}=J;Math.abs((ae??0)-(Z??0))===0&&Z===0&&J.setSelectionRange(J.value.length,J.value.length)}))},[O,a.comboboxState,E,a.isTyping]),nI(([D],[ee])=>{if(D===0&&ee===1){if(a.isTyping)return;let q=S.current;if(!q)return;let oe=q.value,{selectionStart:J,selectionEnd:Z,selectionDirection:ae}=q;q.value="",q.value=oe,ae!==null?q.setSelectionRange(J,Z,ae):q.setSelectionRange(J,Z)}},[a.comboboxState]);let N=P.useRef(!1),A=qe(()=>{N.current=!0}),j=qe(()=>{C.nextFrame(()=>{N.current=!1})}),F=qe(D=>{switch(l.setIsTyping(!0),D.key){case Wr.Enter:if(a.comboboxState!==0||N.current)return;if(D.preventDefault(),D.stopPropagation(),a.activeOptionIndex===null){l.closeCombobox();return}l.selectActiveOption(),a.mode===0&&l.closeCombobox();break;case Wr.ArrowDown:return D.preventDefault(),D.stopPropagation(),Mo(a.comboboxState,{0:()=>l.goToOption(Wn.Next),1:()=>l.openCombobox()});case Wr.ArrowUp:return D.preventDefault(),D.stopPropagation(),Mo(a.comboboxState,{0:()=>l.goToOption(Wn.Previous),1:()=>{Tr.flushSync(()=>l.openCombobox()),a.value||l.goToOption(Wn.Last)}});case Wr.Home:if(D.shiftKey)break;return D.preventDefault(),D.stopPropagation(),l.goToOption(Wn.First);case Wr.PageUp:return D.preventDefault(),D.stopPropagation(),l.goToOption(Wn.First);case Wr.End:if(D.shiftKey)break;return D.preventDefault(),D.stopPropagation(),l.goToOption(Wn.Last);case Wr.PageDown:return D.preventDefault(),D.stopPropagation(),l.goToOption(Wn.Last);case Wr.Escape:return a.comboboxState!==0?void 0:(D.preventDefault(),a.optionsElement&&!a.optionsPropsRef.current.static&&D.stopPropagation(),a.mode===0&&a.value===null&&M(),l.closeCombobox());case Wr.Tab:if(a.comboboxState!==0)return;a.mode===0&&a.activationTrigger!==1&&l.selectActiveOption(),l.closeCombobox();break}}),$=qe(D=>{p==null||p(D),a.mode===0&&D.target.value===""&&M(),l.openCombobox()}),K=qe(D=>{var ee,q,oe;let J=(ee=D.relatedTarget)!=null?ee:Il.find(Z=>Z!==D.currentTarget);if(!((q=a.optionsElement)!=null&&q.contains(J))&&!((oe=a.buttonElement)!=null&&oe.contains(J))&&a.comboboxState===0)return D.preventDefault(),a.mode===0&&a.value===null&&M(),l.closeCombobox()}),H=qe(D=>{var ee,q,oe;let J=(ee=D.relatedTarget)!=null?ee:Il.find(Z=>Z!==D.currentTarget);(q=a.buttonElement)!=null&&q.contains(J)||(oe=a.optionsElement)!=null&&oe.contains(J)||a.disabled||a.immediate&&a.comboboxState!==0&&C.microTask(()=>{Tr.flushSync(()=>l.openCombobox()),l.setActivationTrigger(1)})}),L=O0(),W=$be(),{isFocused:B,focusProps:U}=_8({autoFocus:b}),{isHovered:Y,hoverProps:I}=S8({isDisabled:m}),Q=P.useMemo(()=>({open:a.comboboxState===0,disabled:m,hover:Y,focus:B,autofocus:b}),[a,Y,B,b,m]),G=cR({ref:_,id:d,role:"combobox",type:v,"aria-controls":(n=a.optionsElement)==null?void 0:n.id,"aria-expanded":a.comboboxState===0,"aria-activedescendant":a.activeOptionIndex===null?void 0:a.virtual?(r=a.options.find(D=>!D.dataRef.current.disabled&&a.compare(D.dataRef.current.value,a.virtual.options[a.activeOptionIndex])))==null?void 0:r.id:(i=a.options[a.activeOptionIndex])==null?void 0:i.id,"aria-labelledby":L,"aria-describedby":W,"aria-autocomplete":"list",defaultValue:(s=(o=e.defaultValue)!=null?o:a.defaultValue!==void 0?h==null?void 0:h(a.defaultValue):null)!=null?s:a.defaultValue,disabled:m||void 0,autoFocus:b,onCompositionStart:A,onCompositionEnd:j,onKeyDown:F,onChange:$,onFocus:H,onBlur:K},U,I);return Hi()({ourProps:G,theirProps:x,slot:Q,defaultTag:L0e,name:"Combobox.Input"})}let j0e="button";function $0e(e,t){var n;let r=Nd("Combobox.Button"),i=Wp("Combobox.Button"),o=ko(t,i.setButtonElement),s=P.useId(),{id:a=`headlessui-combobox-button-${s}`,disabled:l=r.disabled||!1,autoFocus:c=!1,...u}=e,d=z8(r.inputElement),p=qe(O=>{switch(O.key){case Wr.Space:case Wr.Enter:O.preventDefault(),O.stopPropagation(),r.comboboxState===1&&Tr.flushSync(()=>i.openCombobox()),d();return;case Wr.ArrowDown:O.preventDefault(),O.stopPropagation(),r.comboboxState===1&&(Tr.flushSync(()=>i.openCombobox()),r.value||i.goToOption(Wn.First)),d();return;case Wr.ArrowUp:O.preventDefault(),O.stopPropagation(),r.comboboxState===1&&(Tr.flushSync(()=>i.openCombobox()),r.value||i.goToOption(Wn.Last)),d();return;case Wr.Escape:if(r.comboboxState!==0)return;O.preventDefault(),r.optionsElement&&!r.optionsPropsRef.current.static&&O.stopPropagation(),Tr.flushSync(()=>i.closeCombobox()),d();return;default:return}}),h=qe(O=>{O.preventDefault(),!Lbe(O.currentTarget)&&(O.button===mR.Left&&(r.comboboxState===0?i.closeCombobox():i.openCombobox()),d())}),m=O0([a]),{isFocusVisible:b,focusProps:v}=_8({autoFocus:c}),{isHovered:x,hoverProps:S}=S8({isDisabled:l}),{pressed:_,pressProps:E}=wbe({disabled:l}),C=P.useMemo(()=>({open:r.comboboxState===0,active:_||r.comboboxState===0,disabled:l,value:r.value,hover:x,focus:b}),[r,x,b,_,l]),M=cR({ref:o,id:a,type:Cye(e,r.buttonElement),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":(n=r.optionsElement)==null?void 0:n.id,"aria-expanded":r.comboboxState===0,"aria-labelledby":m,disabled:l||void 0,autoFocus:c,onMouseDown:h,onKeyDown:p},v,S,E);return Hi()({ourProps:M,theirProps:u,slot:C,defaultTag:j0e,name:"Combobox.Button"})}let z0e="div",B0e=ay.RenderStrategy|ay.Static;function H0e(e,t){var n,r,i;let o=P.useId(),{id:s=`headlessui-combobox-options-${o}`,hold:a=!1,anchor:l,portal:c=!1,modal:u=!0,transition:d=!1,...p}=e,h=Nd("Combobox.Options"),m=Wp("Combobox.Options"),b=i0e(l);b&&(c=!0);let[v,x]=a0e(b),[S,_]=P.useState(null),E=s0e(),C=ko(t,b?v:null,m.setOptionsElement,_),M=D0(h.optionsElement),O=gR(),[N,A]=H8(d,S,O!==null?(O&Po.Open)===Po.Open:h.comboboxState===0);hye(N,h.inputElement,m.closeCombobox);let j=h.__demoMode?!1:u&&h.comboboxState===0;Oye(j,M);let F=h.__demoMode?!1:u&&h.comboboxState===0;fye(F,{allowed:P.useCallback(()=>[h.inputElement,h.buttonElement,h.optionsElement],[h.inputElement,h.buttonElement,h.optionsElement])}),nn(()=>{var G;h.optionsPropsRef.current.static=(G=e.static)!=null?G:!1},[h.optionsPropsRef,e.static]),nn(()=>{h.optionsPropsRef.current.hold=a},[h.optionsPropsRef,a]),Fye(h.comboboxState===0,{container:h.optionsElement,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 $=O0([(n=h.buttonElement)==null?void 0:n.id]),K=P.useMemo(()=>({open:h.comboboxState===0,option:void 0}),[h.comboboxState]),H=qe(()=>{m.setActivationTrigger(0)}),L=qe(G=>{G.preventDefault(),m.setActivationTrigger(0)}),W=cR(b?E():{},{"aria-labelledby":$,role:"listbox","aria-multiselectable":h.mode===1?!0:void 0,id:s,ref:C,style:{...p.style,...x,"--input-width":KA(h.inputElement,!0).width,"--button-width":KA(h.buttonElement,!0).width},onWheel:h.activationTrigger===0?void 0:H,onMouseDown:L,...B8(A)}),B=N&&h.comboboxState===1,U=l_(B,(r=h.virtual)==null?void 0:r.options),Y=l_(B,h.value),I=qe(G=>h.compare(Y,G));if(h.virtual){if(U===void 0)throw new Error("Missing `options` in virtual mode");Object.assign(p,{children:P.createElement(Fh.Provider,{value:U!==h.virtual.options?{...h,virtual:{...h.virtual,options:U}}:h},P.createElement(A0e,{slot:K},p.children))})}let Q=Hi();return P.createElement(R0e,{enabled:c?e.static||N:!1},P.createElement(Fh.Provider,{value:h.mode===1?h:{...h,isSelected:I}},Q({ourProps:W,theirProps:{...p,children:P.createElement(d0e,{freeze:B},typeof p.children=="function"?(i=p.children)==null?void 0:i.call(p,K):p.children)},slot:K,defaultTag:z0e,features:B0e,visible:N,name:"Combobox.Options"})))}let V0e="div";function W0e(e,t){var n,r,i,o;let s=Nd("Combobox.Option"),a=Wp("Combobox.Option"),l=P.useId(),{id:c=`headlessui-combobox-option-${l}`,value:u,disabled:d=(i=(r=(n=s.virtual)==null?void 0:n.disabled)==null?void 0:r.call(n,u))!=null?i:!1,order:p=null,...h}=e,m=z8(s.inputElement),b=s.virtual?s.activeOptionIndex===s.calculateIndex(u):s.activeOptionIndex===null?!1:((o=s.options[s.activeOptionIndex])==null?void 0:o.id)===c,v=s.isSelected(u),x=P.useRef(null),S=ol({disabled:d,value:u,domRef:x,order:p}),_=P.useContext(K8),E=ko(t,x,_?_.measureElement:null),C=qe(()=>{a.setIsTyping(!1),a.onChange(u)});nn(()=>a.registerOption(c,S),[S,c]);let M=P.useRef(!(s.virtual||s.__demoMode));nn(()=>{if(!s.virtual&&!s.__demoMode)return ds().requestAnimationFrame(()=>{M.current=!0})},[s.virtual,s.__demoMode]),nn(()=>{if(M.current&&s.comboboxState===0&&b&&s.activationTrigger!==0)return ds().requestAnimationFrame(()=>{var L,W;(W=(L=x.current)==null?void 0:L.scrollIntoView)==null||W.call(L,{block:"nearest"})})},[x,b,s.comboboxState,s.activationTrigger,s.activeOptionIndex]);let O=qe(L=>{L.preventDefault(),L.button===mR.Left&&(d||(C(),$8()||requestAnimationFrame(()=>m()),s.mode===0&&a.closeCombobox()))}),N=qe(()=>{if(d)return a.goToOption(Wn.Nothing);let L=s.calculateIndex(u);a.goToOption(Wn.Specific,L)}),A=Dye(),j=qe(L=>A.update(L)),F=qe(L=>{if(!A.wasMoved(L)||d||b)return;let W=s.calculateIndex(u);a.goToOption(Wn.Specific,W,0)}),$=qe(L=>{A.wasMoved(L)&&(d||b&&(s.optionsPropsRef.current.hold||a.goToOption(Wn.Nothing)))}),K=P.useMemo(()=>({active:b,focus:b,selected:v,disabled:d}),[b,v,d]),H={id:c,ref:E,role:"option",tabIndex:d===!0?void 0:-1,"aria-disabled":d===!0?!0:void 0,"aria-selected":v,disabled:void 0,onMouseDown:O,onFocus:N,onPointerEnter:j,onMouseEnter:j,onPointerMove:F,onMouseMove:F,onPointerLeave:$,onMouseLeave:$};return Hi()({ourProps:H,theirProps:h,slot:K,defaultTag:V0e,name:"Combobox.Option"})}let U0e=yi(N0e),X8=yi($0e),Q8=yi(F0e),G0e=qbe,J8=yi(H0e),Z8=yi(W0e),q0e=Object.assign(U0e,{Input:Q8,Button:X8,Label:G0e,Options:J8,Option:Z8});function Y0e(){let e=P.useRef(!1);return nn(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function e7(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:n7)!==P.Fragment||P.Children.count(e.children)===1}let A0=P.createContext(null);A0.displayName="TransitionContext";var K0e=(e=>(e.Visible="visible",e.Hidden="hidden",e))(K0e||{});function X0e(){let e=P.useContext(A0);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function Q0e(){let e=P.useContext(I0);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let I0=P.createContext(null);I0.displayName="NestingContext";function k0(e){return"children"in e?k0(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function t7(e,t){let n=ol(e),r=P.useRef([]),i=Y0e(),o=kd(),s=qe((h,m=ja.Hidden)=>{let b=r.current.findIndex(({el:v})=>v===h);b!==-1&&(Mo(m,{[ja.Unmount](){r.current.splice(b,1)},[ja.Hidden](){r.current[b].state="hidden"}}),o.microTask(()=>{var v;!k0(r)&&i.current&&((v=n.current)==null||v.call(n))}))}),a=qe(h=>{let m=r.current.find(({el:b})=>b===h);return m?m.state!=="visible"&&(m.state="visible"):r.current.push({el:h,state:"visible"}),()=>s(h,ja.Unmount)}),l=P.useRef([]),c=P.useRef(Promise.resolve()),u=P.useRef({enter:[],leave:[]}),d=qe((h,m,b)=>{l.current.splice(0),t&&(t.chains.current[m]=t.chains.current[m].filter(([v])=>v!==h)),t==null||t.chains.current[m].push([h,new Promise(v=>{l.current.push(v)})]),t==null||t.chains.current[m].push([h,new Promise(v=>{Promise.all(u.current[m].map(([x,S])=>S)).then(()=>v())})]),m==="enter"?c.current=c.current.then(()=>t==null?void 0:t.wait.current).then(()=>b(m)):b(m)}),p=qe((h,m,b)=>{Promise.all(u.current[m].splice(0).map(([v,x])=>x)).then(()=>{var v;(v=l.current.shift())==null||v()}).then(()=>b(m))});return P.useMemo(()=>({children:r,register:a,unregister:s,onStart:d,onStop:p,wait:c,chains:u}),[a,s,r,d,p,u,c])}let n7=P.Fragment,r7=ay.RenderStrategy;function J0e(e,t){var n,r;let{transition:i=!0,beforeEnter:o,afterEnter:s,beforeLeave:a,afterLeave:l,enter:c,enterFrom:u,enterTo:d,entered:p,leave:h,leaveFrom:m,leaveTo:b,...v}=e,[x,S]=P.useState(null),_=P.useRef(null),E=e7(e),C=ko(...E?[_,t,S]:t===null?[]:[t]),M=(n=v.unmount)==null||n?ja.Unmount:ja.Hidden,{show:O,appear:N,initial:A}=X0e(),[j,F]=P.useState(O?"visible":"hidden"),$=Q0e(),{register:K,unregister:H}=$;nn(()=>K(_),[K,_]),nn(()=>{if(M===ja.Hidden&&_.current){if(O&&j!=="visible"){F("visible");return}return Mo(j,{hidden:()=>H(_),visible:()=>K(_)})}},[j,_,K,H,O,M]);let L=bR();nn(()=>{if(E&&L&&j==="visible"&&_.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[_,j,L,E]);let W=A&&!N,B=N&&O&&A,U=P.useRef(!1),Y=t7(()=>{U.current||(F("hidden"),H(_))},$),I=qe(J=>{U.current=!0;let Z=J?"enter":"leave";Y.onStart(_,Z,ae=>{ae==="enter"?o==null||o():ae==="leave"&&(a==null||a())})}),Q=qe(J=>{let Z=J?"enter":"leave";U.current=!1,Y.onStop(_,Z,ae=>{ae==="enter"?s==null||s():ae==="leave"&&(l==null||l())}),Z==="leave"&&!k0(Y)&&(F("hidden"),H(_))});P.useEffect(()=>{E&&i||(I(O),Q(O))},[O,E,i]);let G=!(!i||!E||!L||W),[,D]=H8(G,x,O,{start:I,end:Q}),ee=_a({ref:C,className:((r=i_(v.className,B&&c,B&&u,D.enter&&c,D.enter&&D.closed&&u,D.enter&&!D.closed&&d,D.leave&&h,D.leave&&!D.closed&&m,D.leave&&D.closed&&b,!D.transition&&O&&p))==null?void 0:r.trim())||void 0,...B8(D)}),q=0;j==="visible"&&(q|=Po.Open),j==="hidden"&&(q|=Po.Closed),D.enter&&(q|=Po.Opening),D.leave&&(q|=Po.Closing);let oe=Hi();return P.createElement(I0.Provider,{value:Y},P.createElement(G8,{value:q},oe({ourProps:ee,theirProps:v,defaultTag:n7,features:r7,visible:j==="visible",name:"Transition.Child"})))}function Z0e(e,t){let{show:n,appear:r=!1,unmount:i=!0,...o}=e,s=P.useRef(null),a=e7(e),l=ko(...a?[s,t]:t===null?[]:[t]);bR();let c=gR();if(n===void 0&&c!==null&&(n=(c&Po.Open)===Po.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[u,d]=P.useState(n?"visible":"hidden"),p=t7(()=>{n||d("hidden")}),[h,m]=P.useState(!0),b=P.useRef([n]);nn(()=>{h!==!1&&b.current[b.current.length-1]!==n&&(b.current.push(n),m(!1))},[b,n]);let v=P.useMemo(()=>({show:n,appear:r,initial:h}),[n,r,h]);nn(()=>{n?d("visible"):!k0(p)&&s.current!==null&&d("hidden")},[n,p]);let x={unmount:i},S=qe(()=>{var C;h&&m(!1),(C=e.beforeEnter)==null||C.call(e)}),_=qe(()=>{var C;h&&m(!1),(C=e.beforeLeave)==null||C.call(e)}),E=Hi();return P.createElement(I0.Provider,{value:p},P.createElement(A0.Provider,{value:v},E({ourProps:{...x,as:P.Fragment,children:P.createElement(i7,{ref:l,...x,...o,beforeEnter:S,beforeLeave:_})},theirProps:{},defaultTag:P.Fragment,features:r7,visible:u==="visible",name:"Transition"})))}function eve(e,t){let n=P.useContext(A0)!==null,r=gR()!==null;return P.createElement(P.Fragment,null,!n&&r?P.createElement(c_,{ref:t,...e}):P.createElement(i7,{ref:t,...e}))}let c_=yi(Z0e),i7=yi(J0e),tve=yi(eve),nve=Object.assign(c_,{Child:tve,Root:c_});var vR="Checkbox",[rve,BTe]=er(vR),[ive,ove]=rve(vR),o7=R.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:o,required:s,disabled:a,value:l="on",onCheckedChange:c,form:u,...d}=e,[p,h]=R.useState(null),m=rt(t,E=>h(E)),b=R.useRef(!1),v=p?u||!!p.closest("form"):!0,[x=!1,S]=Ar({prop:i,defaultProp:o,onChange:c}),_=R.useRef(x);return R.useEffect(()=>{const E=p==null?void 0:p.form;if(E){const C=()=>S(_.current);return E.addEventListener("reset",C),()=>E.removeEventListener("reset",C)}},[p,S]),y.jsxs(ive,{scope:n,state:x,disabled:a,children:[y.jsx(Ne.button,{type:"button",role:"checkbox","aria-checked":Ba(x)?"mixed":x,"aria-required":s,"data-state":l7(x),"data-disabled":a?"":void 0,disabled:a,value:l,...d,ref:m,onKeyDown:Re(e.onKeyDown,E=>{E.key==="Enter"&&E.preventDefault()}),onClick:Re(e.onClick,E=>{S(C=>Ba(C)?!0:!C),v&&(b.current=E.isPropagationStopped(),b.current||E.stopPropagation())})}),v&&y.jsx(sve,{control:p,bubbles:!b.current,name:r,value:l,checked:x,required:s,disabled:a,form:u,style:{transform:"translateX(-100%)"},defaultChecked:Ba(o)?!1:o})]})});o7.displayName=vR;var s7="CheckboxIndicator",a7=R.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...i}=e,o=ove(s7,n);return y.jsx(qn,{present:r||Ba(o.state)||o.state===!0,children:y.jsx(Ne.span,{"data-state":l7(o.state),"data-disabled":o.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});a7.displayName=s7;var sve=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:i,...o}=e,s=R.useRef(null),a=b0(n),l=a0(t);R.useEffect(()=>{const u=s.current,d=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(d,"checked").set;if(a!==n&&h){const m=new Event("click",{bubbles:r});u.indeterminate=Ba(n),h.call(u,Ba(n)?!1:n),u.dispatchEvent(m)}},[a,n,r]);const c=R.useRef(Ba(n)?!1:n);return y.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i??c.current,...o,tabIndex:-1,ref:s,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Ba(e){return e==="indeterminate"}function l7(e){return Ba(e)?"indeterminate":e?"checked":"unchecked"}var c7=o7,ave=a7;const N0=R.forwardRef(({className:e,...t},n)=>y.jsx(c7,{ref:n,className:be("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:y.jsx(ave,{className:be("flex items-center justify-center text-current"),children:y.jsx(vp,{className:"h-4 w-4"})})}));N0.displayName=c7.displayName;function lve(e){const t=/(>=|<=|>|<|=)/,n=e.match(t);if(n){const r=n[0],[i,o]=e.split(r);return{operation:r,value:o.trim()}}else return null}function cve(e,t,n){const r=`SELECT ${n}, COUNT(*) FROM ${t} {{ filters | where }} GROUP BY ${n} ORDER BY ${n} ASC LIMIT 50`,i=`SELECT min(${n}) as min, max(${n}) as max FROM ${t} {{ filters | where }}`;return Sd.includes(e)?i:r}function u7(e){const[t,n]=P.useState([]),[r,i]=P.useState(""),o=ve(C=>C.filterValues),s=ve(C=>C.selectedSheetId),{addOrUpdateFilterValue:a,removeFilterValue:l}=lr(),{data:c,isLoading:u,isFetching:d,isError:p}=h8(e),h=P.useMemo(()=>{var C;return(C=c==null?void 0:c.records)==null?void 0:C.map(M=>{let O=e.column.split(".").slice(-1)[0].replace(/"/g,"");return M[O]===void 0&&(O=O.toLowerCase()),{id:M[O],value:M[O]}})},[c,e.column]);P.useEffect(()=>{if(o){const C=o.find(M=>M.filterId===e.id);if(!C){n([]);return}if(C.operation==="in"){const M=h==null?void 0:h.filter(O=>C.values.includes(O.value));M&&n(M)}}},[c,s,o,e.id,h]),P.useEffect(()=>{if(o&&!o.find(M=>M.filterId===e.id)){n([]);return}},[o,e.id]);function m(C){const M=lve(C[0].toString());if(!(M!=null&&M.value)||!(M!=null&&M.operation))return;const O={filterId:e.id,connectionType:e.database==="NA"?"api":"database",valueType:Cu(e),name:e.column,operation:M.operation,values:[Number(M.value)]};a(O)}function b(C){if(Array.isArray(C)||(C=[C]),console.log("onComboBoxChange",C),C.length===1&&h.find(O=>O.value===C[0].value)===void 0){m(C);return}if(n(C),C.length===0){l(e.id);return}const M={filterId:e.id,connectionType:e.database==="NA"?"api":"database",name:e.column,valueType:Cu(e),operation:e.operation,values:C.map(O=>O.value)};a(M)}function v(C){if(C){n(h);const M={filterId:e.id,connectionType:e.database==="NA"?"api":"database",name:e.column,valueType:Cu(e),operation:e.operation,values:h.map(O=>O.value)};a(M)}else n([]),l(e.id)}function x(){if(hp.includes(e.dataType))return h;const C=r.toLowerCase().replace(/\s+/g,"");return r===""?h:h.filter(M=>M.value.toLowerCase().replace(/\s+/g,"").includes(C))}const S=x(),_=e.type==="single",E=t.length===(h==null?void 0:h.length);return{isLoading:u,isFetching:d,isError:p,selected:t,handleValueChange:b,handleSelectAll:v,query:r,setQuery:i,filteredRecords:S,isSingleSelect:_,allSelected:E}}function uve({filter:e}){const{filteredRecords:t,isSingleSelect:n,allSelected:r,handleValueChange:i,handleSelectAll:o,query:s,setQuery:a,isLoading:l,isFetching:c,isError:u,selected:d}=u7(e);return console.log(t),l||c?y.jsx("div",{children:y.jsx(Ru,{className:"h-8 w-full bg-foreground/10"})}):u?y.jsx("div",{className:"flex h-8 w-full items-center bg-muted px-2 text-sm",children:"Error"}):y.jsx("div",{className:"w-full",children:y.jsx(q0e,{value:d,multiple:!n,onChange:i,children:y.jsxs("div",{className:"relative",children:[y.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:[y.jsx(Q8,{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:p=>p.map(m=>m.value).join(", "),onChange:p=>{a(p.target.value)}}),y.jsx(X8,{className:"absolute inset-y-0 right-0 flex items-center bg-background pl-1 pr-2",children:y.jsx(OZ,{className:"h-5 w-5 text-gray-400","aria-hidden":"true"})})]}),y.jsx(nve,{as:P.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",afterLeave:()=>a(""),children:y.jsxs(J8,{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:[e.type==="multiple"||e.type===void 0&&y.jsxs("div",{className:"flex items-center justify-between gap-2 border-b px-4 py-2",children:[y.jsx("span",{children:"Select All"}),y.jsx(N0,{checked:r,onCheckedChange:o})]}),(t==null?void 0:t.length)===0&&s!==""?y.jsx("div",{className:"relative cursor-default select-none px-4 py-2 text-gray-700",children:"Nothing found."}):t==null?void 0:t.map(p=>y.jsx(Z8,{className:({active:h})=>`relative cursor-default select-none border-b border-muted py-2 pl-10 pr-4 ${h?"bg-muted":"text-foreground-900"}`,value:p,children:({selected:h,active:m})=>y.jsxs("div",{className:"",children:[y.jsx("span",{className:`block ${h?"font-medium":"font-normal"}`,children:typeof p.value=="boolean"?p.value?"True":"False":p.value}),h?y.jsx("span",{className:"absolute inset-y-0 left-0 flex items-center pl-3 text-foreground",children:y.jsx(F5,{className:"h-5 w-5","aria-hidden":"true"})}):null]})},p.value))]})})]})})})}var xR="Radio",[dve,d7]=er(xR),[fve,hve]=dve(xR),f7=R.forwardRef((e,t)=>{const{__scopeRadio:n,name:r,checked:i=!1,required:o,disabled:s,value:a="on",onCheck:l,form:c,...u}=e,[d,p]=R.useState(null),h=rt(t,v=>p(v)),m=R.useRef(!1),b=d?c||!!d.closest("form"):!0;return y.jsxs(fve,{scope:n,checked:i,disabled:s,children:[y.jsx(Ne.button,{type:"button",role:"radio","aria-checked":i,"data-state":g7(i),"data-disabled":s?"":void 0,disabled:s,value:a,...u,ref:h,onClick:Re(e.onClick,v=>{i||l==null||l(),b&&(m.current=v.isPropagationStopped(),m.current||v.stopPropagation())})}),b&&y.jsx(pve,{control:d,bubbles:!m.current,name:r,value:a,checked:i,required:o,disabled:s,form:c,style:{transform:"translateX(-100%)"}})]})});f7.displayName=xR;var h7="RadioIndicator",p7=R.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:r,...i}=e,o=hve(h7,n);return y.jsx(qn,{present:r||o.checked,children:y.jsx(Ne.span,{"data-state":g7(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:t})})});p7.displayName=h7;var pve=e=>{const{control:t,checked:n,bubbles:r=!0,...i}=e,o=R.useRef(null),s=b0(n),a=a0(t);return R.useEffect(()=>{const l=o.current,c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"checked").set;if(s!==n&&d){const p=new Event("click",{bubbles:r});d.call(l,n),l.dispatchEvent(p)}},[s,n,r]),y.jsx("input",{type:"radio","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:o,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function g7(e){return e?"checked":"unchecked"}var gve=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],wR="RadioGroup",[mve,HTe]=er(wR,[Cd,d7]),m7=Cd(),b7=d7(),[bve,yve]=mve(wR),y7=R.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:r,defaultValue:i,value:o,required:s=!1,disabled:a=!1,orientation:l,dir:c,loop:u=!0,onValueChange:d,...p}=e,h=m7(n),m=Oc(c),[b,v]=Ar({prop:o,defaultProp:i,onChange:d});return y.jsx(bve,{scope:n,name:r,required:s,disabled:a,value:b,onValueChange:v,children:y.jsx(Z_,{asChild:!0,...h,orientation:l,dir:m,loop:u,children:y.jsx(Ne.div,{role:"radiogroup","aria-required":s,"aria-orientation":l,"data-disabled":a?"":void 0,dir:m,...p,ref:t})})})});y7.displayName=wR;var v7="RadioGroupItem",x7=R.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:r,...i}=e,o=yve(v7,n),s=o.disabled||r,a=m7(n),l=b7(n),c=R.useRef(null),u=rt(t,c),d=o.value===i.value,p=R.useRef(!1);return R.useEffect(()=>{const h=b=>{gve.includes(b.key)&&(p.current=!0)},m=()=>p.current=!1;return document.addEventListener("keydown",h),document.addEventListener("keyup",m),()=>{document.removeEventListener("keydown",h),document.removeEventListener("keyup",m)}},[]),y.jsx(eC,{asChild:!0,...a,focusable:!s,active:d,children:y.jsx(f7,{disabled:s,required:o.required,checked:d,...l,...i,name:o.name,ref:u,onCheck:()=>o.onValueChange(i.value),onKeyDown:Re(h=>{h.key==="Enter"&&h.preventDefault()}),onFocus:Re(i.onFocus,()=>{var h;p.current&&((h=c.current)==null||h.click())})})})});x7.displayName=v7;var vve="RadioGroupIndicator",w7=R.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...r}=e,i=b7(n);return y.jsx(p7,{...i,...r,ref:t})});w7.displayName=vve;var S7=y7,_7=x7,xve=w7;const jh=R.forwardRef(({className:e,...t},n)=>y.jsx(S7,{className:be("grid gap-2",e),...t,ref:n}));jh.displayName=S7.displayName;const Hl=R.forwardRef(({className:e,...t},n)=>y.jsx(_7,{ref:n,className:be("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:y.jsx(xve,{className:"flex items-center justify-center",children:y.jsx(OC,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Hl.displayName=_7.displayName;function wve({filter:e}){var o;const{filteredRecords:t,handleValueChange:n,selected:r}=u7(e);function i(s){console.log(s),n([{value:s,id:s}])}return console.log(r),y.jsx(jh,{onValueChange:i,value:((o=r==null?void 0:r[0])==null?void 0:o.value)||"",className:"mt-2 flex gap-3 overflow-x-auto",children:t==null?void 0:t.map(s=>y.jsxs("div",{className:"flex gap-2",children:[y.jsx(Hl,{value:s.value,id:"r1"}),y.jsx(xn,{className:"text-muted-foreground",htmlFor:"r1",children:s.value})]}))})}function SR({filter:e}){return Sd.includes(e.dataType)?y.jsx(Zme,{filter:e}):e.uiType==="radio"&&e.type==="single"?y.jsx(wve,{filter:e}):y.jsx(uve,{filter:e})}function Sve({card:e,frame:t}){var K,H,L;const{customCards:n}=uo();P.useRef(null);const r=ve(W=>W.themeStyle),i=ve(W=>W.selectedSheetId),o=ve(W=>W.isDashboardEditing),s=ve(W=>W.selectedLensId),a=ve(W=>W.dashboard.filters),l=a==null?void 0:a.find(W=>W.id===t.filterId),{setCardTitle:c,setCardDescription:u,setSelectedFrameId:d,updateFilter:p}=lr(),{updateFrame:h}=lr(),m=((K=e.customCardPreferences)==null?void 0:K.showCardHeader)??!0,{isError:b,isLoading:v,isFetching:x,cfg:S,visualKey:_,data:E,handleDatapointClick:C}=hE(e);function M(){var W;if(n&&n.length>0){const B=n.find(U=>U.cardId===e.id);if(B&&B.replaceDefault){const U=B.content;if(U)return y.jsx(U,{card:e})}}return e.type==="kpi"?y.jsx(i3,{card:e,data:(E==null?void 0:E.records)||[]}):e.type==="text"&&((W=t==null?void 0:t.cards)==null?void 0:W.length)===1?y.jsx(kh,{className:"mx-3 my-6 overflow-y-auto break-words px-3",children:y.jsx(FS,{isLoading:v||x,card:e,data:(E==null?void 0:E.records)||[]})}):$}function O(){return["{{ filters | where }}","{{ filters | and }}"].some(B=>{var U;return(U=e.sql)==null?void 0:U.includes(B)})?y.jsx(Wue,{}):null}function N(){if(b)return y.jsx("p",{className:"text-sm",children:"Oops! It seems like something went wrong. Please review your connection or filters."});if(e.type==="table"&&(E!=null&&E.records)&&(E==null?void 0:E.records.length)>0)return y.jsx("div",{className:"relative flex min-h-0 flex-1 grow basis-0",children:y.jsx(C6,{card:e,data:(E==null?void 0:E.records)||[]})});if(e.type==="text")return y.jsx(kh,{className:"overflow-y-auto break-words pr-2",children:y.jsx(FS,{isLoading:v||x,card:e,data:(E==null?void 0:E.records)||[]})});if(e.type==="custom")return y.jsx(Dhe,{frame:t,card:e});if(n&&n.length>0){const W=n.find(B=>B.cardId===e.id);if(W&&W.content){const B=W.content;return y.jsx(B,{card:e})}}if(S)return y.jsx(VE,{cfg:S,onDatapointClick:C},`${_}-${s}`)}function A(){if(n&&n.length>0){const W=n.find(B=>B.cardId===e.id);if(W&&W.footer){const B=W.footer;if(B)return y.jsx(B,{card:e})}}return null}function j(){var W,B,U;return y.jsx(rC,{value:t.activeCardId,className:"flex items-center justify-end gap-3",onValueChange:Y=>{const I={...t,activeCardId:Y};h(i,I)},children:y.jsx(Dy,{style:{borderRadius:(B=(W=r==null?void 0:r.chart)==null?void 0:W.options)==null?void 0:B.borderRadius},className:"flex-end flex-wrap items-center",children:(U=t.cards.filter(Y=>{var I;return!((I=Y.tabTitle)!=null&&I.endsWith("__Header"))&&(Y.displayTab===!0||Y.displayTab===void 0)}))==null?void 0:U.map(Y=>{var I,Q;return y.jsx(Ay,{style:{borderRadius:(Q=(I=r==null?void 0:r.chart)==null?void 0:I.options)==null?void 0:Q.borderRadius},value:Y.id,children:Y.tabTitle||Y.title},Y.id)})})})}function F(){let W=t.cards.find(B=>B.type==="kpi"&&B.tabTitle===`${e.tabTitle}__Header`);return W||(W=t.cards.find(B=>B.type==="kpi"&&B.tabTitle==="All__Header")),W?y.jsx("div",{className:"flex items-end gap-2",children:y.jsx(eue,{renderFilterInfo:O,card:W})}):y.jsxs(y.Fragment,{children:[y.jsxs("div",{role:"card-title-container",className:"flex items-center gap-2",children:[y.jsx(rs,{text:e.title,onSave:B=>c(i,e.id,B),children:y.jsx(_d,{className:be("text-base",{}),children:e.title})}),(o||e.info)&&y.jsx($3,{card:e}),e.refreshInterval&&y.jsxs(q3,{children:[y.jsx(Y3,{className:"pr-1",children:y.jsx("div",{className:be("h-2 w-2 rounded-full bg-green-500 transition-opacity",{"opacity-10":v||x})})}),y.jsx(ME,{side:"right",align:"center",children:y.jsx("p",{className:"text-xs",children:`Realtime (${e==null?void 0:e.refreshInterval})`})})]}),O()]}),y.jsx("div",{role:"card-description-container",children:y.jsx(rs,{text:(e==null?void 0:e.description)||"",onSave:B=>u(i,e.id,B),children:y.jsxs(Q_,{className:be("",{}),children:[" ",e.description]})})})]})}if(!e.id)return null;const $=y.jsxs(y.Fragment,{children:[m?y.jsx(Ry,{children:y.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[y.jsx("div",{className:"grow",role:"header-container",children:F()}),y.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.cards.length>1&&j(),y.jsx("div",{children:l&&y.jsxs("div",{style:{borderRadius:(L=(H=r==null?void 0:r.chart)==null?void 0:H.options)==null?void 0:L.borderRadius},role:"frame-filter-container",className:"flex h-10 shrink-0 items-center bg-muted p-1",children:[!Sd.includes(l.dataType)&&y.jsx(rs,{className:"my-1",containerClassName:"shrink-0",text:l.title||l.column,onSave:W=>p({...l,title:W}),children:y.jsx(xn,{className:"px-3",children:l.title})}),y.jsx(SR,{filter:l})]})})]})]})}):y.jsx("div",{className:"h-8"}),y.jsx(Py,{className:"relative flex min-h-0 grow flex-col",children:N()}),y.jsx(MN,{children:A()})]});return y.jsx("div",{className:be("flex h-full flex-col",{"animate-pulse":v||x}),children:M()})}function _ve({frame:e,footer:t,className:n,...r}){var b,v;const i=P.useRef(null),o=ve(x=>x.themeStyle),s=ve(x=>x.selectedFrameId),a=ve(x=>x.isDashboardEditing),{setSelectedFrameId:l}=lr(),{setSelectedConnectionId:c,setSelectedDatabaseName:u,setSelectedSchemaName:d,setSelectedTableName:p}=Uy(),h=e.cards.find(x=>x.id===e.activeCardId);dee(e,i);function m(x){x.stopPropagation(),l(e.id),h!=null&&h.connectionId&&c(h==null?void 0:h.connectionId),h!=null&&h.lastSelectedDatabase&&u(h==null?void 0:h.lastSelectedDatabase),h!=null&&h.lastSelectedSchema&&d(h==null?void 0:h.lastSelectedSchema),h!=null&&h.lastSelectedTable&&p(h==null?void 0:h.lastSelectedTable)}return y.jsx(Yy,{FallbackComponent:kC,children:y.jsxs("div",{tabIndex:-1,ref:i,role:"card-frame",onClick:m,style:{borderRadius:(v=(b=o==null?void 0:o.chart)==null?void 0:b.options)==null?void 0:v.borderRadius},className:be("relative flex h-full flex-col rounded-sm border bg-background shadow-sm",{"border-dashed border-foreground/50":s===e.id&&a},o==null?void 0:o.dashboardCard,n,"semaphor-card-frame"),...r,children:[y.jsx(t4,{frame:e}),y.jsx(Sve,{card:h,frame:e},h.id)]})})}const _R=R.forwardRef(({className:e,...t},n)=>y.jsx("textarea",{className:be("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));_R.displayName="Textarea";function Cve({label:e,onCheckedChange:t,checked:n}){return y.jsxs("div",{className:"flex items-center space-x-2",children:[y.jsx(N0,{onCheckedChange:t,id:"terms",checked:n}),y.jsx("label",{htmlFor:"terms",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:e})]})}function Eve({filter:e}){const[t,n]=P.useState(e.sql),[r,i]=P.useState(!1),o=ve(p=>p.selectedSheetId),{updateFilter:s}=lr();function a(){const p={...e,sql:t};s(p),i(!1)}function l(p){console.log("operation",p);const h={...e,operation:p};s(h)}function c(p){const h={...e,type:p};s(h)}function u(p){const h={...e,uiType:p};s(h)}function d(p){if(!o)return;const h={...e,sheetId:p?o:void 0};s(h)}return y.jsxs(_0,{open:r,onOpenChange:i,children:[y.jsx(C0,{children:y.jsx(IC,{className:"invisible h-3 w-3 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"})}),y.jsxs(Np,{onMouseDown:p=>p.stopPropagation(),onDoubleClick:p=>p.stopPropagation(),className:"z-50 m-2 w-full min-w-[350px] space-y-4",children:[y.jsxs("div",{className:"space-y-2",children:[y.jsxs("div",{className:"flex items-center gap-3",children:[y.jsx("h4",{className:"font-medium leading-none",children:"Customize Filter"}),y.jsx("p",{className:"rounded-md bg-muted px-2 py-1 text-xs text-muted-foreground",children:e.column})]}),y.jsx("p",{className:"text-sm text-muted-foreground",children:"Customize the filter operation and SQL"})]}),y.jsx(Op,{}),y.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[y.jsxs("div",{className:"space-y-2",children:[y.jsx(xn,{children:"Type"}),y.jsxs(jh,{onValueChange:c,value:e.type||"multiple",className:"flex gap-3",defaultValue:"x",children:[y.jsxs("div",{className:"flex items-center space-x-2",children:[y.jsx(Hl,{value:"multiple",id:"r1"}),y.jsx("label",{className:"text-sm",htmlFor:"r1",children:"Multiple"})]}),y.jsxs("div",{className:"flex items-center space-x-2",children:[y.jsx(Hl,{value:"single",id:"r2"}),y.jsx("label",{className:"text-sm",htmlFor:"r2",children:"Single"})]})]})]}),e.type==="single"&&y.jsxs("div",{className:"space-y-2",children:[y.jsx(xn,{children:"Filter Element"}),y.jsxs(jh,{onValueChange:u,value:e.uiType||"dropdown",className:"flex gap-3",defaultValue:"x",children:[y.jsxs("div",{className:"flex items-center space-x-2",children:[y.jsx(Hl,{value:"dropdown",id:"r2"}),y.jsx("label",{className:"text-sm",htmlFor:"r2",children:"Dropdown"})]}),y.jsxs("div",{className:"flex items-center space-x-2",children:[y.jsx(Hl,{value:"radio",id:"r1"}),y.jsx("label",{className:"text-sm",htmlFor:"r1",children:"Radio"})]})]})]})]}),y.jsxs("div",{className:"grid grid-cols-6 gap-4 text-sm",children:[y.jsxs("div",{className:"col-span-2 space-y-1",children:[y.jsx(xn,{children:"Table Column"}),y.jsx(xn,{className:"block rounded-md bg-muted p-2 font-mono text-xs",children:e.column})]}),y.jsxs("div",{className:"col-span-2 space-y-1",children:[y.jsx(xn,{children:"Data Type"}),y.jsx(xn,{className:"block rounded-md bg-muted p-2 font-mono text-xs",children:e.dataType})]}),y.jsxs("div",{className:"col-span-2 space-y-1",children:[y.jsx(xn,{className:"text-sm",children:"Filter Operation"}),y.jsx(Rve,{updateFilterOperation:l,value:e.operation})]})]}),y.jsxs("div",{className:"flex grow flex-col space-y-1",role:"container",children:[y.jsx(xn,{className:"text-sm",children:"Values SQL"}),y.jsx(_R,{onKeyDown:p=>{p.stopPropagation()},value:t,onChange:p=>n(p.target.value),className:`min-w-full grow resize font-mono text-xs ${Yf}`})]}),y.jsx("div",{children:y.jsx(Cve,{label:"Local to sheet",onCheckedChange:d,checked:!!e.sheetId})}),y.jsx("div",{className:"flex justify-end gap-2",children:y.jsxs(pi,{onClick:a,size:"sm",variant:"outline",children:[y.jsx(vp,{className:"mr-2 size-4"}),"Accept"]})})]})]})}function Rve({value:e,updateFilterOperation:t}){return y.jsxs(js,{defaultValue:"in",value:e,onValueChange:n=>t(n),children:[y.jsx(Vo,{className:"h-8 w-[180px] focus:ring-0 focus:ring-offset-0",children:y.jsx($s,{placeholder:"Operation"})}),y.jsxs(Wo,{children:[y.jsx(zn,{value:"=",children:"Equals"}),y.jsx(zn,{value:"in",children:"Contains"}),y.jsx(zn,{value:"like",children:"Like"})]})]})}function C7({filter:e}){const t=ve(a=>a.isDashboardEditing),n=ve(a=>a.filterValues),r=n==null?void 0:n.some(a=>a.filterId===e.id),{removeFilterValue:i,removeFilter:o,updateFilter:s}=lr();return y.jsx(rs,{className:"my-1",text:e.title||e.column,onSave:a=>s({...e,title:a}),children:y.jsxs("div",{className:"group mb-1 flex grow items-center justify-between",children:[y.jsxs("div",{className:"flex grow items-center gap-2",children:[y.jsx(xn,{className:"inline-block text-sm",children:e.title}),t&&y.jsx(Eve,{filter:e})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[r&&y.jsx("button",{onClick:()=>i(e.id),className:"text-foreground/30 hover:text-foreground/50",children:y.jsx(DC,{className:"size-3.5"})}),t&&y.jsx(Ed,{onClick:()=>{i(e.id),o(e.id)},className:"size-3.5 cursor-pointer text-foreground/30 hover:cursor-pointer hover:text-foreground/50"})]})]})})}var Pve=e=>{switch(e){case"success":return Ove;case"info":return Ave;case"warning":return Dve;case"error":return Ive;default:return null}},Tve=Array(12).fill(0),Mve=({visible:e,className:t})=>P.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},P.createElement("div",{className:"sonner-spinner"},Tve.map((n,r)=>P.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),Ove=P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},P.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"})),Dve=P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},P.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"})),Ave=P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},P.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"})),Ive=P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},P.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"})),kve=P.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"},P.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),P.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Nve=()=>{let[e,t]=P.useState(document.hidden);return P.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},u_=1,Lve=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:n,...r}=e,i=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:u_++,o=this.toasts.find(a=>a.id===i),s=e.dismissible===void 0?!0:e.dismissible;return o?this.toasts=this.toasts.map(a=>a.id===i?(this.publish({...a,...e,id:i,title:n}),{...a,...e,id:i,dismissible:s,title:n}):a):this.addToast({title:n,...r,dismissible:s,id:i}),i},this.dismiss=e=>(e||this.toasts.forEach(t=>{this.subscribers.forEach(n=>n({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let r=e instanceof Promise?e:e(),i=n!==void 0,o,s=r.then(async l=>{if(o=["resolve",l],P.isValidElement(l))i=!1,this.create({id:n,type:"default",message:l});else if(jve(l)&&!l.ok){i=!1;let c=typeof t.error=="function"?await t.error(`HTTP error! status: ${l.status}`):t.error,u=typeof t.description=="function"?await t.description(`HTTP error! status: ${l.status}`):t.description;this.create({id:n,type:"error",message:c,description:u})}else if(t.success!==void 0){i=!1;let c=typeof t.success=="function"?await t.success(l):t.success,u=typeof t.description=="function"?await t.description(l):t.description;this.create({id:n,type:"success",message:c,description:u})}}).catch(async l=>{if(o=["reject",l],t.error!==void 0){i=!1;let c=typeof t.error=="function"?await t.error(l):t.error,u=typeof t.description=="function"?await t.description(l):t.description;this.create({id:n,type:"error",message:c,description:u})}}).finally(()=>{var l;i&&(this.dismiss(n),n=void 0),(l=t.finally)==null||l.call(t)}),a=()=>new Promise((l,c)=>s.then(()=>o[0]==="reject"?c(o[1]):l(o[1])).catch(c));return typeof n!="string"&&typeof n!="number"?{unwrap:a}:Object.assign(n,{unwrap:a})},this.custom=(e,t)=>{let n=(t==null?void 0:t.id)||u_++;return this.create({jsx:e(n),id:n,...t}),n},this.subscribers=[],this.toasts=[]}},Mi=new Lve,Fve=(e,t)=>{let n=(t==null?void 0:t.id)||u_++;return Mi.addToast({title:e,...t,id:n}),n},jve=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",$ve=Fve,zve=()=>Mi.toasts,E7=Object.assign($ve,{success:Mi.success,info:Mi.info,warning:Mi.warning,error:Mi.error,custom:Mi.custom,message:Mi.message,promise:Mi.promise,dismiss:Mi.dismiss,loading:Mi.loading},{getHistory:zve});function Bve(e,{insertAt:t}={}){if(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))}Bve(`: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;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-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;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}[data-sonner-toast] [data-close-button]{background:var(--gray1)}: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:-50%;right:-50%;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-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);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-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--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-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[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%)}
330
+ `)),[]});var Iye=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(Iye||{});function B8(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function H8(e,t,n,r){let[i,o]=P.useState(n),{hasFlag:s,addFlag:a,removeFlag:l}=Aye(e&&i?3:0),c=P.useRef(!1),u=P.useRef(!1),d=kd();return nn(()=>{var p;if(e){if(n&&o(!0),!t){n&&a(3);return}return(p=r==null?void 0:r.start)==null||p.call(r,n),kye(t,{inFlight:c,prepare(){u.current?u.current=!1:u.current=c.current,c.current=!0,!u.current&&(n?(a(3),l(4)):(a(4),l(2)))},run(){u.current?n?(l(3),a(4)):(l(4),a(3)):n?l(1):a(1)},done(){var h;u.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(c.current=!1,l(7),n||o(!1),(h=r==null?void 0:r.end)==null||h.call(r,n))}})}},[e,n,t,d]),e?[i,{closed:s(1),enter:s(2),leave:s(4),transition:s(2)||s(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function kye(e,{prepare:t,run:n,done:r,inFlight:i}){let o=ds();return Lye(e,{prepare:t,inFlight:i}),o.nextFrame(()=>{n(),o.requestAnimationFrame(()=>{o.add(Nye(e,r))})}),o.dispose}function Nye(e,t){var n,r;let i=ds();if(!e)return i.dispose;let o=!1;i.add(()=>{o=!0});let s=(r=(n=e.getAnimations)==null?void 0:n.call(e).filter(a=>a instanceof CSSTransition))!=null?r:[];return s.length===0?(t(),i.dispose):(Promise.allSettled(s.map(a=>a.finished)).then(()=>{o||t()}),i.dispose)}function Lye(e,{inFlight:t,prepare:n}){if(t!=null&&t.current){n();return}let r=e.style.transition;e.style.transition="none",n(),e.offsetHeight,e.style.transition=r}function Fye(e,{container:t,accept:n,walk:r}){let i=P.useRef(n),o=P.useRef(r);P.useEffect(()=>{i.current=n,o.current=r},[n,r]),nn(()=>{if(!t||!e)return;let s=Hp(t);if(!s)return;let a=i.current,l=o.current,c=Object.assign(d=>a(d),{acceptNode:a}),u=s.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,c,!1);for(;u.nextNode();)l(u.currentNode)},[t,e,i,o])}function nI(e,t){let n=P.useRef([]),r=qe(e);P.useEffect(()=>{let i=[...n.current];for(let[o,s]of t.entries())if(n.current[o]!==s){let a=r(t,i);return n.current=t,a}},[r,...t])}function jye(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}const V8={...R},$ye=V8.useInsertionEffect,zye=$ye||(e=>e());function W8(e){const t=R.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return zye(()=>{t.current=e}),R.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.current==null?void 0:t.current(...r)},[])}var a_=typeof document<"u"?P.useLayoutEffect:P.useEffect;let rI=!1,Bye=0;const iI=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Bye++;function Hye(){const[e,t]=R.useState(()=>rI?iI():void 0);return a_(()=>{e==null&&t(iI())},[]),R.useEffect(()=>{rI=!0},[]),e}const Vye=V8.useId,Wye=Vye||Hye;let Lh;process.env.NODE_ENV!=="production"&&(Lh=new Set);function Uye(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const i="Floating UI: "+n.join(" ");if(!((e=Lh)!=null&&e.has(i))){var o;(o=Lh)==null||o.add(i),console.warn(i)}}function Gye(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const i="Floating UI: "+n.join(" ");if(!((e=Lh)!=null&&e.has(i))){var o;(o=Lh)==null||o.add(i),console.error(i)}}function qye(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(i=>i(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,((r=e.get(t))==null?void 0:r.filter(i=>i!==n))||[])}}}const Yye=R.createContext(null),Kye=R.createContext(null),Xye=()=>{var e;return((e=R.useContext(Yye))==null?void 0:e.id)||null},Qye=()=>R.useContext(Kye),Jye="data-floating-ui-focusable";function Zye(e){const{open:t=!1,onOpenChange:n,elements:r}=e,i=Wye(),o=R.useRef({}),[s]=R.useState(()=>qye()),a=Xye()!=null;if(process.env.NODE_ENV!=="production"){const h=r.reference;h&&!Dr(h)&&Gye("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[l,c]=R.useState(r.reference),u=W8((h,m,b)=>{o.current.openEvent=h?m:void 0,s.emit("openchange",{open:h,event:m,reason:b,nested:a}),n==null||n(h,m,b)}),d=R.useMemo(()=>({setPositionReference:c}),[]),p=R.useMemo(()=>({reference:l||r.reference||null,floating:r.floating||null,domReference:r.reference}),[l,r.reference,r.floating]);return R.useMemo(()=>({dataRef:o,open:t,onOpenChange:u,elements:p,events:s,floatingId:i,refs:d}),[t,u,p,s,i,d])}function e0e(e){e===void 0&&(e={});const{nodeId:t}=e,n=Zye({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,i=r.elements,[o,s]=R.useState(null),[a,l]=R.useState(null),u=(i==null?void 0:i.domReference)||o,d=R.useRef(null),p=Qye();a_(()=>{u&&(d.current=u)},[u]);const h=b3({...e,elements:{...i,...a&&{reference:a}}}),m=R.useCallback(_=>{const E=Dr(_)?{getBoundingClientRect:()=>_.getBoundingClientRect(),contextElement:_}:_;l(E),h.refs.setReference(E)},[h.refs]),b=R.useCallback(_=>{(Dr(_)||_===null)&&(d.current=_,s(_)),(Dr(h.refs.reference.current)||h.refs.reference.current===null||_!==null&&!Dr(_))&&h.refs.setReference(_)},[h.refs]),v=R.useMemo(()=>({...h.refs,setReference:b,setPositionReference:m,domReference:d}),[h.refs,b,m]),x=R.useMemo(()=>({...h.elements,domReference:u}),[h.elements,u]),S=R.useMemo(()=>({...h,...r,refs:v,elements:x,nodeId:t}),[h,v,x,t,r]);return a_(()=>{r.dataRef.current.floatingContext=S;const _=p==null?void 0:p.nodesRef.current.find(E=>E.id===t);_&&(_.context=S)}),R.useMemo(()=>({...h,context:S,refs:v,elements:x}),[h,v,x,S])}const oI="active",sI="selected";function kw(e,t,n){const r=new Map,i=n==="item";let o=e;if(i&&e){const{[oI]:s,[sI]:a,...l}=e;o=l}return{...n==="floating"&&{tabIndex:-1,[Jye]:""},...o,...t.map(s=>{const a=s?s[n]:null;return typeof a=="function"?e?a(e):null:a}).concat(e).reduce((s,a)=>(a&&Object.entries(a).forEach(l=>{let[c,u]=l;if(!(i&&[oI,sI].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof u=="function"){var d;(d=r.get(c))==null||d.push(u),s[c]=function(){for(var p,h=arguments.length,m=new Array(h),b=0;b<h;b++)m[b]=arguments[b];return(p=r.get(c))==null?void 0:p.map(v=>v(...m)).find(v=>v!==void 0)}}}else s[c]=u}),s),{})}}function t0e(e){e===void 0&&(e=[]);const t=e.map(a=>a==null?void 0:a.reference),n=e.map(a=>a==null?void 0:a.floating),r=e.map(a=>a==null?void 0:a.item),i=R.useCallback(a=>kw(a,e,"reference"),t),o=R.useCallback(a=>kw(a,e,"floating"),n),s=R.useCallback(a=>kw(a,e,"item"),r);return R.useMemo(()=>({getReferenceProps:i,getFloatingProps:o,getItemProps:s}),[i,o,s])}function aI(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const n0e=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:i,offset:o=0,index:s=0,minItemsVisible:a=4,referenceOverflowThreshold:l=0,scrollRef:c,...u}=ls(e,t),{rects:d,elements:{floating:p}}=t,h=n.current[s],m=(c==null?void 0:c.current)||p,b=p.clientTop||m.clientTop,v=p.clientTop!==0,x=m.clientTop!==0,S=p===m;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||Uye('`placement` side must be "bottom" when using the `inner`',"middleware.")),!h)return{};const _={...t,...await wE(-h.offsetTop-p.clientTop-d.reference.height/2-h.offsetHeight/2-o).fn(t)},E=await ew(aI(_,m.scrollHeight+b+p.clientTop),u),C=await ew(_,{...u,elementContext:"reference"}),M=Pr(0,E.top),O=_.y+M,j=(m.scrollHeight>m.clientHeight?F=>F:Dh)(Pr(0,m.scrollHeight+(v&&S||x?b*2:0)-M-Pr(0,E.bottom)));if(m.style.maxHeight=j+"px",m.scrollTop=M,i){const F=m.offsetHeight<h.offsetHeight*ea(a,n.current.length)-1||C.top>=-l||C.bottom>=-l;dc.flushSync(()=>i(F))}return r&&(r.current=await ew(aI({..._,y:O},m.offsetHeight+b+p.clientTop),u)),{y:O}}});function r0e(e,t){const{open:n,elements:r}=e,{enabled:i=!0,overflowRef:o,scrollRef:s,onChange:a}=t,l=W8(a),c=R.useRef(!1),u=R.useRef(null),d=R.useRef(null);R.useEffect(()=>{if(!i)return;function h(b){if(b.ctrlKey||!m||o.current==null)return;const v=b.deltaY,x=o.current.top>=-.5,S=o.current.bottom>=-.5,_=m.scrollHeight-m.clientHeight,E=v<0?-1:1,C=v<0?"max":"min";m.scrollHeight<=m.clientHeight||(!x&&v>0||!S&&v<0?(b.preventDefault(),dc.flushSync(()=>{l(M=>M+Math[C](v,_*E))})):/firefox/i.test(jye())&&(m.scrollTop+=v))}const m=(s==null?void 0:s.current)||r.floating;if(n&&m)return m.addEventListener("wheel",h),requestAnimationFrame(()=>{u.current=m.scrollTop,o.current!=null&&(d.current={...o.current})}),()=>{u.current=null,d.current=null,m.removeEventListener("wheel",h)}},[i,n,r.floating,o,s,l]);const p=R.useMemo(()=>({onKeyDown(){c.current=!0},onWheel(){c.current=!1},onPointerMove(){c.current=!1},onScroll(){const h=(s==null?void 0:s.current)||r.floating;if(!(!o.current||!h||!c.current)){if(u.current!==null){const m=h.scrollTop-u.current;(o.current.bottom<-.5&&m<-1||o.current.top<-.5&&m>1)&&dc.flushSync(()=>l(b=>b+m))}requestAnimationFrame(()=>{u.current=h.scrollTop})}}}),[r.floating,l,o,s]);return R.useMemo(()=>i?{floating:p}:{},[i,p])}let Vp=P.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Vp.displayName="FloatingContext";let hR=P.createContext(null);hR.displayName="PlacementContext";function i0e(e){return P.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function o0e(){return P.useContext(Vp).setReference}function s0e(){let{getFloatingProps:e,slot:t}=P.useContext(Vp);return P.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function a0e(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=P.useContext(hR),n=P.useMemo(()=>e,[JSON.stringify(e,(i,o)=>{var s;return(s=o==null?void 0:o.outerHTML)!=null?s:o})]);nn(()=>{t==null||t(n??null)},[t,n]);let r=P.useContext(Vp);return P.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let lI=4;function l0e({children:e,enabled:t=!0}){let[n,r]=P.useState(null),[i,o]=P.useState(0),s=P.useRef(null),[a,l]=P.useState(null);c0e(a);let c=t&&n!==null&&a!==null,{to:u="bottom",gap:d=0,offset:p=0,padding:h=0,inner:m}=u0e(n,a),[b,v="center"]=u.split(" ");nn(()=>{c&&o(0)},[c]);let{refs:x,floatingStyles:S,context:_}=e0e({open:c,placement:b==="selection"?v==="center"?"bottom":`bottom-${v}`:v==="center"?`${b}`:`${b}-${v}`,strategy:"absolute",transform:!1,middleware:[wE({mainAxis:b==="selection"?0:d,crossAxis:p}),y3({padding:h}),b!=="selection"&&v3({padding:h}),b==="selection"&&m?n0e({...m,padding:h,overflowRef:s,offset:i,minItemsVisible:lI,referenceOverflowThreshold:h,onFallbackChange(F){var $,K;if(!F)return;let H=_.elements.floating;if(!H)return;let L=parseFloat(getComputedStyle(H).scrollPaddingBottom)||0,W=Math.min(lI,H.childElementCount),B=0,U=0;for(let Y of(K=($=_.elements.floating)==null?void 0:$.childNodes)!=null?K:[])if(Y instanceof HTMLElement){let I=Y.offsetTop,Q=I+Y.clientHeight+L,G=H.scrollTop,D=G+H.clientHeight;if(I>=G&&Q<=D)W--;else{U=Math.max(0,Math.min(Q,D)-Math.max(I,G)),B=Y.clientHeight;break}}W>=1&&o(Y=>{let I=B*W-U+L;return Y>=I?Y:I})}}):null,x3({padding:h,apply({availableWidth:F,availableHeight:$,elements:K}){Object.assign(K.floating.style,{overflow:"auto",maxWidth:`${F}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${$}px)`})}})].filter(Boolean),whileElementsMounted:g3}),[E=b,C=v]=_.placement.split("-");b==="selection"&&(E="selection");let M=P.useMemo(()=>({anchor:[E,C].filter(Boolean).join(" ")}),[E,C]),O=r0e(_,{overflowRef:s,onChange:o}),{getReferenceProps:N,getFloatingProps:A}=t0e([O]),j=qe(F=>{l(F),x.setFloating(F)});return R.createElement(hR.Provider,{value:r},R.createElement(Vp.Provider,{value:{setFloating:j,setReference:x.setReference,styles:S,getReferenceProps:N,getFloatingProps:A,slot:M}},e))}function c0e(e){nn(()=>{if(!e)return;let t=new MutationObserver(()=>{let n=window.getComputedStyle(e).maxHeight,r=parseFloat(n);if(isNaN(r))return;let i=parseInt(n);isNaN(i)||r!==i&&(e.style.maxHeight=`${Math.ceil(r)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}function u0e(e,t){var n,r,i;let o=Nw((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),s=Nw((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),a=Nw((i=e==null?void 0:e.padding)!=null?i:"var(--anchor-padding, 0)",t);return{...e,gap:o,offset:s,padding:a}}function Nw(e,t,n=void 0){let r=kd(),i=qe((l,c)=>{if(l==null)return[n,null];if(typeof l=="number")return[l,null];if(typeof l=="string"){if(!c)return[n,null];let u=cI(l,c);return[u,d=>{let p=U8(l);{let h=p.map(m=>window.getComputedStyle(c).getPropertyValue(m));r.requestAnimationFrame(function m(){r.nextFrame(m);let b=!1;for(let[x,S]of p.entries()){let _=window.getComputedStyle(c).getPropertyValue(S);if(h[x]!==_){h[x]=_,b=!0;break}}if(!b)return;let v=cI(l,c);u!==v&&(d(v),u=v)})}return r.dispose}]}return[n,null]}),o=P.useMemo(()=>i(e,t)[0],[e,t]),[s=o,a]=P.useState();return nn(()=>{let[l,c]=i(e,t);if(a(l),!!c)return c(a)},[e,t]),s}function U8(e){let t=/var\((.*)\)/.exec(e);if(t){let n=t[1].indexOf(",");if(n===-1)return[t[1]];let r=t[1].slice(0,n).trim(),i=t[1].slice(n+1).trim();return i?[r,...U8(i)]:[r]}return[]}function cI(e,t){let n=document.createElement("div");t.appendChild(n),n.style.setProperty("margin-top","0px","important"),n.style.setProperty("margin-top",e,"important");let r=parseFloat(window.getComputedStyle(n).marginTop)||0;return t.removeChild(n),r}function d0e({children:e,freeze:t}){let n=l_(t,e);return P.createElement(P.Fragment,null,n)}function l_(e,t){let[n,r]=P.useState(t);return!e&&n!==t&&r(t),e?n:t}let pR=P.createContext(null);pR.displayName="OpenClosedContext";var Po=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Po||{});function gR(){return P.useContext(pR)}function G8({value:e,children:t}){return P.createElement(pR.Provider,{value:e},t)}function f0e(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let Il=[];f0e(()=>{function e(t){if(!(t.target instanceof HTMLElement)||t.target===document.body||Il[0]===t.target)return;let n=t.target;n=n.closest(s_),Il.unshift(n??t.target),Il=Il.filter(r=>r!=null&&r.isConnected),Il.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 h0e(e){throw new Error("Unexpected object: "+e)}var Wn=(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))(Wn||{});function uI(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),i=r??-1;switch(e.focus){case 0:{for(let o=0;o<n.length;++o)if(!t.resolveDisabled(n[o],o,n))return o;return r}case 1:{i===-1&&(i=n.length);for(let o=i-1;o>=0;--o)if(!t.resolveDisabled(n[o],o,n))return o;return r}case 2:{for(let o=i+1;o<n.length;++o)if(!t.resolveDisabled(n[o],o,n))return o;return r}case 3:{for(let o=n.length-1;o>=0;--o)if(!t.resolveDisabled(n[o],o,n))return o;return r}case 4:{for(let o=0;o<n.length;++o)if(t.resolveId(n[o],o,n)===e.id)return o;return r}case 5:return null;default:h0e(e)}}var mR=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(mR||{});function p0e(e){let t=qe(e),n=P.useRef(!1);P.useEffect(()=>(n.current=!1,()=>{n.current=!0,C8(()=>{n.current&&t()})}),[t])}function g0e(){let e=typeof document>"u";return"useSyncExternalStore"in R?(t=>t.useSyncExternalStore)(R)(()=>()=>{},()=>!1,()=>!e):!1}function bR(){let e=g0e(),[t,n]=R.useState(lc.isHandoffComplete);return t&&lc.isHandoffComplete===!1&&n(!1),R.useEffect(()=>{t!==!0&&n(!0)},[t]),R.useEffect(()=>lc.handoff(),[]),e?!1:t}let m0e=P.createContext(!1);function b0e(){return P.useContext(m0e)}function y0e(e){let t=b0e(),n=P.useContext(Y8),r=D0(e),[i,o]=P.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(lc.isServer)return null;let a=r==null?void 0:r.getElementById("headlessui-portal-root");if(a)return a;if(r===null)return null;let l=r.createElement("div");return l.setAttribute("id","headlessui-portal-root"),r.body.appendChild(l)});return P.useEffect(()=>{i!==null&&(r!=null&&r.body.contains(i)||r==null||r.body.appendChild(i))},[i,r]),P.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),i}let q8=P.Fragment,v0e=yi(function(e,t){let n=e,r=P.useRef(null),i=ko(jbe(d=>{r.current=d}),t),o=D0(r),s=y0e(r),[a]=P.useState(()=>{var d;return lc.isServer?null:(d=o==null?void 0:o.createElement("div"))!=null?d:null}),l=P.useContext(_0e),c=bR();nn(()=>{!s||!a||s.contains(a)||(a.setAttribute("data-headlessui-portal",""),s.appendChild(a))},[s,a]),nn(()=>{if(a&&l)return l.register(a)},[l,a]),p0e(()=>{var d;!s||!a||(a instanceof Node&&s.contains(a)&&s.removeChild(a),s.childNodes.length<=0&&((d=s.parentElement)==null||d.removeChild(s)))});let u=Hi();return c?!s||!a?null:Tr.createPortal(u({ourProps:{ref:i},theirProps:n,slot:{},defaultTag:q8,name:"Portal"}),a):null});function x0e(e,t){let n=ko(t),{enabled:r=!0,...i}=e,o=Hi();return r?P.createElement(v0e,{...i,ref:n}):o({ourProps:{ref:n},theirProps:i,slot:{},defaultTag:q8,name:"Portal"})}let w0e=P.Fragment,Y8=P.createContext(null);function S0e(e,t){let{target:n,...r}=e,i={ref:ko(t)},o=Hi();return P.createElement(Y8.Provider,{value:n},o({ourProps:i,theirProps:r,defaultTag:w0e,name:"Popover.Group"}))}let _0e=P.createContext(null),C0e=yi(x0e),E0e=yi(S0e),R0e=Object.assign(C0e,{Group:E0e});var P0e=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(P0e||{}),T0e=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(T0e||{}),M0e=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))(M0e||{}),O0e=(e=>(e[e.OpenCombobox=0]="OpenCombobox",e[e.CloseCombobox=1]="CloseCombobox",e[e.GoToOption=2]="GoToOption",e[e.SetTyping=3]="SetTyping",e[e.RegisterOption=4]="RegisterOption",e[e.UnregisterOption=5]="UnregisterOption",e[e.SetActivationTrigger=6]="SetActivationTrigger",e[e.UpdateVirtualConfiguration=7]="UpdateVirtualConfiguration",e[e.SetInputElement=8]="SetInputElement",e[e.SetButtonElement=9]="SetButtonElement",e[e.SetOptionsElement=10]="SetOptionsElement",e))(O0e||{});function Lw(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=t(e.options.slice()),i=r.length>0&&r[0].dataRef.current.order!==null?r.sort((s,a)=>s.dataRef.current.order-a.dataRef.current.order):vye(r,s=>s.dataRef.current.domRef.current),o=n?i.indexOf(n):null;return o===-1&&(o=null),{options:i,activeOptionIndex:o}}let D0e={1(e){var t;return(t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===1?e:{...e,activeOptionIndex:null,comboboxState:1,isTyping:!1,activationTrigger:2,__demoMode:!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,__demoMode:!1}}return{...e,comboboxState:0,__demoMode:!1}},3(e,t){return e.isTyping===t.isTyping?e:{...e,isTyping:t.isTyping}},2(e,t){var n,r,i,o;if((n=e.dataRef.current)!=null&&n.disabled||e.optionsElement&&!((r=e.dataRef.current)!=null&&r.optionsPropsRef.current.static)&&e.comboboxState===1)return e;if(e.virtual){let{options:c,disabled:u}=e.virtual,d=t.focus===Wn.Specific?t.idx:uI(t,{resolveItems:()=>c,resolveActiveIndex:()=>{var h,m;return(m=(h=e.activeOptionIndex)!=null?h:c.findIndex(b=>!u(b)))!=null?m:null},resolveDisabled:u,resolveId(){throw new Error("Function not implemented.")}}),p=(i=t.trigger)!=null?i:2;return e.activeOptionIndex===d&&e.activationTrigger===p?e:{...e,activeOptionIndex:d,activationTrigger:p,isTyping:!1,__demoMode:!1}}let s=Lw(e);if(s.activeOptionIndex===null){let c=s.options.findIndex(u=>!u.dataRef.current.disabled);c!==-1&&(s.activeOptionIndex=c)}let a=t.focus===Wn.Specific?t.idx:uI(t,{resolveItems:()=>s.options,resolveActiveIndex:()=>s.activeOptionIndex,resolveId:c=>c.id,resolveDisabled:c=>c.dataRef.current.disabled}),l=(o=t.trigger)!=null?o:2;return e.activeOptionIndex===a&&e.activationTrigger===l?e:{...e,...s,isTyping:!1,activeOptionIndex:a,activationTrigger:l,__demoMode:!1}},4:(e,t)=>{var n,r,i;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:[...e.options,t.payload]};let o=t.payload,s=Lw(e,l=>(l.push(o),l));e.activeOptionIndex===null&&(r=e.dataRef.current)!=null&&r.isSelected(t.payload.dataRef.current.value)&&(s.activeOptionIndex=s.options.indexOf(o));let a={...e,...s,activationTrigger:2};return(i=e.dataRef.current)!=null&&i.__demoMode&&e.dataRef.current.value===void 0&&(a.activeOptionIndex=0),a},5:(e,t)=>{var n;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:e.options.filter(i=>i.id!==t.id)};let r=Lw(e,i=>{let o=i.findIndex(s=>s.id===t.id);return o!==-1&&i.splice(o,1),i});return{...e,...r,activationTrigger:2}},6:(e,t)=>e.activationTrigger===t.trigger?e:{...e,activationTrigger:t.trigger},7:(e,t)=>{var n,r;if(e.virtual===null)return{...e,virtual:{options:t.options,disabled:(n=t.disabled)!=null?n:()=>!1}};if(e.virtual.options===t.options&&e.virtual.disabled===t.disabled)return e;let i=e.activeOptionIndex;if(e.activeOptionIndex!==null){let o=t.options.indexOf(e.virtual.options[e.activeOptionIndex]);o!==-1?i=o:i=null}return{...e,activeOptionIndex:i,virtual:{options:t.options,disabled:(r=t.disabled)!=null?r:()=>!1}}},8:(e,t)=>e.inputElement===t.element?e:{...e,inputElement:t.element},9:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},10:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element}},yR=P.createContext(null);yR.displayName="ComboboxActionsContext";function Wp(e){let t=P.useContext(yR);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Wp),n}return t}let K8=P.createContext(null);function A0e(e){let t=Nd("VirtualProvider"),{options:n}=t.virtual,[r,i]=P.useMemo(()=>{let c=t.optionsElement;if(!c)return[0,0];let u=window.getComputedStyle(c);return[parseFloat(u.paddingBlockStart||u.paddingTop),parseFloat(u.paddingBlockEnd||u.paddingBottom)]},[t.optionsElement]),o=sye({enabled:n.length!==0,scrollPaddingStart:r,scrollPaddingEnd:i,count:n.length,estimateSize(){return 40},getScrollElement(){return t.optionsElement},overscan:12}),[s,a]=P.useState(0);nn(()=>{a(c=>c+1)},[n]);let l=o.getVirtualItems();return l.length===0?null:P.createElement(K8.Provider,{value:o},P.createElement("div",{style:{position:"relative",width:"100%",height:`${o.getTotalSize()}px`},ref:c=>{c&&t.activationTrigger!==0&&t.activeOptionIndex!==null&&n.length>t.activeOptionIndex&&o.scrollToIndex(t.activeOptionIndex)}},l.map(c=>{var u;return P.createElement(P.Fragment,{key:c.key},P.cloneElement((u=e.children)==null?void 0:u.call(e,{...e.slot,option:n[c.index]}),{key:`${s}-${c.key}`,"data-index":c.index,"aria-setsize":n.length,"aria-posinset":c.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${c.start}px)`,overflowAnchor:"none"}}))})))}let Fh=P.createContext(null);Fh.displayName="ComboboxDataContext";function Nd(e){let t=P.useContext(Fh);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Nd),n}return t}function I0e(e,t){return Mo(t.type,D0e,e,t)}let k0e=P.Fragment;function N0e(e,t){var n,r;let i=lR(),{value:o,defaultValue:s,onChange:a,form:l,name:c,by:u,disabled:d=i||!1,onClose:p,__demoMode:h=!1,multiple:m=!1,immediate:b=!1,virtual:v=null,nullable:x,...S}=e,_=Tbe(s),[E=m?[]:void 0,C]=Pbe(o,a,_),[M,O]=P.useReducer(I0e,{dataRef:P.createRef(),comboboxState:h?0:1,isTyping:!1,options:[],virtual:v?{options:v.options,disabled:(n=v.disabled)!=null?n:()=>!1}:null,activeOptionIndex:null,activationTrigger:2,inputElement:null,buttonElement:null,optionsElement:null,__demoMode:h}),N=P.useRef(!1),A=P.useRef({static:!1,hold:!1}),j=lye(u),F=qe(de=>v?u===null?v.options.indexOf(de):v.options.findIndex(Ee=>j(Ee,de)):M.options.findIndex(Ee=>j(Ee.dataRef.current.value,de))),$=P.useCallback(de=>Mo(H.mode,{1:()=>E.some(Ee=>j(Ee,de)),0:()=>j(E,de)}),[E]),K=qe(de=>M.activeOptionIndex===F(de)),H=P.useMemo(()=>({...M,immediate:b,optionsPropsRef:A,value:E,defaultValue:_,disabled:d,mode:m?1:0,virtual:v?M.virtual:null,get activeOptionIndex(){if(N.current&&M.activeOptionIndex===null&&(v?v.options.length>0:M.options.length>0)){if(v){let Ee=v.options.findIndex(De=>{var $e,Te;return!((Te=($e=v.disabled)==null?void 0:$e.call(v,De))!=null&&Te)});if(Ee!==-1)return Ee}let de=M.options.findIndex(Ee=>!Ee.dataRef.current.disabled);if(de!==-1)return de}return M.activeOptionIndex},calculateIndex:F,compare:j,isSelected:$,isActive:K}),[E,_,d,m,h,M,v]);nn(()=>{var de;v&&O({type:7,options:v.options,disabled:(de=v.disabled)!=null?de:null})},[v,v==null?void 0:v.options,v==null?void 0:v.disabled]),nn(()=>{M.dataRef.current=H},[H]);let L=H.comboboxState===0;Sye(L,[H.buttonElement,H.inputElement,H.optionsElement],()=>Z.closeCombobox());let W=P.useMemo(()=>{var de,Ee,De;return{open:H.comboboxState===0,disabled:d,activeIndex:H.activeOptionIndex,activeOption:H.activeOptionIndex===null?null:H.virtual?H.virtual.options[(de=H.activeOptionIndex)!=null?de:0]:(De=(Ee=H.options[H.activeOptionIndex])==null?void 0:Ee.dataRef.current.value)!=null?De:null,value:E}},[H,d,E]),B=qe(()=>{if(H.activeOptionIndex!==null){if(Z.setIsTyping(!1),H.virtual)D(H.virtual.options[H.activeOptionIndex]);else{let{dataRef:de}=H.options[H.activeOptionIndex];D(de.current.value)}Z.goToOption(Wn.Specific,H.activeOptionIndex)}}),U=qe(()=>{O({type:0}),N.current=!0}),Y=qe(()=>{O({type:1}),N.current=!1,p==null||p()}),I=qe(de=>{O({type:3,isTyping:de})}),Q=qe((de,Ee,De)=>(N.current=!1,de===Wn.Specific?O({type:2,focus:Wn.Specific,idx:Ee,trigger:De}):O({type:2,focus:de,trigger:De}))),G=qe((de,Ee)=>(O({type:4,payload:{id:de,dataRef:Ee}}),()=>{H.isActive(Ee.current.value)&&(N.current=!0),O({type:5,id:de})})),D=qe(de=>Mo(H.mode,{0(){return C==null?void 0:C(de)},1(){let Ee=H.value.slice(),De=Ee.findIndex($e=>j($e,de));return De===-1?Ee.push(de):Ee.splice(De,1),C==null?void 0:C(Ee)}})),ee=qe(de=>{O({type:6,trigger:de})}),q=qe(de=>{O({type:8,element:de})}),oe=qe(de=>{O({type:9,element:de})}),J=qe(de=>{O({type:10,element:de})}),Z=P.useMemo(()=>({onChange:D,registerOption:G,goToOption:Q,setIsTyping:I,closeCombobox:Y,openCombobox:U,setActivationTrigger:ee,selectActiveOption:B,setInputElement:q,setButtonElement:oe,setOptionsElement:J}),[]),[ae,ce]=Vbe(),ge=t===null?{}:{ref:t},ie=P.useCallback(()=>{if(_!==void 0)return C==null?void 0:C(_)},[C,_]),pe=Hi();return P.createElement(ce,{value:ae,props:{htmlFor:(r=H.inputElement)==null?void 0:r.id},slot:{open:H.comboboxState===0,disabled:d}},P.createElement(l0e,null,P.createElement(yR.Provider,{value:Z},P.createElement(Fh.Provider,{value:H},P.createElement(G8,{value:Mo(H.comboboxState,{0:Po.Open,1:Po.Closed})},c!=null&&P.createElement(Ibe,{disabled:d,data:E!=null?{[c]:E}:{},form:l,onReset:ie}),pe({ourProps:ge,theirProps:S,slot:W,defaultTag:k0e,name:"Combobox"}))))))}let L0e="input";function F0e(e,t){var n,r,i,o,s;let a=Nd("Combobox.Input"),l=Wp("Combobox.Input"),c=P.useId(),u=O8(),{id:d=u||`headlessui-combobox-input-${c}`,onChange:p,displayValue:h,disabled:m=a.disabled||!1,autoFocus:b=!1,type:v="text",...x}=e,S=P.useRef(null),_=ko(S,t,o0e(),l.setInputElement),E=D0(a.inputElement),C=kd(),M=qe(()=>{l.onChange(null),a.optionsElement&&(a.optionsElement.scrollTop=0),l.goToOption(Wn.Nothing)}),O=P.useMemo(()=>{var D;return typeof h=="function"&&a.value!==void 0?(D=h(a.value))!=null?D:"":typeof a.value=="string"?a.value:""},[a.value,h]);nI(([D,ee],[q,oe])=>{if(a.isTyping)return;let J=S.current;J&&((oe===0&&ee===1||D!==q)&&(J.value=D),requestAnimationFrame(()=>{if(a.isTyping||!J||(E==null?void 0:E.activeElement)!==J)return;let{selectionStart:Z,selectionEnd:ae}=J;Math.abs((ae??0)-(Z??0))===0&&Z===0&&J.setSelectionRange(J.value.length,J.value.length)}))},[O,a.comboboxState,E,a.isTyping]),nI(([D],[ee])=>{if(D===0&&ee===1){if(a.isTyping)return;let q=S.current;if(!q)return;let oe=q.value,{selectionStart:J,selectionEnd:Z,selectionDirection:ae}=q;q.value="",q.value=oe,ae!==null?q.setSelectionRange(J,Z,ae):q.setSelectionRange(J,Z)}},[a.comboboxState]);let N=P.useRef(!1),A=qe(()=>{N.current=!0}),j=qe(()=>{C.nextFrame(()=>{N.current=!1})}),F=qe(D=>{switch(l.setIsTyping(!0),D.key){case Wr.Enter:if(a.comboboxState!==0||N.current)return;if(D.preventDefault(),D.stopPropagation(),a.activeOptionIndex===null){l.closeCombobox();return}l.selectActiveOption(),a.mode===0&&l.closeCombobox();break;case Wr.ArrowDown:return D.preventDefault(),D.stopPropagation(),Mo(a.comboboxState,{0:()=>l.goToOption(Wn.Next),1:()=>l.openCombobox()});case Wr.ArrowUp:return D.preventDefault(),D.stopPropagation(),Mo(a.comboboxState,{0:()=>l.goToOption(Wn.Previous),1:()=>{Tr.flushSync(()=>l.openCombobox()),a.value||l.goToOption(Wn.Last)}});case Wr.Home:if(D.shiftKey)break;return D.preventDefault(),D.stopPropagation(),l.goToOption(Wn.First);case Wr.PageUp:return D.preventDefault(),D.stopPropagation(),l.goToOption(Wn.First);case Wr.End:if(D.shiftKey)break;return D.preventDefault(),D.stopPropagation(),l.goToOption(Wn.Last);case Wr.PageDown:return D.preventDefault(),D.stopPropagation(),l.goToOption(Wn.Last);case Wr.Escape:return a.comboboxState!==0?void 0:(D.preventDefault(),a.optionsElement&&!a.optionsPropsRef.current.static&&D.stopPropagation(),a.mode===0&&a.value===null&&M(),l.closeCombobox());case Wr.Tab:if(a.comboboxState!==0)return;a.mode===0&&a.activationTrigger!==1&&l.selectActiveOption(),l.closeCombobox();break}}),$=qe(D=>{p==null||p(D),a.mode===0&&D.target.value===""&&M(),l.openCombobox()}),K=qe(D=>{var ee,q,oe;let J=(ee=D.relatedTarget)!=null?ee:Il.find(Z=>Z!==D.currentTarget);if(!((q=a.optionsElement)!=null&&q.contains(J))&&!((oe=a.buttonElement)!=null&&oe.contains(J))&&a.comboboxState===0)return D.preventDefault(),a.mode===0&&a.value===null&&M(),l.closeCombobox()}),H=qe(D=>{var ee,q,oe;let J=(ee=D.relatedTarget)!=null?ee:Il.find(Z=>Z!==D.currentTarget);(q=a.buttonElement)!=null&&q.contains(J)||(oe=a.optionsElement)!=null&&oe.contains(J)||a.disabled||a.immediate&&a.comboboxState!==0&&C.microTask(()=>{Tr.flushSync(()=>l.openCombobox()),l.setActivationTrigger(1)})}),L=O0(),W=$be(),{isFocused:B,focusProps:U}=_8({autoFocus:b}),{isHovered:Y,hoverProps:I}=S8({isDisabled:m}),Q=P.useMemo(()=>({open:a.comboboxState===0,disabled:m,hover:Y,focus:B,autofocus:b}),[a,Y,B,b,m]),G=cR({ref:_,id:d,role:"combobox",type:v,"aria-controls":(n=a.optionsElement)==null?void 0:n.id,"aria-expanded":a.comboboxState===0,"aria-activedescendant":a.activeOptionIndex===null?void 0:a.virtual?(r=a.options.find(D=>!D.dataRef.current.disabled&&a.compare(D.dataRef.current.value,a.virtual.options[a.activeOptionIndex])))==null?void 0:r.id:(i=a.options[a.activeOptionIndex])==null?void 0:i.id,"aria-labelledby":L,"aria-describedby":W,"aria-autocomplete":"list",defaultValue:(s=(o=e.defaultValue)!=null?o:a.defaultValue!==void 0?h==null?void 0:h(a.defaultValue):null)!=null?s:a.defaultValue,disabled:m||void 0,autoFocus:b,onCompositionStart:A,onCompositionEnd:j,onKeyDown:F,onChange:$,onFocus:H,onBlur:K},U,I);return Hi()({ourProps:G,theirProps:x,slot:Q,defaultTag:L0e,name:"Combobox.Input"})}let j0e="button";function $0e(e,t){var n;let r=Nd("Combobox.Button"),i=Wp("Combobox.Button"),o=ko(t,i.setButtonElement),s=P.useId(),{id:a=`headlessui-combobox-button-${s}`,disabled:l=r.disabled||!1,autoFocus:c=!1,...u}=e,d=z8(r.inputElement),p=qe(O=>{switch(O.key){case Wr.Space:case Wr.Enter:O.preventDefault(),O.stopPropagation(),r.comboboxState===1&&Tr.flushSync(()=>i.openCombobox()),d();return;case Wr.ArrowDown:O.preventDefault(),O.stopPropagation(),r.comboboxState===1&&(Tr.flushSync(()=>i.openCombobox()),r.value||i.goToOption(Wn.First)),d();return;case Wr.ArrowUp:O.preventDefault(),O.stopPropagation(),r.comboboxState===1&&(Tr.flushSync(()=>i.openCombobox()),r.value||i.goToOption(Wn.Last)),d();return;case Wr.Escape:if(r.comboboxState!==0)return;O.preventDefault(),r.optionsElement&&!r.optionsPropsRef.current.static&&O.stopPropagation(),Tr.flushSync(()=>i.closeCombobox()),d();return;default:return}}),h=qe(O=>{O.preventDefault(),!Lbe(O.currentTarget)&&(O.button===mR.Left&&(r.comboboxState===0?i.closeCombobox():i.openCombobox()),d())}),m=O0([a]),{isFocusVisible:b,focusProps:v}=_8({autoFocus:c}),{isHovered:x,hoverProps:S}=S8({isDisabled:l}),{pressed:_,pressProps:E}=wbe({disabled:l}),C=P.useMemo(()=>({open:r.comboboxState===0,active:_||r.comboboxState===0,disabled:l,value:r.value,hover:x,focus:b}),[r,x,b,_,l]),M=cR({ref:o,id:a,type:Cye(e,r.buttonElement),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":(n=r.optionsElement)==null?void 0:n.id,"aria-expanded":r.comboboxState===0,"aria-labelledby":m,disabled:l||void 0,autoFocus:c,onMouseDown:h,onKeyDown:p},v,S,E);return Hi()({ourProps:M,theirProps:u,slot:C,defaultTag:j0e,name:"Combobox.Button"})}let z0e="div",B0e=ay.RenderStrategy|ay.Static;function H0e(e,t){var n,r,i;let o=P.useId(),{id:s=`headlessui-combobox-options-${o}`,hold:a=!1,anchor:l,portal:c=!1,modal:u=!0,transition:d=!1,...p}=e,h=Nd("Combobox.Options"),m=Wp("Combobox.Options"),b=i0e(l);b&&(c=!0);let[v,x]=a0e(b),[S,_]=P.useState(null),E=s0e(),C=ko(t,b?v:null,m.setOptionsElement,_),M=D0(h.optionsElement),O=gR(),[N,A]=H8(d,S,O!==null?(O&Po.Open)===Po.Open:h.comboboxState===0);hye(N,h.inputElement,m.closeCombobox);let j=h.__demoMode?!1:u&&h.comboboxState===0;Oye(j,M);let F=h.__demoMode?!1:u&&h.comboboxState===0;fye(F,{allowed:P.useCallback(()=>[h.inputElement,h.buttonElement,h.optionsElement],[h.inputElement,h.buttonElement,h.optionsElement])}),nn(()=>{var G;h.optionsPropsRef.current.static=(G=e.static)!=null?G:!1},[h.optionsPropsRef,e.static]),nn(()=>{h.optionsPropsRef.current.hold=a},[h.optionsPropsRef,a]),Fye(h.comboboxState===0,{container:h.optionsElement,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 $=O0([(n=h.buttonElement)==null?void 0:n.id]),K=P.useMemo(()=>({open:h.comboboxState===0,option:void 0}),[h.comboboxState]),H=qe(()=>{m.setActivationTrigger(0)}),L=qe(G=>{G.preventDefault(),m.setActivationTrigger(0)}),W=cR(b?E():{},{"aria-labelledby":$,role:"listbox","aria-multiselectable":h.mode===1?!0:void 0,id:s,ref:C,style:{...p.style,...x,"--input-width":KA(h.inputElement,!0).width,"--button-width":KA(h.buttonElement,!0).width},onWheel:h.activationTrigger===0?void 0:H,onMouseDown:L,...B8(A)}),B=N&&h.comboboxState===1,U=l_(B,(r=h.virtual)==null?void 0:r.options),Y=l_(B,h.value),I=qe(G=>h.compare(Y,G));if(h.virtual){if(U===void 0)throw new Error("Missing `options` in virtual mode");Object.assign(p,{children:P.createElement(Fh.Provider,{value:U!==h.virtual.options?{...h,virtual:{...h.virtual,options:U}}:h},P.createElement(A0e,{slot:K},p.children))})}let Q=Hi();return P.createElement(R0e,{enabled:c?e.static||N:!1},P.createElement(Fh.Provider,{value:h.mode===1?h:{...h,isSelected:I}},Q({ourProps:W,theirProps:{...p,children:P.createElement(d0e,{freeze:B},typeof p.children=="function"?(i=p.children)==null?void 0:i.call(p,K):p.children)},slot:K,defaultTag:z0e,features:B0e,visible:N,name:"Combobox.Options"})))}let V0e="div";function W0e(e,t){var n,r,i,o;let s=Nd("Combobox.Option"),a=Wp("Combobox.Option"),l=P.useId(),{id:c=`headlessui-combobox-option-${l}`,value:u,disabled:d=(i=(r=(n=s.virtual)==null?void 0:n.disabled)==null?void 0:r.call(n,u))!=null?i:!1,order:p=null,...h}=e,m=z8(s.inputElement),b=s.virtual?s.activeOptionIndex===s.calculateIndex(u):s.activeOptionIndex===null?!1:((o=s.options[s.activeOptionIndex])==null?void 0:o.id)===c,v=s.isSelected(u),x=P.useRef(null),S=ol({disabled:d,value:u,domRef:x,order:p}),_=P.useContext(K8),E=ko(t,x,_?_.measureElement:null),C=qe(()=>{a.setIsTyping(!1),a.onChange(u)});nn(()=>a.registerOption(c,S),[S,c]);let M=P.useRef(!(s.virtual||s.__demoMode));nn(()=>{if(!s.virtual&&!s.__demoMode)return ds().requestAnimationFrame(()=>{M.current=!0})},[s.virtual,s.__demoMode]),nn(()=>{if(M.current&&s.comboboxState===0&&b&&s.activationTrigger!==0)return ds().requestAnimationFrame(()=>{var L,W;(W=(L=x.current)==null?void 0:L.scrollIntoView)==null||W.call(L,{block:"nearest"})})},[x,b,s.comboboxState,s.activationTrigger,s.activeOptionIndex]);let O=qe(L=>{L.preventDefault(),L.button===mR.Left&&(d||(C(),$8()||requestAnimationFrame(()=>m()),s.mode===0&&a.closeCombobox()))}),N=qe(()=>{if(d)return a.goToOption(Wn.Nothing);let L=s.calculateIndex(u);a.goToOption(Wn.Specific,L)}),A=Dye(),j=qe(L=>A.update(L)),F=qe(L=>{if(!A.wasMoved(L)||d||b)return;let W=s.calculateIndex(u);a.goToOption(Wn.Specific,W,0)}),$=qe(L=>{A.wasMoved(L)&&(d||b&&(s.optionsPropsRef.current.hold||a.goToOption(Wn.Nothing)))}),K=P.useMemo(()=>({active:b,focus:b,selected:v,disabled:d}),[b,v,d]),H={id:c,ref:E,role:"option",tabIndex:d===!0?void 0:-1,"aria-disabled":d===!0?!0:void 0,"aria-selected":v,disabled:void 0,onMouseDown:O,onFocus:N,onPointerEnter:j,onMouseEnter:j,onPointerMove:F,onMouseMove:F,onPointerLeave:$,onMouseLeave:$};return Hi()({ourProps:H,theirProps:h,slot:K,defaultTag:V0e,name:"Combobox.Option"})}let U0e=yi(N0e),X8=yi($0e),Q8=yi(F0e),G0e=qbe,J8=yi(H0e),Z8=yi(W0e),q0e=Object.assign(U0e,{Input:Q8,Button:X8,Label:G0e,Options:J8,Option:Z8});function Y0e(){let e=P.useRef(!1);return nn(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function e7(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:n7)!==P.Fragment||P.Children.count(e.children)===1}let A0=P.createContext(null);A0.displayName="TransitionContext";var K0e=(e=>(e.Visible="visible",e.Hidden="hidden",e))(K0e||{});function X0e(){let e=P.useContext(A0);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function Q0e(){let e=P.useContext(I0);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let I0=P.createContext(null);I0.displayName="NestingContext";function k0(e){return"children"in e?k0(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function t7(e,t){let n=ol(e),r=P.useRef([]),i=Y0e(),o=kd(),s=qe((h,m=ja.Hidden)=>{let b=r.current.findIndex(({el:v})=>v===h);b!==-1&&(Mo(m,{[ja.Unmount](){r.current.splice(b,1)},[ja.Hidden](){r.current[b].state="hidden"}}),o.microTask(()=>{var v;!k0(r)&&i.current&&((v=n.current)==null||v.call(n))}))}),a=qe(h=>{let m=r.current.find(({el:b})=>b===h);return m?m.state!=="visible"&&(m.state="visible"):r.current.push({el:h,state:"visible"}),()=>s(h,ja.Unmount)}),l=P.useRef([]),c=P.useRef(Promise.resolve()),u=P.useRef({enter:[],leave:[]}),d=qe((h,m,b)=>{l.current.splice(0),t&&(t.chains.current[m]=t.chains.current[m].filter(([v])=>v!==h)),t==null||t.chains.current[m].push([h,new Promise(v=>{l.current.push(v)})]),t==null||t.chains.current[m].push([h,new Promise(v=>{Promise.all(u.current[m].map(([x,S])=>S)).then(()=>v())})]),m==="enter"?c.current=c.current.then(()=>t==null?void 0:t.wait.current).then(()=>b(m)):b(m)}),p=qe((h,m,b)=>{Promise.all(u.current[m].splice(0).map(([v,x])=>x)).then(()=>{var v;(v=l.current.shift())==null||v()}).then(()=>b(m))});return P.useMemo(()=>({children:r,register:a,unregister:s,onStart:d,onStop:p,wait:c,chains:u}),[a,s,r,d,p,u,c])}let n7=P.Fragment,r7=ay.RenderStrategy;function J0e(e,t){var n,r;let{transition:i=!0,beforeEnter:o,afterEnter:s,beforeLeave:a,afterLeave:l,enter:c,enterFrom:u,enterTo:d,entered:p,leave:h,leaveFrom:m,leaveTo:b,...v}=e,[x,S]=P.useState(null),_=P.useRef(null),E=e7(e),C=ko(...E?[_,t,S]:t===null?[]:[t]),M=(n=v.unmount)==null||n?ja.Unmount:ja.Hidden,{show:O,appear:N,initial:A}=X0e(),[j,F]=P.useState(O?"visible":"hidden"),$=Q0e(),{register:K,unregister:H}=$;nn(()=>K(_),[K,_]),nn(()=>{if(M===ja.Hidden&&_.current){if(O&&j!=="visible"){F("visible");return}return Mo(j,{hidden:()=>H(_),visible:()=>K(_)})}},[j,_,K,H,O,M]);let L=bR();nn(()=>{if(E&&L&&j==="visible"&&_.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[_,j,L,E]);let W=A&&!N,B=N&&O&&A,U=P.useRef(!1),Y=t7(()=>{U.current||(F("hidden"),H(_))},$),I=qe(J=>{U.current=!0;let Z=J?"enter":"leave";Y.onStart(_,Z,ae=>{ae==="enter"?o==null||o():ae==="leave"&&(a==null||a())})}),Q=qe(J=>{let Z=J?"enter":"leave";U.current=!1,Y.onStop(_,Z,ae=>{ae==="enter"?s==null||s():ae==="leave"&&(l==null||l())}),Z==="leave"&&!k0(Y)&&(F("hidden"),H(_))});P.useEffect(()=>{E&&i||(I(O),Q(O))},[O,E,i]);let G=!(!i||!E||!L||W),[,D]=H8(G,x,O,{start:I,end:Q}),ee=_a({ref:C,className:((r=i_(v.className,B&&c,B&&u,D.enter&&c,D.enter&&D.closed&&u,D.enter&&!D.closed&&d,D.leave&&h,D.leave&&!D.closed&&m,D.leave&&D.closed&&b,!D.transition&&O&&p))==null?void 0:r.trim())||void 0,...B8(D)}),q=0;j==="visible"&&(q|=Po.Open),j==="hidden"&&(q|=Po.Closed),D.enter&&(q|=Po.Opening),D.leave&&(q|=Po.Closing);let oe=Hi();return P.createElement(I0.Provider,{value:Y},P.createElement(G8,{value:q},oe({ourProps:ee,theirProps:v,defaultTag:n7,features:r7,visible:j==="visible",name:"Transition.Child"})))}function Z0e(e,t){let{show:n,appear:r=!1,unmount:i=!0,...o}=e,s=P.useRef(null),a=e7(e),l=ko(...a?[s,t]:t===null?[]:[t]);bR();let c=gR();if(n===void 0&&c!==null&&(n=(c&Po.Open)===Po.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[u,d]=P.useState(n?"visible":"hidden"),p=t7(()=>{n||d("hidden")}),[h,m]=P.useState(!0),b=P.useRef([n]);nn(()=>{h!==!1&&b.current[b.current.length-1]!==n&&(b.current.push(n),m(!1))},[b,n]);let v=P.useMemo(()=>({show:n,appear:r,initial:h}),[n,r,h]);nn(()=>{n?d("visible"):!k0(p)&&s.current!==null&&d("hidden")},[n,p]);let x={unmount:i},S=qe(()=>{var C;h&&m(!1),(C=e.beforeEnter)==null||C.call(e)}),_=qe(()=>{var C;h&&m(!1),(C=e.beforeLeave)==null||C.call(e)}),E=Hi();return P.createElement(I0.Provider,{value:p},P.createElement(A0.Provider,{value:v},E({ourProps:{...x,as:P.Fragment,children:P.createElement(i7,{ref:l,...x,...o,beforeEnter:S,beforeLeave:_})},theirProps:{},defaultTag:P.Fragment,features:r7,visible:u==="visible",name:"Transition"})))}function eve(e,t){let n=P.useContext(A0)!==null,r=gR()!==null;return P.createElement(P.Fragment,null,!n&&r?P.createElement(c_,{ref:t,...e}):P.createElement(i7,{ref:t,...e}))}let c_=yi(Z0e),i7=yi(J0e),tve=yi(eve),nve=Object.assign(c_,{Child:tve,Root:c_});var vR="Checkbox",[rve,BTe]=er(vR),[ive,ove]=rve(vR),o7=R.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:o,required:s,disabled:a,value:l="on",onCheckedChange:c,form:u,...d}=e,[p,h]=R.useState(null),m=rt(t,E=>h(E)),b=R.useRef(!1),v=p?u||!!p.closest("form"):!0,[x=!1,S]=Ar({prop:i,defaultProp:o,onChange:c}),_=R.useRef(x);return R.useEffect(()=>{const E=p==null?void 0:p.form;if(E){const C=()=>S(_.current);return E.addEventListener("reset",C),()=>E.removeEventListener("reset",C)}},[p,S]),y.jsxs(ive,{scope:n,state:x,disabled:a,children:[y.jsx(Ne.button,{type:"button",role:"checkbox","aria-checked":Ba(x)?"mixed":x,"aria-required":s,"data-state":l7(x),"data-disabled":a?"":void 0,disabled:a,value:l,...d,ref:m,onKeyDown:Re(e.onKeyDown,E=>{E.key==="Enter"&&E.preventDefault()}),onClick:Re(e.onClick,E=>{S(C=>Ba(C)?!0:!C),v&&(b.current=E.isPropagationStopped(),b.current||E.stopPropagation())})}),v&&y.jsx(sve,{control:p,bubbles:!b.current,name:r,value:l,checked:x,required:s,disabled:a,form:u,style:{transform:"translateX(-100%)"},defaultChecked:Ba(o)?!1:o})]})});o7.displayName=vR;var s7="CheckboxIndicator",a7=R.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...i}=e,o=ove(s7,n);return y.jsx(qn,{present:r||Ba(o.state)||o.state===!0,children:y.jsx(Ne.span,{"data-state":l7(o.state),"data-disabled":o.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});a7.displayName=s7;var sve=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:i,...o}=e,s=R.useRef(null),a=b0(n),l=a0(t);R.useEffect(()=>{const u=s.current,d=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(d,"checked").set;if(a!==n&&h){const m=new Event("click",{bubbles:r});u.indeterminate=Ba(n),h.call(u,Ba(n)?!1:n),u.dispatchEvent(m)}},[a,n,r]);const c=R.useRef(Ba(n)?!1:n);return y.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i??c.current,...o,tabIndex:-1,ref:s,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Ba(e){return e==="indeterminate"}function l7(e){return Ba(e)?"indeterminate":e?"checked":"unchecked"}var c7=o7,ave=a7;const N0=R.forwardRef(({className:e,...t},n)=>y.jsx(c7,{ref:n,className:be("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:y.jsx(ave,{className:be("flex items-center justify-center text-current"),children:y.jsx(vp,{className:"h-4 w-4"})})}));N0.displayName=c7.displayName;function lve(e){const t=/(>=|<=|>|<|=)/,n=e.match(t);if(n){const r=n[0],[i,o]=e.split(r);return{operation:r,value:o.trim()}}else return null}function cve(e,t,n){const r=`SELECT ${n}, COUNT(*) FROM ${t} {{ filters | where }} GROUP BY ${n} ORDER BY ${n} ASC LIMIT 50`,i=`SELECT min(${n}) as min, max(${n}) as max FROM ${t} {{ filters | where }}`;return Sd.includes(e)?i:r}function u7(e){const[t,n]=P.useState([]),[r,i]=P.useState(""),o=ve(C=>C.filterValues),s=ve(C=>C.selectedSheetId),{addOrUpdateFilterValue:a,removeFilterValue:l}=lr(),{data:c,isLoading:u,isFetching:d,isError:p}=h8(e),h=P.useMemo(()=>{var C;return(C=c==null?void 0:c.records)==null?void 0:C.map(M=>{let O=e.column.split(".").slice(-1)[0].replace(/"/g,"");return M[O]===void 0&&(O=O.toLowerCase()),{id:M[O],value:M[O]}})},[c,e.column]);P.useEffect(()=>{if(o){const C=o.find(M=>M.filterId===e.id);if(!C){n([]);return}if(C.operation==="in"){const M=h==null?void 0:h.filter(O=>C.values.includes(O.value));M&&n(M)}}},[c,s,o,e.id,h]),P.useEffect(()=>{if(o&&!o.find(M=>M.filterId===e.id)){n([]);return}},[o,e.id]);function m(C){const M=lve(C[0].toString());if(!(M!=null&&M.value)||!(M!=null&&M.operation))return;const O={filterId:e.id,connectionType:e.database==="NA"?"api":"database",valueType:Cu(e),name:e.column,operation:M.operation,values:[Number(M.value)]};a(O)}function b(C){if(Array.isArray(C)||(C=[C]),C.length===1&&h.find(O=>O.value===C[0].value)===void 0){m(C);return}if(n(C),C.length===0){l(e.id);return}const M={filterId:e.id,connectionType:e.database==="NA"?"api":"database",name:e.column,valueType:Cu(e),operation:e.operation,values:C.map(O=>O.value)};a(M)}function v(C){if(C){n(h);const M={filterId:e.id,connectionType:e.database==="NA"?"api":"database",name:e.column,valueType:Cu(e),operation:e.operation,values:h.map(O=>O.value)};a(M)}else n([]),l(e.id)}function x(){if(hp.includes(e.dataType))return h;const C=r.toLowerCase().replace(/\s+/g,"");return r===""?h:h.filter(M=>M.value.toLowerCase().replace(/\s+/g,"").includes(C))}const S=x(),_=e.type==="single",E=t.length===(h==null?void 0:h.length);return{isLoading:u,isFetching:d,isError:p,selected:t,handleValueChange:b,handleSelectAll:v,query:r,setQuery:i,filteredRecords:S,isSingleSelect:_,allSelected:E}}function uve({filter:e}){const{filteredRecords:t,isSingleSelect:n,allSelected:r,handleValueChange:i,handleSelectAll:o,query:s,setQuery:a,isLoading:l,isFetching:c,isError:u,selected:d}=u7(e);return l||c?y.jsx("div",{children:y.jsx(Ru,{className:"h-8 w-full bg-foreground/10"})}):u?y.jsx("div",{className:"flex h-8 w-full items-center bg-muted px-2 text-sm",children:"Error"}):y.jsx("div",{className:"w-full",children:y.jsx(q0e,{value:d,multiple:!n,onChange:i,children:y.jsxs("div",{className:"relative",children:[y.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:[y.jsx(Q8,{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:p=>p.map(m=>m.value).join(", "),onChange:p=>{a(p.target.value)}}),y.jsx(X8,{className:"absolute inset-y-0 right-0 flex items-center bg-background pl-1 pr-2",children:y.jsx(OZ,{className:"h-5 w-5 text-gray-400","aria-hidden":"true"})})]}),y.jsx(nve,{as:P.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",afterLeave:()=>a(""),children:y.jsxs(J8,{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:[e.type==="multiple"||e.type===void 0&&y.jsxs("div",{className:"flex items-center justify-between gap-2 border-b px-4 py-2",children:[y.jsx("span",{children:"Select All"}),y.jsx(N0,{checked:r,onCheckedChange:o})]}),(t==null?void 0:t.length)===0&&s!==""?y.jsx("div",{className:"relative cursor-default select-none px-4 py-2 text-gray-700",children:"Nothing found."}):t==null?void 0:t.map(p=>y.jsx(Z8,{className:({active:h})=>`relative cursor-default select-none border-b border-muted py-2 pl-10 pr-4 ${h?"bg-muted":"text-foreground-900"}`,value:p,children:({selected:h,active:m})=>y.jsxs("div",{className:"",children:[y.jsx("span",{className:`block ${h?"font-medium":"font-normal"}`,children:typeof p.value=="boolean"?p.value?"True":"False":p.value}),h?y.jsx("span",{className:"absolute inset-y-0 left-0 flex items-center pl-3 text-foreground",children:y.jsx(F5,{className:"h-5 w-5","aria-hidden":"true"})}):null]})},p.value))]})})]})})})}var xR="Radio",[dve,d7]=er(xR),[fve,hve]=dve(xR),f7=R.forwardRef((e,t)=>{const{__scopeRadio:n,name:r,checked:i=!1,required:o,disabled:s,value:a="on",onCheck:l,form:c,...u}=e,[d,p]=R.useState(null),h=rt(t,v=>p(v)),m=R.useRef(!1),b=d?c||!!d.closest("form"):!0;return y.jsxs(fve,{scope:n,checked:i,disabled:s,children:[y.jsx(Ne.button,{type:"button",role:"radio","aria-checked":i,"data-state":g7(i),"data-disabled":s?"":void 0,disabled:s,value:a,...u,ref:h,onClick:Re(e.onClick,v=>{i||l==null||l(),b&&(m.current=v.isPropagationStopped(),m.current||v.stopPropagation())})}),b&&y.jsx(pve,{control:d,bubbles:!m.current,name:r,value:a,checked:i,required:o,disabled:s,form:c,style:{transform:"translateX(-100%)"}})]})});f7.displayName=xR;var h7="RadioIndicator",p7=R.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:r,...i}=e,o=hve(h7,n);return y.jsx(qn,{present:r||o.checked,children:y.jsx(Ne.span,{"data-state":g7(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:t})})});p7.displayName=h7;var pve=e=>{const{control:t,checked:n,bubbles:r=!0,...i}=e,o=R.useRef(null),s=b0(n),a=a0(t);return R.useEffect(()=>{const l=o.current,c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"checked").set;if(s!==n&&d){const p=new Event("click",{bubbles:r});d.call(l,n),l.dispatchEvent(p)}},[s,n,r]),y.jsx("input",{type:"radio","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:o,style:{...e.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function g7(e){return e?"checked":"unchecked"}var gve=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],wR="RadioGroup",[mve,HTe]=er(wR,[Cd,d7]),m7=Cd(),b7=d7(),[bve,yve]=mve(wR),y7=R.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:r,defaultValue:i,value:o,required:s=!1,disabled:a=!1,orientation:l,dir:c,loop:u=!0,onValueChange:d,...p}=e,h=m7(n),m=Oc(c),[b,v]=Ar({prop:o,defaultProp:i,onChange:d});return y.jsx(bve,{scope:n,name:r,required:s,disabled:a,value:b,onValueChange:v,children:y.jsx(Z_,{asChild:!0,...h,orientation:l,dir:m,loop:u,children:y.jsx(Ne.div,{role:"radiogroup","aria-required":s,"aria-orientation":l,"data-disabled":a?"":void 0,dir:m,...p,ref:t})})})});y7.displayName=wR;var v7="RadioGroupItem",x7=R.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:r,...i}=e,o=yve(v7,n),s=o.disabled||r,a=m7(n),l=b7(n),c=R.useRef(null),u=rt(t,c),d=o.value===i.value,p=R.useRef(!1);return R.useEffect(()=>{const h=b=>{gve.includes(b.key)&&(p.current=!0)},m=()=>p.current=!1;return document.addEventListener("keydown",h),document.addEventListener("keyup",m),()=>{document.removeEventListener("keydown",h),document.removeEventListener("keyup",m)}},[]),y.jsx(eC,{asChild:!0,...a,focusable:!s,active:d,children:y.jsx(f7,{disabled:s,required:o.required,checked:d,...l,...i,name:o.name,ref:u,onCheck:()=>o.onValueChange(i.value),onKeyDown:Re(h=>{h.key==="Enter"&&h.preventDefault()}),onFocus:Re(i.onFocus,()=>{var h;p.current&&((h=c.current)==null||h.click())})})})});x7.displayName=v7;var vve="RadioGroupIndicator",w7=R.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...r}=e,i=b7(n);return y.jsx(p7,{...i,...r,ref:t})});w7.displayName=vve;var S7=y7,_7=x7,xve=w7;const jh=R.forwardRef(({className:e,...t},n)=>y.jsx(S7,{className:be("grid gap-2",e),...t,ref:n}));jh.displayName=S7.displayName;const Hl=R.forwardRef(({className:e,...t},n)=>y.jsx(_7,{ref:n,className:be("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:y.jsx(xve,{className:"flex items-center justify-center",children:y.jsx(OC,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Hl.displayName=_7.displayName;function wve({filter:e}){var o;const{filteredRecords:t,handleValueChange:n,selected:r}=u7(e);function i(s){n([{value:s,id:s}])}return y.jsx(jh,{onValueChange:i,value:((o=r==null?void 0:r[0])==null?void 0:o.value)||"",className:"mt-2 flex gap-3 overflow-x-auto",children:t==null?void 0:t.map(s=>y.jsxs("div",{className:"flex gap-2",children:[y.jsx(Hl,{value:s.value,id:"r1"}),y.jsx(xn,{className:"text-muted-foreground",htmlFor:"r1",children:s.value})]},s.value))})}function SR({filter:e}){return Sd.includes(e.dataType)?y.jsx(Zme,{filter:e}):e.uiType==="radio"&&e.type==="single"?y.jsx(wve,{filter:e}):y.jsx(uve,{filter:e})}function Sve({card:e,frame:t}){var K,H,L;const{customCards:n}=uo();P.useRef(null);const r=ve(W=>W.themeStyle),i=ve(W=>W.selectedSheetId),o=ve(W=>W.isDashboardEditing),s=ve(W=>W.selectedLensId),a=ve(W=>W.dashboard.filters),l=a==null?void 0:a.find(W=>W.id===t.filterId),{setCardTitle:c,setCardDescription:u,setSelectedFrameId:d,updateFilter:p}=lr(),{updateFrame:h}=lr(),m=((K=e.customCardPreferences)==null?void 0:K.showCardHeader)??!0,{isError:b,isLoading:v,isFetching:x,cfg:S,visualKey:_,data:E,handleDatapointClick:C}=hE(e);function M(){var W;if(n&&n.length>0){const B=n.find(U=>U.cardId===e.id);if(B&&B.replaceDefault){const U=B.content;if(U)return y.jsx(U,{card:e})}}return e.type==="kpi"?y.jsx(i3,{card:e,data:(E==null?void 0:E.records)||[]}):e.type==="text"&&((W=t==null?void 0:t.cards)==null?void 0:W.length)===1?y.jsx(kh,{className:"mx-3 my-6 overflow-y-auto break-words px-3",children:y.jsx(FS,{isLoading:v||x,card:e,data:(E==null?void 0:E.records)||[]})}):$}function O(){return["{{ filters | where }}","{{ filters | and }}"].some(B=>{var U;return(U=e.sql)==null?void 0:U.includes(B)})?y.jsx(Wue,{}):null}function N(){if(b)return y.jsx("p",{className:"text-sm",children:"Oops! It seems like something went wrong. Please review your connection or filters."});if(e.type==="table"&&(E!=null&&E.records)&&(E==null?void 0:E.records.length)>0)return y.jsx("div",{className:"relative flex min-h-0 flex-1 grow basis-0",children:y.jsx(C6,{card:e,data:(E==null?void 0:E.records)||[]})});if(e.type==="text")return y.jsx(kh,{className:"overflow-y-auto break-words pr-2",children:y.jsx(FS,{isLoading:v||x,card:e,data:(E==null?void 0:E.records)||[]})});if(e.type==="custom")return y.jsx(Dhe,{frame:t,card:e});if(n&&n.length>0){const W=n.find(B=>B.cardId===e.id);if(W&&W.content){const B=W.content;return y.jsx(B,{card:e})}}if(S)return y.jsx(VE,{cfg:S,onDatapointClick:C},`${_}-${s}`)}function A(){if(n&&n.length>0){const W=n.find(B=>B.cardId===e.id);if(W&&W.footer){const B=W.footer;if(B)return y.jsx(B,{card:e})}}return null}function j(){var W,B,U;return y.jsx(rC,{value:t.activeCardId,className:"flex items-center justify-end gap-3",onValueChange:Y=>{const I={...t,activeCardId:Y};h(i,I)},children:y.jsx(Dy,{style:{borderRadius:(B=(W=r==null?void 0:r.chart)==null?void 0:W.options)==null?void 0:B.borderRadius},className:"flex-end flex-wrap items-center",children:(U=t.cards.filter(Y=>{var I;return!((I=Y.tabTitle)!=null&&I.endsWith("__Header"))&&(Y.displayTab===!0||Y.displayTab===void 0)}))==null?void 0:U.map(Y=>{var I,Q;return y.jsx(Ay,{style:{borderRadius:(Q=(I=r==null?void 0:r.chart)==null?void 0:I.options)==null?void 0:Q.borderRadius},value:Y.id,children:Y.tabTitle||Y.title},Y.id)})})})}function F(){let W=t.cards.find(B=>B.type==="kpi"&&B.tabTitle===`${e.tabTitle}__Header`);return W||(W=t.cards.find(B=>B.type==="kpi"&&B.tabTitle==="All__Header")),W?y.jsx("div",{className:"flex items-end gap-2",children:y.jsx(eue,{renderFilterInfo:O,card:W})}):y.jsxs(y.Fragment,{children:[y.jsxs("div",{role:"card-title-container",className:"flex items-center gap-2",children:[y.jsx(rs,{text:e.title,onSave:B=>c(i,e.id,B),children:y.jsx(_d,{className:be("text-base",{}),children:e.title})}),(o||e.info)&&y.jsx($3,{card:e}),e.refreshInterval&&y.jsxs(q3,{children:[y.jsx(Y3,{className:"pr-1",children:y.jsx("div",{className:be("h-2 w-2 rounded-full bg-green-500 transition-opacity",{"opacity-10":v||x})})}),y.jsx(ME,{side:"right",align:"center",children:y.jsx("p",{className:"text-xs",children:`Realtime (${e==null?void 0:e.refreshInterval})`})})]}),O()]}),y.jsx("div",{role:"card-description-container",children:y.jsx(rs,{text:(e==null?void 0:e.description)||"",onSave:B=>u(i,e.id,B),children:y.jsxs(Q_,{className:be("",{}),children:[" ",e.description]})})})]})}if(!e.id)return null;const $=y.jsxs(y.Fragment,{children:[m?y.jsx(Ry,{children:y.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[y.jsx("div",{className:"grow",role:"header-container",children:F()}),y.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.cards.length>1&&j(),y.jsx("div",{children:l&&y.jsxs("div",{style:{borderRadius:(L=(H=r==null?void 0:r.chart)==null?void 0:H.options)==null?void 0:L.borderRadius},role:"frame-filter-container",className:"flex h-10 shrink-0 items-center bg-muted p-1",children:[!Sd.includes(l.dataType)&&y.jsx(rs,{className:"my-1",containerClassName:"shrink-0",text:l.title||l.column,onSave:W=>p({...l,title:W}),children:y.jsx(xn,{className:"px-3",children:l.title})}),y.jsx(SR,{filter:l})]})})]})]})}):y.jsx("div",{className:"h-8"}),y.jsx(Py,{className:"relative flex min-h-0 grow flex-col",children:N()}),y.jsx(MN,{children:A()})]});return y.jsx("div",{className:be("flex h-full flex-col",{"animate-pulse":v||x}),children:M()})}function _ve({frame:e,footer:t,className:n,...r}){var b,v;const i=P.useRef(null),o=ve(x=>x.themeStyle),s=ve(x=>x.selectedFrameId),a=ve(x=>x.isDashboardEditing),{setSelectedFrameId:l}=lr(),{setSelectedConnectionId:c,setSelectedDatabaseName:u,setSelectedSchemaName:d,setSelectedTableName:p}=Uy(),h=e.cards.find(x=>x.id===e.activeCardId);dee(e,i);function m(x){x.stopPropagation(),l(e.id),h!=null&&h.connectionId&&c(h==null?void 0:h.connectionId),h!=null&&h.lastSelectedDatabase&&u(h==null?void 0:h.lastSelectedDatabase),h!=null&&h.lastSelectedSchema&&d(h==null?void 0:h.lastSelectedSchema),h!=null&&h.lastSelectedTable&&p(h==null?void 0:h.lastSelectedTable)}return y.jsx(Yy,{FallbackComponent:kC,children:y.jsxs("div",{tabIndex:-1,ref:i,role:"card-frame",onClick:m,style:{borderRadius:(v=(b=o==null?void 0:o.chart)==null?void 0:b.options)==null?void 0:v.borderRadius},className:be("relative flex h-full flex-col rounded-sm border bg-background shadow-sm",{"border-dashed border-foreground/50":s===e.id&&a},o==null?void 0:o.dashboardCard,n,"semaphor-card-frame"),...r,children:[y.jsx(t4,{frame:e}),y.jsx(Sve,{card:h,frame:e},h.id)]})})}const _R=R.forwardRef(({className:e,...t},n)=>y.jsx("textarea",{className:be("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));_R.displayName="Textarea";function Cve({label:e,onCheckedChange:t,checked:n}){return y.jsxs("div",{className:"flex items-center space-x-2",children:[y.jsx(N0,{onCheckedChange:t,id:"terms",checked:n}),y.jsx("label",{htmlFor:"terms",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:e})]})}function Eve({filter:e}){const[t,n]=P.useState(e.sql),[r,i]=P.useState(!1),o=ve(p=>p.selectedSheetId),{updateFilter:s}=lr();function a(){const p={...e,sql:t};s(p),i(!1)}function l(p){console.log("operation",p);const h={...e,operation:p};s(h)}function c(p){const h={...e,type:p};s(h)}function u(p){const h={...e,uiType:p};s(h)}function d(p){if(!o)return;const h={...e,sheetId:p?o:void 0};s(h)}return y.jsxs(_0,{open:r,onOpenChange:i,children:[y.jsx(C0,{children:y.jsx(IC,{className:"invisible h-3 w-3 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"})}),y.jsxs(Np,{onMouseDown:p=>p.stopPropagation(),onDoubleClick:p=>p.stopPropagation(),className:"z-50 m-2 w-full min-w-[350px] space-y-4",children:[y.jsxs("div",{className:"space-y-2",children:[y.jsxs("div",{className:"flex items-center gap-3",children:[y.jsx("h4",{className:"font-medium leading-none",children:"Customize Filter"}),y.jsx("p",{className:"rounded-md bg-muted px-2 py-1 text-xs text-muted-foreground",children:e.column})]}),y.jsx("p",{className:"text-sm text-muted-foreground",children:"Customize the filter operation and SQL"})]}),y.jsx(Op,{}),y.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[y.jsxs("div",{className:"space-y-2",children:[y.jsx(xn,{children:"Type"}),y.jsxs(jh,{onValueChange:c,value:e.type||"multiple",className:"flex gap-3",defaultValue:"x",children:[y.jsxs("div",{className:"flex items-center space-x-2",children:[y.jsx(Hl,{value:"multiple",id:"r1"}),y.jsx("label",{className:"text-sm",htmlFor:"r1",children:"Multiple"})]}),y.jsxs("div",{className:"flex items-center space-x-2",children:[y.jsx(Hl,{value:"single",id:"r2"}),y.jsx("label",{className:"text-sm",htmlFor:"r2",children:"Single"})]})]})]}),e.type==="single"&&y.jsxs("div",{className:"space-y-2",children:[y.jsx(xn,{children:"Filter Element"}),y.jsxs(jh,{onValueChange:u,value:e.uiType||"dropdown",className:"flex gap-3",defaultValue:"x",children:[y.jsxs("div",{className:"flex items-center space-x-2",children:[y.jsx(Hl,{value:"dropdown",id:"r2"}),y.jsx("label",{className:"text-sm",htmlFor:"r2",children:"Dropdown"})]}),y.jsxs("div",{className:"flex items-center space-x-2",children:[y.jsx(Hl,{value:"radio",id:"r1"}),y.jsx("label",{className:"text-sm",htmlFor:"r1",children:"Radio"})]})]})]})]}),y.jsxs("div",{className:"grid grid-cols-6 gap-4 text-sm",children:[y.jsxs("div",{className:"col-span-2 space-y-1",children:[y.jsx(xn,{children:"Table Column"}),y.jsx(xn,{className:"block rounded-md bg-muted p-2 font-mono text-xs",children:e.column})]}),y.jsxs("div",{className:"col-span-2 space-y-1",children:[y.jsx(xn,{children:"Data Type"}),y.jsx(xn,{className:"block rounded-md bg-muted p-2 font-mono text-xs",children:e.dataType})]}),y.jsxs("div",{className:"col-span-2 space-y-1",children:[y.jsx(xn,{className:"text-sm",children:"Filter Operation"}),y.jsx(Rve,{updateFilterOperation:l,value:e.operation})]})]}),y.jsxs("div",{className:"flex grow flex-col space-y-1",role:"container",children:[y.jsx(xn,{className:"text-sm",children:"Values SQL"}),y.jsx(_R,{onKeyDown:p=>{p.stopPropagation()},value:t,onChange:p=>n(p.target.value),className:`min-w-full grow resize font-mono text-xs ${Yf}`})]}),y.jsx("div",{children:y.jsx(Cve,{label:"Local to sheet",onCheckedChange:d,checked:!!e.sheetId})}),y.jsx("div",{className:"flex justify-end gap-2",children:y.jsxs(pi,{onClick:a,size:"sm",variant:"outline",children:[y.jsx(vp,{className:"mr-2 size-4"}),"Accept"]})})]})]})}function Rve({value:e,updateFilterOperation:t}){return y.jsxs(js,{defaultValue:"in",value:e,onValueChange:n=>t(n),children:[y.jsx(Vo,{className:"h-8 w-[180px] focus:ring-0 focus:ring-offset-0",children:y.jsx($s,{placeholder:"Operation"})}),y.jsxs(Wo,{children:[y.jsx(zn,{value:"=",children:"Equals"}),y.jsx(zn,{value:"in",children:"Contains"}),y.jsx(zn,{value:"like",children:"Like"})]})]})}function C7({filter:e}){const t=ve(a=>a.isDashboardEditing),n=ve(a=>a.filterValues),r=n==null?void 0:n.some(a=>a.filterId===e.id),{removeFilterValue:i,removeFilter:o,updateFilter:s}=lr();return y.jsx(rs,{className:"my-1",text:e.title||e.column,onSave:a=>s({...e,title:a}),children:y.jsxs("div",{className:"group mb-1 flex grow items-center justify-between",children:[y.jsxs("div",{className:"flex grow items-center gap-2",children:[y.jsx(xn,{className:"inline-block text-sm",children:e.title}),t&&y.jsx(Eve,{filter:e})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[r&&y.jsx("button",{onClick:()=>i(e.id),className:"text-foreground/30 hover:text-foreground/50",children:y.jsx(DC,{className:"size-3.5"})}),t&&y.jsx(Ed,{onClick:()=>{i(e.id),o(e.id)},className:"size-3.5 cursor-pointer text-foreground/30 hover:cursor-pointer hover:text-foreground/50"})]})]})})}var Pve=e=>{switch(e){case"success":return Ove;case"info":return Ave;case"warning":return Dve;case"error":return Ive;default:return null}},Tve=Array(12).fill(0),Mve=({visible:e,className:t})=>P.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},P.createElement("div",{className:"sonner-spinner"},Tve.map((n,r)=>P.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),Ove=P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},P.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"})),Dve=P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},P.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"})),Ave=P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},P.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"})),Ive=P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},P.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"})),kve=P.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"},P.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),P.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Nve=()=>{let[e,t]=P.useState(document.hidden);return P.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},u_=1,Lve=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:n,...r}=e,i=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:u_++,o=this.toasts.find(a=>a.id===i),s=e.dismissible===void 0?!0:e.dismissible;return o?this.toasts=this.toasts.map(a=>a.id===i?(this.publish({...a,...e,id:i,title:n}),{...a,...e,id:i,dismissible:s,title:n}):a):this.addToast({title:n,...r,dismissible:s,id:i}),i},this.dismiss=e=>(e||this.toasts.forEach(t=>{this.subscribers.forEach(n=>n({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let r=e instanceof Promise?e:e(),i=n!==void 0,o,s=r.then(async l=>{if(o=["resolve",l],P.isValidElement(l))i=!1,this.create({id:n,type:"default",message:l});else if(jve(l)&&!l.ok){i=!1;let c=typeof t.error=="function"?await t.error(`HTTP error! status: ${l.status}`):t.error,u=typeof t.description=="function"?await t.description(`HTTP error! status: ${l.status}`):t.description;this.create({id:n,type:"error",message:c,description:u})}else if(t.success!==void 0){i=!1;let c=typeof t.success=="function"?await t.success(l):t.success,u=typeof t.description=="function"?await t.description(l):t.description;this.create({id:n,type:"success",message:c,description:u})}}).catch(async l=>{if(o=["reject",l],t.error!==void 0){i=!1;let c=typeof t.error=="function"?await t.error(l):t.error,u=typeof t.description=="function"?await t.description(l):t.description;this.create({id:n,type:"error",message:c,description:u})}}).finally(()=>{var l;i&&(this.dismiss(n),n=void 0),(l=t.finally)==null||l.call(t)}),a=()=>new Promise((l,c)=>s.then(()=>o[0]==="reject"?c(o[1]):l(o[1])).catch(c));return typeof n!="string"&&typeof n!="number"?{unwrap:a}:Object.assign(n,{unwrap:a})},this.custom=(e,t)=>{let n=(t==null?void 0:t.id)||u_++;return this.create({jsx:e(n),id:n,...t}),n},this.subscribers=[],this.toasts=[]}},Mi=new Lve,Fve=(e,t)=>{let n=(t==null?void 0:t.id)||u_++;return Mi.addToast({title:e,...t,id:n}),n},jve=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",$ve=Fve,zve=()=>Mi.toasts,E7=Object.assign($ve,{success:Mi.success,info:Mi.info,warning:Mi.warning,error:Mi.error,custom:Mi.custom,message:Mi.message,promise:Mi.promise,dismiss:Mi.dismiss,loading:Mi.loading},{getHistory:zve});function Bve(e,{insertAt:t}={}){if(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))}Bve(`: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;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-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;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}[data-sonner-toast] [data-close-button]{background:var(--gray1)}: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:-50%;right:-50%;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-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);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-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--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-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[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%)}
331
331
  `);function Nm(e){return e.label!==void 0}var Hve=3,Vve="32px",Wve="16px",dI=4e3,Uve=356,Gve=14,qve=20,Yve=200;function yo(...e){return e.filter(Boolean).join(" ")}function Kve(e){let[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}var Xve=e=>{var t,n,r,i,o,s,a,l,c,u,d;let{invert:p,toast:h,unstyled:m,interacting:b,setHeights:v,visibleToasts:x,heights:S,index:_,toasts:E,expanded:C,removeToast:M,defaultRichColors:O,closeButton:N,style:A,cancelButtonStyle:j,actionButtonStyle:F,className:$="",descriptionClassName:K="",duration:H,position:L,gap:W,loadingIcon:B,expandByDefault:U,classNames:Y,icons:I,closeButtonAriaLabel:Q="Close toast",pauseWhenPageIsHidden:G}=e,[D,ee]=P.useState(null),[q,oe]=P.useState(null),[J,Z]=P.useState(!1),[ae,ce]=P.useState(!1),[ge,ie]=P.useState(!1),[pe,de]=P.useState(!1),[Ee,De]=P.useState(!1),[$e,Te]=P.useState(0),[ze,yt]=P.useState(0),Mt=P.useRef(h.duration||H||dI),gn=P.useRef(null),Ot=P.useRef(null),cn=_===0,Jt=_+1<=x,fe=h.type,_e=h.dismissible!==!1,Be=h.className||"",Je=h.descriptionClassName||"",st=P.useMemo(()=>S.findIndex(Le=>Le.toastId===h.id)||0,[S,h.id]),Mn=P.useMemo(()=>{var Le;return(Le=h.closeButton)!=null?Le:N},[h.closeButton,N]),Ln=P.useMemo(()=>h.duration||H||dI,[h.duration,H]),En=P.useRef(0),rn=P.useRef(0),Fn=P.useRef(0),Zt=P.useRef(null),[tr,Yn]=L.split("-"),Vi=P.useMemo(()=>S.reduce((Le,vt,Bt)=>Bt>=st?Le:Le+vt.height,0),[S,st]),yr=Nve(),Lo=h.invert||p,vr=fe==="loading";rn.current=P.useMemo(()=>st*W+Vi,[st,Vi]),P.useEffect(()=>{Mt.current=Ln},[Ln]),P.useEffect(()=>{Z(!0)},[]),P.useEffect(()=>{let Le=Ot.current;if(Le){let vt=Le.getBoundingClientRect().height;return yt(vt),v(Bt=>[{toastId:h.id,height:vt,position:h.position},...Bt]),()=>v(Bt=>Bt.filter(Kn=>Kn.toastId!==h.id))}},[v,h.id]),P.useLayoutEffect(()=>{if(!J)return;let Le=Ot.current,vt=Le.style.height;Le.style.height="auto";let Bt=Le.getBoundingClientRect().height;Le.style.height=vt,yt(Bt),v(Kn=>Kn.find(Xn=>Xn.toastId===h.id)?Kn.map(Xn=>Xn.toastId===h.id?{...Xn,height:Bt}:Xn):[{toastId:h.id,height:Bt,position:h.position},...Kn])},[J,h.title,h.description,v,h.id]);let kr=P.useCallback(()=>{ce(!0),Te(rn.current),v(Le=>Le.filter(vt=>vt.toastId!==h.id)),setTimeout(()=>{M(h)},Yve)},[h,M,v,rn]);P.useEffect(()=>{if(h.promise&&fe==="loading"||h.duration===1/0||h.type==="loading")return;let Le;return C||b||G&&yr?(()=>{if(Fn.current<En.current){let vt=new Date().getTime()-En.current;Mt.current=Mt.current-vt}Fn.current=new Date().getTime()})():Mt.current!==1/0&&(En.current=new Date().getTime(),Le=setTimeout(()=>{var vt;(vt=h.onAutoClose)==null||vt.call(h,h),kr()},Mt.current)),()=>clearTimeout(Le)},[C,b,h,fe,G,yr,kr]),P.useEffect(()=>{h.delete&&kr()},[kr,h.delete]);function al(){var Le,vt,Bt;return I!=null&&I.loading?P.createElement("div",{className:yo(Y==null?void 0:Y.loader,(Le=h==null?void 0:h.classNames)==null?void 0:Le.loader,"sonner-loader"),"data-visible":fe==="loading"},I.loading):B?P.createElement("div",{className:yo(Y==null?void 0:Y.loader,(vt=h==null?void 0:h.classNames)==null?void 0:vt.loader,"sonner-loader"),"data-visible":fe==="loading"},B):P.createElement(Mve,{className:yo(Y==null?void 0:Y.loader,(Bt=h==null?void 0:h.classNames)==null?void 0:Bt.loader),visible:fe==="loading"})}return P.createElement("li",{tabIndex:0,ref:Ot,className:yo($,Be,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[fe],(n=h==null?void 0:h.classNames)==null?void 0:n[fe]),"data-sonner-toast":"","data-rich-colors":(r=h.richColors)!=null?r:O,"data-styled":!(h.jsx||h.unstyled||m),"data-mounted":J,"data-promise":!!h.promise,"data-swiped":Ee,"data-removed":ae,"data-visible":Jt,"data-y-position":tr,"data-x-position":Yn,"data-index":_,"data-front":cn,"data-swiping":ge,"data-dismissible":_e,"data-type":fe,"data-invert":Lo,"data-swipe-out":pe,"data-swipe-direction":q,"data-expanded":!!(C||U&&J),style:{"--index":_,"--toasts-before":_,"--z-index":E.length-_,"--offset":`${ae?$e:rn.current}px`,"--initial-height":U?"auto":`${ze}px`,...A,...h.style},onPointerDown:Le=>{vr||!_e||(gn.current=new Date,Te(rn.current),Le.target.setPointerCapture(Le.pointerId),Le.target.tagName!=="BUTTON"&&(ie(!0),Zt.current={x:Le.clientX,y:Le.clientY}))},onPointerUp:()=>{var Le,vt,Bt,Kn;if(pe||!_e)return;Zt.current=null;let Xn=Number(((Le=Ot.current)==null?void 0:Le.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Nr=Number(((vt=Ot.current)==null?void 0:vt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),ur=new Date().getTime()-((Bt=gn.current)==null?void 0:Bt.getTime()),nr=D==="x"?Xn:Nr,mn=Math.abs(nr)/ur;if(Math.abs(nr)>=qve||mn>.11){Te(rn.current),(Kn=h.onDismiss)==null||Kn.call(h,h),oe(D==="x"?Xn>0?"right":"left":Nr>0?"down":"up"),kr(),de(!0),De(!1);return}ie(!1),ee(null)},onPointerMove:Le=>{var vt,Bt,Kn,Xn;if(!Zt.current||!_e||((vt=window.getSelection())==null?void 0:vt.toString().length)>0)return;let Nr=Le.clientY-Zt.current.y,ur=Le.clientX-Zt.current.x,nr=(Bt=e.swipeDirections)!=null?Bt:Kve(L);!D&&(Math.abs(ur)>1||Math.abs(Nr)>1)&&ee(Math.abs(ur)>Math.abs(Nr)?"x":"y");let mn={x:0,y:0};D==="y"?(nr.includes("top")||nr.includes("bottom"))&&(nr.includes("top")&&Nr<0||nr.includes("bottom")&&Nr>0)&&(mn.y=Nr):D==="x"&&(nr.includes("left")||nr.includes("right"))&&(nr.includes("left")&&ur<0||nr.includes("right")&&ur>0)&&(mn.x=ur),(Math.abs(mn.x)>0||Math.abs(mn.y)>0)&&De(!0),(Kn=Ot.current)==null||Kn.style.setProperty("--swipe-amount-x",`${mn.x}px`),(Xn=Ot.current)==null||Xn.style.setProperty("--swipe-amount-y",`${mn.y}px`)}},Mn&&!h.jsx?P.createElement("button",{"aria-label":Q,"data-disabled":vr,"data-close-button":!0,onClick:vr||!_e?()=>{}:()=>{var Le;kr(),(Le=h.onDismiss)==null||Le.call(h,h)},className:yo(Y==null?void 0:Y.closeButton,(i=h==null?void 0:h.classNames)==null?void 0:i.closeButton)},(o=I==null?void 0:I.close)!=null?o:kve):null,h.jsx||P.isValidElement(h.title)?h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title:P.createElement(P.Fragment,null,fe||h.icon||h.promise?P.createElement("div",{"data-icon":"",className:yo(Y==null?void 0:Y.icon,(s=h==null?void 0:h.classNames)==null?void 0:s.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||al():null,h.type!=="loading"?h.icon||(I==null?void 0:I[fe])||Pve(fe):null):null,P.createElement("div",{"data-content":"",className:yo(Y==null?void 0:Y.content,(a=h==null?void 0:h.classNames)==null?void 0:a.content)},P.createElement("div",{"data-title":"",className:yo(Y==null?void 0:Y.title,(l=h==null?void 0:h.classNames)==null?void 0:l.title)},typeof h.title=="function"?h.title():h.title),h.description?P.createElement("div",{"data-description":"",className:yo(K,Je,Y==null?void 0:Y.description,(c=h==null?void 0:h.classNames)==null?void 0:c.description)},typeof h.description=="function"?h.description():h.description):null),P.isValidElement(h.cancel)?h.cancel:h.cancel&&Nm(h.cancel)?P.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||j,onClick:Le=>{var vt,Bt;Nm(h.cancel)&&_e&&((Bt=(vt=h.cancel).onClick)==null||Bt.call(vt,Le),kr())},className:yo(Y==null?void 0:Y.cancelButton,(u=h==null?void 0:h.classNames)==null?void 0:u.cancelButton)},h.cancel.label):null,P.isValidElement(h.action)?h.action:h.action&&Nm(h.action)?P.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||F,onClick:Le=>{var vt,Bt;Nm(h.action)&&((Bt=(vt=h.action).onClick)==null||Bt.call(vt,Le),!Le.defaultPrevented&&kr())},className:yo(Y==null?void 0:Y.actionButton,(d=h==null?void 0:h.classNames)==null?void 0:d.actionButton)},h.action.label):null))};function fI(){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}function Qve(e,t){let n={};return[e,t].forEach((r,i)=>{let o=i===1,s=o?"--mobile-offset":"--offset",a=o?Wve:Vve;function l(c){["top","right","bottom","left"].forEach(u=>{n[`${s}-${u}`]=typeof c=="number"?`${c}px`:c})}typeof r=="number"||typeof r=="string"?l(r):typeof r=="object"?["top","right","bottom","left"].forEach(c=>{r[c]===void 0?n[`${s}-${c}`]=a:n[`${s}-${c}`]=typeof r[c]=="number"?`${r[c]}px`:r[c]}):l(a)}),n}var Jve=P.forwardRef(function(e,t){let{invert:n,position:r="bottom-right",hotkey:i=["altKey","KeyT"],expand:o,closeButton:s,className:a,offset:l,mobileOffset:c,theme:u="light",richColors:d,duration:p,style:h,visibleToasts:m=Hve,toastOptions:b,dir:v=fI(),gap:x=Gve,loadingIcon:S,icons:_,containerAriaLabel:E="Notifications",pauseWhenPageIsHidden:C}=e,[M,O]=P.useState([]),N=P.useMemo(()=>Array.from(new Set([r].concat(M.filter(G=>G.position).map(G=>G.position)))),[M,r]),[A,j]=P.useState([]),[F,$]=P.useState(!1),[K,H]=P.useState(!1),[L,W]=P.useState(u!=="system"?u:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),B=P.useRef(null),U=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),Y=P.useRef(null),I=P.useRef(!1),Q=P.useCallback(G=>{O(D=>{var ee;return(ee=D.find(q=>q.id===G.id))!=null&&ee.delete||Mi.dismiss(G.id),D.filter(({id:q})=>q!==G.id)})},[]);return P.useEffect(()=>Mi.subscribe(G=>{if(G.dismiss){O(D=>D.map(ee=>ee.id===G.id?{...ee,delete:!0}:ee));return}setTimeout(()=>{Tr.flushSync(()=>{O(D=>{let ee=D.findIndex(q=>q.id===G.id);return ee!==-1?[...D.slice(0,ee),{...D[ee],...G},...D.slice(ee+1)]:[G,...D]})})})}),[]),P.useEffect(()=>{if(u!=="system"){W(u);return}if(u==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?W("dark"):W("light")),typeof window>"u")return;let G=window.matchMedia("(prefers-color-scheme: dark)");try{G.addEventListener("change",({matches:D})=>{W(D?"dark":"light")})}catch{G.addListener(({matches:ee})=>{try{W(ee?"dark":"light")}catch(q){console.error(q)}})}},[u]),P.useEffect(()=>{M.length<=1&&$(!1)},[M]),P.useEffect(()=>{let G=D=>{var ee,q;i.every(oe=>D[oe]||D.code===oe)&&($(!0),(ee=B.current)==null||ee.focus()),D.code==="Escape"&&(document.activeElement===B.current||(q=B.current)!=null&&q.contains(document.activeElement))&&$(!1)};return document.addEventListener("keydown",G),()=>document.removeEventListener("keydown",G)},[i]),P.useEffect(()=>{if(B.current)return()=>{Y.current&&(Y.current.focus({preventScroll:!0}),Y.current=null,I.current=!1)}},[B.current]),P.createElement("section",{ref:t,"aria-label":`${E} ${U}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},N.map((G,D)=>{var ee;let[q,oe]=G.split("-");return M.length?P.createElement("ol",{key:G,dir:v==="auto"?fI():v,tabIndex:-1,ref:B,className:a,"data-sonner-toaster":!0,"data-theme":L,"data-y-position":q,"data-lifted":F&&M.length>1&&!o,"data-x-position":oe,style:{"--front-toast-height":`${((ee=A[0])==null?void 0:ee.height)||0}px`,"--width":`${Uve}px`,"--gap":`${x}px`,...h,...Qve(l,c)},onBlur:J=>{I.current&&!J.currentTarget.contains(J.relatedTarget)&&(I.current=!1,Y.current&&(Y.current.focus({preventScroll:!0}),Y.current=null))},onFocus:J=>{J.target instanceof HTMLElement&&J.target.dataset.dismissible==="false"||I.current||(I.current=!0,Y.current=J.relatedTarget)},onMouseEnter:()=>$(!0),onMouseMove:()=>$(!0),onMouseLeave:()=>{K||$(!1)},onPointerDown:J=>{J.target instanceof HTMLElement&&J.target.dataset.dismissible==="false"||H(!0)},onPointerUp:()=>H(!1)},M.filter(J=>!J.position&&D===0||J.position===G).map((J,Z)=>{var ae,ce;return P.createElement(Xve,{key:J.id,icons:_,index:Z,toast:J,defaultRichColors:d,duration:(ae=b==null?void 0:b.duration)!=null?ae:p,className:b==null?void 0:b.className,descriptionClassName:b==null?void 0:b.descriptionClassName,invert:n,visibleToasts:m,closeButton:(ce=b==null?void 0:b.closeButton)!=null?ce:s,interacting:K,position:G,style:b==null?void 0:b.style,unstyled:b==null?void 0:b.unstyled,classNames:b==null?void 0:b.classNames,cancelButtonStyle:b==null?void 0:b.cancelButtonStyle,actionButtonStyle:b==null?void 0:b.actionButtonStyle,removeToast:Q,toasts:M.filter(ge=>ge.position==J.position),heights:A.filter(ge=>ge.position==J.position),setHeights:j,expandByDefault:o,gap:x,loadingIcon:S,expanded:F,pauseWhenPageIsHidden:C,swipeDirections:e.swipeDirections})})):null}))});function Zve(){const{getSelectedFrame:e,addFrame:t,setSelectedFrameId:n}=lr(),r=ve(l=>l.dashboard.sheets),o=ve(l=>l.selectedSheetId)??(r==null?void 0:r[0].id),s=ve(l=>l.isDashboardEditing),a=ve(l=>l.isVisualEditing);P.useEffect(()=>{if(!s||a)return;async function l(d){const p=d.ctrlKey||d.metaKey;p&&d.key==="c"?(await c(),E7.success("Card copied to clipboard"),d.preventDefault()):p&&d.key==="v"&&(await u(),d.preventDefault())}async function c(){try{const d=e();d&&await navigator.clipboard.writeText(JSON.stringify(d))}catch(d){console.error("Failed to copy text:",d)}}async function u(){if(!o)return null;try{const d=await navigator.clipboard.readText();try{const p=JSON.parse(d);if(p&&p.id){p.id=Va();const h=p.activeCardId;p.cards.forEach(m=>{const b=m.id;m.id=Va(),b===h&&(p.activeCardId=m.id,m.title=`${m.title} (Copy)`)}),t(o,p),n(p.id)}}catch(p){console.error("Failed to parse clipboard contents: ",p)}return d}catch(d){return console.error("Failed to paste text:",d),null}}return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,e,n,o,s,a])}const exe=HM.WidthProvider(HM.Responsive);function txe({sheet:e}){var m;const t=ve(b=>b.isDashboardEditing);ve(b=>b.currentBreakpoint);const n=ve(b=>b.themeStyle);P.useState([]);const r=ve(b=>b.selectedSheetId);ve(b=>b.selectedLensId);const i=e.layouts,o=ve(b=>b.dashboard.filters),s=e.frames,{setSheetLayouts:a,setCurrentBreakpoint:l}=ve(b=>b.actions);Zve();function c(b){l(b)}function u(b,v){r===e.id&&a(r,v)}if(!r)return null;const d=(b,v)=>y.jsx(R7,{className:"after:content-none",ref:v,handleAxis:b});function p(){const b=o==null?void 0:o.filter(v=>v.sheetId===r||!v.sheetId);return b==null?void 0:b.map(v=>{var x,S;return v.location==="frame"?null:y.jsxs("div",{style:{borderRadius:(S=(x=n==null?void 0:n.chart)==null?void 0:x.options)==null?void 0:S.borderRadius},className:be("z-50 flex flex-col rounded-md border bg-background px-3 py-2"),children:[y.jsx(C7,{filter:v}),y.jsx(SR,{filter:v})]},v.id)})}function h(){return s==null?void 0:s.map(b=>y.jsx("div",{role:"dashboard-frame-container",className:be("group isolate overflow-hidden",n==null?void 0:n.dashboardCardContainer),children:y.jsx(Yy,{FallbackComponent:({error:v,resetErrorBoundary:x})=>y.jsx(pee,{error:v,resetErrorBoundary:x,frame:b}),children:y.jsx(_ve,{frame:b})})},b.id))}return y.jsx(y.Fragment,{children:y.jsxs(exe,{margin:[10,10],isDraggable:t,resizeHandles:t?["sw","nw","ne","se","e","w"]:[],className:be((m=n==null?void 0:n.gridLayout)==null?void 0:m.className),layouts:i,cols:{lg:48,md:36,sm:24,xs:12,xxs:6},rowHeight:1,onBreakpointChange:c,onLayoutChange:u,resizeHandle:d,children:[p(),h()]})})}const R7=P.forwardRef(({className:e,handleAxis:t,...n},r)=>(ve(i=>i.themeStyle),y.jsx("div",{ref:r,className:be(`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})));R7.displayName="ResizeHandle";var P7="vercel.ai.error",nxe=Symbol.for(P7),T7,rxe=class M7 extends Error{constructor({name:t,message:n,cause:r}){super(n),this[T7]=!0,this.name=t,this.cause=r}static isInstance(t){return M7.hasMarker(t,P7)}static hasMarker(t,n){const r=Symbol.for(n);return t!=null&&typeof t=="object"&&r in t&&typeof t[r]=="boolean"&&t[r]===!0}};T7=nxe;var vd=rxe;function O7(e){return e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e)}var D7="AI_InvalidArgumentError",A7=`vercel.ai.error.${D7}`,ixe=Symbol.for(A7),I7,oxe=class extends vd{constructor({message:e,cause:t,argument:n}){super({name:D7,message:e,cause:t}),this[I7]=!0,this.argument=n}static isInstance(e){return vd.hasMarker(e,A7)}};I7=ixe;var k7="AI_JSONParseError",N7=`vercel.ai.error.${k7}`,sxe=Symbol.for(N7),L7,hI=class extends vd{constructor({text:e,cause:t}){super({name:k7,message:`JSON parsing failed: Text: ${e}.
332
332
  Error message: ${O7(t)}`,cause:t}),this[L7]=!0,this.text=e}static isInstance(e){return vd.hasMarker(e,N7)}};L7=sxe;var F7="AI_TypeValidationError",j7=`vercel.ai.error.${F7}`,axe=Symbol.for(j7),$7,lxe=class d_ extends vd{constructor({value:t,cause:n}){super({name:F7,message:`Type validation failed: Value: ${JSON.stringify(t)}.
333
333
  Error message: ${O7(n)}`,cause:n}),this[$7]=!0,this.value=t}static isInstance(t){return vd.hasMarker(t,j7)}static wrap({value:t,cause:n}){return d_.isInstance(n)&&n.value===t?n:new d_({value:t,cause:n})}};$7=axe;var pI=lxe;let cxe=(e,t=21)=>(n=t)=>{let r="",i=n|0;for(;i--;)r+=e[Math.random()*e.length|0];return r};var Ld={exports:{}};const uxe=typeof Buffer<"u",gI=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,mI=/"(?: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 z7(e,t,n){n==null&&t!==null&&typeof t=="object"&&(n=t,t=void 0),uxe&&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 i=n&&n.protoAction||"error",o=n&&n.constructorAction||"error";if(i==="ignore"&&o==="ignore")return r;if(i!=="ignore"&&o!=="ignore"){if(gI.test(e)===!1&&mI.test(e)===!1)return r}else if(i!=="ignore"&&o==="ignore"){if(gI.test(e)===!1)return r}else if(mI.test(e)===!1)return r;return B7(r,{protoAction:i,constructorAction:o,safe:n&&n.safe})}function B7(e,{protoAction:t="error",constructorAction:n="error",safe:r}={}){let i=[e];for(;i.length;){const o=i;i=[];for(const s of o){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"&&i.push(l)}}}return e}function CR(e,t,n){const r=Error.stackTraceLimit;Error.stackTraceLimit=0;try{return z7(e,t,n)}finally{Error.stackTraceLimit=r}}function dxe(e,t){const n=Error.stackTraceLimit;Error.stackTraceLimit=0;try{return z7(e,t,{safe:!0})}catch{return null}finally{Error.stackTraceLimit=n}}Ld.exports=CR;Ld.exports.default=CR;Ld.exports.parse=CR;Ld.exports.safeParse=dxe;Ld.exports.scan=B7;var fxe=Ld.exports;const hxe=Tc(fxe);var pxe=({prefix:e,size:t=16,alphabet:n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:r="-"}={})=>{const i=cxe(n,t);if(e==null)return i;if(n.includes(r))throw new oxe({argument:"separator",message:`The separator "${r}" must not be part of the alphabet "${n}".`});return o=>`${e}${r}${i(o)}`},H7=pxe(),f_=Symbol.for("vercel.ai.validator");function gxe(e){return{[f_]:!0,validate:e}}function mxe(e){return typeof e=="object"&&e!==null&&f_ in e&&e[f_]===!0&&"validate"in e}function bxe(e){return mxe(e)?e:yxe(e)}function yxe(e){return gxe(t=>{const n=e.safeParse(t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}})}function vxe({value:e,schema:t}){const n=bxe(t);try{if(n.validate==null)return{success:!0,value:e};const r=n.validate(e);return r.success?r:{success:!1,error:pI.wrap({value:e,cause:r.error})}}catch(r){return{success:!1,error:pI.wrap({value:e,cause:r})}}}function bI({text:e,schema:t}){try{const n=hxe.parse(e);return t==null?{success:!0,value:n}:vxe({value:n,schema:t})}catch(n){return{success:!1,error:hI.isInstance(n)?n:new hI({text:e,cause:n})}}}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");var $h={code:"0",name:"text",parse:e=>{if(typeof e!="string")throw new Error('"text" parts expect a string value.');return{type:"text",value:e}}},zh={code:"3",name:"error",parse:e=>{if(typeof e!="string")throw new Error('"error" parts expect a string value.');return{type:"error",value:e}}},Bh={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}}},Hh={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}}}},Vh={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}}},xxe=[$h,zh,Bh,Hh,Vh];$h.code+"",zh.code+"",Bh.code+"",Hh.code+"",Vh.code+"";$h.name+"",$h.code,zh.name+"",zh.code,Bh.name+"",Bh.code,Hh.name+"",Hh.code,Vh.name+"",Vh.code;xxe.map(e=>e.code);function wxe(e){const t=["ROOT"];let n=-1,r=null;function i(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 o(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":i(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":{i(c,l,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{o(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,i(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":{i(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"&&o(c,l);break}case"}":{t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&o(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 d=e.substring(r,l+1);!"false".startsWith(d)&&!"true".startsWith(d)&&!"null".startsWith(d)?(t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?o(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 Sxe(e){if(e===void 0)return{value:void 0,state:"undefined-input"};let t=bI({text:e});return t.success?{value:t.value,state:"successful-parse"}:(t=bI({text:wxe(e)}),t.success?{value:t.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var Wh={code:"0",name:"text",parse:e=>{if(typeof e!="string")throw new Error('"text" parts expect a string value.');return{type:"text",value:e}}},Uh={code:"2",name:"data",parse:e=>{if(!Array.isArray(e))throw new Error('"data" parts expect an array value.');return{type:"data",value:e}}},Gh={code:"3",name:"error",parse:e=>{if(typeof e!="string")throw new Error('"error" parts expect a string value.');return{type:"error",value:e}}},qh={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}}},Yh={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}}},Kh={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}}},Xh={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}}},Qh={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}}},Jh={code:"d",name:"finish_message",parse:e=>{if(e==null||typeof e!="object"||!("finishReason"in e)||typeof e.finishReason!="string")throw new Error('"finish_message" parts expect an object with a "finishReason" property.');const t={finishReason:e.finishReason};return"usage"in e&&e.usage!=null&&typeof e.usage=="object"&&"promptTokens"in e.usage&&"completionTokens"in e.usage&&(t.usage={promptTokens:typeof e.usage.promptTokens=="number"?e.usage.promptTokens:Number.NaN,completionTokens:typeof e.usage.completionTokens=="number"?e.usage.completionTokens:Number.NaN}),{type:"finish_message",value:t}}},Zh={code:"e",name:"finish_step",parse:e=>{if(e==null||typeof e!="object"||!("finishReason"in e)||typeof e.finishReason!="string")throw new Error('"finish_step" parts expect an object with a "finishReason" property.');const t={finishReason:e.finishReason,isContinued:!1};return"usage"in e&&e.usage!=null&&typeof e.usage=="object"&&"promptTokens"in e.usage&&"completionTokens"in e.usage&&(t.usage={promptTokens:typeof e.usage.promptTokens=="number"?e.usage.promptTokens:Number.NaN,completionTokens:typeof e.usage.completionTokens=="number"?e.usage.completionTokens:Number.NaN}),"isContinued"in e&&typeof e.isContinued=="boolean"&&(t.isContinued=e.isContinued),{type:"finish_step",value:t}}},ep={code:"f",name:"start_step",parse:e=>{if(e==null||typeof e!="object"||!("messageId"in e)||typeof e.messageId!="string")throw new Error('"start_step" parts expect an object with an "id" property.');return{type:"start_step",value:{messageId:e.messageId}}}},_xe=[Wh,Uh,Gh,qh,Yh,Kh,Xh,Qh,Jh,Zh,ep],Cxe={[Wh.code]:Wh,[Uh.code]:Uh,[Gh.code]:Gh,[qh.code]:qh,[Yh.code]:Yh,[Kh.code]:Kh,[Xh.code]:Xh,[Qh.code]:Qh,[Jh.code]:Jh,[Zh.code]:Zh,[ep.code]:ep};Wh.name+"",Wh.code,Uh.name+"",Uh.code,Gh.name+"",Gh.code,qh.name+"",qh.code,Yh.name+"",Yh.code,Kh.name+"",Kh.code,Xh.name+"",Xh.code,Qh.name+"",Qh.code,Jh.name+"",Jh.code,Zh.name+"",Zh.code,ep.name+"",ep.code;var Exe=_xe.map(e=>e.code),Rxe=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(!Exe.includes(n))throw new Error(`Failed to parse stream string. Invalid code ${n}.`);const r=n,i=e.slice(t+1),o=JSON.parse(i);return Cxe[r].parse(o)},Pxe=10;function Txe(e,t){const n=new Uint8Array(t);let r=0;for(const i of e)n.set(i,r),r+=i.length;return e.length=0,n}async function Mxe({stream:e,onTextPart:t,onDataPart:n,onErrorPart:r,onToolCallStreamingStartPart:i,onToolCallDeltaPart:o,onToolCallPart:s,onToolResultPart:a,onMessageAnnotationsPart:l,onFinishMessagePart:c,onFinishStepPart:u,onStartStepPart:d}){const p=e.getReader(),h=new TextDecoder,m=[];let b=0;for(;;){const{value:v}=await p.read();if(v&&(m.push(v),b+=v.length,v[v.length-1]!==Pxe))continue;if(m.length===0)break;const x=Txe(m,b);b=0;const S=h.decode(x,{stream:!0}).split(`