react-semaphor 0.0.364 → 0.0.366
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{index-M934lYN-.js → index-0sZ1-IXK.js} +2 -2
- package/dist/chunks/{index-BdIy27IM.js → index-B0y-9ayw.js} +11 -6
- package/dist/chunks/{index-B48hv_2G.js → index-DMKp0FF7.js} +1223 -1209
- package/dist/chunks/index-ckeXgCi_.js +181 -0
- package/dist/chunks/{lucide-react-69gCJpeX.js → lucide-react-Ch7fAUq1.js} +3 -3
- package/dist/chunks/{lucide-react-CN5Da4Em.js → lucide-react-Cui-03tX.js} +1 -1
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +13 -12
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +1 -1
- package/dist/types/main.d.ts +4 -0
- package/package.json +1 -1
- package/dist/chunks/index--KqMl_wh.js +0 -181
|
@@ -88,7 +88,7 @@ __p += '`),Nt&&(Ce+=`' +
|
|
|
88
88
|
function print() { __p += __j.call(arguments, '') }
|
|
89
89
|
`:`;
|
|
90
90
|
`)+Ce+`return __p
|
|
91
|
-
}`;var yt=YT(function(){return qt(V,Ve+"return "+Ce).apply(n,Z)});if(yt.source=Ce,Qv(yt))throw yt;return yt}function Hq(f){return Qt(f).toLowerCase()}function Vq(f){return Qt(f).toUpperCase()}function Wq(f,g,S){if(f=Qt(f),f&&(S||g===n))return rP(f);if(!f||!(g=_i(g)))return f;var A=go(f),D=go(g),V=iP(A,D),Z=oP(A,D)+1;return ma(A,V,Z).join("")}function Uq(f,g,S){if(f=Qt(f),f&&(S||g===n))return f.slice(0,aP(f)+1);if(!f||!(g=_i(g)))return f;var A=go(f),D=oP(A,go(g))+1;return ma(A,0,D).join("")}function Gq(f,g,S){if(f=Qt(f),f&&(S||g===n))return f.replace(yn,"");if(!f||!(g=_i(g)))return f;var A=go(f),D=iP(A,go(g));return ma(A,D).join("")}function qq(f,g){var S=j,A=F;if(kn(g)){var D="separator"in g?g.separator:D;S="length"in g?ft(g.length):S,A="omission"in g?_i(g.omission):A}f=Qt(f);var V=f.length;if(Kc(f)){var Z=go(f);V=Z.length}if(S>=V)return f;var re=S-Xc(A);if(re<1)return A;var ue=Z?ma(Z,0,re).join(""):f.slice(0,re);if(D===n)return ue+A;if(Z&&(re+=ue.length-re),Zv(D)){if(f.slice(re).search(D)){var ve,we=ue;for(D.global||(D=pv(D.source,Qt(Bt.exec(D))+"g")),D.lastIndex=0;ve=D.exec(we);)var Ce=ve.index;ue=ue.slice(0,Ce===n?re:Ce)}}else if(f.indexOf(_i(D),re)!=re){var De=ue.lastIndexOf(D);De>-1&&(ue=ue.slice(0,De))}return ue+A}function Yq(f){return f=Qt(f),f&&Lr.test(f)?f.replace(Fo,_H):f}var Kq=ru(function(f,g,S){return f+(S?" ":"")+g.toUpperCase()}),tx=KP("toUpperCase");function qT(f,g,S){return f=Qt(f),g=S?n:g,g===n?yH(f)?RH(f):cH(f):f.match(g)||[]}var YT=_t(function(f,g){try{return wi(f,n,g)}catch(S){return Qv(S)?S:new st(S)}}),Xq=Ps(function(f,g){return Yi(g,function(S){S=zo(S),Es(f,S,Kv(f[S],f))}),f});function Qq(f){var g=f==null?0:f.length,S=Ue();return f=g?Tn(f,function(A){if(typeof A[1]!="function")throw new Ki(s);return[S(A[0]),A[1]]}):[],_t(function(A){for(var D=-1;++D<g;){var V=f[D];if(wi(V[0],this,A))return wi(V[1],this,A)}})}function Zq(f){return _V(Qi(f,d))}function nx(f){return function(){return f}}function Jq(f,g){return f==null||f!==f?g:f}var eY=QP(),tY=QP(!0);function ii(f){return f}function rx(f){return PP(typeof f=="function"?f:Qi(f,d))}function nY(f){return kP(Qi(f,d))}function rY(f,g){return AP(f,Qi(g,d))}var iY=_t(function(f,g){return function(S){return sf(S,f,g)}}),oY=_t(function(f,g){return function(S){return sf(f,S,g)}});function ix(f,g,S){var A=sr(g),D=pg(g,A);S==null&&!(kn(g)&&(D.length||!A.length))&&(S=g,g=f,f=this,D=pg(g,sr(g)));var V=!(kn(S)&&"chain"in S)||!!S.chain,Z=ks(f);return Yi(D,function(re){var ue=g[re];f[re]=ue,Z&&(f.prototype[re]=function(){var ve=this.__chain__;if(V||ve){var we=f(this.__wrapped__),Ce=we.__actions__=ti(this.__actions__);return Ce.push({func:ue,args:arguments,thisArg:f}),we.__chain__=ve,we}return ue.apply(f,ua([this.value()],arguments))})}),f}function sY(){return fr._===this&&(fr._=MH),this}function ox(){}function aY(f){return f=ft(f),_t(function(g){return OP(g,f)})}var lY=Lv(Tn),cY=Lv(Z2),uY=Lv(av);function KT(f){return Vv(f)?lv(zo(f)):zV(f)}function dY(f){return function(g){return f==null?n:bl(f,g)}}var fY=JP(),hY=JP(!0);function sx(){return[]}function ax(){return!1}function pY(){return{}}function gY(){return""}function mY(){return!0}function bY(f,g){if(f=ft(f),f<1||f>W)return[];var S=Y,A=Sr(f,Y);g=Ue(g),f-=Y;for(var D=dv(A,g);++S<f;)g(S);return D}function yY(f){return lt(f)?Tn(f,zo):Ci(f)?[f]:ti(gT(Qt(f)))}function vY(f){var g=++AH;return Qt(f)+g}var xY=xg(function(f,g){return f+g},0),wY=Fv("ceil"),SY=xg(function(f,g){return f/g},1),_Y=Fv("floor");function CY(f){return f&&f.length?hg(f,ii,Sv):n}function EY(f,g){return f&&f.length?hg(f,Ue(g,2),Sv):n}function RY(f){return tP(f,ii)}function PY(f,g){return tP(f,Ue(g,2))}function TY(f){return f&&f.length?hg(f,ii,Rv):n}function kY(f,g){return f&&f.length?hg(f,Ue(g,2),Rv):n}var AY=xg(function(f,g){return f*g},1),OY=Fv("round"),MY=xg(function(f,g){return f-g},0);function IY(f){return f&&f.length?uv(f,ii):0}function DY(f,g){return f&&f.length?uv(f,Ue(g,2)):0}return z.after=nG,z.ary=RT,z.assign=VG,z.assignIn=zT,z.assignInWith=Ig,z.assignWith=WG,z.at=UG,z.before=PT,z.bind=Kv,z.bindAll=Xq,z.bindKey=TT,z.castArray=pG,z.chain=_T,z.chunk=_W,z.compact=CW,z.concat=EW,z.cond=Qq,z.conforms=Zq,z.constant=nx,z.countBy=IU,z.create=GG,z.curry=kT,z.curryRight=AT,z.debounce=OT,z.defaults=qG,z.defaultsDeep=YG,z.defer=rG,z.delay=iG,z.difference=RW,z.differenceBy=PW,z.differenceWith=TW,z.drop=kW,z.dropRight=AW,z.dropRightWhile=OW,z.dropWhile=MW,z.fill=IW,z.filter=NU,z.flatMap=jU,z.flatMapDeep=$U,z.flatMapDepth=zU,z.flatten=vT,z.flattenDeep=DW,z.flattenDepth=NW,z.flip=oG,z.flow=eY,z.flowRight=tY,z.fromPairs=LW,z.functions=tq,z.functionsIn=nq,z.groupBy=BU,z.initial=jW,z.intersection=$W,z.intersectionBy=zW,z.intersectionWith=BW,z.invert=iq,z.invertBy=oq,z.invokeMap=VU,z.iteratee=rx,z.keyBy=WU,z.keys=sr,z.keysIn=ri,z.map=Pg,z.mapKeys=aq,z.mapValues=lq,z.matches=nY,z.matchesProperty=rY,z.memoize=kg,z.merge=cq,z.mergeWith=BT,z.method=iY,z.methodOf=oY,z.mixin=ix,z.negate=Ag,z.nthArg=aY,z.omit=uq,z.omitBy=dq,z.once=sG,z.orderBy=UU,z.over=lY,z.overArgs=aG,z.overEvery=cY,z.overSome=uY,z.partial=Xv,z.partialRight=MT,z.partition=GU,z.pick=fq,z.pickBy=HT,z.property=KT,z.propertyOf=dY,z.pull=UW,z.pullAll=wT,z.pullAllBy=GW,z.pullAllWith=qW,z.pullAt=YW,z.range=fY,z.rangeRight=hY,z.rearg=lG,z.reject=KU,z.remove=KW,z.rest=cG,z.reverse=qv,z.sampleSize=QU,z.set=pq,z.setWith=gq,z.shuffle=ZU,z.slice=XW,z.sortBy=tG,z.sortedUniq=rU,z.sortedUniqBy=iU,z.split=jq,z.spread=uG,z.tail=oU,z.take=sU,z.takeRight=aU,z.takeRightWhile=lU,z.takeWhile=cU,z.tap=CU,z.throttle=dG,z.thru=Rg,z.toArray=FT,z.toPairs=VT,z.toPairsIn=WT,z.toPath=yY,z.toPlainObject=$T,z.transform=mq,z.unary=fG,z.union=uU,z.unionBy=dU,z.unionWith=fU,z.uniq=hU,z.uniqBy=pU,z.uniqWith=gU,z.unset=bq,z.unzip=Yv,z.unzipWith=ST,z.update=yq,z.updateWith=vq,z.values=su,z.valuesIn=xq,z.without=mU,z.words=qT,z.wrap=hG,z.xor=bU,z.xorBy=yU,z.xorWith=vU,z.zip=xU,z.zipObject=wU,z.zipObjectDeep=SU,z.zipWith=_U,z.entries=VT,z.entriesIn=WT,z.extend=zT,z.extendWith=Ig,ix(z,z),z.add=xY,z.attempt=YT,z.camelCase=Cq,z.capitalize=UT,z.ceil=wY,z.clamp=wq,z.clone=gG,z.cloneDeep=bG,z.cloneDeepWith=yG,z.cloneWith=mG,z.conformsTo=vG,z.deburr=GT,z.defaultTo=Jq,z.divide=SY,z.endsWith=Eq,z.eq=bo,z.escape=Rq,z.escapeRegExp=Pq,z.every=DU,z.find=LU,z.findIndex=bT,z.findKey=KG,z.findLast=FU,z.findLastIndex=yT,z.findLastKey=XG,z.floor=_Y,z.forEach=CT,z.forEachRight=ET,z.forIn=QG,z.forInRight=ZG,z.forOwn=JG,z.forOwnRight=eq,z.get=Jv,z.gt=xG,z.gte=wG,z.has=rq,z.hasIn=ex,z.head=xT,z.identity=ii,z.includes=HU,z.indexOf=FW,z.inRange=Sq,z.invoke=sq,z.isArguments=xl,z.isArray=lt,z.isArrayBuffer=SG,z.isArrayLike=ni,z.isArrayLikeObject=zn,z.isBoolean=_G,z.isBuffer=ba,z.isDate=CG,z.isElement=EG,z.isEmpty=RG,z.isEqual=PG,z.isEqualWith=TG,z.isError=Qv,z.isFinite=kG,z.isFunction=ks,z.isInteger=IT,z.isLength=Og,z.isMap=DT,z.isMatch=AG,z.isMatchWith=OG,z.isNaN=MG,z.isNative=IG,z.isNil=NG,z.isNull=DG,z.isNumber=NT,z.isObject=kn,z.isObjectLike=Mn,z.isPlainObject=ff,z.isRegExp=Zv,z.isSafeInteger=LG,z.isSet=LT,z.isString=Mg,z.isSymbol=Ci,z.isTypedArray=ou,z.isUndefined=FG,z.isWeakMap=jG,z.isWeakSet=$G,z.join=HW,z.kebabCase=Tq,z.last=Ji,z.lastIndexOf=VW,z.lowerCase=kq,z.lowerFirst=Aq,z.lt=zG,z.lte=BG,z.max=CY,z.maxBy=EY,z.mean=RY,z.meanBy=PY,z.min=TY,z.minBy=kY,z.stubArray=sx,z.stubFalse=ax,z.stubObject=pY,z.stubString=gY,z.stubTrue=mY,z.multiply=AY,z.nth=WW,z.noConflict=sY,z.noop=ox,z.now=Tg,z.pad=Oq,z.padEnd=Mq,z.padStart=Iq,z.parseInt=Dq,z.random=_q,z.reduce=qU,z.reduceRight=YU,z.repeat=Nq,z.replace=Lq,z.result=hq,z.round=OY,z.runInContext=ce,z.sample=XU,z.size=JU,z.snakeCase=Fq,z.some=eG,z.sortedIndex=QW,z.sortedIndexBy=ZW,z.sortedIndexOf=JW,z.sortedLastIndex=eU,z.sortedLastIndexBy=tU,z.sortedLastIndexOf=nU,z.startCase=$q,z.startsWith=zq,z.subtract=MY,z.sum=IY,z.sumBy=DY,z.template=Bq,z.times=bY,z.toFinite=As,z.toInteger=ft,z.toLength=jT,z.toLower=Hq,z.toNumber=eo,z.toSafeInteger=HG,z.toString=Qt,z.toUpper=Vq,z.trim=Wq,z.trimEnd=Uq,z.trimStart=Gq,z.truncate=qq,z.unescape=Yq,z.uniqueId=vY,z.upperCase=Kq,z.upperFirst=tx,z.each=CT,z.eachRight=ET,z.first=xT,ix(z,function(){var f={};return jo(z,function(g,S){rn.call(z.prototype,S)||(f[S]=g)}),f}(),{chain:!1}),z.VERSION=r,Yi(["bind","bindKey","curry","curryRight","partial","partialRight"],function(f){z[f].placeholder=z}),Yi(["drop","take"],function(f,g){It.prototype[f]=function(S){S=S===n?1:er(ft(S),0);var A=this.__filtered__&&!g?new It(this):this.clone();return A.__filtered__?A.__takeCount__=Sr(S,A.__takeCount__):A.__views__.push({size:Sr(S,Y),type:f+(A.__dir__<0?"Right":"")}),A},It.prototype[f+"Right"]=function(S){return this.reverse()[f](S).reverse()}}),Yi(["filter","map","takeWhile"],function(f,g){var S=g+1,A=S==H||S==G;It.prototype[f]=function(D){var V=this.clone();return V.__iteratees__.push({iteratee:Ue(D,3),type:S}),V.__filtered__=V.__filtered__||A,V}}),Yi(["head","last"],function(f,g){var S="take"+(g?"Right":"");It.prototype[f]=function(){return this[S](1).value()[0]}}),Yi(["initial","tail"],function(f,g){var S="drop"+(g?"":"Right");It.prototype[f]=function(){return this.__filtered__?new It(this):this[S](1)}}),It.prototype.compact=function(){return this.filter(ii)},It.prototype.find=function(f){return this.filter(f).head()},It.prototype.findLast=function(f){return this.reverse().find(f)},It.prototype.invokeMap=_t(function(f,g){return typeof f=="function"?new It(this):this.map(function(S){return sf(S,f,g)})}),It.prototype.reject=function(f){return this.filter(Ag(Ue(f)))},It.prototype.slice=function(f,g){f=ft(f);var S=this;return S.__filtered__&&(f>0||g<0)?new It(S):(f<0?S=S.takeRight(-f):f&&(S=S.drop(f)),g!==n&&(g=ft(g),S=g<0?S.dropRight(-g):S.take(g-f)),S)},It.prototype.takeRightWhile=function(f){return this.reverse().takeWhile(f).reverse()},It.prototype.toArray=function(){return this.take(Y)},jo(It.prototype,function(f,g){var S=/^(?:filter|find|map|reject)|While$/.test(g),A=/^(?:head|last)$/.test(g),D=z[A?"take"+(g=="last"?"Right":""):g],V=A||/^find/.test(g);D&&(z.prototype[g]=function(){var Z=this.__wrapped__,re=A?[1]:arguments,ue=Z instanceof It,ve=re[0],we=ue||lt(Z),Ce=function(kt){var Nt=D.apply(z,ua([kt],re));return A&&De?Nt[0]:Nt};we&&S&&typeof ve=="function"&&ve.length!=1&&(ue=we=!1);var De=this.__chain__,Ve=!!this.__actions__.length,qe=V&&!De,yt=ue&&!Ve;if(!V&&we){Z=yt?Z:new It(this);var Ye=f.apply(Z,re);return Ye.__actions__.push({func:Rg,args:[Ce],thisArg:n}),new Xi(Ye,De)}return qe&&yt?f.apply(this,re):(Ye=this.thru(Ce),qe?A?Ye.value()[0]:Ye.value():Ye)})}),Yi(["pop","push","shift","sort","splice","unshift"],function(f){var g=Zp[f],S=/^(?:push|sort|unshift)$/.test(f)?"tap":"thru",A=/^(?:pop|shift)$/.test(f);z.prototype[f]=function(){var D=arguments;if(A&&!this.__chain__){var V=this.value();return g.apply(lt(V)?V:[],D)}return this[S](function(Z){return g.apply(lt(Z)?Z:[],D)})}}),jo(It.prototype,function(f,g){var S=z[g];if(S){var A=S.name+"";rn.call(eu,A)||(eu[A]=[]),eu[A].push({name:g,func:S})}}),eu[vg(n,x).name]=[{name:"wrapper",func:n}],It.prototype.clone=YH,It.prototype.reverse=KH,It.prototype.value=XH,z.prototype.at=EU,z.prototype.chain=RU,z.prototype.commit=PU,z.prototype.next=TU,z.prototype.plant=AU,z.prototype.reverse=OU,z.prototype.toJSON=z.prototype.valueOf=z.prototype.value=MU,z.prototype.first=z.prototype.head,Zd&&(z.prototype[Zd]=kU),z},Qc=PH();fl?((fl.exports=Qc)._=Qc,rv._=Qc):fr._=Qc}).call(Pa)})(hb,hb.exports);var zf=hb.exports;const tc=Ic(zf);function gk({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 K_.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 mk(e,t){if(!t)return;const n={...t};return K_.forEach(r=>{n[r]&&(n[r]=n[r].filter(i=>i.i!==e))}),n}function J_(e){return ye.getState().dashboard.globalCacheConfig}const ye=lN()(gN((e,t)=>({isSessionExpired:!1,currentBreakpoint:"lg",dashboard:{id:"",style:fb},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:fb},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(y=>y.id===b.filterId));r.filterValues=(c=r.filterValues)==null?void 0:c.filter(b=>!(m!=null&&m.some(y=>y.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=>{K_.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})},addToAIScope:n=>{e(r=>{const{connectionId:i,connectionType:o,databaseName:s,schemaName:a,tableName:l,datamodelName:c}=n,u={connectionId:i||"",connectionType:o||"",databaseName:s||"",schemaName:a||"",tableName:l||"",datamodelName:c||""};let p=[...r.dashboard.aiScopeTables||[],u];p=p.filter((h,m,b)=>b.findIndex(y=>y.tableName===h.tableName&&y.datamodelName===h.datamodelName)===m),r.dashboard.aiScopeTables=p})},removeFromAIScope:n=>{e(r=>{const{connectionId:i,tableName:o,datamodelName:s}=n,a=r.dashboard.aiScopeTables||[];if(s){const l=a.filter(c=>!(c.datamodelName===s&&c.connectionId===i));r.dashboard.aiScopeTables=l}else if(o){const l=a.filter(c=>!(c.tableName===o&&c.connectionId===i));r.dashboard.aiScopeTables=l}})},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&&zf.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&&zf.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&&zf.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&&zf.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})},removeFilterValues: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=>{gk({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=mk(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))}})},updateFilterId:(n,r)=>{e(i=>{var a,l;const o=(a=i.dashboard.filters)==null?void 0:a.find(c=>c.id===n),s=(l=i.dashboard.filters)==null?void 0:l.some(c=>c.id===r);o&&!s&&(o.id=r)})},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=gk({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),mk(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)=>{rX({card:n,dataPoint:r,set:e,get:t})}}}))),Vn=()=>ye(e=>e.actions);async function iX(e,t){const n=t.slice(0,16),r=new TextEncoder,i=await window.crypto.subtle.importKey("raw",r.encode(n),{name:"PBKDF2"},!1,["deriveKey"]),o=await window.crypto.subtle.deriveKey({name:"PBKDF2",salt:r.encode(n),iterations:1e5,hash:"SHA-256"},i,{name:"AES-GCM",length:256},!1,["encrypt"]),s=window.crypto.getRandomValues(new Uint8Array(12)),a=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:s},o,r.encode(e)),l=new Uint8Array(s.length+a.byteLength);return l.set(s,0),l.set(new Uint8Array(a),s.length),{payload:btoa(String.fromCharCode(...l))}}async function xN(e,t){const n=t.slice(0,16),r=new TextEncoder,i=new TextDecoder,o=await window.crypto.subtle.importKey("raw",r.encode(n),{name:"PBKDF2"},!1,["deriveKey"]),s=await window.crypto.subtle.deriveKey({name:"PBKDF2",salt:r.encode(n),iterations:1e5,hash:"SHA-256"},o,{name:"AES-GCM",length:256},!1,["decrypt"]),a=Uint8Array.from(atob(e),p=>p.charCodeAt(0)),l=a.slice(0,12),c=a.slice(a.length-16),u=a.slice(12,a.length-16),d=new Uint8Array(u.length+c.length);d.set(u),d.set(c,u.length);try{const p=await window.crypto.subtle.decrypt({name:"AES-GCM",iv:l},s,d);return{decryptedData:i.decode(p)}}catch(p){throw new Error(`Decryption failed: ${p}`)}}function be(...e){return bK(id(e))}const oX=e=>Object.keys(e).length===0;async function sX(e,t,n={}){try{const r=new URLSearchParams(n).toString(),i=`${e}?${r}`,o=await fetch(i,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});if(!o.ok){const a=await o.json();throw new Error((a==null?void 0:a.error)||`HTTP error! status: ${o.status}`)}return await o.json()}catch(r){throw console.error("Error during fetch:",r),r}}async function Cy(e,t,n={}){try{const r=JSON.stringify(n),i=await iX(r,t),o=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(i)});if(!o.ok)return o.json().then(a=>{throw console.log(a.detail||"Unknown error occurred"),new Error((a==null?void 0:a.error)||`HTTP error! status: ${o.status}`)});const s=await o.json();if(s.payload){const a=await xN(s.payload,t);return JSON.parse(a.decryptedData)}return s}catch(r){throw console.error("Error during fetch:",r),r}}function aX(e){if(!e)return{tenantId:"",endUserId:""};const t=H_(e);return{tenantId:t==null?void 0:t.tenantId,endUserId:t==null?void 0:t.endUserId}}function lX(e){if(!e)return;const t=H_(e);if(t.params&&t.params.currencyFormat)return t.params.currencyFormat}function wN(e){return e?H_(e).params:void 0}function cX(e){return e.charAt(0).toUpperCase()+e.slice(1)}const ih="focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0";async function uX(){var i,o;const e=(o=(i=ye.getState())==null?void 0:i.authToken)==null?void 0:o.accessToken;if(!e)return;const n=await fetch("https://semaphor.cloud/api/v1/invalidate-token",{method:"POST",headers:{Authorization:`Bearer ${e}`}});if(!n.ok)throw new Error("Failed to invalidate token");const r=await n.json();return console.log("invalidateToken",r),r}async function dX(e,t={}){if(!e)return null;let n="https://semaphor.cloud/api/v1/dashboard";const r=Object.fromEntries(Object.entries(t).filter(([a,l])=>l!==void 0)),i=new URLSearchParams(r).toString();i&&(n+=`?${i}`);let s=await(await fetch(n,{headers:{Authorization:`Bearer ${e}`}})).json();if("payload"in s){const a=await xN(atob(s.payload),e);s=JSON.parse(a.decryptedData)}return s}async function fX(e){return e?await(await fetch("https://semaphor.cloud/api/v1/plugins",{headers:{Authorization:`Bearer ${e}`}})).json():null}const hX={theme:"system",setTheme:()=>null},SN=k.createContext(hX);function pX({children:e,defaultTheme:t="system",storageKey:n="vite-ui-theme",...r}){const[i,o]=k.useState(()=>localStorage.getItem(n)||t);k.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 v.jsx(SN.Provider,{...r,value:s,children:e})}const _N=()=>{const e=k.useContext(SN);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e};var fp=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(){}},vc=typeof window>"u"||"Deno"in globalThis;function ro(){}function gX(e,t){return typeof e=="function"?e(t):e}function S1(e){return typeof e=="number"&&e>=0&&e!==1/0}function CN(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Mu(e,t){return typeof e=="function"?e(t):e}function Eo(e,t){return typeof e=="function"?e(t):e}function bk(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:o,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==eC(s,t.options))return!1}else if(!kh(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 yk(e,t){const{exact:n,status:r,predicate:i,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(Th(t.options.mutationKey)!==Th(o))return!1}else if(!kh(t.options.mutationKey,o))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function eC(e,t){return((t==null?void 0:t.queryKeyHashFn)||Th)(e)}function Th(e){return JSON.stringify(e,(t,n)=>E1(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function kh(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!kh(e[n],t[n])):!1}function _1(e,t){if(e===t)return e;const n=vk(e)&&vk(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 vk(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function E1(e){if(!xk(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!xk(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function xk(e){return Object.prototype.toString.call(e)==="[object Object]"}function mX(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 bX(e){return e}function yX(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function vX(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var pb=Symbol();function EN(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===pb&&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===pb?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var Yl,ka,Uu,GD,xX=(GD=class extends fp{constructor(){super();et(this,Yl);et(this,ka);et(this,Uu);ze(this,Uu,t=>{if(!vc&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){ae(this,ka)||this.setEventListener(ae(this,Uu))}onUnsubscribe(){var t;this.hasListeners()||((t=ae(this,ka))==null||t.call(this),ze(this,ka,void 0))}setEventListener(t){var n;ze(this,Uu,t),(n=ae(this,ka))==null||n.call(this),ze(this,ka,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){ae(this,Yl)!==t&&(ze(this,Yl,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof ae(this,Yl)=="boolean"?ae(this,Yl):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Yl=new WeakMap,ka=new WeakMap,Uu=new WeakMap,GD),tC=new xX,Gu,Aa,qu,qD,wX=(qD=class extends fp{constructor(){super();et(this,Gu,!0);et(this,Aa);et(this,qu);ze(this,qu,t=>{if(!vc&&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(){ae(this,Aa)||this.setEventListener(ae(this,qu))}onUnsubscribe(){var t;this.hasListeners()||((t=ae(this,Aa))==null||t.call(this),ze(this,Aa,void 0))}setEventListener(t){var n;ze(this,qu,t),(n=ae(this,Aa))==null||n.call(this),ze(this,Aa,t(this.setOnline.bind(this)))}setOnline(t){ae(this,Gu)!==t&&(ze(this,Gu,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return ae(this,Gu)}},Gu=new WeakMap,Aa=new WeakMap,qu=new WeakMap,qD),gb=new wX;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 SX(e){return Math.min(1e3*2**e,3e4)}function RN(e){return(e??"online")==="online"?gb.isOnline():!0}var PN=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function bx(e){return e instanceof PN}function TN(e){let t=!1,n=0,r=!1,i;const o=P1(),s=b=>{var y;r||(p(new PN(b)),(y=e.abort)==null||y.call(e))},a=()=>{t=!0},l=()=>{t=!1},c=()=>tC.isFocused()&&(e.networkMode==="always"||gb.isOnline())&&e.canRun(),u=()=>RN(e.networkMode)&&e.canRun(),d=b=>{var y;r||(r=!0,(y=e.onSuccess)==null||y.call(e,b),i==null||i(),o.resolve(b))},p=b=>{var y;r||(r=!0,(y=e.onError)==null||y.call(e,b),i==null||i(),o.reject(b))},h=()=>new Promise(b=>{var y;i=x=>{(r||c())&&b(x)},(y=e.onPause)==null||y.call(e)}).then(()=>{var b;i=void 0,r||(b=e.onContinue)==null||b.call(e)}),m=()=>{if(r)return;let b;const y=n===0?e.initialPromise:void 0;try{b=y??e.fn()}catch(x){b=Promise.reject(x)}Promise.resolve(b).then(d).catch(x=>{var R;if(r)return;const w=e.retry??(vc?0:3),_=e.retryDelay??SX,E=typeof _=="function"?_(n,x):_,C=w===!0||typeof w=="number"&&n<w||typeof w=="function"&&w(n,x);if(t||!C){p(x);return}n++,(R=e.onFail)==null||R.call(e,n,x),mX(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 _X(){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 mr=_X(),Kl,YD,kN=(YD=class{constructor(){et(this,Kl)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),S1(this.gcTime)&&ze(this,Kl,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(vc?1/0:5*60*1e3))}clearGcTimeout(){ae(this,Kl)&&(clearTimeout(ae(this,Kl)),ze(this,Kl,void 0))}},Kl=new WeakMap,YD),Yu,Ku,no,Pr,ap,Xl,_o,Ls,KD,CX=(KD=class extends kN{constructor(t){super();et(this,_o);et(this,Yu);et(this,Ku);et(this,no);et(this,Pr);et(this,ap);et(this,Xl);ze(this,Xl,!1),ze(this,ap,t.defaultOptions),this.setOptions(t.options),this.observers=[],ze(this,no,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ze(this,Yu,EX(this.options)),this.state=t.state??ae(this,Yu),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=ae(this,Pr))==null?void 0:t.promise}setOptions(t){this.options={...ae(this,ap),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&ae(this,no).remove(this)}setData(t,n){const r=R1(this.state.data,t,this.options);return Lt(this,_o,Ls).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){Lt(this,_o,Ls).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,i;const n=(r=ae(this,Pr))==null?void 0:r.promise;return(i=ae(this,Pr))==null||i.cancel(t),n?n.then(ro).catch(ro):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(ae(this,Yu))}isActive(){return this.observers.some(t=>Eo(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===pb||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||!CN(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=ae(this,Pr))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=ae(this,Pr))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),ae(this,no).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(ae(this,Pr)&&(ae(this,Xl)?ae(this,Pr).cancel({revert:!0}):ae(this,Pr).cancelRetry()),this.scheduleGc()),ae(this,no).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Lt(this,_o,Ls).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(ae(this,Pr))return ae(this,Pr).continueRetry(),ae(this,Pr).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:()=>(ze(this,Xl,!0),r.signal)})},o=()=>{const d=EN(this.options,n),p={queryKey:this.queryKey,meta:this.meta};return i(p),ze(this,Xl,!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),ze(this,Ku,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((c=s.fetchOptions)==null?void 0:c.meta))&&Lt(this,_o,Ls).call(this,{type:"fetch",meta:(u=s.fetchOptions)==null?void 0:u.meta});const a=d=>{var p,h,m,b;bx(d)&&d.silent||Lt(this,_o,Ls).call(this,{type:"error",error:d}),bx(d)||((h=(p=ae(this,no).config).onError)==null||h.call(p,d,this),(b=(m=ae(this,no).config).onSettled)==null||b.call(m,this.state.data,d,this)),this.scheduleGc()};return ze(this,Pr,TN({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(y){a(y);return}(h=(p=ae(this,no).config).onSuccess)==null||h.call(p,d,this),(b=(m=ae(this,no).config).onSettled)==null||b.call(m,d,this.state.error,this),this.scheduleGc()},onError:a,onFail:(d,p)=>{Lt(this,_o,Ls).call(this,{type:"failed",failureCount:d,error:p})},onPause:()=>{Lt(this,_o,Ls).call(this,{type:"pause"})},onContinue:()=>{Lt(this,_o,Ls).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),ae(this,Pr).start()}},Yu=new WeakMap,Ku=new WeakMap,no=new WeakMap,Pr=new WeakMap,ap=new WeakMap,Xl=new WeakMap,_o=new WeakSet,Ls=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,...AN(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 bx(i)&&i.revert&&ae(this,Ku)?{...ae(this,Ku),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),mr.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),ae(this,no).notify({query:this,type:"updated",action:t})})},KD);function AN(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:RN(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function EX(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 Go,XD,ON=(XD=class extends fp{constructor(t={}){super();et(this,Go);this.config=t,ze(this,Go,new Map)}build(t,n,r){const i=n.queryKey,o=n.queryHash??eC(i,n);let s=this.get(o);return s||(s=new CX({cache:this,queryKey:i,queryHash:o,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(i)}),this.add(s)),s}add(t){ae(this,Go).has(t.queryHash)||(ae(this,Go).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=ae(this,Go).get(t.queryHash);n&&(t.destroy(),n===t&&ae(this,Go).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){mr.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return ae(this,Go).get(t)}getAll(){return[...ae(this,Go).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>bk(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>bk(t,r)):n}notify(t){mr.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){mr.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){mr.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Go=new WeakMap,XD),qo,Vr,Ql,Yo,Ca,QD,RX=(QD=class extends kN{constructor(t){super();et(this,Yo);et(this,qo);et(this,Vr);et(this,Ql);this.mutationId=t.mutationId,ze(this,Vr,t.mutationCache),ze(this,qo,[]),this.state=t.state||PX(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){ae(this,qo).includes(t)||(ae(this,qo).push(t),this.clearGcTimeout(),ae(this,Vr).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ze(this,qo,ae(this,qo).filter(n=>n!==t)),this.scheduleGc(),ae(this,Vr).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){ae(this,qo).length||(this.state.status==="pending"?this.scheduleGc():ae(this,Vr).remove(this))}continue(){var t;return((t=ae(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,y,x,w,_,E,C,R,T;ze(this,Ql,TN({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(M,L)=>{Lt(this,Yo,Ca).call(this,{type:"failed",failureCount:M,error:L})},onPause:()=>{Lt(this,Yo,Ca).call(this,{type:"pause"})},onContinue:()=>{Lt(this,Yo,Ca).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>ae(this,Vr).canRun(this)}));const n=this.state.status==="pending",r=!ae(this,Ql).canStart();try{if(!n){Lt(this,Yo,Ca).call(this,{type:"pending",variables:t,isPaused:r}),await((o=(i=ae(this,Vr).config).onMutate)==null?void 0:o.call(i,t,this));const L=await((a=(s=this.options).onMutate)==null?void 0:a.call(s,t));L!==this.state.context&&Lt(this,Yo,Ca).call(this,{type:"pending",context:L,variables:t,isPaused:r})}const M=await ae(this,Ql).start();return await((c=(l=ae(this,Vr).config).onSuccess)==null?void 0:c.call(l,M,t,this.state.context,this)),await((d=(u=this.options).onSuccess)==null?void 0:d.call(u,M,t,this.state.context)),await((h=(p=ae(this,Vr).config).onSettled)==null?void 0:h.call(p,M,null,this.state.variables,this.state.context,this)),await((b=(m=this.options).onSettled)==null?void 0:b.call(m,M,null,t,this.state.context)),Lt(this,Yo,Ca).call(this,{type:"success",data:M}),M}catch(M){try{throw await((x=(y=ae(this,Vr).config).onError)==null?void 0:x.call(y,M,t,this.state.context,this)),await((_=(w=this.options).onError)==null?void 0:_.call(w,M,t,this.state.context)),await((C=(E=ae(this,Vr).config).onSettled)==null?void 0:C.call(E,void 0,M,this.state.variables,this.state.context,this)),await((T=(R=this.options).onSettled)==null?void 0:T.call(R,void 0,M,t,this.state.context)),M}finally{Lt(this,Yo,Ca).call(this,{type:"error",error:M})}}finally{ae(this,Vr).runNext(this)}}},qo=new WeakMap,Vr=new WeakMap,Ql=new WeakMap,Yo=new WeakSet,Ca=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),mr.batch(()=>{ae(this,qo).forEach(r=>{r.onMutationUpdate(t)}),ae(this,Vr).notify({mutation:this,type:"updated",action:t})})},QD);function PX(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Vs,Co,lp,ZD,TX=(ZD=class extends fp{constructor(t={}){super();et(this,Vs);et(this,Co);et(this,lp);this.config=t,ze(this,Vs,new Set),ze(this,Co,new Map),ze(this,lp,0)}build(t,n,r){const i=new RX({mutationCache:this,mutationId:++Dg(this,lp)._,options:t.defaultMutationOptions(n),state:r});return this.add(i),i}add(t){ae(this,Vs).add(t);const n=Fg(t);if(typeof n=="string"){const r=ae(this,Co).get(n);r?r.push(t):ae(this,Co).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(ae(this,Vs).delete(t)){const n=Fg(t);if(typeof n=="string"){const r=ae(this,Co).get(n);if(r)if(r.length>1){const i=r.indexOf(t);i!==-1&&r.splice(i,1)}else r[0]===t&&ae(this,Co).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Fg(t);if(typeof n=="string"){const r=ae(this,Co).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=Fg(t);if(typeof n=="string"){const i=(r=ae(this,Co).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(){mr.batch(()=>{ae(this,Vs).forEach(t=>{this.notify({type:"removed",mutation:t})}),ae(this,Vs).clear(),ae(this,Co).clear()})}getAll(){return Array.from(ae(this,Vs))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>yk(n,r))}findAll(t={}){return this.getAll().filter(n=>yk(t,n))}notify(t){mr.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return mr.batch(()=>Promise.all(t.map(n=>n.continue().catch(ro))))}},Vs=new WeakMap,Co=new WeakMap,lp=new WeakMap,ZD);function Fg(e){var t;return(t=e.options.scope)==null?void 0:t.id}function wk(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 y=_=>{Object.defineProperty(_,"signal",{enumerable:!0,get:()=>(t.signal.aborted?b=!0:t.signal.addEventListener("abort",()=>{b=!0}),t.signal)})},x=EN(t.options,t.fetchOptions),w=async(_,E,C)=>{if(b)return Promise.reject();if(E==null&&_.pages.length)return Promise.resolve(_);const R={queryKey:t.queryKey,pageParam:E,direction:C?"backward":"forward",meta:t.options.meta};y(R);const T=await x(R),{maxPages:M}=t.options,L=C?vX:yX;return{pages:L(_.pages,T,M),pageParams:L(_.pageParams,E,M)}};if(i&&o.length){const _=i==="backward",E=_?kX:Sk,C={pages:o,pageParams:s},R=E(r,C);a=await w(C,R,_)}else{const _=e??o.length;do{const E=l===0?s[0]??r.initialPageParam:Sk(r,a);if(l>0&&E==null)break;a=await w(a,E),l++}while(l<_)}return a};t.options.persister?t.fetchFn=()=>{var b,y;return(y=(b=t.options).persister)==null?void 0:y.call(b,c,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=c}}}function Sk(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 kX(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 In,Oa,Ma,Xu,Qu,Ia,Zu,Ju,JD,AX=(JD=class{constructor(e={}){et(this,In);et(this,Oa);et(this,Ma);et(this,Xu);et(this,Qu);et(this,Ia);et(this,Zu);et(this,Ju);ze(this,In,e.queryCache||new ON),ze(this,Oa,e.mutationCache||new TX),ze(this,Ma,e.defaultOptions||{}),ze(this,Xu,new Map),ze(this,Qu,new Map),ze(this,Ia,0)}mount(){Dg(this,Ia)._++,ae(this,Ia)===1&&(ze(this,Zu,tC.subscribe(async e=>{e&&(await this.resumePausedMutations(),ae(this,In).onFocus())})),ze(this,Ju,gb.subscribe(async e=>{e&&(await this.resumePausedMutations(),ae(this,In).onOnline())})))}unmount(){var e,t;Dg(this,Ia)._--,ae(this,Ia)===0&&((e=ae(this,Zu))==null||e.call(this),ze(this,Zu,void 0),(t=ae(this,Ju))==null||t.call(this),ze(this,Ju,void 0))}isFetching(e){return ae(this,In).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return ae(this,Oa).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=ae(this,In).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=ae(this,In).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Mu(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return ae(this,In).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=ae(this,In).get(r.queryHash),o=i==null?void 0:i.state.data,s=gX(t,o);if(s!==void 0)return ae(this,In).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return mr.batch(()=>ae(this,In).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=ae(this,In).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=ae(this,In);mr.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=ae(this,In),r={type:"active",...e};return mr.batch(()=>(n.findAll(e).forEach(i=>{i.reset()}),this.refetchQueries(r,t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=mr.batch(()=>ae(this,In).findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(ro).catch(ro)}invalidateQueries(e,t={}){return mr.batch(()=>{if(ae(this,In).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=mr.batch(()=>ae(this,In).findAll(e).filter(i=>!i.isDisabled()).map(i=>{let o=i.fetch(void 0,n);return n.throwOnError||(o=o.catch(ro)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(ro)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=ae(this,In).build(this,t);return n.isStaleByTime(Mu(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ro).catch(ro)}fetchInfiniteQuery(e){return e.behavior=wk(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ro).catch(ro)}ensureInfiniteQueryData(e){return e.behavior=wk(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return gb.isOnline()?ae(this,Oa).resumePausedMutations():Promise.resolve()}getQueryCache(){return ae(this,In)}getMutationCache(){return ae(this,Oa)}getDefaultOptions(){return ae(this,Ma)}setDefaultOptions(e){ze(this,Ma,e)}setQueryDefaults(e,t){ae(this,Xu).set(Th(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...ae(this,Xu).values()],n={};return t.forEach(r=>{kh(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){ae(this,Qu).set(Th(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...ae(this,Qu).values()];let n={};return t.forEach(r=>{kh(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...ae(this,Ma).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=eC(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===pb&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...ae(this,Ma).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){ae(this,In).clear(),ae(this,Oa).clear()}},In=new WeakMap,Oa=new WeakMap,Ma=new WeakMap,Xu=new WeakMap,Qu=new WeakMap,Ia=new WeakMap,Zu=new WeakMap,Ju=new WeakMap,JD),di,Ft,cp,Wr,Zl,ed,Da,Ko,up,td,nd,Jl,ec,Na,rd,tn,Bf,T1,k1,A1,O1,M1,I1,D1,MN,eN,OX=(eN=class extends fp{constructor(t,n){super();et(this,tn);et(this,di);et(this,Ft);et(this,cp);et(this,Wr);et(this,Zl);et(this,ed);et(this,Da);et(this,Ko);et(this,up);et(this,td);et(this,nd);et(this,Jl);et(this,ec);et(this,Na);et(this,rd,new Set);this.options=n,ze(this,di,t),ze(this,Ko,null),ze(this,Da,P1()),this.options.experimental_prefetchInRender||ae(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&&(ae(this,Ft).addObserver(this),_k(ae(this,Ft),this.options)?Lt(this,tn,Bf).call(this):this.updateResult(),Lt(this,tn,O1).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return N1(ae(this,Ft),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return N1(ae(this,Ft),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Lt(this,tn,M1).call(this),Lt(this,tn,I1).call(this),ae(this,Ft).removeObserver(this)}setOptions(t,n){const r=this.options,i=ae(this,Ft);if(this.options=ae(this,di).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Eo(this.options.enabled,ae(this,Ft))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Lt(this,tn,D1).call(this),ae(this,Ft).setOptions(this.options),r._defaulted&&!C1(this.options,r)&&ae(this,di).getQueryCache().notify({type:"observerOptionsUpdated",query:ae(this,Ft),observer:this});const o=this.hasListeners();o&&Ck(ae(this,Ft),i,this.options,r)&&Lt(this,tn,Bf).call(this),this.updateResult(n),o&&(ae(this,Ft)!==i||Eo(this.options.enabled,ae(this,Ft))!==Eo(r.enabled,ae(this,Ft))||Mu(this.options.staleTime,ae(this,Ft))!==Mu(r.staleTime,ae(this,Ft)))&&Lt(this,tn,T1).call(this);const s=Lt(this,tn,k1).call(this);o&&(ae(this,Ft)!==i||Eo(this.options.enabled,ae(this,Ft))!==Eo(r.enabled,ae(this,Ft))||s!==ae(this,Na))&&Lt(this,tn,A1).call(this,s)}getOptimisticResult(t){const n=ae(this,di).getQueryCache().build(ae(this,di),t),r=this.createResult(n,t);return IX(this,r)&&(ze(this,Wr,r),ze(this,ed,this.options),ze(this,Zl,ae(this,Ft).state)),r}getCurrentResult(){return ae(this,Wr)}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){ae(this,rd).add(t)}getCurrentQuery(){return ae(this,Ft)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=ae(this,di).defaultQueryOptions(t),r=ae(this,di).getQueryCache().build(ae(this,di),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return Lt(this,tn,Bf).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),ae(this,Wr)))}createResult(t,n){var M;const r=ae(this,Ft),i=this.options,o=ae(this,Wr),s=ae(this,Zl),a=ae(this,ed),c=t!==r?t.state:ae(this,cp),{state:u}=t;let d={...u},p=!1,h;if(n._optimisticResults){const L=this.hasListeners(),j=!L&&_k(t,n),F=L&&Ck(t,r,n,i);(j||F)&&(d={...d,...AN(u.data,t.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:m,errorUpdatedAt:b,status:y}=d;if(n.select&&d.data!==void 0)if(o&&d.data===(s==null?void 0:s.data)&&n.select===ae(this,up))h=ae(this,td);else try{ze(this,up,n.select),h=n.select(d.data),h=R1(o==null?void 0:o.data,h,n),ze(this,td,h),ze(this,Ko,null)}catch(L){ze(this,Ko,L)}else h=d.data;if(n.placeholderData!==void 0&&h===void 0&&y==="pending"){let L;if(o!=null&&o.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData))L=o.data;else if(L=typeof n.placeholderData=="function"?n.placeholderData((M=ae(this,nd))==null?void 0:M.state.data,ae(this,nd)):n.placeholderData,n.select&&L!==void 0)try{L=n.select(L),ze(this,Ko,null)}catch(j){ze(this,Ko,j)}L!==void 0&&(y="success",h=R1(o==null?void 0:o.data,L,n),p=!0)}ae(this,Ko)&&(m=ae(this,Ko),h=ae(this,td),b=Date.now(),y="error");const x=d.fetchStatus==="fetching",w=y==="pending",_=y==="error",E=w&&x,C=h!==void 0,T={status:y,fetchStatus:d.fetchStatus,isPending:w,isSuccess:y==="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&&!w,isLoadingError:_&&!C,isPaused:d.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:_&&C,isStale:nC(t,n),refetch:this.refetch,promise:ae(this,Da)};if(this.options.experimental_prefetchInRender){const L=$=>{T.status==="error"?$.reject(T.error):T.data!==void 0&&$.resolve(T.data)},j=()=>{const $=ze(this,Da,T.promise=P1());L($)},F=ae(this,Da);switch(F.status){case"pending":t.queryHash===r.queryHash&&L(F);break;case"fulfilled":(T.status==="error"||T.data!==F.value)&&j();break;case"rejected":(T.status!=="error"||T.error!==F.reason)&&j();break}}return T}updateResult(t){const n=ae(this,Wr),r=this.createResult(ae(this,Ft),this.options);if(ze(this,Zl,ae(this,Ft).state),ze(this,ed,this.options),ae(this,Zl).data!==void 0&&ze(this,nd,ae(this,Ft)),C1(r,n))return;ze(this,Wr,r);const i={},o=()=>{if(!n)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!ae(this,rd).size)return!0;const l=new Set(a??ae(this,rd));return this.options.throwOnError&&l.add("error"),Object.keys(ae(this,Wr)).some(c=>{const u=c;return ae(this,Wr)[u]!==n[u]&&l.has(u)})};(t==null?void 0:t.listeners)!==!1&&o()&&(i.listeners=!0),Lt(this,tn,MN).call(this,{...i,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Lt(this,tn,O1).call(this)}},di=new WeakMap,Ft=new WeakMap,cp=new WeakMap,Wr=new WeakMap,Zl=new WeakMap,ed=new WeakMap,Da=new WeakMap,Ko=new WeakMap,up=new WeakMap,td=new WeakMap,nd=new WeakMap,Jl=new WeakMap,ec=new WeakMap,Na=new WeakMap,rd=new WeakMap,tn=new WeakSet,Bf=function(t){Lt(this,tn,D1).call(this);let n=ae(this,Ft).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(ro)),n},T1=function(){Lt(this,tn,M1).call(this);const t=Mu(this.options.staleTime,ae(this,Ft));if(vc||ae(this,Wr).isStale||!S1(t))return;const r=CN(ae(this,Wr).dataUpdatedAt,t)+1;ze(this,Jl,setTimeout(()=>{ae(this,Wr).isStale||this.updateResult()},r))},k1=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(ae(this,Ft)):this.options.refetchInterval)??!1},A1=function(t){Lt(this,tn,I1).call(this),ze(this,Na,t),!(vc||Eo(this.options.enabled,ae(this,Ft))===!1||!S1(ae(this,Na))||ae(this,Na)===0)&&ze(this,ec,setInterval(()=>{(this.options.refetchIntervalInBackground||tC.isFocused())&&Lt(this,tn,Bf).call(this)},ae(this,Na)))},O1=function(){Lt(this,tn,T1).call(this),Lt(this,tn,A1).call(this,Lt(this,tn,k1).call(this))},M1=function(){ae(this,Jl)&&(clearTimeout(ae(this,Jl)),ze(this,Jl,void 0))},I1=function(){ae(this,ec)&&(clearInterval(ae(this,ec)),ze(this,ec,void 0))},D1=function(){const t=ae(this,di).getQueryCache().build(ae(this,di),this.options);if(t===ae(this,Ft))return;const n=ae(this,Ft);ze(this,Ft,t),ze(this,cp,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},MN=function(t){mr.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(ae(this,Wr))}),ae(this,di).getQueryCache().notify({query:ae(this,Ft),type:"observerResultsUpdated"})})},eN);function MX(e,t){return Eo(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function _k(e,t){return MX(e,t)||e.state.data!==void 0&&N1(e,t,t.refetchOnMount)}function N1(e,t,n){if(Eo(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&nC(e,t)}return!1}function Ck(e,t,n,r){return(e!==t||Eo(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&nC(e,n)}function nC(e,t){return Eo(t.enabled,e)!==!1&&e.isStaleByTime(Mu(t.staleTime,e))}function IX(e,t){return!C1(e.getCurrentResult(),t)}var rC=P.createContext(void 0),iC=e=>{const t=P.useContext(rC);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},DX=({client:e,children:t})=>(P.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),v.jsx(rC.Provider,{value:e,children:t})),IN=P.createContext(!1),NX=()=>P.useContext(IN);IN.Provider;function LX(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var FX=P.createContext(LX()),jX=()=>P.useContext(FX);function $X(e,t){return typeof e=="function"?e(...t):!!e}function Ek(){}var zX=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},BX=e=>{P.useEffect(()=>{e.clearReset()},[e])},HX=({result:e,errorResetBoundary:t,throwOnError:n,query:r})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&$X(n,[e.error,r]),VX=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)))},WX=(e,t)=>e.isLoading&&e.isFetching&&!t,UX=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Rk=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function GX(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=iC(),i=NX(),o=jX(),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",VX(s),zX(s,o),BX(o);const a=!r.getQueryCache().get(s.queryHash),[l]=P.useState(()=>new t(r,s)),c=l.getOptimisticResult(s),u=!i&&e.subscribed!==!1;if(P.useSyncExternalStore(P.useCallback(y=>{const x=u?l.subscribe(mr.batchCalls(y)):Ek;return l.updateResult(),x},[l,u]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),P.useEffect(()=>{l.setOptions(s,{listeners:!1})},[s,l]),UX(s,c))throw Rk(s,l,o);if(HX({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&&!vc&&WX(c,i)){const y=a?Rk(s,l,o):(b=r.getQueryCache().get(s.queryHash))==null?void 0:b.promise;y==null||y.catch(Ek).finally(()=>{l.updateResult()})}return s.notifyOnChangeProps?c:l.trackResult(c)}function hp(e,t){return GX(e,OX)}function qX(){const e=k.useContext(rC);if(e&&e.isSemaphorClient)return e}function DN({children:e}){const{setIsSessionExpired:t}=Vn(),n=qX(),[r]=k.useState(()=>{const i=new AX({queryCache:new ON({onError:o=>{o instanceof Error?(console.error(`Something went wrong: ${o.message}`),o.message==="invalid token"&&t(!0)):console.error("Something went wrong:",o)}}),defaultOptions:{queries:{gcTime:36e5,staleTime:3e5,refetchOnWindowFocus:!1,retry:1}}});return i.isSemaphorClient=!0,i});return n?v.jsx(v.Fragment,{children:e}):v.jsx(DX,{client:r,children:e})}const Dc=k.forwardRef(({children:e,className:t,...n},r)=>v.jsx("div",{className:be("semaphor-scope",t),ref:r,...n,children:e})),YX={id:"",authToken:void 0},NN=k.createContext(YX),LN=({children:e,dashboardProps:t})=>v.jsx(DN,{children:v.jsx(NN.Provider,{value:t,children:v.jsx(Dc,{style:{height:"100%"},children:e})})});function Wi(){const e=k.useContext(NN);if(e===void 0)throw new Error("useApplicationContext must be used within a ApplicationContextProvider");return e}function KX(){const{authToken:e,version:t}=Wi(),n=ye(a=>a.selectedLensId),{data:r,isLoading:i,isFetching:o,isError:s}=hp({queryKey:["dashboard",n,e==null?void 0:e.accessToken],queryFn:()=>dX(e==null?void 0:e.accessToken,{lensId:n,version:t}),enabled:!!(e!=null&&e.accessToken)});return{data:r,isLoading:i,isFetching:o,isError:s}}function XX(){const{authToken:e}=Wi(),t=ye(r=>r.authToken),{setAuthToken:n}=Vn();return k.useEffect(()=>{e&&(e==null?void 0:e.toString())!==(t==null?void 0:t.toString())&&n(e)},[e,t,n]),e}function FN(e){return e==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e}function Pk(e,t){const n=FN(e);return n==="dark"?tc.merge({...t==null?void 0:t.default},{...t==null?void 0:t.dark}):t==null?void 0:t.default}function QX({customStyle:e,currentTheme:t,onSave:n,onEvent:r,defaultFilterValues:i,onFilterValuesChange:o}){const{authToken:s}=Wi();XX();const a=ye(N=>N.selectedLensId),{data:l,isLoading:c,isFetching:u,isError:d}=KX(),[p,h]=k.useState(i||[]),{theme:m,setTheme:b}=_N(),y=ye(N=>N.dashboard.globalStyle),{setDashboard:x,setDashboardWithFilterValues:w,setSelectedSheetId:_,setStyle:E,setOnSaveFunction:C,setLenses:R,setSelectedLensId:T,setInitStore:M}=Vn();ye(N=>N.actions.setCustomCards);const L=ye(N=>N.actions.setFilterValues),j=ye(N=>N.filterValues),F=ye(N=>N.actions.setThemeStyle),$=ye(N=>N.actions.setDashboardTheme),Q=ye(N=>N.actions.setOnEvent);k.useEffect(()=>{s&&M()},[s,M]),k.useEffect(()=>{if(m){const N=FN(m);$(N)}},[m,$]),k.useEffect(()=>{t&&b(t)},[t,b]);const H=k.useCallback(()=>{const N=tc.cloneDeep(fb),G=tc.merge(N,y);if(e){const B=tc.merge(G,e),W=Pk(m,B);F(W),E(B)}else{const B=Pk(m,G);F(B),E(fb)}},[m,e,y,F,E]);return k.useEffect(()=>{l&&l.dashboard&&H()},[m,e,y,H,l]),k.useEffect(()=>{var Y,U;function N(O,ee){const K=O.filters||[],oe=[];for(const X of ee){const J=K.find(se=>se.id===X.filterId);J&&oe.push({filterId:X.filterId,connectionType:J.database==="NA"?"api":"database",name:J.column,operation:J.operation,valueType:Ou(J),values:X.values})}return oe}if(!l||!l.dashboard)return;const{dashboard:G,filterValues:B,defaultLensId:W,lenses:q}=l,I=N(G,p||[]);w(G,(!B||(B==null?void 0:B.length)===0?I:B)||[]),W&&T(W),q&&R(q),_(((U=(Y=G==null?void 0:G.sheets)==null?void 0:Y[0])==null?void 0:U.id)||null)},[l,x,_,L,a,R,w,T,p]),k.useEffect(()=>{o&&j&&o(j)},[j,o]),k.useEffect(()=>{n&&C(n),r&&Q(r)},[n,C,r,Q]),{isFetching:u,isLoading:c,isError:d}}function Iu({className:e,...t}){return v.jsx("div",{className:be("animate-pulse rounded-md bg-muted",e),...t})}const jN=P.forwardRef(({className:e,...t},n)=>v.jsx("div",{ref:n,className:be("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));jN.displayName="Card";const Ey=P.forwardRef(({className:e,...t},n)=>v.jsx("div",{ref:n,className:be("flex flex-col space-y-1.5 p-6",e),...t}));Ey.displayName="CardHeader";const Od=P.forwardRef(({className:e,...t},n)=>v.jsx("h3",{ref:n,className:be("text-2xl font-semibold leading-none tracking-tight",e),...t}));Od.displayName="CardTitle";const oC=P.forwardRef(({className:e,...t},n)=>v.jsx("p",{ref:n,className:be("text-sm text-muted-foreground",e),...t}));oC.displayName="CardDescription";const Ry=P.forwardRef(({className:e,...t},n)=>v.jsx("div",{ref:n,className:be("px-6 pt-0",e),...t}));Ry.displayName="CardContent";const $N=P.forwardRef(({className:e,...t},n)=>v.jsx("div",{ref:n,className:be("flex items-center p-6 pt-0",e),...t}));$N.displayName="CardFooter";function zN({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}){const{placeholders:y}=Wi(),x=ye(C=>C.themeStyle),w=ye(C=>C.isSessionExpired),{isLoading:_,isError:E}=QX({authToken:l,customStyle:t,currentTheme:c,onSave:n,onEvent:r,defaultFilterValues:h,onFilterValuesChange:m});return _||!l?(r==null||r({type:"info",message:"Loading dashboard"}),i?v.jsx(i,{message:"loading"}):v.jsx("div",{className:"flex items-center gap-3",children:v.jsx(Iu,{className:"h-1 w-full dark:h-[2px]"})})):E?(r==null||r({type:"error",message:"Error fetching dashboard"}),o?(console.log("Error fetching dashboard"),v.jsx(o,{})):v.jsx("div",{children:"Error"})):w?(r==null||r({type:"error",message:"Session Expired"}),y!=null&&y.SessionExpired?v.jsx("div",{className:"flex h-full items-center justify-center",children:v.jsx("div",{children:y.SessionExpired})}):v.jsx("div",{className:"flex h-full items-center justify-center",children:v.jsxs("div",{className:"space-y-4 rounded-md border border-muted p-10",children:[v.jsx(Od,{children:"Session Expired"}),v.jsx("p",{className:"text-muted-foreground",children:"Please refresh your page to continue."})]})})):v.jsx("div",{className:be("flex h-full flex-col justify-between",x==null?void 0:x.dashboardPanel,e),style:{},role:"dashboard-panel",...b})}function Pe(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 ZX(e,t){const n=P.createContext(t),r=o=>{const{children:s,...a}=o,l=P.useMemo(()=>a,Object.values(a));return v.jsx(n.Provider,{value:l,children:s})};r.displayName=e+"Provider";function i(o){const s=P.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 nr(e,t=[]){let n=[];function r(o,s){const a=P.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,y=P.useMemo(()=>m,Object.values(m));return v.jsx(b.Provider,{value:y,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=P.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=>P.createContext(s));return function(a){const l=(a==null?void 0:a[e])||o;return P.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,JX(i,...t)]}function JX(...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 P.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Tk(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Py(...e){return t=>{let n=!1;const r=e.map(i=>{const o=Tk(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():Tk(e[i],null)}}}}function it(...e){return P.useCallback(Py(...e),e)}var ea=P.forwardRef((e,t)=>{const{children:n,...r}=e,i=P.Children.toArray(n),o=i.find(eQ);if(o){const s=o.props.children,a=i.map(l=>l===o?P.Children.count(s)>1?P.Children.only(null):P.isValidElement(s)?s.props.children:null:l);return v.jsx(L1,{...r,ref:t,children:P.isValidElement(s)?P.cloneElement(s,void 0,a):null})}return v.jsx(L1,{...r,ref:t,children:n})});ea.displayName="Slot";var L1=P.forwardRef((e,t)=>{const{children:n,...r}=e;if(P.isValidElement(n)){const i=nQ(n);return P.cloneElement(n,{...tQ(r,n.props),ref:t?Py(t,i):i})}return P.Children.count(n)>1?P.Children.only(null):null});L1.displayName="SlotClone";var sC=({children:e})=>v.jsx(v.Fragment,{children:e});function eQ(e){return P.isValidElement(e)&&e.type===sC}function tQ(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 nQ(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 Ty(e){const t=e+"CollectionProvider",[n,r]=nr(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=h=>{const{scope:m,children:b}=h,y=k.useRef(null),x=k.useRef(new Map).current;return v.jsx(i,{scope:m,itemMap:x,collectionRef:y,children:b})};s.displayName=t;const a=e+"CollectionSlot",l=k.forwardRef((h,m)=>{const{scope:b,children:y}=h,x=o(a,b),w=it(m,x.collectionRef);return v.jsx(ea,{ref:w,children:y})});l.displayName=a;const c=e+"CollectionItemSlot",u="data-radix-collection-item",d=k.forwardRef((h,m)=>{const{scope:b,children:y,...x}=h,w=k.useRef(null),_=it(m,w),E=o(c,b);return k.useEffect(()=>(E.itemMap.set(w,{ref:w,...x}),()=>void E.itemMap.delete(w))),v.jsx(ea,{[u]:"",ref:_,children:y})});d.displayName=c;function p(h){const m=o(e+"CollectionConsumer",h);return k.useCallback(()=>{const y=m.collectionRef.current;if(!y)return[];const x=Array.from(y.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 yr=globalThis!=null&&globalThis.document?P.useLayoutEffect:()=>{},rQ=P.useId||(()=>{}),iQ=0;function Yn(e){const[t,n]=P.useState(rQ());return yr(()=>{e||n(r=>r??String(iQ++))},[e]),e||(t?`radix-${t}`:"")}var oQ=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Le=oQ.reduce((e,t)=>{const n=P.forwardRef((r,i)=>{const{asChild:o,...s}=r,a=o?ea:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),v.jsx(a,{...s,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function BN(e,t){e&&mc.flushSync(()=>e.dispatchEvent(t))}function tr(e){const t=P.useRef(e);return P.useEffect(()=>{t.current=e}),P.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function Dr({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,i]=sQ({defaultProp:t,onChange:n}),o=e!==void 0,s=o?e:r,a=tr(n),l=P.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 sQ({defaultProp:e,onChange:t}){const n=P.useState(e),[r]=n,i=P.useRef(r),o=tr(t);return P.useEffect(()=>{i.current!==r&&(o(r),i.current=r)},[r,i,o]),n}var aQ=P.createContext(void 0);function Nc(e){const t=P.useContext(aQ);return e||t||"ltr"}var yx="rovingFocusGroup.onEntryFocus",lQ={bubbles:!1,cancelable:!0},ky="RovingFocusGroup",[F1,HN,cQ]=Ty(ky),[uQ,Md]=nr(ky,[cQ]),[dQ,fQ]=uQ(ky),VN=P.forwardRef((e,t)=>v.jsx(F1.Provider,{scope:e.__scopeRovingFocusGroup,children:v.jsx(F1.Slot,{scope:e.__scopeRovingFocusGroup,children:v.jsx(hQ,{...e,ref:t})})}));VN.displayName=ky;var hQ=P.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=P.useRef(null),h=it(t,p),m=Nc(o),[b=null,y]=Dr({prop:s,defaultProp:a,onChange:l}),[x,w]=P.useState(!1),_=tr(c),E=HN(n),C=P.useRef(!1),[R,T]=P.useState(0);return P.useEffect(()=>{const M=p.current;if(M)return M.addEventListener(yx,_),()=>M.removeEventListener(yx,_)},[_]),v.jsx(dQ,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:b,onItemFocus:P.useCallback(M=>y(M),[y]),onItemShiftTab:P.useCallback(()=>w(!0),[]),onFocusableItemAdd:P.useCallback(()=>T(M=>M+1),[]),onFocusableItemRemove:P.useCallback(()=>T(M=>M-1),[]),children:v.jsx(Le.div,{tabIndex:x||R===0?-1:0,"data-orientation":r,...d,ref:h,style:{outline:"none",...e.style},onMouseDown:Pe(e.onMouseDown,()=>{C.current=!0}),onFocus:Pe(e.onFocus,M=>{const L=!C.current;if(M.target===M.currentTarget&&L&&!x){const j=new CustomEvent(yx,lQ);if(M.currentTarget.dispatchEvent(j),!j.defaultPrevented){const F=E().filter(G=>G.focusable),$=F.find(G=>G.active),Q=F.find(G=>G.id===b),N=[$,Q,...F].filter(Boolean).map(G=>G.ref.current);GN(N,u)}}C.current=!1}),onBlur:Pe(e.onBlur,()=>w(!1))})})}),WN="RovingFocusGroupItem",UN=P.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,...s}=e,a=Yn(),l=o||a,c=fQ(WN,n),u=c.currentTabStopId===l,d=HN(n),{onFocusableItemAdd:p,onFocusableItemRemove:h}=c;return P.useEffect(()=>{if(r)return p(),()=>h()},[r,p,h]),v.jsx(F1.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:v.jsx(Le.span,{tabIndex:u?0:-1,"data-orientation":c.orientation,...s,ref:t,onMouseDown:Pe(e.onMouseDown,m=>{r?c.onItemFocus(l):m.preventDefault()}),onFocus:Pe(e.onFocus,()=>c.onItemFocus(l)),onKeyDown:Pe(e.onKeyDown,m=>{if(m.key==="Tab"&&m.shiftKey){c.onItemShiftTab();return}if(m.target!==m.currentTarget)return;const b=mQ(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(w=>w.focusable).map(w=>w.ref.current);if(b==="last")x.reverse();else if(b==="prev"||b==="next"){b==="prev"&&x.reverse();const w=x.indexOf(m.currentTarget);x=c.loop?bQ(x,w+1):x.slice(w+1)}setTimeout(()=>GN(x))}})})})});UN.displayName=WN;var pQ={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function gQ(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function mQ(e,t,n){const r=gQ(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return pQ[r]}function GN(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function bQ(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var aC=VN,lC=UN;function yQ(e,t){return P.useReducer((n,r)=>t[n][r]??n,e)}var Kn=e=>{const{present:t,children:n}=e,r=vQ(t),i=typeof n=="function"?n({present:r.isPresent}):P.Children.only(n),o=it(r.ref,xQ(i));return typeof n=="function"||r.isPresent?P.cloneElement(i,{ref:o}):null};Kn.displayName="Presence";function vQ(e){const[t,n]=P.useState(),r=P.useRef({}),i=P.useRef(e),o=P.useRef("none"),s=e?"mounted":"unmounted",[a,l]=yQ(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return P.useEffect(()=>{const c=jg(r.current);o.current=a==="mounted"?c:"none"},[a]),yr(()=>{const c=r.current,u=i.current;if(u!==e){const p=o.current,h=jg(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]),yr(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,d=h=>{const b=jg(r.current).includes(h.animationName);if(h.target===t&&b&&(l("ANIMATION_END"),!i.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},p=h=>{h.target===t&&(o.current=jg(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:P.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function jg(e){return(e==null?void 0:e.animationName)||"none"}function xQ(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 cC="Tabs",[wQ,OAe]=nr(cC,[Md]),qN=Md(),[SQ,uC]=wQ(cC),YN=P.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:s="horizontal",dir:a,activationMode:l="automatic",...c}=e,u=Nc(a),[d,p]=Dr({prop:r,onChange:i,defaultProp:o});return v.jsx(SQ,{scope:n,baseId:Yn(),value:d,onValueChange:p,orientation:s,dir:u,activationMode:l,children:v.jsx(Le.div,{dir:u,"data-orientation":s,...c,ref:t})})});YN.displayName=cC;var KN="TabsList",XN=P.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,o=uC(KN,n),s=qN(n);return v.jsx(aC,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:r,children:v.jsx(Le.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:t})})});XN.displayName=KN;var QN="TabsTrigger",ZN=P.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...o}=e,s=uC(QN,n),a=qN(n),l=t5(s.baseId,r),c=n5(s.baseId,r),u=r===s.value;return v.jsx(lC,{asChild:!0,...a,focusable:!i,active:u,children:v.jsx(Le.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:Pe(e.onMouseDown,d=>{!i&&d.button===0&&d.ctrlKey===!1?s.onValueChange(r):d.preventDefault()}),onKeyDown:Pe(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&s.onValueChange(r)}),onFocus:Pe(e.onFocus,()=>{const d=s.activationMode!=="manual";!u&&!i&&d&&s.onValueChange(r)})})})});ZN.displayName=QN;var JN="TabsContent",e5=P.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:o,...s}=e,a=uC(JN,n),l=t5(a.baseId,r),c=n5(a.baseId,r),u=r===a.value,d=P.useRef(u);return P.useEffect(()=>{const p=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(p)},[]),v.jsx(Kn,{present:i||u,children:({present:p})=>v.jsx(Le.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})})});e5.displayName=JN;function t5(e,t){return`${e}-trigger-${t}`}function n5(e,t){return`${e}-content-${t}`}var _Q=YN,r5=XN,i5=ZN,o5=e5;const dC=_Q,Ay=P.forwardRef(({className:e,...t},n)=>v.jsx(r5,{ref:n,className:be("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Ay.displayName=r5.displayName;const Oy=P.forwardRef(({className:e,...t},n)=>v.jsx(i5,{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}));Oy.displayName=i5.displayName;const fC=P.forwardRef(({className:e,...t},n)=>v.jsx(o5,{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}));fC.displayName=o5.displayName;var s5={exports:{}},pp={},j1={exports:{}};(function(e,t){(function(n,r){r(t)})(Pa,function(n){function r(J){return function(le,ge,ie,pe,he,Re,Oe){return J(le,ge,Oe)}}function i(J){return function(le,ge,ie,pe){if(!le||!ge||typeof le!="object"||typeof ge!="object")return J(le,ge,ie,pe);var he=pe.get(le),Re=pe.get(ge);if(he&&Re)return he===ge&&Re===le;pe.set(le,ge),pe.set(ge,le);var Oe=J(le,ge,ie,pe);return pe.delete(le),pe.delete(ge),Oe}}function o(J,se){var le={};for(var ge in J)le[ge]=J[ge];for(var ge in se)le[ge]=se[ge];return le}function s(J){return J.constructor===Object||J.constructor==null}function a(J){return typeof J.then=="function"}function l(J,se){return J===se||J!==J&&se!==se}var c="[object Arguments]",u="[object Boolean]",d="[object Date]",p="[object RegExp]",h="[object Map]",m="[object Number]",b="[object Object]",y="[object Set]",x="[object String]",w=Object.prototype.toString;function _(J){var se=J.areArraysEqual,le=J.areDatesEqual,ge=J.areMapsEqual,ie=J.areObjectsEqual,pe=J.areRegExpsEqual,he=J.areSetsEqual,Re=J.createIsNestedEqual,Oe=Re(Fe);function Fe(ke,Be,dt){if(ke===Be)return!0;if(!ke||!Be||typeof ke!="object"||typeof Be!="object")return ke!==ke&&Be!==Be;if(s(ke)&&s(Be))return ie(ke,Be,Oe,dt);var Ct=Array.isArray(ke),an=Array.isArray(Be);if(Ct||an)return Ct===an&&se(ke,Be,Oe,dt);var mt=w.call(ke);return mt!==w.call(Be)?!1:mt===d?le(ke,Be,Oe,dt):mt===p?pe(ke,Be,Oe,dt):mt===h?ge(ke,Be,Oe,dt):mt===y?he(ke,Be,Oe,dt):mt===b||mt===c?a(ke)||a(Be)?!1:ie(ke,Be,Oe,dt):mt===u||mt===m||mt===x?l(ke.valueOf(),Be.valueOf()):!1}return Fe}function E(J,se,le,ge){var ie=J.length;if(se.length!==ie)return!1;for(;ie-- >0;)if(!le(J[ie],se[ie],ie,ie,J,se,ge))return!1;return!0}var C=i(E);function R(J,se){return l(J.valueOf(),se.valueOf())}function T(J,se,le,ge){var ie=J.size===se.size;if(!ie)return!1;if(!J.size)return!0;var pe={},he=0;return J.forEach(function(Re,Oe){if(ie){var Fe=!1,ke=0;se.forEach(function(Be,dt){!Fe&&!pe[ke]&&(Fe=le(Oe,dt,he,ke,J,se,ge)&&le(Re,Be,Oe,dt,J,se,ge))&&(pe[ke]=!0),ke++}),he++,ie=Fe}}),ie}var M=i(T),L="_owner",j=Object.prototype.hasOwnProperty;function F(J,se,le,ge){var ie=Object.keys(J),pe=ie.length;if(Object.keys(se).length!==pe)return!1;for(var he;pe-- >0;){if(he=ie[pe],he===L){var Re=!!J.$$typeof,Oe=!!se.$$typeof;if((Re||Oe)&&Re!==Oe)return!1}if(!j.call(se,he)||!le(J[he],se[he],he,he,J,se,ge))return!1}return!0}var $=i(F);function Q(J,se){return J.source===se.source&&J.flags===se.flags}function H(J,se,le,ge){var ie=J.size===se.size;if(!ie)return!1;if(!J.size)return!0;var pe={};return J.forEach(function(he,Re){if(ie){var Oe=!1,Fe=0;se.forEach(function(ke,Be){!Oe&&!pe[Fe]&&(Oe=le(he,ke,Re,Be,J,se,ge))&&(pe[Fe]=!0),Fe++}),ie=Oe}}),ie}var N=i(H),G=Object.freeze({areArraysEqual:E,areDatesEqual:R,areMapsEqual:T,areObjectsEqual:F,areRegExpsEqual:Q,areSetsEqual:H,createIsNestedEqual:r}),B=Object.freeze({areArraysEqual:C,areDatesEqual:R,areMapsEqual:M,areObjectsEqual:$,areRegExpsEqual:Q,areSetsEqual:N,createIsNestedEqual:r}),W=_(G);function q(J,se){return W(J,se,void 0)}var I=_(o(G,{createIsNestedEqual:function(){return l}}));function Y(J,se){return I(J,se,void 0)}var U=_(B);function O(J,se){return U(J,se,new WeakMap)}var ee=_(o(B,{createIsNestedEqual:function(){return l}}));function K(J,se){return ee(J,se,new WeakMap)}function oe(J){return _(o(G,J(G)))}function X(J){var se=_(o(B,J(B)));return function(le,ge,ie){return ie===void 0&&(ie=new WeakMap),se(le,ge,ie)}}n.circularDeepEqual=O,n.circularShallowEqual=K,n.createCustomCircularEqual=X,n.createCustomEqual=oe,n.deepEqual=q,n.sameValueZeroEqual=l,n.shallowEqual=Y,Object.defineProperty(n,"__esModule",{value:!0})})})(j1,j1.exports);var hC=j1.exports;const pC=z_($Y);var Pt={},CQ=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(Pt,"__esModule",{value:!0});Pt.bottom=gC;Pt.childrenEqual=TQ;Pt.cloneLayout=a5;Pt.cloneLayoutItem=nc;Pt.collides=My;Pt.compact=c5;Pt.compactItem=u5;Pt.compactType=BQ;Pt.correctBounds=d5;Pt.fastPositionEqual=kQ;Pt.fastRGLPropsEqual=void 0;Pt.getAllCollisions=f5;Pt.getFirstCollision=zl;Pt.getLayoutItem=mC;Pt.getStatics=bC;Pt.modifyLayout=l5;Pt.moveElement=Vf;Pt.moveElementAwayFromCollision=z1;Pt.noop=void 0;Pt.perc=OQ;Pt.resizeItemInDirection=FQ;Pt.setTopLeft=$Q;Pt.setTransform=jQ;Pt.sortLayoutItems=_C;Pt.sortLayoutItemsByColRow=b5;Pt.sortLayoutItemsByRowCol=m5;Pt.synchronizeLayoutWithChildren=zQ;Pt.validateLayout=y5;Pt.withLayoutItem=PQ;var kk=hC,Hf=EQ(k);function EQ(e){return e&&e.__esModule?e:{default:e}}const RQ=process.env.NODE_ENV==="production";function gC(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 a5(e){const t=Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=nc(e[n]);return t}function l5(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 PQ(e,t,n){let r=mC(e,t);return r?(r=n(nc(r)),e=l5(e,r),[e,r]):[e,null]}function nc(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 TQ(e,t){return(0,kk.deepEqual)(Hf.default.Children.map(e,n=>n==null?void 0:n.key),Hf.default.Children.map(t,n=>n==null?void 0:n.key))&&(0,kk.deepEqual)(Hf.default.Children.map(e,n=>n==null?void 0:n.props["data-grid"]),Hf.default.Children.map(t,n=>n==null?void 0:n.props["data-grid"]))}Pt.fastRGLPropsEqual=CQ;function kQ(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function My(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 c5(e,t,n,r){const i=bC(e),o=_C(e,t),s=Array(e.length);for(let a=0,l=o.length;a<l;a++){let c=nc(o[a]);c.static||(c=u5(i,c,t,n,o,r),i.push(c)),s[e.indexOf(o[a])]=c,c.moved=!1}return s}const AQ={x:"w",y:"h"};function $1(e,t,n,r){const i=AQ[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;My(t,a)&&$1(e,a,n+t[i],r)}}t[r]=n}function u5(e,t,n,r,i,o){const s=n==="vertical",a=n==="horizontal";if(s)for(t.y=Math.min(gC(e),t.y);t.y>0&&!zl(e,t);)t.y--;else if(a)for(;t.x>0&&!zl(e,t);)t.x--;let l;for(;(l=zl(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&&!zl(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function d5(e,t){const n=bC(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(;zl(n,o);)o.y++}return e}function mC(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function zl(e,t){for(let n=0,r=e.length;n<r;n++)if(My(e[n],t))return e[n]}function f5(e,t){return e.filter(n=>My(n,t))}function bC(e){return e.filter(t=>t.static)}function Vf(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=_C(e,s);(s==="vertical"&&typeof r=="number"?u>=r:s==="horizontal"&&typeof n=="number"?c>=n:!1)&&(d=d.reverse());const h=f5(d,t),m=h.length>0;if(m&&l)return a5(e);if(m&&o)return`${t.i}`,t.x=c,t.y=u,t.moved=!1,e;for(let b=0,y=h.length;b<y;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=zl(e,d),h=p&&p.y+p.h>t.y,m=p&&t.x+t.w>p.x;if(p){if(h&&a)return Vf(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 Vf(e,t,n.x,void 0,r,l,i)}else return`${n.i}${d.x}${d.y}`,Vf(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:Vf(e,n,s?n.x+1:void 0,a?n.y+1:void 0,r,l,i)}function OQ(e){return e*100+"%"}const h5=(e,t,n,r)=>e+n>r?t:n,p5=(e,t,n)=>e<0?t:n,g5=e=>Math.max(0,e),yC=e=>Math.max(0,e),vC=(e,t,n)=>{let{left:r,height:i,width:o}=t;const s=e.top-(i-e.height);return{left:r,width:o,height:p5(s,e.height,i),top:yC(s)}},xC=(e,t,n)=>{let{top:r,left:i,height:o,width:s}=t;return{top:r,height:o,width:h5(e.left,e.width,s,n),left:g5(i)}},wC=(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:h5(e.left,e.width,o,n),top:yC(r),left:g5(s)}},SC=(e,t,n)=>{let{top:r,left:i,height:o,width:s}=t;return{width:s,left:i,height:p5(r,e.height,o),top:yC(r)}},MQ=function(){return vC(arguments.length<=0?void 0:arguments[0],xC(...arguments))},IQ=function(){return vC(arguments.length<=0?void 0:arguments[0],wC(...arguments))},DQ=function(){return SC(arguments.length<=0?void 0:arguments[0],xC(...arguments))},NQ=function(){return SC(arguments.length<=0?void 0:arguments[0],wC(...arguments))},LQ={n:vC,ne:MQ,e:xC,se:DQ,s:SC,sw:NQ,w:wC,nw:IQ};function FQ(e,t,n,r){const i=LQ[e];return i?i(t,{...t,...n},r):n}function jQ(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 $Q(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 _C(e,t){return t==="horizontal"?b5(e):t==="vertical"?m5(e):e}function m5(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 b5(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 zQ(e,t,n,r,i){e=e||[];const o=[];Hf.default.Children.forEach(t,a=>{if((a==null?void 0:a.key)==null)return;const l=mC(e,String(a.key)),c=a.props["data-grid"];l&&c==null?o.push(nc(l)):c?(RQ||y5([c],"ReactGridLayout.children"),o.push(nc({...c,i:a.key}))):o.push(nc({w:1,h:1,x:0,y:gC(o),i:String(a.key)}))});const s=d5(o,{cols:n});return i?s:c5(s,r,n)}function y5(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 BQ(e){const{verticalCompact:t,compactType:n}=e||{};return t===!1?null:n}const HQ=()=>{};Pt.noop=HQ;var gs={};Object.defineProperty(gs,"__esModule",{value:!0});gs.calcGridColWidth=Iy;gs.calcGridItemPosition=VQ;gs.calcGridItemWHPx=B1;gs.calcWH=UQ;gs.calcXY=WQ;gs.clamp=Bl;function Iy(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 VQ(e,t,n,r,i,o){const{margin:s,containerPadding:a,rowHeight:l}=e,c=Iy(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 WQ(e,t,n,r,i){const{margin:o,containerPadding:s,cols:a,rowHeight:l,maxRows:c}=e,u=Iy(e);let d=Math.round((n-s[0])/(u+o[0])),p=Math.round((t-s[1])/(l+o[1]));return d=Bl(d,0,a-r),p=Bl(p,0,c-i),{x:d,y:p}}function UQ(e,t,n,r,i,o){const{margin:s,maxRows:a,cols:l,rowHeight:c}=e,u=Iy(e);let d=Math.round((t+s[0])/(u+s[0])),p=Math.round((n+s[1])/(c+s[1])),h=Bl(d,0,l-r),m=Bl(p,0,a-i);return["sw","w","nw"].indexOf(o)!==-1&&(h=Bl(d,0,l)),["nw","n","ne"].indexOf(o)!==-1&&(m=Bl(p,0,a)),{w:h,h:m}}function Bl(e,t,n){return Math.max(Math.min(e,n),t)}var Dy={},H1={exports:{}},$g={exports:{}},Zt={};/** @license React v16.13.1
|
|
91
|
+
}`;var yt=YT(function(){return qt(V,Ve+"return "+Ce).apply(n,Z)});if(yt.source=Ce,Qv(yt))throw yt;return yt}function Hq(f){return Qt(f).toLowerCase()}function Vq(f){return Qt(f).toUpperCase()}function Wq(f,g,S){if(f=Qt(f),f&&(S||g===n))return rP(f);if(!f||!(g=_i(g)))return f;var A=go(f),D=go(g),V=iP(A,D),Z=oP(A,D)+1;return ma(A,V,Z).join("")}function Uq(f,g,S){if(f=Qt(f),f&&(S||g===n))return f.slice(0,aP(f)+1);if(!f||!(g=_i(g)))return f;var A=go(f),D=oP(A,go(g))+1;return ma(A,0,D).join("")}function Gq(f,g,S){if(f=Qt(f),f&&(S||g===n))return f.replace(yn,"");if(!f||!(g=_i(g)))return f;var A=go(f),D=iP(A,go(g));return ma(A,D).join("")}function qq(f,g){var S=j,A=F;if(kn(g)){var D="separator"in g?g.separator:D;S="length"in g?ft(g.length):S,A="omission"in g?_i(g.omission):A}f=Qt(f);var V=f.length;if(Kc(f)){var Z=go(f);V=Z.length}if(S>=V)return f;var re=S-Xc(A);if(re<1)return A;var ue=Z?ma(Z,0,re).join(""):f.slice(0,re);if(D===n)return ue+A;if(Z&&(re+=ue.length-re),Zv(D)){if(f.slice(re).search(D)){var ve,we=ue;for(D.global||(D=pv(D.source,Qt(Bt.exec(D))+"g")),D.lastIndex=0;ve=D.exec(we);)var Ce=ve.index;ue=ue.slice(0,Ce===n?re:Ce)}}else if(f.indexOf(_i(D),re)!=re){var De=ue.lastIndexOf(D);De>-1&&(ue=ue.slice(0,De))}return ue+A}function Yq(f){return f=Qt(f),f&&Lr.test(f)?f.replace(Fo,_H):f}var Kq=ru(function(f,g,S){return f+(S?" ":"")+g.toUpperCase()}),tx=KP("toUpperCase");function qT(f,g,S){return f=Qt(f),g=S?n:g,g===n?yH(f)?RH(f):cH(f):f.match(g)||[]}var YT=_t(function(f,g){try{return wi(f,n,g)}catch(S){return Qv(S)?S:new st(S)}}),Xq=Ps(function(f,g){return Yi(g,function(S){S=zo(S),Es(f,S,Kv(f[S],f))}),f});function Qq(f){var g=f==null?0:f.length,S=Ue();return f=g?Tn(f,function(A){if(typeof A[1]!="function")throw new Ki(s);return[S(A[0]),A[1]]}):[],_t(function(A){for(var D=-1;++D<g;){var V=f[D];if(wi(V[0],this,A))return wi(V[1],this,A)}})}function Zq(f){return _V(Qi(f,d))}function nx(f){return function(){return f}}function Jq(f,g){return f==null||f!==f?g:f}var eY=QP(),tY=QP(!0);function ii(f){return f}function rx(f){return PP(typeof f=="function"?f:Qi(f,d))}function nY(f){return kP(Qi(f,d))}function rY(f,g){return AP(f,Qi(g,d))}var iY=_t(function(f,g){return function(S){return sf(S,f,g)}}),oY=_t(function(f,g){return function(S){return sf(f,S,g)}});function ix(f,g,S){var A=sr(g),D=pg(g,A);S==null&&!(kn(g)&&(D.length||!A.length))&&(S=g,g=f,f=this,D=pg(g,sr(g)));var V=!(kn(S)&&"chain"in S)||!!S.chain,Z=ks(f);return Yi(D,function(re){var ue=g[re];f[re]=ue,Z&&(f.prototype[re]=function(){var ve=this.__chain__;if(V||ve){var we=f(this.__wrapped__),Ce=we.__actions__=ti(this.__actions__);return Ce.push({func:ue,args:arguments,thisArg:f}),we.__chain__=ve,we}return ue.apply(f,ua([this.value()],arguments))})}),f}function sY(){return fr._===this&&(fr._=MH),this}function ox(){}function aY(f){return f=ft(f),_t(function(g){return OP(g,f)})}var lY=Lv(Tn),cY=Lv(Z2),uY=Lv(av);function KT(f){return Vv(f)?lv(zo(f)):zV(f)}function dY(f){return function(g){return f==null?n:bl(f,g)}}var fY=JP(),hY=JP(!0);function sx(){return[]}function ax(){return!1}function pY(){return{}}function gY(){return""}function mY(){return!0}function bY(f,g){if(f=ft(f),f<1||f>W)return[];var S=Y,A=Sr(f,Y);g=Ue(g),f-=Y;for(var D=dv(A,g);++S<f;)g(S);return D}function yY(f){return lt(f)?Tn(f,zo):Ci(f)?[f]:ti(gT(Qt(f)))}function vY(f){var g=++AH;return Qt(f)+g}var xY=xg(function(f,g){return f+g},0),wY=Fv("ceil"),SY=xg(function(f,g){return f/g},1),_Y=Fv("floor");function CY(f){return f&&f.length?hg(f,ii,Sv):n}function EY(f,g){return f&&f.length?hg(f,Ue(g,2),Sv):n}function RY(f){return tP(f,ii)}function PY(f,g){return tP(f,Ue(g,2))}function TY(f){return f&&f.length?hg(f,ii,Rv):n}function kY(f,g){return f&&f.length?hg(f,Ue(g,2),Rv):n}var AY=xg(function(f,g){return f*g},1),OY=Fv("round"),MY=xg(function(f,g){return f-g},0);function IY(f){return f&&f.length?uv(f,ii):0}function DY(f,g){return f&&f.length?uv(f,Ue(g,2)):0}return z.after=nG,z.ary=RT,z.assign=VG,z.assignIn=zT,z.assignInWith=Ig,z.assignWith=WG,z.at=UG,z.before=PT,z.bind=Kv,z.bindAll=Xq,z.bindKey=TT,z.castArray=pG,z.chain=_T,z.chunk=_W,z.compact=CW,z.concat=EW,z.cond=Qq,z.conforms=Zq,z.constant=nx,z.countBy=IU,z.create=GG,z.curry=kT,z.curryRight=AT,z.debounce=OT,z.defaults=qG,z.defaultsDeep=YG,z.defer=rG,z.delay=iG,z.difference=RW,z.differenceBy=PW,z.differenceWith=TW,z.drop=kW,z.dropRight=AW,z.dropRightWhile=OW,z.dropWhile=MW,z.fill=IW,z.filter=NU,z.flatMap=jU,z.flatMapDeep=$U,z.flatMapDepth=zU,z.flatten=vT,z.flattenDeep=DW,z.flattenDepth=NW,z.flip=oG,z.flow=eY,z.flowRight=tY,z.fromPairs=LW,z.functions=tq,z.functionsIn=nq,z.groupBy=BU,z.initial=jW,z.intersection=$W,z.intersectionBy=zW,z.intersectionWith=BW,z.invert=iq,z.invertBy=oq,z.invokeMap=VU,z.iteratee=rx,z.keyBy=WU,z.keys=sr,z.keysIn=ri,z.map=Pg,z.mapKeys=aq,z.mapValues=lq,z.matches=nY,z.matchesProperty=rY,z.memoize=kg,z.merge=cq,z.mergeWith=BT,z.method=iY,z.methodOf=oY,z.mixin=ix,z.negate=Ag,z.nthArg=aY,z.omit=uq,z.omitBy=dq,z.once=sG,z.orderBy=UU,z.over=lY,z.overArgs=aG,z.overEvery=cY,z.overSome=uY,z.partial=Xv,z.partialRight=MT,z.partition=GU,z.pick=fq,z.pickBy=HT,z.property=KT,z.propertyOf=dY,z.pull=UW,z.pullAll=wT,z.pullAllBy=GW,z.pullAllWith=qW,z.pullAt=YW,z.range=fY,z.rangeRight=hY,z.rearg=lG,z.reject=KU,z.remove=KW,z.rest=cG,z.reverse=qv,z.sampleSize=QU,z.set=pq,z.setWith=gq,z.shuffle=ZU,z.slice=XW,z.sortBy=tG,z.sortedUniq=rU,z.sortedUniqBy=iU,z.split=jq,z.spread=uG,z.tail=oU,z.take=sU,z.takeRight=aU,z.takeRightWhile=lU,z.takeWhile=cU,z.tap=CU,z.throttle=dG,z.thru=Rg,z.toArray=FT,z.toPairs=VT,z.toPairsIn=WT,z.toPath=yY,z.toPlainObject=$T,z.transform=mq,z.unary=fG,z.union=uU,z.unionBy=dU,z.unionWith=fU,z.uniq=hU,z.uniqBy=pU,z.uniqWith=gU,z.unset=bq,z.unzip=Yv,z.unzipWith=ST,z.update=yq,z.updateWith=vq,z.values=su,z.valuesIn=xq,z.without=mU,z.words=qT,z.wrap=hG,z.xor=bU,z.xorBy=yU,z.xorWith=vU,z.zip=xU,z.zipObject=wU,z.zipObjectDeep=SU,z.zipWith=_U,z.entries=VT,z.entriesIn=WT,z.extend=zT,z.extendWith=Ig,ix(z,z),z.add=xY,z.attempt=YT,z.camelCase=Cq,z.capitalize=UT,z.ceil=wY,z.clamp=wq,z.clone=gG,z.cloneDeep=bG,z.cloneDeepWith=yG,z.cloneWith=mG,z.conformsTo=vG,z.deburr=GT,z.defaultTo=Jq,z.divide=SY,z.endsWith=Eq,z.eq=bo,z.escape=Rq,z.escapeRegExp=Pq,z.every=DU,z.find=LU,z.findIndex=bT,z.findKey=KG,z.findLast=FU,z.findLastIndex=yT,z.findLastKey=XG,z.floor=_Y,z.forEach=CT,z.forEachRight=ET,z.forIn=QG,z.forInRight=ZG,z.forOwn=JG,z.forOwnRight=eq,z.get=Jv,z.gt=xG,z.gte=wG,z.has=rq,z.hasIn=ex,z.head=xT,z.identity=ii,z.includes=HU,z.indexOf=FW,z.inRange=Sq,z.invoke=sq,z.isArguments=xl,z.isArray=lt,z.isArrayBuffer=SG,z.isArrayLike=ni,z.isArrayLikeObject=zn,z.isBoolean=_G,z.isBuffer=ba,z.isDate=CG,z.isElement=EG,z.isEmpty=RG,z.isEqual=PG,z.isEqualWith=TG,z.isError=Qv,z.isFinite=kG,z.isFunction=ks,z.isInteger=IT,z.isLength=Og,z.isMap=DT,z.isMatch=AG,z.isMatchWith=OG,z.isNaN=MG,z.isNative=IG,z.isNil=NG,z.isNull=DG,z.isNumber=NT,z.isObject=kn,z.isObjectLike=Mn,z.isPlainObject=ff,z.isRegExp=Zv,z.isSafeInteger=LG,z.isSet=LT,z.isString=Mg,z.isSymbol=Ci,z.isTypedArray=ou,z.isUndefined=FG,z.isWeakMap=jG,z.isWeakSet=$G,z.join=HW,z.kebabCase=Tq,z.last=Ji,z.lastIndexOf=VW,z.lowerCase=kq,z.lowerFirst=Aq,z.lt=zG,z.lte=BG,z.max=CY,z.maxBy=EY,z.mean=RY,z.meanBy=PY,z.min=TY,z.minBy=kY,z.stubArray=sx,z.stubFalse=ax,z.stubObject=pY,z.stubString=gY,z.stubTrue=mY,z.multiply=AY,z.nth=WW,z.noConflict=sY,z.noop=ox,z.now=Tg,z.pad=Oq,z.padEnd=Mq,z.padStart=Iq,z.parseInt=Dq,z.random=_q,z.reduce=qU,z.reduceRight=YU,z.repeat=Nq,z.replace=Lq,z.result=hq,z.round=OY,z.runInContext=ce,z.sample=XU,z.size=JU,z.snakeCase=Fq,z.some=eG,z.sortedIndex=QW,z.sortedIndexBy=ZW,z.sortedIndexOf=JW,z.sortedLastIndex=eU,z.sortedLastIndexBy=tU,z.sortedLastIndexOf=nU,z.startCase=$q,z.startsWith=zq,z.subtract=MY,z.sum=IY,z.sumBy=DY,z.template=Bq,z.times=bY,z.toFinite=As,z.toInteger=ft,z.toLength=jT,z.toLower=Hq,z.toNumber=eo,z.toSafeInteger=HG,z.toString=Qt,z.toUpper=Vq,z.trim=Wq,z.trimEnd=Uq,z.trimStart=Gq,z.truncate=qq,z.unescape=Yq,z.uniqueId=vY,z.upperCase=Kq,z.upperFirst=tx,z.each=CT,z.eachRight=ET,z.first=xT,ix(z,function(){var f={};return jo(z,function(g,S){rn.call(z.prototype,S)||(f[S]=g)}),f}(),{chain:!1}),z.VERSION=r,Yi(["bind","bindKey","curry","curryRight","partial","partialRight"],function(f){z[f].placeholder=z}),Yi(["drop","take"],function(f,g){It.prototype[f]=function(S){S=S===n?1:er(ft(S),0);var A=this.__filtered__&&!g?new It(this):this.clone();return A.__filtered__?A.__takeCount__=Sr(S,A.__takeCount__):A.__views__.push({size:Sr(S,Y),type:f+(A.__dir__<0?"Right":"")}),A},It.prototype[f+"Right"]=function(S){return this.reverse()[f](S).reverse()}}),Yi(["filter","map","takeWhile"],function(f,g){var S=g+1,A=S==H||S==G;It.prototype[f]=function(D){var V=this.clone();return V.__iteratees__.push({iteratee:Ue(D,3),type:S}),V.__filtered__=V.__filtered__||A,V}}),Yi(["head","last"],function(f,g){var S="take"+(g?"Right":"");It.prototype[f]=function(){return this[S](1).value()[0]}}),Yi(["initial","tail"],function(f,g){var S="drop"+(g?"":"Right");It.prototype[f]=function(){return this.__filtered__?new It(this):this[S](1)}}),It.prototype.compact=function(){return this.filter(ii)},It.prototype.find=function(f){return this.filter(f).head()},It.prototype.findLast=function(f){return this.reverse().find(f)},It.prototype.invokeMap=_t(function(f,g){return typeof f=="function"?new It(this):this.map(function(S){return sf(S,f,g)})}),It.prototype.reject=function(f){return this.filter(Ag(Ue(f)))},It.prototype.slice=function(f,g){f=ft(f);var S=this;return S.__filtered__&&(f>0||g<0)?new It(S):(f<0?S=S.takeRight(-f):f&&(S=S.drop(f)),g!==n&&(g=ft(g),S=g<0?S.dropRight(-g):S.take(g-f)),S)},It.prototype.takeRightWhile=function(f){return this.reverse().takeWhile(f).reverse()},It.prototype.toArray=function(){return this.take(Y)},jo(It.prototype,function(f,g){var S=/^(?:filter|find|map|reject)|While$/.test(g),A=/^(?:head|last)$/.test(g),D=z[A?"take"+(g=="last"?"Right":""):g],V=A||/^find/.test(g);D&&(z.prototype[g]=function(){var Z=this.__wrapped__,re=A?[1]:arguments,ue=Z instanceof It,ve=re[0],we=ue||lt(Z),Ce=function(kt){var Nt=D.apply(z,ua([kt],re));return A&&De?Nt[0]:Nt};we&&S&&typeof ve=="function"&&ve.length!=1&&(ue=we=!1);var De=this.__chain__,Ve=!!this.__actions__.length,qe=V&&!De,yt=ue&&!Ve;if(!V&&we){Z=yt?Z:new It(this);var Ye=f.apply(Z,re);return Ye.__actions__.push({func:Rg,args:[Ce],thisArg:n}),new Xi(Ye,De)}return qe&&yt?f.apply(this,re):(Ye=this.thru(Ce),qe?A?Ye.value()[0]:Ye.value():Ye)})}),Yi(["pop","push","shift","sort","splice","unshift"],function(f){var g=Zp[f],S=/^(?:push|sort|unshift)$/.test(f)?"tap":"thru",A=/^(?:pop|shift)$/.test(f);z.prototype[f]=function(){var D=arguments;if(A&&!this.__chain__){var V=this.value();return g.apply(lt(V)?V:[],D)}return this[S](function(Z){return g.apply(lt(Z)?Z:[],D)})}}),jo(It.prototype,function(f,g){var S=z[g];if(S){var A=S.name+"";rn.call(eu,A)||(eu[A]=[]),eu[A].push({name:g,func:S})}}),eu[vg(n,x).name]=[{name:"wrapper",func:n}],It.prototype.clone=YH,It.prototype.reverse=KH,It.prototype.value=XH,z.prototype.at=EU,z.prototype.chain=RU,z.prototype.commit=PU,z.prototype.next=TU,z.prototype.plant=AU,z.prototype.reverse=OU,z.prototype.toJSON=z.prototype.valueOf=z.prototype.value=MU,z.prototype.first=z.prototype.head,Zd&&(z.prototype[Zd]=kU),z},Qc=PH();fl?((fl.exports=Qc)._=Qc,rv._=Qc):fr._=Qc}).call(Pa)})(hb,hb.exports);var zf=hb.exports;const tc=Ic(zf);function gk({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 K_.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 mk(e,t){if(!t)return;const n={...t};return K_.forEach(r=>{n[r]&&(n[r]=n[r].filter(i=>i.i!==e))}),n}function J_(e){return ye.getState().dashboard.globalCacheConfig}const ye=lN()(gN((e,t)=>({isSessionExpired:!1,currentBreakpoint:"lg",dashboard:{id:"",style:fb},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:fb},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})},setIsDownloadingPdf:n=>{e(r=>{r.isDownloadingPdf=n})},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(y=>y.id===b.filterId));r.filterValues=(c=r.filterValues)==null?void 0:c.filter(b=>!(m!=null&&m.some(y=>y.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=>{K_.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})},addToAIScope:n=>{e(r=>{const{connectionId:i,connectionType:o,databaseName:s,schemaName:a,tableName:l,datamodelName:c}=n,u={connectionId:i||"",connectionType:o||"",databaseName:s||"",schemaName:a||"",tableName:l||"",datamodelName:c||""};let p=[...r.dashboard.aiScopeTables||[],u];p=p.filter((h,m,b)=>b.findIndex(y=>y.tableName===h.tableName&&y.datamodelName===h.datamodelName)===m),r.dashboard.aiScopeTables=p})},removeFromAIScope:n=>{e(r=>{const{connectionId:i,tableName:o,datamodelName:s}=n,a=r.dashboard.aiScopeTables||[];if(s){const l=a.filter(c=>!(c.datamodelName===s&&c.connectionId===i));r.dashboard.aiScopeTables=l}else if(o){const l=a.filter(c=>!(c.tableName===o&&c.connectionId===i));r.dashboard.aiScopeTables=l}})},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&&zf.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&&zf.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&&zf.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&&zf.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})},removeFilterValues: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=>{gk({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=mk(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))}})},updateFilterId:(n,r)=>{e(i=>{var a,l;const o=(a=i.dashboard.filters)==null?void 0:a.find(c=>c.id===n),s=(l=i.dashboard.filters)==null?void 0:l.some(c=>c.id===r);o&&!s&&(o.id=r)})},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=gk({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),mk(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)=>{rX({card:n,dataPoint:r,set:e,get:t})}}}))),Vn=()=>ye(e=>e.actions);async function iX(e,t){const n=t.slice(0,16),r=new TextEncoder,i=await window.crypto.subtle.importKey("raw",r.encode(n),{name:"PBKDF2"},!1,["deriveKey"]),o=await window.crypto.subtle.deriveKey({name:"PBKDF2",salt:r.encode(n),iterations:1e5,hash:"SHA-256"},i,{name:"AES-GCM",length:256},!1,["encrypt"]),s=window.crypto.getRandomValues(new Uint8Array(12)),a=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:s},o,r.encode(e)),l=new Uint8Array(s.length+a.byteLength);return l.set(s,0),l.set(new Uint8Array(a),s.length),{payload:btoa(String.fromCharCode(...l))}}async function xN(e,t){const n=t.slice(0,16),r=new TextEncoder,i=new TextDecoder,o=await window.crypto.subtle.importKey("raw",r.encode(n),{name:"PBKDF2"},!1,["deriveKey"]),s=await window.crypto.subtle.deriveKey({name:"PBKDF2",salt:r.encode(n),iterations:1e5,hash:"SHA-256"},o,{name:"AES-GCM",length:256},!1,["decrypt"]),a=Uint8Array.from(atob(e),p=>p.charCodeAt(0)),l=a.slice(0,12),c=a.slice(a.length-16),u=a.slice(12,a.length-16),d=new Uint8Array(u.length+c.length);d.set(u),d.set(c,u.length);try{const p=await window.crypto.subtle.decrypt({name:"AES-GCM",iv:l},s,d);return{decryptedData:i.decode(p)}}catch(p){throw new Error(`Decryption failed: ${p}`)}}function be(...e){return bK(id(e))}const oX=e=>Object.keys(e).length===0;async function sX(e,t,n={}){try{const r=new URLSearchParams(n).toString(),i=`${e}?${r}`,o=await fetch(i,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});if(!o.ok){const a=await o.json();throw new Error((a==null?void 0:a.error)||`HTTP error! status: ${o.status}`)}return await o.json()}catch(r){throw console.error("Error during fetch:",r),r}}async function Cy(e,t,n={}){try{const r=JSON.stringify(n),i=await iX(r,t),o=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(i)});if(!o.ok)return o.json().then(a=>{throw console.log(a.detail||"Unknown error occurred"),new Error((a==null?void 0:a.error)||`HTTP error! status: ${o.status}`)});const s=await o.json();if(s.payload){const a=await xN(s.payload,t);return JSON.parse(a.decryptedData)}return s}catch(r){throw console.error("Error during fetch:",r),r}}function aX(e){if(!e)return{tenantId:"",endUserId:""};const t=H_(e);return{tenantId:t==null?void 0:t.tenantId,endUserId:t==null?void 0:t.endUserId}}function lX(e){if(!e)return;const t=H_(e);if(t.params&&t.params.currencyFormat)return t.params.currencyFormat}function wN(e){return e?H_(e).params:void 0}function cX(e){return e.charAt(0).toUpperCase()+e.slice(1)}const ih="focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0";async function uX(){var i,o;const e=(o=(i=ye.getState())==null?void 0:i.authToken)==null?void 0:o.accessToken;if(!e)return;const n=await fetch("https://semaphor.cloud/api/v1/invalidate-token",{method:"POST",headers:{Authorization:`Bearer ${e}`}});if(!n.ok)throw new Error("Failed to invalidate token");const r=await n.json();return console.log("invalidateToken",r),r}async function dX(e,t={}){if(!e)return null;let n="https://semaphor.cloud/api/v1/dashboard";const r=Object.fromEntries(Object.entries(t).filter(([a,l])=>l!==void 0)),i=new URLSearchParams(r).toString();i&&(n+=`?${i}`);let s=await(await fetch(n,{headers:{Authorization:`Bearer ${e}`}})).json();if("payload"in s){const a=await xN(atob(s.payload),e);s=JSON.parse(a.decryptedData)}return s}async function fX(e){return e?await(await fetch("https://semaphor.cloud/api/v1/plugins",{headers:{Authorization:`Bearer ${e}`}})).json():null}const hX={theme:"system",setTheme:()=>null},SN=k.createContext(hX);function pX({children:e,defaultTheme:t="system",storageKey:n="vite-ui-theme",...r}){const[i,o]=k.useState(()=>localStorage.getItem(n)||t);k.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 v.jsx(SN.Provider,{...r,value:s,children:e})}const _N=()=>{const e=k.useContext(SN);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e};var fp=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(){}},vc=typeof window>"u"||"Deno"in globalThis;function ro(){}function gX(e,t){return typeof e=="function"?e(t):e}function S1(e){return typeof e=="number"&&e>=0&&e!==1/0}function CN(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Mu(e,t){return typeof e=="function"?e(t):e}function Eo(e,t){return typeof e=="function"?e(t):e}function bk(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:o,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==eC(s,t.options))return!1}else if(!kh(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 yk(e,t){const{exact:n,status:r,predicate:i,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(Th(t.options.mutationKey)!==Th(o))return!1}else if(!kh(t.options.mutationKey,o))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function eC(e,t){return((t==null?void 0:t.queryKeyHashFn)||Th)(e)}function Th(e){return JSON.stringify(e,(t,n)=>E1(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function kh(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!kh(e[n],t[n])):!1}function _1(e,t){if(e===t)return e;const n=vk(e)&&vk(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 vk(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function E1(e){if(!xk(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!xk(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function xk(e){return Object.prototype.toString.call(e)==="[object Object]"}function mX(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 bX(e){return e}function yX(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function vX(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var pb=Symbol();function EN(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===pb&&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===pb?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var Yl,ka,Uu,GD,xX=(GD=class extends fp{constructor(){super();et(this,Yl);et(this,ka);et(this,Uu);ze(this,Uu,t=>{if(!vc&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){ae(this,ka)||this.setEventListener(ae(this,Uu))}onUnsubscribe(){var t;this.hasListeners()||((t=ae(this,ka))==null||t.call(this),ze(this,ka,void 0))}setEventListener(t){var n;ze(this,Uu,t),(n=ae(this,ka))==null||n.call(this),ze(this,ka,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){ae(this,Yl)!==t&&(ze(this,Yl,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof ae(this,Yl)=="boolean"?ae(this,Yl):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Yl=new WeakMap,ka=new WeakMap,Uu=new WeakMap,GD),tC=new xX,Gu,Aa,qu,qD,wX=(qD=class extends fp{constructor(){super();et(this,Gu,!0);et(this,Aa);et(this,qu);ze(this,qu,t=>{if(!vc&&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(){ae(this,Aa)||this.setEventListener(ae(this,qu))}onUnsubscribe(){var t;this.hasListeners()||((t=ae(this,Aa))==null||t.call(this),ze(this,Aa,void 0))}setEventListener(t){var n;ze(this,qu,t),(n=ae(this,Aa))==null||n.call(this),ze(this,Aa,t(this.setOnline.bind(this)))}setOnline(t){ae(this,Gu)!==t&&(ze(this,Gu,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return ae(this,Gu)}},Gu=new WeakMap,Aa=new WeakMap,qu=new WeakMap,qD),gb=new wX;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 SX(e){return Math.min(1e3*2**e,3e4)}function RN(e){return(e??"online")==="online"?gb.isOnline():!0}var PN=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function bx(e){return e instanceof PN}function TN(e){let t=!1,n=0,r=!1,i;const o=P1(),s=b=>{var y;r||(p(new PN(b)),(y=e.abort)==null||y.call(e))},a=()=>{t=!0},l=()=>{t=!1},c=()=>tC.isFocused()&&(e.networkMode==="always"||gb.isOnline())&&e.canRun(),u=()=>RN(e.networkMode)&&e.canRun(),d=b=>{var y;r||(r=!0,(y=e.onSuccess)==null||y.call(e,b),i==null||i(),o.resolve(b))},p=b=>{var y;r||(r=!0,(y=e.onError)==null||y.call(e,b),i==null||i(),o.reject(b))},h=()=>new Promise(b=>{var y;i=x=>{(r||c())&&b(x)},(y=e.onPause)==null||y.call(e)}).then(()=>{var b;i=void 0,r||(b=e.onContinue)==null||b.call(e)}),m=()=>{if(r)return;let b;const y=n===0?e.initialPromise:void 0;try{b=y??e.fn()}catch(x){b=Promise.reject(x)}Promise.resolve(b).then(d).catch(x=>{var R;if(r)return;const w=e.retry??(vc?0:3),_=e.retryDelay??SX,E=typeof _=="function"?_(n,x):_,C=w===!0||typeof w=="number"&&n<w||typeof w=="function"&&w(n,x);if(t||!C){p(x);return}n++,(R=e.onFail)==null||R.call(e,n,x),mX(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 _X(){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 mr=_X(),Kl,YD,kN=(YD=class{constructor(){et(this,Kl)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),S1(this.gcTime)&&ze(this,Kl,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(vc?1/0:5*60*1e3))}clearGcTimeout(){ae(this,Kl)&&(clearTimeout(ae(this,Kl)),ze(this,Kl,void 0))}},Kl=new WeakMap,YD),Yu,Ku,no,Pr,ap,Xl,_o,Ls,KD,CX=(KD=class extends kN{constructor(t){super();et(this,_o);et(this,Yu);et(this,Ku);et(this,no);et(this,Pr);et(this,ap);et(this,Xl);ze(this,Xl,!1),ze(this,ap,t.defaultOptions),this.setOptions(t.options),this.observers=[],ze(this,no,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ze(this,Yu,EX(this.options)),this.state=t.state??ae(this,Yu),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=ae(this,Pr))==null?void 0:t.promise}setOptions(t){this.options={...ae(this,ap),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&ae(this,no).remove(this)}setData(t,n){const r=R1(this.state.data,t,this.options);return Lt(this,_o,Ls).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){Lt(this,_o,Ls).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,i;const n=(r=ae(this,Pr))==null?void 0:r.promise;return(i=ae(this,Pr))==null||i.cancel(t),n?n.then(ro).catch(ro):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(ae(this,Yu))}isActive(){return this.observers.some(t=>Eo(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===pb||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||!CN(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=ae(this,Pr))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=ae(this,Pr))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),ae(this,no).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(ae(this,Pr)&&(ae(this,Xl)?ae(this,Pr).cancel({revert:!0}):ae(this,Pr).cancelRetry()),this.scheduleGc()),ae(this,no).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Lt(this,_o,Ls).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(ae(this,Pr))return ae(this,Pr).continueRetry(),ae(this,Pr).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:()=>(ze(this,Xl,!0),r.signal)})},o=()=>{const d=EN(this.options,n),p={queryKey:this.queryKey,meta:this.meta};return i(p),ze(this,Xl,!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),ze(this,Ku,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((c=s.fetchOptions)==null?void 0:c.meta))&&Lt(this,_o,Ls).call(this,{type:"fetch",meta:(u=s.fetchOptions)==null?void 0:u.meta});const a=d=>{var p,h,m,b;bx(d)&&d.silent||Lt(this,_o,Ls).call(this,{type:"error",error:d}),bx(d)||((h=(p=ae(this,no).config).onError)==null||h.call(p,d,this),(b=(m=ae(this,no).config).onSettled)==null||b.call(m,this.state.data,d,this)),this.scheduleGc()};return ze(this,Pr,TN({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(y){a(y);return}(h=(p=ae(this,no).config).onSuccess)==null||h.call(p,d,this),(b=(m=ae(this,no).config).onSettled)==null||b.call(m,d,this.state.error,this),this.scheduleGc()},onError:a,onFail:(d,p)=>{Lt(this,_o,Ls).call(this,{type:"failed",failureCount:d,error:p})},onPause:()=>{Lt(this,_o,Ls).call(this,{type:"pause"})},onContinue:()=>{Lt(this,_o,Ls).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),ae(this,Pr).start()}},Yu=new WeakMap,Ku=new WeakMap,no=new WeakMap,Pr=new WeakMap,ap=new WeakMap,Xl=new WeakMap,_o=new WeakSet,Ls=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,...AN(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 bx(i)&&i.revert&&ae(this,Ku)?{...ae(this,Ku),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),mr.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),ae(this,no).notify({query:this,type:"updated",action:t})})},KD);function AN(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:RN(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function EX(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 Go,XD,ON=(XD=class extends fp{constructor(t={}){super();et(this,Go);this.config=t,ze(this,Go,new Map)}build(t,n,r){const i=n.queryKey,o=n.queryHash??eC(i,n);let s=this.get(o);return s||(s=new CX({cache:this,queryKey:i,queryHash:o,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(i)}),this.add(s)),s}add(t){ae(this,Go).has(t.queryHash)||(ae(this,Go).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=ae(this,Go).get(t.queryHash);n&&(t.destroy(),n===t&&ae(this,Go).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){mr.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return ae(this,Go).get(t)}getAll(){return[...ae(this,Go).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>bk(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>bk(t,r)):n}notify(t){mr.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){mr.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){mr.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Go=new WeakMap,XD),qo,Vr,Ql,Yo,Ca,QD,RX=(QD=class extends kN{constructor(t){super();et(this,Yo);et(this,qo);et(this,Vr);et(this,Ql);this.mutationId=t.mutationId,ze(this,Vr,t.mutationCache),ze(this,qo,[]),this.state=t.state||PX(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){ae(this,qo).includes(t)||(ae(this,qo).push(t),this.clearGcTimeout(),ae(this,Vr).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ze(this,qo,ae(this,qo).filter(n=>n!==t)),this.scheduleGc(),ae(this,Vr).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){ae(this,qo).length||(this.state.status==="pending"?this.scheduleGc():ae(this,Vr).remove(this))}continue(){var t;return((t=ae(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,y,x,w,_,E,C,R,T;ze(this,Ql,TN({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(M,L)=>{Lt(this,Yo,Ca).call(this,{type:"failed",failureCount:M,error:L})},onPause:()=>{Lt(this,Yo,Ca).call(this,{type:"pause"})},onContinue:()=>{Lt(this,Yo,Ca).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>ae(this,Vr).canRun(this)}));const n=this.state.status==="pending",r=!ae(this,Ql).canStart();try{if(!n){Lt(this,Yo,Ca).call(this,{type:"pending",variables:t,isPaused:r}),await((o=(i=ae(this,Vr).config).onMutate)==null?void 0:o.call(i,t,this));const L=await((a=(s=this.options).onMutate)==null?void 0:a.call(s,t));L!==this.state.context&&Lt(this,Yo,Ca).call(this,{type:"pending",context:L,variables:t,isPaused:r})}const M=await ae(this,Ql).start();return await((c=(l=ae(this,Vr).config).onSuccess)==null?void 0:c.call(l,M,t,this.state.context,this)),await((d=(u=this.options).onSuccess)==null?void 0:d.call(u,M,t,this.state.context)),await((h=(p=ae(this,Vr).config).onSettled)==null?void 0:h.call(p,M,null,this.state.variables,this.state.context,this)),await((b=(m=this.options).onSettled)==null?void 0:b.call(m,M,null,t,this.state.context)),Lt(this,Yo,Ca).call(this,{type:"success",data:M}),M}catch(M){try{throw await((x=(y=ae(this,Vr).config).onError)==null?void 0:x.call(y,M,t,this.state.context,this)),await((_=(w=this.options).onError)==null?void 0:_.call(w,M,t,this.state.context)),await((C=(E=ae(this,Vr).config).onSettled)==null?void 0:C.call(E,void 0,M,this.state.variables,this.state.context,this)),await((T=(R=this.options).onSettled)==null?void 0:T.call(R,void 0,M,t,this.state.context)),M}finally{Lt(this,Yo,Ca).call(this,{type:"error",error:M})}}finally{ae(this,Vr).runNext(this)}}},qo=new WeakMap,Vr=new WeakMap,Ql=new WeakMap,Yo=new WeakSet,Ca=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),mr.batch(()=>{ae(this,qo).forEach(r=>{r.onMutationUpdate(t)}),ae(this,Vr).notify({mutation:this,type:"updated",action:t})})},QD);function PX(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Vs,Co,lp,ZD,TX=(ZD=class extends fp{constructor(t={}){super();et(this,Vs);et(this,Co);et(this,lp);this.config=t,ze(this,Vs,new Set),ze(this,Co,new Map),ze(this,lp,0)}build(t,n,r){const i=new RX({mutationCache:this,mutationId:++Dg(this,lp)._,options:t.defaultMutationOptions(n),state:r});return this.add(i),i}add(t){ae(this,Vs).add(t);const n=Fg(t);if(typeof n=="string"){const r=ae(this,Co).get(n);r?r.push(t):ae(this,Co).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(ae(this,Vs).delete(t)){const n=Fg(t);if(typeof n=="string"){const r=ae(this,Co).get(n);if(r)if(r.length>1){const i=r.indexOf(t);i!==-1&&r.splice(i,1)}else r[0]===t&&ae(this,Co).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Fg(t);if(typeof n=="string"){const r=ae(this,Co).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=Fg(t);if(typeof n=="string"){const i=(r=ae(this,Co).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(){mr.batch(()=>{ae(this,Vs).forEach(t=>{this.notify({type:"removed",mutation:t})}),ae(this,Vs).clear(),ae(this,Co).clear()})}getAll(){return Array.from(ae(this,Vs))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>yk(n,r))}findAll(t={}){return this.getAll().filter(n=>yk(t,n))}notify(t){mr.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return mr.batch(()=>Promise.all(t.map(n=>n.continue().catch(ro))))}},Vs=new WeakMap,Co=new WeakMap,lp=new WeakMap,ZD);function Fg(e){var t;return(t=e.options.scope)==null?void 0:t.id}function wk(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 y=_=>{Object.defineProperty(_,"signal",{enumerable:!0,get:()=>(t.signal.aborted?b=!0:t.signal.addEventListener("abort",()=>{b=!0}),t.signal)})},x=EN(t.options,t.fetchOptions),w=async(_,E,C)=>{if(b)return Promise.reject();if(E==null&&_.pages.length)return Promise.resolve(_);const R={queryKey:t.queryKey,pageParam:E,direction:C?"backward":"forward",meta:t.options.meta};y(R);const T=await x(R),{maxPages:M}=t.options,L=C?vX:yX;return{pages:L(_.pages,T,M),pageParams:L(_.pageParams,E,M)}};if(i&&o.length){const _=i==="backward",E=_?kX:Sk,C={pages:o,pageParams:s},R=E(r,C);a=await w(C,R,_)}else{const _=e??o.length;do{const E=l===0?s[0]??r.initialPageParam:Sk(r,a);if(l>0&&E==null)break;a=await w(a,E),l++}while(l<_)}return a};t.options.persister?t.fetchFn=()=>{var b,y;return(y=(b=t.options).persister)==null?void 0:y.call(b,c,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=c}}}function Sk(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 kX(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 In,Oa,Ma,Xu,Qu,Ia,Zu,Ju,JD,AX=(JD=class{constructor(e={}){et(this,In);et(this,Oa);et(this,Ma);et(this,Xu);et(this,Qu);et(this,Ia);et(this,Zu);et(this,Ju);ze(this,In,e.queryCache||new ON),ze(this,Oa,e.mutationCache||new TX),ze(this,Ma,e.defaultOptions||{}),ze(this,Xu,new Map),ze(this,Qu,new Map),ze(this,Ia,0)}mount(){Dg(this,Ia)._++,ae(this,Ia)===1&&(ze(this,Zu,tC.subscribe(async e=>{e&&(await this.resumePausedMutations(),ae(this,In).onFocus())})),ze(this,Ju,gb.subscribe(async e=>{e&&(await this.resumePausedMutations(),ae(this,In).onOnline())})))}unmount(){var e,t;Dg(this,Ia)._--,ae(this,Ia)===0&&((e=ae(this,Zu))==null||e.call(this),ze(this,Zu,void 0),(t=ae(this,Ju))==null||t.call(this),ze(this,Ju,void 0))}isFetching(e){return ae(this,In).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return ae(this,Oa).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=ae(this,In).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=ae(this,In).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Mu(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return ae(this,In).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=ae(this,In).get(r.queryHash),o=i==null?void 0:i.state.data,s=gX(t,o);if(s!==void 0)return ae(this,In).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return mr.batch(()=>ae(this,In).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=ae(this,In).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=ae(this,In);mr.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=ae(this,In),r={type:"active",...e};return mr.batch(()=>(n.findAll(e).forEach(i=>{i.reset()}),this.refetchQueries(r,t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=mr.batch(()=>ae(this,In).findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(ro).catch(ro)}invalidateQueries(e,t={}){return mr.batch(()=>{if(ae(this,In).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=mr.batch(()=>ae(this,In).findAll(e).filter(i=>!i.isDisabled()).map(i=>{let o=i.fetch(void 0,n);return n.throwOnError||(o=o.catch(ro)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(ro)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=ae(this,In).build(this,t);return n.isStaleByTime(Mu(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ro).catch(ro)}fetchInfiniteQuery(e){return e.behavior=wk(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ro).catch(ro)}ensureInfiniteQueryData(e){return e.behavior=wk(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return gb.isOnline()?ae(this,Oa).resumePausedMutations():Promise.resolve()}getQueryCache(){return ae(this,In)}getMutationCache(){return ae(this,Oa)}getDefaultOptions(){return ae(this,Ma)}setDefaultOptions(e){ze(this,Ma,e)}setQueryDefaults(e,t){ae(this,Xu).set(Th(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...ae(this,Xu).values()],n={};return t.forEach(r=>{kh(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){ae(this,Qu).set(Th(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...ae(this,Qu).values()];let n={};return t.forEach(r=>{kh(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...ae(this,Ma).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=eC(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===pb&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...ae(this,Ma).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){ae(this,In).clear(),ae(this,Oa).clear()}},In=new WeakMap,Oa=new WeakMap,Ma=new WeakMap,Xu=new WeakMap,Qu=new WeakMap,Ia=new WeakMap,Zu=new WeakMap,Ju=new WeakMap,JD),di,Ft,cp,Wr,Zl,ed,Da,Ko,up,td,nd,Jl,ec,Na,rd,tn,Bf,T1,k1,A1,O1,M1,I1,D1,MN,eN,OX=(eN=class extends fp{constructor(t,n){super();et(this,tn);et(this,di);et(this,Ft);et(this,cp);et(this,Wr);et(this,Zl);et(this,ed);et(this,Da);et(this,Ko);et(this,up);et(this,td);et(this,nd);et(this,Jl);et(this,ec);et(this,Na);et(this,rd,new Set);this.options=n,ze(this,di,t),ze(this,Ko,null),ze(this,Da,P1()),this.options.experimental_prefetchInRender||ae(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&&(ae(this,Ft).addObserver(this),_k(ae(this,Ft),this.options)?Lt(this,tn,Bf).call(this):this.updateResult(),Lt(this,tn,O1).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return N1(ae(this,Ft),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return N1(ae(this,Ft),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Lt(this,tn,M1).call(this),Lt(this,tn,I1).call(this),ae(this,Ft).removeObserver(this)}setOptions(t,n){const r=this.options,i=ae(this,Ft);if(this.options=ae(this,di).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Eo(this.options.enabled,ae(this,Ft))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Lt(this,tn,D1).call(this),ae(this,Ft).setOptions(this.options),r._defaulted&&!C1(this.options,r)&&ae(this,di).getQueryCache().notify({type:"observerOptionsUpdated",query:ae(this,Ft),observer:this});const o=this.hasListeners();o&&Ck(ae(this,Ft),i,this.options,r)&&Lt(this,tn,Bf).call(this),this.updateResult(n),o&&(ae(this,Ft)!==i||Eo(this.options.enabled,ae(this,Ft))!==Eo(r.enabled,ae(this,Ft))||Mu(this.options.staleTime,ae(this,Ft))!==Mu(r.staleTime,ae(this,Ft)))&&Lt(this,tn,T1).call(this);const s=Lt(this,tn,k1).call(this);o&&(ae(this,Ft)!==i||Eo(this.options.enabled,ae(this,Ft))!==Eo(r.enabled,ae(this,Ft))||s!==ae(this,Na))&&Lt(this,tn,A1).call(this,s)}getOptimisticResult(t){const n=ae(this,di).getQueryCache().build(ae(this,di),t),r=this.createResult(n,t);return IX(this,r)&&(ze(this,Wr,r),ze(this,ed,this.options),ze(this,Zl,ae(this,Ft).state)),r}getCurrentResult(){return ae(this,Wr)}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){ae(this,rd).add(t)}getCurrentQuery(){return ae(this,Ft)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=ae(this,di).defaultQueryOptions(t),r=ae(this,di).getQueryCache().build(ae(this,di),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return Lt(this,tn,Bf).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),ae(this,Wr)))}createResult(t,n){var M;const r=ae(this,Ft),i=this.options,o=ae(this,Wr),s=ae(this,Zl),a=ae(this,ed),c=t!==r?t.state:ae(this,cp),{state:u}=t;let d={...u},p=!1,h;if(n._optimisticResults){const L=this.hasListeners(),j=!L&&_k(t,n),F=L&&Ck(t,r,n,i);(j||F)&&(d={...d,...AN(u.data,t.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:m,errorUpdatedAt:b,status:y}=d;if(n.select&&d.data!==void 0)if(o&&d.data===(s==null?void 0:s.data)&&n.select===ae(this,up))h=ae(this,td);else try{ze(this,up,n.select),h=n.select(d.data),h=R1(o==null?void 0:o.data,h,n),ze(this,td,h),ze(this,Ko,null)}catch(L){ze(this,Ko,L)}else h=d.data;if(n.placeholderData!==void 0&&h===void 0&&y==="pending"){let L;if(o!=null&&o.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData))L=o.data;else if(L=typeof n.placeholderData=="function"?n.placeholderData((M=ae(this,nd))==null?void 0:M.state.data,ae(this,nd)):n.placeholderData,n.select&&L!==void 0)try{L=n.select(L),ze(this,Ko,null)}catch(j){ze(this,Ko,j)}L!==void 0&&(y="success",h=R1(o==null?void 0:o.data,L,n),p=!0)}ae(this,Ko)&&(m=ae(this,Ko),h=ae(this,td),b=Date.now(),y="error");const x=d.fetchStatus==="fetching",w=y==="pending",_=y==="error",E=w&&x,C=h!==void 0,T={status:y,fetchStatus:d.fetchStatus,isPending:w,isSuccess:y==="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&&!w,isLoadingError:_&&!C,isPaused:d.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:_&&C,isStale:nC(t,n),refetch:this.refetch,promise:ae(this,Da)};if(this.options.experimental_prefetchInRender){const L=$=>{T.status==="error"?$.reject(T.error):T.data!==void 0&&$.resolve(T.data)},j=()=>{const $=ze(this,Da,T.promise=P1());L($)},F=ae(this,Da);switch(F.status){case"pending":t.queryHash===r.queryHash&&L(F);break;case"fulfilled":(T.status==="error"||T.data!==F.value)&&j();break;case"rejected":(T.status!=="error"||T.error!==F.reason)&&j();break}}return T}updateResult(t){const n=ae(this,Wr),r=this.createResult(ae(this,Ft),this.options);if(ze(this,Zl,ae(this,Ft).state),ze(this,ed,this.options),ae(this,Zl).data!==void 0&&ze(this,nd,ae(this,Ft)),C1(r,n))return;ze(this,Wr,r);const i={},o=()=>{if(!n)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!ae(this,rd).size)return!0;const l=new Set(a??ae(this,rd));return this.options.throwOnError&&l.add("error"),Object.keys(ae(this,Wr)).some(c=>{const u=c;return ae(this,Wr)[u]!==n[u]&&l.has(u)})};(t==null?void 0:t.listeners)!==!1&&o()&&(i.listeners=!0),Lt(this,tn,MN).call(this,{...i,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Lt(this,tn,O1).call(this)}},di=new WeakMap,Ft=new WeakMap,cp=new WeakMap,Wr=new WeakMap,Zl=new WeakMap,ed=new WeakMap,Da=new WeakMap,Ko=new WeakMap,up=new WeakMap,td=new WeakMap,nd=new WeakMap,Jl=new WeakMap,ec=new WeakMap,Na=new WeakMap,rd=new WeakMap,tn=new WeakSet,Bf=function(t){Lt(this,tn,D1).call(this);let n=ae(this,Ft).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(ro)),n},T1=function(){Lt(this,tn,M1).call(this);const t=Mu(this.options.staleTime,ae(this,Ft));if(vc||ae(this,Wr).isStale||!S1(t))return;const r=CN(ae(this,Wr).dataUpdatedAt,t)+1;ze(this,Jl,setTimeout(()=>{ae(this,Wr).isStale||this.updateResult()},r))},k1=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(ae(this,Ft)):this.options.refetchInterval)??!1},A1=function(t){Lt(this,tn,I1).call(this),ze(this,Na,t),!(vc||Eo(this.options.enabled,ae(this,Ft))===!1||!S1(ae(this,Na))||ae(this,Na)===0)&&ze(this,ec,setInterval(()=>{(this.options.refetchIntervalInBackground||tC.isFocused())&&Lt(this,tn,Bf).call(this)},ae(this,Na)))},O1=function(){Lt(this,tn,T1).call(this),Lt(this,tn,A1).call(this,Lt(this,tn,k1).call(this))},M1=function(){ae(this,Jl)&&(clearTimeout(ae(this,Jl)),ze(this,Jl,void 0))},I1=function(){ae(this,ec)&&(clearInterval(ae(this,ec)),ze(this,ec,void 0))},D1=function(){const t=ae(this,di).getQueryCache().build(ae(this,di),this.options);if(t===ae(this,Ft))return;const n=ae(this,Ft);ze(this,Ft,t),ze(this,cp,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},MN=function(t){mr.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(ae(this,Wr))}),ae(this,di).getQueryCache().notify({query:ae(this,Ft),type:"observerResultsUpdated"})})},eN);function MX(e,t){return Eo(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function _k(e,t){return MX(e,t)||e.state.data!==void 0&&N1(e,t,t.refetchOnMount)}function N1(e,t,n){if(Eo(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&nC(e,t)}return!1}function Ck(e,t,n,r){return(e!==t||Eo(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&nC(e,n)}function nC(e,t){return Eo(t.enabled,e)!==!1&&e.isStaleByTime(Mu(t.staleTime,e))}function IX(e,t){return!C1(e.getCurrentResult(),t)}var rC=P.createContext(void 0),iC=e=>{const t=P.useContext(rC);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},DX=({client:e,children:t})=>(P.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),v.jsx(rC.Provider,{value:e,children:t})),IN=P.createContext(!1),NX=()=>P.useContext(IN);IN.Provider;function LX(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var FX=P.createContext(LX()),jX=()=>P.useContext(FX);function $X(e,t){return typeof e=="function"?e(...t):!!e}function Ek(){}var zX=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},BX=e=>{P.useEffect(()=>{e.clearReset()},[e])},HX=({result:e,errorResetBoundary:t,throwOnError:n,query:r})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&$X(n,[e.error,r]),VX=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)))},WX=(e,t)=>e.isLoading&&e.isFetching&&!t,UX=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Rk=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function GX(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=iC(),i=NX(),o=jX(),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",VX(s),zX(s,o),BX(o);const a=!r.getQueryCache().get(s.queryHash),[l]=P.useState(()=>new t(r,s)),c=l.getOptimisticResult(s),u=!i&&e.subscribed!==!1;if(P.useSyncExternalStore(P.useCallback(y=>{const x=u?l.subscribe(mr.batchCalls(y)):Ek;return l.updateResult(),x},[l,u]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),P.useEffect(()=>{l.setOptions(s,{listeners:!1})},[s,l]),UX(s,c))throw Rk(s,l,o);if(HX({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&&!vc&&WX(c,i)){const y=a?Rk(s,l,o):(b=r.getQueryCache().get(s.queryHash))==null?void 0:b.promise;y==null||y.catch(Ek).finally(()=>{l.updateResult()})}return s.notifyOnChangeProps?c:l.trackResult(c)}function hp(e,t){return GX(e,OX)}function qX(){const e=k.useContext(rC);if(e&&e.isSemaphorClient)return e}function DN({children:e}){const{setIsSessionExpired:t}=Vn(),n=qX(),[r]=k.useState(()=>{const i=new AX({queryCache:new ON({onError:o=>{o instanceof Error?(console.error(`Something went wrong: ${o.message}`),o.message==="invalid token"&&t(!0)):console.error("Something went wrong:",o)}}),defaultOptions:{queries:{gcTime:36e5,staleTime:3e5,refetchOnWindowFocus:!1,retry:1}}});return i.isSemaphorClient=!0,i});return n?v.jsx(v.Fragment,{children:e}):v.jsx(DX,{client:r,children:e})}const Dc=k.forwardRef(({children:e,className:t,...n},r)=>v.jsx("div",{className:be("semaphor-scope",t),ref:r,...n,children:e})),YX={id:"",authToken:void 0},NN=k.createContext(YX),LN=({children:e,dashboardProps:t})=>v.jsx(DN,{children:v.jsx(NN.Provider,{value:t,children:v.jsx(Dc,{style:{height:"100%"},children:e})})});function Wi(){const e=k.useContext(NN);if(e===void 0)throw new Error("useApplicationContext must be used within a ApplicationContextProvider");return e}function KX(){const{authToken:e,version:t}=Wi(),n=ye(a=>a.selectedLensId),{data:r,isLoading:i,isFetching:o,isError:s}=hp({queryKey:["dashboard",n,e==null?void 0:e.accessToken],queryFn:()=>dX(e==null?void 0:e.accessToken,{lensId:n,version:t}),enabled:!!(e!=null&&e.accessToken)});return{data:r,isLoading:i,isFetching:o,isError:s}}function XX(){const{authToken:e}=Wi(),t=ye(r=>r.authToken),{setAuthToken:n}=Vn();return k.useEffect(()=>{e&&(e==null?void 0:e.toString())!==(t==null?void 0:t.toString())&&n(e)},[e,t,n]),e}function FN(e){return e==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e}function Pk(e,t){const n=FN(e);return n==="dark"?tc.merge({...t==null?void 0:t.default},{...t==null?void 0:t.dark}):t==null?void 0:t.default}function QX({customStyle:e,currentTheme:t,onSave:n,onEvent:r,defaultFilterValues:i,onFilterValuesChange:o}){const{authToken:s}=Wi();XX();const a=ye(N=>N.selectedLensId),{data:l,isLoading:c,isFetching:u,isError:d}=KX(),[p,h]=k.useState(i||[]),{theme:m,setTheme:b}=_N(),y=ye(N=>N.dashboard.globalStyle),{setDashboard:x,setDashboardWithFilterValues:w,setSelectedSheetId:_,setStyle:E,setOnSaveFunction:C,setLenses:R,setSelectedLensId:T,setInitStore:M}=Vn();ye(N=>N.actions.setCustomCards);const L=ye(N=>N.actions.setFilterValues),j=ye(N=>N.filterValues),F=ye(N=>N.actions.setThemeStyle),$=ye(N=>N.actions.setDashboardTheme),Q=ye(N=>N.actions.setOnEvent);k.useEffect(()=>{s&&M()},[s,M]),k.useEffect(()=>{if(m){const N=FN(m);$(N)}},[m,$]),k.useEffect(()=>{t&&b(t)},[t,b]);const H=k.useCallback(()=>{const N=tc.cloneDeep(fb),G=tc.merge(N,y);if(e){const B=tc.merge(G,e),W=Pk(m,B);F(W),E(B)}else{const B=Pk(m,G);F(B),E(fb)}},[m,e,y,F,E]);return k.useEffect(()=>{l&&l.dashboard&&H()},[m,e,y,H,l]),k.useEffect(()=>{var Y,U;function N(O,ee){const K=O.filters||[],oe=[];for(const X of ee){const J=K.find(se=>se.id===X.filterId);J&&oe.push({filterId:X.filterId,connectionType:J.database==="NA"?"api":"database",name:J.column,operation:J.operation,valueType:Ou(J),values:X.values})}return oe}if(!l||!l.dashboard)return;const{dashboard:G,filterValues:B,defaultLensId:W,lenses:q}=l,I=N(G,p||[]);w(G,(!B||(B==null?void 0:B.length)===0?I:B)||[]),W&&T(W),q&&R(q),_(((U=(Y=G==null?void 0:G.sheets)==null?void 0:Y[0])==null?void 0:U.id)||null)},[l,x,_,L,a,R,w,T,p]),k.useEffect(()=>{o&&j&&o(j)},[j,o]),k.useEffect(()=>{n&&C(n),r&&Q(r)},[n,C,r,Q]),{isFetching:u,isLoading:c,isError:d}}function Iu({className:e,...t}){return v.jsx("div",{className:be("animate-pulse rounded-md bg-muted",e),...t})}const jN=P.forwardRef(({className:e,...t},n)=>v.jsx("div",{ref:n,className:be("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));jN.displayName="Card";const Ey=P.forwardRef(({className:e,...t},n)=>v.jsx("div",{ref:n,className:be("flex flex-col space-y-1.5 p-6",e),...t}));Ey.displayName="CardHeader";const Od=P.forwardRef(({className:e,...t},n)=>v.jsx("h3",{ref:n,className:be("text-2xl font-semibold leading-none tracking-tight",e),...t}));Od.displayName="CardTitle";const oC=P.forwardRef(({className:e,...t},n)=>v.jsx("p",{ref:n,className:be("text-sm text-muted-foreground",e),...t}));oC.displayName="CardDescription";const Ry=P.forwardRef(({className:e,...t},n)=>v.jsx("div",{ref:n,className:be("px-6 pt-0",e),...t}));Ry.displayName="CardContent";const $N=P.forwardRef(({className:e,...t},n)=>v.jsx("div",{ref:n,className:be("flex items-center p-6 pt-0",e),...t}));$N.displayName="CardFooter";function zN({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}){const{placeholders:y}=Wi(),x=ye(C=>C.themeStyle),w=ye(C=>C.isSessionExpired),{isLoading:_,isError:E}=QX({authToken:l,customStyle:t,currentTheme:c,onSave:n,onEvent:r,defaultFilterValues:h,onFilterValuesChange:m});return _||!l?(r==null||r({type:"info",message:"Loading dashboard"}),i?v.jsx(i,{message:"loading"}):v.jsx("div",{className:"flex items-center gap-3",children:v.jsx(Iu,{className:"h-1 w-full dark:h-[2px]"})})):E?(r==null||r({type:"error",message:"Error fetching dashboard"}),o?(console.log("Error fetching dashboard"),v.jsx(o,{})):v.jsx("div",{children:"Error"})):w?(r==null||r({type:"error",message:"Session Expired"}),y!=null&&y.SessionExpired?v.jsx("div",{className:"flex h-full items-center justify-center",children:v.jsx("div",{children:y.SessionExpired})}):v.jsx("div",{className:"flex h-full items-center justify-center",children:v.jsxs("div",{className:"space-y-4 rounded-md border border-muted p-10",children:[v.jsx(Od,{children:"Session Expired"}),v.jsx("p",{className:"text-muted-foreground",children:"Please refresh your page to continue."})]})})):v.jsx("div",{className:be("flex h-full flex-col justify-between",x==null?void 0:x.dashboardPanel,e),style:{},role:"dashboard-panel",...b})}function Pe(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 ZX(e,t){const n=P.createContext(t),r=o=>{const{children:s,...a}=o,l=P.useMemo(()=>a,Object.values(a));return v.jsx(n.Provider,{value:l,children:s})};r.displayName=e+"Provider";function i(o){const s=P.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 nr(e,t=[]){let n=[];function r(o,s){const a=P.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,y=P.useMemo(()=>m,Object.values(m));return v.jsx(b.Provider,{value:y,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=P.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=>P.createContext(s));return function(a){const l=(a==null?void 0:a[e])||o;return P.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return i.scopeName=e,[r,JX(i,...t)]}function JX(...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 P.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Tk(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Py(...e){return t=>{let n=!1;const r=e.map(i=>{const o=Tk(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():Tk(e[i],null)}}}}function it(...e){return P.useCallback(Py(...e),e)}var ea=P.forwardRef((e,t)=>{const{children:n,...r}=e,i=P.Children.toArray(n),o=i.find(eQ);if(o){const s=o.props.children,a=i.map(l=>l===o?P.Children.count(s)>1?P.Children.only(null):P.isValidElement(s)?s.props.children:null:l);return v.jsx(L1,{...r,ref:t,children:P.isValidElement(s)?P.cloneElement(s,void 0,a):null})}return v.jsx(L1,{...r,ref:t,children:n})});ea.displayName="Slot";var L1=P.forwardRef((e,t)=>{const{children:n,...r}=e;if(P.isValidElement(n)){const i=nQ(n);return P.cloneElement(n,{...tQ(r,n.props),ref:t?Py(t,i):i})}return P.Children.count(n)>1?P.Children.only(null):null});L1.displayName="SlotClone";var sC=({children:e})=>v.jsx(v.Fragment,{children:e});function eQ(e){return P.isValidElement(e)&&e.type===sC}function tQ(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 nQ(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 Ty(e){const t=e+"CollectionProvider",[n,r]=nr(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=h=>{const{scope:m,children:b}=h,y=k.useRef(null),x=k.useRef(new Map).current;return v.jsx(i,{scope:m,itemMap:x,collectionRef:y,children:b})};s.displayName=t;const a=e+"CollectionSlot",l=k.forwardRef((h,m)=>{const{scope:b,children:y}=h,x=o(a,b),w=it(m,x.collectionRef);return v.jsx(ea,{ref:w,children:y})});l.displayName=a;const c=e+"CollectionItemSlot",u="data-radix-collection-item",d=k.forwardRef((h,m)=>{const{scope:b,children:y,...x}=h,w=k.useRef(null),_=it(m,w),E=o(c,b);return k.useEffect(()=>(E.itemMap.set(w,{ref:w,...x}),()=>void E.itemMap.delete(w))),v.jsx(ea,{[u]:"",ref:_,children:y})});d.displayName=c;function p(h){const m=o(e+"CollectionConsumer",h);return k.useCallback(()=>{const y=m.collectionRef.current;if(!y)return[];const x=Array.from(y.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 yr=globalThis!=null&&globalThis.document?P.useLayoutEffect:()=>{},rQ=P.useId||(()=>{}),iQ=0;function Yn(e){const[t,n]=P.useState(rQ());return yr(()=>{e||n(r=>r??String(iQ++))},[e]),e||(t?`radix-${t}`:"")}var oQ=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Le=oQ.reduce((e,t)=>{const n=P.forwardRef((r,i)=>{const{asChild:o,...s}=r,a=o?ea:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),v.jsx(a,{...s,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function BN(e,t){e&&mc.flushSync(()=>e.dispatchEvent(t))}function tr(e){const t=P.useRef(e);return P.useEffect(()=>{t.current=e}),P.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function Dr({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,i]=sQ({defaultProp:t,onChange:n}),o=e!==void 0,s=o?e:r,a=tr(n),l=P.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 sQ({defaultProp:e,onChange:t}){const n=P.useState(e),[r]=n,i=P.useRef(r),o=tr(t);return P.useEffect(()=>{i.current!==r&&(o(r),i.current=r)},[r,i,o]),n}var aQ=P.createContext(void 0);function Nc(e){const t=P.useContext(aQ);return e||t||"ltr"}var yx="rovingFocusGroup.onEntryFocus",lQ={bubbles:!1,cancelable:!0},ky="RovingFocusGroup",[F1,HN,cQ]=Ty(ky),[uQ,Md]=nr(ky,[cQ]),[dQ,fQ]=uQ(ky),VN=P.forwardRef((e,t)=>v.jsx(F1.Provider,{scope:e.__scopeRovingFocusGroup,children:v.jsx(F1.Slot,{scope:e.__scopeRovingFocusGroup,children:v.jsx(hQ,{...e,ref:t})})}));VN.displayName=ky;var hQ=P.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=P.useRef(null),h=it(t,p),m=Nc(o),[b=null,y]=Dr({prop:s,defaultProp:a,onChange:l}),[x,w]=P.useState(!1),_=tr(c),E=HN(n),C=P.useRef(!1),[R,T]=P.useState(0);return P.useEffect(()=>{const M=p.current;if(M)return M.addEventListener(yx,_),()=>M.removeEventListener(yx,_)},[_]),v.jsx(dQ,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:b,onItemFocus:P.useCallback(M=>y(M),[y]),onItemShiftTab:P.useCallback(()=>w(!0),[]),onFocusableItemAdd:P.useCallback(()=>T(M=>M+1),[]),onFocusableItemRemove:P.useCallback(()=>T(M=>M-1),[]),children:v.jsx(Le.div,{tabIndex:x||R===0?-1:0,"data-orientation":r,...d,ref:h,style:{outline:"none",...e.style},onMouseDown:Pe(e.onMouseDown,()=>{C.current=!0}),onFocus:Pe(e.onFocus,M=>{const L=!C.current;if(M.target===M.currentTarget&&L&&!x){const j=new CustomEvent(yx,lQ);if(M.currentTarget.dispatchEvent(j),!j.defaultPrevented){const F=E().filter(G=>G.focusable),$=F.find(G=>G.active),Q=F.find(G=>G.id===b),N=[$,Q,...F].filter(Boolean).map(G=>G.ref.current);GN(N,u)}}C.current=!1}),onBlur:Pe(e.onBlur,()=>w(!1))})})}),WN="RovingFocusGroupItem",UN=P.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,...s}=e,a=Yn(),l=o||a,c=fQ(WN,n),u=c.currentTabStopId===l,d=HN(n),{onFocusableItemAdd:p,onFocusableItemRemove:h}=c;return P.useEffect(()=>{if(r)return p(),()=>h()},[r,p,h]),v.jsx(F1.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:v.jsx(Le.span,{tabIndex:u?0:-1,"data-orientation":c.orientation,...s,ref:t,onMouseDown:Pe(e.onMouseDown,m=>{r?c.onItemFocus(l):m.preventDefault()}),onFocus:Pe(e.onFocus,()=>c.onItemFocus(l)),onKeyDown:Pe(e.onKeyDown,m=>{if(m.key==="Tab"&&m.shiftKey){c.onItemShiftTab();return}if(m.target!==m.currentTarget)return;const b=mQ(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(w=>w.focusable).map(w=>w.ref.current);if(b==="last")x.reverse();else if(b==="prev"||b==="next"){b==="prev"&&x.reverse();const w=x.indexOf(m.currentTarget);x=c.loop?bQ(x,w+1):x.slice(w+1)}setTimeout(()=>GN(x))}})})})});UN.displayName=WN;var pQ={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function gQ(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function mQ(e,t,n){const r=gQ(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return pQ[r]}function GN(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function bQ(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var aC=VN,lC=UN;function yQ(e,t){return P.useReducer((n,r)=>t[n][r]??n,e)}var Kn=e=>{const{present:t,children:n}=e,r=vQ(t),i=typeof n=="function"?n({present:r.isPresent}):P.Children.only(n),o=it(r.ref,xQ(i));return typeof n=="function"||r.isPresent?P.cloneElement(i,{ref:o}):null};Kn.displayName="Presence";function vQ(e){const[t,n]=P.useState(),r=P.useRef({}),i=P.useRef(e),o=P.useRef("none"),s=e?"mounted":"unmounted",[a,l]=yQ(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return P.useEffect(()=>{const c=jg(r.current);o.current=a==="mounted"?c:"none"},[a]),yr(()=>{const c=r.current,u=i.current;if(u!==e){const p=o.current,h=jg(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]),yr(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,d=h=>{const b=jg(r.current).includes(h.animationName);if(h.target===t&&b&&(l("ANIMATION_END"),!i.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},p=h=>{h.target===t&&(o.current=jg(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:P.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function jg(e){return(e==null?void 0:e.animationName)||"none"}function xQ(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 cC="Tabs",[wQ,OAe]=nr(cC,[Md]),qN=Md(),[SQ,uC]=wQ(cC),YN=P.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:s="horizontal",dir:a,activationMode:l="automatic",...c}=e,u=Nc(a),[d,p]=Dr({prop:r,onChange:i,defaultProp:o});return v.jsx(SQ,{scope:n,baseId:Yn(),value:d,onValueChange:p,orientation:s,dir:u,activationMode:l,children:v.jsx(Le.div,{dir:u,"data-orientation":s,...c,ref:t})})});YN.displayName=cC;var KN="TabsList",XN=P.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,o=uC(KN,n),s=qN(n);return v.jsx(aC,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:r,children:v.jsx(Le.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:t})})});XN.displayName=KN;var QN="TabsTrigger",ZN=P.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...o}=e,s=uC(QN,n),a=qN(n),l=t5(s.baseId,r),c=n5(s.baseId,r),u=r===s.value;return v.jsx(lC,{asChild:!0,...a,focusable:!i,active:u,children:v.jsx(Le.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:Pe(e.onMouseDown,d=>{!i&&d.button===0&&d.ctrlKey===!1?s.onValueChange(r):d.preventDefault()}),onKeyDown:Pe(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&s.onValueChange(r)}),onFocus:Pe(e.onFocus,()=>{const d=s.activationMode!=="manual";!u&&!i&&d&&s.onValueChange(r)})})})});ZN.displayName=QN;var JN="TabsContent",e5=P.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:o,...s}=e,a=uC(JN,n),l=t5(a.baseId,r),c=n5(a.baseId,r),u=r===a.value,d=P.useRef(u);return P.useEffect(()=>{const p=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(p)},[]),v.jsx(Kn,{present:i||u,children:({present:p})=>v.jsx(Le.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})})});e5.displayName=JN;function t5(e,t){return`${e}-trigger-${t}`}function n5(e,t){return`${e}-content-${t}`}var _Q=YN,r5=XN,i5=ZN,o5=e5;const dC=_Q,Ay=P.forwardRef(({className:e,...t},n)=>v.jsx(r5,{ref:n,className:be("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Ay.displayName=r5.displayName;const Oy=P.forwardRef(({className:e,...t},n)=>v.jsx(i5,{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}));Oy.displayName=i5.displayName;const fC=P.forwardRef(({className:e,...t},n)=>v.jsx(o5,{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}));fC.displayName=o5.displayName;var s5={exports:{}},pp={},j1={exports:{}};(function(e,t){(function(n,r){r(t)})(Pa,function(n){function r(J){return function(le,ge,ie,pe,he,Re,Oe){return J(le,ge,Oe)}}function i(J){return function(le,ge,ie,pe){if(!le||!ge||typeof le!="object"||typeof ge!="object")return J(le,ge,ie,pe);var he=pe.get(le),Re=pe.get(ge);if(he&&Re)return he===ge&&Re===le;pe.set(le,ge),pe.set(ge,le);var Oe=J(le,ge,ie,pe);return pe.delete(le),pe.delete(ge),Oe}}function o(J,se){var le={};for(var ge in J)le[ge]=J[ge];for(var ge in se)le[ge]=se[ge];return le}function s(J){return J.constructor===Object||J.constructor==null}function a(J){return typeof J.then=="function"}function l(J,se){return J===se||J!==J&&se!==se}var c="[object Arguments]",u="[object Boolean]",d="[object Date]",p="[object RegExp]",h="[object Map]",m="[object Number]",b="[object Object]",y="[object Set]",x="[object String]",w=Object.prototype.toString;function _(J){var se=J.areArraysEqual,le=J.areDatesEqual,ge=J.areMapsEqual,ie=J.areObjectsEqual,pe=J.areRegExpsEqual,he=J.areSetsEqual,Re=J.createIsNestedEqual,Oe=Re(Fe);function Fe(ke,Be,dt){if(ke===Be)return!0;if(!ke||!Be||typeof ke!="object"||typeof Be!="object")return ke!==ke&&Be!==Be;if(s(ke)&&s(Be))return ie(ke,Be,Oe,dt);var Ct=Array.isArray(ke),an=Array.isArray(Be);if(Ct||an)return Ct===an&&se(ke,Be,Oe,dt);var mt=w.call(ke);return mt!==w.call(Be)?!1:mt===d?le(ke,Be,Oe,dt):mt===p?pe(ke,Be,Oe,dt):mt===h?ge(ke,Be,Oe,dt):mt===y?he(ke,Be,Oe,dt):mt===b||mt===c?a(ke)||a(Be)?!1:ie(ke,Be,Oe,dt):mt===u||mt===m||mt===x?l(ke.valueOf(),Be.valueOf()):!1}return Fe}function E(J,se,le,ge){var ie=J.length;if(se.length!==ie)return!1;for(;ie-- >0;)if(!le(J[ie],se[ie],ie,ie,J,se,ge))return!1;return!0}var C=i(E);function R(J,se){return l(J.valueOf(),se.valueOf())}function T(J,se,le,ge){var ie=J.size===se.size;if(!ie)return!1;if(!J.size)return!0;var pe={},he=0;return J.forEach(function(Re,Oe){if(ie){var Fe=!1,ke=0;se.forEach(function(Be,dt){!Fe&&!pe[ke]&&(Fe=le(Oe,dt,he,ke,J,se,ge)&&le(Re,Be,Oe,dt,J,se,ge))&&(pe[ke]=!0),ke++}),he++,ie=Fe}}),ie}var M=i(T),L="_owner",j=Object.prototype.hasOwnProperty;function F(J,se,le,ge){var ie=Object.keys(J),pe=ie.length;if(Object.keys(se).length!==pe)return!1;for(var he;pe-- >0;){if(he=ie[pe],he===L){var Re=!!J.$$typeof,Oe=!!se.$$typeof;if((Re||Oe)&&Re!==Oe)return!1}if(!j.call(se,he)||!le(J[he],se[he],he,he,J,se,ge))return!1}return!0}var $=i(F);function Q(J,se){return J.source===se.source&&J.flags===se.flags}function H(J,se,le,ge){var ie=J.size===se.size;if(!ie)return!1;if(!J.size)return!0;var pe={};return J.forEach(function(he,Re){if(ie){var Oe=!1,Fe=0;se.forEach(function(ke,Be){!Oe&&!pe[Fe]&&(Oe=le(he,ke,Re,Be,J,se,ge))&&(pe[Fe]=!0),Fe++}),ie=Oe}}),ie}var N=i(H),G=Object.freeze({areArraysEqual:E,areDatesEqual:R,areMapsEqual:T,areObjectsEqual:F,areRegExpsEqual:Q,areSetsEqual:H,createIsNestedEqual:r}),B=Object.freeze({areArraysEqual:C,areDatesEqual:R,areMapsEqual:M,areObjectsEqual:$,areRegExpsEqual:Q,areSetsEqual:N,createIsNestedEqual:r}),W=_(G);function q(J,se){return W(J,se,void 0)}var I=_(o(G,{createIsNestedEqual:function(){return l}}));function Y(J,se){return I(J,se,void 0)}var U=_(B);function O(J,se){return U(J,se,new WeakMap)}var ee=_(o(B,{createIsNestedEqual:function(){return l}}));function K(J,se){return ee(J,se,new WeakMap)}function oe(J){return _(o(G,J(G)))}function X(J){var se=_(o(B,J(B)));return function(le,ge,ie){return ie===void 0&&(ie=new WeakMap),se(le,ge,ie)}}n.circularDeepEqual=O,n.circularShallowEqual=K,n.createCustomCircularEqual=X,n.createCustomEqual=oe,n.deepEqual=q,n.sameValueZeroEqual=l,n.shallowEqual=Y,Object.defineProperty(n,"__esModule",{value:!0})})})(j1,j1.exports);var hC=j1.exports;const pC=z_($Y);var Pt={},CQ=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(Pt,"__esModule",{value:!0});Pt.bottom=gC;Pt.childrenEqual=TQ;Pt.cloneLayout=a5;Pt.cloneLayoutItem=nc;Pt.collides=My;Pt.compact=c5;Pt.compactItem=u5;Pt.compactType=BQ;Pt.correctBounds=d5;Pt.fastPositionEqual=kQ;Pt.fastRGLPropsEqual=void 0;Pt.getAllCollisions=f5;Pt.getFirstCollision=zl;Pt.getLayoutItem=mC;Pt.getStatics=bC;Pt.modifyLayout=l5;Pt.moveElement=Vf;Pt.moveElementAwayFromCollision=z1;Pt.noop=void 0;Pt.perc=OQ;Pt.resizeItemInDirection=FQ;Pt.setTopLeft=$Q;Pt.setTransform=jQ;Pt.sortLayoutItems=_C;Pt.sortLayoutItemsByColRow=b5;Pt.sortLayoutItemsByRowCol=m5;Pt.synchronizeLayoutWithChildren=zQ;Pt.validateLayout=y5;Pt.withLayoutItem=PQ;var kk=hC,Hf=EQ(k);function EQ(e){return e&&e.__esModule?e:{default:e}}const RQ=process.env.NODE_ENV==="production";function gC(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 a5(e){const t=Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=nc(e[n]);return t}function l5(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 PQ(e,t,n){let r=mC(e,t);return r?(r=n(nc(r)),e=l5(e,r),[e,r]):[e,null]}function nc(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 TQ(e,t){return(0,kk.deepEqual)(Hf.default.Children.map(e,n=>n==null?void 0:n.key),Hf.default.Children.map(t,n=>n==null?void 0:n.key))&&(0,kk.deepEqual)(Hf.default.Children.map(e,n=>n==null?void 0:n.props["data-grid"]),Hf.default.Children.map(t,n=>n==null?void 0:n.props["data-grid"]))}Pt.fastRGLPropsEqual=CQ;function kQ(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function My(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 c5(e,t,n,r){const i=bC(e),o=_C(e,t),s=Array(e.length);for(let a=0,l=o.length;a<l;a++){let c=nc(o[a]);c.static||(c=u5(i,c,t,n,o,r),i.push(c)),s[e.indexOf(o[a])]=c,c.moved=!1}return s}const AQ={x:"w",y:"h"};function $1(e,t,n,r){const i=AQ[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;My(t,a)&&$1(e,a,n+t[i],r)}}t[r]=n}function u5(e,t,n,r,i,o){const s=n==="vertical",a=n==="horizontal";if(s)for(t.y=Math.min(gC(e),t.y);t.y>0&&!zl(e,t);)t.y--;else if(a)for(;t.x>0&&!zl(e,t);)t.x--;let l;for(;(l=zl(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&&!zl(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function d5(e,t){const n=bC(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(;zl(n,o);)o.y++}return e}function mC(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function zl(e,t){for(let n=0,r=e.length;n<r;n++)if(My(e[n],t))return e[n]}function f5(e,t){return e.filter(n=>My(n,t))}function bC(e){return e.filter(t=>t.static)}function Vf(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=_C(e,s);(s==="vertical"&&typeof r=="number"?u>=r:s==="horizontal"&&typeof n=="number"?c>=n:!1)&&(d=d.reverse());const h=f5(d,t),m=h.length>0;if(m&&l)return a5(e);if(m&&o)return`${t.i}`,t.x=c,t.y=u,t.moved=!1,e;for(let b=0,y=h.length;b<y;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=zl(e,d),h=p&&p.y+p.h>t.y,m=p&&t.x+t.w>p.x;if(p){if(h&&a)return Vf(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 Vf(e,t,n.x,void 0,r,l,i)}else return`${n.i}${d.x}${d.y}`,Vf(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:Vf(e,n,s?n.x+1:void 0,a?n.y+1:void 0,r,l,i)}function OQ(e){return e*100+"%"}const h5=(e,t,n,r)=>e+n>r?t:n,p5=(e,t,n)=>e<0?t:n,g5=e=>Math.max(0,e),yC=e=>Math.max(0,e),vC=(e,t,n)=>{let{left:r,height:i,width:o}=t;const s=e.top-(i-e.height);return{left:r,width:o,height:p5(s,e.height,i),top:yC(s)}},xC=(e,t,n)=>{let{top:r,left:i,height:o,width:s}=t;return{top:r,height:o,width:h5(e.left,e.width,s,n),left:g5(i)}},wC=(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:h5(e.left,e.width,o,n),top:yC(r),left:g5(s)}},SC=(e,t,n)=>{let{top:r,left:i,height:o,width:s}=t;return{width:s,left:i,height:p5(r,e.height,o),top:yC(r)}},MQ=function(){return vC(arguments.length<=0?void 0:arguments[0],xC(...arguments))},IQ=function(){return vC(arguments.length<=0?void 0:arguments[0],wC(...arguments))},DQ=function(){return SC(arguments.length<=0?void 0:arguments[0],xC(...arguments))},NQ=function(){return SC(arguments.length<=0?void 0:arguments[0],wC(...arguments))},LQ={n:vC,ne:MQ,e:xC,se:DQ,s:SC,sw:NQ,w:wC,nw:IQ};function FQ(e,t,n,r){const i=LQ[e];return i?i(t,{...t,...n},r):n}function jQ(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 $Q(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 _C(e,t){return t==="horizontal"?b5(e):t==="vertical"?m5(e):e}function m5(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 b5(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 zQ(e,t,n,r,i){e=e||[];const o=[];Hf.default.Children.forEach(t,a=>{if((a==null?void 0:a.key)==null)return;const l=mC(e,String(a.key)),c=a.props["data-grid"];l&&c==null?o.push(nc(l)):c?(RQ||y5([c],"ReactGridLayout.children"),o.push(nc({...c,i:a.key}))):o.push(nc({w:1,h:1,x:0,y:gC(o),i:String(a.key)}))});const s=d5(o,{cols:n});return i?s:c5(s,r,n)}function y5(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 BQ(e){const{verticalCompact:t,compactType:n}=e||{};return t===!1?null:n}const HQ=()=>{};Pt.noop=HQ;var gs={};Object.defineProperty(gs,"__esModule",{value:!0});gs.calcGridColWidth=Iy;gs.calcGridItemPosition=VQ;gs.calcGridItemWHPx=B1;gs.calcWH=UQ;gs.calcXY=WQ;gs.clamp=Bl;function Iy(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 VQ(e,t,n,r,i,o){const{margin:s,containerPadding:a,rowHeight:l}=e,c=Iy(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 WQ(e,t,n,r,i){const{margin:o,containerPadding:s,cols:a,rowHeight:l,maxRows:c}=e,u=Iy(e);let d=Math.round((n-s[0])/(u+o[0])),p=Math.round((t-s[1])/(l+o[1]));return d=Bl(d,0,a-r),p=Bl(p,0,c-i),{x:d,y:p}}function UQ(e,t,n,r,i,o){const{margin:s,maxRows:a,cols:l,rowHeight:c}=e,u=Iy(e);let d=Math.round((t+s[0])/(u+s[0])),p=Math.round((n+s[1])/(c+s[1])),h=Bl(d,0,l-r),m=Bl(p,0,a-i);return["sw","w","nw"].indexOf(o)!==-1&&(h=Bl(d,0,l)),["nw","n","ne"].indexOf(o)!==-1&&(m=Bl(p,0,a)),{w:h,h:m}}function Bl(e,t,n){return Math.max(Math.min(e,n),t)}var Dy={},H1={exports:{}},$g={exports:{}},Zt={};/** @license React v16.13.1
|
|
92
92
|
* react-is.production.min.js
|
|
93
93
|
*
|
|
94
94
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -412,7 +412,7 @@ prismjs/prism.js:
|
|
|
412
412
|
* @namespace
|
|
413
413
|
* @public
|
|
414
414
|
*)
|
|
415
|
-
*/function XRe({message:e,onAddToDashboard:t}){var o;const n=(o=e==null?void 0:e.parts)==null?void 0:o.filter(s=>s.type==="tool-invocation"&&s.toolInvocation.toolName==="getData"&&s.toolInvocation.state==="result");if(!n)return null;const i=n.map(s=>s.toolInvocation).map(s=>{const l=s.result.data.records;return{chartCfg:vE({cardType:s.args.chartType,data:l}),chartTitle:s.args.chartTitle,chartType:s.args.chartType,sql:s.args.sql,data:l,connectionId:s.args.connectionId}});return i.length===0?null:v.jsx("div",{className:"",children:i.map((s,a)=>v.jsxs("div",{className:"relative isolate flex h-[350px] w-[99%] grow flex-col",children:[v.jsxs(br,{className:"absolute right-0 top-0 z-10 h-8 p-2",onClick:()=>{t==null||t({sql:s.sql,data:s.data,cardCfg:s.chartCfg,cardTitle:s.chartTitle,connectionId:s.connectionId,cardType:s.chartType})},size:"sm",variant:"secondary",children:[v.jsx(qy,{className:"mr-1 size-4"}),"Add"]}),v.jsx(qE,{cfg:s.chartCfg})]},a))})}function QRe({message:e,showTools:t}){var r;if(!t)return null;const n=(r=e==null?void 0:e.parts)==null?void 0:r.filter(i=>i.type==="tool-invocation");return v.jsx("div",{className:"space-y-3",children:n==null?void 0:n.map((i,o)=>{const s=i.toolInvocation;return v.jsxs(g1e,{children:[v.jsxs(m1e,{className:"rounded-md bg-green-200 p-1 px-2 font-mono text-xs text-black",children:[v.jsx("span",{className:"font-bold",children:"Tool:"})," ",s.toolName]}),v.jsx(b1e,{className:"mt-2 font-mono text-xs",children:v.jsxs("div",{className:"space-y-2 px-2",children:[v.jsxs("div",{className:"space-y-1",children:[v.jsx("span",{children:"Args:"}),v.jsx(I_,{language:"json",code:JSON.stringify(s.args,null,2)})]}),v.jsxs("div",{className:"space-y-1",children:[v.jsx("span",{children:"Result:"}),v.jsx(I_,{language:"json",code:JSON.stringify(s.result,null,2)})]})]})})]},o)})})}function ZRe({message:e}){return e.role!=="user"?null:v.jsxs("div",{className:"rounded-md bg-muted/50 p-3 text-sm",children:[v.jsx(xL,{className:"float-left mr-2 size-4"}),v.jsx("div",{children:e.content})]})}function JRe({message:e,handleRun:t}){if(e.role!=="assistant")return null;const n={p:({node:r,...i})=>v.jsx("p",{className:"text-sm",...i}),code:({node:r,...i})=>v.jsx("code",{className:"rounded-md bg-muted px-2 py-1 text-xs",...i}),pre:r=>v.jsx(e2e,{...r,handleRun:t}),li:({node:r,...i})=>v.jsx("li",{className:"my-2 list-outside pl-4 text-sm",...i})};return v.jsx(WEe,{components:n,children:e.content.replace(/DuckDB/gi,"Semaphor")})}function p7({status:e,isLoading:t}){return t?v.jsx("div",{className:"flex items-center text-xs text-muted-foreground",children:e}):null}function g7({messages:e,showTools:t=!1,handleRun:n,onAddToDashboard:r}){return e==null?void 0:e.map(i=>v.jsxs("div",{className:be("relative my-4 space-y-4 text-sm text-foreground/80"),children:[v.jsx(ZRe,{message:i}),v.jsx(QRe,{message:i,showTools:t}),v.jsx(XRe,{onAddToDashboard:r,message:i}),v.jsx(JRe,{message:i,handleRun:n})]},i.id))}function e2e({children:e,handleRun:t}){const[n,r]=k.useState(!1);k.useRef(null);const i=()=>{navigator.clipboard.writeText(o).then(()=>{r(!0),setTimeout(()=>r(!1),2e3)})},o=M_(e);return v.jsxs("pre",{className:"relative my-2 space-y-2 rounded-md bg-muted/50",children:[v.jsxs("div",{className:"float-right m-1.5",children:[v.jsx(br,{className:"h-8 p-2 text-xs text-muted-foreground hover:text-foreground",onClick:i,size:"sm",variant:"ghost",children:n?v.jsx(jc,{className:"size-3"}):v.jsx($C,{className:"size-3"})}),v.jsx(br,{className:"h-8 p-2 text-muted-foreground hover:text-foreground",onClick:()=>t==null?void 0:t(o),size:"sm",variant:"ghost",children:v.jsx(hL,{className:"size-3"})})]}),v.jsx(I_,{code:o})]})}function M_(e){return typeof e=="string"?e:Array.isArray(e)?e.map(M_).join(""):k.isValidElement(e)?M_(e.props.children):""}const I_=({code:e,language:t="sql"})=>{const n=ye(r=>r.theme);return v.jsx(KRe,{code:e,language:t,theme:n==="dark"?O_.vsDark:O_.oneLight,children:({className:r,style:i,tokens:o,getLineProps:s,getTokenProps:a})=>v.jsx("pre",{className:`${r} border-1 whitespace-pre-wrap rounded-md border border-muted p-2 text-xs`,style:{...i},children:o.map((l,c)=>v.jsx("div",{...s({line:l}),children:l.map((u,d)=>v.jsx("span",{...a({token:u})},d))},c))})})};function m7(e,t){return t||(e==="ready"?"":e==="error"?"Error":e==="streaming"?"":"Thinking...")}const b7=k.forwardRef(({input:e,handleInputChange:t,handleSubmit:n,isLoading:r,stop:i},o)=>v.jsxs("form",{onSubmit:n,className:"flex w-full items-center rounded-md border",children:[v.jsx(dc,{autoFocus:!0,ref:o,placeholder:"Type your question...",className:be("max-h-10 min-h-7 resize-none border-none focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"),disabled:r,value:e,onChange:t}),v.jsxs("div",{className:"mr-2 flex items-center gap-2",children:[r===!0&&v.jsx(br,{size:"sm",className:"h-7 rounded-full p-2",onClick:()=>i(),children:v.jsx(uL,{className:"size-3 bg-background"})}),r===!1&&e&&v.jsx("button",{disabled:!e,className:"mr-3",children:v.jsx(mL,{className:"size-4 text-muted-foreground hover:text-foreground"})})]})]}));function t2e(){const e=k.useRef(null),[t,n]=k.useState("");k.useState(!1);const r=ye(R=>R.dashboard.aiScopeTables);Wy();const i=ye(R=>R.selectedSheetId),{addFrame:o,setSelectedFrameId:s,setIsDashboardEditing:a}=Vn(),{authToken:l}=Wi(),c=iC(),{messages:u,setMessages:d,reload:p,input:h,status:m,handleInputChange:b,handleSubmit:y,addToolResult:x,stop:w}=w9({api:"https://semaphor.cloud/api/v1/chat",headers:{Authorization:`Bearer ${l==null?void 0:l.accessToken}`},maxSteps:10,async onToolCall({toolCall:R}){if(R.toolName==="getTables")return n("Initializing..."),{tables:r||[]};if(R.toolName==="getSchemas"&&n("Analyzing..."),R.toolName==="getData"){n("Fetching..."),console.log(R.args);const T=R.args;if(!(T!=null&&T.sql)||!(T!=null&&T.connectionId))return"Please provide sql, connectionId and table";const M=await c.fetchQuery({queryKey:["chat",T.connectionId,T.sql],queryFn:()=>Cy("https://semaphor.cloud/api/v1/query",(l==null?void 0:l.accessToken)||(l==null?void 0:l.accessToken)||"",{connection_id:T.connectionId,sql:T.sql,cache_config:J_({})})});return n("Summarizing..."),{data:M,sql:T.sql}}},onFinish(R,T){n(""),console.log("onFinish",R,T),T.finishReason==="stop"&&n("")}}),_=()=>{var R;(R=e.current)==null||R.scrollIntoView({behavior:"smooth"})};k.useEffect(()=>{_()},[u]);function E({sql:R,data:T,cardCfg:M,cardTitle:L,connectionId:j,cardType:F}){if(!i)return;const $={id:Ga(),title:L||"Title",description:"Description",preferences:{onClickFilter:[{columnIndex:0,expression:""}],chartOptions:{indexAxis:F==="horizontalBar"?"y":"x"}},type:M.type,cfg:M,sql:R,data:T,connectionId:j},Q={id:Ga(),cards:[$],activeCardId:$.id};a(!0),o(i,Q,"start"),s(Q.id)}const C=!["ready","error"].includes(m);return v.jsxs("div",{role:"chat-box",className:"flex h-full grow flex-col justify-between break-words rounded-md",children:[v.jsxs("div",{className:"flex items-center justify-between gap-2 px-6 py-8",children:[v.jsxs("div",{className:"flex items-center gap-4",children:[v.jsx(Sn,{className:"flex items-center gap-2 text-xl",children:"Assistant"}),v.jsxs(Bd,{openDelay:0,children:[v.jsx(Hd,{children:v.jsx(wL,{className:"size-4 text-muted-foreground/70 hover:text-muted-foreground"})}),v.jsx(Bc,{className:"w-70 p-2",children:v.jsx("div",{className:"flex justify-between space-x-2 text-muted-foreground",children:v.jsxs("div",{children:[(r==null?void 0:r.length)===0&&v.jsx("p",{className:"text-sm",children:"No tables in scope"}),v.jsx("div",{className:"space-y-2",children:r==null?void 0:r.map((R,T)=>v.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[v.jsx(yL,{className:"size-3 text-muted-foreground/70"}),v.jsx("span",{children:vN({schemaName:R.schemaName||"",tableName:R.tableName||"",modelName:R.datamodelName||"",connectionType:R.connectionType||""})})]},T))})]})})})]})]}),v.jsx("div",{children:v.jsx(br,{className:"h-8",size:"sm",variant:"secondary",onClick:()=>{d([]),p()},children:"Clear"})})]}),v.jsx(Rp,{className:"bg-muted"}),v.jsxs(fc,{className:"flex flex-1 basis-0 flex-col flex-wrap justify-end px-6 py-6",children:[v.jsxs("div",{className:"pb-4",children:[v.jsx(g7,{messages:u,onAddToDashboard:E}),v.jsx(p7,{status:m7(m,t),isLoading:C}),v.jsx("div",{ref:e})]}),v.jsx(Mp,{orientation:"vertical"})]}),v.jsx("div",{className:"px-6 pb-8",children:v.jsx(b7,{stop:w,input:h,handleInputChange:b,handleSubmit:y,isLoading:C})})]})}const{createElement:Td,createContext:n2e,createRef:YAe,forwardRef:y7,useCallback:ci,useContext:v7,useEffect:pc,useImperativeHandle:x7,useLayoutEffect:r2e,useMemo:i2e,useRef:fi,useState:Hu}=P,PD=P[`useId${Math.random()}`.slice(0,5)],o2e=r2e,$0=n2e(null);$0.displayName="PanelGroupContext";const gc=o2e,s2e=typeof PD=="function"?PD:()=>null;let a2e=0;function e2(e=null){const t=s2e(),n=fi(e||t||null);return n.current===null&&(n.current=""+a2e++),e??n.current}function w7({children:e,className:t="",collapsedSize:n,collapsible:r,defaultSize:i,forwardedRef:o,id:s,maxSize:a,minSize:l,onCollapse:c,onExpand:u,onResize:d,order:p,style:h,tagName:m="div",...b}){const y=v7($0);if(y===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:x,expandPanel:w,getPanelSize:_,getPanelStyle:E,groupId:C,isPanelCollapsed:R,reevaluatePanelConstraints:T,registerPanel:M,resizePanel:L,unregisterPanel:j}=y,F=e2(s),$=fi({callbacks:{onCollapse:c,onExpand:u,onResize:d},constraints:{collapsedSize:n,collapsible:r,defaultSize:i,maxSize:a,minSize:l},id:F,idIsFromProps:s!==void 0,order:p});fi({didLogMissingDefaultSizeWarning:!1}),gc(()=>{const{callbacks:H,constraints:N}=$.current,G={...N};$.current.id=F,$.current.idIsFromProps=s!==void 0,$.current.order=p,H.onCollapse=c,H.onExpand=u,H.onResize=d,N.collapsedSize=n,N.collapsible=r,N.defaultSize=i,N.maxSize=a,N.minSize=l,(G.collapsedSize!==N.collapsedSize||G.collapsible!==N.collapsible||G.maxSize!==N.maxSize||G.minSize!==N.minSize)&&T($.current,G)}),gc(()=>{const H=$.current;return M(H),()=>{j(H)}},[p,F,M,j]),x7(o,()=>({collapse:()=>{x($.current)},expand:H=>{w($.current,H)},getId(){return F},getSize(){return _($.current)},isCollapsed(){return R($.current)},isExpanded(){return!R($.current)},resize:H=>{L($.current,H)}}),[x,w,_,R,F,L]);const Q=E($.current,i);return Td(m,{...b,children:e,className:t,id:s,style:{...Q,...h},"data-panel":"","data-panel-collapsible":r||void 0,"data-panel-group-id":C,"data-panel-id":F,"data-panel-size":parseFloat(""+Q.flexGrow).toFixed(1)})}const S7=y7((e,t)=>Td(w7,{...e,forwardedRef:t}));w7.displayName="Panel";S7.displayName="forwardRef(Panel)";let D_=null,ql=null;function l2e(e,t){if(t){const n=(t&P7)!==0,r=(t&T7)!==0,i=(t&k7)!==0,o=(t&A7)!==0;if(n)return i?"se-resize":o?"ne-resize":"e-resize";if(r)return i?"sw-resize":o?"nw-resize":"w-resize";if(i)return"s-resize";if(o)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function c2e(){ql!==null&&(document.head.removeChild(ql),D_=null,ql=null)}function e1(e,t){const n=l2e(e,t);D_!==n&&(D_=n,ql===null&&(ql=document.createElement("style"),document.head.appendChild(ql)),ql.innerHTML=`*{cursor: ${n}!important;}`)}function _7(e){return e.type==="keydown"}function C7(e){return e.type.startsWith("pointer")}function E7(e){return e.type.startsWith("mouse")}function z0(e){if(C7(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(E7(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function u2e(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function d2e(e,t,n){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function f2e(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:AD(e),b:AD(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;xt(r,"Stacking order can only be calculated for elements with a common ancestor");const i={a:kD(TD(n.a)),b:kD(TD(n.b))};if(i.a===i.b){const o=r.childNodes,s={a:n.a.at(-1),b:n.b.at(-1)};let a=o.length;for(;a--;){const l=o[a];if(l===s.a)return 1;if(l===s.b)return-1}}return Math.sign(i.a-i.b)}const h2e=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function p2e(e){var t;const n=getComputedStyle((t=R7(e))!==null&&t!==void 0?t:e).display;return n==="flex"||n==="inline-flex"}function g2e(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||p2e(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||h2e.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function TD(e){let t=e.length;for(;t--;){const n=e[t];if(xt(n,"Missing node"),g2e(n))return n}return null}function kD(e){return e&&Number(getComputedStyle(e).zIndex)||0}function AD(e){const t=[];for(;e;)t.push(e),e=R7(e);return t}function R7(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const P7=1,T7=2,k7=4,A7=8,m2e=u2e()==="coarse";let Oo=[],Vu=!1,Ta=new Map,B0=new Map;const tp=new Set;function b2e(e,t,n,r,i){var o;const{ownerDocument:s}=t,a={direction:n,element:t,hitAreaMargins:r,setResizeHandlerState:i},l=(o=Ta.get(s))!==null&&o!==void 0?o:0;return Ta.set(s,l+1),tp.add(a),uy(),function(){var u;B0.delete(e),tp.delete(a);const d=(u=Ta.get(s))!==null&&u!==void 0?u:1;if(Ta.set(s,d-1),uy(),d===1&&Ta.delete(s),Oo.includes(a)){const p=Oo.indexOf(a);p>=0&&Oo.splice(p,1),n2(),i("up",!0,null)}}}function OD(e){const{target:t}=e,{x:n,y:r}=z0(e);Vu=!0,t2({target:t,x:n,y:r}),uy(),Oo.length>0&&(dy("down",e),e.preventDefault(),e.stopPropagation())}function Ff(e){const{x:t,y:n}=z0(e);if(Vu&&e.buttons===0&&(Vu=!1,dy("up",e)),!Vu){const{target:r}=e;t2({target:r,x:t,y:n})}dy("move",e),n2(),Oo.length>0&&e.preventDefault()}function yu(e){const{target:t}=e,{x:n,y:r}=z0(e);B0.clear(),Vu=!1,Oo.length>0&&e.preventDefault(),dy("up",e),t2({target:t,x:n,y:r}),n2(),uy()}function t2({target:e,x:t,y:n}){Oo.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),tp.forEach(i=>{const{element:o,hitAreaMargins:s}=i,a=o.getBoundingClientRect(),{bottom:l,left:c,right:u,top:d}=a,p=m2e?s.coarse:s.fine;if(t>=c-p&&t<=u+p&&n>=d-p&&n<=l+p){if(r!==null&&document.contains(r)&&o!==r&&!o.contains(r)&&!r.contains(o)&&f2e(r,o)>0){let m=r,b=!1;for(;m&&!m.contains(o);){if(d2e(m.getBoundingClientRect(),a)){b=!0;break}m=m.parentElement}if(b)return}Oo.push(i)}})}function t1(e,t){B0.set(e,t)}function n2(){let e=!1,t=!1;Oo.forEach(r=>{const{direction:i}=r;i==="horizontal"?e=!0:t=!0});let n=0;B0.forEach(r=>{n|=r}),e&&t?e1("intersection",n):e?e1("horizontal",n):t?e1("vertical",n):c2e()}function uy(){Ta.forEach((e,t)=>{const{body:n}=t;n.removeEventListener("contextmenu",yu),n.removeEventListener("pointerdown",OD),n.removeEventListener("pointerleave",Ff),n.removeEventListener("pointermove",Ff)}),window.removeEventListener("pointerup",yu),window.removeEventListener("pointercancel",yu),tp.size>0&&(Vu?(Oo.length>0&&Ta.forEach((e,t)=>{const{body:n}=t;e>0&&(n.addEventListener("contextmenu",yu),n.addEventListener("pointerleave",Ff),n.addEventListener("pointermove",Ff))}),window.addEventListener("pointerup",yu),window.addEventListener("pointercancel",yu)):Ta.forEach((e,t)=>{const{body:n}=t;e>0&&(n.addEventListener("pointerdown",OD,{capture:!0}),n.addEventListener("pointermove",Ff))}))}function dy(e,t){tp.forEach(n=>{const{setResizeHandlerState:r}=n,i=Oo.includes(n);r(e,i,t)})}function y2e(){const[e,t]=Hu(0);return ci(()=>t(n=>n+1),[])}function xt(e,t){if(!e)throw console.error(t),Error(t)}const r2=10;function kc(e,t,n=r2){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function qs(e,t,n=r2){return kc(e,t,n)===0}function Ii(e,t,n){return kc(e,t,n)===0}function v2e(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){const i=e[r],o=t[r];if(!Ii(i,o,n))return!1}return!0}function Tu({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];xt(r!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:o,maxSize:s=100,minSize:a=0}=r;if(kc(n,a)<0)if(o){const l=(i+a)/2;kc(n,l)<0?n=i:n=a}else n=a;return n=Math.min(s,n),n=parseFloat(n.toFixed(r2)),n}function eh({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:o}){if(Ii(e,0))return t;const s=[...t],[a,l]=r;xt(a!=null,"Invalid first pivot index"),xt(l!=null,"Invalid second pivot index");let c=0;if(o==="keyboard"){{const d=e<0?l:a,p=n[d];xt(p,`Panel constraints not found for index ${d}`);const{collapsedSize:h=0,collapsible:m,minSize:b=0}=p;if(m){const y=t[d];if(xt(y!=null,`Previous layout not found for panel index ${d}`),Ii(y,h)){const x=b-y;kc(x,Math.abs(e))>0&&(e=e<0?0-x:x)}}}{const d=e<0?a:l,p=n[d];xt(p,`No panel constraints found for index ${d}`);const{collapsedSize:h=0,collapsible:m,minSize:b=0}=p;if(m){const y=t[d];if(xt(y!=null,`Previous layout not found for panel index ${d}`),Ii(y,b)){const x=y-h;kc(x,Math.abs(e))>0&&(e=e<0?0-x:x)}}}}{const d=e<0?1:-1;let p=e<0?l:a,h=0;for(;;){const b=t[p];xt(b!=null,`Previous layout not found for panel index ${p}`);const x=Tu({panelConstraints:n,panelIndex:p,size:100})-b;if(h+=x,p+=d,p<0||p>=n.length)break}const m=Math.min(Math.abs(e),Math.abs(h));e=e<0?0-m:m}{let p=e<0?a:l;for(;p>=0&&p<n.length;){const h=Math.abs(e)-Math.abs(c),m=t[p];xt(m!=null,`Previous layout not found for panel index ${p}`);const b=m-h,y=Tu({panelConstraints:n,panelIndex:p,size:b});if(!Ii(m,y)&&(c+=m-y,s[p]=y,c.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?p--:p++}}if(v2e(i,s))return i;{const d=e<0?l:a,p=t[d];xt(p!=null,`Previous layout not found for panel index ${d}`);const h=p+c,m=Tu({panelConstraints:n,panelIndex:d,size:h});if(s[d]=m,!Ii(m,h)){let b=h-m,x=e<0?l:a;for(;x>=0&&x<n.length;){const w=s[x];xt(w!=null,`Previous layout not found for panel index ${x}`);const _=w+b,E=Tu({panelConstraints:n,panelIndex:x,size:_});if(Ii(w,E)||(b-=E-w,s[x]=E),Ii(b,0))break;e>0?x--:x++}}}const u=s.reduce((d,p)=>p+d,0);return Ii(u,100)?s:i}function x2e({layout:e,panelsArray:t,pivotIndices:n}){let r=0,i=100,o=0,s=0;const a=n[0];xt(a!=null,"No pivot index found"),t.forEach((d,p)=>{const{constraints:h}=d,{maxSize:m=100,minSize:b=0}=h;p===a?(r=b,i=m):(o+=b,s+=m)});const l=Math.min(i,100-o),c=Math.max(r,100-s),u=e[a];return{valueMax:l,valueMin:c,valueNow:u}}function np(e,t=document){return Array.from(t.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function O7(e,t,n=document){const i=np(e,n).findIndex(o=>o.getAttribute("data-panel-resize-handle-id")===t);return i??null}function M7(e,t,n){const r=O7(e,t,n);return r!=null?[r,r+1]:[-1,-1]}function I7(e,t=document){var n;if(t instanceof HTMLElement&&(t==null||(n=t.dataset)===null||n===void 0?void 0:n.panelGroupId)==e)return t;const r=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return r||null}function H0(e,t=document){const n=t.querySelector(`[data-panel-resize-handle-id="${e}"]`);return n||null}function w2e(e,t,n,r=document){var i,o,s,a;const l=H0(t,r),c=np(e,r),u=l?c.indexOf(l):-1,d=(i=(o=n[u])===null||o===void 0?void 0:o.id)!==null&&i!==void 0?i:null,p=(s=(a=n[u+1])===null||a===void 0?void 0:a.id)!==null&&s!==void 0?s:null;return[d,p]}function S2e({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:r,panelDataArray:i,panelGroupElement:o,setLayout:s}){fi({didWarnAboutMissingResizeHandle:!1}),gc(()=>{if(!o)return;const a=np(n,o);for(let l=0;l<i.length-1;l++){const{valueMax:c,valueMin:u,valueNow:d}=x2e({layout:r,panelsArray:i,pivotIndices:[l,l+1]}),p=a[l];if(p!=null){const h=i[l];xt(h,`No panel data found for index "${l}"`),p.setAttribute("aria-controls",h.id),p.setAttribute("aria-valuemax",""+Math.round(c)),p.setAttribute("aria-valuemin",""+Math.round(u)),p.setAttribute("aria-valuenow",d!=null?""+Math.round(d):"")}}return()=>{a.forEach((l,c)=>{l.removeAttribute("aria-controls"),l.removeAttribute("aria-valuemax"),l.removeAttribute("aria-valuemin"),l.removeAttribute("aria-valuenow")})}},[n,r,i,o]),pc(()=>{if(!o)return;const a=t.current;xt(a,"Eager values not found");const{panelDataArray:l}=a,c=I7(n,o);xt(c!=null,`No group found for id "${n}"`);const u=np(n,o);xt(u,`No resize handles found for group id "${n}"`);const d=u.map(p=>{const h=p.getAttribute("data-panel-resize-handle-id");xt(h,"Resize handle element has no handle id attribute");const[m,b]=w2e(n,h,l,o);if(m==null||b==null)return()=>{};const y=x=>{if(!x.defaultPrevented)switch(x.key){case"Enter":{x.preventDefault();const w=l.findIndex(_=>_.id===m);if(w>=0){const _=l[w];xt(_,`No panel data found for index ${w}`);const E=r[w],{collapsedSize:C=0,collapsible:R,minSize:T=0}=_.constraints;if(E!=null&&R){const M=eh({delta:Ii(E,C)?T-C:C-E,initialLayout:r,panelConstraints:l.map(L=>L.constraints),pivotIndices:M7(n,h,o),prevLayout:r,trigger:"keyboard"});r!==M&&s(M)}}break}}};return p.addEventListener("keydown",y),()=>{p.removeEventListener("keydown",y)}});return()=>{d.forEach(p=>p())}},[o,e,t,n,r,i,s])}function MD(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function D7(e,t){const n=e==="horizontal",{x:r,y:i}=z0(t);return n?r:i}function _2e(e,t,n,r,i){const o=n==="horizontal",s=H0(t,i);xt(s,`No resize handle element found for id "${t}"`);const a=s.getAttribute("data-panel-group-id");xt(a,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=r;const c=D7(n,e),u=I7(a,i);xt(u,`No group element found for id "${a}"`);const d=u.getBoundingClientRect(),p=o?d.width:d.height;return(c-l)/p*100}function C2e(e,t,n,r,i,o){if(_7(e)){const s=n==="horizontal";let a=0;e.shiftKey?a=100:i!=null?a=i:a=10;let l=0;switch(e.key){case"ArrowDown":l=s?0:a;break;case"ArrowLeft":l=s?-a:0;break;case"ArrowRight":l=s?a:0;break;case"ArrowUp":l=s?0:-a;break;case"End":l=100;break;case"Home":l=-100;break}return l}else return r==null?0:_2e(e,t,n,r,o)}function E2e({panelDataArray:e}){const t=Array(e.length),n=e.map(o=>o.constraints);let r=0,i=100;for(let o=0;o<e.length;o++){const s=n[o];xt(s,`Panel constraints not found for index ${o}`);const{defaultSize:a}=s;a!=null&&(r++,t[o]=a,i-=a)}for(let o=0;o<e.length;o++){const s=n[o];xt(s,`Panel constraints not found for index ${o}`);const{defaultSize:a}=s;if(a!=null)continue;const l=e.length-r,c=i/l;r++,t[o]=c,i-=c}return t}function vu(e,t,n){t.forEach((r,i)=>{const o=e[i];xt(o,`Panel data not found for index ${i}`);const{callbacks:s,constraints:a,id:l}=o,{collapsedSize:c=0,collapsible:u}=a,d=n[l];if(d==null||r!==d){n[l]=r;const{onCollapse:p,onExpand:h,onResize:m}=s;m&&m(r,d),u&&(p||h)&&(h&&(d==null||qs(d,c))&&!qs(r,c)&&h(),p&&(d==null||!qs(d,c))&&qs(r,c)&&p())}})}function $m(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function R2e({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:i,precision:o=3}){const s=n[i];let a;return s==null?a=e!=null?e.toPrecision(o):"1":r.length===1?a="1":a=s.toPrecision(o),{flexBasis:0,flexGrow:a,flexShrink:1,overflow:"hidden",pointerEvents:t!==null?"none":void 0}}function P2e(e,t=10){let n=null;return(...i)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...i)},t)}}function ID(e){try{if(typeof localStorage<"u")e.getItem=t=>localStorage.getItem(t),e.setItem=(t,n)=>{localStorage.setItem(t,n)};else throw new Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function N7(e){return`react-resizable-panels:${e}`}function L7(e){return e.map(t=>{const{constraints:n,id:r,idIsFromProps:i,order:o}=t;return i?r:o?`${o}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((t,n)=>t.localeCompare(n)).join(",")}function F7(e,t){try{const n=N7(e),r=t.getItem(n);if(r){const i=JSON.parse(r);if(typeof i=="object"&&i!=null)return i}}catch{}return null}function T2e(e,t,n){var r,i;const o=(r=F7(e,n))!==null&&r!==void 0?r:{},s=L7(t);return(i=o[s])!==null&&i!==void 0?i:null}function k2e(e,t,n,r,i){var o;const s=N7(e),a=L7(t),l=(o=F7(e,i))!==null&&o!==void 0?o:{};l[a]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{i.setItem(s,JSON.stringify(l))}catch(c){console.error(c)}}function DD({layout:e,panelConstraints:t}){const n=[...e],r=n.reduce((o,s)=>o+s,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(o=>`${o}%`).join(", ")}`);if(!Ii(r,100)&&n.length>0)for(let o=0;o<t.length;o++){const s=n[o];xt(s!=null,`No layout data found for index ${o}`);const a=100/r*s;n[o]=a}let i=0;for(let o=0;o<t.length;o++){const s=n[o];xt(s!=null,`No layout data found for index ${o}`);const a=Tu({panelConstraints:t,panelIndex:o,size:s});s!=a&&(i+=s-a,n[o]=a)}if(!Ii(i,0))for(let o=0;o<t.length;o++){const s=n[o];xt(s!=null,`No layout data found for index ${o}`);const a=s+i,l=Tu({panelConstraints:t,panelIndex:o,size:a});if(s!==l&&(i-=l-s,n[o]=l,Ii(i,0)))break}return n}const A2e=100,th={getItem:e=>(ID(th),th.getItem(e)),setItem:(e,t)=>{ID(th),th.setItem(e,t)}},ND={};function j7({autoSaveId:e=null,children:t,className:n="",direction:r,forwardedRef:i,id:o=null,onLayout:s=null,keyboardResizeBy:a=null,storage:l=th,style:c,tagName:u="div",...d}){const p=e2(o),h=fi(null),[m,b]=Hu(null),[y,x]=Hu([]),w=y2e(),_=fi({}),E=fi(new Map),C=fi(0),R=fi({autoSaveId:e,direction:r,dragState:m,id:p,keyboardResizeBy:a,onLayout:s,storage:l}),T=fi({layout:y,panelDataArray:[],panelDataArrayChanged:!1});fi({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),x7(i,()=>({getId:()=>R.current.id,getLayout:()=>{const{layout:O}=T.current;return O},setLayout:O=>{const{onLayout:ee}=R.current,{layout:K,panelDataArray:oe}=T.current,X=DD({layout:O,panelConstraints:oe.map(J=>J.constraints)});MD(K,X)||(x(X),T.current.layout=X,ee&&ee(X),vu(oe,X,_.current))}}),[]),gc(()=>{R.current.autoSaveId=e,R.current.direction=r,R.current.dragState=m,R.current.id=p,R.current.onLayout=s,R.current.storage=l}),S2e({committedValuesRef:R,eagerValuesRef:T,groupId:p,layout:y,panelDataArray:T.current.panelDataArray,setLayout:x,panelGroupElement:h.current}),pc(()=>{const{panelDataArray:O}=T.current;if(e){if(y.length===0||y.length!==O.length)return;let ee=ND[e];ee==null&&(ee=P2e(k2e,A2e),ND[e]=ee);const K=[...O],oe=new Map(E.current);ee(e,K,oe,y,l)}},[e,y,l]),pc(()=>{});const M=ci(O=>{const{onLayout:ee}=R.current,{layout:K,panelDataArray:oe}=T.current;if(O.constraints.collapsible){const X=oe.map(ge=>ge.constraints),{collapsedSize:J=0,panelSize:se,pivotIndices:le}=Tl(oe,O,K);if(xt(se!=null,`Panel size not found for panel "${O.id}"`),!qs(se,J)){E.current.set(O.id,se);const ie=wu(oe,O)===oe.length-1?se-J:J-se,pe=eh({delta:ie,initialLayout:K,panelConstraints:X,pivotIndices:le,prevLayout:K,trigger:"imperative-api"});$m(K,pe)||(x(pe),T.current.layout=pe,ee&&ee(pe),vu(oe,pe,_.current))}}},[]),L=ci((O,ee)=>{const{onLayout:K}=R.current,{layout:oe,panelDataArray:X}=T.current;if(O.constraints.collapsible){const J=X.map(he=>he.constraints),{collapsedSize:se=0,panelSize:le=0,minSize:ge=0,pivotIndices:ie}=Tl(X,O,oe),pe=ee??ge;if(qs(le,se)){const he=E.current.get(O.id),Re=he!=null&&he>=pe?he:pe,Fe=wu(X,O)===X.length-1?le-Re:Re-le,ke=eh({delta:Fe,initialLayout:oe,panelConstraints:J,pivotIndices:ie,prevLayout:oe,trigger:"imperative-api"});$m(oe,ke)||(x(ke),T.current.layout=ke,K&&K(ke),vu(X,ke,_.current))}}},[]),j=ci(O=>{const{layout:ee,panelDataArray:K}=T.current,{panelSize:oe}=Tl(K,O,ee);return xt(oe!=null,`Panel size not found for panel "${O.id}"`),oe},[]),F=ci((O,ee)=>{const{panelDataArray:K}=T.current,oe=wu(K,O);return R2e({defaultSize:ee,dragState:m,layout:y,panelData:K,panelIndex:oe})},[m,y]),$=ci(O=>{const{layout:ee,panelDataArray:K}=T.current,{collapsedSize:oe=0,collapsible:X,panelSize:J}=Tl(K,O,ee);return xt(J!=null,`Panel size not found for panel "${O.id}"`),X===!0&&qs(J,oe)},[]),Q=ci(O=>{const{layout:ee,panelDataArray:K}=T.current,{collapsedSize:oe=0,collapsible:X,panelSize:J}=Tl(K,O,ee);return xt(J!=null,`Panel size not found for panel "${O.id}"`),!X||kc(J,oe)>0},[]),H=ci(O=>{const{panelDataArray:ee}=T.current;ee.push(O),ee.sort((K,oe)=>{const X=K.order,J=oe.order;return X==null&&J==null?0:X==null?-1:J==null?1:X-J}),T.current.panelDataArrayChanged=!0,w()},[w]);gc(()=>{if(T.current.panelDataArrayChanged){T.current.panelDataArrayChanged=!1;const{autoSaveId:O,onLayout:ee,storage:K}=R.current,{layout:oe,panelDataArray:X}=T.current;let J=null;if(O){const le=T2e(O,X,K);le&&(E.current=new Map(Object.entries(le.expandToSizes)),J=le.layout)}J==null&&(J=E2e({panelDataArray:X}));const se=DD({layout:J,panelConstraints:X.map(le=>le.constraints)});MD(oe,se)||(x(se),T.current.layout=se,ee&&ee(se),vu(X,se,_.current))}}),gc(()=>{const O=T.current;return()=>{O.layout=[]}},[]);const N=ci(O=>{let ee=!1;const K=h.current;return K&&window.getComputedStyle(K,null).getPropertyValue("direction")==="rtl"&&(ee=!0),function(X){X.preventDefault();const J=h.current;if(!J)return()=>null;const{direction:se,dragState:le,id:ge,keyboardResizeBy:ie,onLayout:pe}=R.current,{layout:he,panelDataArray:Re}=T.current,{initialLayout:Oe}=le??{},Fe=M7(ge,O,J);let ke=C2e(X,O,se,le,ie,J);const Be=se==="horizontal";Be&&ee&&(ke=-ke);const dt=Re.map(mt=>mt.constraints),Ct=eh({delta:ke,initialLayout:Oe??he,panelConstraints:dt,pivotIndices:Fe,prevLayout:he,trigger:_7(X)?"keyboard":"mouse-or-touch"}),an=!$m(he,Ct);(C7(X)||E7(X))&&C.current!=ke&&(C.current=ke,!an&&ke!==0?Be?t1(O,ke<0?P7:T7):t1(O,ke<0?k7:A7):t1(O,0)),an&&(x(Ct),T.current.layout=Ct,pe&&pe(Ct),vu(Re,Ct,_.current))}},[]),G=ci((O,ee)=>{const{onLayout:K}=R.current,{layout:oe,panelDataArray:X}=T.current,J=X.map(he=>he.constraints),{panelSize:se,pivotIndices:le}=Tl(X,O,oe);xt(se!=null,`Panel size not found for panel "${O.id}"`);const ie=wu(X,O)===X.length-1?se-ee:ee-se,pe=eh({delta:ie,initialLayout:oe,panelConstraints:J,pivotIndices:le,prevLayout:oe,trigger:"imperative-api"});$m(oe,pe)||(x(pe),T.current.layout=pe,K&&K(pe),vu(X,pe,_.current))},[]),B=ci((O,ee)=>{const{layout:K,panelDataArray:oe}=T.current,{collapsedSize:X=0,collapsible:J}=ee,{collapsedSize:se=0,collapsible:le,maxSize:ge=100,minSize:ie=0}=O.constraints,{panelSize:pe}=Tl(oe,O,K);pe!=null&&(J&&le&&qs(pe,X)?qs(X,se)||G(O,se):pe<ie?G(O,ie):pe>ge&&G(O,ge))},[G]),W=ci((O,ee)=>{const{direction:K}=R.current,{layout:oe}=T.current;if(!h.current)return;const X=H0(O,h.current);xt(X,`Drag handle element not found for id "${O}"`);const J=D7(K,ee);b({dragHandleId:O,dragHandleRect:X.getBoundingClientRect(),initialCursorPosition:J,initialLayout:oe})},[]),q=ci(()=>{b(null)},[]),I=ci(O=>{const{panelDataArray:ee}=T.current,K=wu(ee,O);K>=0&&(ee.splice(K,1),delete _.current[O.id],T.current.panelDataArrayChanged=!0,w())},[w]),Y=i2e(()=>({collapsePanel:M,direction:r,dragState:m,expandPanel:L,getPanelSize:j,getPanelStyle:F,groupId:p,isPanelCollapsed:$,isPanelExpanded:Q,reevaluatePanelConstraints:B,registerPanel:H,registerResizeHandle:N,resizePanel:G,startDragging:W,stopDragging:q,unregisterPanel:I,panelGroupElement:h.current}),[M,m,r,L,j,F,p,$,Q,B,H,N,G,W,q,I]),U={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return Td($0.Provider,{value:Y},Td(u,{...d,children:t,className:n,id:o,ref:h,style:{...U,...c},"data-panel-group":"","data-panel-group-direction":r,"data-panel-group-id":p}))}const $7=y7((e,t)=>Td(j7,{...e,forwardedRef:t}));j7.displayName="PanelGroup";$7.displayName="forwardRef(PanelGroup)";function wu(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function Tl(e,t,n){const r=wu(e,t),o=r===e.length-1?[r-1,r]:[r,r+1],s=n[r];return{...t.constraints,panelSize:s,pivotIndices:o}}function O2e({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:r}){pc(()=>{if(e||n==null||r==null)return;const i=H0(t,r);if(i==null)return;const o=s=>{if(!s.defaultPrevented)switch(s.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{s.preventDefault(),n(s);break}case"F6":{s.preventDefault();const a=i.getAttribute("data-panel-group-id");xt(a,`No group element found for id "${a}"`);const l=np(a,r),c=O7(a,t,r);xt(c!==null,`No resize element found for id "${t}"`);const u=s.shiftKey?c>0?c-1:l.length-1:c+1<l.length?c+1:0;l[u].focus();break}}};return i.addEventListener("keydown",o),()=>{i.removeEventListener("keydown",o)}},[r,e,t,n])}function i2({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:r,id:i,onBlur:o,onDragging:s,onFocus:a,style:l={},tabIndex:c=0,tagName:u="div",...d}){var p,h;const m=fi(null),b=fi({onDragging:s});pc(()=>{b.current.onDragging=s});const y=v7($0);if(y===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:x,groupId:w,registerResizeHandle:_,startDragging:E,stopDragging:C,panelGroupElement:R}=y,T=e2(i),[M,L]=Hu("inactive"),[j,F]=Hu(!1),[$,Q]=Hu(null),H=fi({state:M});gc(()=>{H.current.state=M}),pc(()=>{if(n)Q(null);else{const W=_(T);Q(()=>W)}},[n,T,_]);const N=(p=r==null?void 0:r.coarse)!==null&&p!==void 0?p:15,G=(h=r==null?void 0:r.fine)!==null&&h!==void 0?h:5;return pc(()=>{if(n||$==null)return;const W=m.current;return xt(W,"Element ref not attached"),b2e(T,W,x,{coarse:N,fine:G},(I,Y,U)=>{if(Y)switch(I){case"down":{L("drag"),xt(U,'Expected event to be defined for "down" action'),E(T,U);const{onDragging:O}=b.current;O&&O(!0);break}case"move":{const{state:O}=H.current;O!=="drag"&&L("hover"),xt(U,'Expected event to be defined for "move" action'),$(U);break}case"up":{L("hover"),C();const{onDragging:O}=b.current;O&&O(!1);break}}else L("inactive")})},[N,x,n,G,_,T,$,E,C]),O2e({disabled:n,handleId:T,resizeHandler:$,panelGroupElement:R}),Td(u,{...d,children:e,className:t,id:i,onBlur:()=>{F(!1),o==null||o()},onFocus:()=>{F(!0),a==null||a()},ref:m,role:"separator",style:{...{touchAction:"none",userSelect:"none"},...l},tabIndex:c,"data-panel-group-direction":x,"data-panel-group-id":w,"data-resize-handle":"","data-resize-handle-active":M==="drag"?"pointer":j?"keyboard":void 0,"data-resize-handle-state":M,"data-panel-resize-handle-enabled":!n,"data-panel-resize-handle-id":T})}i2.displayName="PanelResizeHandle";const z7=({className:e,...t})=>v.jsx($7,{className:be("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t}),N_=S7,M2e=({withHandle:e,className:t,...n})=>v.jsx(i2,{className:be("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),...n,children:e&&v.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:v.jsx(oL,{className:"h-2.5 w-2.5"})})}),I2e=({withHandle:e,className:t,onTabClick:n,open:r,...i})=>v.jsx(i2,{className:be("relative flex w-px items-start justify-end bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",{"justify-start":r},t),...i,children:e&&v.jsx("div",{className:be("z-50 flex items-center justify-start",{"border-l":r}),children:v.jsx(br,{variant:"secondary",className:be("h-7 p-0.5",{"rounded-bl-none rounded-br-md rounded-tl-none rounded-tr-md":r,"mt-0 rounded-bl-md rounded-br-none rounded-tl-md rounded-tr-none":!r}),onClick:()=>n(!r),children:r?v.jsx(Gy,{className:"size-4"}):v.jsx(FC,{className:"size-4"})})})});var o2="Dialog",[B7,H7]=nr(o2),[D2e,Lo]=B7(o2),V7=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:s=!0}=e,a=P.useRef(null),l=P.useRef(null),[c=!1,u]=Dr({prop:r,defaultProp:i,onChange:o});return v.jsx(D2e,{scope:t,triggerRef:a,contentRef:l,contentId:Yn(),titleId:Yn(),descriptionId:Yn(),open:c,onOpenChange:u,onOpenToggle:P.useCallback(()=>u(d=>!d),[u]),modal:s,children:n})};V7.displayName=o2;var W7="DialogTrigger",U7=P.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Lo(W7,n),o=it(t,i.triggerRef);return v.jsx(Le.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":l2(i.open),...r,ref:o,onClick:Pe(e.onClick,i.onOpenToggle)})});U7.displayName=W7;var s2="DialogPortal",[N2e,G7]=B7(s2,{forceMount:void 0}),q7=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:i}=e,o=Lo(s2,t);return v.jsx(N2e,{scope:t,forceMount:n,children:P.Children.map(r,s=>v.jsx(Kn,{present:n||o.open,children:v.jsx(Ep,{asChild:!0,container:i,children:s})}))})};q7.displayName=s2;var fy="DialogOverlay",Y7=P.forwardRef((e,t)=>{const n=G7(fy,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=Lo(fy,e.__scopeDialog);return o.modal?v.jsx(Kn,{present:r||o.open,children:v.jsx(L2e,{...i,ref:t})}):null});Y7.displayName=fy;var L2e=P.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Lo(fy,n);return v.jsx(Tp,{as:ea,allowPinchZoom:!0,shards:[i.contentRef],children:v.jsx(Le.div,{"data-state":l2(i.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Ac="DialogContent",K7=P.forwardRef((e,t)=>{const n=G7(Ac,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=Lo(Ac,e.__scopeDialog);return v.jsx(Kn,{present:r||o.open,children:o.modal?v.jsx(F2e,{...i,ref:t}):v.jsx(j2e,{...i,ref:t})})});K7.displayName=Ac;var F2e=P.forwardRef((e,t)=>{const n=Lo(Ac,e.__scopeDialog),r=P.useRef(null),i=it(t,n.contentRef,r);return P.useEffect(()=>{const o=r.current;if(o)return g0(o)},[]),v.jsx(X7,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Pe(e.onCloseAutoFocus,o=>{var s;o.preventDefault(),(s=n.triggerRef.current)==null||s.focus()}),onPointerDownOutside:Pe(e.onPointerDownOutside,o=>{const s=o.detail.originalEvent,a=s.button===0&&s.ctrlKey===!0;(s.button===2||a)&&o.preventDefault()}),onFocusOutside:Pe(e.onFocusOutside,o=>o.preventDefault())})}),j2e=P.forwardRef((e,t)=>{const n=Lo(Ac,e.__scopeDialog),r=P.useRef(!1),i=P.useRef(!1);return v.jsx(X7,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var s,a;(s=e.onCloseAutoFocus)==null||s.call(e,o),o.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),o.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:o=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const s=o.target;((c=n.triggerRef.current)==null?void 0:c.contains(s))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),X7=P.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,...s}=e,a=Lo(Ac,n),l=P.useRef(null),c=it(t,l);return h0(),v.jsxs(v.Fragment,{children:[v.jsx(Pp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:v.jsx(zc,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":l2(a.open),...s,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),v.jsxs(v.Fragment,{children:[v.jsx(z2e,{titleId:a.titleId}),v.jsx(H2e,{contentRef:l,descriptionId:a.descriptionId})]})]})}),a2="DialogTitle",Q7=P.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Lo(a2,n);return v.jsx(Le.h2,{id:i.titleId,...r,ref:t})});Q7.displayName=a2;var Z7="DialogDescription",J7=P.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Lo(Z7,n);return v.jsx(Le.p,{id:i.descriptionId,...r,ref:t})});J7.displayName=Z7;var e$="DialogClose",t$=P.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Lo(e$,n);return v.jsx(Le.button,{type:"button",...r,ref:t,onClick:Pe(e.onClick,()=>i.onOpenChange(!1))})});t$.displayName=e$;function l2(e){return e?"open":"closed"}var n$="DialogTitleWarning",[$2e,r$]=ZX(n$,{contentName:Ac,titleName:a2,docsSlug:"dialog"}),z2e=({titleId:e})=>{const t=r$(n$),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
415
|
+
*/function XRe({message:e,onAddToDashboard:t}){var o;const n=(o=e==null?void 0:e.parts)==null?void 0:o.filter(s=>s.type==="tool-invocation"&&s.toolInvocation.toolName==="getData"&&s.toolInvocation.state==="result");if(!n)return null;const i=n.map(s=>s.toolInvocation).map(s=>{const l=s.result.data.records;return{chartCfg:vE({cardType:s.args.chartType,data:l}),chartTitle:s.args.chartTitle,chartType:s.args.chartType,sql:s.args.sql,data:l,connectionId:s.args.connectionId}});return i.length===0?null:v.jsx("div",{className:"",children:i.map((s,a)=>v.jsxs("div",{className:"group relative isolate flex h-[350px] w-[99%] grow flex-col",children:[v.jsxs(br,{className:"invisible absolute right-0 top-0 z-10 h-8 p-2 group-hover:visible",onClick:()=>{t==null||t({sql:s.sql,data:s.data,cardCfg:s.chartCfg,cardTitle:s.chartTitle,connectionId:s.connectionId,cardType:s.chartType})},size:"sm",variant:"outline",children:[v.jsx(qy,{className:"mr-1 size-4"}),"Add"]}),v.jsx(qE,{cfg:s.chartCfg})]},a))})}function QRe({message:e,showTools:t}){var r;if(!t)return null;const n=(r=e==null?void 0:e.parts)==null?void 0:r.filter(i=>i.type==="tool-invocation");return v.jsx("div",{className:"space-y-3",children:n==null?void 0:n.map((i,o)=>{const s=i.toolInvocation;return v.jsxs(g1e,{children:[v.jsxs(m1e,{className:"rounded-md bg-green-200 p-1 px-2 font-mono text-xs text-black",children:[v.jsx("span",{className:"font-bold",children:"Tool:"})," ",s.toolName]}),v.jsx(b1e,{className:"mt-2 font-mono text-xs",children:v.jsxs("div",{className:"space-y-2 px-2",children:[v.jsxs("div",{className:"space-y-1",children:[v.jsx("span",{children:"Args:"}),v.jsx(I_,{language:"json",code:JSON.stringify(s.args,null,2)})]}),v.jsxs("div",{className:"space-y-1",children:[v.jsx("span",{children:"Result:"}),v.jsx(I_,{language:"json",code:JSON.stringify(s.result,null,2)})]})]})})]},o)})})}function ZRe({message:e}){return e.role!=="user"?null:v.jsxs("div",{className:"rounded-md bg-muted/50 p-3 text-sm",children:[v.jsx(xL,{className:"float-left mr-2 size-4"}),v.jsx("div",{children:e.content})]})}function JRe({message:e,handleRun:t}){if(e.role!=="assistant")return null;const n={p:({node:r,...i})=>v.jsx("p",{className:"text-sm",...i}),code:({node:r,...i})=>v.jsx("code",{className:"rounded-md bg-muted px-2 py-1 text-xs",...i}),pre:r=>v.jsx(e2e,{...r,handleRun:t}),li:({node:r,...i})=>v.jsx("li",{className:"my-2 list-outside pl-4 text-sm",...i})};return v.jsx(WEe,{components:n,children:e.content.replace(/DuckDB/gi,"Semaphor")})}function p7({status:e,isLoading:t}){return t?v.jsx("div",{className:"flex items-center text-xs text-muted-foreground",children:e}):null}function g7({messages:e,showTools:t=!1,handleRun:n,onAddToDashboard:r}){return e==null?void 0:e.map(i=>v.jsxs("div",{className:be("relative my-4 space-y-4 text-sm text-foreground/80"),children:[v.jsx(ZRe,{message:i}),v.jsx(QRe,{message:i,showTools:t}),v.jsx(XRe,{onAddToDashboard:r,message:i}),v.jsx(JRe,{message:i,handleRun:n})]},i.id))}function e2e({children:e,handleRun:t}){const[n,r]=k.useState(!1);k.useRef(null);const i=()=>{navigator.clipboard.writeText(o).then(()=>{r(!0),setTimeout(()=>r(!1),2e3)})},o=M_(e);return v.jsxs("pre",{className:"relative my-2 space-y-2 rounded-md bg-muted/50",children:[v.jsxs("div",{className:"float-right m-1.5",children:[v.jsx(br,{className:"h-8 p-2 text-xs text-muted-foreground hover:text-foreground",onClick:i,size:"sm",variant:"ghost",children:n?v.jsx(jc,{className:"size-3"}):v.jsx($C,{className:"size-3"})}),v.jsx(br,{className:"h-8 p-2 text-muted-foreground hover:text-foreground",onClick:()=>t==null?void 0:t(o),size:"sm",variant:"ghost",children:v.jsx(hL,{className:"size-3"})})]}),v.jsx(I_,{code:o})]})}function M_(e){return typeof e=="string"?e:Array.isArray(e)?e.map(M_).join(""):k.isValidElement(e)?M_(e.props.children):""}const I_=({code:e,language:t="sql"})=>{const n=ye(r=>r.theme);return v.jsx(KRe,{code:e,language:t,theme:n==="dark"?O_.vsDark:O_.oneLight,children:({className:r,style:i,tokens:o,getLineProps:s,getTokenProps:a})=>v.jsx("pre",{className:`${r} border-1 whitespace-pre-wrap rounded-md border border-muted p-2 text-xs`,style:{...i},children:o.map((l,c)=>v.jsx("div",{...s({line:l}),children:l.map((u,d)=>v.jsx("span",{...a({token:u})},d))},c))})})};function m7(e,t){return t||(e==="ready"?"":e==="error"?"Error":e==="streaming"?"":"Thinking...")}const b7=k.forwardRef(({input:e,handleInputChange:t,handleSubmit:n,isLoading:r,stop:i},o)=>v.jsxs("form",{onSubmit:n,className:"flex w-full items-center rounded-md border",children:[v.jsx(dc,{autoFocus:!0,ref:o,placeholder:"Type your question...",className:be("max-h-10 min-h-7 resize-none border-none focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"),disabled:r,value:e,onChange:t}),v.jsxs("div",{className:"mr-2 flex items-center gap-2",children:[r===!0&&v.jsx(br,{size:"sm",className:"h-7 rounded-full p-2",onClick:()=>i(),children:v.jsx(uL,{className:"size-3 bg-background"})}),r===!1&&e&&v.jsx("button",{disabled:!e,className:"mr-3",children:v.jsx(mL,{className:"size-4 text-muted-foreground hover:text-foreground"})})]})]}));function t2e(){const e=k.useRef(null),[t,n]=k.useState("");k.useState(!1);const r=ye(R=>R.dashboard.aiScopeTables);Wy();const i=ye(R=>R.selectedSheetId),{addFrame:o,setSelectedFrameId:s,setIsDashboardEditing:a}=Vn(),{authToken:l}=Wi(),c=iC(),{messages:u,setMessages:d,reload:p,input:h,status:m,handleInputChange:b,handleSubmit:y,addToolResult:x,stop:w}=w9({api:"https://semaphor.cloud/api/v1/chat",headers:{Authorization:`Bearer ${l==null?void 0:l.accessToken}`},maxSteps:10,async onToolCall({toolCall:R}){if(R.toolName==="getTables")return n("Initializing..."),{tables:r||[]};if(R.toolName==="getSchemas"&&n("Analyzing..."),R.toolName==="getData"){n("Fetching..."),console.log(R.args);const T=R.args;if(!(T!=null&&T.sql)||!(T!=null&&T.connectionId))return"Please provide sql, connectionId and table";const M=await c.fetchQuery({queryKey:["chat",T.connectionId,T.sql],queryFn:()=>Cy("https://semaphor.cloud/api/v1/query",(l==null?void 0:l.accessToken)||(l==null?void 0:l.accessToken)||"",{connection_id:T.connectionId,sql:T.sql,cache_config:J_({})})});return n("Summarizing..."),{data:M,sql:T.sql}}},onFinish(R,T){n(""),console.log("onFinish",R,T),T.finishReason==="stop"&&n("")}}),_=()=>{var R;(R=e.current)==null||R.scrollIntoView({behavior:"smooth"})};k.useEffect(()=>{_()},[u]);function E({sql:R,data:T,cardCfg:M,cardTitle:L,connectionId:j,cardType:F}){if(!i)return;const $={id:Ga(),title:L||"Title",description:"Description",preferences:{onClickFilter:[{columnIndex:0,expression:""}],chartOptions:{indexAxis:F==="horizontalBar"?"y":"x"}},type:M.type,cfg:M,sql:R,data:T,connectionId:j},Q={id:Ga(),cards:[$],activeCardId:$.id};a(!0),o(i,Q,"start"),s(Q.id)}const C=!["ready","error"].includes(m);return v.jsxs("div",{role:"chat-box",className:"flex h-full grow flex-col justify-between break-words rounded-md",children:[v.jsxs("div",{className:"flex items-center justify-between gap-2 px-6 py-6",children:[v.jsxs("div",{className:"flex items-center gap-4",children:[v.jsx(Sn,{className:"flex items-center gap-2 text-xl",children:"Assistant"}),v.jsxs(Bd,{openDelay:0,children:[v.jsx(Hd,{children:v.jsx(wL,{className:"size-4 text-muted-foreground/70 hover:text-muted-foreground"})}),v.jsx(Bc,{className:"w-70 p-2",children:v.jsx("div",{className:"flex justify-between space-x-2 text-muted-foreground",children:v.jsxs("div",{children:[(r==null?void 0:r.length)===0&&v.jsx("p",{className:"text-sm",children:"No tables in scope"}),v.jsx("div",{className:"space-y-2",children:r==null?void 0:r.map((R,T)=>v.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[v.jsx(yL,{className:"size-3 text-muted-foreground/70"}),v.jsx("span",{children:vN({schemaName:R.schemaName||"",tableName:R.tableName||"",modelName:R.datamodelName||"",connectionType:R.connectionType||""})})]},T))})]})})})]})]}),v.jsx("div",{children:v.jsx(br,{className:"h-8",size:"sm",variant:"secondary",onClick:()=>{d([]),p()},children:"Clear"})})]}),v.jsx(Rp,{className:"bg-muted"}),v.jsxs(fc,{className:"flex flex-1 basis-0 flex-col flex-wrap justify-end px-6 py-3",children:[v.jsxs("div",{className:"pb-4",children:[v.jsx(g7,{messages:u,onAddToDashboard:E}),v.jsx(p7,{status:m7(m,t),isLoading:C}),v.jsx("div",{ref:e})]}),v.jsx(Mp,{orientation:"vertical"})]}),v.jsx("div",{className:"px-6 pb-6",children:v.jsx(b7,{stop:w,input:h,handleInputChange:b,handleSubmit:y,isLoading:C})})]})}const{createElement:Td,createContext:n2e,createRef:YAe,forwardRef:y7,useCallback:ci,useContext:v7,useEffect:pc,useImperativeHandle:x7,useLayoutEffect:r2e,useMemo:i2e,useRef:fi,useState:Hu}=P,PD=P[`useId${Math.random()}`.slice(0,5)],o2e=r2e,$0=n2e(null);$0.displayName="PanelGroupContext";const gc=o2e,s2e=typeof PD=="function"?PD:()=>null;let a2e=0;function e2(e=null){const t=s2e(),n=fi(e||t||null);return n.current===null&&(n.current=""+a2e++),e??n.current}function w7({children:e,className:t="",collapsedSize:n,collapsible:r,defaultSize:i,forwardedRef:o,id:s,maxSize:a,minSize:l,onCollapse:c,onExpand:u,onResize:d,order:p,style:h,tagName:m="div",...b}){const y=v7($0);if(y===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:x,expandPanel:w,getPanelSize:_,getPanelStyle:E,groupId:C,isPanelCollapsed:R,reevaluatePanelConstraints:T,registerPanel:M,resizePanel:L,unregisterPanel:j}=y,F=e2(s),$=fi({callbacks:{onCollapse:c,onExpand:u,onResize:d},constraints:{collapsedSize:n,collapsible:r,defaultSize:i,maxSize:a,minSize:l},id:F,idIsFromProps:s!==void 0,order:p});fi({didLogMissingDefaultSizeWarning:!1}),gc(()=>{const{callbacks:H,constraints:N}=$.current,G={...N};$.current.id=F,$.current.idIsFromProps=s!==void 0,$.current.order=p,H.onCollapse=c,H.onExpand=u,H.onResize=d,N.collapsedSize=n,N.collapsible=r,N.defaultSize=i,N.maxSize=a,N.minSize=l,(G.collapsedSize!==N.collapsedSize||G.collapsible!==N.collapsible||G.maxSize!==N.maxSize||G.minSize!==N.minSize)&&T($.current,G)}),gc(()=>{const H=$.current;return M(H),()=>{j(H)}},[p,F,M,j]),x7(o,()=>({collapse:()=>{x($.current)},expand:H=>{w($.current,H)},getId(){return F},getSize(){return _($.current)},isCollapsed(){return R($.current)},isExpanded(){return!R($.current)},resize:H=>{L($.current,H)}}),[x,w,_,R,F,L]);const Q=E($.current,i);return Td(m,{...b,children:e,className:t,id:s,style:{...Q,...h},"data-panel":"","data-panel-collapsible":r||void 0,"data-panel-group-id":C,"data-panel-id":F,"data-panel-size":parseFloat(""+Q.flexGrow).toFixed(1)})}const S7=y7((e,t)=>Td(w7,{...e,forwardedRef:t}));w7.displayName="Panel";S7.displayName="forwardRef(Panel)";let D_=null,ql=null;function l2e(e,t){if(t){const n=(t&P7)!==0,r=(t&T7)!==0,i=(t&k7)!==0,o=(t&A7)!==0;if(n)return i?"se-resize":o?"ne-resize":"e-resize";if(r)return i?"sw-resize":o?"nw-resize":"w-resize";if(i)return"s-resize";if(o)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function c2e(){ql!==null&&(document.head.removeChild(ql),D_=null,ql=null)}function e1(e,t){const n=l2e(e,t);D_!==n&&(D_=n,ql===null&&(ql=document.createElement("style"),document.head.appendChild(ql)),ql.innerHTML=`*{cursor: ${n}!important;}`)}function _7(e){return e.type==="keydown"}function C7(e){return e.type.startsWith("pointer")}function E7(e){return e.type.startsWith("mouse")}function z0(e){if(C7(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(E7(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function u2e(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function d2e(e,t,n){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function f2e(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:AD(e),b:AD(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;xt(r,"Stacking order can only be calculated for elements with a common ancestor");const i={a:kD(TD(n.a)),b:kD(TD(n.b))};if(i.a===i.b){const o=r.childNodes,s={a:n.a.at(-1),b:n.b.at(-1)};let a=o.length;for(;a--;){const l=o[a];if(l===s.a)return 1;if(l===s.b)return-1}}return Math.sign(i.a-i.b)}const h2e=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function p2e(e){var t;const n=getComputedStyle((t=R7(e))!==null&&t!==void 0?t:e).display;return n==="flex"||n==="inline-flex"}function g2e(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||p2e(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||h2e.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function TD(e){let t=e.length;for(;t--;){const n=e[t];if(xt(n,"Missing node"),g2e(n))return n}return null}function kD(e){return e&&Number(getComputedStyle(e).zIndex)||0}function AD(e){const t=[];for(;e;)t.push(e),e=R7(e);return t}function R7(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const P7=1,T7=2,k7=4,A7=8,m2e=u2e()==="coarse";let Oo=[],Vu=!1,Ta=new Map,B0=new Map;const tp=new Set;function b2e(e,t,n,r,i){var o;const{ownerDocument:s}=t,a={direction:n,element:t,hitAreaMargins:r,setResizeHandlerState:i},l=(o=Ta.get(s))!==null&&o!==void 0?o:0;return Ta.set(s,l+1),tp.add(a),uy(),function(){var u;B0.delete(e),tp.delete(a);const d=(u=Ta.get(s))!==null&&u!==void 0?u:1;if(Ta.set(s,d-1),uy(),d===1&&Ta.delete(s),Oo.includes(a)){const p=Oo.indexOf(a);p>=0&&Oo.splice(p,1),n2(),i("up",!0,null)}}}function OD(e){const{target:t}=e,{x:n,y:r}=z0(e);Vu=!0,t2({target:t,x:n,y:r}),uy(),Oo.length>0&&(dy("down",e),e.preventDefault(),e.stopPropagation())}function Ff(e){const{x:t,y:n}=z0(e);if(Vu&&e.buttons===0&&(Vu=!1,dy("up",e)),!Vu){const{target:r}=e;t2({target:r,x:t,y:n})}dy("move",e),n2(),Oo.length>0&&e.preventDefault()}function yu(e){const{target:t}=e,{x:n,y:r}=z0(e);B0.clear(),Vu=!1,Oo.length>0&&e.preventDefault(),dy("up",e),t2({target:t,x:n,y:r}),n2(),uy()}function t2({target:e,x:t,y:n}){Oo.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),tp.forEach(i=>{const{element:o,hitAreaMargins:s}=i,a=o.getBoundingClientRect(),{bottom:l,left:c,right:u,top:d}=a,p=m2e?s.coarse:s.fine;if(t>=c-p&&t<=u+p&&n>=d-p&&n<=l+p){if(r!==null&&document.contains(r)&&o!==r&&!o.contains(r)&&!r.contains(o)&&f2e(r,o)>0){let m=r,b=!1;for(;m&&!m.contains(o);){if(d2e(m.getBoundingClientRect(),a)){b=!0;break}m=m.parentElement}if(b)return}Oo.push(i)}})}function t1(e,t){B0.set(e,t)}function n2(){let e=!1,t=!1;Oo.forEach(r=>{const{direction:i}=r;i==="horizontal"?e=!0:t=!0});let n=0;B0.forEach(r=>{n|=r}),e&&t?e1("intersection",n):e?e1("horizontal",n):t?e1("vertical",n):c2e()}function uy(){Ta.forEach((e,t)=>{const{body:n}=t;n.removeEventListener("contextmenu",yu),n.removeEventListener("pointerdown",OD),n.removeEventListener("pointerleave",Ff),n.removeEventListener("pointermove",Ff)}),window.removeEventListener("pointerup",yu),window.removeEventListener("pointercancel",yu),tp.size>0&&(Vu?(Oo.length>0&&Ta.forEach((e,t)=>{const{body:n}=t;e>0&&(n.addEventListener("contextmenu",yu),n.addEventListener("pointerleave",Ff),n.addEventListener("pointermove",Ff))}),window.addEventListener("pointerup",yu),window.addEventListener("pointercancel",yu)):Ta.forEach((e,t)=>{const{body:n}=t;e>0&&(n.addEventListener("pointerdown",OD,{capture:!0}),n.addEventListener("pointermove",Ff))}))}function dy(e,t){tp.forEach(n=>{const{setResizeHandlerState:r}=n,i=Oo.includes(n);r(e,i,t)})}function y2e(){const[e,t]=Hu(0);return ci(()=>t(n=>n+1),[])}function xt(e,t){if(!e)throw console.error(t),Error(t)}const r2=10;function kc(e,t,n=r2){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function qs(e,t,n=r2){return kc(e,t,n)===0}function Ii(e,t,n){return kc(e,t,n)===0}function v2e(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){const i=e[r],o=t[r];if(!Ii(i,o,n))return!1}return!0}function Tu({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];xt(r!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:o,maxSize:s=100,minSize:a=0}=r;if(kc(n,a)<0)if(o){const l=(i+a)/2;kc(n,l)<0?n=i:n=a}else n=a;return n=Math.min(s,n),n=parseFloat(n.toFixed(r2)),n}function eh({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:o}){if(Ii(e,0))return t;const s=[...t],[a,l]=r;xt(a!=null,"Invalid first pivot index"),xt(l!=null,"Invalid second pivot index");let c=0;if(o==="keyboard"){{const d=e<0?l:a,p=n[d];xt(p,`Panel constraints not found for index ${d}`);const{collapsedSize:h=0,collapsible:m,minSize:b=0}=p;if(m){const y=t[d];if(xt(y!=null,`Previous layout not found for panel index ${d}`),Ii(y,h)){const x=b-y;kc(x,Math.abs(e))>0&&(e=e<0?0-x:x)}}}{const d=e<0?a:l,p=n[d];xt(p,`No panel constraints found for index ${d}`);const{collapsedSize:h=0,collapsible:m,minSize:b=0}=p;if(m){const y=t[d];if(xt(y!=null,`Previous layout not found for panel index ${d}`),Ii(y,b)){const x=y-h;kc(x,Math.abs(e))>0&&(e=e<0?0-x:x)}}}}{const d=e<0?1:-1;let p=e<0?l:a,h=0;for(;;){const b=t[p];xt(b!=null,`Previous layout not found for panel index ${p}`);const x=Tu({panelConstraints:n,panelIndex:p,size:100})-b;if(h+=x,p+=d,p<0||p>=n.length)break}const m=Math.min(Math.abs(e),Math.abs(h));e=e<0?0-m:m}{let p=e<0?a:l;for(;p>=0&&p<n.length;){const h=Math.abs(e)-Math.abs(c),m=t[p];xt(m!=null,`Previous layout not found for panel index ${p}`);const b=m-h,y=Tu({panelConstraints:n,panelIndex:p,size:b});if(!Ii(m,y)&&(c+=m-y,s[p]=y,c.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?p--:p++}}if(v2e(i,s))return i;{const d=e<0?l:a,p=t[d];xt(p!=null,`Previous layout not found for panel index ${d}`);const h=p+c,m=Tu({panelConstraints:n,panelIndex:d,size:h});if(s[d]=m,!Ii(m,h)){let b=h-m,x=e<0?l:a;for(;x>=0&&x<n.length;){const w=s[x];xt(w!=null,`Previous layout not found for panel index ${x}`);const _=w+b,E=Tu({panelConstraints:n,panelIndex:x,size:_});if(Ii(w,E)||(b-=E-w,s[x]=E),Ii(b,0))break;e>0?x--:x++}}}const u=s.reduce((d,p)=>p+d,0);return Ii(u,100)?s:i}function x2e({layout:e,panelsArray:t,pivotIndices:n}){let r=0,i=100,o=0,s=0;const a=n[0];xt(a!=null,"No pivot index found"),t.forEach((d,p)=>{const{constraints:h}=d,{maxSize:m=100,minSize:b=0}=h;p===a?(r=b,i=m):(o+=b,s+=m)});const l=Math.min(i,100-o),c=Math.max(r,100-s),u=e[a];return{valueMax:l,valueMin:c,valueNow:u}}function np(e,t=document){return Array.from(t.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function O7(e,t,n=document){const i=np(e,n).findIndex(o=>o.getAttribute("data-panel-resize-handle-id")===t);return i??null}function M7(e,t,n){const r=O7(e,t,n);return r!=null?[r,r+1]:[-1,-1]}function I7(e,t=document){var n;if(t instanceof HTMLElement&&(t==null||(n=t.dataset)===null||n===void 0?void 0:n.panelGroupId)==e)return t;const r=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return r||null}function H0(e,t=document){const n=t.querySelector(`[data-panel-resize-handle-id="${e}"]`);return n||null}function w2e(e,t,n,r=document){var i,o,s,a;const l=H0(t,r),c=np(e,r),u=l?c.indexOf(l):-1,d=(i=(o=n[u])===null||o===void 0?void 0:o.id)!==null&&i!==void 0?i:null,p=(s=(a=n[u+1])===null||a===void 0?void 0:a.id)!==null&&s!==void 0?s:null;return[d,p]}function S2e({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:r,panelDataArray:i,panelGroupElement:o,setLayout:s}){fi({didWarnAboutMissingResizeHandle:!1}),gc(()=>{if(!o)return;const a=np(n,o);for(let l=0;l<i.length-1;l++){const{valueMax:c,valueMin:u,valueNow:d}=x2e({layout:r,panelsArray:i,pivotIndices:[l,l+1]}),p=a[l];if(p!=null){const h=i[l];xt(h,`No panel data found for index "${l}"`),p.setAttribute("aria-controls",h.id),p.setAttribute("aria-valuemax",""+Math.round(c)),p.setAttribute("aria-valuemin",""+Math.round(u)),p.setAttribute("aria-valuenow",d!=null?""+Math.round(d):"")}}return()=>{a.forEach((l,c)=>{l.removeAttribute("aria-controls"),l.removeAttribute("aria-valuemax"),l.removeAttribute("aria-valuemin"),l.removeAttribute("aria-valuenow")})}},[n,r,i,o]),pc(()=>{if(!o)return;const a=t.current;xt(a,"Eager values not found");const{panelDataArray:l}=a,c=I7(n,o);xt(c!=null,`No group found for id "${n}"`);const u=np(n,o);xt(u,`No resize handles found for group id "${n}"`);const d=u.map(p=>{const h=p.getAttribute("data-panel-resize-handle-id");xt(h,"Resize handle element has no handle id attribute");const[m,b]=w2e(n,h,l,o);if(m==null||b==null)return()=>{};const y=x=>{if(!x.defaultPrevented)switch(x.key){case"Enter":{x.preventDefault();const w=l.findIndex(_=>_.id===m);if(w>=0){const _=l[w];xt(_,`No panel data found for index ${w}`);const E=r[w],{collapsedSize:C=0,collapsible:R,minSize:T=0}=_.constraints;if(E!=null&&R){const M=eh({delta:Ii(E,C)?T-C:C-E,initialLayout:r,panelConstraints:l.map(L=>L.constraints),pivotIndices:M7(n,h,o),prevLayout:r,trigger:"keyboard"});r!==M&&s(M)}}break}}};return p.addEventListener("keydown",y),()=>{p.removeEventListener("keydown",y)}});return()=>{d.forEach(p=>p())}},[o,e,t,n,r,i,s])}function MD(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function D7(e,t){const n=e==="horizontal",{x:r,y:i}=z0(t);return n?r:i}function _2e(e,t,n,r,i){const o=n==="horizontal",s=H0(t,i);xt(s,`No resize handle element found for id "${t}"`);const a=s.getAttribute("data-panel-group-id");xt(a,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=r;const c=D7(n,e),u=I7(a,i);xt(u,`No group element found for id "${a}"`);const d=u.getBoundingClientRect(),p=o?d.width:d.height;return(c-l)/p*100}function C2e(e,t,n,r,i,o){if(_7(e)){const s=n==="horizontal";let a=0;e.shiftKey?a=100:i!=null?a=i:a=10;let l=0;switch(e.key){case"ArrowDown":l=s?0:a;break;case"ArrowLeft":l=s?-a:0;break;case"ArrowRight":l=s?a:0;break;case"ArrowUp":l=s?0:-a;break;case"End":l=100;break;case"Home":l=-100;break}return l}else return r==null?0:_2e(e,t,n,r,o)}function E2e({panelDataArray:e}){const t=Array(e.length),n=e.map(o=>o.constraints);let r=0,i=100;for(let o=0;o<e.length;o++){const s=n[o];xt(s,`Panel constraints not found for index ${o}`);const{defaultSize:a}=s;a!=null&&(r++,t[o]=a,i-=a)}for(let o=0;o<e.length;o++){const s=n[o];xt(s,`Panel constraints not found for index ${o}`);const{defaultSize:a}=s;if(a!=null)continue;const l=e.length-r,c=i/l;r++,t[o]=c,i-=c}return t}function vu(e,t,n){t.forEach((r,i)=>{const o=e[i];xt(o,`Panel data not found for index ${i}`);const{callbacks:s,constraints:a,id:l}=o,{collapsedSize:c=0,collapsible:u}=a,d=n[l];if(d==null||r!==d){n[l]=r;const{onCollapse:p,onExpand:h,onResize:m}=s;m&&m(r,d),u&&(p||h)&&(h&&(d==null||qs(d,c))&&!qs(r,c)&&h(),p&&(d==null||!qs(d,c))&&qs(r,c)&&p())}})}function $m(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function R2e({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:i,precision:o=3}){const s=n[i];let a;return s==null?a=e!=null?e.toPrecision(o):"1":r.length===1?a="1":a=s.toPrecision(o),{flexBasis:0,flexGrow:a,flexShrink:1,overflow:"hidden",pointerEvents:t!==null?"none":void 0}}function P2e(e,t=10){let n=null;return(...i)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...i)},t)}}function ID(e){try{if(typeof localStorage<"u")e.getItem=t=>localStorage.getItem(t),e.setItem=(t,n)=>{localStorage.setItem(t,n)};else throw new Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function N7(e){return`react-resizable-panels:${e}`}function L7(e){return e.map(t=>{const{constraints:n,id:r,idIsFromProps:i,order:o}=t;return i?r:o?`${o}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((t,n)=>t.localeCompare(n)).join(",")}function F7(e,t){try{const n=N7(e),r=t.getItem(n);if(r){const i=JSON.parse(r);if(typeof i=="object"&&i!=null)return i}}catch{}return null}function T2e(e,t,n){var r,i;const o=(r=F7(e,n))!==null&&r!==void 0?r:{},s=L7(t);return(i=o[s])!==null&&i!==void 0?i:null}function k2e(e,t,n,r,i){var o;const s=N7(e),a=L7(t),l=(o=F7(e,i))!==null&&o!==void 0?o:{};l[a]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{i.setItem(s,JSON.stringify(l))}catch(c){console.error(c)}}function DD({layout:e,panelConstraints:t}){const n=[...e],r=n.reduce((o,s)=>o+s,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(o=>`${o}%`).join(", ")}`);if(!Ii(r,100)&&n.length>0)for(let o=0;o<t.length;o++){const s=n[o];xt(s!=null,`No layout data found for index ${o}`);const a=100/r*s;n[o]=a}let i=0;for(let o=0;o<t.length;o++){const s=n[o];xt(s!=null,`No layout data found for index ${o}`);const a=Tu({panelConstraints:t,panelIndex:o,size:s});s!=a&&(i+=s-a,n[o]=a)}if(!Ii(i,0))for(let o=0;o<t.length;o++){const s=n[o];xt(s!=null,`No layout data found for index ${o}`);const a=s+i,l=Tu({panelConstraints:t,panelIndex:o,size:a});if(s!==l&&(i-=l-s,n[o]=l,Ii(i,0)))break}return n}const A2e=100,th={getItem:e=>(ID(th),th.getItem(e)),setItem:(e,t)=>{ID(th),th.setItem(e,t)}},ND={};function j7({autoSaveId:e=null,children:t,className:n="",direction:r,forwardedRef:i,id:o=null,onLayout:s=null,keyboardResizeBy:a=null,storage:l=th,style:c,tagName:u="div",...d}){const p=e2(o),h=fi(null),[m,b]=Hu(null),[y,x]=Hu([]),w=y2e(),_=fi({}),E=fi(new Map),C=fi(0),R=fi({autoSaveId:e,direction:r,dragState:m,id:p,keyboardResizeBy:a,onLayout:s,storage:l}),T=fi({layout:y,panelDataArray:[],panelDataArrayChanged:!1});fi({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),x7(i,()=>({getId:()=>R.current.id,getLayout:()=>{const{layout:O}=T.current;return O},setLayout:O=>{const{onLayout:ee}=R.current,{layout:K,panelDataArray:oe}=T.current,X=DD({layout:O,panelConstraints:oe.map(J=>J.constraints)});MD(K,X)||(x(X),T.current.layout=X,ee&&ee(X),vu(oe,X,_.current))}}),[]),gc(()=>{R.current.autoSaveId=e,R.current.direction=r,R.current.dragState=m,R.current.id=p,R.current.onLayout=s,R.current.storage=l}),S2e({committedValuesRef:R,eagerValuesRef:T,groupId:p,layout:y,panelDataArray:T.current.panelDataArray,setLayout:x,panelGroupElement:h.current}),pc(()=>{const{panelDataArray:O}=T.current;if(e){if(y.length===0||y.length!==O.length)return;let ee=ND[e];ee==null&&(ee=P2e(k2e,A2e),ND[e]=ee);const K=[...O],oe=new Map(E.current);ee(e,K,oe,y,l)}},[e,y,l]),pc(()=>{});const M=ci(O=>{const{onLayout:ee}=R.current,{layout:K,panelDataArray:oe}=T.current;if(O.constraints.collapsible){const X=oe.map(ge=>ge.constraints),{collapsedSize:J=0,panelSize:se,pivotIndices:le}=Tl(oe,O,K);if(xt(se!=null,`Panel size not found for panel "${O.id}"`),!qs(se,J)){E.current.set(O.id,se);const ie=wu(oe,O)===oe.length-1?se-J:J-se,pe=eh({delta:ie,initialLayout:K,panelConstraints:X,pivotIndices:le,prevLayout:K,trigger:"imperative-api"});$m(K,pe)||(x(pe),T.current.layout=pe,ee&&ee(pe),vu(oe,pe,_.current))}}},[]),L=ci((O,ee)=>{const{onLayout:K}=R.current,{layout:oe,panelDataArray:X}=T.current;if(O.constraints.collapsible){const J=X.map(he=>he.constraints),{collapsedSize:se=0,panelSize:le=0,minSize:ge=0,pivotIndices:ie}=Tl(X,O,oe),pe=ee??ge;if(qs(le,se)){const he=E.current.get(O.id),Re=he!=null&&he>=pe?he:pe,Fe=wu(X,O)===X.length-1?le-Re:Re-le,ke=eh({delta:Fe,initialLayout:oe,panelConstraints:J,pivotIndices:ie,prevLayout:oe,trigger:"imperative-api"});$m(oe,ke)||(x(ke),T.current.layout=ke,K&&K(ke),vu(X,ke,_.current))}}},[]),j=ci(O=>{const{layout:ee,panelDataArray:K}=T.current,{panelSize:oe}=Tl(K,O,ee);return xt(oe!=null,`Panel size not found for panel "${O.id}"`),oe},[]),F=ci((O,ee)=>{const{panelDataArray:K}=T.current,oe=wu(K,O);return R2e({defaultSize:ee,dragState:m,layout:y,panelData:K,panelIndex:oe})},[m,y]),$=ci(O=>{const{layout:ee,panelDataArray:K}=T.current,{collapsedSize:oe=0,collapsible:X,panelSize:J}=Tl(K,O,ee);return xt(J!=null,`Panel size not found for panel "${O.id}"`),X===!0&&qs(J,oe)},[]),Q=ci(O=>{const{layout:ee,panelDataArray:K}=T.current,{collapsedSize:oe=0,collapsible:X,panelSize:J}=Tl(K,O,ee);return xt(J!=null,`Panel size not found for panel "${O.id}"`),!X||kc(J,oe)>0},[]),H=ci(O=>{const{panelDataArray:ee}=T.current;ee.push(O),ee.sort((K,oe)=>{const X=K.order,J=oe.order;return X==null&&J==null?0:X==null?-1:J==null?1:X-J}),T.current.panelDataArrayChanged=!0,w()},[w]);gc(()=>{if(T.current.panelDataArrayChanged){T.current.panelDataArrayChanged=!1;const{autoSaveId:O,onLayout:ee,storage:K}=R.current,{layout:oe,panelDataArray:X}=T.current;let J=null;if(O){const le=T2e(O,X,K);le&&(E.current=new Map(Object.entries(le.expandToSizes)),J=le.layout)}J==null&&(J=E2e({panelDataArray:X}));const se=DD({layout:J,panelConstraints:X.map(le=>le.constraints)});MD(oe,se)||(x(se),T.current.layout=se,ee&&ee(se),vu(X,se,_.current))}}),gc(()=>{const O=T.current;return()=>{O.layout=[]}},[]);const N=ci(O=>{let ee=!1;const K=h.current;return K&&window.getComputedStyle(K,null).getPropertyValue("direction")==="rtl"&&(ee=!0),function(X){X.preventDefault();const J=h.current;if(!J)return()=>null;const{direction:se,dragState:le,id:ge,keyboardResizeBy:ie,onLayout:pe}=R.current,{layout:he,panelDataArray:Re}=T.current,{initialLayout:Oe}=le??{},Fe=M7(ge,O,J);let ke=C2e(X,O,se,le,ie,J);const Be=se==="horizontal";Be&&ee&&(ke=-ke);const dt=Re.map(mt=>mt.constraints),Ct=eh({delta:ke,initialLayout:Oe??he,panelConstraints:dt,pivotIndices:Fe,prevLayout:he,trigger:_7(X)?"keyboard":"mouse-or-touch"}),an=!$m(he,Ct);(C7(X)||E7(X))&&C.current!=ke&&(C.current=ke,!an&&ke!==0?Be?t1(O,ke<0?P7:T7):t1(O,ke<0?k7:A7):t1(O,0)),an&&(x(Ct),T.current.layout=Ct,pe&&pe(Ct),vu(Re,Ct,_.current))}},[]),G=ci((O,ee)=>{const{onLayout:K}=R.current,{layout:oe,panelDataArray:X}=T.current,J=X.map(he=>he.constraints),{panelSize:se,pivotIndices:le}=Tl(X,O,oe);xt(se!=null,`Panel size not found for panel "${O.id}"`);const ie=wu(X,O)===X.length-1?se-ee:ee-se,pe=eh({delta:ie,initialLayout:oe,panelConstraints:J,pivotIndices:le,prevLayout:oe,trigger:"imperative-api"});$m(oe,pe)||(x(pe),T.current.layout=pe,K&&K(pe),vu(X,pe,_.current))},[]),B=ci((O,ee)=>{const{layout:K,panelDataArray:oe}=T.current,{collapsedSize:X=0,collapsible:J}=ee,{collapsedSize:se=0,collapsible:le,maxSize:ge=100,minSize:ie=0}=O.constraints,{panelSize:pe}=Tl(oe,O,K);pe!=null&&(J&&le&&qs(pe,X)?qs(X,se)||G(O,se):pe<ie?G(O,ie):pe>ge&&G(O,ge))},[G]),W=ci((O,ee)=>{const{direction:K}=R.current,{layout:oe}=T.current;if(!h.current)return;const X=H0(O,h.current);xt(X,`Drag handle element not found for id "${O}"`);const J=D7(K,ee);b({dragHandleId:O,dragHandleRect:X.getBoundingClientRect(),initialCursorPosition:J,initialLayout:oe})},[]),q=ci(()=>{b(null)},[]),I=ci(O=>{const{panelDataArray:ee}=T.current,K=wu(ee,O);K>=0&&(ee.splice(K,1),delete _.current[O.id],T.current.panelDataArrayChanged=!0,w())},[w]),Y=i2e(()=>({collapsePanel:M,direction:r,dragState:m,expandPanel:L,getPanelSize:j,getPanelStyle:F,groupId:p,isPanelCollapsed:$,isPanelExpanded:Q,reevaluatePanelConstraints:B,registerPanel:H,registerResizeHandle:N,resizePanel:G,startDragging:W,stopDragging:q,unregisterPanel:I,panelGroupElement:h.current}),[M,m,r,L,j,F,p,$,Q,B,H,N,G,W,q,I]),U={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return Td($0.Provider,{value:Y},Td(u,{...d,children:t,className:n,id:o,ref:h,style:{...U,...c},"data-panel-group":"","data-panel-group-direction":r,"data-panel-group-id":p}))}const $7=y7((e,t)=>Td(j7,{...e,forwardedRef:t}));j7.displayName="PanelGroup";$7.displayName="forwardRef(PanelGroup)";function wu(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function Tl(e,t,n){const r=wu(e,t),o=r===e.length-1?[r-1,r]:[r,r+1],s=n[r];return{...t.constraints,panelSize:s,pivotIndices:o}}function O2e({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:r}){pc(()=>{if(e||n==null||r==null)return;const i=H0(t,r);if(i==null)return;const o=s=>{if(!s.defaultPrevented)switch(s.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{s.preventDefault(),n(s);break}case"F6":{s.preventDefault();const a=i.getAttribute("data-panel-group-id");xt(a,`No group element found for id "${a}"`);const l=np(a,r),c=O7(a,t,r);xt(c!==null,`No resize element found for id "${t}"`);const u=s.shiftKey?c>0?c-1:l.length-1:c+1<l.length?c+1:0;l[u].focus();break}}};return i.addEventListener("keydown",o),()=>{i.removeEventListener("keydown",o)}},[r,e,t,n])}function i2({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:r,id:i,onBlur:o,onDragging:s,onFocus:a,style:l={},tabIndex:c=0,tagName:u="div",...d}){var p,h;const m=fi(null),b=fi({onDragging:s});pc(()=>{b.current.onDragging=s});const y=v7($0);if(y===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:x,groupId:w,registerResizeHandle:_,startDragging:E,stopDragging:C,panelGroupElement:R}=y,T=e2(i),[M,L]=Hu("inactive"),[j,F]=Hu(!1),[$,Q]=Hu(null),H=fi({state:M});gc(()=>{H.current.state=M}),pc(()=>{if(n)Q(null);else{const W=_(T);Q(()=>W)}},[n,T,_]);const N=(p=r==null?void 0:r.coarse)!==null&&p!==void 0?p:15,G=(h=r==null?void 0:r.fine)!==null&&h!==void 0?h:5;return pc(()=>{if(n||$==null)return;const W=m.current;return xt(W,"Element ref not attached"),b2e(T,W,x,{coarse:N,fine:G},(I,Y,U)=>{if(Y)switch(I){case"down":{L("drag"),xt(U,'Expected event to be defined for "down" action'),E(T,U);const{onDragging:O}=b.current;O&&O(!0);break}case"move":{const{state:O}=H.current;O!=="drag"&&L("hover"),xt(U,'Expected event to be defined for "move" action'),$(U);break}case"up":{L("hover"),C();const{onDragging:O}=b.current;O&&O(!1);break}}else L("inactive")})},[N,x,n,G,_,T,$,E,C]),O2e({disabled:n,handleId:T,resizeHandler:$,panelGroupElement:R}),Td(u,{...d,children:e,className:t,id:i,onBlur:()=>{F(!1),o==null||o()},onFocus:()=>{F(!0),a==null||a()},ref:m,role:"separator",style:{...{touchAction:"none",userSelect:"none"},...l},tabIndex:c,"data-panel-group-direction":x,"data-panel-group-id":w,"data-resize-handle":"","data-resize-handle-active":M==="drag"?"pointer":j?"keyboard":void 0,"data-resize-handle-state":M,"data-panel-resize-handle-enabled":!n,"data-panel-resize-handle-id":T})}i2.displayName="PanelResizeHandle";const z7=({className:e,...t})=>v.jsx($7,{className:be("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t}),N_=S7,M2e=({withHandle:e,className:t,...n})=>v.jsx(i2,{className:be("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),...n,children:e&&v.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:v.jsx(oL,{className:"h-2.5 w-2.5"})})}),I2e=({withHandle:e,className:t,onTabClick:n,open:r,...i})=>v.jsx(i2,{className:be("relative flex w-px items-start justify-end bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",{"justify-start":r},t),...i,children:e&&v.jsx("div",{className:be("z-50 flex items-center justify-start",{"border-l":r}),children:v.jsx(br,{variant:"secondary",className:be("h-7 p-0.5",{"rounded-bl-none rounded-br-md rounded-tl-none rounded-tr-md":r,"mt-0 rounded-bl-md rounded-br-none rounded-tl-md rounded-tr-none":!r}),onClick:()=>n(!r),children:r?v.jsx(Gy,{className:"size-4"}):v.jsx(FC,{className:"size-4"})})})});var o2="Dialog",[B7,H7]=nr(o2),[D2e,Lo]=B7(o2),V7=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:s=!0}=e,a=P.useRef(null),l=P.useRef(null),[c=!1,u]=Dr({prop:r,defaultProp:i,onChange:o});return v.jsx(D2e,{scope:t,triggerRef:a,contentRef:l,contentId:Yn(),titleId:Yn(),descriptionId:Yn(),open:c,onOpenChange:u,onOpenToggle:P.useCallback(()=>u(d=>!d),[u]),modal:s,children:n})};V7.displayName=o2;var W7="DialogTrigger",U7=P.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Lo(W7,n),o=it(t,i.triggerRef);return v.jsx(Le.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":l2(i.open),...r,ref:o,onClick:Pe(e.onClick,i.onOpenToggle)})});U7.displayName=W7;var s2="DialogPortal",[N2e,G7]=B7(s2,{forceMount:void 0}),q7=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:i}=e,o=Lo(s2,t);return v.jsx(N2e,{scope:t,forceMount:n,children:P.Children.map(r,s=>v.jsx(Kn,{present:n||o.open,children:v.jsx(Ep,{asChild:!0,container:i,children:s})}))})};q7.displayName=s2;var fy="DialogOverlay",Y7=P.forwardRef((e,t)=>{const n=G7(fy,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=Lo(fy,e.__scopeDialog);return o.modal?v.jsx(Kn,{present:r||o.open,children:v.jsx(L2e,{...i,ref:t})}):null});Y7.displayName=fy;var L2e=P.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Lo(fy,n);return v.jsx(Tp,{as:ea,allowPinchZoom:!0,shards:[i.contentRef],children:v.jsx(Le.div,{"data-state":l2(i.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Ac="DialogContent",K7=P.forwardRef((e,t)=>{const n=G7(Ac,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,o=Lo(Ac,e.__scopeDialog);return v.jsx(Kn,{present:r||o.open,children:o.modal?v.jsx(F2e,{...i,ref:t}):v.jsx(j2e,{...i,ref:t})})});K7.displayName=Ac;var F2e=P.forwardRef((e,t)=>{const n=Lo(Ac,e.__scopeDialog),r=P.useRef(null),i=it(t,n.contentRef,r);return P.useEffect(()=>{const o=r.current;if(o)return g0(o)},[]),v.jsx(X7,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Pe(e.onCloseAutoFocus,o=>{var s;o.preventDefault(),(s=n.triggerRef.current)==null||s.focus()}),onPointerDownOutside:Pe(e.onPointerDownOutside,o=>{const s=o.detail.originalEvent,a=s.button===0&&s.ctrlKey===!0;(s.button===2||a)&&o.preventDefault()}),onFocusOutside:Pe(e.onFocusOutside,o=>o.preventDefault())})}),j2e=P.forwardRef((e,t)=>{const n=Lo(Ac,e.__scopeDialog),r=P.useRef(!1),i=P.useRef(!1);return v.jsx(X7,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var s,a;(s=e.onCloseAutoFocus)==null||s.call(e,o),o.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),o.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:o=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const s=o.target;((c=n.triggerRef.current)==null?void 0:c.contains(s))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),X7=P.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,...s}=e,a=Lo(Ac,n),l=P.useRef(null),c=it(t,l);return h0(),v.jsxs(v.Fragment,{children:[v.jsx(Pp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:v.jsx(zc,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":l2(a.open),...s,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),v.jsxs(v.Fragment,{children:[v.jsx(z2e,{titleId:a.titleId}),v.jsx(H2e,{contentRef:l,descriptionId:a.descriptionId})]})]})}),a2="DialogTitle",Q7=P.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Lo(a2,n);return v.jsx(Le.h2,{id:i.titleId,...r,ref:t})});Q7.displayName=a2;var Z7="DialogDescription",J7=P.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Lo(Z7,n);return v.jsx(Le.p,{id:i.descriptionId,...r,ref:t})});J7.displayName=Z7;var e$="DialogClose",t$=P.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=Lo(e$,n);return v.jsx(Le.button,{type:"button",...r,ref:t,onClick:Pe(e.onClick,()=>i.onOpenChange(!1))})});t$.displayName=e$;function l2(e){return e?"open":"closed"}var n$="DialogTitleWarning",[$2e,r$]=ZX(n$,{contentName:Ac,titleName:a2,docsSlug:"dialog"}),z2e=({titleId:e})=>{const t=r$(n$),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
416
416
|
|
|
417
417
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
418
418
|
|