semaphor 0.0.110 → 0.0.111
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{dashboard-plus-BNf0BV-P.js → dashboard-plus-CCV5mAgn.js} +2 -2
- package/dist/chunks/{dashboard-plus-De4ARAzt.js → dashboard-plus-CZggRVns.js} +2 -2
- package/dist/chunks/{index-CphHc_zH.js → index-CL8DpfKu.js} +77 -77
- package/dist/chunks/{index-_4WM9HaF.js → index-IrFoACqT.js} +2 -2
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +1 -1
- package/package.json +3 -3
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
*/var TN;function tY(){return TN||(TN=1,process.env.NODE_ENV!=="production"&&function(){function e(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=R,n=R0,r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,i=t.useRef,s=t.useEffect,a=t.useMemo,l=t.useDebugValue;zv.useSyncExternalStoreWithSelector=function(c,u,d,h,p){var g=i(null);if(g.current===null){var m={hasValue:!1,value:null};g.current=m}else m=g.current;g=a(function(){function y(E){if(!v){if(v=!0,x=E,E=h(E),p!==void 0&&m.hasValue){var C=m.value;if(p(C,E))return S=C}return S=E}if(C=S,r(x,E))return C;var k=h(E);return p!==void 0&&p(C,k)?(x=E,C):(x=E,S=k)}var v=!1,x,S,_=d===void 0?null:d;return[function(){return y(u())},_===null?void 0:function(){return y(_())}]},[u,d,h,p]);var b=o(c,g[0],g[1]);return s(function(){m.hasValue=!0,m.value=b},[b]),l(b),b},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),zv}process.env.NODE_ENV==="production"?d1.exports=eY():d1.exports=tY();var nY=d1.exports;const rY=Pa(nY),Kj={},{useDebugValue:oY}=R,{useSyncExternalStoreWithSelector:iY}=rY;let jN=!1;const sY=e=>e;function aY(e,t=sY,n){(Kj?"production":void 0)!=="production"&&n&&!jN&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),jN=!0);const r=iY(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return oY(r),r}const ON=e=>{(Kj?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?Qq(e):e,n=(r,o)=>aY(t,r,o);return Object.assign(n,t),n},Es=e=>e?ON(e):ON;var Xj=Symbol.for("immer-nothing"),FN=Symbol.for("immer-draftable"),io=Symbol.for("immer-state"),lY=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function jr(e,...t){if(process.env.NODE_ENV!=="production"){const n=lY[e],r=typeof n=="function"?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Pu=Object.getPrototypeOf;function Du(e){return!!e&&!!e[io]}function zl(e){var t;return e?Qj(e)||Array.isArray(e)||!!e[FN]||!!((t=e.constructor)!=null&&t[FN])||N0(e)||M0(e):!1}var cY=Object.prototype.constructor.toString();function Qj(e){if(!e||typeof e!="object")return!1;const t=Pu(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===cY}function Yg(e,t){k0(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function k0(e){const t=e[io];return t?t.type_:Array.isArray(e)?1:N0(e)?2:M0(e)?3:0}function h1(e,t){return k0(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Zj(e,t,n){const r=k0(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function uY(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function N0(e){return e instanceof Map}function M0(e){return e instanceof Set}function tl(e){return e.copy_||e.base_}function p1(e,t){if(N0(e))return new Map(e);if(M0(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Qj(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[io];let o=Reflect.ownKeys(r);for(let i=0;i<o.length;i++){const s=o[i],a=r[s];a.writable===!1&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(r[s]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[s]})}return Object.create(Pu(e),r)}else{const r=Pu(e);if(r!==null&&n)return{...e};const o=Object.create(r);return Object.assign(o,e)}}function yE(e,t=!1){return P0(e)||Du(e)||!zl(e)||(k0(e)>1&&(e.set=e.add=e.clear=e.delete=dY),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>yE(r,!0))),e}function dY(){jr(2)}function P0(e){return Object.isFrozen(e)}var fY={};function Bl(e){const t=fY[e];return t||jr(0,e),t}var Kf;function Jj(){return Kf}function hY(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function LN(e,t){t&&(Bl("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function m1(e){g1(e),e.drafts_.forEach(pY),e.drafts_=null}function g1(e){e===Kf&&(Kf=e.parent_)}function $N(e){return Kf=hY(Kf,e)}function pY(e){const t=e[io];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function zN(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[io].modified_&&(m1(t),jr(4)),zl(e)&&(e=Kg(t,e),t.parent_||Xg(t,e)),t.patches_&&Bl("Patches").generateReplacementPatches_(n[io].base_,e,t.patches_,t.inversePatches_)):e=Kg(t,n,[]),m1(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Xj?e:void 0}function Kg(e,t,n){if(P0(t))return t;const r=t[io];if(!r)return Yg(t,(o,i)=>BN(e,r,t,o,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return Xg(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const o=r.copy_;let i=o,s=!1;r.type_===3&&(i=new Set(o),o.clear(),s=!0),Yg(i,(a,l)=>BN(e,r,o,a,l,n,s)),Xg(e,o,!1),n&&e.patches_&&Bl("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function BN(e,t,n,r,o,i,s){if(process.env.NODE_ENV!=="production"&&o===n&&jr(5),Du(o)){const a=i&&t&&t.type_!==3&&!h1(t.assigned_,r)?i.concat(r):void 0,l=Kg(e,o,a);if(Zj(n,r,l),Du(l))e.canAutoFreeze_=!1;else return}else s&&n.add(o);if(zl(o)&&!P0(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Kg(e,o),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&Xg(e,o)}}function Xg(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&yE(t,n)}function mY(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Jj(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=vE;n&&(o=[r],i=Xf);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}var vE={get(e,t){if(t===io)return e;const n=tl(e);if(!h1(n,t))return gY(e,n,t);const r=n[t];return e.finalized_||!zl(r)?r:r===Bv(e.base_,t)?(Vv(e),e.copy_[t]=y1(r,e)):r},has(e,t){return t in tl(e)},ownKeys(e){return Reflect.ownKeys(tl(e))},set(e,t,n){const r=eO(tl(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const o=Bv(tl(e),t),i=o==null?void 0:o[io];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(uY(n,o)&&(n!==void 0||h1(e.base_,t)))return!0;Vv(e),b1(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Bv(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Vv(e),b1(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=tl(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){jr(11)},getPrototypeOf(e){return Pu(e.base_)},setPrototypeOf(){jr(12)}},Xf={};Yg(vE,(e,t)=>{Xf[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Xf.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&jr(13),Xf.set.call(this,e,t,void 0)};Xf.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&jr(14),vE.set.call(this,e[0],t,n,e[0])};function Bv(e,t){const n=e[io];return(n?tl(n):e)[t]}function gY(e,t,n){var o;const r=eO(t,n);return r?"value"in r?r.value:(o=r.get)==null?void 0:o.call(e.draft_):void 0}function eO(e,t){if(!(t in e))return;let n=Pu(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Pu(n)}}function b1(e){e.modified_||(e.modified_=!0,e.parent_&&b1(e.parent_))}function Vv(e){e.copy_||(e.copy_=p1(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var bY=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(l=i,...c){return s.produce(l,u=>n.call(this,u,...c))}}typeof n!="function"&&jr(6),r!==void 0&&typeof r!="function"&&jr(7);let o;if(zl(t)){const i=$N(this),s=y1(t,void 0);let a=!0;try{o=n(s),a=!1}finally{a?m1(i):g1(i)}return LN(i,r),zN(o,i)}else if(!t||typeof t!="object"){if(o=n(t),o===void 0&&(o=t),o===Xj&&(o=void 0),this.autoFreeze_&&yE(o,!0),r){const i=[],s=[];Bl("Patches").generateReplacementPatches_(t,o,i,s),r(i,s)}return o}else jr(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...a)=>this.produceWithPatches(s,l=>t(l,...a));let r,o;return[this.produce(t,n,(s,a)=>{r=s,o=a}),r,o]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){zl(e)||jr(8),Du(e)&&(e=yY(e));const t=$N(this),n=y1(e,void 0);return n[io].isManual_=!0,g1(t),n}finishDraft(e,t){const n=e&&e[io];(!n||!n.isManual_)&&jr(9);const{scope_:r}=n;return LN(r,t),zN(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const o=t[n];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}n>-1&&(t=t.slice(n+1));const r=Bl("Patches").applyPatches_;return Du(e)?r(e,t):this.produce(e,o=>r(o,t))}};function y1(e,t){const n=N0(e)?Bl("MapSet").proxyMap_(e,t):M0(e)?Bl("MapSet").proxySet_(e,t):mY(e,t);return(t?t.scope_:Jj()).drafts_.push(n),n}function yY(e){return Du(e)||jr(10,e),tO(e)}function tO(e){if(!zl(e)||P0(e))return e;const t=e[io];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=p1(e,t.scope_.immer_.useStrictShallowCopy_)}else n=p1(e,!0);return Yg(n,(r,o)=>{Zj(n,r,tO(o))}),t&&(t.finalized_=!1),n}var so=new bY,vY=so.produce;so.produceWithPatches.bind(so);so.setAutoFreeze.bind(so);so.setUseStrictShallowCopy.bind(so);so.applyPatches.bind(so);so.createDraft.bind(so);so.finishDraft.bind(so);const xY=e=>(t,n,r)=>(r.setState=(o,i,...s)=>{const a=typeof o=="function"?vY(o):o;return t(a,i,...s)},e(r.setState,n,r)),Jh=xY;var v1,lm=rn;if(process.env.NODE_ENV==="production")v1=lm.createRoot,lm.hydrateRoot;else{var VN=lm.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;v1=function(e,t){VN.usingClientEntryPoint=!0;try{return lm.createRoot(e,t)}finally{VN.usingClientEntryPoint=!1}}}var nO={},rO={},xE={exports:{}},tt=String,oO=function(){return{isColorSupported:!1,reset:tt,bold:tt,dim:tt,italic:tt,underline:tt,inverse:tt,hidden:tt,strikethrough:tt,black:tt,red:tt,green:tt,yellow:tt,blue:tt,magenta:tt,cyan:tt,white:tt,gray:tt,bgBlack:tt,bgRed:tt,bgGreen:tt,bgYellow:tt,bgBlue:tt,bgMagenta:tt,bgCyan:tt,bgWhite:tt,blackBright:tt,redBright:tt,greenBright:tt,yellowBright:tt,blueBright:tt,magentaBright:tt,cyanBright:tt,whiteBright:tt,bgBlackBright:tt,bgRedBright:tt,bgGreenBright:tt,bgYellowBright:tt,bgBlueBright:tt,bgMagentaBright:tt,bgCyanBright:tt,bgWhiteBright:tt}};xE.exports=oO();xE.exports.createColors=oO;var wY=xE.exports;(function(e){Object.defineProperty(e,"__esModule",{value:!0});function t(l,c){for(var u in c)Object.defineProperty(l,u,{enumerable:!0,get:c[u]})}t(e,{dim:function(){return s},default:function(){return a}});const n=r(wY);function r(l){return l&&l.__esModule?l:{default:l}}let o=new Set;function i(l,c,u){typeof process<"u"&&process.env.JEST_WORKER_ID||u&&o.has(u)||(u&&o.add(u),console.warn(""),c.forEach(d=>console.warn(l,"-",d)))}function s(l){return n.default.dim(l)}const a={info(l,c){i(n.default.bold(n.default.cyan("info")),...Array.isArray(l)?[l]:[c,l])},warn(l,c){i(n.default.bold(n.default.yellow("warn")),...Array.isArray(l)?[l]:[c,l])},risk(l,c){i(n.default.bold(n.default.magenta("risk")),...Array.isArray(l)?[l]:[c,l])}}})(rO);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o}});const t=n(rO);function n(i){return i&&i.__esModule?i:{default:i}}function r({version:i,from:s,to:a}){t.default.warn(`${s}-color-renamed`,[`As of Tailwind CSS ${i}, \`${s}\` has been renamed to \`${a}\`.`,"Update your configuration file to silence this warning."])}const o={inherit:"inherit",current:"currentColor",transparent:"transparent",black:"#000",white:"#fff",slate:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a",950:"#020617"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827",950:"#030712"},zinc:{50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b",950:"#09090b"},neutral:{50:"#fafafa",100:"#f5f5f5",200:"#e5e5e5",300:"#d4d4d4",400:"#a3a3a3",500:"#737373",600:"#525252",700:"#404040",800:"#262626",900:"#171717",950:"#0a0a0a"},stone:{50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a8a29e",500:"#78716c",600:"#57534e",700:"#44403c",800:"#292524",900:"#1c1917",950:"#0c0a09"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"},orange:{50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12",950:"#431407"},amber:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#f59e0b",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f",950:"#451a03"},yellow:{50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12",950:"#422006"},lime:{50:"#f7fee7",100:"#ecfccb",200:"#d9f99d",300:"#bef264",400:"#a3e635",500:"#84cc16",600:"#65a30d",700:"#4d7c0f",800:"#3f6212",900:"#365314",950:"#1a2e05"},green:{50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d",950:"#052e16"},emerald:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#10b981",600:"#059669",700:"#047857",800:"#065f46",900:"#064e3b",950:"#022c22"},teal:{50:"#f0fdfa",100:"#ccfbf1",200:"#99f6e4",300:"#5eead4",400:"#2dd4bf",500:"#14b8a6",600:"#0d9488",700:"#0f766e",800:"#115e59",900:"#134e4a",950:"#042f2e"},cyan:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63",950:"#083344"},sky:{50:"#f0f9ff",100:"#e0f2fe",200:"#bae6fd",300:"#7dd3fc",400:"#38bdf8",500:"#0ea5e9",600:"#0284c7",700:"#0369a1",800:"#075985",900:"#0c4a6e",950:"#082f49"},blue:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a",950:"#172554"},indigo:{50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81",950:"#1e1b4b"},violet:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95",950:"#2e1065"},purple:{50:"#faf5ff",100:"#f3e8ff",200:"#e9d5ff",300:"#d8b4fe",400:"#c084fc",500:"#a855f7",600:"#9333ea",700:"#7e22ce",800:"#6b21a8",900:"#581c87",950:"#3b0764"},fuchsia:{50:"#fdf4ff",100:"#fae8ff",200:"#f5d0fe",300:"#f0abfc",400:"#e879f9",500:"#d946ef",600:"#c026d3",700:"#a21caf",800:"#86198f",900:"#701a75",950:"#4a044e"},pink:{50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843",950:"#500724"},rose:{50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337",950:"#4c0519"},get lightBlue(){return r({version:"v2.2",from:"lightBlue",to:"sky"}),this.sky},get warmGray(){return r({version:"v3.0",from:"warmGray",to:"stone"}),this.stone},get trueGray(){return r({version:"v3.0",from:"trueGray",to:"neutral"}),this.neutral},get coolGray(){return r({version:"v3.0",from:"coolGray",to:"gray"}),this.gray},get blueGray(){return r({version:"v3.0",from:"blueGray",to:"slate"}),this.slate}}})(nO);let Hv=nO;var CY=(Hv.__esModule?Hv:{default:Hv}).default;const Mt=Pa(CY),Qg=!1,wE=`import pandas as pd
|
|
34
34
|
df = pd.DataFrame(data) # 'data' contains the query result
|
|
35
35
|
result = df.to_dict('records') # must return 'result' as [dict] type
|
|
36
|
-
`,iO=["_forecast"],Zg="dm",Qf=[{locale:"en-US",currency:"USD",currencyName:"US Dollar"},{locale:"en-GB",currency:"GBP",currencyName:"British Pound"},{locale:"en-CA",currency:"CAD",currencyName:"Canadian Dollar"},{locale:"en-AU",currency:"AUD",currencyName:"Australian Dollar"},{locale:"en-IN",currency:"INR",currencyName:"Indian Rupee"},{locale:"ja-JP",currency:"JPY",currencyName:"Japanese Yen"},{locale:"de-DE",currency:"EUR",currencyName:"Germany (Eurozone)"},{locale:"fr-FR",currency:"EUR",currencyName:"France (Eurozone)"},{locale:"es-ES",currency:"EUR",currencyName:"Spain (Eurozone)"},{locale:"it-IT",currency:"EUR",currencyName:"Italy (Eurozone)"},{locale:"fi-FI",currency:"EUR",currencyName:"Finland (Eurozone)"},{locale:"nl-NL",currency:"EUR",currencyName:"Netherlands (Eurozone)"},{locale:"zh-CN",currency:"CNY",currencyName:"Chinese Yuan"},{locale:"ru-RU",currency:"RUB",currencyName:"Russian Ruble"},{locale:"pt-BR",currency:"BRL",currencyName:"Brazilian Real"},{locale:"ko-KR",currency:"KRW",currencyName:"South Korean Won"},{locale:"ar-SA",currency:"SAR",currencyName:"Saudi Riyal"},{locale:"sv-SE",currency:"SEK",currencyName:"Swedish Krona"},{locale:"no-NO",currency:"NOK",currencyName:"Norwegian Krone"},{locale:"da-DK",currency:"DKK",currencyName:"Danish Krone"},{locale:"pl-PL",currency:"PLN",currencyName:"Polish Zloty"},{locale:"tr-TR",currency:"TRY",currencyName:"Turkish Lira"},{locale:"he-IL",currency:"ILS",currencyName:"Israeli Shekel"},{locale:"th-TH",currency:"THB",currencyName:"Thai Baht"},{locale:"vi-VN",currency:"VND",currencyName:"Vietnamese Dong"},{locale:"id-ID",currency:"IDR",currencyName:"Indonesian Rupiah"},{locale:"mx-MX",currency:"MXN",currencyName:"Mexican Peso"},{locale:"za-ZA",currency:"ZAR",currencyName:"South African Rand"},{locale:"sg-SG",currency:"SGD",currencyName:"Singapore Dollar"},{locale:"hk-HK",currency:"HKD",currencyName:"Hong Kong Dollar"},{locale:"ch-CH",currency:"CHF",currencyName:"Swiss Franc"},{locale:"my-MY",currency:"MYR",currencyName:"Malaysian Ringgit"},{locale:"ph-PH",currency:"PHP",currencyName:"Philippine Peso"},{locale:"eg-EG",currency:"EGP",currencyName:"Egyptian Pound"},{locale:"nz-NZ",currency:"NZD",currencyName:"New Zealand Dollar"}],SY=[{label:"English",locales:[{code:"en-US",name:"US English"},{code:"en-GB",name:"British English"},{code:"en-AU",name:"Australian English"},{code:"en-CA",name:"Canadian English"}]},{label:"French",locales:[{code:"fr-FR",name:"France French"},{code:"fr-CA",name:"Canadian French"}]},{label:"Spanish",locales:[{code:"es-ES",name:"Spain Spanish"},{code:"es-MX",name:"Mexican Spanish"},{code:"es-419",name:"Latin American Spanish"}]},{label:"German",locales:[{code:"de-DE",name:"Germany German"},{code:"de-CH",name:"Swiss German"}]},{label:"Chinese",locales:[{code:"zh-CN",name:"Simplified Chinese (China)"},{code:"zh-TW",name:"Traditional Chinese (Taiwan)"},{code:"zh-HK",name:"Hong Kong Chinese"}]},{label:"Japanese",locales:[{code:"ja-JP",name:"Japanese"}]},{label:"Arabic",locales:[{code:"ar-EG",name:"Egypt Arabic"},{code:"ar-SA",name:"Saudi Arabia Arabic"}]},{label:"Russian",locales:[{code:"ru-RU",name:"Russian"}]},{label:"Portuguese",locales:[{code:"pt-PT",name:"Portugal Portuguese"},{code:"pt-BR",name:"Brazil Portuguese"}]},{label:"Indian Languages",locales:[{code:"hi-IN",name:"Hindi (India)"},{code:"ta-IN",name:"Tamil (India)"}]},{label:"Korean",locales:[{code:"ko-KR",name:"Korean"}]},{label:"Italian",locales:[{code:"it-IT",name:"Italian (Italy)"}]},{label:"Dutch",locales:[{code:"nl-NL",name:"Dutch (Netherlands)"}]},{label:"Swedish",locales:[{code:"sv-SE",name:"Swedish (Sweden)"}]},{label:"Turkish",locales:[{code:"tr-TR",name:"Turkish (Turkey)"}]},{label:"Hebrew",locales:[{code:"he-IL",name:"Hebrew (Israel)"}]},{label:"Thai",locales:[{code:"th-TH",name:"Thai (Thailand)"}]},{label:"Polish",locales:[{code:"pl-PL",name:"Polish (Poland)"}]},{label:"Greek",locales:[{code:"el-GR",name:"Greek (Greece)"}]},{label:"Norwegian",locales:[{code:"no-NO",name:"Norwegian (Norway)"}]}],CE=["lg","md","sm","xs","xxs"],Jg={default:{dashboardPanel:"",dashboardTabsContainer:"",gridLayout:{className:""},chart:{font:{family:"Open Sans, Arial, sans-serif"},dataset:{backgroundColor:[Mt.teal[500],Mt.teal[300],Mt.gray[700],Mt.gray[500],Mt.gray[300]],borderColor:[Mt.teal[500],Mt.teal[300],Mt.gray[700],Mt.gray[500],Mt.gray[300]]},options:{interaction:{mode:"index"},plugins:{datalabels:{display:!1,color:x1},title:{display:!0},tooltip:{backgroundColor:"#fff",bodyColor:"#000",borderWidth:.25,titleColor:"#000",borderColor:"rgb(128,131,139)",cornerRadius:4,usePointStyle:!0,pointStyle:"rectRounded",boxPadding:4},legend:{position:"top",align:"center",maxHeight:0,labels:{useBorderRadius:!0,borderRadius:2}}},scales:{y:{grid:{display:!0},title:{display:!0,text:""},beginAtZero:!0,ticks:{precision:0}},x:{grid:{display:!0},title:{display:!0}}},layout:{padding:{top:-40}},borderRadius:2,responsive:!0,maintainAspectRatio:!1}}},dark:{chart:{dataset:{datalables:{color:x1},backgroundColor:[Mt.teal[500],Mt.teal[300],Mt.gray[700],Mt.gray[500],Mt.gray[300]],borderColor:[Mt.teal[500],Mt.teal[300],Mt.gray[700],Mt.gray[500],Mt.gray[300]]},options:{plugins:{tooltip:{backgroundColor:"#000",bodyColor:"#fff",borderWidth:.25,titleColor:"#fff",borderColor:"rgb(128,131,139)",cornerRadius:2,boxPadding:4}},datalabels:{display:!1},scales:{x:{grid:{display:!0,color:Mt.slate[800]}},y:{grid:{display:!0,color:Mt.slate[800]}}}}}}};function x1(e){var r,o,i,s,a,l;const t=(a=(s=(i=(o=(r=e==null?void 0:e.chart)==null?void 0:r.config)==null?void 0:o._config)==null?void 0:i.options)==null?void 0:s.plugins)==null?void 0:a.datalabels;let n=(l=e==null?void 0:e.dataset)==null?void 0:l.backgroundColor;return(t==null?void 0:t.align)==="end"&&(t==null?void 0:t.anchor)==="end"&&(n=Zf()),(t==null?void 0:t.align)==="start"&&(t==null?void 0:t.anchor)==="start"&&(n=Zf()),Au(n)}function Zf(){return oe.getState().theme==="dark"?"#000000":"#FFFFFF"}function Au(e){let t=0,n=0,r=0,o=0;const i=u=>{if(!u)return Mt.gray[500];const d=u.replace("#",""),h=parseInt(d.substring(0,2),16),p=parseInt(d.substring(2,4),16),g=parseInt(d.substring(4,6),16);t+=h,n+=p,r+=g,o++};Array.isArray(e)?e.forEach(u=>{i(u)}):i(e);const s=t/o,a=n/o,l=r/o;return(s*299+a*587+l*114)/1e3>=180?"black":"white"}const EY=["text","nullable(string)","name","enum","varchar","nvarchar","nvarchar2","char","character","longtext","nchar","char varying","nchar varying","character varying","string"],_Y=["number","integer","int","int64","bigint","smallint","tinyint","byteint","numeric","decimal","dec","double","real","double precision","float","float4","float8","float64"],RY=["date","datetime","time","timestamp","timestamp without time zone","timestamp_ns"],kY=["boolean"];function SE(e){return e.match(/[A-Z]/)?`"${e}"`:e}function D0(e){return EY.includes(e.toLowerCase())||/varchar/i.test(e)}function ep(e){return _Y.includes(e.toLowerCase())||/int|decimal|float|double/i.test(e)}function ic(e){return RY.includes(e.toLowerCase())||/date|time|timestamp/i.test(e)}function EE(e){return kY.includes(e.toLowerCase())||/boolean/i.test(e)}function NY(e,t,n,r,o,i){const{measures:s,dimensions:a}=e,l=s==null?void 0:s.map(h=>`${h.calc}(${h.name}) as ${h.calc}_${h.name.replace(/"/g,"")}`).join(", "),c=(a==null?void 0:a.join(", "))||"";let u="";const d=r?`${Zg}.${r}`:_E({schemaName:t,tableName:n,connectionType:o,databaseName:i});if(l&&c)return u=`SELECT ${c}, COUNT(*) as count, ${l} FROM ${d} GROUP BY ${c} ORDER BY ${c} DESC LIMIT 100`,u;if(!l&&c)return u=`SELECT ${c}, COUNT(*) as count FROM ${d} GROUP BY ${c} ORDER BY ${c} DESC LIMIT 100`,u;if(l&&!c)return u=`SELECT ${l} FROM ${d} LIMIT 100`,u}function MY(e,t,n="AVG"){var i,s,a,l;let r={};const o=SE(e.column_name);return D0(e.data_type)&&(((i=t.dimensions)==null?void 0:i.includes(o))?r={...t,dimensions:(s=t.dimensions)==null?void 0:s.filter(u=>u!==o)}:r={...t,dimensions:[...t.dimensions||[],o]}),ep(e.data_type)&&(((a=t.measures)==null?void 0:a.some(u=>u.name===o&&u.calc===n))?r={...t,measures:(l=t.measures)==null?void 0:l.filter(u=>!(u.name===o&&u.calc===n))}:r={...t,measures:[...t.measures||[],{name:o,calc:n||"SUM"}]}),r}function nu(e){return D0(e.dataType)?"string":ep(e.dataType)?"number":ic(e.dataType)?"date":EE(e.dataType)?"boolean":"string"}function PY(e){let t;const n=e.data_type.toLowerCase();return D0(n)?t="T":ep(n)?t="#":ic(n)?t="D":EE(n)?t="B":t="?",t}function DY(e,t){const{dimensions:n,measures:r}=t,o=n==null?void 0:n.includes(e.column_name),i=r==null?void 0:r.some(s=>s.name===e.column_name);return o||i}function sO(e){return e?e!=null&&e.startsWith(`${Zg}.`)?e:`${Zg}.${e}`:""}function aO({schemaName:e,tableName:t,modelName:n,connectionType:r,databaseName:o}){let i=_E({schemaName:e,tableName:t,connectionType:r,databaseName:o});n&&(i=sO(n));let s=i;return(l=>/[A-Z]/.test(l))(t)&&(s=s.split(".").map(c=>`"${c}"`).join(".")),s}function _E({schemaName:e,tableName:t,connectionType:n,databaseName:r}){return t==="api"||e===SE("NA")||n==="S3"||n==="API"?t:n==="S3Tables"?`${r}.${e}.${t}`:e?`${e}.${t}`:`${t}`}const AY=e=>{const t=new Date(e);return!isNaN(t.getTime())},IY=e=>!isNaN(Number(e))&&!isNaN(parseFloat(e)),A0=e=>{let t;return typeof e=="number"?t="number":typeof e=="string"?AY(e)?t="date":IY(e)?t="number":t="string":typeof e=="boolean"?t="boolean":e instanceof Date?t="date":t="unknown",t};function TY({get:e,dataPoint:t,card:n}){var h;const{addOrUpdateFilterValue:r,addFilteringCard:o,removeFilterValues:i,replaceFilterValue:s,removeFilteringCard:a}=e().actions,l=e().filteringCards,{columnName:c,columnValue:u}=t,d={filterId:n.id,connectionId:n==null?void 0:n.connectionId,tableName:n.lastSelectedTable,name:c,expression:(h=n.preferences)==null?void 0:h.filterOnClickField,valueType:A0(u),operation:"=",values:[u]};if(l!=null&&l.find(p=>p.id===n.id)){const p=n.id;if(u==null){a(n),i(p);return}else s(d)}o(n),r(d)}function HN({id:e,layouts:t,initialHeight:n,y:r,x:o,w:i,minH:s}){const a={i:e,x:o??0,y:r??1/0,w:i||20,h:n||35,minW:6,minH:s||10},l=t?{...t}:{};return CE.forEach(c=>{l[c]||(l[c]=[]);const u=l[c].reduce((d,h)=>Math.max(d,h.y+h.h),0);a.y=a.y===1/0?u:a.y,l[c].push({...a})}),l}function WN(e,t){if(!t)return;const n={...t};return CE.forEach(r=>{n[r]&&(n[r]=n[r].filter(o=>o.i!==e))}),n}function lO(e){const t=oe.getState().dashboard.globalCacheConfig,{card:n,filter:r}=e;return t}const oe=Es()(Jh((e,t)=>({isSessionExpired:!1,currentBreakpoint:"lg",dashboard:{id:"",style:Jg},showContext:!1,selectedSheetId:null,selectedCardId:null,selectedFrameId:null,selectedCard:null,showFilters:!1,isDashboardEditing:!1,isVisualEditing:!1,showDashboardJSON:!1,filteringCards:[],isDashboardPanelOpen:!1,actions:{setInitStore:()=>{e(n=>{n.isSessionExpired=!1,n.currentBreakpoint="lg",n.dashboard={id:"",style:Jg},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})},setAiContext:n=>{e(r=>{r.dashboard.aiContext=n})},setHandleOpenAssistantProfile:n=>{e(r=>{r.handleOpenAssistantProfile=n})},setFilterMode:(n,r)=>{const o=r==="exclude"?"not in":"in";e(i=>{var a,l,c;const s=(a=i.dashboard.filters)==null?void 0:a.find(u=>u.id===n);s&&(s.operation=o,i.dashboard.filters=(l=i.dashboard.filters)==null?void 0:l.map(u=>u.id===n?s:u),i.filterValues&&i.filterValues.length>0&&(i.filterValues=(c=i.filterValues)==null?void 0:c.map(u=>u.filterId===n?{...u,operation:o}:u)))})},updateEmailSettings:n=>{e(r=>{r.dashboard.emailSettings=n})},setDefaultFilterValues:n=>{e(r=>{r.dashboard.defaultFilterValues=n})},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 i,s,a,l,c,u,d,h;const o=(i=r.dashboard.sheets)==null?void 0:i.findIndex(p=>p.id===n);if(o!==void 0&&o>-1){(s=r.dashboard.sheets)==null||s.splice(o,1);const p=(a=r.dashboard.filters)==null?void 0:a.filter(m=>m.sheetId===n),g=(l=r.filterValues)==null?void 0:l.filter(m=>p==null?void 0:p.some(b=>b.id===m.filterId));r.filterValues=(c=r.filterValues)==null?void 0:c.filter(m=>!(g!=null&&g.some(b=>b.filterId===m.filterId))),r.dashboard.filters=(u=r.dashboard.filters)==null?void 0:u.filter(m=>m.sheetId!==n),r.selectedSheetId=(h=(d=r.dashboard.sheets)==null?void 0:d[0])==null?void 0:h.id}})},addSheet:n=>{e(r=>{r.dashboard.sheets||(r.dashboard.sheets=[]);const o=r.dashboard.filters;let i={};o==null||o.forEach(a=>{CE.forEach(l=>{i!=null&&i[l]||(i={...i,[l]:[]});const c={i:a.id,x:0,y:0,w:10,h:8};i[l].push(c)})});const s={...n,layouts:i};r.dashboard.sheets.push(s)})},setGlobalStyle:n=>{e(r=>{r.dashboard.globalStyle=n})},setAIScopeTables:n=>{e(r=>{r.dashboard.aiScopeTables=n})},addToAIScope:n=>{e(r=>{const{connectionId:o,connectionType:i,databaseName:s,schemaName:a,tableName:l,datamodelName:c,datamodelId:u}=n,d={connectionId:o||"",connectionType:i||"",databaseName:s||"",schemaName:a||"",tableName:l||"",datamodelName:c||"",datamodelId:u||""};let p=[...r.dashboard.aiScopeTables||[],d];p=p.filter((g,m,b)=>b.findIndex(y=>y.tableName===g.tableName&&y.datamodelName===g.datamodelName)===m),r.dashboard.aiScopeTables=p})},removeFromAIScope:n=>{e(r=>{const{connectionId:o,tableName:i,datamodelName:s}=n,a=r.dashboard.aiScopeTables||[];if(s){const l=a.filter(c=>!(c.datamodelName===s&&c.connectionId===o));r.dashboard.aiScopeTables=l}else if(i){const l=a.filter(c=>!(c.tableName===i&&c.connectionId===o));r.dashboard.aiScopeTables=l}})},setIsSessionExpired:n=>{e(()=>({isSessionExpired:n}))},setCardPython:(n,r)=>{e(o=>{var s,a,l;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(c=>c.id===o.selectedSheetId);i&&((l=i==null?void 0:i.frames)==null||l.forEach(c=>{var d;const u=(d=c.cards)==null?void 0:d.find(h=>h.id===n);u&&(u.python=r)}))})},addBaseQuery:n=>{e(r=>{var o;r.dashboard.baseQueries||(r.dashboard.baseQueries=[]),(o=r.dashboard.baseQueries)==null||o.push(n)})},removeBaseQuery:n=>{e(r=>{var i,s;const o=(i=r.dashboard.baseQueries)==null?void 0:i.findIndex(a=>a.id===n);o!=null&&o>-1&&((s=r.dashboard.baseQueries)==null||s.splice(o,1))})},setBaseQueries:n=>{e(r=>{r.dashboard.baseQueries=n})},setCurrentBreakpoint:n=>{e(()=>({currentBreakpoint:n}))},setFilteringCards:n=>{e(()=>({filteringCards:n}))},addFilteringCard:n=>{e(r=>{var o;(o=r.filteringCards)==null||o.push(n)})},removeFilteringCard:n=>{e(r=>{var i,s;const o=(i=r.filteringCards)==null?void 0:i.findIndex(a=>a.id===n.id);o!==void 0&&o>-1&&((s=r.filteringCards)==null||s.splice(o,1))})},setCustomCards:n=>{e(r=>{r.dashboard.customCards=n})},setAuthToken:n=>{e(()=>({authToken:n}))},setThemeStyle:n=>{e(()=>({themeStyle:n}))},setDashboard:n=>e({dashboard:n}),setDashboardWithFilterValues:(n,r)=>{e(o=>{o.dashboard=n,o.filterValues=r})},setDashboardTheme:n=>{e(r=>{r.theme=n})},setSheets:n=>{e(r=>{r.dashboard&&(r.dashboard.sheets=n)})},setSheetTitle:(n,r)=>{e(o=>{var s,a;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);i&&(i.title=r)})},setCardTitle:(n,r,o)=>{e(i=>{var a,l,c;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(u=>u.id===n);s&&((c=s==null?void 0:s.frames)==null||c.forEach(u=>{var h;const d=(h=u.cards)==null?void 0:h.find(p=>p.id===r);d&&(d.title=o)}))})},setCardInfo:(n,r)=>{e(o=>{var s,a,l;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(c=>c.id===o.selectedSheetId);i&&((l=i==null?void 0:i.frames)==null||l.forEach(c=>{var d;const u=(d=c.cards)==null?void 0:d.find(h=>h.id===n);u&&(u.info=r)}))})},setCardDescription:(n,r,o)=>{e(i=>{var a,l,c;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(u=>u.id===n);s&&((c=s==null?void 0:s.frames)==null||c.forEach(u=>{var h;const d=(h=u.cards)==null?void 0:h.find(p=>p.id===r);d&&(d.description=o)}))})},setCardSql:(n,r,o)=>{e(i=>{var a,l,c,u;const s=(l=(a=i.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(h=>h.id===r);d&&(d.sql=o,(u=i.onUpdateCard)==null||u.call(i,d,n))}})},setSheetLayout:(n,r)=>{e(o=>{var s,a;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);i&&(i.layout=r)})},setSheetLayouts:(n,r)=>{e(o=>{var s,a;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);i&&(i.layouts=r)})},setShowContext:n=>{e(()=>({showContext:n}))},setShowFilters:n=>{e(()=>({showFilters:n}))},setFilterValues:n=>{e(()=>({filterValues:n}))},addOrUpdateFilterValue:n=>{e(r=>{if(r.filterValues){const o=r.filterValues.findIndex(i=>i.filterId===n.filterId);o>-1?r.filterValues.splice(o,1,n):r.filterValues.push(n)}else r.filterValues=[n]})},addOrUpdateFilterValues:n=>{e(r=>{r.filterValues?n.forEach(o=>{var s,a,l,c;const i=(s=r==null?void 0:r.filterValues)==null?void 0:s.findIndex(u=>u.filterId===o.filterId);if(o.values.length===0){r.filterValues=(a=r.filterValues)==null?void 0:a.filter(u=>u.filterId!==o.filterId);return}i!==void 0&&i>-1?(l=r.filterValues)==null||l.splice(i,1,o):(c=r.filterValues)==null||c.push(o)}):r.filterValues=n})},removeFilterValues:n=>{e(r=>{if(r.filterValues){const o=r.filterValues.filter(i=>i.filterId!==n&&!i.filterId.startsWith(n));r.filterValues=o}})},replaceFilterValue:n=>{e(r=>{if(r.filterValues){const o=r.filterValues.findIndex(i=>i.filterId===n.filterId);o>-1&&r.filterValues.splice(o,1,n)}})},addFilter:n=>{e(r=>{var i,s;r.dashboard.filters?(i=r.dashboard.filters)==null||i.push(n):r.dashboard.filters=[n],(s=r.dashboard.sheets)==null||s.find(a=>a.id===r.selectedSheetId);const o=r.dashboard.sheets;o==null||o.forEach(a=>{HN({id:n.id,layouts:a.layouts,y:0,initialHeight:8,minH:7,w:10})})})},removeFilter:n=>{e(r=>{var o,i,s;if(r.dashboard.filters){const a=(o=r.dashboard.filters)==null?void 0:o.findIndex(l=>l.id===n);if(a>-1){(i=r.dashboard.filters)==null||i.splice(a,1),(s=r.dashboard.sheets)==null||s.find(c=>c.id===r.selectedSheetId);const l=r.dashboard.sheets;l==null||l.forEach(c=>{const u=WN(n,c.layouts);c.layouts=u})}}})},updateCurrentDashboardCard:n=>{e(r=>{var a,l,c,u,d;const o=(l=(a=r.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(h=>h.id===r.selectedSheetId),i=(c=o==null?void 0:o.frames)==null?void 0:c.find(h=>h.id===r.selectedFrameId),s=(u=i==null?void 0:i.cards)==null?void 0:u.findIndex(h=>h.id===n.id);typeof s=="number"&&s>=0&&((d=i==null?void 0:i.cards)==null||d.splice(s,1,n))})},updateFrameCard:(n,r,o)=>{e(i=>{var l,c,u,d,h;const s=(c=(l=i.dashboard)==null?void 0:l.sheets)==null?void 0:c.find(p=>p.id===n);if(!s)return;const a=(u=s==null?void 0:s.frames)==null?void 0:u.find(p=>p.id===r);if(a){const p=(d=a.cards)==null?void 0:d.findIndex(g=>g.id===o.id);p>-1&&((h=a.cards)==null||h.splice(p,1,o))}})},updateFilter:n=>{e(r=>{var o,i;if(r.dashboard.filters){const s=(o=r.dashboard.filters)==null?void 0:o.findIndex(a=>a.id===n.id);s>-1&&((i=r.dashboard.filters)==null||i.splice(s,1,n))}})},updateFilterId:(n,r)=>{e(o=>{var a,l;const i=(a=o.dashboard.filters)==null?void 0:a.find(c=>c.id===n),s=(l=o.dashboard.filters)==null?void 0:l.some(c=>c.id===r);i&&!s&&(i.id=r)})},setIsDashboardEditing:n=>{e(()=>({isDashboardEditing:n}))},setShowDashboardJSON:n=>{e(()=>({showDashboardJSON:n}))},setIsVisualEditing:n=>{e(()=>({isVisualEditing:n}))},addFrame:(n,r,o)=>{e(i=>{var a,l,c,u;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(d=>d.id===n);if(s){s.frames||(s.frames=[]),(c=s.frames)==null||c.push(r);let d=1/0;const h=0;o==="start"&&(d=0);const p=HN({id:r.id,layouts:s.layouts,minH:10,x:h,y:d});s.layouts=p,(u=i.onAddFrame)==null||u.call(i,r,n)}})},removeFrame:(n,r)=>{e(o=>{var s,a,l,c,u;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(d=>d.id===n);if(i){const d=(l=i.frames)==null?void 0:l.findIndex(h=>h.id===r);console.log(d),typeof d=="number"&&d>-1&&((c=i.frames)==null||c.splice(d,1),(u=i.layout)==null||u.splice(d,1),WN(r,i.layouts))}})},updateFrame:(n,r)=>{e(o=>{var a,l,c,u,d;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(h=>h.id===n),s=(c=i==null?void 0:i.frames)==null?void 0:c.findIndex(h=>h.id===r.id);i&&((u=i.frames)==null||u.splice(s,1,r)),(d=o.onAcceptChanges)==null||d.call(o,r,o.dashboard)})},updateCard:(n,r)=>{e(o=>{var a,l,c,u,d;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(h=>h.id===n),s=(c=i==null?void 0:i.cards)==null?void 0:c.findIndex(h=>h.id===r.id);i&&((u=i.cards)==null||u.splice(s,1,r),(d=o.onUpdateCard)==null||d.call(o,r,n))})},removeCard:(n,r)=>{e(o=>{var a,l,c,u,d,h;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(p=>p.id===n),s=(c=i==null?void 0:i.cards)==null?void 0:c.findIndex(p=>p.id===r.id);i&&((u=i.cards)==null||u.splice(s,1),(d=i.layout)==null||d.splice(s,1),(h=o.onRemoveCard)==null||h.call(o,r,n))})},setStyle:n=>{e(r=>{r.dashboard&&(r.dashboard.style=n)})},setSelectedCardId:(n,r)=>{e(o=>{var s,a,l;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(c=>c.id===n);i&&(((l=i.cards)==null?void 0:l.find(u=>u.id===r))?o.selectedCardId=r:o.selectedCardId=null)})},setSelectedFrameId:n=>{e(r=>{var i,s;((s=(i=r.dashboard)==null?void 0:i.sheets)==null?void 0:s.find(a=>a.id===r.selectedSheetId))&&(r.selectedFrameId=n)})},setSelectedSheetId:n=>{e(r=>{var i,s;((s=(i=r.dashboard)==null?void 0:i.sheets)==null?void 0:s.find(a=>a.id===n))&&(r.selectedSheetId=n)})},setOnSaveFunction:n=>{e(()=>({onSaveFunction:n}))},setOnAddCard:n=>{e(()=>({onAddCard:n}))},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(o=>o.id===t().selectedSheetId)},getCardFrame:n=>{var o,i;const r=(o=t().dashboard)==null?void 0:o.sheets;if(r)for(let s=0;s<r.length;s++){const a=r[s].frames;if(a){for(let l=0;l<a.length;l++)if((i=a[l].cards)==null?void 0:i.find(u=>u.id===n))return a[l]}}},getSelectedFrame:()=>{var r,o,i;const n=(o=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:o.find(s=>s.id===t().selectedSheetId);return(i=n==null?void 0:n.frames)==null?void 0:i.find(s=>s.id===t().selectedFrameId)},getCard:n=>{var o,i;const r=(o=t().dashboard)==null?void 0:o.sheets;if(r)for(let s=0;s<r.length;s++){const a=r[s].frames;if(a)for(let l=0;l<a.length;l++){const c=(i=a[l].cards)==null?void 0:i.find(u=>u.id===n);if(c)return c}}},getSelectedSheetLayout:()=>{var r,o;const n=(o=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:o.find(i=>i.id===t().selectedSheetId);return n==null?void 0:n.layout},getSelectedSheetLayouts:()=>{var r,o;const n=(o=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:o.find(i=>i.id===t().selectedSheetId);return n==null?void 0:n.layouts},getStyle:()=>{var n;return(n=t().dashboard)==null?void 0:n.style},getCardSheet(n){var o,i;const r=(o=t().dashboard)==null?void 0:o.sheets;if(r)for(let s=0;s<r.length;s++){const a=r[s].frames;if(a){for(let l=0;l<a.length;l++)if((i=a[l].cards)==null?void 0:i.find(u=>u.id===n))return r[s]}}},handleDataPointClickAction:(n,r)=>{TY({card:n,dataPoint:r,get:t})},setIsDashboardPanelOpen:n=>{e(()=>({isDashboardPanelOpen:n}))}}}))),cO=()=>oe(t=>{var i,s,a,l,c;const n=(s=(i=t.dashboard)==null?void 0:i.sheets)==null?void 0:s.find(u=>u.id===t.selectedSheetId),r=(a=n==null?void 0:n.frames)==null?void 0:a.find(u=>u.id===t.selectedFrameId);return((l=r==null?void 0:r.cards)==null?void 0:l.find(u=>u.id===(r==null?void 0:r.activeCardId)))||((c=r==null?void 0:r.cards)==null?void 0:c[0])}),uO=()=>{var n;const e=oe(r=>{var o,i;return(i=(o=r.dashboard)==null?void 0:o.sheets)==null?void 0:i.find(s=>s.id===r.selectedSheetId)});return(((n=e==null?void 0:e.frames)==null?void 0:n.map(r=>{var o;return(o=r.cards)==null?void 0:o.find(i=>i.id===r.activeCardId)}))||[]).filter(r=>r!==void 0)},dO=()=>{var t,n,r;const e=cO();return{metricFields:((t=e==null?void 0:e.config)==null?void 0:t.metricColumns)||[],groupByFields:((n=e==null?void 0:e.config)==null?void 0:n.groupByColumns)||[],pivotByFields:((r=e==null?void 0:e.config)==null?void 0:r.pivotByColumns)||[]}},on=()=>oe(e=>e.actions);async function jY(e,t){const n=t.slice(0,16),r=new TextEncoder,o=await window.crypto.subtle.importKey("raw",r.encode(n),{name:"PBKDF2"},!1,["deriveKey"]),i=await window.crypto.subtle.deriveKey({name:"PBKDF2",salt:r.encode(n),iterations:1e5,hash:"SHA-256"},o,{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},i,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 fO(e,t){const n=t.slice(0,16),r=new TextEncoder,o=new TextDecoder,i=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"},i,{name:"AES-GCM",length:256},!1,["decrypt"]),a=Uint8Array.from(atob(e),h=>h.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 h=await window.crypto.subtle.decrypt({name:"AES-GCM",iv:l},s,d);return{decryptedData:o.decode(h)}}catch(h){throw new Error(`Decryption failed: ${h}`)}}function re(...e){return qq($l(e))}const OY=e=>Object.keys(e).length===0;async function br(e,t,n={}){try{const r=new URLSearchParams(n).toString(),o=`${e}?${r}`,i=await fetch(o,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});if(!i.ok){const a=await i.json();throw new Error((a==null?void 0:a.error)||`HTTP error! status: ${i.status}`)}return await i.json()}catch(r){throw console.error("Error during fetch:",r),r}}async function hO(e,t,n={}){try{const r=JSON.stringify(n),o=await jY(r,t),i=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(o)});if(!i.ok)return i.json().then(a=>{throw console.log(a.detail||"Unknown error occurred"),new Error((a==null?void 0:a.error)||`HTTP error! status: ${i.status}`)});const s=await i.json();if(s.payload){const a=await fO(s.payload,t);return JSON.parse(a.decryptedData)}return s}catch(r){throw console.error("Error during fetch:",r),r}}async function pO(e,t,n={},r="POST"){try{const o=await fetch(e,{method:r,headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(n)});return o.ok?await o.json():o.json().then(s=>{throw console.log(s.detail||"Unknown error occurred"),new Error((s==null?void 0:s.error)||`HTTP error! status: ${o.status}`)})}catch(o){throw console.error("Error during fetch:",o),o}}function FY(e){if(!e)return{tenantId:"",endUserId:""};const t=Zh(e);return{tenantId:t==null?void 0:t.tenantId,endUserId:t==null?void 0:t.endUserId}}function LY(e){return e?Zh(e).assistantProfileId:void 0}function $Y(e){if(!e)return;const t=Zh(e);if(t.params&&t.params.currencyFormat)return t.params.currencyFormat}function mO(e){return e?Zh(e).params:void 0}function RE(e){return e.charAt(0).toUpperCase()+e.slice(1)}function kE(e){return e.replace(/\w\S*/g,t=>t.charAt(0).toUpperCase()+t.substring(1).toLowerCase())}function NE(e){return e.replace(/[_-]+/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\w\S*/g,t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase())}const Nr="focus:ring-1 focus:ring-offset-0 focus-visible:ring-1 focus-visible:ring-offset-0",ps="focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0 focus:ring-0 focus:ring-ring focus:ring-offset-0";async function zY(){var o,i;const e=(i=(o=oe.getState())==null?void 0:o.authToken)==null?void 0:i.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 BY(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)),o=new URLSearchParams(r).toString();o&&(n+=`?${o}`);let s=await(await fetch(n,{headers:{Authorization:`Bearer ${e}`}})).json();if("payload"in s){const a=await fO(atob(s.payload),e);s=JSON.parse(a.decryptedData)}return s}async function VY(e){return e?await(await fetch("https://semaphor.cloud/api/v1/plugins",{headers:{Authorization:`Bearer ${e}`}})).json():null}const I0=e=>/boolean/i.test(e)?"boolean":/date|timestamp/i.test(e)?"date":/int|decimal|float|double|num/i.test(e)?"number":/json/i.test(e)?"json":/geo|geography|geometry/i.test(e)?"geo":"string";var eb={exports:{}};eb.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",o=800,i=16,s=9007199254740991,a="[object Arguments]",l="[object Array]",c="[object AsyncFunction]",u="[object Boolean]",d="[object Date]",h="[object Error]",p="[object Function]",g="[object GeneratorFunction]",m="[object Map]",b="[object Number]",y="[object Null]",v="[object Object]",x="[object Proxy]",S="[object RegExp]",_="[object Set]",E="[object String]",C="[object Undefined]",k="[object WeakMap]",N="[object ArrayBuffer]",M="[object DataView]",A="[object Float32Array]",P="[object Float64Array]",j="[object Int8Array]",F="[object Int16Array]",I="[object Int32Array]",O="[object Uint8Array]",$="[object Uint8ClampedArray]",B="[object Uint16Array]",z="[object Uint32Array]",T=/[\\^$.*+?()[\]{}|]/g,W=/^\[object .+?Constructor\]$/,L=/^(?:0|[1-9]\d*)$/,D={};D[A]=D[P]=D[j]=D[F]=D[I]=D[O]=D[$]=D[B]=D[z]=!0,D[a]=D[l]=D[N]=D[u]=D[M]=D[d]=D[h]=D[p]=D[m]=D[b]=D[v]=D[S]=D[_]=D[E]=D[k]=!1;var H=typeof ls=="object"&&ls&&ls.Object===Object&&ls,V=typeof self=="object"&&self&&self.Object===Object&&self,q=H||V||Function("return this")(),U=t&&!t.nodeType&&t,Y=U&&!0&&e&&!e.nodeType&&e,K=Y&&Y.exports===U,Z=K&&H.process,ee=function(){try{var G=Y&&Y.require&&Y.require("util").types;return G||Z&&Z.binding&&Z.binding("util")}catch{}}(),Q=ee&&ee.isTypedArray;function ie(G,J,se){switch(se.length){case 0:return G.call(J);case 1:return G.call(J,se[0]);case 2:return G.call(J,se[0],se[1]);case 3:return G.call(J,se[0],se[1],se[2])}return G.apply(J,se)}function te(G,J){for(var se=-1,Ne=Array(G);++se<G;)Ne[se]=J(se);return Ne}function le(G){return function(J){return G(J)}}function ue(G,J){return G==null?void 0:G[J]}function Re(G,J){return function(se){return G(J(se))}}var be=Array.prototype,we=Function.prototype,Pe=Object.prototype,Ye=q["__core-js_shared__"],_t=we.toString,me=Pe.hasOwnProperty,je=function(){var G=/[^.]+$/.exec(Ye&&Ye.keys&&Ye.keys.IE_PROTO||"");return G?"Symbol(src)_1."+G:""}(),Ae=Pe.toString,ne=_t.call(Object),ce=RegExp("^"+_t.call(me).replace(T,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ke=K?q.Buffer:void 0,De=q.Symbol,Ue=q.Uint8Array;ke&&ke.allocUnsafe;var jt=Re(Object.getPrototypeOf,Object),kn=Object.create,gn=Pe.propertyIsEnumerable,ge=be.splice,bn=De?De.toStringTag:void 0,Ot=function(){try{var G=kv(Object,"defineProperty");return G({},"",{}),G}catch{}}(),uo=ke?ke.isBuffer:void 0,On=Math.max,Sc=Date.now,Va=kv(q,"Map"),Wi=kv(Object,"create"),an=function(){function G(){}return function(J){if(!Ua(J))return{};if(kn)return kn(J);G.prototype=J;var se=new G;return G.prototype=void 0,se}}();function Rt(G){var J=-1,se=G==null?0:G.length;for(this.clear();++J<se;){var Ne=G[J];this.set(Ne[0],Ne[1])}}function Fn(){this.__data__=Wi?Wi(null):{},this.size=0}function Ie(G){var J=this.has(G)&&delete this.__data__[G];return this.size-=J?1:0,J}function Ge(G){var J=this.__data__;if(Wi){var se=J[G];return se===r?void 0:se}return me.call(J,G)?J[G]:void 0}function rt(G){var J=this.__data__;return Wi?J[G]!==void 0:me.call(J,G)}function Jt(G,J){var se=this.__data__;return this.size+=this.has(G)?0:1,se[G]=Wi&&J===void 0?r:J,this}Rt.prototype.clear=Fn,Rt.prototype.delete=Ie,Rt.prototype.get=Ge,Rt.prototype.has=rt,Rt.prototype.set=Jt;function Ft(G){var J=-1,se=G==null?0:G.length;for(this.clear();++J<se;){var Ne=G[J];this.set(Ne[0],Ne[1])}}function Lt(){this.__data__=[],this.size=0}function Dn(G){var J=this.__data__,se=rm(J,G);if(se<0)return!1;var Ne=J.length-1;return se==Ne?J.pop():ge.call(J,se,1),--this.size,!0}function en(G){var J=this.__data__,se=rm(J,G);return se<0?void 0:J[se][1]}function yn(G){return rm(this.__data__,G)>-1}function Ha(G,J){var se=this.__data__,Ne=rm(se,G);return Ne<0?(++this.size,se.push([G,J])):se[Ne][1]=J,this}Ft.prototype.clear=Lt,Ft.prototype.delete=Dn,Ft.prototype.get=en,Ft.prototype.has=yn,Ft.prototype.set=Ha;function fo(G){var J=-1,se=G==null?0:G.length;for(this.clear();++J<se;){var Ne=G[J];this.set(Ne[0],Ne[1])}}function ri(){this.size=0,this.__data__={hash:new Rt,map:new(Va||Ft),string:new Rt}}function Wa(G){var J=im(this,G).delete(G);return this.size-=J?1:0,J}function Id(G){return im(this,G).get(G)}function kG(G){return im(this,G).has(G)}function NG(G,J){var se=im(this,G),Ne=se.size;return se.set(G,J),this.size+=se.size==Ne?0:1,this}fo.prototype.clear=ri,fo.prototype.delete=Wa,fo.prototype.get=Id,fo.prototype.has=kG,fo.prototype.set=NG;function Ec(G){var J=this.__data__=new Ft(G);this.size=J.size}function MG(){this.__data__=new Ft,this.size=0}function PG(G){var J=this.__data__,se=J.delete(G);return this.size=J.size,se}function DG(G){return this.__data__.get(G)}function AG(G){return this.__data__.has(G)}function IG(G,J){var se=this.__data__;if(se instanceof Ft){var Ne=se.__data__;if(!Va||Ne.length<n-1)return Ne.push([G,J]),this.size=++se.size,this;se=this.__data__=new fo(Ne)}return se.set(G,J),this.size=se.size,this}Ec.prototype.clear=MG,Ec.prototype.delete=PG,Ec.prototype.get=DG,Ec.prototype.has=AG,Ec.prototype.set=IG;function TG(G,J){var se=Pv(G),Ne=!se&&Mv(G),mt=!se&&!Ne&&xN(G),Bt=!se&&!Ne&&!mt&&CN(G),tn=se||Ne||mt||Bt,xt=tn?te(G.length,String):[],nn=xt.length;for(var Do in G)tn&&(Do=="length"||mt&&(Do=="offset"||Do=="parent")||Bt&&(Do=="buffer"||Do=="byteLength"||Do=="byteOffset")||yN(Do,nn))||xt.push(Do);return xt}function _v(G,J,se){(se!==void 0&&!sm(G[J],se)||se===void 0&&!(J in G))&&Rv(G,J,se)}function jG(G,J,se){var Ne=G[J];(!(me.call(G,J)&&sm(Ne,se))||se===void 0&&!(J in G))&&Rv(G,J,se)}function rm(G,J){for(var se=G.length;se--;)if(sm(G[se][0],J))return se;return-1}function Rv(G,J,se){J=="__proto__"&&Ot?Ot(G,J,{configurable:!0,enumerable:!0,value:se,writable:!0}):G[J]=se}var OG=KG();function om(G){return G==null?G===void 0?C:y:bn&&bn in Object(G)?XG(G):nq(G)}function gN(G){return Td(G)&&om(G)==a}function FG(G){if(!Ua(G)||eq(G))return!1;var J=Av(G)?ce:W;return J.test(sq(G))}function LG(G){return Td(G)&&wN(G.length)&&!!D[om(G)]}function $G(G){if(!Ua(G))return tq(G);var J=vN(G),se=[];for(var Ne in G)Ne=="constructor"&&(J||!me.call(G,Ne))||se.push(Ne);return se}function bN(G,J,se,Ne,mt){G!==J&&OG(J,function(Bt,tn){if(mt||(mt=new Ec),Ua(Bt))zG(G,J,tn,se,bN,Ne,mt);else{var xt=Ne?Ne(Nv(G,tn),Bt,tn+"",G,J,mt):void 0;xt===void 0&&(xt=Bt),_v(G,tn,xt)}},SN)}function zG(G,J,se,Ne,mt,Bt,tn){var xt=Nv(G,se),nn=Nv(J,se),Do=tn.get(nn);if(Do){_v(G,se,Do);return}var Ur=Bt?Bt(xt,nn,se+"",G,J,tn):void 0,jd=Ur===void 0;if(jd){var Iv=Pv(nn),Tv=!Iv&&xN(nn),_N=!Iv&&!Tv&&CN(nn);Ur=nn,Iv||Tv||_N?Pv(xt)?Ur=xt:aq(xt)?Ur=GG(xt):Tv?(jd=!1,Ur=HG(nn)):_N?(jd=!1,Ur=UG(nn)):Ur=[]:lq(nn)||Mv(nn)?(Ur=xt,Mv(xt)?Ur=cq(xt):(!Ua(xt)||Av(xt))&&(Ur=QG(nn))):jd=!1}jd&&(tn.set(nn,Ur),mt(Ur,nn,Ne,Bt,tn),tn.delete(nn)),_v(G,se,Ur)}function BG(G,J){return oq(rq(G,J,EN),G+"")}var VG=Ot?function(G,J){return Ot(G,"toString",{configurable:!0,enumerable:!1,value:dq(J),writable:!0})}:EN;function HG(G,J){return G.slice()}function WG(G){var J=new G.constructor(G.byteLength);return new Ue(J).set(new Ue(G)),J}function UG(G,J){var se=WG(G.buffer);return new G.constructor(se,G.byteOffset,G.length)}function GG(G,J){var se=-1,Ne=G.length;for(J||(J=Array(Ne));++se<Ne;)J[se]=G[se];return J}function qG(G,J,se,Ne){var mt=!se;se||(se={});for(var Bt=-1,tn=J.length;++Bt<tn;){var xt=J[Bt],nn=void 0;nn===void 0&&(nn=G[xt]),mt?Rv(se,xt,nn):jG(se,xt,nn)}return se}function YG(G){return BG(function(J,se){var Ne=-1,mt=se.length,Bt=mt>1?se[mt-1]:void 0,tn=mt>2?se[2]:void 0;for(Bt=G.length>3&&typeof Bt=="function"?(mt--,Bt):void 0,tn&&ZG(se[0],se[1],tn)&&(Bt=mt<3?void 0:Bt,mt=1),J=Object(J);++Ne<mt;){var xt=se[Ne];xt&&G(J,xt,Ne,Bt)}return J})}function KG(G){return function(J,se,Ne){for(var mt=-1,Bt=Object(J),tn=Ne(J),xt=tn.length;xt--;){var nn=tn[++mt];if(se(Bt[nn],nn,Bt)===!1)break}return J}}function im(G,J){var se=G.__data__;return JG(J)?se[typeof J=="string"?"string":"hash"]:se.map}function kv(G,J){var se=ue(G,J);return FG(se)?se:void 0}function XG(G){var J=me.call(G,bn),se=G[bn];try{G[bn]=void 0;var Ne=!0}catch{}var mt=Ae.call(G);return Ne&&(J?G[bn]=se:delete G[bn]),mt}function QG(G){return typeof G.constructor=="function"&&!vN(G)?an(jt(G)):{}}function yN(G,J){var se=typeof G;return J=J??s,!!J&&(se=="number"||se!="symbol"&&L.test(G))&&G>-1&&G%1==0&&G<J}function ZG(G,J,se){if(!Ua(se))return!1;var Ne=typeof J;return(Ne=="number"?Dv(se)&&yN(J,se.length):Ne=="string"&&J in se)?sm(se[J],G):!1}function JG(G){var J=typeof G;return J=="string"||J=="number"||J=="symbol"||J=="boolean"?G!=="__proto__":G===null}function eq(G){return!!je&&je in G}function vN(G){var J=G&&G.constructor,se=typeof J=="function"&&J.prototype||Pe;return G===se}function tq(G){var J=[];if(G!=null)for(var se in Object(G))J.push(se);return J}function nq(G){return Ae.call(G)}function rq(G,J,se){return J=On(J===void 0?G.length-1:J,0),function(){for(var Ne=arguments,mt=-1,Bt=On(Ne.length-J,0),tn=Array(Bt);++mt<Bt;)tn[mt]=Ne[J+mt];mt=-1;for(var xt=Array(J+1);++mt<J;)xt[mt]=Ne[mt];return xt[J]=se(tn),ie(G,this,xt)}}function Nv(G,J){if(!(J==="constructor"&&typeof G[J]=="function")&&J!="__proto__")return G[J]}var oq=iq(VG);function iq(G){var J=0,se=0;return function(){var Ne=Sc(),mt=i-(Ne-se);if(se=Ne,mt>0){if(++J>=o)return arguments[0]}else J=0;return G.apply(void 0,arguments)}}function sq(G){if(G!=null){try{return _t.call(G)}catch{}try{return G+""}catch{}}return""}function sm(G,J){return G===J||G!==G&&J!==J}var Mv=gN(function(){return arguments}())?gN:function(G){return Td(G)&&me.call(G,"callee")&&!gn.call(G,"callee")},Pv=Array.isArray;function Dv(G){return G!=null&&wN(G.length)&&!Av(G)}function aq(G){return Td(G)&&Dv(G)}var xN=uo||fq;function Av(G){if(!Ua(G))return!1;var J=om(G);return J==p||J==g||J==c||J==x}function wN(G){return typeof G=="number"&&G>-1&&G%1==0&&G<=s}function Ua(G){var J=typeof G;return G!=null&&(J=="object"||J=="function")}function Td(G){return G!=null&&typeof G=="object"}function lq(G){if(!Td(G)||om(G)!=v)return!1;var J=jt(G);if(J===null)return!0;var se=me.call(J,"constructor")&&J.constructor;return typeof se=="function"&&se instanceof se&&_t.call(se)==ne}var CN=Q?le(Q):LG;function cq(G){return qG(G,SN(G))}function SN(G){return Dv(G)?TG(G):$G(G)}var uq=YG(function(G,J,se){bN(G,J,se)});function dq(G){return function(){return G}}function EN(G){return G}function fq(){return!1}e.exports=uq})(eb,eb.exports);var HY=eb.exports;const Jf=Pa(HY),WY={theme:"system",setTheme:()=>null},gO=R.createContext(WY);function UY({children:e,defaultTheme:t="system",storageKey:n="vite-ui-theme",...r}){const[o,i]=R.useState(()=>localStorage.getItem(n)||t);R.useEffect(()=>{const a=window.document.documentElement;if(a.classList.remove("light","dark"),o==="system"){const l=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";a.classList.add(l);return}a.classList.add(o)},[o]);const s={theme:o,setTheme:a=>{localStorage.setItem(n,a),i(a)}};return f.jsx(gO.Provider,{...r,value:s,children:e})}const bO=()=>{const e=R.useContext(gO);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e};var sc=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(){}},Vl=typeof window>"u"||"Deno"in globalThis;function bo(){}function GY(e,t){return typeof e=="function"?e(t):e}function w1(e){return typeof e=="number"&&e>=0&&e!==1/0}function yO(e,t){return Math.max(e+(t||0)-Date.now(),0)}function ru(e,t){return typeof e=="function"?e(t):e}function Fo(e,t){return typeof e=="function"?e(t):e}function UN(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==ME(s,t.options))return!1}else if(!eh(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||o&&o!==t.state.fetchStatus||i&&!i(t))}function GN(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Iu(t.options.mutationKey)!==Iu(i))return!1}else if(!eh(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function ME(e,t){return((t==null?void 0:t.queryKeyHashFn)||Iu)(e)}function Iu(e){return JSON.stringify(e,(t,n)=>C1(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function eh(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!eh(e[n],t[n])):!1}function tb(e,t){if(e===t)return e;const n=qN(e)&&qN(t);if(n||C1(e)&&C1(t)){const r=n?e:Object.keys(e),o=r.length,i=n?t:Object.keys(t),s=i.length,a=n?[]:{};let l=0;for(let c=0;c<s;c++){const u=n?c:i[c];(!n&&r.includes(u)||n)&&e[u]===void 0&&t[u]===void 0?(a[u]=void 0,l++):(a[u]=tb(e[u],t[u]),a[u]===e[u]&&e[u]!==void 0&&l++)}return o===s&&l===o?e:a}return t}function nb(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 qN(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function C1(e){if(!YN(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!YN(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function YN(e){return Object.prototype.toString.call(e)==="[object Object]"}function qY(e){return new Promise(t=>{setTimeout(t,e)})}function S1(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 tb(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 tb(e,t)}return t}function YY(e){return e}function KY(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function XY(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var rb=Symbol();function vO(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===rb&&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===rb?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var gl,Gs,mu,Ij,QY=(Ij=class extends sc{constructor(){super();Me(this,gl);Me(this,Gs);Me(this,mu);xe(this,mu,t=>{if(!Vl&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){X(this,Gs)||this.setEventListener(X(this,mu))}onUnsubscribe(){var t;this.hasListeners()||((t=X(this,Gs))==null||t.call(this),xe(this,Gs,void 0))}setEventListener(t){var n;xe(this,mu,t),(n=X(this,Gs))==null||n.call(this),xe(this,Gs,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){X(this,gl)!==t&&(xe(this,gl,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof X(this,gl)=="boolean"?X(this,gl):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},gl=new WeakMap,Gs=new WeakMap,mu=new WeakMap,Ij),PE=new QY,gu,qs,bu,Tj,ZY=(Tj=class extends sc{constructor(){super();Me(this,gu,!0);Me(this,qs);Me(this,bu);xe(this,bu,t=>{if(!Vl&&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(){X(this,qs)||this.setEventListener(X(this,bu))}onUnsubscribe(){var t;this.hasListeners()||((t=X(this,qs))==null||t.call(this),xe(this,qs,void 0))}setEventListener(t){var n;xe(this,bu,t),(n=X(this,qs))==null||n.call(this),xe(this,qs,t(this.setOnline.bind(this)))}setOnline(t){X(this,gu)!==t&&(xe(this,gu,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return X(this,gu)}},gu=new WeakMap,qs=new WeakMap,bu=new WeakMap,Tj),ob=new ZY;function E1(){let e,t;const n=new Promise((o,i)=>{e=o,t=i});n.status="pending",n.catch(()=>{});function r(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},n.reject=o=>{r({status:"rejected",reason:o}),t(o)},n}function JY(e){return Math.min(1e3*2**e,3e4)}function xO(e){return(e??"online")==="online"?ob.isOnline():!0}var wO=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Wv(e){return e instanceof wO}function CO(e){let t=!1,n=0,r=!1,o;const i=E1(),s=m=>{var b;r||(h(new wO(m)),(b=e.abort)==null||b.call(e))},a=()=>{t=!0},l=()=>{t=!1},c=()=>PE.isFocused()&&(e.networkMode==="always"||ob.isOnline())&&e.canRun(),u=()=>xO(e.networkMode)&&e.canRun(),d=m=>{var b;r||(r=!0,(b=e.onSuccess)==null||b.call(e,m),o==null||o(),i.resolve(m))},h=m=>{var b;r||(r=!0,(b=e.onError)==null||b.call(e,m),o==null||o(),i.reject(m))},p=()=>new Promise(m=>{var b;o=y=>{(r||c())&&m(y)},(b=e.onPause)==null||b.call(e)}).then(()=>{var m;o=void 0,r||(m=e.onContinue)==null||m.call(e)}),g=()=>{if(r)return;let m;const b=n===0?e.initialPromise:void 0;try{m=b??e.fn()}catch(y){m=Promise.reject(y)}Promise.resolve(m).then(d).catch(y=>{var E;if(r)return;const v=e.retry??(Vl?0:3),x=e.retryDelay??JY,S=typeof x=="function"?x(n,y):x,_=v===!0||typeof v=="number"&&n<v||typeof v=="function"&&v(n,y);if(t||!_){h(y);return}n++,(E=e.onFail)==null||E.call(e,n,y),qY(S).then(()=>c()?void 0:p()).then(()=>{t?h(y):g()})})};return{promise:i,cancel:s,continue:()=>(o==null||o(),i),cancelRetry:a,continueRetry:l,canStart:u,start:()=>(u()?g():p().then(g),i)}}function eK(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=a=>setTimeout(a,0);const i=a=>{t?e.push(a):o(()=>{n(a)})},s=()=>{const a=e;e=[],a.length&&o(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||s()}return l},batchCalls:a=>(...l)=>{i(()=>{a(...l)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{o=a}}}var pn=eK(),bl,jj,SO=(jj=class{constructor(){Me(this,bl)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),w1(this.gcTime)&&xe(this,bl,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Vl?1/0:5*60*1e3))}clearGcTimeout(){X(this,bl)&&(clearTimeout(X(this,bl)),xe(this,bl,void 0))}},bl=new WeakMap,jj),yu,vu,po,yl,Yn,Uh,vl,jo,Xi,Oj,tK=(Oj=class extends SO{constructor(t){super();Me(this,jo);Me(this,yu);Me(this,vu);Me(this,po);Me(this,yl);Me(this,Yn);Me(this,Uh);Me(this,vl);xe(this,vl,!1),xe(this,Uh,t.defaultOptions),this.setOptions(t.options),this.observers=[],xe(this,yl,t.client),xe(this,po,X(this,yl).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,xe(this,yu,nK(this.options)),this.state=t.state??X(this,yu),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=X(this,Yn))==null?void 0:t.promise}setOptions(t){this.options={...X(this,Uh),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&X(this,po).remove(this)}setData(t,n){const r=S1(this.state.data,t,this.options);return He(this,jo,Xi).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){He(this,jo,Xi).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=X(this,Yn))==null?void 0:r.promise;return(o=X(this,Yn))==null||o.cancel(t),n?n.then(bo).catch(bo):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(X(this,yu))}isActive(){return this.observers.some(t=>Fo(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===rb||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||!yO(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=X(this,Yn))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=X(this,Yn))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),X(this,po).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(X(this,Yn)&&(X(this,vl)?X(this,Yn).cancel({revert:!0}):X(this,Yn).cancelRetry()),this.scheduleGc()),X(this,po).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||He(this,jo,Xi).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(X(this,Yn))return X(this,Yn).continueRetry(),X(this,Yn).promise}if(t&&this.setOptions(t),!this.options.queryFn){const d=this.observers.find(h=>h.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,o=d=>{Object.defineProperty(d,"signal",{enumerable:!0,get:()=>(xe(this,vl,!0),r.signal)})},i=()=>{const d=vO(this.options,n),h={client:X(this,yl),queryKey:this.queryKey,meta:this.meta};return o(h),xe(this,vl,!1),this.options.persister?this.options.persister(d,h,this):d(h)},s={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:X(this,yl),state:this.state,fetchFn:i};o(s),(l=this.options.behavior)==null||l.onFetch(s,this),xe(this,vu,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((c=s.fetchOptions)==null?void 0:c.meta))&&He(this,jo,Xi).call(this,{type:"fetch",meta:(u=s.fetchOptions)==null?void 0:u.meta});const a=d=>{var h,p,g,m;Wv(d)&&d.silent||He(this,jo,Xi).call(this,{type:"error",error:d}),Wv(d)||((p=(h=X(this,po).config).onError)==null||p.call(h,d,this),(m=(g=X(this,po).config).onSettled)==null||m.call(g,this.state.data,d,this)),this.scheduleGc()};return xe(this,Yn,CO({initialPromise:n==null?void 0:n.initialPromise,fn:s.fetchFn,abort:r.abort.bind(r),onSuccess:d=>{var h,p,g,m;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(b){a(b);return}(p=(h=X(this,po).config).onSuccess)==null||p.call(h,d,this),(m=(g=X(this,po).config).onSettled)==null||m.call(g,d,this.state.error,this),this.scheduleGc()},onError:a,onFail:(d,h)=>{He(this,jo,Xi).call(this,{type:"failed",failureCount:d,error:h})},onPause:()=>{He(this,jo,Xi).call(this,{type:"pause"})},onContinue:()=>{He(this,jo,Xi).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),X(this,Yn).start()}},yu=new WeakMap,vu=new WeakMap,po=new WeakMap,yl=new WeakMap,Yn=new WeakMap,Uh=new WeakMap,vl=new WeakMap,jo=new WeakSet,Xi=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,...EO(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 o=t.error;return Wv(o)&&o.revert&&X(this,vu)?{...X(this,vu),fetchStatus:"idle"}:{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),pn.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),X(this,po).notify({query:this,type:"updated",action:t})})},Oj);function EO(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:xO(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function nK(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 ai,Fj,_O=(Fj=class extends sc{constructor(t={}){super();Me(this,ai);this.config=t,xe(this,ai,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??ME(o,n);let s=this.get(i);return s||(s=new tK({client:t,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){X(this,ai).has(t.queryHash)||(X(this,ai).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=X(this,ai).get(t.queryHash);n&&(t.destroy(),n===t&&X(this,ai).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){pn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return X(this,ai).get(t)}getAll(){return[...X(this,ai).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>UN(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>UN(t,r)):n}notify(t){pn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){pn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){pn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},ai=new WeakMap,Fj),li,cr,xl,ci,$s,Lj,rK=(Lj=class extends SO{constructor(t){super();Me(this,ci);Me(this,li);Me(this,cr);Me(this,xl);this.mutationId=t.mutationId,xe(this,cr,t.mutationCache),xe(this,li,[]),this.state=t.state||RO(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){X(this,li).includes(t)||(X(this,li).push(t),this.clearGcTimeout(),X(this,cr).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){xe(this,li,X(this,li).filter(n=>n!==t)),this.scheduleGc(),X(this,cr).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){X(this,li).length||(this.state.status==="pending"?this.scheduleGc():X(this,cr).remove(this))}continue(){var t;return((t=X(this,xl))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,s,a,l,c,u,d,h,p,g,m,b,y,v,x,S,_,E,C;xe(this,xl,CO({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(k,N)=>{He(this,ci,$s).call(this,{type:"failed",failureCount:k,error:N})},onPause:()=>{He(this,ci,$s).call(this,{type:"pause"})},onContinue:()=>{He(this,ci,$s).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>X(this,cr).canRun(this)}));const n=this.state.status==="pending",r=!X(this,xl).canStart();try{if(!n){He(this,ci,$s).call(this,{type:"pending",variables:t,isPaused:r}),await((i=(o=X(this,cr).config).onMutate)==null?void 0:i.call(o,t,this));const N=await((a=(s=this.options).onMutate)==null?void 0:a.call(s,t));N!==this.state.context&&He(this,ci,$s).call(this,{type:"pending",context:N,variables:t,isPaused:r})}const k=await X(this,xl).start();return await((c=(l=X(this,cr).config).onSuccess)==null?void 0:c.call(l,k,t,this.state.context,this)),await((d=(u=this.options).onSuccess)==null?void 0:d.call(u,k,t,this.state.context)),await((p=(h=X(this,cr).config).onSettled)==null?void 0:p.call(h,k,null,this.state.variables,this.state.context,this)),await((m=(g=this.options).onSettled)==null?void 0:m.call(g,k,null,t,this.state.context)),He(this,ci,$s).call(this,{type:"success",data:k}),k}catch(k){try{throw await((y=(b=X(this,cr).config).onError)==null?void 0:y.call(b,k,t,this.state.context,this)),await((x=(v=this.options).onError)==null?void 0:x.call(v,k,t,this.state.context)),await((_=(S=X(this,cr).config).onSettled)==null?void 0:_.call(S,void 0,k,this.state.variables,this.state.context,this)),await((C=(E=this.options).onSettled)==null?void 0:C.call(E,void 0,k,t,this.state.context)),k}finally{He(this,ci,$s).call(this,{type:"error",error:k})}}finally{X(this,cr).runNext(this)}}},li=new WeakMap,cr=new WeakMap,xl=new WeakMap,ci=new WeakSet,$s=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),pn.batch(()=>{X(this,li).forEach(r=>{r.onMutationUpdate(t)}),X(this,cr).notify({mutation:this,type:"updated",action:t})})},Lj);function RO(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ns,Oo,Gh,$j,oK=($j=class extends sc{constructor(t={}){super();Me(this,ns);Me(this,Oo);Me(this,Gh);this.config=t,xe(this,ns,new Set),xe(this,Oo,new Map),xe(this,Gh,0)}build(t,n,r){const o=new rK({mutationCache:this,mutationId:++am(this,Gh)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){X(this,ns).add(t);const n=cm(t);if(typeof n=="string"){const r=X(this,Oo).get(n);r?r.push(t):X(this,Oo).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(X(this,ns).delete(t)){const n=cm(t);if(typeof n=="string"){const r=X(this,Oo).get(n);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&X(this,Oo).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=cm(t);if(typeof n=="string"){const r=X(this,Oo).get(n),o=r==null?void 0:r.find(i=>i.state.status==="pending");return!o||o===t}else return!0}runNext(t){var r;const n=cm(t);if(typeof n=="string"){const o=(r=X(this,Oo).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){pn.batch(()=>{X(this,ns).forEach(t=>{this.notify({type:"removed",mutation:t})}),X(this,ns).clear(),X(this,Oo).clear()})}getAll(){return Array.from(X(this,ns))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>GN(n,r))}findAll(t={}){return this.getAll().filter(n=>GN(t,n))}notify(t){pn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return pn.batch(()=>Promise.all(t.map(n=>n.continue().catch(bo))))}},ns=new WeakMap,Oo=new WeakMap,Gh=new WeakMap,$j);function cm(e){var t;return(t=e.options.scope)==null?void 0:t.id}function KN(e){return{onFetch:(t,n)=>{var u,d,h,p,g;const r=t.options,o=(h=(d=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:d.fetchMore)==null?void 0:h.direction,i=((p=t.state.data)==null?void 0:p.pages)||[],s=((g=t.state.data)==null?void 0:g.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let m=!1;const b=x=>{Object.defineProperty(x,"signal",{enumerable:!0,get:()=>(t.signal.aborted?m=!0:t.signal.addEventListener("abort",()=>{m=!0}),t.signal)})},y=vO(t.options,t.fetchOptions),v=async(x,S,_)=>{if(m)return Promise.reject();if(S==null&&x.pages.length)return Promise.resolve(x);const E={client:t.client,queryKey:t.queryKey,pageParam:S,direction:_?"backward":"forward",meta:t.options.meta};b(E);const C=await y(E),{maxPages:k}=t.options,N=_?XY:KY;return{pages:N(x.pages,C,k),pageParams:N(x.pageParams,S,k)}};if(o&&i.length){const x=o==="backward",S=x?iK:XN,_={pages:i,pageParams:s},E=S(r,_);a=await v(_,E,x)}else{const x=e??i.length;do{const S=l===0?s[0]??r.initialPageParam:XN(r,a);if(l>0&&S==null)break;a=await v(a,S),l++}while(l<x)}return a};t.options.persister?t.fetchFn=()=>{var m,b;return(b=(m=t.options).persister)==null?void 0:b.call(m,c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=c}}}function XN(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 iK(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 ln,Ys,Ks,xu,wu,Xs,Cu,Su,zj,sK=(zj=class{constructor(e={}){Me(this,ln);Me(this,Ys);Me(this,Ks);Me(this,xu);Me(this,wu);Me(this,Xs);Me(this,Cu);Me(this,Su);xe(this,ln,e.queryCache||new _O),xe(this,Ys,e.mutationCache||new oK),xe(this,Ks,e.defaultOptions||{}),xe(this,xu,new Map),xe(this,wu,new Map),xe(this,Xs,0)}mount(){am(this,Xs)._++,X(this,Xs)===1&&(xe(this,Cu,PE.subscribe(async e=>{e&&(await this.resumePausedMutations(),X(this,ln).onFocus())})),xe(this,Su,ob.subscribe(async e=>{e&&(await this.resumePausedMutations(),X(this,ln).onOnline())})))}unmount(){var e,t;am(this,Xs)._--,X(this,Xs)===0&&((e=X(this,Cu))==null||e.call(this),xe(this,Cu,void 0),(t=X(this,Su))==null||t.call(this),xe(this,Su,void 0))}isFetching(e){return X(this,ln).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return X(this,Ys).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=X(this,ln).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=X(this,ln).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(ru(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return X(this,ln).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),o=X(this,ln).get(r.queryHash),i=o==null?void 0:o.state.data,s=GY(t,i);if(s!==void 0)return X(this,ln).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return pn.batch(()=>X(this,ln).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=X(this,ln).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=X(this,ln);pn.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=X(this,ln);return pn.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=pn.batch(()=>X(this,ln).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(bo).catch(bo)}invalidateQueries(e,t={}){return pn.batch(()=>(X(this,ln).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=pn.batch(()=>X(this,ln).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(bo)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(bo)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=X(this,ln).build(this,t);return n.isStaleByTime(ru(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(bo).catch(bo)}fetchInfiniteQuery(e){return e.behavior=KN(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(bo).catch(bo)}ensureInfiniteQueryData(e){return e.behavior=KN(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return ob.isOnline()?X(this,Ys).resumePausedMutations():Promise.resolve()}getQueryCache(){return X(this,ln)}getMutationCache(){return X(this,Ys)}getDefaultOptions(){return X(this,Ks)}setDefaultOptions(e){xe(this,Ks,e)}setQueryDefaults(e,t){X(this,xu).set(Iu(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...X(this,xu).values()],n={};return t.forEach(r=>{eh(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){X(this,wu).set(Iu(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...X(this,wu).values()],n={};return t.forEach(r=>{eh(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...X(this,Ks).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=ME(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===rb&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...X(this,Ks).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){X(this,ln).clear(),X(this,Ys).clear()}},ln=new WeakMap,Ys=new WeakMap,Ks=new WeakMap,xu=new WeakMap,wu=new WeakMap,Xs=new WeakMap,Cu=new WeakMap,Su=new WeakMap,zj),Ar,ft,qh,ur,wl,Eu,Qs,ui,Yh,_u,Ru,Cl,Sl,Zs,ku,It,nf,_1,R1,k1,N1,M1,P1,D1,kO,Bj,DE=(Bj=class extends sc{constructor(t,n){super();Me(this,It);Me(this,Ar);Me(this,ft);Me(this,qh);Me(this,ur);Me(this,wl);Me(this,Eu);Me(this,Qs);Me(this,ui);Me(this,Yh);Me(this,_u);Me(this,Ru);Me(this,Cl);Me(this,Sl);Me(this,Zs);Me(this,ku,new Set);this.options=n,xe(this,Ar,t),xe(this,ui,null),xe(this,Qs,E1()),this.options.experimental_prefetchInRender||X(this,Qs).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&&(X(this,ft).addObserver(this),QN(X(this,ft),this.options)?He(this,It,nf).call(this):this.updateResult(),He(this,It,N1).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return A1(X(this,ft),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return A1(X(this,ft),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,He(this,It,M1).call(this),He(this,It,P1).call(this),X(this,ft).removeObserver(this)}setOptions(t,n){const r=this.options,o=X(this,ft);if(this.options=X(this,Ar).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Fo(this.options.enabled,X(this,ft))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");He(this,It,D1).call(this),X(this,ft).setOptions(this.options),r._defaulted&&!nb(this.options,r)&&X(this,Ar).getQueryCache().notify({type:"observerOptionsUpdated",query:X(this,ft),observer:this});const i=this.hasListeners();i&&ZN(X(this,ft),o,this.options,r)&&He(this,It,nf).call(this),this.updateResult(n),i&&(X(this,ft)!==o||Fo(this.options.enabled,X(this,ft))!==Fo(r.enabled,X(this,ft))||ru(this.options.staleTime,X(this,ft))!==ru(r.staleTime,X(this,ft)))&&He(this,It,_1).call(this);const s=He(this,It,R1).call(this);i&&(X(this,ft)!==o||Fo(this.options.enabled,X(this,ft))!==Fo(r.enabled,X(this,ft))||s!==X(this,Zs))&&He(this,It,k1).call(this,s)}getOptimisticResult(t){const n=X(this,Ar).getQueryCache().build(X(this,Ar),t),r=this.createResult(n,t);return lK(this,r)&&(xe(this,ur,r),xe(this,Eu,this.options),xe(this,wl,X(this,ft).state)),r}getCurrentResult(){return X(this,ur)}trackResult(t,n){const r={};return Object.keys(t).forEach(o=>{Object.defineProperty(r,o,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(o),n==null||n(o),t[o])})}),r}trackProp(t){X(this,ku).add(t)}getCurrentQuery(){return X(this,ft)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=X(this,Ar).defaultQueryOptions(t),r=X(this,Ar).getQueryCache().build(X(this,Ar),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return He(this,It,nf).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),X(this,ur)))}createResult(t,n){var k;const r=X(this,ft),o=this.options,i=X(this,ur),s=X(this,wl),a=X(this,Eu),c=t!==r?t.state:X(this,qh),{state:u}=t;let d={...u},h=!1,p;if(n._optimisticResults){const N=this.hasListeners(),M=!N&&QN(t,n),A=N&&ZN(t,r,n,o);(M||A)&&(d={...d,...EO(u.data,t.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:g,errorUpdatedAt:m,status:b}=d;if(n.select&&d.data!==void 0)if(i&&d.data===(s==null?void 0:s.data)&&n.select===X(this,Yh))p=X(this,_u);else try{xe(this,Yh,n.select),p=n.select(d.data),p=S1(i==null?void 0:i.data,p,n),xe(this,_u,p),xe(this,ui,null)}catch(N){xe(this,ui,N)}else p=d.data;if(n.placeholderData!==void 0&&p===void 0&&b==="pending"){let N;if(i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData))N=i.data;else if(N=typeof n.placeholderData=="function"?n.placeholderData((k=X(this,Ru))==null?void 0:k.state.data,X(this,Ru)):n.placeholderData,n.select&&N!==void 0)try{N=n.select(N),xe(this,ui,null)}catch(M){xe(this,ui,M)}N!==void 0&&(b="success",p=S1(i==null?void 0:i.data,N,n),h=!0)}X(this,ui)&&(g=X(this,ui),p=X(this,_u),m=Date.now(),b="error");const y=d.fetchStatus==="fetching",v=b==="pending",x=b==="error",S=v&&y,_=p!==void 0,C={status:b,fetchStatus:d.fetchStatus,isPending:v,isSuccess:b==="success",isError:x,isInitialLoading:S,isLoading:S,data:p,dataUpdatedAt:d.dataUpdatedAt,error:g,errorUpdatedAt:m,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:y,isRefetching:y&&!v,isLoadingError:x&&!_,isPaused:d.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:x&&_,isStale:AE(t,n),refetch:this.refetch,promise:X(this,Qs)};if(this.options.experimental_prefetchInRender){const N=P=>{C.status==="error"?P.reject(C.error):C.data!==void 0&&P.resolve(C.data)},M=()=>{const P=xe(this,Qs,C.promise=E1());N(P)},A=X(this,Qs);switch(A.status){case"pending":t.queryHash===r.queryHash&&N(A);break;case"fulfilled":(C.status==="error"||C.data!==A.value)&&M();break;case"rejected":(C.status!=="error"||C.error!==A.reason)&&M();break}}return C}updateResult(t){const n=X(this,ur),r=this.createResult(X(this,ft),this.options);if(xe(this,wl,X(this,ft).state),xe(this,Eu,this.options),X(this,wl).data!==void 0&&xe(this,Ru,X(this,ft)),nb(r,n))return;xe(this,ur,r);const o={},i=()=>{if(!n)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!X(this,ku).size)return!0;const l=new Set(a??X(this,ku));return this.options.throwOnError&&l.add("error"),Object.keys(X(this,ur)).some(c=>{const u=c;return X(this,ur)[u]!==n[u]&&l.has(u)})};(t==null?void 0:t.listeners)!==!1&&i()&&(o.listeners=!0),He(this,It,kO).call(this,{...o,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&He(this,It,N1).call(this)}},Ar=new WeakMap,ft=new WeakMap,qh=new WeakMap,ur=new WeakMap,wl=new WeakMap,Eu=new WeakMap,Qs=new WeakMap,ui=new WeakMap,Yh=new WeakMap,_u=new WeakMap,Ru=new WeakMap,Cl=new WeakMap,Sl=new WeakMap,Zs=new WeakMap,ku=new WeakMap,It=new WeakSet,nf=function(t){He(this,It,D1).call(this);let n=X(this,ft).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(bo)),n},_1=function(){He(this,It,M1).call(this);const t=ru(this.options.staleTime,X(this,ft));if(Vl||X(this,ur).isStale||!w1(t))return;const r=yO(X(this,ur).dataUpdatedAt,t)+1;xe(this,Cl,setTimeout(()=>{X(this,ur).isStale||this.updateResult()},r))},R1=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(X(this,ft)):this.options.refetchInterval)??!1},k1=function(t){He(this,It,P1).call(this),xe(this,Zs,t),!(Vl||Fo(this.options.enabled,X(this,ft))===!1||!w1(X(this,Zs))||X(this,Zs)===0)&&xe(this,Sl,setInterval(()=>{(this.options.refetchIntervalInBackground||PE.isFocused())&&He(this,It,nf).call(this)},X(this,Zs)))},N1=function(){He(this,It,_1).call(this),He(this,It,k1).call(this,He(this,It,R1).call(this))},M1=function(){X(this,Cl)&&(clearTimeout(X(this,Cl)),xe(this,Cl,void 0))},P1=function(){X(this,Sl)&&(clearInterval(X(this,Sl)),xe(this,Sl,void 0))},D1=function(){const t=X(this,Ar).getQueryCache().build(X(this,Ar),this.options);if(t===X(this,ft))return;const n=X(this,ft);xe(this,ft,t),xe(this,qh,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},kO=function(t){pn.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(X(this,ur))}),X(this,Ar).getQueryCache().notify({query:X(this,ft),type:"observerResultsUpdated"})})},Bj);function aK(e,t){return Fo(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function QN(e,t){return aK(e,t)||e.state.data!==void 0&&A1(e,t,t.refetchOnMount)}function A1(e,t,n){if(Fo(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&AE(e,t)}return!1}function ZN(e,t,n,r){return(e!==t||Fo(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&AE(e,n)}function AE(e,t){return Fo(t.enabled,e)!==!1&&e.isStaleByTime(ru(t.staleTime,e))}function lK(e,t){return!nb(e.getCurrentResult(),t)}function JN(e,t){return e.filter(n=>!t.includes(n))}function cK(e,t,n){const r=e.slice(0);return r[t]=n,r}var El,mo,Nu,Mu,go,Js,Kh,Xh,Qh,Wn,I1,T1,j1,O1,F1,Vj,uK=(Vj=class extends sc{constructor(t,n,r){super();Me(this,Wn);Me(this,El);Me(this,mo);Me(this,Nu);Me(this,Mu);Me(this,go);Me(this,Js);Me(this,Kh);Me(this,Xh);Me(this,Qh,[]);xe(this,El,t),xe(this,Mu,r),xe(this,Nu,[]),xe(this,go,[]),xe(this,mo,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&X(this,go).forEach(t=>{t.subscribe(n=>{He(this,Wn,O1).call(this,t,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,X(this,go).forEach(t=>{t.destroy()})}setQueries(t,n,r){if(xe(this,Nu,t),xe(this,Mu,n),process.env.NODE_ENV!=="production"){const o=t.map(i=>X(this,El).defaultQueryOptions(i).queryHash);new Set(o).size!==o.length&&console.warn("[QueriesObserver]: Duplicate Queries found. This might result in unexpected behavior.")}pn.batch(()=>{const o=X(this,go),i=He(this,Wn,j1).call(this,X(this,Nu));xe(this,Qh,i),i.forEach(c=>c.observer.setOptions(c.defaultedQueryOptions,r));const s=i.map(c=>c.observer),a=s.map(c=>c.getCurrentResult()),l=s.some((c,u)=>c!==o[u]);o.length===s.length&&!l||(xe(this,go,s),xe(this,mo,a),this.hasListeners()&&(JN(o,s).forEach(c=>{c.destroy()}),JN(s,o).forEach(c=>{c.subscribe(u=>{He(this,Wn,O1).call(this,c,u)})}),He(this,Wn,F1).call(this)))})}getCurrentResult(){return X(this,mo)}getQueries(){return X(this,go).map(t=>t.getCurrentQuery())}getObservers(){return X(this,go)}getOptimisticResult(t,n){const r=He(this,Wn,j1).call(this,t),o=r.map(i=>i.observer.getOptimisticResult(i.defaultedQueryOptions));return[o,i=>He(this,Wn,T1).call(this,i??o,n),()=>He(this,Wn,I1).call(this,o,r)]}},El=new WeakMap,mo=new WeakMap,Nu=new WeakMap,Mu=new WeakMap,go=new WeakMap,Js=new WeakMap,Kh=new WeakMap,Xh=new WeakMap,Qh=new WeakMap,Wn=new WeakSet,I1=function(t,n){return n.map((r,o)=>{const i=t[o];return r.defaultedQueryOptions.notifyOnChangeProps?i:r.observer.trackResult(i,s=>{n.forEach(a=>{a.observer.trackProp(s)})})})},T1=function(t,n){return n?((!X(this,Js)||X(this,mo)!==X(this,Xh)||n!==X(this,Kh))&&(xe(this,Kh,n),xe(this,Xh,X(this,mo)),xe(this,Js,tb(X(this,Js),n(t)))),X(this,Js)):t},j1=function(t){const n=new Map(X(this,go).map(o=>[o.options.queryHash,o])),r=[];return t.forEach(o=>{const i=X(this,El).defaultQueryOptions(o),s=n.get(i.queryHash);s?r.push({defaultedQueryOptions:i,observer:s}):r.push({defaultedQueryOptions:i,observer:new DE(X(this,El),i)})}),r},O1=function(t,n){const r=X(this,go).indexOf(t);r!==-1&&(xe(this,mo,cK(X(this,mo),r,n)),He(this,Wn,F1).call(this))},F1=function(){var t;if(this.hasListeners()){const n=X(this,Js),r=He(this,Wn,I1).call(this,X(this,mo),X(this,Qh)),o=He(this,Wn,T1).call(this,r,(t=X(this,Mu))==null?void 0:t.combine);n!==o&&pn.batch(()=>{this.listeners.forEach(i=>{i(X(this,mo))})})}},Vj),IE=w.createContext(void 0),tp=e=>{const t=w.useContext(IE);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},dK=({client:e,children:t})=>(w.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),f.jsx(IE.Provider,{value:e,children:t})),NO=w.createContext(!1),MO=()=>w.useContext(NO);NO.Provider;function fK(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var hK=w.createContext(fK()),PO=()=>w.useContext(hK);function DO(e,t){return typeof e=="function"?e(...t):!!e}function ib(){}var AO=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},IO=e=>{w.useEffect(()=>{e.clearReset()},[e])},TO=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||DO(n,[e.error,r])),jO=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)))},OO=(e,t)=>e.isLoading&&e.isFetching&&!t,L1=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,sb=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function pK({queries:e,...t},n){const r=tp(),o=MO(),i=PO(),s=w.useMemo(()=>e.map(m=>{const b=r.defaultQueryOptions(m);return b._optimisticResults=o?"isRestoring":"optimistic",b}),[e,r,o]);s.forEach(m=>{jO(m),AO(m,i)}),IO(i);const[a]=w.useState(()=>new uK(r,s,t)),[l,c,u]=a.getOptimisticResult(s,t.combine),d=!o&&t.subscribed!==!1;w.useSyncExternalStore(w.useCallback(m=>d?a.subscribe(pn.batchCalls(m)):ib,[a,d]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),w.useEffect(()=>{a.setQueries(s,t,{listeners:!1})},[s,t,a]);const p=l.some((m,b)=>L1(s[b],m))?l.flatMap((m,b)=>{const y=s[b];if(y){const v=new DE(r,y);if(L1(y,m))return sb(y,v,i);OO(m,o)&&sb(y,v,i)}return[]}):[];if(p.length>0)throw Promise.all(p);const g=l.find((m,b)=>{const y=s[b];return y&&TO({result:m,errorResetBoundary:i,throwOnError:y.throwOnError,query:r.getQueryCache().get(y.queryHash),suspense:y.suspense})});if(g!=null&&g.error)throw g.error;return c(u())}function mK(e,t,n){var d,h,p,g,m;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=tp(),o=MO(),i=PO(),s=r.defaultQueryOptions(e);(h=(d=r.getDefaultOptions().queries)==null?void 0:d._experimental_beforeQuery)==null||h.call(d,s),process.env.NODE_ENV!=="production"&&(s.queryFn||console.error(`[${s.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),s._optimisticResults=o?"isRestoring":"optimistic",jO(s),AO(s,i),IO(i);const a=!r.getQueryCache().get(s.queryHash),[l]=w.useState(()=>new t(r,s)),c=l.getOptimisticResult(s),u=!o&&e.subscribed!==!1;if(w.useSyncExternalStore(w.useCallback(b=>{const y=u?l.subscribe(pn.batchCalls(b)):ib;return l.updateResult(),y},[l,u]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),w.useEffect(()=>{l.setOptions(s,{listeners:!1})},[s,l]),L1(s,c))throw sb(s,l,i);if(TO({result:c,errorResetBoundary:i,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw c.error;if((g=(p=r.getDefaultOptions().queries)==null?void 0:p._experimental_afterQuery)==null||g.call(p,s,c),s.experimental_prefetchInRender&&!Vl&&OO(c,o)){const b=a?sb(s,l,i):(m=r.getQueryCache().get(s.queryHash))==null?void 0:m.promise;b==null||b.catch(ib).finally(()=>{l.updateResult()})}return s.notifyOnChangeProps?c:l.trackResult(c)}function Tn(e,t){return mK(e,DE)}function gK(){const e=R.useContext(IE);if(e&&e.isSemaphorClient)return e}function FO({children:e}){const{setIsSessionExpired:t}=on(),n=gK(),[r]=R.useState(()=>{const o=new sK({queryCache:new _O({onError:i=>{i instanceof Error?(console.error(`Something went wrong: ${i.message}`),i.message==="invalid token"&&t(!0)):console.error("Something went wrong:",i)}}),defaultOptions:{queries:{gcTime:36e5,staleTime:3e5,refetchOnWindowFocus:!1,retry:1}}});return o.isSemaphorClient=!0,o});return n?f.jsx(f.Fragment,{children:e}):f.jsx(dK,{client:r,children:e})}const Qo=R.forwardRef(({children:e,className:t,...n},r)=>f.jsx("div",{className:re("semaphor-scope",t),ref:r,...n,children:e})),bK={id:"",authToken:void 0,tokenProps:{}},TE=R.createContext(bK),LO=({children:e,dashboardProps:t})=>{const n=R.useMemo(()=>{let r={};const o=t.authToken;return o&&(r=Zh(o.accessToken)),{...t,tokenProps:r}},[t]);return f.jsx(FO,{children:f.jsx(TE.Provider,{value:n,children:f.jsx(Qo,{style:{height:"100%"},children:e})})})};function ir(){const e=R.useContext(TE);if(e===void 0)throw new Error("useApplicationContext must be used within a ApplicationContextProvider");return e}const sd=Es()(Jh(e=>({selectedDashboard:null,selectedVisual:null,lastSelectedDashboard:null,lastSelectedVisual:null,actions:{selectDashboard:t=>{e(n=>{var r;((r=n.selectedDashboard)==null?void 0:r.id)!==t.id&&(n.lastSelectedDashboard=n.selectedDashboard,n.selectedDashboard=t)})},selectVisual:t=>{e(n=>{n.lastSelectedVisual=n.selectedVisual,n.selectedVisual=t})},clearSelectedDashboard:()=>{e(t=>{t.lastSelectedDashboard=t.selectedDashboard,t.selectedDashboard=null})},clearSelectedVisual:()=>{e(t=>{t.lastSelectedVisual=t.selectedVisual,t.selectedVisual=null})}}}))),yK=()=>sd(e=>e.selectedVisual),vK=()=>sd(e=>e.actions),xK=e=>sd(t=>{var n;return((n=t.selectedDashboard)==null?void 0:n.id)===e}),wK=e=>sd(t=>{var n;return((n=t.selectedVisual)==null?void 0:n.id)===e});function CK(){const e=sd(c=>c.selectedDashboard),{authToken:t,version:n}=ir(),r=oe(c=>c.selectedLensId);function o(){if(!(t!=null&&t.accessToken))return!1}const{data:i,isLoading:s,isFetching:a,isError:l}=Tn({queryKey:["dashboard",r,t==null?void 0:t.accessToken,e==null?void 0:e.id],queryFn:()=>BY(t==null?void 0:t.accessToken,{lensId:r,version:n,dashboardId:e==null?void 0:e.id}),enabled:o()});return{data:i,isLoading:s,isFetching:a,isError:l}}function SK(){const{authToken:e}=ir(),t=oe(r=>r.authToken),{setAuthToken:n}=on();return R.useEffect(()=>{e&&(e==null?void 0:e.toString())!==(t==null?void 0:t.toString())&&n(e)},[e,t,n]),e}const $O=(e,t)=>{const n={};if(e===null||t===null)return t;const r=new Set([...Object.keys(e),...Object.keys(t)]);for(const o of r){if(!(o in e)&&o in t){n[o]=t[o];continue}if(o in e&&!(o in t)){n[o]=void 0;continue}const i=e[o],s=t[o];if(!$1(i,s))if(Array.isArray(i)&&Array.isArray(s))n[o]=s;else if(eM(i)&&eM(s)){const a=$O(i,s);Object.keys(a).length>0&&(n[o]=a)}else n[o]=s}return n},$1=(e,t)=>{if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((o,i)=>$1(o,t[i]));const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(o=>$1(e[o],t[o]))}return!1},eM=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),th=e=>{if(e===null||typeof e!="object")return e;if(e instanceof Date)return new Date(e);if(e instanceof RegExp)return new RegExp(e);if(Array.isArray(e))return e.map(n=>th(n));const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=th(e[n]));return t};function zO(e){return e==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e}function tM(e,t){const n=zO(e);return n==="dark"?Jf({...t==null?void 0:t.default},{...t==null?void 0:t.dark}):t==null?void 0:t.default}function EK({customStyle:e,currentTheme:t,onSave:n,onEvent:r,defaultFilterValues:o,selectedSheetId:i,onFilterValuesChange:s}){const{authToken:a}=ir();SK();const l=oe(O=>O.selectedLensId),{data:c,isLoading:u,isFetching:d,isError:h}=CK(),[p,g]=R.useState(o||[]),{theme:m,setTheme:b}=bO(),y=oe(O=>O.dashboard.globalStyle),{setDashboard:v,setDashboardWithFilterValues:x,setSelectedSheetId:S,setStyle:_,setOnSaveFunction:E,setLenses:C,setSelectedLensId:k,setInitStore:N}=on();oe(O=>O.actions.setCustomCards);const M=oe(O=>O.actions.setFilterValues),A=oe(O=>O.filterValues),P=oe(O=>O.actions.setThemeStyle),j=oe(O=>O.actions.setDashboardTheme),F=oe(O=>O.actions.setOnEvent);R.useEffect(()=>{a&&N()},[a,N]),R.useEffect(()=>{if(m){const O=zO(m);j(O)}},[m,j]),R.useEffect(()=>{t&&b(t)},[t,b]);const I=R.useCallback(()=>{const O=th(Jg),$=Jf(O,y);if(e){const B=Jf($,e),z=tM(m,B);P(z),_(B)}else{const B=tM(m,$);P(B),_(Jg)}},[m,e,y,P,_]);return R.useEffect(()=>{c&&c.dashboard&&I()},[m,e,y,I,c]),R.useEffect(()=>{var L,D;function O(H,V){const q=H.filters||[],U=[];for(const Y of V){const K=q.find(Z=>Z.id===Y.filterId);K&&U.push({filterId:Y.filterId,connectionType:K.database==="NA"?"api":"database",name:K.column,operation:K.operation,valueType:nu(K),values:Y.values})}return U}if(!c||!c.dashboard)return;const{dashboard:$,filterValues:B,defaultLensId:z,lenses:T}=c;function W(){var V;if(B&&(B==null?void 0:B.length)>0)return B;const H=O($,p||[]);return H&&(H==null?void 0:H.length)>0?H:$.defaultFilterValues&&((V=$.defaultFilterValues)==null?void 0:V.length)>0?$.defaultFilterValues:[]}x($,W()),T&&C(T),z&&k(z),S(i||((D=(L=$==null?void 0:$.sheets)==null?void 0:L[0])==null?void 0:D.id)||null)},[c,v,S,M,l,C,x,k,p,i]),R.useEffect(()=>{s&&A&&s(A)},[A,s]),R.useEffect(()=>{n&&E(n),r&&F(r)},[n,E,r,F]),{isFetching:d,isLoading:u,isError:h}}function ms({className:e,...t}){return f.jsx("div",{className:re("animate-pulse rounded-md bg-muted",e),...t})}const ab=w.forwardRef(({className:e,...t},n)=>f.jsx("div",{ref:n,className:re("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));ab.displayName="Card";const Tu=w.forwardRef(({className:e,...t},n)=>f.jsx("div",{ref:n,className:re("flex flex-col space-y-1.5 p-6",e),...t}));Tu.displayName="CardHeader";const fa=w.forwardRef(({className:e,...t},n)=>f.jsx("h3",{ref:n,className:re("text-2xl font-semibold leading-none tracking-tight",e),...t}));fa.displayName="CardTitle";const jE=w.forwardRef(({className:e,...t},n)=>f.jsx("p",{ref:n,className:re("text-sm text-muted-foreground",e),...t}));jE.displayName="CardDescription";const nh=w.forwardRef(({className:e,...t},n)=>f.jsx("div",{ref:n,className:re("px-6 pt-0",e),...t}));nh.displayName="CardContent";const BO=w.forwardRef(({className:e,...t},n)=>f.jsx("div",{ref:n,className:re("flex items-center p-6 pt-0",e),...t}));BO.displayName="CardFooter";function VO({className:e,customStyle:t,onSave:n,onEvent:r,LoadingComponent:o,ErrorComponent:i,onChartElementClicked:s,id:a,authToken:l,currentTheme:c,version:u,customCards:d,showAssistant:h,defaultFilterValues:p,onFilterValuesChange:g,selectedSheetId:m,eventHandlers:b,...y}){const{placeholders:v}=ir(),x=oe(C=>C.themeStyle),S=oe(C=>C.isSessionExpired),{isLoading:_,isError:E}=EK({customStyle:t,currentTheme:c,onSave:n,onEvent:r,defaultFilterValues:p,onFilterValuesChange:g,selectedSheetId:m});return _||!l?(r==null||r({type:"info",message:"Loading dashboard"}),o?f.jsx(o,{message:"loading"}):f.jsx("div",{className:"flex items-center gap-3",children:f.jsx(ms,{className:"h-1 w-full dark:h-[2px]"})})):E?(r==null||r({type:"error",message:"Error fetching dashboard"}),i?(console.log("Error fetching dashboard"),f.jsx(i,{})):f.jsx("div",{children:"Error"})):S?(r==null||r({type:"error",message:"Session Expired"}),v!=null&&v.SessionExpired?f.jsx("div",{className:"flex h-full items-center justify-center",children:f.jsx("div",{children:v.SessionExpired})}):f.jsx("div",{className:"flex h-full items-center justify-center",children:f.jsxs("div",{className:"space-y-4 rounded-md border border-muted p-10",children:[f.jsx(fa,{children:"Session Expired"}),f.jsx("p",{className:"text-muted-foreground",children:"Please refresh your page to continue"})]})})):f.jsx("div",{className:re("isolate flex grow flex-col",x==null?void 0:x.dashboardPanel,e),style:{},"data-role":"dashboard-panel",...y})}function fe(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function _K(e,t){const n=w.createContext(t),r=i=>{const{children:s,...a}=i,l=w.useMemo(()=>a,Object.values(a));return f.jsx(n.Provider,{value:l,children:s})};r.displayName=e+"Provider";function o(i){const s=w.useContext(n);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,o]}function Pn(e,t=[]){let n=[];function r(i,s){const a=w.createContext(s),l=n.length;n=[...n,s];const c=d=>{var y;const{scope:h,children:p,...g}=d,m=((y=h==null?void 0:h[e])==null?void 0:y[l])||a,b=w.useMemo(()=>g,Object.values(g));return f.jsx(m.Provider,{value:b,children:p})};c.displayName=i+"Provider";function u(d,h){var m;const p=((m=h==null?void 0:h[e])==null?void 0:m[l])||a,g=w.useContext(p);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[c,u]}const o=()=>{const i=n.map(s=>w.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return w.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,RK(o,...t)]}function RK(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(i)[`__scope${c}`];return{...a,...d}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function nM(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function vr(...e){return t=>{let n=!1;const r=e.map(o=>{const i=nM(o,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<r.length;o++){const i=r[o];typeof i=="function"?i():nM(e[o],null)}}}}function Ve(...e){return w.useCallback(vr(...e),e)}var z1=w.forwardRef((e,t)=>{const{children:n,...r}=e,o=w.Children.toArray(n),i=o.find(NK);if(i){const s=i.props.children,a=o.map(l=>l===i?w.Children.count(s)>1?w.Children.only(null):w.isValidElement(s)?s.props.children:null:l);return f.jsx(B1,{...r,ref:t,children:w.isValidElement(s)?w.cloneElement(s,void 0,a):null})}return f.jsx(B1,{...r,ref:t,children:n})});z1.displayName="Slot";var B1=w.forwardRef((e,t)=>{const{children:n,...r}=e;if(w.isValidElement(n)){const o=PK(n),i=MK(r,n.props);return n.type!==w.Fragment&&(i.ref=t?vr(t,o):o),w.cloneElement(n,i)}return w.Children.count(n)>1?w.Children.only(null):null});B1.displayName="SlotClone";var kK=({children:e})=>f.jsx(f.Fragment,{children:e});function NK(e){return w.isValidElement(e)&&e.type===kK}function MK(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function PK(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function T0(e){const t=e+"CollectionProvider",[n,r]=Pn(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=p=>{const{scope:g,children:m}=p,b=R.useRef(null),y=R.useRef(new Map).current;return f.jsx(o,{scope:g,itemMap:y,collectionRef:b,children:m})};s.displayName=t;const a=e+"CollectionSlot",l=R.forwardRef((p,g)=>{const{scope:m,children:b}=p,y=i(a,m),v=Ve(g,y.collectionRef);return f.jsx(z1,{ref:v,children:b})});l.displayName=a;const c=e+"CollectionItemSlot",u="data-radix-collection-item",d=R.forwardRef((p,g)=>{const{scope:m,children:b,...y}=p,v=R.useRef(null),x=Ve(g,v),S=i(c,m);return R.useEffect(()=>(S.itemMap.set(v,{ref:v,...y}),()=>void S.itemMap.delete(v))),f.jsx(z1,{[u]:"",ref:x,children:b})});d.displayName=c;function h(p){const g=i(e+"CollectionConsumer",p);return R.useCallback(()=>{const b=g.collectionRef.current;if(!b)return[];const y=Array.from(b.querySelectorAll(`[${u}]`));return Array.from(g.itemMap.values()).sort((S,_)=>y.indexOf(S.ref.current)-y.indexOf(_.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:s,Slot:l,ItemSlot:d},h,r]}var Vn=globalThis!=null&&globalThis.document?w.useLayoutEffect:()=>{},DK=w.useId||(()=>{}),AK=0;function _n(e){const[t,n]=w.useState(DK());return Vn(()=>{n(r=>r??String(AK++))},[e]),t?`radix-${t}`:""}var HO=w.forwardRef((e,t)=>{const{children:n,...r}=e,o=w.Children.toArray(n),i=o.find(TK);if(i){const s=i.props.children,a=o.map(l=>l===i?w.Children.count(s)>1?w.Children.only(null):w.isValidElement(s)?s.props.children:null:l);return f.jsx(V1,{...r,ref:t,children:w.isValidElement(s)?w.cloneElement(s,void 0,a):null})}return f.jsx(V1,{...r,ref:t,children:n})});HO.displayName="Slot";var V1=w.forwardRef((e,t)=>{const{children:n,...r}=e;if(w.isValidElement(n)){const o=OK(n),i=jK(r,n.props);return n.type!==w.Fragment&&(i.ref=t?vr(t,o):o),w.cloneElement(n,i)}return w.Children.count(n)>1?w.Children.only(null):null});V1.displayName="SlotClone";var IK=({children:e})=>f.jsx(f.Fragment,{children:e});function TK(e){return w.isValidElement(e)&&e.type===IK}function jK(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function OK(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var FK=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],_e=FK.reduce((e,t)=>{const n=w.forwardRef((r,o)=>{const{asChild:i,...s}=r,a=i?HO:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(a,{...s,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function WO(e,t){e&&vs.flushSync(()=>e.dispatchEvent(t))}function Mn(e){const t=w.useRef(e);return w.useEffect(()=>{t.current=e}),w.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function or({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=LK({defaultProp:t,onChange:n}),i=e!==void 0,s=i?e:r,a=Mn(n),l=w.useCallback(c=>{if(i){const d=typeof c=="function"?c(e):c;d!==e&&a(d)}else o(c)},[i,e,o,a]);return[s,l]}function LK({defaultProp:e,onChange:t}){const n=w.useState(e),[r]=n,o=w.useRef(r),i=Mn(t);return w.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}var $K=w.createContext(void 0);function ac(e){const t=w.useContext($K);return e||t||"ltr"}var Uv="rovingFocusGroup.onEntryFocus",zK={bubbles:!1,cancelable:!0},j0="RovingFocusGroup",[H1,UO,BK]=T0(j0),[VK,ad]=Pn(j0,[BK]),[HK,WK]=VK(j0),GO=w.forwardRef((e,t)=>f.jsx(H1.Provider,{scope:e.__scopeRovingFocusGroup,children:f.jsx(H1.Slot,{scope:e.__scopeRovingFocusGroup,children:f.jsx(UK,{...e,ref:t})})}));GO.displayName=j0;var UK=w.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=e,h=w.useRef(null),p=Ve(t,h),g=ac(i),[m=null,b]=or({prop:s,defaultProp:a,onChange:l}),[y,v]=w.useState(!1),x=Mn(c),S=UO(n),_=w.useRef(!1),[E,C]=w.useState(0);return w.useEffect(()=>{const k=h.current;if(k)return k.addEventListener(Uv,x),()=>k.removeEventListener(Uv,x)},[x]),f.jsx(HK,{scope:n,orientation:r,dir:g,loop:o,currentTabStopId:m,onItemFocus:w.useCallback(k=>b(k),[b]),onItemShiftTab:w.useCallback(()=>v(!0),[]),onFocusableItemAdd:w.useCallback(()=>C(k=>k+1),[]),onFocusableItemRemove:w.useCallback(()=>C(k=>k-1),[]),children:f.jsx(_e.div,{tabIndex:y||E===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:"none",...e.style},onMouseDown:fe(e.onMouseDown,()=>{_.current=!0}),onFocus:fe(e.onFocus,k=>{const N=!_.current;if(k.target===k.currentTarget&&N&&!y){const M=new CustomEvent(Uv,zK);if(k.currentTarget.dispatchEvent(M),!M.defaultPrevented){const A=S().filter(O=>O.focusable),P=A.find(O=>O.active),j=A.find(O=>O.id===m),I=[P,j,...A].filter(Boolean).map(O=>O.ref.current);KO(I,u)}}_.current=!1}),onBlur:fe(e.onBlur,()=>v(!1))})})}),qO="RovingFocusGroupItem",YO=w.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,...s}=e,a=_n(),l=i||a,c=WK(qO,n),u=c.currentTabStopId===l,d=UO(n),{onFocusableItemAdd:h,onFocusableItemRemove:p}=c;return w.useEffect(()=>{if(r)return h(),()=>p()},[r,h,p]),f.jsx(H1.ItemSlot,{scope:n,id:l,focusable:r,active:o,children:f.jsx(_e.span,{tabIndex:u?0:-1,"data-orientation":c.orientation,...s,ref:t,onMouseDown:fe(e.onMouseDown,g=>{r?c.onItemFocus(l):g.preventDefault()}),onFocus:fe(e.onFocus,()=>c.onItemFocus(l)),onKeyDown:fe(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){c.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const m=YK(g,c.orientation,c.dir);if(m!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let y=d().filter(v=>v.focusable).map(v=>v.ref.current);if(m==="last")y.reverse();else if(m==="prev"||m==="next"){m==="prev"&&y.reverse();const v=y.indexOf(g.currentTarget);y=c.loop?KK(y,v+1):y.slice(v+1)}setTimeout(()=>KO(y))}})})})});YO.displayName=qO;var GK={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function qK(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function YK(e,t,n){const r=qK(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return GK[r]}function KO(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function KK(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var OE=GO,FE=YO;function XK(e,t){return w.useReducer((n,r)=>t[n][r]??n,e)}var fn=e=>{const{present:t,children:n}=e,r=QK(t),o=typeof n=="function"?n({present:r.isPresent}):w.Children.only(n),i=Ve(r.ref,ZK(o));return typeof n=="function"||r.isPresent?w.cloneElement(o,{ref:i}):null};fn.displayName="Presence";function QK(e){const[t,n]=w.useState(),r=w.useRef({}),o=w.useRef(e),i=w.useRef("none"),s=e?"mounted":"unmounted",[a,l]=XK(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const c=um(r.current);i.current=a==="mounted"?c:"none"},[a]),Vn(()=>{const c=r.current,u=o.current;if(u!==e){const h=i.current,p=um(c);e?l("MOUNT"):p==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&h!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),Vn(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,d=p=>{const m=um(r.current).includes(p.animationName);if(p.target===t&&m&&(l("ANIMATION_END"),!o.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},h=p=>{p.target===t&&(i.current=um(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{u.clearTimeout(c),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:w.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function um(e){return(e==null?void 0:e.animationName)||"none"}function ZK(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var LE="Tabs",[JK,DLe]=Pn(LE,[ad]),XO=ad(),[eX,$E]=JK(LE),QO=w.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:l="automatic",...c}=e,u=ac(a),[d,h]=or({prop:r,onChange:o,defaultProp:i});return f.jsx(eX,{scope:n,baseId:_n(),value:d,onValueChange:h,orientation:s,dir:u,activationMode:l,children:f.jsx(_e.div,{dir:u,"data-orientation":s,...c,ref:t})})});QO.displayName=LE;var ZO="TabsList",JO=w.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=$E(ZO,n),s=XO(n);return f.jsx(OE,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:f.jsx(_e.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});JO.displayName=ZO;var e5="TabsTrigger",t5=w.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=$E(e5,n),a=XO(n),l=o5(s.baseId,r),c=i5(s.baseId,r),u=r===s.value;return f.jsx(FE,{asChild:!0,...a,focusable:!o,active:u,children:f.jsx(_e.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:l,...i,ref:t,onMouseDown:fe(e.onMouseDown,d=>{!o&&d.button===0&&d.ctrlKey===!1?s.onValueChange(r):d.preventDefault()}),onKeyDown:fe(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&s.onValueChange(r)}),onFocus:fe(e.onFocus,()=>{const d=s.activationMode!=="manual";!u&&!o&&d&&s.onValueChange(r)})})})});t5.displayName=e5;var n5="TabsContent",r5=w.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=$E(n5,n),l=o5(a.baseId,r),c=i5(a.baseId,r),u=r===a.value,d=w.useRef(u);return w.useEffect(()=>{const h=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(h)},[]),f.jsx(fn,{present:o||u,children:({present:h})=>f.jsx(_e.div,{"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!h,id:c,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:h&&i})})});r5.displayName=n5;function o5(e,t){return`${e}-trigger-${t}`}function i5(e,t){return`${e}-content-${t}`}var tX=QO,s5=JO,a5=t5,l5=r5;const ld=tX,lc=w.forwardRef(({className:e,...t},n)=>f.jsx(s5,{ref:n,className:re("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));lc.displayName=s5.displayName;const Jr=w.forwardRef(({className:e,...t},n)=>f.jsx(a5,{ref:n,className:re("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}));Jr.displayName=a5.displayName;const mi=w.forwardRef(({className:e,...t},n)=>f.jsx(l5,{ref:n,className:re("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));mi.displayName=l5.displayName;var c5={exports:{}},np={},W1={exports:{}};(function(e,t){(function(n,r){r(t)})(ls,function(n){function r(Y){return function(Z,ee,Q,ie,te,le,ue){return Y(Z,ee,ue)}}function o(Y){return function(Z,ee,Q,ie){if(!Z||!ee||typeof Z!="object"||typeof ee!="object")return Y(Z,ee,Q,ie);var te=ie.get(Z),le=ie.get(ee);if(te&&le)return te===ee&&le===Z;ie.set(Z,ee),ie.set(ee,Z);var ue=Y(Z,ee,Q,ie);return ie.delete(Z),ie.delete(ee),ue}}function i(Y,K){var Z={};for(var ee in Y)Z[ee]=Y[ee];for(var ee in K)Z[ee]=K[ee];return Z}function s(Y){return Y.constructor===Object||Y.constructor==null}function a(Y){return typeof Y.then=="function"}function l(Y,K){return Y===K||Y!==Y&&K!==K}var c="[object Arguments]",u="[object Boolean]",d="[object Date]",h="[object RegExp]",p="[object Map]",g="[object Number]",m="[object Object]",b="[object Set]",y="[object String]",v=Object.prototype.toString;function x(Y){var K=Y.areArraysEqual,Z=Y.areDatesEqual,ee=Y.areMapsEqual,Q=Y.areObjectsEqual,ie=Y.areRegExpsEqual,te=Y.areSetsEqual,le=Y.createIsNestedEqual,ue=le(Re);function Re(be,we,Pe){if(be===we)return!0;if(!be||!we||typeof be!="object"||typeof we!="object")return be!==be&&we!==we;if(s(be)&&s(we))return Q(be,we,ue,Pe);var Ye=Array.isArray(be),_t=Array.isArray(we);if(Ye||_t)return Ye===_t&&K(be,we,ue,Pe);var me=v.call(be);return me!==v.call(we)?!1:me===d?Z(be,we,ue,Pe):me===h?ie(be,we,ue,Pe):me===p?ee(be,we,ue,Pe):me===b?te(be,we,ue,Pe):me===m||me===c?a(be)||a(we)?!1:Q(be,we,ue,Pe):me===u||me===g||me===y?l(be.valueOf(),we.valueOf()):!1}return Re}function S(Y,K,Z,ee){var Q=Y.length;if(K.length!==Q)return!1;for(;Q-- >0;)if(!Z(Y[Q],K[Q],Q,Q,Y,K,ee))return!1;return!0}var _=o(S);function E(Y,K){return l(Y.valueOf(),K.valueOf())}function C(Y,K,Z,ee){var Q=Y.size===K.size;if(!Q)return!1;if(!Y.size)return!0;var ie={},te=0;return Y.forEach(function(le,ue){if(Q){var Re=!1,be=0;K.forEach(function(we,Pe){!Re&&!ie[be]&&(Re=Z(ue,Pe,te,be,Y,K,ee)&&Z(le,we,ue,Pe,Y,K,ee))&&(ie[be]=!0),be++}),te++,Q=Re}}),Q}var k=o(C),N="_owner",M=Object.prototype.hasOwnProperty;function A(Y,K,Z,ee){var Q=Object.keys(Y),ie=Q.length;if(Object.keys(K).length!==ie)return!1;for(var te;ie-- >0;){if(te=Q[ie],te===N){var le=!!Y.$$typeof,ue=!!K.$$typeof;if((le||ue)&&le!==ue)return!1}if(!M.call(K,te)||!Z(Y[te],K[te],te,te,Y,K,ee))return!1}return!0}var P=o(A);function j(Y,K){return Y.source===K.source&&Y.flags===K.flags}function F(Y,K,Z,ee){var Q=Y.size===K.size;if(!Q)return!1;if(!Y.size)return!0;var ie={};return Y.forEach(function(te,le){if(Q){var ue=!1,Re=0;K.forEach(function(be,we){!ue&&!ie[Re]&&(ue=Z(te,be,le,we,Y,K,ee))&&(ie[Re]=!0),Re++}),Q=ue}}),Q}var I=o(F),O=Object.freeze({areArraysEqual:S,areDatesEqual:E,areMapsEqual:C,areObjectsEqual:A,areRegExpsEqual:j,areSetsEqual:F,createIsNestedEqual:r}),$=Object.freeze({areArraysEqual:_,areDatesEqual:E,areMapsEqual:k,areObjectsEqual:P,areRegExpsEqual:j,areSetsEqual:I,createIsNestedEqual:r}),B=x(O);function z(Y,K){return B(Y,K,void 0)}var T=x(i(O,{createIsNestedEqual:function(){return l}}));function W(Y,K){return T(Y,K,void 0)}var L=x($);function D(Y,K){return L(Y,K,new WeakMap)}var H=x(i($,{createIsNestedEqual:function(){return l}}));function V(Y,K){return H(Y,K,new WeakMap)}function q(Y){return x(i(O,Y(O)))}function U(Y){var K=x(i($,Y($)));return function(Z,ee,Q){return Q===void 0&&(Q=new WeakMap),K(Z,ee,Q)}}n.circularDeepEqual=D,n.circularShallowEqual=V,n.createCustomCircularEqual=U,n.createCustomEqual=q,n.deepEqual=z,n.sameValueZeroEqual=l,n.shallowEqual=W,Object.defineProperty(n,"__esModule",{value:!0})})})(W1,W1.exports);var zE=W1.exports;const BE=bE(mq);var lt={},nX=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(lt,"__esModule",{value:!0});lt.bottom=VE;lt.childrenEqual=sX;lt.cloneLayout=u5;lt.cloneLayoutItem=_l;lt.collides=O0;lt.compact=f5;lt.compactItem=h5;lt.compactType=vX;lt.correctBounds=p5;lt.fastPositionEqual=aX;lt.fastRGLPropsEqual=void 0;lt.getAllCollisions=m5;lt.getFirstCollision=cl;lt.getLayoutItem=HE;lt.getStatics=WE;lt.modifyLayout=d5;lt.moveElement=of;lt.moveElementAwayFromCollision=G1;lt.noop=void 0;lt.perc=cX;lt.resizeItemInDirection=mX;lt.setTopLeft=bX;lt.setTransform=gX;lt.sortLayoutItems=XE;lt.sortLayoutItemsByColRow=x5;lt.sortLayoutItemsByRowCol=v5;lt.synchronizeLayoutWithChildren=yX;lt.validateLayout=w5;lt.withLayoutItem=iX;var rM=zE,rf=rX(R);function rX(e){return e&&e.__esModule?e:{default:e}}const oX=process.env.NODE_ENV==="production";function VE(e){let t=0,n;for(let r=0,o=e.length;r<o;r++)n=e[r].y+e[r].h,n>t&&(t=n);return t}function u5(e){const t=Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=_l(e[n]);return t}function d5(e,t){const n=Array(e.length);for(let r=0,o=e.length;r<o;r++)t.i===e[r].i?n[r]=t:n[r]=e[r];return n}function iX(e,t,n){let r=HE(e,t);return r?(r=n(_l(r)),e=d5(e,r),[e,r]):[e,null]}function _l(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 sX(e,t){return(0,rM.deepEqual)(rf.default.Children.map(e,n=>n==null?void 0:n.key),rf.default.Children.map(t,n=>n==null?void 0:n.key))&&(0,rM.deepEqual)(rf.default.Children.map(e,n=>n==null?void 0:n.props["data-grid"]),rf.default.Children.map(t,n=>n==null?void 0:n.props["data-grid"]))}lt.fastRGLPropsEqual=nX;function aX(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function O0(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 f5(e,t,n,r){const o=WE(e),i=XE(e,t),s=Array(e.length);for(let a=0,l=i.length;a<l;a++){let c=_l(i[a]);c.static||(c=h5(o,c,t,n,i,r),o.push(c)),s[e.indexOf(i[a])]=c,c.moved=!1}return s}const lX={x:"w",y:"h"};function U1(e,t,n,r){const o=lX[r];t[r]+=1;const i=e.map(s=>s.i).indexOf(t.i);for(let s=i+1;s<e.length;s++){const a=e[s];if(!a.static){if(a.y>t.y+t.h)break;O0(t,a)&&U1(e,a,n+t[o],r)}}t[r]=n}function h5(e,t,n,r,o,i){const s=n==="vertical",a=n==="horizontal";if(s)for(t.y=Math.min(VE(e),t.y);t.y>0&&!cl(e,t);)t.y--;else if(a)for(;t.x>0&&!cl(e,t);)t.x--;let l;for(;(l=cl(e,t))&&!(n===null&&i);)if(a?U1(o,t,l.x+l.w,"x"):U1(o,t,l.y+l.h,"y"),a&&t.x+t.w>r)for(t.x=r-t.w,t.y++;t.x>0&&!cl(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function p5(e,t){const n=WE(e);for(let r=0,o=e.length;r<o;r++){const i=e[r];if(i.x+i.w>t.cols&&(i.x=t.cols-i.w),i.x<0&&(i.x=0,i.w=t.cols),!i.static)n.push(i);else for(;cl(n,i);)i.y++}return e}function HE(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function cl(e,t){for(let n=0,r=e.length;n<r;n++)if(O0(e[n],t))return e[n]}function m5(e,t){return e.filter(n=>O0(n,t))}function WE(e){return e.filter(t=>t.static)}function of(e,t,n,r,o,i,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=XE(e,s);(s==="vertical"&&typeof r=="number"?u>=r:s==="horizontal"&&typeof n=="number"?c>=n:!1)&&(d=d.reverse());const p=m5(d,t),g=p.length>0;if(g&&l)return u5(e);if(g&&i)return`${t.i}`,t.x=c,t.y=u,t.moved=!1,e;for(let m=0,b=p.length;m<b;m++){const y=p[m];`${t.i}${t.x}${t.y}${y.i}${y.x}${y.y}`,!y.moved&&(y.static?e=G1(e,y,t,o,s):e=G1(e,t,y,o,s))}return e}function G1(e,t,n,r,o,i){const s=o==="horizontal",a=o==="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"},h=cl(e,d),p=h&&h.y+h.h>t.y,g=h&&t.x+t.w>h.x;if(h){if(p&&a)return of(e,n,void 0,t.y+1,r,l,o);if(p&&o==null)return t.y=n.y,n.y=n.y+n.h,e;if(g&&s)return of(e,t,n.x,void 0,r,l,o)}else return`${n.i}${d.x}${d.y}`,of(e,n,s?d.x:void 0,a?d.y:void 0,r,l,o)}const c=s?n.x+1:void 0,u=a?n.y+1:void 0;return c==null&&u==null?e:of(e,n,s?n.x+1:void 0,a?n.y+1:void 0,r,l,o)}function cX(e){return e*100+"%"}const g5=(e,t,n,r)=>e+n>r?t:n,b5=(e,t,n)=>e<0?t:n,y5=e=>Math.max(0,e),UE=e=>Math.max(0,e),GE=(e,t,n)=>{let{left:r,height:o,width:i}=t;const s=e.top-(o-e.height);return{left:r,width:i,height:b5(s,e.height,o),top:UE(s)}},qE=(e,t,n)=>{let{top:r,left:o,height:i,width:s}=t;return{top:r,height:i,width:g5(e.left,e.width,s,n),left:y5(o)}},YE=(e,t,n)=>{let{top:r,height:o,width:i}=t;const s=e.left-(i-e.width);return{height:o,width:s<0?e.width:g5(e.left,e.width,i,n),top:UE(r),left:y5(s)}},KE=(e,t,n)=>{let{top:r,left:o,height:i,width:s}=t;return{width:s,left:o,height:b5(r,e.height,i),top:UE(r)}},uX=function(){return GE(arguments.length<=0?void 0:arguments[0],qE(...arguments))},dX=function(){return GE(arguments.length<=0?void 0:arguments[0],YE(...arguments))},fX=function(){return KE(arguments.length<=0?void 0:arguments[0],qE(...arguments))},hX=function(){return KE(arguments.length<=0?void 0:arguments[0],YE(...arguments))},pX={n:GE,ne:uX,e:qE,se:fX,s:KE,sw:hX,w:YE,nw:dX};function mX(e,t,n,r){const o=pX[e];return o?o(t,{...t,...n},r):n}function gX(e){let{top:t,left:n,width:r,height:o}=e;const i=`translate(${n}px,${t}px)`;return{transform:i,WebkitTransform:i,MozTransform:i,msTransform:i,OTransform:i,width:`${r}px`,height:`${o}px`,position:"absolute"}}function bX(e){let{top:t,left:n,width:r,height:o}=e;return{top:`${t}px`,left:`${n}px`,width:`${r}px`,height:`${o}px`,position:"absolute"}}function XE(e,t){return t==="horizontal"?x5(e):t==="vertical"?v5(e):e}function v5(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 x5(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 yX(e,t,n,r,o){e=e||[];const i=[];rf.default.Children.forEach(t,a=>{if((a==null?void 0:a.key)==null)return;const l=HE(e,String(a.key)),c=a.props["data-grid"];l&&c==null?i.push(_l(l)):c?(oX||w5([c],"ReactGridLayout.children"),i.push(_l({...c,i:a.key}))):i.push(_l({w:1,h:1,x:0,y:VE(i),i:String(a.key)}))});const s=p5(i,{cols:n});return o?s:f5(s,r,n)}function w5(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Layout";const n=["x","y","w","h"];if(!Array.isArray(e))throw new Error(t+" must be an array!");for(let r=0,o=e.length;r<o;r++){const i=e[r];for(let s=0;s<n.length;s++){const a=n[s],l=i[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 i.i<"u"&&typeof i.i!="string")throw new Error(`ReactGridLayout: ${t}[${r}].i must be a string! Received: ${i.i} (${typeof i.i})`)}}function vX(e){const{verticalCompact:t,compactType:n}=e||{};return t===!1?null:n}const xX=()=>{};lt.noop=xX;var ji={};Object.defineProperty(ji,"__esModule",{value:!0});ji.calcGridColWidth=F0;ji.calcGridItemPosition=wX;ji.calcGridItemWHPx=q1;ji.calcWH=SX;ji.calcXY=CX;ji.clamp=ul;function F0(e){const{margin:t,containerPadding:n,containerWidth:r,cols:o}=e;return(r-t[0]*(o-1)-n[0]*2)/o}function q1(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function wX(e,t,n,r,o,i){const{margin:s,containerPadding:a,rowHeight:l}=e,c=F0(e),u={};return i&&i.resizing?(u.width=Math.round(i.resizing.width),u.height=Math.round(i.resizing.height)):(u.width=q1(r,c,s[0]),u.height=q1(o,l,s[1])),i&&i.dragging?(u.top=Math.round(i.dragging.top),u.left=Math.round(i.dragging.left)):i&&i.resizing&&typeof i.resizing.top=="number"&&typeof i.resizing.left=="number"?(u.top=Math.round(i.resizing.top),u.left=Math.round(i.resizing.left)):(u.top=Math.round((l+s[1])*n+a[1]),u.left=Math.round((c+s[0])*t+a[0])),u}function CX(e,t,n,r,o){const{margin:i,containerPadding:s,cols:a,rowHeight:l,maxRows:c}=e,u=F0(e);let d=Math.round((n-s[0])/(u+i[0])),h=Math.round((t-s[1])/(l+i[1]));return d=ul(d,0,a-r),h=ul(h,0,c-o),{x:d,y:h}}function SX(e,t,n,r,o,i){const{margin:s,maxRows:a,cols:l,rowHeight:c}=e,u=F0(e);let d=Math.round((t+s[0])/(u+s[0])),h=Math.round((n+s[1])/(c+s[1])),p=ul(d,0,l-r),g=ul(h,0,a-o);return["sw","w","nw"].indexOf(i)!==-1&&(p=ul(d,0,l)),["nw","n","ne"].indexOf(i)!==-1&&(g=ul(h,0,a)),{w:p,h:g}}function ul(e,t,n){return Math.max(Math.min(e,n),t)}var L0={},Y1={exports:{}},dm={exports:{}},kt={};/** @license React v16.13.1
|
|
36
|
+
`,iO=["_forecast"],Zg="dm",Qf=[{locale:"en-US",currency:"USD",currencyName:"US Dollar"},{locale:"en-GB",currency:"GBP",currencyName:"British Pound"},{locale:"en-CA",currency:"CAD",currencyName:"Canadian Dollar"},{locale:"en-AU",currency:"AUD",currencyName:"Australian Dollar"},{locale:"en-IN",currency:"INR",currencyName:"Indian Rupee"},{locale:"ja-JP",currency:"JPY",currencyName:"Japanese Yen"},{locale:"de-DE",currency:"EUR",currencyName:"Germany (Eurozone)"},{locale:"fr-FR",currency:"EUR",currencyName:"France (Eurozone)"},{locale:"es-ES",currency:"EUR",currencyName:"Spain (Eurozone)"},{locale:"it-IT",currency:"EUR",currencyName:"Italy (Eurozone)"},{locale:"fi-FI",currency:"EUR",currencyName:"Finland (Eurozone)"},{locale:"nl-NL",currency:"EUR",currencyName:"Netherlands (Eurozone)"},{locale:"zh-CN",currency:"CNY",currencyName:"Chinese Yuan"},{locale:"ru-RU",currency:"RUB",currencyName:"Russian Ruble"},{locale:"pt-BR",currency:"BRL",currencyName:"Brazilian Real"},{locale:"ko-KR",currency:"KRW",currencyName:"South Korean Won"},{locale:"ar-SA",currency:"SAR",currencyName:"Saudi Riyal"},{locale:"sv-SE",currency:"SEK",currencyName:"Swedish Krona"},{locale:"no-NO",currency:"NOK",currencyName:"Norwegian Krone"},{locale:"da-DK",currency:"DKK",currencyName:"Danish Krone"},{locale:"pl-PL",currency:"PLN",currencyName:"Polish Zloty"},{locale:"tr-TR",currency:"TRY",currencyName:"Turkish Lira"},{locale:"he-IL",currency:"ILS",currencyName:"Israeli Shekel"},{locale:"th-TH",currency:"THB",currencyName:"Thai Baht"},{locale:"vi-VN",currency:"VND",currencyName:"Vietnamese Dong"},{locale:"id-ID",currency:"IDR",currencyName:"Indonesian Rupiah"},{locale:"mx-MX",currency:"MXN",currencyName:"Mexican Peso"},{locale:"za-ZA",currency:"ZAR",currencyName:"South African Rand"},{locale:"sg-SG",currency:"SGD",currencyName:"Singapore Dollar"},{locale:"hk-HK",currency:"HKD",currencyName:"Hong Kong Dollar"},{locale:"ch-CH",currency:"CHF",currencyName:"Swiss Franc"},{locale:"my-MY",currency:"MYR",currencyName:"Malaysian Ringgit"},{locale:"ph-PH",currency:"PHP",currencyName:"Philippine Peso"},{locale:"eg-EG",currency:"EGP",currencyName:"Egyptian Pound"},{locale:"nz-NZ",currency:"NZD",currencyName:"New Zealand Dollar"}],SY=[{label:"English",locales:[{code:"en-US",name:"US English"},{code:"en-GB",name:"British English"},{code:"en-AU",name:"Australian English"},{code:"en-CA",name:"Canadian English"}]},{label:"French",locales:[{code:"fr-FR",name:"France French"},{code:"fr-CA",name:"Canadian French"}]},{label:"Spanish",locales:[{code:"es-ES",name:"Spain Spanish"},{code:"es-MX",name:"Mexican Spanish"},{code:"es-419",name:"Latin American Spanish"}]},{label:"German",locales:[{code:"de-DE",name:"Germany German"},{code:"de-CH",name:"Swiss German"}]},{label:"Chinese",locales:[{code:"zh-CN",name:"Simplified Chinese (China)"},{code:"zh-TW",name:"Traditional Chinese (Taiwan)"},{code:"zh-HK",name:"Hong Kong Chinese"}]},{label:"Japanese",locales:[{code:"ja-JP",name:"Japanese"}]},{label:"Arabic",locales:[{code:"ar-EG",name:"Egypt Arabic"},{code:"ar-SA",name:"Saudi Arabia Arabic"}]},{label:"Russian",locales:[{code:"ru-RU",name:"Russian"}]},{label:"Portuguese",locales:[{code:"pt-PT",name:"Portugal Portuguese"},{code:"pt-BR",name:"Brazil Portuguese"}]},{label:"Indian Languages",locales:[{code:"hi-IN",name:"Hindi (India)"},{code:"ta-IN",name:"Tamil (India)"}]},{label:"Korean",locales:[{code:"ko-KR",name:"Korean"}]},{label:"Italian",locales:[{code:"it-IT",name:"Italian (Italy)"}]},{label:"Dutch",locales:[{code:"nl-NL",name:"Dutch (Netherlands)"}]},{label:"Swedish",locales:[{code:"sv-SE",name:"Swedish (Sweden)"}]},{label:"Turkish",locales:[{code:"tr-TR",name:"Turkish (Turkey)"}]},{label:"Hebrew",locales:[{code:"he-IL",name:"Hebrew (Israel)"}]},{label:"Thai",locales:[{code:"th-TH",name:"Thai (Thailand)"}]},{label:"Polish",locales:[{code:"pl-PL",name:"Polish (Poland)"}]},{label:"Greek",locales:[{code:"el-GR",name:"Greek (Greece)"}]},{label:"Norwegian",locales:[{code:"no-NO",name:"Norwegian (Norway)"}]}],CE=["lg","md","sm","xs","xxs"],Jg={default:{dashboardPanel:"",dashboardTabsContainer:"",gridLayout:{className:""},chart:{font:{family:"Open Sans, Arial, sans-serif"},dataset:{backgroundColor:[Mt.teal[500],Mt.teal[300],Mt.gray[700],Mt.gray[500],Mt.gray[300]],borderColor:[Mt.teal[500],Mt.teal[300],Mt.gray[700],Mt.gray[500],Mt.gray[300]]},options:{interaction:{mode:"index"},plugins:{datalabels:{display:!1,color:x1},title:{display:!0},tooltip:{backgroundColor:"#fff",bodyColor:"#000",borderWidth:.25,titleColor:"#000",borderColor:"rgb(128,131,139)",cornerRadius:4,usePointStyle:!0,pointStyle:"rectRounded",boxPadding:4},legend:{position:"top",align:"center",maxHeight:0,labels:{useBorderRadius:!0,borderRadius:2}}},scales:{y:{grid:{display:!0},title:{display:!0,text:""},beginAtZero:!0,ticks:{precision:0}},x:{grid:{display:!0},title:{display:!0}}},layout:{padding:{top:-40}},borderRadius:2,responsive:!0,maintainAspectRatio:!1}}},dark:{chart:{dataset:{datalables:{color:x1},backgroundColor:[Mt.teal[500],Mt.teal[300],Mt.gray[700],Mt.gray[500],Mt.gray[300]],borderColor:[Mt.teal[500],Mt.teal[300],Mt.gray[700],Mt.gray[500],Mt.gray[300]]},options:{plugins:{tooltip:{backgroundColor:"#000",bodyColor:"#fff",borderWidth:.25,titleColor:"#fff",borderColor:"rgb(128,131,139)",cornerRadius:2,boxPadding:4}},datalabels:{display:!1},scales:{x:{grid:{display:!0,color:Mt.slate[800]}},y:{grid:{display:!0,color:Mt.slate[800]}}}}}}};function x1(e){var r,o,i,s,a,l;const t=(a=(s=(i=(o=(r=e==null?void 0:e.chart)==null?void 0:r.config)==null?void 0:o._config)==null?void 0:i.options)==null?void 0:s.plugins)==null?void 0:a.datalabels;let n=(l=e==null?void 0:e.dataset)==null?void 0:l.backgroundColor;return(t==null?void 0:t.align)==="end"&&(t==null?void 0:t.anchor)==="end"&&(n=Zf()),(t==null?void 0:t.align)==="start"&&(t==null?void 0:t.anchor)==="start"&&(n=Zf()),Au(n)}function Zf(){return oe.getState().theme==="dark"?"#000000":"#FFFFFF"}function Au(e){let t=0,n=0,r=0,o=0;const i=u=>{if(!u)return Mt.gray[500];const d=u.replace("#",""),h=parseInt(d.substring(0,2),16),p=parseInt(d.substring(2,4),16),g=parseInt(d.substring(4,6),16);t+=h,n+=p,r+=g,o++};Array.isArray(e)?e.forEach(u=>{i(u)}):i(e);const s=t/o,a=n/o,l=r/o;return(s*299+a*587+l*114)/1e3>=180?"black":"white"}const EY=["text","nullable(string)","name","enum","varchar","nvarchar","nvarchar2","char","character","longtext","nchar","char varying","nchar varying","character varying","string"],_Y=["number","integer","int","int64","bigint","smallint","tinyint","byteint","numeric","decimal","dec","double","real","double precision","float","float4","float8","float64"],RY=["date","datetime","time","timestamp","timestamp without time zone","timestamp_ns"],kY=["boolean"];function SE(e){return e.match(/[A-Z]/)?`"${e}"`:e}function D0(e){return EY.includes(e.toLowerCase())||/varchar/i.test(e)}function ep(e){return _Y.includes(e.toLowerCase())||/int|decimal|float|double/i.test(e)}function ic(e){return RY.includes(e.toLowerCase())||/date|time|timestamp/i.test(e)}function EE(e){return kY.includes(e.toLowerCase())||/boolean/i.test(e)}function NY(e,t,n,r,o,i){const{measures:s,dimensions:a}=e,l=s==null?void 0:s.map(h=>`${h.calc}(${h.name}) as ${h.calc}_${h.name.replace(/"/g,"")}`).join(", "),c=(a==null?void 0:a.join(", "))||"";let u="";const d=r?`${Zg}.${r}`:_E({schemaName:t,tableName:n,connectionType:o,databaseName:i});if(l&&c)return u=`SELECT ${c}, COUNT(*) as count, ${l} FROM ${d} GROUP BY ${c} ORDER BY ${c} DESC LIMIT 100`,u;if(!l&&c)return u=`SELECT ${c}, COUNT(*) as count FROM ${d} GROUP BY ${c} ORDER BY ${c} DESC LIMIT 100`,u;if(l&&!c)return u=`SELECT ${l} FROM ${d} LIMIT 100`,u}function MY(e,t,n="AVG"){var i,s,a,l;let r={};const o=SE(e.column_name);return D0(e.data_type)&&(((i=t.dimensions)==null?void 0:i.includes(o))?r={...t,dimensions:(s=t.dimensions)==null?void 0:s.filter(u=>u!==o)}:r={...t,dimensions:[...t.dimensions||[],o]}),ep(e.data_type)&&(((a=t.measures)==null?void 0:a.some(u=>u.name===o&&u.calc===n))?r={...t,measures:(l=t.measures)==null?void 0:l.filter(u=>!(u.name===o&&u.calc===n))}:r={...t,measures:[...t.measures||[],{name:o,calc:n||"SUM"}]}),r}function nu(e){return D0(e.dataType)?"string":ep(e.dataType)?"number":ic(e.dataType)?"date":EE(e.dataType)?"boolean":"string"}function PY(e){let t;const n=e.data_type.toLowerCase();return D0(n)?t="T":ep(n)?t="#":ic(n)?t="D":EE(n)?t="B":t="?",t}function DY(e,t){const{dimensions:n,measures:r}=t,o=n==null?void 0:n.includes(e.column_name),i=r==null?void 0:r.some(s=>s.name===e.column_name);return o||i}function sO(e){return e?e!=null&&e.startsWith(`${Zg}.`)?e:`${Zg}.${e}`:""}function aO({schemaName:e,tableName:t,modelName:n,connectionType:r,databaseName:o}){let i=_E({schemaName:e,tableName:t,connectionType:r,databaseName:o});n&&(i=sO(n));let s=i;return(l=>/[A-Z]/.test(l))(t)&&(s=s.split(".").map(c=>`"${c}"`).join(".")),s}function _E({schemaName:e,tableName:t,connectionType:n,databaseName:r}){return t==="api"||e===SE("NA")||n==="S3"||n==="API"?t:n==="S3Tables"?`${r}.${e}.${t}`:e?`${e}.${t}`:`${t}`}const AY=e=>{const t=new Date(e);return!isNaN(t.getTime())},IY=e=>!isNaN(Number(e))&&!isNaN(parseFloat(e)),A0=e=>{let t;return typeof e=="number"?t="number":typeof e=="string"?AY(e)?t="date":IY(e)?t="number":t="string":typeof e=="boolean"?t="boolean":e instanceof Date?t="date":t="unknown",t};function TY({get:e,dataPoint:t,card:n}){var h;const{addOrUpdateFilterValue:r,addFilteringCard:o,removeFilterValues:i,replaceFilterValue:s,removeFilteringCard:a}=e().actions,l=e().filteringCards,{columnName:c,columnValue:u}=t,d={filterId:n.id,connectionId:n==null?void 0:n.connectionId,tableName:n.lastSelectedTable,name:c,expression:(h=n.preferences)==null?void 0:h.filterOnClickField,valueType:A0(u),operation:"=",values:[u]};if(l!=null&&l.find(p=>p.id===n.id)){const p=n.id;if(u==null){a(n),i(p);return}else s(d)}o(n),r(d)}function HN({id:e,layouts:t,initialHeight:n,y:r,x:o,w:i,minH:s}){const a={i:e,x:o??0,y:r??1/0,w:i||20,h:n||35,minW:6,minH:s||10},l=t?{...t}:{};return CE.forEach(c=>{l[c]||(l[c]=[]);const u=l[c].reduce((d,h)=>Math.max(d,h.y+h.h),0);a.y=a.y===1/0?u:a.y,l[c].push({...a})}),l}function WN(e,t){if(!t)return;const n={...t};return CE.forEach(r=>{n[r]&&(n[r]=n[r].filter(o=>o.i!==e))}),n}function lO(e){const t=oe.getState().dashboard.globalCacheConfig,{card:n,filter:r}=e;return t}const oe=Es()(Jh((e,t)=>({isSessionExpired:!1,currentBreakpoint:"lg",dashboard:{id:"",style:Jg},showContext:!1,selectedSheetId:null,selectedCardId:null,selectedFrameId:null,selectedCard:null,showFilters:!1,isDashboardEditing:!1,isVisualEditing:!1,showDashboardJSON:!1,filteringCards:[],isDashboardPanelOpen:!1,actions:{setInitStore:()=>{e(n=>{n.isSessionExpired=!1,n.currentBreakpoint="lg",n.dashboard={id:"",style:Jg},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})},setAiContext:n=>{e(r=>{r.dashboard.aiContext=n})},setHandleOpenAssistantProfile:n=>{e(r=>{r.handleOpenAssistantProfile=n})},setFilterMode:(n,r)=>{const o=r==="exclude"?"not in":"in";e(i=>{var a,l,c;const s=(a=i.dashboard.filters)==null?void 0:a.find(u=>u.id===n);s&&(s.operation=o,i.dashboard.filters=(l=i.dashboard.filters)==null?void 0:l.map(u=>u.id===n?s:u),i.filterValues&&i.filterValues.length>0&&(i.filterValues=(c=i.filterValues)==null?void 0:c.map(u=>u.filterId===n?{...u,operation:o}:u)))})},updateEmailSettings:n=>{e(r=>{r.dashboard.emailSettings=n})},setDefaultFilterValues:n=>{e(r=>{r.dashboard.defaultFilterValues=n})},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 i,s,a,l,c,u,d,h;const o=(i=r.dashboard.sheets)==null?void 0:i.findIndex(p=>p.id===n);if(o!==void 0&&o>-1){(s=r.dashboard.sheets)==null||s.splice(o,1);const p=(a=r.dashboard.filters)==null?void 0:a.filter(m=>m.sheetId===n),g=(l=r.filterValues)==null?void 0:l.filter(m=>p==null?void 0:p.some(b=>b.id===m.filterId));r.filterValues=(c=r.filterValues)==null?void 0:c.filter(m=>!(g!=null&&g.some(b=>b.filterId===m.filterId))),r.dashboard.filters=(u=r.dashboard.filters)==null?void 0:u.filter(m=>m.sheetId!==n),r.selectedSheetId=(h=(d=r.dashboard.sheets)==null?void 0:d[0])==null?void 0:h.id}})},addSheet:n=>{e(r=>{r.dashboard.sheets||(r.dashboard.sheets=[]);const o=r.dashboard.filters;let i={};o==null||o.forEach(a=>{CE.forEach(l=>{i!=null&&i[l]||(i={...i,[l]:[]});const c={i:a.id,x:0,y:0,w:10,h:8};i[l].push(c)})});const s={...n,layouts:i};r.dashboard.sheets.push(s)})},setGlobalStyle:n=>{e(r=>{r.dashboard.globalStyle=n})},setAIScopeTables:n=>{e(r=>{r.dashboard.aiScopeTables=n})},addToAIScope:n=>{e(r=>{const{connectionId:o,connectionType:i,databaseName:s,schemaName:a,tableName:l,datamodelName:c,datamodelId:u}=n,d={connectionId:o||"",connectionType:i||"",databaseName:s||"",schemaName:a||"",tableName:l||"",datamodelName:c||"",datamodelId:u||""};let p=[...r.dashboard.aiScopeTables||[],d];p=p.filter((g,m,b)=>b.findIndex(y=>y.tableName===g.tableName&&y.datamodelName===g.datamodelName)===m),r.dashboard.aiScopeTables=p})},removeFromAIScope:n=>{e(r=>{const{connectionId:o,tableName:i,datamodelName:s}=n,a=r.dashboard.aiScopeTables||[];if(s){const l=a.filter(c=>!(c.datamodelName===s&&c.connectionId===o));r.dashboard.aiScopeTables=l}else if(i){const l=a.filter(c=>!(c.tableName===i&&c.connectionId===o));r.dashboard.aiScopeTables=l}})},setIsSessionExpired:n=>{e(()=>({isSessionExpired:n}))},setCardPython:(n,r)=>{e(o=>{var s,a,l;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(c=>c.id===o.selectedSheetId);i&&((l=i==null?void 0:i.frames)==null||l.forEach(c=>{var d;const u=(d=c.cards)==null?void 0:d.find(h=>h.id===n);u&&(u.python=r)}))})},addBaseQuery:n=>{e(r=>{var o;r.dashboard.baseQueries||(r.dashboard.baseQueries=[]),(o=r.dashboard.baseQueries)==null||o.push(n)})},removeBaseQuery:n=>{e(r=>{var i,s;const o=(i=r.dashboard.baseQueries)==null?void 0:i.findIndex(a=>a.id===n);o!=null&&o>-1&&((s=r.dashboard.baseQueries)==null||s.splice(o,1))})},setBaseQueries:n=>{e(r=>{r.dashboard.baseQueries=n})},setCurrentBreakpoint:n=>{e(()=>({currentBreakpoint:n}))},setFilteringCards:n=>{e(()=>({filteringCards:n}))},addFilteringCard:n=>{e(r=>{var o;(o=r.filteringCards)==null||o.push(n)})},removeFilteringCard:n=>{e(r=>{var i,s;const o=(i=r.filteringCards)==null?void 0:i.findIndex(a=>a.id===n.id);o!==void 0&&o>-1&&((s=r.filteringCards)==null||s.splice(o,1))})},setCustomCards:n=>{e(r=>{r.dashboard.customCards=n})},setAuthToken:n=>{e(()=>({authToken:n}))},setThemeStyle:n=>{e(()=>({themeStyle:n}))},setDashboard:n=>e({dashboard:n}),setDashboardWithFilterValues:(n,r)=>{e(o=>{o.dashboard=n,o.filterValues=r})},setDashboardTheme:n=>{e(r=>{r.theme=n})},setSheets:n=>{e(r=>{r.dashboard&&(r.dashboard.sheets=n)})},setSheetTitle:(n,r)=>{e(o=>{var s,a;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);i&&(i.title=r)})},setCardTitle:(n,r,o)=>{e(i=>{var a,l,c;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(u=>u.id===n);s&&((c=s==null?void 0:s.frames)==null||c.forEach(u=>{var h;const d=(h=u.cards)==null?void 0:h.find(p=>p.id===r);d&&(d.title=o)}))})},setCardInfo:(n,r)=>{e(o=>{var s,a,l;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(c=>c.id===o.selectedSheetId);i&&((l=i==null?void 0:i.frames)==null||l.forEach(c=>{var d;const u=(d=c.cards)==null?void 0:d.find(h=>h.id===n);u&&(u.info=r)}))})},setCardDescription:(n,r,o)=>{e(i=>{var a,l,c;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(u=>u.id===n);s&&((c=s==null?void 0:s.frames)==null||c.forEach(u=>{var h;const d=(h=u.cards)==null?void 0:h.find(p=>p.id===r);d&&(d.description=o)}))})},setCardSql:(n,r,o)=>{e(i=>{var a,l,c,u;const s=(l=(a=i.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(h=>h.id===r);d&&(d.sql=o,(u=i.onUpdateCard)==null||u.call(i,d,n))}})},setSheetLayout:(n,r)=>{e(o=>{var s,a;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);i&&(i.layout=r)})},setSheetLayouts:(n,r)=>{e(o=>{var s,a;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(l=>l.id===n);i&&(i.layouts=r)})},setShowContext:n=>{e(()=>({showContext:n}))},setShowFilters:n=>{e(()=>({showFilters:n}))},setFilterValues:n=>{e(()=>({filterValues:n}))},addOrUpdateFilterValue:n=>{e(r=>{if(r.filterValues){const o=r.filterValues.findIndex(i=>i.filterId===n.filterId);o>-1?r.filterValues.splice(o,1,n):r.filterValues.push(n)}else r.filterValues=[n]})},addOrUpdateFilterValues:n=>{e(r=>{r.filterValues?n.forEach(o=>{var s,a,l,c;const i=(s=r==null?void 0:r.filterValues)==null?void 0:s.findIndex(u=>u.filterId===o.filterId);if(o.values.length===0){r.filterValues=(a=r.filterValues)==null?void 0:a.filter(u=>u.filterId!==o.filterId);return}i!==void 0&&i>-1?(l=r.filterValues)==null||l.splice(i,1,o):(c=r.filterValues)==null||c.push(o)}):r.filterValues=n})},removeFilterValues:n=>{e(r=>{if(r.filterValues){const o=r.filterValues.filter(i=>i.filterId!==n&&!i.filterId.startsWith(n));r.filterValues=o}})},replaceFilterValue:n=>{e(r=>{if(r.filterValues){const o=r.filterValues.findIndex(i=>i.filterId===n.filterId);o>-1&&r.filterValues.splice(o,1,n)}})},addFilter:n=>{e(r=>{var i,s;r.dashboard.filters?(i=r.dashboard.filters)==null||i.push(n):r.dashboard.filters=[n],(s=r.dashboard.sheets)==null||s.find(a=>a.id===r.selectedSheetId);const o=r.dashboard.sheets;o==null||o.forEach(a=>{HN({id:n.id,layouts:a.layouts,y:0,initialHeight:8,minH:7,w:10})})})},removeFilter:n=>{e(r=>{var o,i,s;if(r.dashboard.filters){const a=(o=r.dashboard.filters)==null?void 0:o.findIndex(l=>l.id===n);if(a>-1){(i=r.dashboard.filters)==null||i.splice(a,1),(s=r.dashboard.sheets)==null||s.find(c=>c.id===r.selectedSheetId);const l=r.dashboard.sheets;l==null||l.forEach(c=>{const u=WN(n,c.layouts);c.layouts=u})}}})},updateCurrentDashboardCard:n=>{e(r=>{var a,l,c,u,d;const o=(l=(a=r.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(h=>h.id===r.selectedSheetId),i=(c=o==null?void 0:o.frames)==null?void 0:c.find(h=>h.id===r.selectedFrameId),s=(u=i==null?void 0:i.cards)==null?void 0:u.findIndex(h=>h.id===n.id);typeof s=="number"&&s>=0&&((d=i==null?void 0:i.cards)==null||d.splice(s,1,n))})},updateFrameCard:(n,r,o)=>{e(i=>{var l,c,u,d,h;const s=(c=(l=i.dashboard)==null?void 0:l.sheets)==null?void 0:c.find(p=>p.id===n);if(!s)return;const a=(u=s==null?void 0:s.frames)==null?void 0:u.find(p=>p.id===r);if(a){const p=(d=a.cards)==null?void 0:d.findIndex(g=>g.id===o.id);p>-1&&((h=a.cards)==null||h.splice(p,1,o))}})},updateFilter:n=>{e(r=>{var o,i;if(r.dashboard.filters){const s=(o=r.dashboard.filters)==null?void 0:o.findIndex(a=>a.id===n.id);s>-1&&((i=r.dashboard.filters)==null||i.splice(s,1,n))}})},updateFilterId:(n,r)=>{e(o=>{var a,l;const i=(a=o.dashboard.filters)==null?void 0:a.find(c=>c.id===n),s=(l=o.dashboard.filters)==null?void 0:l.some(c=>c.id===r);i&&!s&&(i.id=r)})},setIsDashboardEditing:n=>{e(()=>({isDashboardEditing:n}))},setShowDashboardJSON:n=>{e(()=>({showDashboardJSON:n}))},setIsVisualEditing:n=>{e(()=>({isVisualEditing:n}))},addFrame:(n,r,o)=>{e(i=>{var a,l,c,u;const s=(l=(a=i.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(d=>d.id===n);if(s){s.frames||(s.frames=[]),(c=s.frames)==null||c.push(r);let d=1/0;const h=0;o==="start"&&(d=0);const p=HN({id:r.id,layouts:s.layouts,minH:10,x:h,y:d});s.layouts=p,(u=i.onAddFrame)==null||u.call(i,r,n)}})},removeFrame:(n,r)=>{e(o=>{var s,a,l,c,u;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(d=>d.id===n);if(i){const d=(l=i.frames)==null?void 0:l.findIndex(h=>h.id===r);console.log(d),typeof d=="number"&&d>-1&&((c=i.frames)==null||c.splice(d,1),(u=i.layout)==null||u.splice(d,1),WN(r,i.layouts))}})},updateFrame:(n,r)=>{e(o=>{var a,l,c,u,d;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(h=>h.id===n),s=(c=i==null?void 0:i.frames)==null?void 0:c.findIndex(h=>h.id===r.id);i&&((u=i.frames)==null||u.splice(s,1,r)),(d=o.onAcceptChanges)==null||d.call(o,r,o.dashboard)})},updateCard:(n,r)=>{e(o=>{var a,l,c,u,d;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(h=>h.id===n),s=(c=i==null?void 0:i.cards)==null?void 0:c.findIndex(h=>h.id===r.id);i&&((u=i.cards)==null||u.splice(s,1,r),(d=o.onUpdateCard)==null||d.call(o,r,n))})},removeCard:(n,r)=>{e(o=>{var a,l,c,u,d,h;const i=(l=(a=o.dashboard)==null?void 0:a.sheets)==null?void 0:l.find(p=>p.id===n),s=(c=i==null?void 0:i.cards)==null?void 0:c.findIndex(p=>p.id===r.id);i&&((u=i.cards)==null||u.splice(s,1),(d=i.layout)==null||d.splice(s,1),(h=o.onRemoveCard)==null||h.call(o,r,n))})},setStyle:n=>{e(r=>{r.dashboard&&(r.dashboard.style=n)})},setSelectedCardId:(n,r)=>{e(o=>{var s,a,l;const i=(a=(s=o.dashboard)==null?void 0:s.sheets)==null?void 0:a.find(c=>c.id===n);i&&(((l=i.cards)==null?void 0:l.find(u=>u.id===r))?o.selectedCardId=r:o.selectedCardId=null)})},setSelectedFrameId:n=>{e(r=>{var i,s;((s=(i=r.dashboard)==null?void 0:i.sheets)==null?void 0:s.find(a=>a.id===r.selectedSheetId))&&(r.selectedFrameId=n)})},setSelectedSheetId:n=>{e(r=>{var i,s;((s=(i=r.dashboard)==null?void 0:i.sheets)==null?void 0:s.find(a=>a.id===n))&&(r.selectedSheetId=n)})},setOnSaveFunction:n=>{e(()=>({onSaveFunction:n}))},setOnAddCard:n=>{e(()=>({onAddCard:n}))},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(o=>o.id===t().selectedSheetId)},getCardFrame:n=>{var o,i;const r=(o=t().dashboard)==null?void 0:o.sheets;if(r)for(let s=0;s<r.length;s++){const a=r[s].frames;if(a){for(let l=0;l<a.length;l++)if((i=a[l].cards)==null?void 0:i.find(u=>u.id===n))return a[l]}}},getSelectedFrame:()=>{var r,o,i;const n=(o=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:o.find(s=>s.id===t().selectedSheetId);return(i=n==null?void 0:n.frames)==null?void 0:i.find(s=>s.id===t().selectedFrameId)},getCard:n=>{var o,i;const r=(o=t().dashboard)==null?void 0:o.sheets;if(r)for(let s=0;s<r.length;s++){const a=r[s].frames;if(a)for(let l=0;l<a.length;l++){const c=(i=a[l].cards)==null?void 0:i.find(u=>u.id===n);if(c)return c}}},getSelectedSheetLayout:()=>{var r,o;const n=(o=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:o.find(i=>i.id===t().selectedSheetId);return n==null?void 0:n.layout},getSelectedSheetLayouts:()=>{var r,o;const n=(o=(r=t().dashboard)==null?void 0:r.sheets)==null?void 0:o.find(i=>i.id===t().selectedSheetId);return n==null?void 0:n.layouts},getStyle:()=>{var n;return(n=t().dashboard)==null?void 0:n.style},getCardSheet(n){var o,i;const r=(o=t().dashboard)==null?void 0:o.sheets;if(r)for(let s=0;s<r.length;s++){const a=r[s].frames;if(a){for(let l=0;l<a.length;l++)if((i=a[l].cards)==null?void 0:i.find(u=>u.id===n))return r[s]}}},handleDataPointClickAction:(n,r)=>{TY({card:n,dataPoint:r,get:t})},setIsDashboardPanelOpen:n=>{e(()=>({isDashboardPanelOpen:n}))}}}))),cO=()=>oe(t=>{var i,s,a,l,c;const n=(s=(i=t.dashboard)==null?void 0:i.sheets)==null?void 0:s.find(u=>u.id===t.selectedSheetId),r=(a=n==null?void 0:n.frames)==null?void 0:a.find(u=>u.id===t.selectedFrameId);return((l=r==null?void 0:r.cards)==null?void 0:l.find(u=>u.id===(r==null?void 0:r.activeCardId)))||((c=r==null?void 0:r.cards)==null?void 0:c[0])}),uO=()=>{var n;const e=oe(r=>{var o,i;return(i=(o=r.dashboard)==null?void 0:o.sheets)==null?void 0:i.find(s=>s.id===r.selectedSheetId)});return(((n=e==null?void 0:e.frames)==null?void 0:n.map(r=>{var o;return(o=r.cards)==null?void 0:o.find(i=>i.id===r.activeCardId)}))||[]).filter(r=>r!==void 0)},dO=()=>{var t,n,r;const e=cO();return{metricFields:((t=e==null?void 0:e.config)==null?void 0:t.metricColumns)||[],groupByFields:((n=e==null?void 0:e.config)==null?void 0:n.groupByColumns)||[],pivotByFields:((r=e==null?void 0:e.config)==null?void 0:r.pivotByColumns)||[]}},on=()=>oe(e=>e.actions);async function jY(e,t){const n=t.slice(0,16),r=new TextEncoder,o=await window.crypto.subtle.importKey("raw",r.encode(n),{name:"PBKDF2"},!1,["deriveKey"]),i=await window.crypto.subtle.deriveKey({name:"PBKDF2",salt:r.encode(n),iterations:1e5,hash:"SHA-256"},o,{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},i,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 fO(e,t){const n=t.slice(0,16),r=new TextEncoder,o=new TextDecoder,i=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"},i,{name:"AES-GCM",length:256},!1,["decrypt"]),a=Uint8Array.from(atob(e),h=>h.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 h=await window.crypto.subtle.decrypt({name:"AES-GCM",iv:l},s,d);return{decryptedData:o.decode(h)}}catch(h){throw new Error(`Decryption failed: ${h}`)}}function re(...e){return qq($l(e))}const OY=e=>Object.keys(e).length===0;async function br(e,t,n={}){try{const r=new URLSearchParams(n).toString(),o=`${e}?${r}`,i=await fetch(o,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});if(!i.ok){const a=await i.json();throw new Error((a==null?void 0:a.error)||`HTTP error! status: ${i.status}`)}return await i.json()}catch(r){throw console.error("Error during fetch:",r),r}}async function hO(e,t,n={}){try{const r=JSON.stringify(n),o=await jY(r,t),i=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(o)});if(!i.ok)return i.json().then(a=>{throw console.log(a.detail||"Unknown error occurred"),new Error((a==null?void 0:a.error)||`HTTP error! status: ${i.status}`)});const s=await i.json();if(s.payload){const a=await fO(s.payload,t);return JSON.parse(a.decryptedData)}return s}catch(r){throw console.error("Error during fetch:",r),r}}async function pO(e,t,n={},r="POST"){try{const o=await fetch(e,{method:r,headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify(n)});return o.ok?await o.json():o.json().then(s=>{throw console.log(s.detail||"Unknown error occurred"),new Error((s==null?void 0:s.error)||`HTTP error! status: ${o.status}`)})}catch(o){throw console.error("Error during fetch:",o),o}}function FY(e){if(!e)return{tenantId:"",endUserId:""};const t=Zh(e);return{tenantId:t==null?void 0:t.tenantId,endUserId:t==null?void 0:t.endUserId}}function LY(e){return e?Zh(e).assistantProfileId:void 0}function $Y(e){if(!e)return;const t=Zh(e);if(t.params&&t.params.currencyFormat)return t.params.currencyFormat}function mO(e){return e?Zh(e).params:void 0}function RE(e){return e.charAt(0).toUpperCase()+e.slice(1)}function kE(e){return e.replace(/\w\S*/g,t=>t.charAt(0).toUpperCase()+t.substring(1).toLowerCase())}function NE(e){return e.replace(/[_-]+/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\w\S*/g,t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase())}const Nr="focus:ring-1 focus:ring-offset-0 focus-visible:ring-1 focus-visible:ring-offset-0",ps="focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0 focus:ring-0 focus:ring-ring focus:ring-offset-0";async function zY(){var o,i;const e=(i=(o=oe.getState())==null?void 0:o.authToken)==null?void 0:i.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 BY(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)),o=new URLSearchParams(r).toString();o&&(n+=`?${o}`);let s=await(await fetch(n,{headers:{Authorization:`Bearer ${e}`}})).json();if("payload"in s){const a=await fO(atob(s.payload),e);s=JSON.parse(a.decryptedData)}return s}async function VY(e){return e?await(await fetch("https://semaphor.cloud/api/v1/plugins",{headers:{Authorization:`Bearer ${e}`}})).json():null}const I0=e=>/boolean/i.test(e)?"boolean":/date|timestamp/i.test(e)?"date":/int|decimal|float|double|num/i.test(e)?"number":/json/i.test(e)?"json":/geo|geography|geometry/i.test(e)?"geo":"string";var eb={exports:{}};eb.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",o=800,i=16,s=9007199254740991,a="[object Arguments]",l="[object Array]",c="[object AsyncFunction]",u="[object Boolean]",d="[object Date]",h="[object Error]",p="[object Function]",g="[object GeneratorFunction]",m="[object Map]",b="[object Number]",y="[object Null]",v="[object Object]",x="[object Proxy]",S="[object RegExp]",_="[object Set]",E="[object String]",C="[object Undefined]",k="[object WeakMap]",N="[object ArrayBuffer]",M="[object DataView]",A="[object Float32Array]",P="[object Float64Array]",j="[object Int8Array]",F="[object Int16Array]",I="[object Int32Array]",O="[object Uint8Array]",$="[object Uint8ClampedArray]",B="[object Uint16Array]",z="[object Uint32Array]",T=/[\\^$.*+?()[\]{}|]/g,W=/^\[object .+?Constructor\]$/,L=/^(?:0|[1-9]\d*)$/,D={};D[A]=D[P]=D[j]=D[F]=D[I]=D[O]=D[$]=D[B]=D[z]=!0,D[a]=D[l]=D[N]=D[u]=D[M]=D[d]=D[h]=D[p]=D[m]=D[b]=D[v]=D[S]=D[_]=D[E]=D[k]=!1;var H=typeof ls=="object"&&ls&&ls.Object===Object&&ls,V=typeof self=="object"&&self&&self.Object===Object&&self,q=H||V||Function("return this")(),U=t&&!t.nodeType&&t,Y=U&&!0&&e&&!e.nodeType&&e,K=Y&&Y.exports===U,Z=K&&H.process,ee=function(){try{var G=Y&&Y.require&&Y.require("util").types;return G||Z&&Z.binding&&Z.binding("util")}catch{}}(),Q=ee&&ee.isTypedArray;function ie(G,J,se){switch(se.length){case 0:return G.call(J);case 1:return G.call(J,se[0]);case 2:return G.call(J,se[0],se[1]);case 3:return G.call(J,se[0],se[1],se[2])}return G.apply(J,se)}function te(G,J){for(var se=-1,Ne=Array(G);++se<G;)Ne[se]=J(se);return Ne}function le(G){return function(J){return G(J)}}function ue(G,J){return G==null?void 0:G[J]}function Re(G,J){return function(se){return G(J(se))}}var be=Array.prototype,we=Function.prototype,Pe=Object.prototype,Ye=q["__core-js_shared__"],_t=we.toString,me=Pe.hasOwnProperty,je=function(){var G=/[^.]+$/.exec(Ye&&Ye.keys&&Ye.keys.IE_PROTO||"");return G?"Symbol(src)_1."+G:""}(),Ae=Pe.toString,ne=_t.call(Object),ce=RegExp("^"+_t.call(me).replace(T,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ke=K?q.Buffer:void 0,De=q.Symbol,Ue=q.Uint8Array;ke&&ke.allocUnsafe;var jt=Re(Object.getPrototypeOf,Object),kn=Object.create,gn=Pe.propertyIsEnumerable,ge=be.splice,bn=De?De.toStringTag:void 0,Ot=function(){try{var G=kv(Object,"defineProperty");return G({},"",{}),G}catch{}}(),uo=ke?ke.isBuffer:void 0,On=Math.max,Sc=Date.now,Va=kv(q,"Map"),Wi=kv(Object,"create"),an=function(){function G(){}return function(J){if(!Ua(J))return{};if(kn)return kn(J);G.prototype=J;var se=new G;return G.prototype=void 0,se}}();function Rt(G){var J=-1,se=G==null?0:G.length;for(this.clear();++J<se;){var Ne=G[J];this.set(Ne[0],Ne[1])}}function Fn(){this.__data__=Wi?Wi(null):{},this.size=0}function Ie(G){var J=this.has(G)&&delete this.__data__[G];return this.size-=J?1:0,J}function Ge(G){var J=this.__data__;if(Wi){var se=J[G];return se===r?void 0:se}return me.call(J,G)?J[G]:void 0}function rt(G){var J=this.__data__;return Wi?J[G]!==void 0:me.call(J,G)}function Jt(G,J){var se=this.__data__;return this.size+=this.has(G)?0:1,se[G]=Wi&&J===void 0?r:J,this}Rt.prototype.clear=Fn,Rt.prototype.delete=Ie,Rt.prototype.get=Ge,Rt.prototype.has=rt,Rt.prototype.set=Jt;function Ft(G){var J=-1,se=G==null?0:G.length;for(this.clear();++J<se;){var Ne=G[J];this.set(Ne[0],Ne[1])}}function Lt(){this.__data__=[],this.size=0}function Dn(G){var J=this.__data__,se=rm(J,G);if(se<0)return!1;var Ne=J.length-1;return se==Ne?J.pop():ge.call(J,se,1),--this.size,!0}function en(G){var J=this.__data__,se=rm(J,G);return se<0?void 0:J[se][1]}function yn(G){return rm(this.__data__,G)>-1}function Ha(G,J){var se=this.__data__,Ne=rm(se,G);return Ne<0?(++this.size,se.push([G,J])):se[Ne][1]=J,this}Ft.prototype.clear=Lt,Ft.prototype.delete=Dn,Ft.prototype.get=en,Ft.prototype.has=yn,Ft.prototype.set=Ha;function fo(G){var J=-1,se=G==null?0:G.length;for(this.clear();++J<se;){var Ne=G[J];this.set(Ne[0],Ne[1])}}function ri(){this.size=0,this.__data__={hash:new Rt,map:new(Va||Ft),string:new Rt}}function Wa(G){var J=im(this,G).delete(G);return this.size-=J?1:0,J}function Id(G){return im(this,G).get(G)}function kG(G){return im(this,G).has(G)}function NG(G,J){var se=im(this,G),Ne=se.size;return se.set(G,J),this.size+=se.size==Ne?0:1,this}fo.prototype.clear=ri,fo.prototype.delete=Wa,fo.prototype.get=Id,fo.prototype.has=kG,fo.prototype.set=NG;function Ec(G){var J=this.__data__=new Ft(G);this.size=J.size}function MG(){this.__data__=new Ft,this.size=0}function PG(G){var J=this.__data__,se=J.delete(G);return this.size=J.size,se}function DG(G){return this.__data__.get(G)}function AG(G){return this.__data__.has(G)}function IG(G,J){var se=this.__data__;if(se instanceof Ft){var Ne=se.__data__;if(!Va||Ne.length<n-1)return Ne.push([G,J]),this.size=++se.size,this;se=this.__data__=new fo(Ne)}return se.set(G,J),this.size=se.size,this}Ec.prototype.clear=MG,Ec.prototype.delete=PG,Ec.prototype.get=DG,Ec.prototype.has=AG,Ec.prototype.set=IG;function TG(G,J){var se=Pv(G),Ne=!se&&Mv(G),mt=!se&&!Ne&&xN(G),Bt=!se&&!Ne&&!mt&&CN(G),tn=se||Ne||mt||Bt,xt=tn?te(G.length,String):[],nn=xt.length;for(var Do in G)tn&&(Do=="length"||mt&&(Do=="offset"||Do=="parent")||Bt&&(Do=="buffer"||Do=="byteLength"||Do=="byteOffset")||yN(Do,nn))||xt.push(Do);return xt}function _v(G,J,se){(se!==void 0&&!sm(G[J],se)||se===void 0&&!(J in G))&&Rv(G,J,se)}function jG(G,J,se){var Ne=G[J];(!(me.call(G,J)&&sm(Ne,se))||se===void 0&&!(J in G))&&Rv(G,J,se)}function rm(G,J){for(var se=G.length;se--;)if(sm(G[se][0],J))return se;return-1}function Rv(G,J,se){J=="__proto__"&&Ot?Ot(G,J,{configurable:!0,enumerable:!0,value:se,writable:!0}):G[J]=se}var OG=KG();function om(G){return G==null?G===void 0?C:y:bn&&bn in Object(G)?XG(G):nq(G)}function gN(G){return Td(G)&&om(G)==a}function FG(G){if(!Ua(G)||eq(G))return!1;var J=Av(G)?ce:W;return J.test(sq(G))}function LG(G){return Td(G)&&wN(G.length)&&!!D[om(G)]}function $G(G){if(!Ua(G))return tq(G);var J=vN(G),se=[];for(var Ne in G)Ne=="constructor"&&(J||!me.call(G,Ne))||se.push(Ne);return se}function bN(G,J,se,Ne,mt){G!==J&&OG(J,function(Bt,tn){if(mt||(mt=new Ec),Ua(Bt))zG(G,J,tn,se,bN,Ne,mt);else{var xt=Ne?Ne(Nv(G,tn),Bt,tn+"",G,J,mt):void 0;xt===void 0&&(xt=Bt),_v(G,tn,xt)}},SN)}function zG(G,J,se,Ne,mt,Bt,tn){var xt=Nv(G,se),nn=Nv(J,se),Do=tn.get(nn);if(Do){_v(G,se,Do);return}var Ur=Bt?Bt(xt,nn,se+"",G,J,tn):void 0,jd=Ur===void 0;if(jd){var Iv=Pv(nn),Tv=!Iv&&xN(nn),_N=!Iv&&!Tv&&CN(nn);Ur=nn,Iv||Tv||_N?Pv(xt)?Ur=xt:aq(xt)?Ur=GG(xt):Tv?(jd=!1,Ur=HG(nn)):_N?(jd=!1,Ur=UG(nn)):Ur=[]:lq(nn)||Mv(nn)?(Ur=xt,Mv(xt)?Ur=cq(xt):(!Ua(xt)||Av(xt))&&(Ur=QG(nn))):jd=!1}jd&&(tn.set(nn,Ur),mt(Ur,nn,Ne,Bt,tn),tn.delete(nn)),_v(G,se,Ur)}function BG(G,J){return oq(rq(G,J,EN),G+"")}var VG=Ot?function(G,J){return Ot(G,"toString",{configurable:!0,enumerable:!1,value:dq(J),writable:!0})}:EN;function HG(G,J){return G.slice()}function WG(G){var J=new G.constructor(G.byteLength);return new Ue(J).set(new Ue(G)),J}function UG(G,J){var se=WG(G.buffer);return new G.constructor(se,G.byteOffset,G.length)}function GG(G,J){var se=-1,Ne=G.length;for(J||(J=Array(Ne));++se<Ne;)J[se]=G[se];return J}function qG(G,J,se,Ne){var mt=!se;se||(se={});for(var Bt=-1,tn=J.length;++Bt<tn;){var xt=J[Bt],nn=void 0;nn===void 0&&(nn=G[xt]),mt?Rv(se,xt,nn):jG(se,xt,nn)}return se}function YG(G){return BG(function(J,se){var Ne=-1,mt=se.length,Bt=mt>1?se[mt-1]:void 0,tn=mt>2?se[2]:void 0;for(Bt=G.length>3&&typeof Bt=="function"?(mt--,Bt):void 0,tn&&ZG(se[0],se[1],tn)&&(Bt=mt<3?void 0:Bt,mt=1),J=Object(J);++Ne<mt;){var xt=se[Ne];xt&&G(J,xt,Ne,Bt)}return J})}function KG(G){return function(J,se,Ne){for(var mt=-1,Bt=Object(J),tn=Ne(J),xt=tn.length;xt--;){var nn=tn[++mt];if(se(Bt[nn],nn,Bt)===!1)break}return J}}function im(G,J){var se=G.__data__;return JG(J)?se[typeof J=="string"?"string":"hash"]:se.map}function kv(G,J){var se=ue(G,J);return FG(se)?se:void 0}function XG(G){var J=me.call(G,bn),se=G[bn];try{G[bn]=void 0;var Ne=!0}catch{}var mt=Ae.call(G);return Ne&&(J?G[bn]=se:delete G[bn]),mt}function QG(G){return typeof G.constructor=="function"&&!vN(G)?an(jt(G)):{}}function yN(G,J){var se=typeof G;return J=J??s,!!J&&(se=="number"||se!="symbol"&&L.test(G))&&G>-1&&G%1==0&&G<J}function ZG(G,J,se){if(!Ua(se))return!1;var Ne=typeof J;return(Ne=="number"?Dv(se)&&yN(J,se.length):Ne=="string"&&J in se)?sm(se[J],G):!1}function JG(G){var J=typeof G;return J=="string"||J=="number"||J=="symbol"||J=="boolean"?G!=="__proto__":G===null}function eq(G){return!!je&&je in G}function vN(G){var J=G&&G.constructor,se=typeof J=="function"&&J.prototype||Pe;return G===se}function tq(G){var J=[];if(G!=null)for(var se in Object(G))J.push(se);return J}function nq(G){return Ae.call(G)}function rq(G,J,se){return J=On(J===void 0?G.length-1:J,0),function(){for(var Ne=arguments,mt=-1,Bt=On(Ne.length-J,0),tn=Array(Bt);++mt<Bt;)tn[mt]=Ne[J+mt];mt=-1;for(var xt=Array(J+1);++mt<J;)xt[mt]=Ne[mt];return xt[J]=se(tn),ie(G,this,xt)}}function Nv(G,J){if(!(J==="constructor"&&typeof G[J]=="function")&&J!="__proto__")return G[J]}var oq=iq(VG);function iq(G){var J=0,se=0;return function(){var Ne=Sc(),mt=i-(Ne-se);if(se=Ne,mt>0){if(++J>=o)return arguments[0]}else J=0;return G.apply(void 0,arguments)}}function sq(G){if(G!=null){try{return _t.call(G)}catch{}try{return G+""}catch{}}return""}function sm(G,J){return G===J||G!==G&&J!==J}var Mv=gN(function(){return arguments}())?gN:function(G){return Td(G)&&me.call(G,"callee")&&!gn.call(G,"callee")},Pv=Array.isArray;function Dv(G){return G!=null&&wN(G.length)&&!Av(G)}function aq(G){return Td(G)&&Dv(G)}var xN=uo||fq;function Av(G){if(!Ua(G))return!1;var J=om(G);return J==p||J==g||J==c||J==x}function wN(G){return typeof G=="number"&&G>-1&&G%1==0&&G<=s}function Ua(G){var J=typeof G;return G!=null&&(J=="object"||J=="function")}function Td(G){return G!=null&&typeof G=="object"}function lq(G){if(!Td(G)||om(G)!=v)return!1;var J=jt(G);if(J===null)return!0;var se=me.call(J,"constructor")&&J.constructor;return typeof se=="function"&&se instanceof se&&_t.call(se)==ne}var CN=Q?le(Q):LG;function cq(G){return qG(G,SN(G))}function SN(G){return Dv(G)?TG(G):$G(G)}var uq=YG(function(G,J,se){bN(G,J,se)});function dq(G){return function(){return G}}function EN(G){return G}function fq(){return!1}e.exports=uq})(eb,eb.exports);var HY=eb.exports;const Jf=Pa(HY),WY={theme:"system",setTheme:()=>null},gO=R.createContext(WY);function UY({children:e,defaultTheme:t="system",storageKey:n="vite-ui-theme",...r}){const[o,i]=R.useState(()=>localStorage.getItem(n)||t);R.useEffect(()=>{const a=window.document.documentElement;if(a.classList.remove("light","dark"),o==="system"){const l=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";a.classList.add(l);return}a.classList.add(o)},[o]);const s={theme:o,setTheme:a=>{localStorage.setItem(n,a),i(a)}};return f.jsx(gO.Provider,{...r,value:s,children:e})}const bO=()=>{const e=R.useContext(gO);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e};var sc=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(){}},Vl=typeof window>"u"||"Deno"in globalThis;function bo(){}function GY(e,t){return typeof e=="function"?e(t):e}function w1(e){return typeof e=="number"&&e>=0&&e!==1/0}function yO(e,t){return Math.max(e+(t||0)-Date.now(),0)}function ru(e,t){return typeof e=="function"?e(t):e}function Fo(e,t){return typeof e=="function"?e(t):e}function UN(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==ME(s,t.options))return!1}else if(!eh(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||o&&o!==t.state.fetchStatus||i&&!i(t))}function GN(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Iu(t.options.mutationKey)!==Iu(i))return!1}else if(!eh(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function ME(e,t){return((t==null?void 0:t.queryKeyHashFn)||Iu)(e)}function Iu(e){return JSON.stringify(e,(t,n)=>C1(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function eh(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!eh(e[n],t[n])):!1}function tb(e,t){if(e===t)return e;const n=qN(e)&&qN(t);if(n||C1(e)&&C1(t)){const r=n?e:Object.keys(e),o=r.length,i=n?t:Object.keys(t),s=i.length,a=n?[]:{};let l=0;for(let c=0;c<s;c++){const u=n?c:i[c];(!n&&r.includes(u)||n)&&e[u]===void 0&&t[u]===void 0?(a[u]=void 0,l++):(a[u]=tb(e[u],t[u]),a[u]===e[u]&&e[u]!==void 0&&l++)}return o===s&&l===o?e:a}return t}function nb(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 qN(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function C1(e){if(!YN(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!YN(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function YN(e){return Object.prototype.toString.call(e)==="[object Object]"}function qY(e){return new Promise(t=>{setTimeout(t,e)})}function S1(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 tb(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 tb(e,t)}return t}function YY(e){return e}function KY(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function XY(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var rb=Symbol();function vO(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===rb&&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===rb?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var gl,Gs,mu,Ij,QY=(Ij=class extends sc{constructor(){super();Me(this,gl);Me(this,Gs);Me(this,mu);xe(this,mu,t=>{if(!Vl&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){X(this,Gs)||this.setEventListener(X(this,mu))}onUnsubscribe(){var t;this.hasListeners()||((t=X(this,Gs))==null||t.call(this),xe(this,Gs,void 0))}setEventListener(t){var n;xe(this,mu,t),(n=X(this,Gs))==null||n.call(this),xe(this,Gs,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){X(this,gl)!==t&&(xe(this,gl,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof X(this,gl)=="boolean"?X(this,gl):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},gl=new WeakMap,Gs=new WeakMap,mu=new WeakMap,Ij),PE=new QY,gu,qs,bu,Tj,ZY=(Tj=class extends sc{constructor(){super();Me(this,gu,!0);Me(this,qs);Me(this,bu);xe(this,bu,t=>{if(!Vl&&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(){X(this,qs)||this.setEventListener(X(this,bu))}onUnsubscribe(){var t;this.hasListeners()||((t=X(this,qs))==null||t.call(this),xe(this,qs,void 0))}setEventListener(t){var n;xe(this,bu,t),(n=X(this,qs))==null||n.call(this),xe(this,qs,t(this.setOnline.bind(this)))}setOnline(t){X(this,gu)!==t&&(xe(this,gu,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return X(this,gu)}},gu=new WeakMap,qs=new WeakMap,bu=new WeakMap,Tj),ob=new ZY;function E1(){let e,t;const n=new Promise((o,i)=>{e=o,t=i});n.status="pending",n.catch(()=>{});function r(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},n.reject=o=>{r({status:"rejected",reason:o}),t(o)},n}function JY(e){return Math.min(1e3*2**e,3e4)}function xO(e){return(e??"online")==="online"?ob.isOnline():!0}var wO=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Wv(e){return e instanceof wO}function CO(e){let t=!1,n=0,r=!1,o;const i=E1(),s=m=>{var b;r||(h(new wO(m)),(b=e.abort)==null||b.call(e))},a=()=>{t=!0},l=()=>{t=!1},c=()=>PE.isFocused()&&(e.networkMode==="always"||ob.isOnline())&&e.canRun(),u=()=>xO(e.networkMode)&&e.canRun(),d=m=>{var b;r||(r=!0,(b=e.onSuccess)==null||b.call(e,m),o==null||o(),i.resolve(m))},h=m=>{var b;r||(r=!0,(b=e.onError)==null||b.call(e,m),o==null||o(),i.reject(m))},p=()=>new Promise(m=>{var b;o=y=>{(r||c())&&m(y)},(b=e.onPause)==null||b.call(e)}).then(()=>{var m;o=void 0,r||(m=e.onContinue)==null||m.call(e)}),g=()=>{if(r)return;let m;const b=n===0?e.initialPromise:void 0;try{m=b??e.fn()}catch(y){m=Promise.reject(y)}Promise.resolve(m).then(d).catch(y=>{var E;if(r)return;const v=e.retry??(Vl?0:3),x=e.retryDelay??JY,S=typeof x=="function"?x(n,y):x,_=v===!0||typeof v=="number"&&n<v||typeof v=="function"&&v(n,y);if(t||!_){h(y);return}n++,(E=e.onFail)==null||E.call(e,n,y),qY(S).then(()=>c()?void 0:p()).then(()=>{t?h(y):g()})})};return{promise:i,cancel:s,continue:()=>(o==null||o(),i),cancelRetry:a,continueRetry:l,canStart:u,start:()=>(u()?g():p().then(g),i)}}function eK(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=a=>setTimeout(a,0);const i=a=>{t?e.push(a):o(()=>{n(a)})},s=()=>{const a=e;e=[],a.length&&o(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||s()}return l},batchCalls:a=>(...l)=>{i(()=>{a(...l)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{o=a}}}var pn=eK(),bl,jj,SO=(jj=class{constructor(){Me(this,bl)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),w1(this.gcTime)&&xe(this,bl,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Vl?1/0:5*60*1e3))}clearGcTimeout(){X(this,bl)&&(clearTimeout(X(this,bl)),xe(this,bl,void 0))}},bl=new WeakMap,jj),yu,vu,po,yl,Yn,Uh,vl,jo,Xi,Oj,tK=(Oj=class extends SO{constructor(t){super();Me(this,jo);Me(this,yu);Me(this,vu);Me(this,po);Me(this,yl);Me(this,Yn);Me(this,Uh);Me(this,vl);xe(this,vl,!1),xe(this,Uh,t.defaultOptions),this.setOptions(t.options),this.observers=[],xe(this,yl,t.client),xe(this,po,X(this,yl).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,xe(this,yu,nK(this.options)),this.state=t.state??X(this,yu),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=X(this,Yn))==null?void 0:t.promise}setOptions(t){this.options={...X(this,Uh),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&X(this,po).remove(this)}setData(t,n){const r=S1(this.state.data,t,this.options);return He(this,jo,Xi).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){He(this,jo,Xi).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=X(this,Yn))==null?void 0:r.promise;return(o=X(this,Yn))==null||o.cancel(t),n?n.then(bo).catch(bo):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(X(this,yu))}isActive(){return this.observers.some(t=>Fo(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===rb||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||!yO(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=X(this,Yn))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=X(this,Yn))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),X(this,po).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(X(this,Yn)&&(X(this,vl)?X(this,Yn).cancel({revert:!0}):X(this,Yn).cancelRetry()),this.scheduleGc()),X(this,po).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||He(this,jo,Xi).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(X(this,Yn))return X(this,Yn).continueRetry(),X(this,Yn).promise}if(t&&this.setOptions(t),!this.options.queryFn){const d=this.observers.find(h=>h.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,o=d=>{Object.defineProperty(d,"signal",{enumerable:!0,get:()=>(xe(this,vl,!0),r.signal)})},i=()=>{const d=vO(this.options,n),h={client:X(this,yl),queryKey:this.queryKey,meta:this.meta};return o(h),xe(this,vl,!1),this.options.persister?this.options.persister(d,h,this):d(h)},s={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:X(this,yl),state:this.state,fetchFn:i};o(s),(l=this.options.behavior)==null||l.onFetch(s,this),xe(this,vu,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((c=s.fetchOptions)==null?void 0:c.meta))&&He(this,jo,Xi).call(this,{type:"fetch",meta:(u=s.fetchOptions)==null?void 0:u.meta});const a=d=>{var h,p,g,m;Wv(d)&&d.silent||He(this,jo,Xi).call(this,{type:"error",error:d}),Wv(d)||((p=(h=X(this,po).config).onError)==null||p.call(h,d,this),(m=(g=X(this,po).config).onSettled)==null||m.call(g,this.state.data,d,this)),this.scheduleGc()};return xe(this,Yn,CO({initialPromise:n==null?void 0:n.initialPromise,fn:s.fetchFn,abort:r.abort.bind(r),onSuccess:d=>{var h,p,g,m;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(b){a(b);return}(p=(h=X(this,po).config).onSuccess)==null||p.call(h,d,this),(m=(g=X(this,po).config).onSettled)==null||m.call(g,d,this.state.error,this),this.scheduleGc()},onError:a,onFail:(d,h)=>{He(this,jo,Xi).call(this,{type:"failed",failureCount:d,error:h})},onPause:()=>{He(this,jo,Xi).call(this,{type:"pause"})},onContinue:()=>{He(this,jo,Xi).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),X(this,Yn).start()}},yu=new WeakMap,vu=new WeakMap,po=new WeakMap,yl=new WeakMap,Yn=new WeakMap,Uh=new WeakMap,vl=new WeakMap,jo=new WeakSet,Xi=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,...EO(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 o=t.error;return Wv(o)&&o.revert&&X(this,vu)?{...X(this,vu),fetchStatus:"idle"}:{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),pn.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),X(this,po).notify({query:this,type:"updated",action:t})})},Oj);function EO(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:xO(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function nK(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 ai,Fj,_O=(Fj=class extends sc{constructor(t={}){super();Me(this,ai);this.config=t,xe(this,ai,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??ME(o,n);let s=this.get(i);return s||(s=new tK({client:t,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){X(this,ai).has(t.queryHash)||(X(this,ai).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=X(this,ai).get(t.queryHash);n&&(t.destroy(),n===t&&X(this,ai).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){pn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return X(this,ai).get(t)}getAll(){return[...X(this,ai).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>UN(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>UN(t,r)):n}notify(t){pn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){pn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){pn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},ai=new WeakMap,Fj),li,cr,xl,ci,$s,Lj,rK=(Lj=class extends SO{constructor(t){super();Me(this,ci);Me(this,li);Me(this,cr);Me(this,xl);this.mutationId=t.mutationId,xe(this,cr,t.mutationCache),xe(this,li,[]),this.state=t.state||RO(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){X(this,li).includes(t)||(X(this,li).push(t),this.clearGcTimeout(),X(this,cr).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){xe(this,li,X(this,li).filter(n=>n!==t)),this.scheduleGc(),X(this,cr).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){X(this,li).length||(this.state.status==="pending"?this.scheduleGc():X(this,cr).remove(this))}continue(){var t;return((t=X(this,xl))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,s,a,l,c,u,d,h,p,g,m,b,y,v,x,S,_,E,C;xe(this,xl,CO({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(k,N)=>{He(this,ci,$s).call(this,{type:"failed",failureCount:k,error:N})},onPause:()=>{He(this,ci,$s).call(this,{type:"pause"})},onContinue:()=>{He(this,ci,$s).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>X(this,cr).canRun(this)}));const n=this.state.status==="pending",r=!X(this,xl).canStart();try{if(!n){He(this,ci,$s).call(this,{type:"pending",variables:t,isPaused:r}),await((i=(o=X(this,cr).config).onMutate)==null?void 0:i.call(o,t,this));const N=await((a=(s=this.options).onMutate)==null?void 0:a.call(s,t));N!==this.state.context&&He(this,ci,$s).call(this,{type:"pending",context:N,variables:t,isPaused:r})}const k=await X(this,xl).start();return await((c=(l=X(this,cr).config).onSuccess)==null?void 0:c.call(l,k,t,this.state.context,this)),await((d=(u=this.options).onSuccess)==null?void 0:d.call(u,k,t,this.state.context)),await((p=(h=X(this,cr).config).onSettled)==null?void 0:p.call(h,k,null,this.state.variables,this.state.context,this)),await((m=(g=this.options).onSettled)==null?void 0:m.call(g,k,null,t,this.state.context)),He(this,ci,$s).call(this,{type:"success",data:k}),k}catch(k){try{throw await((y=(b=X(this,cr).config).onError)==null?void 0:y.call(b,k,t,this.state.context,this)),await((x=(v=this.options).onError)==null?void 0:x.call(v,k,t,this.state.context)),await((_=(S=X(this,cr).config).onSettled)==null?void 0:_.call(S,void 0,k,this.state.variables,this.state.context,this)),await((C=(E=this.options).onSettled)==null?void 0:C.call(E,void 0,k,t,this.state.context)),k}finally{He(this,ci,$s).call(this,{type:"error",error:k})}}finally{X(this,cr).runNext(this)}}},li=new WeakMap,cr=new WeakMap,xl=new WeakMap,ci=new WeakSet,$s=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),pn.batch(()=>{X(this,li).forEach(r=>{r.onMutationUpdate(t)}),X(this,cr).notify({mutation:this,type:"updated",action:t})})},Lj);function RO(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ns,Oo,Gh,$j,oK=($j=class extends sc{constructor(t={}){super();Me(this,ns);Me(this,Oo);Me(this,Gh);this.config=t,xe(this,ns,new Set),xe(this,Oo,new Map),xe(this,Gh,0)}build(t,n,r){const o=new rK({mutationCache:this,mutationId:++am(this,Gh)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){X(this,ns).add(t);const n=cm(t);if(typeof n=="string"){const r=X(this,Oo).get(n);r?r.push(t):X(this,Oo).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(X(this,ns).delete(t)){const n=cm(t);if(typeof n=="string"){const r=X(this,Oo).get(n);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&X(this,Oo).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=cm(t);if(typeof n=="string"){const r=X(this,Oo).get(n),o=r==null?void 0:r.find(i=>i.state.status==="pending");return!o||o===t}else return!0}runNext(t){var r;const n=cm(t);if(typeof n=="string"){const o=(r=X(this,Oo).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){pn.batch(()=>{X(this,ns).forEach(t=>{this.notify({type:"removed",mutation:t})}),X(this,ns).clear(),X(this,Oo).clear()})}getAll(){return Array.from(X(this,ns))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>GN(n,r))}findAll(t={}){return this.getAll().filter(n=>GN(t,n))}notify(t){pn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return pn.batch(()=>Promise.all(t.map(n=>n.continue().catch(bo))))}},ns=new WeakMap,Oo=new WeakMap,Gh=new WeakMap,$j);function cm(e){var t;return(t=e.options.scope)==null?void 0:t.id}function KN(e){return{onFetch:(t,n)=>{var u,d,h,p,g;const r=t.options,o=(h=(d=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:d.fetchMore)==null?void 0:h.direction,i=((p=t.state.data)==null?void 0:p.pages)||[],s=((g=t.state.data)==null?void 0:g.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let m=!1;const b=x=>{Object.defineProperty(x,"signal",{enumerable:!0,get:()=>(t.signal.aborted?m=!0:t.signal.addEventListener("abort",()=>{m=!0}),t.signal)})},y=vO(t.options,t.fetchOptions),v=async(x,S,_)=>{if(m)return Promise.reject();if(S==null&&x.pages.length)return Promise.resolve(x);const E={client:t.client,queryKey:t.queryKey,pageParam:S,direction:_?"backward":"forward",meta:t.options.meta};b(E);const C=await y(E),{maxPages:k}=t.options,N=_?XY:KY;return{pages:N(x.pages,C,k),pageParams:N(x.pageParams,S,k)}};if(o&&i.length){const x=o==="backward",S=x?iK:XN,_={pages:i,pageParams:s},E=S(r,_);a=await v(_,E,x)}else{const x=e??i.length;do{const S=l===0?s[0]??r.initialPageParam:XN(r,a);if(l>0&&S==null)break;a=await v(a,S),l++}while(l<x)}return a};t.options.persister?t.fetchFn=()=>{var m,b;return(b=(m=t.options).persister)==null?void 0:b.call(m,c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=c}}}function XN(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 iK(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 ln,Ys,Ks,xu,wu,Xs,Cu,Su,zj,sK=(zj=class{constructor(e={}){Me(this,ln);Me(this,Ys);Me(this,Ks);Me(this,xu);Me(this,wu);Me(this,Xs);Me(this,Cu);Me(this,Su);xe(this,ln,e.queryCache||new _O),xe(this,Ys,e.mutationCache||new oK),xe(this,Ks,e.defaultOptions||{}),xe(this,xu,new Map),xe(this,wu,new Map),xe(this,Xs,0)}mount(){am(this,Xs)._++,X(this,Xs)===1&&(xe(this,Cu,PE.subscribe(async e=>{e&&(await this.resumePausedMutations(),X(this,ln).onFocus())})),xe(this,Su,ob.subscribe(async e=>{e&&(await this.resumePausedMutations(),X(this,ln).onOnline())})))}unmount(){var e,t;am(this,Xs)._--,X(this,Xs)===0&&((e=X(this,Cu))==null||e.call(this),xe(this,Cu,void 0),(t=X(this,Su))==null||t.call(this),xe(this,Su,void 0))}isFetching(e){return X(this,ln).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return X(this,Ys).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=X(this,ln).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=X(this,ln).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(ru(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return X(this,ln).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),o=X(this,ln).get(r.queryHash),i=o==null?void 0:o.state.data,s=GY(t,i);if(s!==void 0)return X(this,ln).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return pn.batch(()=>X(this,ln).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=X(this,ln).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=X(this,ln);pn.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=X(this,ln);return pn.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=pn.batch(()=>X(this,ln).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(bo).catch(bo)}invalidateQueries(e,t={}){return pn.batch(()=>(X(this,ln).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=pn.batch(()=>X(this,ln).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(bo)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(bo)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=X(this,ln).build(this,t);return n.isStaleByTime(ru(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(bo).catch(bo)}fetchInfiniteQuery(e){return e.behavior=KN(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(bo).catch(bo)}ensureInfiniteQueryData(e){return e.behavior=KN(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return ob.isOnline()?X(this,Ys).resumePausedMutations():Promise.resolve()}getQueryCache(){return X(this,ln)}getMutationCache(){return X(this,Ys)}getDefaultOptions(){return X(this,Ks)}setDefaultOptions(e){xe(this,Ks,e)}setQueryDefaults(e,t){X(this,xu).set(Iu(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...X(this,xu).values()],n={};return t.forEach(r=>{eh(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){X(this,wu).set(Iu(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...X(this,wu).values()],n={};return t.forEach(r=>{eh(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...X(this,Ks).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=ME(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===rb&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...X(this,Ks).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){X(this,ln).clear(),X(this,Ys).clear()}},ln=new WeakMap,Ys=new WeakMap,Ks=new WeakMap,xu=new WeakMap,wu=new WeakMap,Xs=new WeakMap,Cu=new WeakMap,Su=new WeakMap,zj),Ar,ft,qh,ur,wl,Eu,Qs,ui,Yh,_u,Ru,Cl,Sl,Zs,ku,It,nf,_1,R1,k1,N1,M1,P1,D1,kO,Bj,DE=(Bj=class extends sc{constructor(t,n){super();Me(this,It);Me(this,Ar);Me(this,ft);Me(this,qh);Me(this,ur);Me(this,wl);Me(this,Eu);Me(this,Qs);Me(this,ui);Me(this,Yh);Me(this,_u);Me(this,Ru);Me(this,Cl);Me(this,Sl);Me(this,Zs);Me(this,ku,new Set);this.options=n,xe(this,Ar,t),xe(this,ui,null),xe(this,Qs,E1()),this.options.experimental_prefetchInRender||X(this,Qs).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&&(X(this,ft).addObserver(this),QN(X(this,ft),this.options)?He(this,It,nf).call(this):this.updateResult(),He(this,It,N1).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return A1(X(this,ft),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return A1(X(this,ft),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,He(this,It,M1).call(this),He(this,It,P1).call(this),X(this,ft).removeObserver(this)}setOptions(t,n){const r=this.options,o=X(this,ft);if(this.options=X(this,Ar).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Fo(this.options.enabled,X(this,ft))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");He(this,It,D1).call(this),X(this,ft).setOptions(this.options),r._defaulted&&!nb(this.options,r)&&X(this,Ar).getQueryCache().notify({type:"observerOptionsUpdated",query:X(this,ft),observer:this});const i=this.hasListeners();i&&ZN(X(this,ft),o,this.options,r)&&He(this,It,nf).call(this),this.updateResult(n),i&&(X(this,ft)!==o||Fo(this.options.enabled,X(this,ft))!==Fo(r.enabled,X(this,ft))||ru(this.options.staleTime,X(this,ft))!==ru(r.staleTime,X(this,ft)))&&He(this,It,_1).call(this);const s=He(this,It,R1).call(this);i&&(X(this,ft)!==o||Fo(this.options.enabled,X(this,ft))!==Fo(r.enabled,X(this,ft))||s!==X(this,Zs))&&He(this,It,k1).call(this,s)}getOptimisticResult(t){const n=X(this,Ar).getQueryCache().build(X(this,Ar),t),r=this.createResult(n,t);return lK(this,r)&&(xe(this,ur,r),xe(this,Eu,this.options),xe(this,wl,X(this,ft).state)),r}getCurrentResult(){return X(this,ur)}trackResult(t,n){const r={};return Object.keys(t).forEach(o=>{Object.defineProperty(r,o,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(o),n==null||n(o),t[o])})}),r}trackProp(t){X(this,ku).add(t)}getCurrentQuery(){return X(this,ft)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=X(this,Ar).defaultQueryOptions(t),r=X(this,Ar).getQueryCache().build(X(this,Ar),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return He(this,It,nf).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),X(this,ur)))}createResult(t,n){var k;const r=X(this,ft),o=this.options,i=X(this,ur),s=X(this,wl),a=X(this,Eu),c=t!==r?t.state:X(this,qh),{state:u}=t;let d={...u},h=!1,p;if(n._optimisticResults){const N=this.hasListeners(),M=!N&&QN(t,n),A=N&&ZN(t,r,n,o);(M||A)&&(d={...d,...EO(u.data,t.options)}),n._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:g,errorUpdatedAt:m,status:b}=d;if(n.select&&d.data!==void 0)if(i&&d.data===(s==null?void 0:s.data)&&n.select===X(this,Yh))p=X(this,_u);else try{xe(this,Yh,n.select),p=n.select(d.data),p=S1(i==null?void 0:i.data,p,n),xe(this,_u,p),xe(this,ui,null)}catch(N){xe(this,ui,N)}else p=d.data;if(n.placeholderData!==void 0&&p===void 0&&b==="pending"){let N;if(i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData))N=i.data;else if(N=typeof n.placeholderData=="function"?n.placeholderData((k=X(this,Ru))==null?void 0:k.state.data,X(this,Ru)):n.placeholderData,n.select&&N!==void 0)try{N=n.select(N),xe(this,ui,null)}catch(M){xe(this,ui,M)}N!==void 0&&(b="success",p=S1(i==null?void 0:i.data,N,n),h=!0)}X(this,ui)&&(g=X(this,ui),p=X(this,_u),m=Date.now(),b="error");const y=d.fetchStatus==="fetching",v=b==="pending",x=b==="error",S=v&&y,_=p!==void 0,C={status:b,fetchStatus:d.fetchStatus,isPending:v,isSuccess:b==="success",isError:x,isInitialLoading:S,isLoading:S,data:p,dataUpdatedAt:d.dataUpdatedAt,error:g,errorUpdatedAt:m,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:y,isRefetching:y&&!v,isLoadingError:x&&!_,isPaused:d.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:x&&_,isStale:AE(t,n),refetch:this.refetch,promise:X(this,Qs)};if(this.options.experimental_prefetchInRender){const N=P=>{C.status==="error"?P.reject(C.error):C.data!==void 0&&P.resolve(C.data)},M=()=>{const P=xe(this,Qs,C.promise=E1());N(P)},A=X(this,Qs);switch(A.status){case"pending":t.queryHash===r.queryHash&&N(A);break;case"fulfilled":(C.status==="error"||C.data!==A.value)&&M();break;case"rejected":(C.status!=="error"||C.error!==A.reason)&&M();break}}return C}updateResult(t){const n=X(this,ur),r=this.createResult(X(this,ft),this.options);if(xe(this,wl,X(this,ft).state),xe(this,Eu,this.options),X(this,wl).data!==void 0&&xe(this,Ru,X(this,ft)),nb(r,n))return;xe(this,ur,r);const o={},i=()=>{if(!n)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!X(this,ku).size)return!0;const l=new Set(a??X(this,ku));return this.options.throwOnError&&l.add("error"),Object.keys(X(this,ur)).some(c=>{const u=c;return X(this,ur)[u]!==n[u]&&l.has(u)})};(t==null?void 0:t.listeners)!==!1&&i()&&(o.listeners=!0),He(this,It,kO).call(this,{...o,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&He(this,It,N1).call(this)}},Ar=new WeakMap,ft=new WeakMap,qh=new WeakMap,ur=new WeakMap,wl=new WeakMap,Eu=new WeakMap,Qs=new WeakMap,ui=new WeakMap,Yh=new WeakMap,_u=new WeakMap,Ru=new WeakMap,Cl=new WeakMap,Sl=new WeakMap,Zs=new WeakMap,ku=new WeakMap,It=new WeakSet,nf=function(t){He(this,It,D1).call(this);let n=X(this,ft).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(bo)),n},_1=function(){He(this,It,M1).call(this);const t=ru(this.options.staleTime,X(this,ft));if(Vl||X(this,ur).isStale||!w1(t))return;const r=yO(X(this,ur).dataUpdatedAt,t)+1;xe(this,Cl,setTimeout(()=>{X(this,ur).isStale||this.updateResult()},r))},R1=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(X(this,ft)):this.options.refetchInterval)??!1},k1=function(t){He(this,It,P1).call(this),xe(this,Zs,t),!(Vl||Fo(this.options.enabled,X(this,ft))===!1||!w1(X(this,Zs))||X(this,Zs)===0)&&xe(this,Sl,setInterval(()=>{(this.options.refetchIntervalInBackground||PE.isFocused())&&He(this,It,nf).call(this)},X(this,Zs)))},N1=function(){He(this,It,_1).call(this),He(this,It,k1).call(this,He(this,It,R1).call(this))},M1=function(){X(this,Cl)&&(clearTimeout(X(this,Cl)),xe(this,Cl,void 0))},P1=function(){X(this,Sl)&&(clearInterval(X(this,Sl)),xe(this,Sl,void 0))},D1=function(){const t=X(this,Ar).getQueryCache().build(X(this,Ar),this.options);if(t===X(this,ft))return;const n=X(this,ft);xe(this,ft,t),xe(this,qh,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},kO=function(t){pn.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(X(this,ur))}),X(this,Ar).getQueryCache().notify({query:X(this,ft),type:"observerResultsUpdated"})})},Bj);function aK(e,t){return Fo(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function QN(e,t){return aK(e,t)||e.state.data!==void 0&&A1(e,t,t.refetchOnMount)}function A1(e,t,n){if(Fo(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&AE(e,t)}return!1}function ZN(e,t,n,r){return(e!==t||Fo(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&AE(e,n)}function AE(e,t){return Fo(t.enabled,e)!==!1&&e.isStaleByTime(ru(t.staleTime,e))}function lK(e,t){return!nb(e.getCurrentResult(),t)}function JN(e,t){return e.filter(n=>!t.includes(n))}function cK(e,t,n){const r=e.slice(0);return r[t]=n,r}var El,mo,Nu,Mu,go,Js,Kh,Xh,Qh,Wn,I1,T1,j1,O1,F1,Vj,uK=(Vj=class extends sc{constructor(t,n,r){super();Me(this,Wn);Me(this,El);Me(this,mo);Me(this,Nu);Me(this,Mu);Me(this,go);Me(this,Js);Me(this,Kh);Me(this,Xh);Me(this,Qh,[]);xe(this,El,t),xe(this,Mu,r),xe(this,Nu,[]),xe(this,go,[]),xe(this,mo,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&X(this,go).forEach(t=>{t.subscribe(n=>{He(this,Wn,O1).call(this,t,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,X(this,go).forEach(t=>{t.destroy()})}setQueries(t,n,r){if(xe(this,Nu,t),xe(this,Mu,n),process.env.NODE_ENV!=="production"){const o=t.map(i=>X(this,El).defaultQueryOptions(i).queryHash);new Set(o).size!==o.length&&console.warn("[QueriesObserver]: Duplicate Queries found. This might result in unexpected behavior.")}pn.batch(()=>{const o=X(this,go),i=He(this,Wn,j1).call(this,X(this,Nu));xe(this,Qh,i),i.forEach(c=>c.observer.setOptions(c.defaultedQueryOptions,r));const s=i.map(c=>c.observer),a=s.map(c=>c.getCurrentResult()),l=s.some((c,u)=>c!==o[u]);o.length===s.length&&!l||(xe(this,go,s),xe(this,mo,a),this.hasListeners()&&(JN(o,s).forEach(c=>{c.destroy()}),JN(s,o).forEach(c=>{c.subscribe(u=>{He(this,Wn,O1).call(this,c,u)})}),He(this,Wn,F1).call(this)))})}getCurrentResult(){return X(this,mo)}getQueries(){return X(this,go).map(t=>t.getCurrentQuery())}getObservers(){return X(this,go)}getOptimisticResult(t,n){const r=He(this,Wn,j1).call(this,t),o=r.map(i=>i.observer.getOptimisticResult(i.defaultedQueryOptions));return[o,i=>He(this,Wn,T1).call(this,i??o,n),()=>He(this,Wn,I1).call(this,o,r)]}},El=new WeakMap,mo=new WeakMap,Nu=new WeakMap,Mu=new WeakMap,go=new WeakMap,Js=new WeakMap,Kh=new WeakMap,Xh=new WeakMap,Qh=new WeakMap,Wn=new WeakSet,I1=function(t,n){return n.map((r,o)=>{const i=t[o];return r.defaultedQueryOptions.notifyOnChangeProps?i:r.observer.trackResult(i,s=>{n.forEach(a=>{a.observer.trackProp(s)})})})},T1=function(t,n){return n?((!X(this,Js)||X(this,mo)!==X(this,Xh)||n!==X(this,Kh))&&(xe(this,Kh,n),xe(this,Xh,X(this,mo)),xe(this,Js,tb(X(this,Js),n(t)))),X(this,Js)):t},j1=function(t){const n=new Map(X(this,go).map(o=>[o.options.queryHash,o])),r=[];return t.forEach(o=>{const i=X(this,El).defaultQueryOptions(o),s=n.get(i.queryHash);s?r.push({defaultedQueryOptions:i,observer:s}):r.push({defaultedQueryOptions:i,observer:new DE(X(this,El),i)})}),r},O1=function(t,n){const r=X(this,go).indexOf(t);r!==-1&&(xe(this,mo,cK(X(this,mo),r,n)),He(this,Wn,F1).call(this))},F1=function(){var t;if(this.hasListeners()){const n=X(this,Js),r=He(this,Wn,I1).call(this,X(this,mo),X(this,Qh)),o=He(this,Wn,T1).call(this,r,(t=X(this,Mu))==null?void 0:t.combine);n!==o&&pn.batch(()=>{this.listeners.forEach(i=>{i(X(this,mo))})})}},Vj),IE=w.createContext(void 0),tp=e=>{const t=w.useContext(IE);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},dK=({client:e,children:t})=>(w.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),f.jsx(IE.Provider,{value:e,children:t})),NO=w.createContext(!1),MO=()=>w.useContext(NO);NO.Provider;function fK(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var hK=w.createContext(fK()),PO=()=>w.useContext(hK);function DO(e,t){return typeof e=="function"?e(...t):!!e}function ib(){}var AO=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},IO=e=>{w.useEffect(()=>{e.clearReset()},[e])},TO=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(o&&e.data===void 0||DO(n,[e.error,r])),jO=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)))},OO=(e,t)=>e.isLoading&&e.isFetching&&!t,L1=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,sb=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function pK({queries:e,...t},n){const r=tp(),o=MO(),i=PO(),s=w.useMemo(()=>e.map(m=>{const b=r.defaultQueryOptions(m);return b._optimisticResults=o?"isRestoring":"optimistic",b}),[e,r,o]);s.forEach(m=>{jO(m),AO(m,i)}),IO(i);const[a]=w.useState(()=>new uK(r,s,t)),[l,c,u]=a.getOptimisticResult(s,t.combine),d=!o&&t.subscribed!==!1;w.useSyncExternalStore(w.useCallback(m=>d?a.subscribe(pn.batchCalls(m)):ib,[a,d]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),w.useEffect(()=>{a.setQueries(s,t,{listeners:!1})},[s,t,a]);const p=l.some((m,b)=>L1(s[b],m))?l.flatMap((m,b)=>{const y=s[b];if(y){const v=new DE(r,y);if(L1(y,m))return sb(y,v,i);OO(m,o)&&sb(y,v,i)}return[]}):[];if(p.length>0)throw Promise.all(p);const g=l.find((m,b)=>{const y=s[b];return y&&TO({result:m,errorResetBoundary:i,throwOnError:y.throwOnError,query:r.getQueryCache().get(y.queryHash),suspense:y.suspense})});if(g!=null&&g.error)throw g.error;return c(u())}function mK(e,t,n){var d,h,p,g,m;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=tp(),o=MO(),i=PO(),s=r.defaultQueryOptions(e);(h=(d=r.getDefaultOptions().queries)==null?void 0:d._experimental_beforeQuery)==null||h.call(d,s),process.env.NODE_ENV!=="production"&&(s.queryFn||console.error(`[${s.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),s._optimisticResults=o?"isRestoring":"optimistic",jO(s),AO(s,i),IO(i);const a=!r.getQueryCache().get(s.queryHash),[l]=w.useState(()=>new t(r,s)),c=l.getOptimisticResult(s),u=!o&&e.subscribed!==!1;if(w.useSyncExternalStore(w.useCallback(b=>{const y=u?l.subscribe(pn.batchCalls(b)):ib;return l.updateResult(),y},[l,u]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),w.useEffect(()=>{l.setOptions(s,{listeners:!1})},[s,l]),L1(s,c))throw sb(s,l,i);if(TO({result:c,errorResetBoundary:i,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash),suspense:s.suspense}))throw c.error;if((g=(p=r.getDefaultOptions().queries)==null?void 0:p._experimental_afterQuery)==null||g.call(p,s,c),s.experimental_prefetchInRender&&!Vl&&OO(c,o)){const b=a?sb(s,l,i):(m=r.getQueryCache().get(s.queryHash))==null?void 0:m.promise;b==null||b.catch(ib).finally(()=>{l.updateResult()})}return s.notifyOnChangeProps?c:l.trackResult(c)}function Tn(e,t){return mK(e,DE)}function gK(){const e=R.useContext(IE);if(e&&e.isSemaphorClient)return e}function FO({children:e}){const{setIsSessionExpired:t}=on(),n=gK(),[r]=R.useState(()=>{const o=new sK({queryCache:new _O({onError:i=>{i instanceof Error?(console.error(`Something went wrong: ${i.message}`),i.message==="invalid token"&&t(!0)):console.error("Something went wrong:",i)}}),defaultOptions:{queries:{gcTime:36e5,staleTime:3e5,refetchOnWindowFocus:!1,retry:1}}});return o.isSemaphorClient=!0,o});return n?f.jsx(f.Fragment,{children:e}):f.jsx(dK,{client:r,children:e})}const Qo=R.forwardRef(({children:e,className:t,...n},r)=>f.jsx("div",{className:re("semaphor-scope",t),ref:r,...n,children:e})),bK={id:"",authToken:void 0,tokenProps:{}},TE=R.createContext(bK),LO=({children:e,dashboardProps:t})=>{const n=R.useMemo(()=>{let r={};const o=t.authToken;return o&&(r=Zh(o.accessToken)),{...t,tokenProps:r}},[t]);return f.jsx(FO,{children:f.jsx(TE.Provider,{value:n,children:f.jsx(Qo,{style:{height:"100%",width:"100%"},children:e})})})};function ir(){const e=R.useContext(TE);if(e===void 0)throw new Error("useApplicationContext must be used within a ApplicationContextProvider");return e}const sd=Es()(Jh(e=>({selectedDashboard:null,selectedVisual:null,lastSelectedDashboard:null,lastSelectedVisual:null,actions:{selectDashboard:t=>{e(n=>{var r;((r=n.selectedDashboard)==null?void 0:r.id)!==t.id&&(n.lastSelectedDashboard=n.selectedDashboard,n.selectedDashboard=t)})},selectVisual:t=>{e(n=>{n.lastSelectedVisual=n.selectedVisual,n.selectedVisual=t})},clearSelectedDashboard:()=>{e(t=>{t.lastSelectedDashboard=t.selectedDashboard,t.selectedDashboard=null})},clearSelectedVisual:()=>{e(t=>{t.lastSelectedVisual=t.selectedVisual,t.selectedVisual=null})}}}))),yK=()=>sd(e=>e.selectedVisual),vK=()=>sd(e=>e.actions),xK=e=>sd(t=>{var n;return((n=t.selectedDashboard)==null?void 0:n.id)===e}),wK=e=>sd(t=>{var n;return((n=t.selectedVisual)==null?void 0:n.id)===e});function CK(){const e=sd(c=>c.selectedDashboard),{authToken:t,version:n}=ir(),r=oe(c=>c.selectedLensId);function o(){if(!(t!=null&&t.accessToken))return!1}const{data:i,isLoading:s,isFetching:a,isError:l}=Tn({queryKey:["dashboard",r,t==null?void 0:t.accessToken,e==null?void 0:e.id],queryFn:()=>BY(t==null?void 0:t.accessToken,{lensId:r,version:n,dashboardId:e==null?void 0:e.id}),enabled:o()});return{data:i,isLoading:s,isFetching:a,isError:l}}function SK(){const{authToken:e}=ir(),t=oe(r=>r.authToken),{setAuthToken:n}=on();return R.useEffect(()=>{e&&(e==null?void 0:e.toString())!==(t==null?void 0:t.toString())&&n(e)},[e,t,n]),e}const $O=(e,t)=>{const n={};if(e===null||t===null)return t;const r=new Set([...Object.keys(e),...Object.keys(t)]);for(const o of r){if(!(o in e)&&o in t){n[o]=t[o];continue}if(o in e&&!(o in t)){n[o]=void 0;continue}const i=e[o],s=t[o];if(!$1(i,s))if(Array.isArray(i)&&Array.isArray(s))n[o]=s;else if(eM(i)&&eM(s)){const a=$O(i,s);Object.keys(a).length>0&&(n[o]=a)}else n[o]=s}return n},$1=(e,t)=>{if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(Array.isArray(e)&&Array.isArray(t))return e.length!==t.length?!1:e.every((o,i)=>$1(o,t[i]));const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(o=>$1(e[o],t[o]))}return!1},eM=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),th=e=>{if(e===null||typeof e!="object")return e;if(e instanceof Date)return new Date(e);if(e instanceof RegExp)return new RegExp(e);if(Array.isArray(e))return e.map(n=>th(n));const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=th(e[n]));return t};function zO(e){return e==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e}function tM(e,t){const n=zO(e);return n==="dark"?Jf({...t==null?void 0:t.default},{...t==null?void 0:t.dark}):t==null?void 0:t.default}function EK({customStyle:e,currentTheme:t,onSave:n,onEvent:r,defaultFilterValues:o,selectedSheetId:i,onFilterValuesChange:s}){const{authToken:a}=ir();SK();const l=oe(O=>O.selectedLensId),{data:c,isLoading:u,isFetching:d,isError:h}=CK(),[p,g]=R.useState(o||[]),{theme:m,setTheme:b}=bO(),y=oe(O=>O.dashboard.globalStyle),{setDashboard:v,setDashboardWithFilterValues:x,setSelectedSheetId:S,setStyle:_,setOnSaveFunction:E,setLenses:C,setSelectedLensId:k,setInitStore:N}=on();oe(O=>O.actions.setCustomCards);const M=oe(O=>O.actions.setFilterValues),A=oe(O=>O.filterValues),P=oe(O=>O.actions.setThemeStyle),j=oe(O=>O.actions.setDashboardTheme),F=oe(O=>O.actions.setOnEvent);R.useEffect(()=>{a&&N()},[a,N]),R.useEffect(()=>{if(m){const O=zO(m);j(O)}},[m,j]),R.useEffect(()=>{t&&b(t)},[t,b]);const I=R.useCallback(()=>{const O=th(Jg),$=Jf(O,y);if(e){const B=Jf($,e),z=tM(m,B);P(z),_(B)}else{const B=tM(m,$);P(B),_(Jg)}},[m,e,y,P,_]);return R.useEffect(()=>{c&&c.dashboard&&I()},[m,e,y,I,c]),R.useEffect(()=>{var L,D;function O(H,V){const q=H.filters||[],U=[];for(const Y of V){const K=q.find(Z=>Z.id===Y.filterId);K&&U.push({filterId:Y.filterId,connectionType:K.database==="NA"?"api":"database",name:K.column,operation:K.operation,valueType:nu(K),values:Y.values})}return U}if(!c||!c.dashboard)return;const{dashboard:$,filterValues:B,defaultLensId:z,lenses:T}=c;function W(){var V;if(B&&(B==null?void 0:B.length)>0)return B;const H=O($,p||[]);return H&&(H==null?void 0:H.length)>0?H:$.defaultFilterValues&&((V=$.defaultFilterValues)==null?void 0:V.length)>0?$.defaultFilterValues:[]}x($,W()),T&&C(T),z&&k(z),S(i||((D=(L=$==null?void 0:$.sheets)==null?void 0:L[0])==null?void 0:D.id)||null)},[c,v,S,M,l,C,x,k,p,i]),R.useEffect(()=>{s&&A&&s(A)},[A,s]),R.useEffect(()=>{n&&E(n),r&&F(r)},[n,E,r,F]),{isFetching:d,isLoading:u,isError:h}}function ms({className:e,...t}){return f.jsx("div",{className:re("animate-pulse rounded-md bg-muted",e),...t})}const ab=w.forwardRef(({className:e,...t},n)=>f.jsx("div",{ref:n,className:re("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));ab.displayName="Card";const Tu=w.forwardRef(({className:e,...t},n)=>f.jsx("div",{ref:n,className:re("flex flex-col space-y-1.5 p-6",e),...t}));Tu.displayName="CardHeader";const fa=w.forwardRef(({className:e,...t},n)=>f.jsx("h3",{ref:n,className:re("text-2xl font-semibold leading-none tracking-tight",e),...t}));fa.displayName="CardTitle";const jE=w.forwardRef(({className:e,...t},n)=>f.jsx("p",{ref:n,className:re("text-sm text-muted-foreground",e),...t}));jE.displayName="CardDescription";const nh=w.forwardRef(({className:e,...t},n)=>f.jsx("div",{ref:n,className:re("px-6 pt-0",e),...t}));nh.displayName="CardContent";const BO=w.forwardRef(({className:e,...t},n)=>f.jsx("div",{ref:n,className:re("flex items-center p-6 pt-0",e),...t}));BO.displayName="CardFooter";function VO({className:e,customStyle:t,onSave:n,onEvent:r,LoadingComponent:o,ErrorComponent:i,onChartElementClicked:s,id:a,authToken:l,currentTheme:c,version:u,customCards:d,showAssistant:h,defaultFilterValues:p,onFilterValuesChange:g,selectedSheetId:m,eventHandlers:b,...y}){const{placeholders:v}=ir(),x=oe(C=>C.themeStyle),S=oe(C=>C.isSessionExpired),{isLoading:_,isError:E}=EK({customStyle:t,currentTheme:c,onSave:n,onEvent:r,defaultFilterValues:p,onFilterValuesChange:g,selectedSheetId:m});return _||!l?(r==null||r({type:"info",message:"Loading dashboard"}),o?f.jsx(o,{message:"loading"}):f.jsx("div",{className:"flex items-center gap-3",children:f.jsx(ms,{className:"h-1 w-full dark:h-[2px]"})})):E?(r==null||r({type:"error",message:"Error fetching dashboard"}),i?(console.log("Error fetching dashboard"),f.jsx(i,{})):f.jsx("div",{children:"Error"})):S?(r==null||r({type:"error",message:"Session Expired"}),v!=null&&v.SessionExpired?f.jsx("div",{className:"flex h-full items-center justify-center",children:f.jsx("div",{children:v.SessionExpired})}):f.jsx("div",{className:"flex h-full items-center justify-center",children:f.jsxs("div",{className:"space-y-4 rounded-md border border-muted p-10",children:[f.jsx(fa,{children:"Session Expired"}),f.jsx("p",{className:"text-muted-foreground",children:"Please refresh your page to continue"})]})})):f.jsx("div",{className:re("isolate flex grow flex-col",x==null?void 0:x.dashboardPanel,e),style:{},"data-role":"dashboard-panel",...y})}function fe(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function _K(e,t){const n=w.createContext(t),r=i=>{const{children:s,...a}=i,l=w.useMemo(()=>a,Object.values(a));return f.jsx(n.Provider,{value:l,children:s})};r.displayName=e+"Provider";function o(i){const s=w.useContext(n);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,o]}function Pn(e,t=[]){let n=[];function r(i,s){const a=w.createContext(s),l=n.length;n=[...n,s];const c=d=>{var y;const{scope:h,children:p,...g}=d,m=((y=h==null?void 0:h[e])==null?void 0:y[l])||a,b=w.useMemo(()=>g,Object.values(g));return f.jsx(m.Provider,{value:b,children:p})};c.displayName=i+"Provider";function u(d,h){var m;const p=((m=h==null?void 0:h[e])==null?void 0:m[l])||a,g=w.useContext(p);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[c,u]}const o=()=>{const i=n.map(s=>w.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return w.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,RK(o,...t)]}function RK(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(i)[`__scope${c}`];return{...a,...d}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function nM(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function vr(...e){return t=>{let n=!1;const r=e.map(o=>{const i=nM(o,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<r.length;o++){const i=r[o];typeof i=="function"?i():nM(e[o],null)}}}}function Ve(...e){return w.useCallback(vr(...e),e)}var z1=w.forwardRef((e,t)=>{const{children:n,...r}=e,o=w.Children.toArray(n),i=o.find(NK);if(i){const s=i.props.children,a=o.map(l=>l===i?w.Children.count(s)>1?w.Children.only(null):w.isValidElement(s)?s.props.children:null:l);return f.jsx(B1,{...r,ref:t,children:w.isValidElement(s)?w.cloneElement(s,void 0,a):null})}return f.jsx(B1,{...r,ref:t,children:n})});z1.displayName="Slot";var B1=w.forwardRef((e,t)=>{const{children:n,...r}=e;if(w.isValidElement(n)){const o=PK(n),i=MK(r,n.props);return n.type!==w.Fragment&&(i.ref=t?vr(t,o):o),w.cloneElement(n,i)}return w.Children.count(n)>1?w.Children.only(null):null});B1.displayName="SlotClone";var kK=({children:e})=>f.jsx(f.Fragment,{children:e});function NK(e){return w.isValidElement(e)&&e.type===kK}function MK(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function PK(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function T0(e){const t=e+"CollectionProvider",[n,r]=Pn(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=p=>{const{scope:g,children:m}=p,b=R.useRef(null),y=R.useRef(new Map).current;return f.jsx(o,{scope:g,itemMap:y,collectionRef:b,children:m})};s.displayName=t;const a=e+"CollectionSlot",l=R.forwardRef((p,g)=>{const{scope:m,children:b}=p,y=i(a,m),v=Ve(g,y.collectionRef);return f.jsx(z1,{ref:v,children:b})});l.displayName=a;const c=e+"CollectionItemSlot",u="data-radix-collection-item",d=R.forwardRef((p,g)=>{const{scope:m,children:b,...y}=p,v=R.useRef(null),x=Ve(g,v),S=i(c,m);return R.useEffect(()=>(S.itemMap.set(v,{ref:v,...y}),()=>void S.itemMap.delete(v))),f.jsx(z1,{[u]:"",ref:x,children:b})});d.displayName=c;function h(p){const g=i(e+"CollectionConsumer",p);return R.useCallback(()=>{const b=g.collectionRef.current;if(!b)return[];const y=Array.from(b.querySelectorAll(`[${u}]`));return Array.from(g.itemMap.values()).sort((S,_)=>y.indexOf(S.ref.current)-y.indexOf(_.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:s,Slot:l,ItemSlot:d},h,r]}var Vn=globalThis!=null&&globalThis.document?w.useLayoutEffect:()=>{},DK=w.useId||(()=>{}),AK=0;function _n(e){const[t,n]=w.useState(DK());return Vn(()=>{n(r=>r??String(AK++))},[e]),t?`radix-${t}`:""}var HO=w.forwardRef((e,t)=>{const{children:n,...r}=e,o=w.Children.toArray(n),i=o.find(TK);if(i){const s=i.props.children,a=o.map(l=>l===i?w.Children.count(s)>1?w.Children.only(null):w.isValidElement(s)?s.props.children:null:l);return f.jsx(V1,{...r,ref:t,children:w.isValidElement(s)?w.cloneElement(s,void 0,a):null})}return f.jsx(V1,{...r,ref:t,children:n})});HO.displayName="Slot";var V1=w.forwardRef((e,t)=>{const{children:n,...r}=e;if(w.isValidElement(n)){const o=OK(n),i=jK(r,n.props);return n.type!==w.Fragment&&(i.ref=t?vr(t,o):o),w.cloneElement(n,i)}return w.Children.count(n)>1?w.Children.only(null):null});V1.displayName="SlotClone";var IK=({children:e})=>f.jsx(f.Fragment,{children:e});function TK(e){return w.isValidElement(e)&&e.type===IK}function jK(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function OK(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var FK=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],_e=FK.reduce((e,t)=>{const n=w.forwardRef((r,o)=>{const{asChild:i,...s}=r,a=i?HO:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(a,{...s,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function WO(e,t){e&&vs.flushSync(()=>e.dispatchEvent(t))}function Mn(e){const t=w.useRef(e);return w.useEffect(()=>{t.current=e}),w.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function or({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=LK({defaultProp:t,onChange:n}),i=e!==void 0,s=i?e:r,a=Mn(n),l=w.useCallback(c=>{if(i){const d=typeof c=="function"?c(e):c;d!==e&&a(d)}else o(c)},[i,e,o,a]);return[s,l]}function LK({defaultProp:e,onChange:t}){const n=w.useState(e),[r]=n,o=w.useRef(r),i=Mn(t);return w.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}var $K=w.createContext(void 0);function ac(e){const t=w.useContext($K);return e||t||"ltr"}var Uv="rovingFocusGroup.onEntryFocus",zK={bubbles:!1,cancelable:!0},j0="RovingFocusGroup",[H1,UO,BK]=T0(j0),[VK,ad]=Pn(j0,[BK]),[HK,WK]=VK(j0),GO=w.forwardRef((e,t)=>f.jsx(H1.Provider,{scope:e.__scopeRovingFocusGroup,children:f.jsx(H1.Slot,{scope:e.__scopeRovingFocusGroup,children:f.jsx(UK,{...e,ref:t})})}));GO.displayName=j0;var UK=w.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=e,h=w.useRef(null),p=Ve(t,h),g=ac(i),[m=null,b]=or({prop:s,defaultProp:a,onChange:l}),[y,v]=w.useState(!1),x=Mn(c),S=UO(n),_=w.useRef(!1),[E,C]=w.useState(0);return w.useEffect(()=>{const k=h.current;if(k)return k.addEventListener(Uv,x),()=>k.removeEventListener(Uv,x)},[x]),f.jsx(HK,{scope:n,orientation:r,dir:g,loop:o,currentTabStopId:m,onItemFocus:w.useCallback(k=>b(k),[b]),onItemShiftTab:w.useCallback(()=>v(!0),[]),onFocusableItemAdd:w.useCallback(()=>C(k=>k+1),[]),onFocusableItemRemove:w.useCallback(()=>C(k=>k-1),[]),children:f.jsx(_e.div,{tabIndex:y||E===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:"none",...e.style},onMouseDown:fe(e.onMouseDown,()=>{_.current=!0}),onFocus:fe(e.onFocus,k=>{const N=!_.current;if(k.target===k.currentTarget&&N&&!y){const M=new CustomEvent(Uv,zK);if(k.currentTarget.dispatchEvent(M),!M.defaultPrevented){const A=S().filter(O=>O.focusable),P=A.find(O=>O.active),j=A.find(O=>O.id===m),I=[P,j,...A].filter(Boolean).map(O=>O.ref.current);KO(I,u)}}_.current=!1}),onBlur:fe(e.onBlur,()=>v(!1))})})}),qO="RovingFocusGroupItem",YO=w.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,...s}=e,a=_n(),l=i||a,c=WK(qO,n),u=c.currentTabStopId===l,d=UO(n),{onFocusableItemAdd:h,onFocusableItemRemove:p}=c;return w.useEffect(()=>{if(r)return h(),()=>p()},[r,h,p]),f.jsx(H1.ItemSlot,{scope:n,id:l,focusable:r,active:o,children:f.jsx(_e.span,{tabIndex:u?0:-1,"data-orientation":c.orientation,...s,ref:t,onMouseDown:fe(e.onMouseDown,g=>{r?c.onItemFocus(l):g.preventDefault()}),onFocus:fe(e.onFocus,()=>c.onItemFocus(l)),onKeyDown:fe(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){c.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const m=YK(g,c.orientation,c.dir);if(m!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let y=d().filter(v=>v.focusable).map(v=>v.ref.current);if(m==="last")y.reverse();else if(m==="prev"||m==="next"){m==="prev"&&y.reverse();const v=y.indexOf(g.currentTarget);y=c.loop?KK(y,v+1):y.slice(v+1)}setTimeout(()=>KO(y))}})})})});YO.displayName=qO;var GK={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function qK(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function YK(e,t,n){const r=qK(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return GK[r]}function KO(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function KK(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var OE=GO,FE=YO;function XK(e,t){return w.useReducer((n,r)=>t[n][r]??n,e)}var fn=e=>{const{present:t,children:n}=e,r=QK(t),o=typeof n=="function"?n({present:r.isPresent}):w.Children.only(n),i=Ve(r.ref,ZK(o));return typeof n=="function"||r.isPresent?w.cloneElement(o,{ref:i}):null};fn.displayName="Presence";function QK(e){const[t,n]=w.useState(),r=w.useRef({}),o=w.useRef(e),i=w.useRef("none"),s=e?"mounted":"unmounted",[a,l]=XK(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const c=um(r.current);i.current=a==="mounted"?c:"none"},[a]),Vn(()=>{const c=r.current,u=o.current;if(u!==e){const h=i.current,p=um(c);e?l("MOUNT"):p==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&h!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),Vn(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,d=p=>{const m=um(r.current).includes(p.animationName);if(p.target===t&&m&&(l("ANIMATION_END"),!o.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},h=p=>{p.target===t&&(i.current=um(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{u.clearTimeout(c),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:w.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function um(e){return(e==null?void 0:e.animationName)||"none"}function ZK(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var LE="Tabs",[JK,DLe]=Pn(LE,[ad]),XO=ad(),[eX,$E]=JK(LE),QO=w.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:l="automatic",...c}=e,u=ac(a),[d,h]=or({prop:r,onChange:o,defaultProp:i});return f.jsx(eX,{scope:n,baseId:_n(),value:d,onValueChange:h,orientation:s,dir:u,activationMode:l,children:f.jsx(_e.div,{dir:u,"data-orientation":s,...c,ref:t})})});QO.displayName=LE;var ZO="TabsList",JO=w.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=$E(ZO,n),s=XO(n);return f.jsx(OE,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:f.jsx(_e.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});JO.displayName=ZO;var e5="TabsTrigger",t5=w.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=$E(e5,n),a=XO(n),l=o5(s.baseId,r),c=i5(s.baseId,r),u=r===s.value;return f.jsx(FE,{asChild:!0,...a,focusable:!o,active:u,children:f.jsx(_e.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:l,...i,ref:t,onMouseDown:fe(e.onMouseDown,d=>{!o&&d.button===0&&d.ctrlKey===!1?s.onValueChange(r):d.preventDefault()}),onKeyDown:fe(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&s.onValueChange(r)}),onFocus:fe(e.onFocus,()=>{const d=s.activationMode!=="manual";!u&&!o&&d&&s.onValueChange(r)})})})});t5.displayName=e5;var n5="TabsContent",r5=w.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=$E(n5,n),l=o5(a.baseId,r),c=i5(a.baseId,r),u=r===a.value,d=w.useRef(u);return w.useEffect(()=>{const h=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(h)},[]),f.jsx(fn,{present:o||u,children:({present:h})=>f.jsx(_e.div,{"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!h,id:c,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:h&&i})})});r5.displayName=n5;function o5(e,t){return`${e}-trigger-${t}`}function i5(e,t){return`${e}-content-${t}`}var tX=QO,s5=JO,a5=t5,l5=r5;const ld=tX,lc=w.forwardRef(({className:e,...t},n)=>f.jsx(s5,{ref:n,className:re("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));lc.displayName=s5.displayName;const Jr=w.forwardRef(({className:e,...t},n)=>f.jsx(a5,{ref:n,className:re("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}));Jr.displayName=a5.displayName;const mi=w.forwardRef(({className:e,...t},n)=>f.jsx(l5,{ref:n,className:re("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));mi.displayName=l5.displayName;var c5={exports:{}},np={},W1={exports:{}};(function(e,t){(function(n,r){r(t)})(ls,function(n){function r(Y){return function(Z,ee,Q,ie,te,le,ue){return Y(Z,ee,ue)}}function o(Y){return function(Z,ee,Q,ie){if(!Z||!ee||typeof Z!="object"||typeof ee!="object")return Y(Z,ee,Q,ie);var te=ie.get(Z),le=ie.get(ee);if(te&&le)return te===ee&&le===Z;ie.set(Z,ee),ie.set(ee,Z);var ue=Y(Z,ee,Q,ie);return ie.delete(Z),ie.delete(ee),ue}}function i(Y,K){var Z={};for(var ee in Y)Z[ee]=Y[ee];for(var ee in K)Z[ee]=K[ee];return Z}function s(Y){return Y.constructor===Object||Y.constructor==null}function a(Y){return typeof Y.then=="function"}function l(Y,K){return Y===K||Y!==Y&&K!==K}var c="[object Arguments]",u="[object Boolean]",d="[object Date]",h="[object RegExp]",p="[object Map]",g="[object Number]",m="[object Object]",b="[object Set]",y="[object String]",v=Object.prototype.toString;function x(Y){var K=Y.areArraysEqual,Z=Y.areDatesEqual,ee=Y.areMapsEqual,Q=Y.areObjectsEqual,ie=Y.areRegExpsEqual,te=Y.areSetsEqual,le=Y.createIsNestedEqual,ue=le(Re);function Re(be,we,Pe){if(be===we)return!0;if(!be||!we||typeof be!="object"||typeof we!="object")return be!==be&&we!==we;if(s(be)&&s(we))return Q(be,we,ue,Pe);var Ye=Array.isArray(be),_t=Array.isArray(we);if(Ye||_t)return Ye===_t&&K(be,we,ue,Pe);var me=v.call(be);return me!==v.call(we)?!1:me===d?Z(be,we,ue,Pe):me===h?ie(be,we,ue,Pe):me===p?ee(be,we,ue,Pe):me===b?te(be,we,ue,Pe):me===m||me===c?a(be)||a(we)?!1:Q(be,we,ue,Pe):me===u||me===g||me===y?l(be.valueOf(),we.valueOf()):!1}return Re}function S(Y,K,Z,ee){var Q=Y.length;if(K.length!==Q)return!1;for(;Q-- >0;)if(!Z(Y[Q],K[Q],Q,Q,Y,K,ee))return!1;return!0}var _=o(S);function E(Y,K){return l(Y.valueOf(),K.valueOf())}function C(Y,K,Z,ee){var Q=Y.size===K.size;if(!Q)return!1;if(!Y.size)return!0;var ie={},te=0;return Y.forEach(function(le,ue){if(Q){var Re=!1,be=0;K.forEach(function(we,Pe){!Re&&!ie[be]&&(Re=Z(ue,Pe,te,be,Y,K,ee)&&Z(le,we,ue,Pe,Y,K,ee))&&(ie[be]=!0),be++}),te++,Q=Re}}),Q}var k=o(C),N="_owner",M=Object.prototype.hasOwnProperty;function A(Y,K,Z,ee){var Q=Object.keys(Y),ie=Q.length;if(Object.keys(K).length!==ie)return!1;for(var te;ie-- >0;){if(te=Q[ie],te===N){var le=!!Y.$$typeof,ue=!!K.$$typeof;if((le||ue)&&le!==ue)return!1}if(!M.call(K,te)||!Z(Y[te],K[te],te,te,Y,K,ee))return!1}return!0}var P=o(A);function j(Y,K){return Y.source===K.source&&Y.flags===K.flags}function F(Y,K,Z,ee){var Q=Y.size===K.size;if(!Q)return!1;if(!Y.size)return!0;var ie={};return Y.forEach(function(te,le){if(Q){var ue=!1,Re=0;K.forEach(function(be,we){!ue&&!ie[Re]&&(ue=Z(te,be,le,we,Y,K,ee))&&(ie[Re]=!0),Re++}),Q=ue}}),Q}var I=o(F),O=Object.freeze({areArraysEqual:S,areDatesEqual:E,areMapsEqual:C,areObjectsEqual:A,areRegExpsEqual:j,areSetsEqual:F,createIsNestedEqual:r}),$=Object.freeze({areArraysEqual:_,areDatesEqual:E,areMapsEqual:k,areObjectsEqual:P,areRegExpsEqual:j,areSetsEqual:I,createIsNestedEqual:r}),B=x(O);function z(Y,K){return B(Y,K,void 0)}var T=x(i(O,{createIsNestedEqual:function(){return l}}));function W(Y,K){return T(Y,K,void 0)}var L=x($);function D(Y,K){return L(Y,K,new WeakMap)}var H=x(i($,{createIsNestedEqual:function(){return l}}));function V(Y,K){return H(Y,K,new WeakMap)}function q(Y){return x(i(O,Y(O)))}function U(Y){var K=x(i($,Y($)));return function(Z,ee,Q){return Q===void 0&&(Q=new WeakMap),K(Z,ee,Q)}}n.circularDeepEqual=D,n.circularShallowEqual=V,n.createCustomCircularEqual=U,n.createCustomEqual=q,n.deepEqual=z,n.sameValueZeroEqual=l,n.shallowEqual=W,Object.defineProperty(n,"__esModule",{value:!0})})})(W1,W1.exports);var zE=W1.exports;const BE=bE(mq);var lt={},nX=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(lt,"__esModule",{value:!0});lt.bottom=VE;lt.childrenEqual=sX;lt.cloneLayout=u5;lt.cloneLayoutItem=_l;lt.collides=O0;lt.compact=f5;lt.compactItem=h5;lt.compactType=vX;lt.correctBounds=p5;lt.fastPositionEqual=aX;lt.fastRGLPropsEqual=void 0;lt.getAllCollisions=m5;lt.getFirstCollision=cl;lt.getLayoutItem=HE;lt.getStatics=WE;lt.modifyLayout=d5;lt.moveElement=of;lt.moveElementAwayFromCollision=G1;lt.noop=void 0;lt.perc=cX;lt.resizeItemInDirection=mX;lt.setTopLeft=bX;lt.setTransform=gX;lt.sortLayoutItems=XE;lt.sortLayoutItemsByColRow=x5;lt.sortLayoutItemsByRowCol=v5;lt.synchronizeLayoutWithChildren=yX;lt.validateLayout=w5;lt.withLayoutItem=iX;var rM=zE,rf=rX(R);function rX(e){return e&&e.__esModule?e:{default:e}}const oX=process.env.NODE_ENV==="production";function VE(e){let t=0,n;for(let r=0,o=e.length;r<o;r++)n=e[r].y+e[r].h,n>t&&(t=n);return t}function u5(e){const t=Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=_l(e[n]);return t}function d5(e,t){const n=Array(e.length);for(let r=0,o=e.length;r<o;r++)t.i===e[r].i?n[r]=t:n[r]=e[r];return n}function iX(e,t,n){let r=HE(e,t);return r?(r=n(_l(r)),e=d5(e,r),[e,r]):[e,null]}function _l(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 sX(e,t){return(0,rM.deepEqual)(rf.default.Children.map(e,n=>n==null?void 0:n.key),rf.default.Children.map(t,n=>n==null?void 0:n.key))&&(0,rM.deepEqual)(rf.default.Children.map(e,n=>n==null?void 0:n.props["data-grid"]),rf.default.Children.map(t,n=>n==null?void 0:n.props["data-grid"]))}lt.fastRGLPropsEqual=nX;function aX(e,t){return e.left===t.left&&e.top===t.top&&e.width===t.width&&e.height===t.height}function O0(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 f5(e,t,n,r){const o=WE(e),i=XE(e,t),s=Array(e.length);for(let a=0,l=i.length;a<l;a++){let c=_l(i[a]);c.static||(c=h5(o,c,t,n,i,r),o.push(c)),s[e.indexOf(i[a])]=c,c.moved=!1}return s}const lX={x:"w",y:"h"};function U1(e,t,n,r){const o=lX[r];t[r]+=1;const i=e.map(s=>s.i).indexOf(t.i);for(let s=i+1;s<e.length;s++){const a=e[s];if(!a.static){if(a.y>t.y+t.h)break;O0(t,a)&&U1(e,a,n+t[o],r)}}t[r]=n}function h5(e,t,n,r,o,i){const s=n==="vertical",a=n==="horizontal";if(s)for(t.y=Math.min(VE(e),t.y);t.y>0&&!cl(e,t);)t.y--;else if(a)for(;t.x>0&&!cl(e,t);)t.x--;let l;for(;(l=cl(e,t))&&!(n===null&&i);)if(a?U1(o,t,l.x+l.w,"x"):U1(o,t,l.y+l.h,"y"),a&&t.x+t.w>r)for(t.x=r-t.w,t.y++;t.x>0&&!cl(e,t);)t.x--;return t.y=Math.max(t.y,0),t.x=Math.max(t.x,0),t}function p5(e,t){const n=WE(e);for(let r=0,o=e.length;r<o;r++){const i=e[r];if(i.x+i.w>t.cols&&(i.x=t.cols-i.w),i.x<0&&(i.x=0,i.w=t.cols),!i.static)n.push(i);else for(;cl(n,i);)i.y++}return e}function HE(e,t){for(let n=0,r=e.length;n<r;n++)if(e[n].i===t)return e[n]}function cl(e,t){for(let n=0,r=e.length;n<r;n++)if(O0(e[n],t))return e[n]}function m5(e,t){return e.filter(n=>O0(n,t))}function WE(e){return e.filter(t=>t.static)}function of(e,t,n,r,o,i,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=XE(e,s);(s==="vertical"&&typeof r=="number"?u>=r:s==="horizontal"&&typeof n=="number"?c>=n:!1)&&(d=d.reverse());const p=m5(d,t),g=p.length>0;if(g&&l)return u5(e);if(g&&i)return`${t.i}`,t.x=c,t.y=u,t.moved=!1,e;for(let m=0,b=p.length;m<b;m++){const y=p[m];`${t.i}${t.x}${t.y}${y.i}${y.x}${y.y}`,!y.moved&&(y.static?e=G1(e,y,t,o,s):e=G1(e,t,y,o,s))}return e}function G1(e,t,n,r,o,i){const s=o==="horizontal",a=o==="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"},h=cl(e,d),p=h&&h.y+h.h>t.y,g=h&&t.x+t.w>h.x;if(h){if(p&&a)return of(e,n,void 0,t.y+1,r,l,o);if(p&&o==null)return t.y=n.y,n.y=n.y+n.h,e;if(g&&s)return of(e,t,n.x,void 0,r,l,o)}else return`${n.i}${d.x}${d.y}`,of(e,n,s?d.x:void 0,a?d.y:void 0,r,l,o)}const c=s?n.x+1:void 0,u=a?n.y+1:void 0;return c==null&&u==null?e:of(e,n,s?n.x+1:void 0,a?n.y+1:void 0,r,l,o)}function cX(e){return e*100+"%"}const g5=(e,t,n,r)=>e+n>r?t:n,b5=(e,t,n)=>e<0?t:n,y5=e=>Math.max(0,e),UE=e=>Math.max(0,e),GE=(e,t,n)=>{let{left:r,height:o,width:i}=t;const s=e.top-(o-e.height);return{left:r,width:i,height:b5(s,e.height,o),top:UE(s)}},qE=(e,t,n)=>{let{top:r,left:o,height:i,width:s}=t;return{top:r,height:i,width:g5(e.left,e.width,s,n),left:y5(o)}},YE=(e,t,n)=>{let{top:r,height:o,width:i}=t;const s=e.left-(i-e.width);return{height:o,width:s<0?e.width:g5(e.left,e.width,i,n),top:UE(r),left:y5(s)}},KE=(e,t,n)=>{let{top:r,left:o,height:i,width:s}=t;return{width:s,left:o,height:b5(r,e.height,i),top:UE(r)}},uX=function(){return GE(arguments.length<=0?void 0:arguments[0],qE(...arguments))},dX=function(){return GE(arguments.length<=0?void 0:arguments[0],YE(...arguments))},fX=function(){return KE(arguments.length<=0?void 0:arguments[0],qE(...arguments))},hX=function(){return KE(arguments.length<=0?void 0:arguments[0],YE(...arguments))},pX={n:GE,ne:uX,e:qE,se:fX,s:KE,sw:hX,w:YE,nw:dX};function mX(e,t,n,r){const o=pX[e];return o?o(t,{...t,...n},r):n}function gX(e){let{top:t,left:n,width:r,height:o}=e;const i=`translate(${n}px,${t}px)`;return{transform:i,WebkitTransform:i,MozTransform:i,msTransform:i,OTransform:i,width:`${r}px`,height:`${o}px`,position:"absolute"}}function bX(e){let{top:t,left:n,width:r,height:o}=e;return{top:`${t}px`,left:`${n}px`,width:`${r}px`,height:`${o}px`,position:"absolute"}}function XE(e,t){return t==="horizontal"?x5(e):t==="vertical"?v5(e):e}function v5(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 x5(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 yX(e,t,n,r,o){e=e||[];const i=[];rf.default.Children.forEach(t,a=>{if((a==null?void 0:a.key)==null)return;const l=HE(e,String(a.key)),c=a.props["data-grid"];l&&c==null?i.push(_l(l)):c?(oX||w5([c],"ReactGridLayout.children"),i.push(_l({...c,i:a.key}))):i.push(_l({w:1,h:1,x:0,y:VE(i),i:String(a.key)}))});const s=p5(i,{cols:n});return o?s:f5(s,r,n)}function w5(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Layout";const n=["x","y","w","h"];if(!Array.isArray(e))throw new Error(t+" must be an array!");for(let r=0,o=e.length;r<o;r++){const i=e[r];for(let s=0;s<n.length;s++){const a=n[s],l=i[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 i.i<"u"&&typeof i.i!="string")throw new Error(`ReactGridLayout: ${t}[${r}].i must be a string! Received: ${i.i} (${typeof i.i})`)}}function vX(e){const{verticalCompact:t,compactType:n}=e||{};return t===!1?null:n}const xX=()=>{};lt.noop=xX;var ji={};Object.defineProperty(ji,"__esModule",{value:!0});ji.calcGridColWidth=F0;ji.calcGridItemPosition=wX;ji.calcGridItemWHPx=q1;ji.calcWH=SX;ji.calcXY=CX;ji.clamp=ul;function F0(e){const{margin:t,containerPadding:n,containerWidth:r,cols:o}=e;return(r-t[0]*(o-1)-n[0]*2)/o}function q1(e,t,n){return Number.isFinite(e)?Math.round(t*e+Math.max(0,e-1)*n):e}function wX(e,t,n,r,o,i){const{margin:s,containerPadding:a,rowHeight:l}=e,c=F0(e),u={};return i&&i.resizing?(u.width=Math.round(i.resizing.width),u.height=Math.round(i.resizing.height)):(u.width=q1(r,c,s[0]),u.height=q1(o,l,s[1])),i&&i.dragging?(u.top=Math.round(i.dragging.top),u.left=Math.round(i.dragging.left)):i&&i.resizing&&typeof i.resizing.top=="number"&&typeof i.resizing.left=="number"?(u.top=Math.round(i.resizing.top),u.left=Math.round(i.resizing.left)):(u.top=Math.round((l+s[1])*n+a[1]),u.left=Math.round((c+s[0])*t+a[0])),u}function CX(e,t,n,r,o){const{margin:i,containerPadding:s,cols:a,rowHeight:l,maxRows:c}=e,u=F0(e);let d=Math.round((n-s[0])/(u+i[0])),h=Math.round((t-s[1])/(l+i[1]));return d=ul(d,0,a-r),h=ul(h,0,c-o),{x:d,y:h}}function SX(e,t,n,r,o,i){const{margin:s,maxRows:a,cols:l,rowHeight:c}=e,u=F0(e);let d=Math.round((t+s[0])/(u+s[0])),h=Math.round((n+s[1])/(c+s[1])),p=ul(d,0,l-r),g=ul(h,0,a-o);return["sw","w","nw"].indexOf(i)!==-1&&(p=ul(d,0,l)),["nw","n","ne"].indexOf(i)!==-1&&(g=ul(h,0,a)),{w:p,h:g}}function ul(e,t,n){return Math.max(Math.min(e,n),t)}var L0={},Y1={exports:{}},dm={exports:{}},kt={};/** @license React v16.13.1
|
|
37
37
|
* react-is.production.min.js
|
|
38
38
|
*
|
|
39
39
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -557,7 +557,7 @@ ${(e*100).toLocaleString()}%`}}},scales:{_index_:{display:!1,padding:10,grid:{di
|
|
|
557
557
|
font-size: .6rem;
|
|
558
558
|
font-weight: bold;
|
|
559
559
|
color: hsl(${Math.max(0,Math.min(120-120*m,120))}deg 100% 31%);`,n==null?void 0:n.key)}return(l=n==null?void 0:n.onChange)==null||l.call(n,o),o}}function kw(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const eEe=(e,t)=>Math.abs(e-t)<1,tEe=(e,t,n)=>{let r;return function(...o){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,o),n)}},nEe=e=>e,rEe=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let o=t;o<=n;o++)r.push(o);return r},oEe=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const o=s=>{const{width:a,height:l}=s;t({width:Math.round(a),height:Math.round(l)})};if(o(n.getBoundingClientRect()),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver(s=>{const a=()=>{const l=s[0];if(l!=null&&l.borderBoxSize){const c=l.borderBoxSize[0];if(c){o({width:c.inlineSize,height:c.blockSize});return}}o(n.getBoundingClientRect())};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},CI={passive:!0},SI=typeof window>"u"?!0:"onscrollend"in window,iEe=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let o=0;const i=e.options.useScrollendEvent&&SI?()=>{}:tEe(r,()=>{t(o,!1)},e.options.isScrollingResetDelay),s=u=>()=>{const{horizontal:d,isRtl:h}=e.options;o=d?n.scrollLeft*(h&&-1||1):n.scrollTop,i(),t(o,u)},a=s(!0),l=s(!1);l(),n.addEventListener("scroll",a,CI);const c=e.options.useScrollendEvent&&SI;return c&&n.addEventListener("scrollend",l,CI),()=>{n.removeEventListener("scroll",a),c&&n.removeEventListener("scrollend",l)}},sEe=(e,t,n)=>{if(t!=null&&t.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return Math.round(e.getBoundingClientRect()[n.options.horizontal?"width":"height"])},aEe=(e,{adjustments:t=0,behavior:n},r)=>{var o,i;const s=e+t;(i=(o=r.scrollElement)==null?void 0:o.scrollTo)==null||i.call(o,{[r.options.horizontal?"left":"top"]:s,behavior:n})};class lEe{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(o=>{o.forEach(i=>{const s=()=>{this._measureElement(i.target,i)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(s):s()})}));return{disconnect:()=>{var o;(o=r())==null||o.disconnect(),n=null},observe:o=>{var i;return(i=r())==null?void 0:i.observe(o,{box:"border-box"})},unobserve:o=>{var i;return(i=r())==null?void 0:i.unobserve(o)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,o])=>{typeof o>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:nEe,rangeExtractor:rEe,onChange:()=>{},measureElement:sEe,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!0,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var r,o;(o=(r=this.options).onChange)==null||o.call(r,this,n)},this.maybeNotify=Lc(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:process.env.NODE_ENV!=="production"&&"maybeNotify",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(o=>{this.observer.observe(o)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(o,i)=>{this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()<o?"forward":"backward":null,this.scrollOffset=o,this.isScrolling=i,this.maybeNotify()}))}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const o=new Map,i=new Map;for(let s=r-1;s>=0;s--){const a=n[s];if(o.has(a.lane))continue;const l=i.get(a.lane);if(l==null||a.end>l.end?i.set(a.lane,a):a.end<l.end&&o.set(a.lane,!0),o.size===this.options.lanes)break}return i.size===this.options.lanes?Array.from(i.values()).sort((s,a)=>s.end===a.end?s.index-a.index:s.end-a.end)[0]:void 0},this.getMeasurementOptions=Lc(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(n,r,o,i,s)=>(this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:r,scrollMargin:o,getItemKey:i,enabled:s}),{key:!1}),this.getMeasurements=Lc(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:o,getItemKey:i,enabled:s},a)=>{if(!s)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(u=>{this.itemSizeCache.set(u.key,u.size)}));const l=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const c=this.measurementsCache.slice(0,l);for(let u=l;u<n;u++){const d=i(u),h=this.options.lanes===1?c[u-1]:this.getFurthestMeasurement(c,u),p=h?h.end+this.options.gap:r+o,g=a.get(d),m=typeof g=="number"?g:this.options.estimateSize(u),b=p+m,y=h?h.lane:u%this.options.lanes;c[u]={index:u,start:p,size:m,end:b,key:d,lane:y}}return this.measurementsCache=c,c},{key:process.env.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=Lc(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,o,i)=>this.range=n.length>0&&r>0?cEe({measurements:n,outerSize:r,scrollOffset:o,lanes:i}):null,{key:process.env.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getVirtualIndexes=Lc(()=>{let n=null,r=null;const o=this.calculateRange();return o&&(n=o.startIndex,r=o.endIndex),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,o,i,s)=>i===null||s===null?[]:n({startIndex:i,endIndex:s,overscan:r,count:o}),{key:process.env.NODE_ENV!=="production"&&"getVirtualIndexes",debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,o=n.getAttribute(r);return o?parseInt(o,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(n,r)=>{const o=this.indexFromElement(n),i=this.measurementsCache[o];if(!i)return;const s=i.key,a=this.elementsCache.get(s);a!==n&&(a&&this.observer.unobserve(a),this.observer.observe(n),this.elementsCache.set(s,n)),n.isConnected&&this.resizeItem(o,this.options.measureElement(n,r,this))},this.resizeItem=(n,r)=>{const o=this.measurementsCache[n];if(!o)return;const i=this.itemSizeCache.get(o.key)??o.size,s=r-i;s!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(o,s,this):o.start<this.getScrollOffset()+this.scrollAdjustments)&&(process.env.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",s),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=s,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(o.index),this.itemSizeCache=new Map(this.itemSizeCache.set(o.key,r)),this.notify(!1))},this.measureElement=n=>{if(!n){this.elementsCache.forEach((r,o)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(o))});return}this._measureElement(n,void 0)},this.getVirtualItems=Lc(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const o=[];for(let i=0,s=n.length;i<s;i++){const a=n[i],l=r[a];o.push(l)}return o},{key:process.env.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return kw(r[Tz(0,r.length-1,o=>kw(r[o]).start,n)])},this.getOffsetForAlignment=(n,r,o=0)=>{const i=this.getSize(),s=this.getScrollOffset();r==="auto"&&(r=n>=s+i?"end":"start"),r==="center"?n+=(o-i)/2:r==="end"&&(n-=i);const a=this.options.horizontal?"scrollWidth":"scrollHeight",c=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[a]:this.scrollElement[a]:0)-i;return Math.max(Math.min(c,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const o=this.measurementsCache[n];if(!o)return;const i=this.getSize(),s=this.getScrollOffset();if(r==="auto")if(o.end>=s+i-this.options.scrollPaddingEnd)r="end";else if(o.start<=s+this.options.scrollPaddingStart)r="start";else return[s,r];const a=r==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,r,o.size),r]},this.isDynamicMode=()=>this.elementsCache.size>0,this.cancelScrollToIndex=()=>{this.scrollToIndexTimeoutId!==null&&this.targetWindow&&(this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId),this.scrollToIndexTimeoutId=null)},this.scrollToOffset=(n,{align:r="start",behavior:o}={})=>{this.cancelScrollToIndex(),o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,r),{adjustments:void 0,behavior:o})},this.scrollToIndex=(n,{align:r="auto",behavior:o}={})=>{n=Math.max(0,Math.min(n,this.options.count-1)),this.cancelScrollToIndex(),o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");const i=this.getOffsetForIndex(n,r);if(!i)return;const[s,a]=i;this._scrollToOffset(s,{adjustments:void 0,behavior:o}),o!=="smooth"&&this.isDynamicMode()&&this.targetWindow&&(this.scrollToIndexTimeoutId=this.targetWindow.setTimeout(()=>{if(this.scrollToIndexTimeoutId=null,this.elementsCache.has(this.options.getItemKey(n))){const[c]=kw(this.getOffsetForIndex(n,a));eEe(c,this.getScrollOffset())||this.scrollToIndex(n,{align:a,behavior:o})}else this.scrollToIndex(n,{align:a,behavior:o})}))},this.scrollBy=(n,{behavior:r}={})=>{this.cancelScrollToIndex(),r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+n,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let o;return r.length===0?o=this.options.paddingStart:o=this.options.lanes===1?((n=r[r.length-1])==null?void 0:n.end)??0:Math.max(...r.slice(-this.options.lanes).map(i=>i.end)),Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:r,behavior:o})=>{this.options.scrollToFn(n,{behavior:o,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(t)}}const Tz=(e,t,n,r)=>{for(;e<=t;){const o=(e+t)/2|0,i=n(o);if(i<r)e=o+1;else if(i>r)t=o-1;else return o}return e>0?e-1:0};function cEe({measurements:e,outerSize:t,scrollOffset:n,lanes:r}){const o=e.length-1;let s=Tz(0,o,l=>e[l].start,n),a=s;for(;a<o&&e[a].end<n+t;)a++;return r>1&&(s=Math.max(0,s-s%r),a=Math.min(o,a+(r-1-a%r))),{startIndex:s,endIndex:a}}const EI=typeof document<"u"?w.useLayoutEffect:w.useEffect;function uEe(e){const t=w.useReducer(()=>({}),{})[1],n={...e,onChange:(o,i)=>{var s;i?rn.flushSync(t):t(),(s=e.onChange)==null||s.call(e,o,i)}},[r]=w.useState(()=>new lEe(n));return r.setOptions(n),EI(()=>r._didMount(),[]),EI(()=>r._willUpdate()),r}function dEe(e){return uEe({observeElementRect:oEe,observeElementOffset:iEe,scrollToFn:aEe,...e})}function fEe(e,t){return e!==null&&t!==null&&typeof e=="object"&&typeof t=="object"&&"id"in e&&"id"in t?e.id===t.id:e===t}function hEe(e=fEe){return R.useCallback((t,n)=>{if(typeof e=="string"){let r=e;return(t==null?void 0:t[r])===(n==null?void 0:n[r])}return e(t,n)},[e])}function pEe(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function _I(e,t=!1){let[n,r]=R.useReducer(()=>({}),{}),o=R.useMemo(()=>pEe(e),[e,n]);return sn(()=>{if(!e)return;let i=new ResizeObserver(r);return i.observe(e),()=>{i.disconnect()}},[e]),t?{width:`${o.width}px`,height:`${o.height}px`}:o}let mEe=class extends Map{constructor(t){super(),this.factory=t}get(t){let n=super.get(t);return n===void 0&&(n=this.factory(t),this.set(t,n)),n}};function jz(e,t){let n=e(),r=new Set;return{getSnapshot(){return n},subscribe(o){return r.add(o),()=>r.delete(o)},dispatch(o,...i){let s=t[o].call(n,...i);s&&(n=s,r.forEach(a=>a()))}}}function Oz(e){return R.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}let gEe=new mEe(()=>jz(()=>[],{ADD(e){return this.includes(e)?this:[...this,e]},REMOVE(e){let t=this.indexOf(e);if(t===-1)return this;let n=this.slice();return n.splice(t,1),n}}));function tk(e,t){let n=gEe.get(t),r=R.useId(),o=Oz(n);if(sn(()=>{if(e)return n.dispatch("ADD",r),()=>n.dispatch("REMOVE",r)},[n,e]),!e)return!1;let i=o.indexOf(r),s=o.length;return i===-1&&(i=s,s+=1),i===s-1}let RS=new Map,Wf=new Map;function RI(e){var t;let n=(t=Wf.get(e))!=null?t:0;return Wf.set(e,n+1),n!==0?()=>kI(e):(RS.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>kI(e))}function kI(e){var t;let n=(t=Wf.get(e))!=null?t:1;if(n===1?Wf.delete(e):Wf.set(e,n-1),n!==1)return;let r=RS.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,RS.delete(e))}function bEe(e,{allowed:t,disallowed:n}={}){let r=tk(e,"inert-others");sn(()=>{var o,i;if(!r)return;let s=Ii();for(let l of(o=n==null?void 0:n())!=null?o:[])l&&s.add(RI(l));let a=(i=t==null?void 0:t())!=null?i:[];for(let l of a){if(!l)continue;let c=Hp(l);if(!c)continue;let u=l.parentElement;for(;u&&u!==c.body;){for(let d of u.children)a.some(h=>d.contains(h))||s.add(RI(d));u=u.parentElement}}return s.dispose},[r,t,n])}function yEe(e,t,n){let r=vc(o=>{let i=o.getBoundingClientRect();i.x===0&&i.y===0&&i.width===0&&i.height===0&&n()});R.useEffect(()=>{if(!e)return;let o=t===null?null:t instanceof HTMLElement?t:t.current;if(!o)return;let i=Ii();if(typeof ResizeObserver<"u"){let s=new ResizeObserver(()=>r.current(o));s.observe(o),i.add(()=>s.disconnect())}if(typeof IntersectionObserver<"u"){let s=new IntersectionObserver(()=>r.current(o));s.observe(o),i.add(()=>s.disconnect())}return()=>i.dispose()},[t,r,e])}let kS=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var vEe=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e[e.AutoFocus=64]="AutoFocus",e))(vEe||{}),xEe=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(xEe||{}),wEe=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(wEe||{}),Fz=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Fz||{});function CEe(e,t=0){var n;return e===((n=Hp(e))==null?void 0:n.body)?!1:ys(t,{0(){return e.matches(kS)},1(){let r=e;for(;r!==null;){if(r.matches(kS))return!0;r=r.parentElement}return!1}})}var SEe=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(SEe||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function EEe(e,t=n=>n){return e.slice().sort((n,r)=>{let o=t(n),i=t(r);if(o===null||i===null)return 0;let s=o.compareDocumentPosition(i);return s&Node.DOCUMENT_POSITION_FOLLOWING?-1:s&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function Lz(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function _Ee(){return/Android/gi.test(window.navigator.userAgent)}function $z(){return Lz()||_Ee()}function Qd(e,t,n,r){let o=vc(n);R.useEffect(()=>{if(!e)return;function i(s){o.current(s)}return document.addEventListener(t,i,r),()=>document.removeEventListener(t,i,r)},[e,t,r])}function REe(e,t,n,r){let o=vc(n);R.useEffect(()=>{if(!e)return;function i(s){o.current(s)}return window.addEventListener(t,i,r),()=>window.removeEventListener(t,i,r)},[e,t,r])}const NI=30;function kEe(e,t,n){let r=tk(e,"outside-click"),o=vc(n),i=R.useCallback(function(l,c){if(l.defaultPrevented)return;let u=c(l);if(u===null||!u.getRootNode().contains(u)||!u.isConnected)return;let d=function h(p){return typeof p=="function"?h(p()):Array.isArray(p)||p instanceof Set?p:[p]}(t);for(let h of d)if(h!==null&&(h.contains(u)||l.composed&&l.composedPath().includes(h)))return;return!CEe(u,Fz.Loose)&&u.tabIndex!==-1&&l.preventDefault(),o.current(l,u)},[o,t]),s=R.useRef(null);Qd(r,"pointerdown",l=>{var c,u;s.current=((u=(c=l.composedPath)==null?void 0:c.call(l))==null?void 0:u[0])||l.target},!0),Qd(r,"mousedown",l=>{var c,u;s.current=((u=(c=l.composedPath)==null?void 0:c.call(l))==null?void 0:u[0])||l.target},!0),Qd(r,"click",l=>{$z()||s.current&&(i(l,()=>s.current),s.current=null)},!0);let a=R.useRef({x:0,y:0});Qd(r,"touchstart",l=>{a.current.x=l.touches[0].clientX,a.current.y=l.touches[0].clientY},!0),Qd(r,"touchend",l=>{let c={x:l.changedTouches[0].clientX,y:l.changedTouches[0].clientY};if(!(Math.abs(c.x-a.current.x)>=NI||Math.abs(c.y-a.current.y)>=NI))return i(l,()=>l.target instanceof HTMLElement?l.target:null)},!0),REe(r,"blur",l=>i(l,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function av(...e){return R.useMemo(()=>Hp(...e),[...e])}function NEe(e,t,n,r){let o=vc(n);R.useEffect(()=>{e=e??window;function i(s){o.current(s)}return e.addEventListener(t,i,r),()=>e.removeEventListener(t,i,r)},[e,t,r])}function zz(e){let t=R.useRef({value:"",selectionStart:null,selectionEnd:null});return NEe(e,"blur",n=>{let r=n.target;r instanceof HTMLInputElement&&(t.current={value:r.value,selectionStart:r.selectionStart,selectionEnd:r.selectionEnd})}),Xe(()=>{if(document.activeElement!==e&&e instanceof HTMLInputElement&&e.isConnected){if(e.focus({preventScroll:!0}),e.value!==t.current.value)e.setSelectionRange(e.value.length,e.value.length);else{let{selectionStart:n,selectionEnd:r}=t.current;n!==null&&r!==null&&e.setSelectionRange(n,r)}t.current={value:"",selectionStart:null,selectionEnd:null}}})}function MEe(e,t){return R.useMemo(()=>{var n;if(e.type)return e.type;let r=(n=e.as)!=null?n:"button";if(typeof r=="string"&&r.toLowerCase()==="button"||(t==null?void 0:t.tagName)==="BUTTON"&&!t.hasAttribute("type"))return"button"},[e.type,e.as,t])}function PEe(){let e;return{before({doc:t}){var n;let r=t.documentElement,o=(n=t.defaultView)!=null?n:window;e=Math.max(0,o.innerWidth-r.clientWidth)},after({doc:t,d:n}){let r=t.documentElement,o=Math.max(0,r.clientWidth-r.offsetWidth),i=Math.max(0,e-o);n.style(r,"paddingRight",`${i}px`)}}}function DEe(){return Lz()?{before({doc:e,d:t,meta:n}){function r(o){return n.containers.flatMap(i=>i()).some(i=>i.contains(o))}t.microTask(()=>{var o;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let a=Ii();a.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>a.dispose()))}let i=(o=window.scrollY)!=null?o:window.pageYOffset,s=null;t.addEventListener(e,"click",a=>{if(a.target instanceof HTMLElement)try{let l=a.target.closest("a");if(!l)return;let{hash:c}=new URL(l.href),u=e.querySelector(c);u&&!r(u)&&(s=u)}catch{}},!0),t.addEventListener(e,"touchstart",a=>{if(a.target instanceof HTMLElement)if(r(a.target)){let l=a.target;for(;l.parentElement&&r(l.parentElement);)l=l.parentElement;t.style(l,"overscrollBehavior","contain")}else t.style(a.target,"touchAction","none")}),t.addEventListener(e,"touchmove",a=>{if(a.target instanceof HTMLElement){if(a.target.tagName==="INPUT")return;if(r(a.target)){let l=a.target;for(;l.parentElement&&l.dataset.headlessuiPortal!==""&&!(l.scrollHeight>l.clientHeight||l.scrollWidth>l.clientWidth);)l=l.parentElement;l.dataset.headlessuiPortal===""&&a.preventDefault()}else a.preventDefault()}},{passive:!1}),t.add(()=>{var a;let l=(a=window.scrollY)!=null?a:window.pageYOffset;i!==l&&window.scrollTo(0,i),s&&s.isConnected&&(s.scrollIntoView({block:"nearest"}),s=null)})})}}:{}}function AEe(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function IEe(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let pl=jz(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:Ii(),meta:new Set};return r.count++,r.meta.add(t),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t)),this},SCROLL_PREVENT({doc:e,d:t,meta:n}){let r={doc:e,d:t,meta:IEe(n)},o=[DEe(),PEe(),AEe()];o.forEach(({before:i})=>i==null?void 0:i(r)),o.forEach(({after:i})=>i==null?void 0:i(r))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});pl.subscribe(()=>{let e=pl.getSnapshot(),t=new Map;for(let[n]of e)t.set(n,n.documentElement.style.overflow);for(let n of e.values()){let r=t.get(n.doc)==="hidden",o=n.count!==0;(o&&!r||!o&&r)&&pl.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&pl.dispatch("TEARDOWN",n)}});function TEe(e,t,n=()=>({containers:[]})){let r=Oz(pl),o=t?r.get(t):void 0,i=o?o.count>0:!1;return sn(()=>{if(!(!t||!e))return pl.dispatch("PUSH",t,n),()=>pl.dispatch("POP",t,n)},[e,t]),i}function jEe(e,t,n=()=>[document.body]){let r=tk(e,"scroll-lock");TEe(r,t,o=>{var i;return{containers:[...(i=o.containers)!=null?i:[],n]}})}function MI(e){return[e.screenX,e.screenY]}function OEe(){let e=R.useRef([-1,-1]);return{wasMoved(t){let n=MI(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=MI(t)}}}function FEe(e=0){let[t,n]=R.useState(e),r=R.useCallback(l=>n(l),[t]),o=R.useCallback(l=>n(c=>c|l),[t]),i=R.useCallback(l=>(t&l)===l,[t]),s=R.useCallback(l=>n(c=>c&~l),[n]),a=R.useCallback(l=>n(c=>c^l),[n]);return{flags:t,setFlag:r,addFlag:o,hasFlag:i,removeFlag:s,toggleFlag:a}}var PI,DI;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((PI=process==null?void 0:process.env)==null?void 0:PI.NODE_ENV)==="test"&&typeof((DI=Element==null?void 0:Element.prototype)==null?void 0:DI.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
|
|
560
|
-
`)),[]});var LEe=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(LEe||{});function $Ee(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function zEe(e,t,n,r){let[o,i]=R.useState(n),{hasFlag:s,addFlag:a,removeFlag:l}=FEe(e&&o?3:0),c=R.useRef(!1),u=R.useRef(!1),d=Wp();return sn(()=>{var h;if(e){if(n&&i(!0),!t){n&&a(3);return}return(h=void 0)==null||h.call(r,n),BEe(t,{inFlight:c,prepare(){u.current?u.current=!1:u.current=c.current,c.current=!0,!u.current&&(n?(a(3),l(4)):(a(4),l(2)))},run(){u.current?n?(l(3),a(4)):(l(4),a(3)):n?l(1):a(1)},done(){var p;u.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(c.current=!1,l(7),n||i(!1),(p=void 0)==null||p.call(r,n))}})}},[e,n,t,d]),e?[o,{closed:s(1),enter:s(2),leave:s(4),transition:s(2)||s(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function BEe(e,{prepare:t,run:n,done:r,inFlight:o}){let i=Ii();return HEe(e,{prepare:t,inFlight:o}),i.nextFrame(()=>{n(),i.requestAnimationFrame(()=>{i.add(VEe(e,r))})}),i.dispose}function VEe(e,t){var n,r;let o=Ii();if(!e)return o.dispose;let i=!1;o.add(()=>{i=!0});let s=(r=(n=e.getAnimations)==null?void 0:n.call(e).filter(a=>a instanceof CSSTransition))!=null?r:[];return s.length===0?(t(),o.dispose):(Promise.allSettled(s.map(a=>a.finished)).then(()=>{i||t()}),o.dispose)}function HEe(e,{inFlight:t,prepare:n}){if(t!=null&&t.current){n();return}let r=e.style.transition;e.style.transition="none",n(),e.offsetHeight,e.style.transition=r}function WEe(e,{container:t,accept:n,walk:r}){let o=R.useRef(n),i=R.useRef(r);R.useEffect(()=>{o.current=n,i.current=r},[n,r]),sn(()=>{if(!t||!e)return;let s=Hp(t);if(!s)return;let a=o.current,l=i.current,c=Object.assign(d=>a(d),{acceptNode:a}),u=s.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,c,!1);for(;u.nextNode();)l(u.currentNode)},[t,e,o,i])}function AI(e,t){let n=R.useRef([]),r=Xe(e);R.useEffect(()=>{let o=[...n.current];for(let[i,s]of t.entries())if(n.current[i]!==s){let a=r(t,o);return n.current=t,a}},[r,...t])}function UEe(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}const Bz={...w},GEe=Bz.useInsertionEffect,qEe=GEe||(e=>e());function Vz(e){const t=w.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return qEe(()=>{t.current=e}),w.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}var NS=typeof document<"u"?R.useLayoutEffect:R.useEffect;let II=!1,YEe=0;const TI=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+YEe++;function KEe(){const[e,t]=w.useState(()=>II?TI():void 0);return NS(()=>{e==null&&t(TI())},[]),w.useEffect(()=>{II=!0},[]),e}const XEe=Bz.useId,QEe=XEe||KEe;let Mh;process.env.NODE_ENV!=="production"&&(Mh=new Set);function ZEe(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=Mh)!=null&&e.has(o))){var i;(i=Mh)==null||i.add(o),console.warn(o)}}function JEe(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=Mh)!=null&&e.has(o))){var i;(i=Mh)==null||i.add(o),console.error(o)}}function e2e(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,((r=e.get(t))==null?void 0:r.filter(o=>o!==n))||[])}}}const t2e=w.createContext(null),n2e=w.createContext(null),r2e=()=>{var e;return((e=w.useContext(t2e))==null?void 0:e.id)||null},o2e=()=>w.useContext(n2e),i2e="data-floating-ui-focusable";function s2e(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=QEe(),i=w.useRef({}),[s]=w.useState(()=>e2e()),a=r2e()!=null;if(process.env.NODE_ENV!=="production"){const p=r.reference;p&&!Qn(p)&&JEe("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[l,c]=w.useState(r.reference),u=Vz((p,g,m)=>{i.current.openEvent=p?g:void 0,s.emit("openchange",{open:p,event:g,reason:m,nested:a}),n==null||n(p,g,m)}),d=w.useMemo(()=>({setPositionReference:c}),[]),h=w.useMemo(()=>({reference:l||r.reference||null,floating:r.floating||null,domReference:r.reference}),[l,r.reference,r.floating]);return w.useMemo(()=>({dataRef:i,open:t,onOpenChange:u,elements:h,events:s,floatingId:o,refs:d}),[t,u,h,s,o,d])}function a2e(e){e===void 0&&(e={});const{nodeId:t}=e,n=s2e({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[i,s]=w.useState(null),[a,l]=w.useState(null),u=(o==null?void 0:o.domReference)||i,d=w.useRef(null),h=o2e();NS(()=>{u&&(d.current=u)},[u]);const p=Y2({...e,elements:{...o,...a&&{reference:a}}}),g=w.useCallback(x=>{const S=Qn(x)?{getBoundingClientRect:()=>x.getBoundingClientRect(),contextElement:x}:x;l(S),p.refs.setReference(S)},[p.refs]),m=w.useCallback(x=>{(Qn(x)||x===null)&&(d.current=x,s(x)),(Qn(p.refs.reference.current)||p.refs.reference.current===null||x!==null&&!Qn(x))&&p.refs.setReference(x)},[p.refs]),b=w.useMemo(()=>({...p.refs,setReference:m,setPositionReference:g,domReference:d}),[p.refs,m,g]),y=w.useMemo(()=>({...p.elements,domReference:u}),[p.elements,u]),v=w.useMemo(()=>({...p,...r,refs:b,elements:y,nodeId:t}),[p,b,y,t,r]);return NS(()=>{r.dataRef.current.floatingContext=v;const x=h==null?void 0:h.nodesRef.current.find(S=>S.id===t);x&&(x.context=v)}),w.useMemo(()=>({...p,context:v,refs:b,elements:y}),[p,b,y,v])}const jI="active",OI="selected";function Nw(e,t,n){const r=new Map,o=n==="item";let i=e;if(o&&e){const{[jI]:s,[OI]:a,...l}=e;i=l}return{...n==="floating"&&{tabIndex:-1,[i2e]:""},...i,...t.map(s=>{const a=s?s[n]:null;return typeof a=="function"?e?a(e):null:a}).concat(e).reduce((s,a)=>(a&&Object.entries(a).forEach(l=>{let[c,u]=l;if(!(o&&[jI,OI].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof u=="function"){var d;(d=r.get(c))==null||d.push(u),s[c]=function(){for(var h,p=arguments.length,g=new Array(p),m=0;m<p;m++)g[m]=arguments[m];return(h=r.get(c))==null?void 0:h.map(b=>b(...g)).find(b=>b!==void 0)}}}else s[c]=u}),s),{})}}function l2e(e){e===void 0&&(e=[]);const t=e.map(a=>a==null?void 0:a.reference),n=e.map(a=>a==null?void 0:a.floating),r=e.map(a=>a==null?void 0:a.item),o=w.useCallback(a=>Nw(a,e,"reference"),t),i=w.useCallback(a=>Nw(a,e,"floating"),n),s=w.useCallback(a=>Nw(a,e,"item"),r);return w.useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:s}),[o,i,s])}function FI(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const c2e=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:i=0,index:s=0,minItemsVisible:a=4,referenceOverflowThreshold:l=0,scrollRef:c,...u}=Ni(e,t),{rects:d,elements:{floating:h}}=t,p=n.current[s],g=(c==null?void 0:c.current)||h,m=h.clientTop||g.clientTop,b=h.clientTop!==0,y=g.clientTop!==0,v=h===g;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||ZEe('`placement` side must be "bottom" when using the `inner`',"middleware.")),!p)return{};const x={...t,...await hy(-p.offsetTop-h.clientTop-d.reference.height/2-p.offsetHeight/2-i).fn(t)},S=await Sx(FI(x,g.scrollHeight+m+h.clientTop),u),_=await Sx(x,{...u,elementContext:"reference"}),E=Xn(0,S.top),C=x.y+E,M=(g.scrollHeight>g.clientHeight?A=>A:uh)(Xn(0,g.scrollHeight+(b&&v||y?m*2:0)-E-Xn(0,S.bottom)));if(g.style.maxHeight=M+"px",g.scrollTop=E,o){const A=g.offsetHeight<p.offsetHeight*ws(a,n.current.length)-1||_.top>=-l||_.bottom>=-l;vs.flushSync(()=>o(A))}return r&&(r.current=await Sx(FI({...x,y:C},g.offsetHeight+m+h.clientTop),u)),{y:C}}});function u2e(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:i,scrollRef:s,onChange:a}=t,l=Vz(a),c=w.useRef(!1),u=w.useRef(null),d=w.useRef(null);w.useEffect(()=>{if(!o)return;function p(m){if(m.ctrlKey||!g||i.current==null)return;const b=m.deltaY,y=i.current.top>=-.5,v=i.current.bottom>=-.5,x=g.scrollHeight-g.clientHeight,S=b<0?-1:1,_=b<0?"max":"min";g.scrollHeight<=g.clientHeight||(!y&&b>0||!v&&b<0?(m.preventDefault(),vs.flushSync(()=>{l(E=>E+Math[_](b,x*S))})):/firefox/i.test(UEe())&&(g.scrollTop+=b))}const g=(s==null?void 0:s.current)||r.floating;if(n&&g)return g.addEventListener("wheel",p),requestAnimationFrame(()=>{u.current=g.scrollTop,i.current!=null&&(d.current={...i.current})}),()=>{u.current=null,d.current=null,g.removeEventListener("wheel",p)}},[o,n,r.floating,i,s,l]);const h=w.useMemo(()=>({onKeyDown(){c.current=!0},onWheel(){c.current=!1},onPointerMove(){c.current=!1},onScroll(){const p=(s==null?void 0:s.current)||r.floating;if(!(!i.current||!p||!c.current)){if(u.current!==null){const g=p.scrollTop-u.current;(i.current.bottom<-.5&&g<-1||i.current.top<-.5&&g>1)&&vs.flushSync(()=>l(m=>m+g))}requestAnimationFrame(()=>{u.current=p.scrollTop})}}}),[r.floating,l,i,s]);return w.useMemo(()=>o?{floating:h}:{},[o,h])}let Up=R.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Up.displayName="FloatingContext";let nk=R.createContext(null);nk.displayName="PlacementContext";function d2e(e){return R.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function f2e(){return R.useContext(Up).setReference}function h2e(){let{getFloatingProps:e,slot:t}=R.useContext(Up);return R.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function p2e(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=R.useContext(nk),n=R.useMemo(()=>e,[JSON.stringify(e,(o,i)=>{var s;return(s=i==null?void 0:i.outerHTML)!=null?s:i})]);sn(()=>{t==null||t(n??null)},[t,n]);let r=R.useContext(Up);return R.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let LI=4;function m2e({children:e,enabled:t=!0}){let[n,r]=R.useState(null),[o,i]=R.useState(0),s=R.useRef(null),[a,l]=R.useState(null);g2e(a);let c=t&&n!==null&&a!==null,{to:u="bottom",gap:d=0,offset:h=0,padding:p=0,inner:g}=b2e(n,a),[m,b="center"]=u.split(" ");sn(()=>{c&&i(0)},[c]);let{refs:y,floatingStyles:v,context:x}=a2e({open:c,placement:m==="selection"?b==="center"?"bottom":`bottom-${b}`:b==="center"?`${m}`:`${m}-${b}`,strategy:"absolute",transform:!1,middleware:[hy({mainAxis:m==="selection"?0:d,crossAxis:h}),K2({padding:p}),m!=="selection"&&X2({padding:p}),m==="selection"&&g?c2e({...g,padding:p,overflowRef:s,offset:o,minItemsVisible:LI,referenceOverflowThreshold:p,onFallbackChange(A){var P,j;if(!A)return;let F=x.elements.floating;if(!F)return;let I=parseFloat(getComputedStyle(F).scrollPaddingBottom)||0,O=Math.min(LI,F.childElementCount),$=0,B=0;for(let z of(j=(P=x.elements.floating)==null?void 0:P.childNodes)!=null?j:[])if(z instanceof HTMLElement){let T=z.offsetTop,W=T+z.clientHeight+I,L=F.scrollTop,D=L+F.clientHeight;if(T>=L&&W<=D)O--;else{B=Math.max(0,Math.min(W,D)-Math.max(T,L)),$=z.clientHeight;break}}O>=1&&i(z=>{let T=$*O-B+I;return z>=T?z:T})}}):null,Q2({padding:p,apply({availableWidth:A,availableHeight:P,elements:j}){Object.assign(j.floating.style,{overflow:"auto",maxWidth:`${A}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${P}px)`})}})].filter(Boolean),whileElementsMounted:q2}),[S=m,_=b]=x.placement.split("-");m==="selection"&&(S="selection");let E=R.useMemo(()=>({anchor:[S,_].filter(Boolean).join(" ")}),[S,_]),C=u2e(x,{overflowRef:s,onChange:i}),{getReferenceProps:k,getFloatingProps:N}=l2e([C]),M=Xe(A=>{l(A),y.setFloating(A)});return w.createElement(nk.Provider,{value:r},w.createElement(Up.Provider,{value:{setFloating:M,setReference:y.setReference,styles:v,getReferenceProps:k,getFloatingProps:N,slot:E}},e))}function g2e(e){sn(()=>{if(!e)return;let t=new MutationObserver(()=>{let n=window.getComputedStyle(e).maxHeight,r=parseFloat(n);if(isNaN(r))return;let o=parseInt(n);isNaN(o)||r!==o&&(e.style.maxHeight=`${Math.ceil(r)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}function b2e(e,t){var n,r,o;let i=Mw((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),s=Mw((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),a=Mw((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:i,offset:s,padding:a}}function Mw(e,t,n=void 0){let r=Wp(),o=Xe((l,c)=>{if(l==null)return[n,null];if(typeof l=="number")return[l,null];if(typeof l=="string"){if(!c)return[n,null];let u=$I(l,c);return[u,d=>{let h=Hz(l);{let p=h.map(g=>window.getComputedStyle(c).getPropertyValue(g));r.requestAnimationFrame(function g(){r.nextFrame(g);let m=!1;for(let[y,v]of h.entries()){let x=window.getComputedStyle(c).getPropertyValue(v);if(p[y]!==x){p[y]=x,m=!0;break}}if(!m)return;let b=$I(l,c);u!==b&&(d(b),u=b)})}return r.dispose}]}return[n,null]}),i=R.useMemo(()=>o(e,t)[0],[e,t]),[s=i,a]=R.useState();return sn(()=>{let[l,c]=o(e,t);if(a(l),!!c)return c(a)},[e,t]),s}function Hz(e){let t=/var\((.*)\)/.exec(e);if(t){let n=t[1].indexOf(",");if(n===-1)return[t[1]];let r=t[1].slice(0,n).trim(),o=t[1].slice(n+1).trim();return o?[r,...Hz(o)]:[r]}return[]}function $I(e,t){let n=document.createElement("div");t.appendChild(n),n.style.setProperty("margin-top","0px","important"),n.style.setProperty("margin-top",e,"important");let r=parseFloat(window.getComputedStyle(n).marginTop)||0;return t.removeChild(n),r}function y2e({children:e,freeze:t}){let n=MS(t,e);return R.createElement(R.Fragment,null,n)}function MS(e,t){let[n,r]=R.useState(t);return!e&&n!==t&&r(t),e?n:t}let rk=R.createContext(null);rk.displayName="OpenClosedContext";var Ph=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Ph||{});function v2e(){return R.useContext(rk)}function x2e({value:e,children:t}){return R.createElement(rk.Provider,{value:e},t)}function w2e(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let al=[];w2e(()=>{function e(t){if(!(t.target instanceof HTMLElement)||t.target===document.body||al[0]===t.target)return;let n=t.target;n=n.closest(kS),al.unshift(n??t.target),al=al.filter(r=>r!=null&&r.isConnected),al.splice(10)}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})});function C2e(e){throw new Error("Unexpected object: "+e)}var Sn=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(Sn||{});function zI(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),o=r??-1;switch(e.focus){case 0:{for(let i=0;i<n.length;++i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 1:{o===-1&&(o=n.length);for(let i=o-1;i>=0;--i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 2:{for(let i=o+1;i<n.length;++i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 3:{for(let i=n.length-1;i>=0;--i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 4:{for(let i=0;i<n.length;++i)if(t.resolveId(n[i],i,n)===e.id)return i;return r}case 5:return null;default:C2e(e)}}var ok=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(ok||{});function S2e(e){let t=Xe(e),n=R.useRef(!1);R.useEffect(()=>(n.current=!1,()=>{n.current=!0,Ez(()=>{n.current&&t()})}),[t])}function E2e(){let e=typeof document>"u";return"useSyncExternalStore"in w?(t=>t.useSyncExternalStore)(w)(()=>()=>{},()=>!1,()=>!e):!1}function _2e(){let e=E2e(),[t,n]=w.useState(Ol.isHandoffComplete);return t&&Ol.isHandoffComplete===!1&&n(!1),w.useEffect(()=>{t!==!0&&n(!0)},[t]),w.useEffect(()=>Ol.handoff(),[]),e?!1:t}let R2e=R.createContext(!1);function k2e(){return R.useContext(R2e)}function N2e(e){let t=k2e(),n=R.useContext(Uz),r=av(e),[o,i]=R.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(Ol.isServer)return null;let a=r==null?void 0:r.getElementById("headlessui-portal-root");if(a)return a;if(r===null)return null;let l=r.createElement("div");return l.setAttribute("id","headlessui-portal-root"),r.body.appendChild(l)});return R.useEffect(()=>{o!==null&&(r!=null&&r.body.contains(o)||r==null||r.body.appendChild(o))},[o,r]),R.useEffect(()=>{t||n!==null&&i(n.current)},[n,i,t]),o}let Wz=R.Fragment,M2e=ti(function(e,t){let n=e,r=R.useRef(null),o=Ms(WSe(d=>{r.current=d}),t),i=av(r),s=N2e(r),[a]=R.useState(()=>{var d;return Ol.isServer?null:(d=i==null?void 0:i.createElement("div"))!=null?d:null}),l=R.useContext(I2e),c=_2e();sn(()=>{!s||!a||s.contains(a)||(a.setAttribute("data-headlessui-portal",""),s.appendChild(a))},[s,a]),sn(()=>{if(a&&l)return l.register(a)},[l,a]),S2e(()=>{var d;!s||!a||(a instanceof Node&&s.contains(a)&&s.removeChild(a),s.childNodes.length<=0&&((d=s.parentElement)==null||d.removeChild(s)))});let u=ei();return c?!s||!a?null:rn.createPortal(u({ourProps:{ref:o},theirProps:n,slot:{},defaultTag:Wz,name:"Portal"}),a):null});function P2e(e,t){let n=Ms(t),{enabled:r=!0,...o}=e,i=ei();return r?R.createElement(M2e,{...o,ref:n}):i({ourProps:{ref:n},theirProps:o,slot:{},defaultTag:Wz,name:"Portal"})}let D2e=R.Fragment,Uz=R.createContext(null);function A2e(e,t){let{target:n,...r}=e,o={ref:Ms(t)},i=ei();return R.createElement(Uz.Provider,{value:n},i({ourProps:o,theirProps:r,defaultTag:D2e,name:"Popover.Group"}))}let I2e=R.createContext(null),T2e=ti(P2e),j2e=ti(A2e),O2e=Object.assign(T2e,{Group:j2e});var F2e=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(F2e||{}),L2e=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(L2e||{}),$2e=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))($2e||{}),z2e=(e=>(e[e.OpenCombobox=0]="OpenCombobox",e[e.CloseCombobox=1]="CloseCombobox",e[e.GoToOption=2]="GoToOption",e[e.SetTyping=3]="SetTyping",e[e.RegisterOption=4]="RegisterOption",e[e.UnregisterOption=5]="UnregisterOption",e[e.SetActivationTrigger=6]="SetActivationTrigger",e[e.UpdateVirtualConfiguration=7]="UpdateVirtualConfiguration",e[e.SetInputElement=8]="SetInputElement",e[e.SetButtonElement=9]="SetButtonElement",e[e.SetOptionsElement=10]="SetOptionsElement",e))(z2e||{});function Pw(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=t(e.options.slice()),o=r.length>0&&r[0].dataRef.current.order!==null?r.sort((s,a)=>s.dataRef.current.order-a.dataRef.current.order):EEe(r,s=>s.dataRef.current.domRef.current),i=n?o.indexOf(n):null;return i===-1&&(i=null),{options:o,activeOptionIndex:i}}let B2e={1(e){var t;return(t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===1?e:{...e,activeOptionIndex:null,comboboxState:1,isTyping:!1,activationTrigger:2,__demoMode:!1}},0(e){var t,n;if((t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===0)return e;if((n=e.dataRef.current)!=null&&n.value){let r=e.dataRef.current.calculateIndex(e.dataRef.current.value);if(r!==-1)return{...e,activeOptionIndex:r,comboboxState:0,__demoMode:!1}}return{...e,comboboxState:0,__demoMode:!1}},3(e,t){return e.isTyping===t.isTyping?e:{...e,isTyping:t.isTyping}},2(e,t){var n,r,o,i;if((n=e.dataRef.current)!=null&&n.disabled||e.optionsElement&&!((r=e.dataRef.current)!=null&&r.optionsPropsRef.current.static)&&e.comboboxState===1)return e;if(e.virtual){let{options:c,disabled:u}=e.virtual,d=t.focus===Sn.Specific?t.idx:zI(t,{resolveItems:()=>c,resolveActiveIndex:()=>{var p,g;return(g=(p=e.activeOptionIndex)!=null?p:c.findIndex(m=>!u(m)))!=null?g:null},resolveDisabled:u,resolveId(){throw new Error("Function not implemented.")}}),h=(o=t.trigger)!=null?o:2;return e.activeOptionIndex===d&&e.activationTrigger===h?e:{...e,activeOptionIndex:d,activationTrigger:h,isTyping:!1,__demoMode:!1}}let s=Pw(e);if(s.activeOptionIndex===null){let c=s.options.findIndex(u=>!u.dataRef.current.disabled);c!==-1&&(s.activeOptionIndex=c)}let a=t.focus===Sn.Specific?t.idx:zI(t,{resolveItems:()=>s.options,resolveActiveIndex:()=>s.activeOptionIndex,resolveId:c=>c.id,resolveDisabled:c=>c.dataRef.current.disabled}),l=(i=t.trigger)!=null?i:2;return e.activeOptionIndex===a&&e.activationTrigger===l?e:{...e,...s,isTyping:!1,activeOptionIndex:a,activationTrigger:l,__demoMode:!1}},4:(e,t)=>{var n,r,o;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:[...e.options,t.payload]};let i=t.payload,s=Pw(e,l=>(l.push(i),l));e.activeOptionIndex===null&&(r=e.dataRef.current)!=null&&r.isSelected(t.payload.dataRef.current.value)&&(s.activeOptionIndex=s.options.indexOf(i));let a={...e,...s,activationTrigger:2};return(o=e.dataRef.current)!=null&&o.__demoMode&&e.dataRef.current.value===void 0&&(a.activeOptionIndex=0),a},5:(e,t)=>{var n;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:e.options.filter(o=>o.id!==t.id)};let r=Pw(e,o=>{let i=o.findIndex(s=>s.id===t.id);return i!==-1&&o.splice(i,1),o});return{...e,...r,activationTrigger:2}},6:(e,t)=>e.activationTrigger===t.trigger?e:{...e,activationTrigger:t.trigger},7:(e,t)=>{var n,r;if(e.virtual===null)return{...e,virtual:{options:t.options,disabled:(n=t.disabled)!=null?n:()=>!1}};if(e.virtual.options===t.options&&e.virtual.disabled===t.disabled)return e;let o=e.activeOptionIndex;if(e.activeOptionIndex!==null){let i=t.options.indexOf(e.virtual.options[e.activeOptionIndex]);i!==-1?o=i:o=null}return{...e,activeOptionIndex:o,virtual:{options:t.options,disabled:(r=t.disabled)!=null?r:()=>!1}}},8:(e,t)=>e.inputElement===t.element?e:{...e,inputElement:t.element},9:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},10:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element}},ik=R.createContext(null);ik.displayName="ComboboxActionsContext";function Gp(e){let t=R.useContext(ik);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Gp),n}return t}let Gz=R.createContext(null);function V2e(e){let t=Md("VirtualProvider"),{options:n}=t.virtual,[r,o]=R.useMemo(()=>{let c=t.optionsElement;if(!c)return[0,0];let u=window.getComputedStyle(c);return[parseFloat(u.paddingBlockStart||u.paddingTop),parseFloat(u.paddingBlockEnd||u.paddingBottom)]},[t.optionsElement]),i=dEe({enabled:n.length!==0,scrollPaddingStart:r,scrollPaddingEnd:o,count:n.length,estimateSize(){return 40},getScrollElement(){return t.optionsElement},overscan:12}),[s,a]=R.useState(0);sn(()=>{a(c=>c+1)},[n]);let l=i.getVirtualItems();return l.length===0?null:R.createElement(Gz.Provider,{value:i},R.createElement("div",{style:{position:"relative",width:"100%",height:`${i.getTotalSize()}px`},ref:c=>{c&&t.activationTrigger!==0&&t.activeOptionIndex!==null&&n.length>t.activeOptionIndex&&i.scrollToIndex(t.activeOptionIndex)}},l.map(c=>{var u;return R.createElement(R.Fragment,{key:c.key},R.cloneElement((u=e.children)==null?void 0:u.call(e,{...e.slot,option:n[c.index]}),{key:`${s}-${c.key}`,"data-index":c.index,"aria-setsize":n.length,"aria-posinset":c.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${c.start}px)`,overflowAnchor:"none"}}))})))}let Dh=R.createContext(null);Dh.displayName="ComboboxDataContext";function Md(e){let t=R.useContext(Dh);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Md),n}return t}function H2e(e,t){return ys(t.type,B2e,e,t)}let W2e=R.Fragment;function U2e(e,t){var n,r;let o=QR(),{value:i,defaultValue:s,onChange:a,form:l,name:c,by:u,disabled:d=o||!1,onClose:h,__demoMode:p=!1,multiple:g=!1,immediate:m=!1,virtual:b=null,nullable:y,...v}=e,x=TSe(s),[S=g?[]:void 0,_]=ISe(i,a,x),[E,C]=R.useReducer(H2e,{dataRef:R.createRef(),comboboxState:p?0:1,isTyping:!1,options:[],virtual:b?{options:b.options,disabled:(n=b.disabled)!=null?n:()=>!1}:null,activeOptionIndex:null,activationTrigger:2,inputElement:null,buttonElement:null,optionsElement:null,__demoMode:p}),k=R.useRef(!1),N=R.useRef({static:!1,hold:!1}),M=hEe(u),A=Xe(te=>b?u===null?b.options.indexOf(te):b.options.findIndex(le=>M(le,te)):E.options.findIndex(le=>M(le.dataRef.current.value,te))),P=R.useCallback(te=>ys(F.mode,{1:()=>S.some(le=>M(le,te)),0:()=>M(S,te)}),[S]),j=Xe(te=>E.activeOptionIndex===A(te)),F=R.useMemo(()=>({...E,immediate:m,optionsPropsRef:N,value:S,defaultValue:x,disabled:d,mode:g?1:0,virtual:b?E.virtual:null,get activeOptionIndex(){if(k.current&&E.activeOptionIndex===null&&(b?b.options.length>0:E.options.length>0)){if(b){let le=b.options.findIndex(ue=>{var Re,be;return!((be=(Re=b.disabled)==null?void 0:Re.call(b,ue))!=null&&be)});if(le!==-1)return le}let te=E.options.findIndex(le=>!le.dataRef.current.disabled);if(te!==-1)return te}return E.activeOptionIndex},calculateIndex:A,compare:M,isSelected:P,isActive:j}),[S,x,d,g,p,E,b]);sn(()=>{var te;b&&C({type:7,options:b.options,disabled:(te=b.disabled)!=null?te:null})},[b,b==null?void 0:b.options,b==null?void 0:b.disabled]),sn(()=>{E.dataRef.current=F},[F]);let I=F.comboboxState===0;kEe(I,[F.buttonElement,F.inputElement,F.optionsElement],()=>Y.closeCombobox());let O=R.useMemo(()=>{var te,le,ue;return{open:F.comboboxState===0,disabled:d,activeIndex:F.activeOptionIndex,activeOption:F.activeOptionIndex===null?null:F.virtual?F.virtual.options[(te=F.activeOptionIndex)!=null?te:0]:(ue=(le=F.options[F.activeOptionIndex])==null?void 0:le.dataRef.current.value)!=null?ue:null,value:S}},[F,d,S]),$=Xe(()=>{if(F.activeOptionIndex!==null){if(Y.setIsTyping(!1),F.virtual)D(F.virtual.options[F.activeOptionIndex]);else{let{dataRef:te}=F.options[F.activeOptionIndex];D(te.current.value)}Y.goToOption(Sn.Specific,F.activeOptionIndex)}}),B=Xe(()=>{C({type:0}),k.current=!0}),z=Xe(()=>{C({type:1}),k.current=!1,h==null||h()}),T=Xe(te=>{C({type:3,isTyping:te})}),W=Xe((te,le,ue)=>(k.current=!1,te===Sn.Specific?C({type:2,focus:Sn.Specific,idx:le,trigger:ue}):C({type:2,focus:te,trigger:ue}))),L=Xe((te,le)=>(C({type:4,payload:{id:te,dataRef:le}}),()=>{F.isActive(le.current.value)&&(k.current=!0),C({type:5,id:te})})),D=Xe(te=>ys(F.mode,{0(){return _==null?void 0:_(te)},1(){let le=F.value.slice(),ue=le.findIndex(Re=>M(Re,te));return ue===-1?le.push(te):le.splice(ue,1),_==null?void 0:_(le)}})),H=Xe(te=>{C({type:6,trigger:te})}),V=Xe(te=>{C({type:8,element:te})}),q=Xe(te=>{C({type:9,element:te})}),U=Xe(te=>{C({type:10,element:te})}),Y=R.useMemo(()=>({onChange:D,registerOption:L,goToOption:W,setIsTyping:T,closeCombobox:z,openCombobox:B,setActivationTrigger:H,selectActiveOption:$,setInputElement:V,setButtonElement:q,setOptionsElement:U}),[]),[K,Z]=KSe(),ee=t===null?{}:{ref:t},Q=R.useCallback(()=>{if(x!==void 0)return _==null?void 0:_(x)},[_,x]),ie=ei();return R.createElement(Z,{value:K,props:{htmlFor:(r=F.inputElement)==null?void 0:r.id},slot:{open:F.comboboxState===0,disabled:d}},R.createElement(m2e,null,R.createElement(ik.Provider,{value:Y},R.createElement(Dh.Provider,{value:F},R.createElement(x2e,{value:ys(F.comboboxState,{0:Ph.Open,1:Ph.Closed})},c!=null&&R.createElement($Se,{disabled:d,data:S!=null?{[c]:S}:{},form:l,onReset:Q}),ie({ourProps:ee,theirProps:v,slot:O,defaultTag:W2e,name:"Combobox"}))))))}let G2e="input";function q2e(e,t){var n,r,o,i,s;let a=Md("Combobox.Input"),l=Gp("Combobox.Input"),c=R.useId(),u=Pz(),{id:d=u||`headlessui-combobox-input-${c}`,onChange:h,displayValue:p,disabled:g=a.disabled||!1,autoFocus:m=!1,type:b="text",...y}=e,v=R.useRef(null),x=Ms(v,t,f2e(),l.setInputElement),S=av(a.inputElement),_=Wp(),E=Xe(()=>{l.onChange(null),a.optionsElement&&(a.optionsElement.scrollTop=0),l.goToOption(Sn.Nothing)}),C=R.useMemo(()=>{var D;return typeof p=="function"&&a.value!==void 0?(D=p(a.value))!=null?D:"":typeof a.value=="string"?a.value:""},[a.value,p]);AI(([D,H],[V,q])=>{if(a.isTyping)return;let U=v.current;U&&((q===0&&H===1||D!==V)&&(U.value=D),requestAnimationFrame(()=>{if(a.isTyping||!U||(S==null?void 0:S.activeElement)!==U)return;let{selectionStart:Y,selectionEnd:K}=U;Math.abs((K??0)-(Y??0))===0&&Y===0&&U.setSelectionRange(U.value.length,U.value.length)}))},[C,a.comboboxState,S,a.isTyping]),AI(([D],[H])=>{if(D===0&&H===1){if(a.isTyping)return;let V=v.current;if(!V)return;let q=V.value,{selectionStart:U,selectionEnd:Y,selectionDirection:K}=V;V.value="",V.value=q,K!==null?V.setSelectionRange(U,Y,K):V.setSelectionRange(U,Y)}},[a.comboboxState]);let k=R.useRef(!1),N=Xe(()=>{k.current=!0}),M=Xe(()=>{_.nextFrame(()=>{k.current=!1})}),A=Xe(D=>{switch(l.setIsTyping(!0),D.key){case fr.Enter:if(a.comboboxState!==0||k.current)return;if(D.preventDefault(),D.stopPropagation(),a.activeOptionIndex===null){l.closeCombobox();return}l.selectActiveOption(),a.mode===0&&l.closeCombobox();break;case fr.ArrowDown:return D.preventDefault(),D.stopPropagation(),ys(a.comboboxState,{0:()=>l.goToOption(Sn.Next),1:()=>l.openCombobox()});case fr.ArrowUp:return D.preventDefault(),D.stopPropagation(),ys(a.comboboxState,{0:()=>l.goToOption(Sn.Previous),1:()=>{rn.flushSync(()=>l.openCombobox()),a.value||l.goToOption(Sn.Last)}});case fr.Home:if(D.shiftKey)break;return D.preventDefault(),D.stopPropagation(),l.goToOption(Sn.First);case fr.PageUp:return D.preventDefault(),D.stopPropagation(),l.goToOption(Sn.First);case fr.End:if(D.shiftKey)break;return D.preventDefault(),D.stopPropagation(),l.goToOption(Sn.Last);case fr.PageDown:return D.preventDefault(),D.stopPropagation(),l.goToOption(Sn.Last);case fr.Escape:return a.comboboxState!==0?void 0:(D.preventDefault(),a.optionsElement&&!a.optionsPropsRef.current.static&&D.stopPropagation(),a.mode===0&&a.value===null&&E(),l.closeCombobox());case fr.Tab:if(a.comboboxState!==0)return;a.mode===0&&a.activationTrigger!==1&&l.selectActiveOption(),l.closeCombobox();break}}),P=Xe(D=>{h==null||h(D),a.mode===0&&D.target.value===""&&E(),l.openCombobox()}),j=Xe(D=>{var H,V,q;let U=(H=D.relatedTarget)!=null?H:al.find(Y=>Y!==D.currentTarget);if(!((V=a.optionsElement)!=null&&V.contains(U))&&!((q=a.buttonElement)!=null&&q.contains(U))&&a.comboboxState===0)return D.preventDefault(),a.mode===0&&a.value===null&&E(),l.closeCombobox()}),F=Xe(D=>{var H,V,q;let U=(H=D.relatedTarget)!=null?H:al.find(Y=>Y!==D.currentTarget);(V=a.buttonElement)!=null&&V.contains(U)||(q=a.optionsElement)!=null&&q.contains(U)||a.disabled||a.immediate&&a.comboboxState!==0&&_.microTask(()=>{rn.flushSync(()=>l.openCombobox()),l.setActivationTrigger(1)})}),I=sv(),O=USe(),{isFocused:$,focusProps:B}=Sz({autoFocus:m}),{isHovered:z,hoverProps:T}=Cz({isDisabled:g}),W=R.useMemo(()=>({open:a.comboboxState===0,disabled:g,hover:z,focus:$,autofocus:m}),[a,z,$,m,g]),L=ZR({ref:x,id:d,role:"combobox",type:b,"aria-controls":(n=a.optionsElement)==null?void 0:n.id,"aria-expanded":a.comboboxState===0,"aria-activedescendant":a.activeOptionIndex===null?void 0:a.virtual?(r=a.options.find(D=>!D.dataRef.current.disabled&&a.compare(D.dataRef.current.value,a.virtual.options[a.activeOptionIndex])))==null?void 0:r.id:(o=a.options[a.activeOptionIndex])==null?void 0:o.id,"aria-labelledby":I,"aria-describedby":O,"aria-autocomplete":"list",defaultValue:(s=(i=e.defaultValue)!=null?i:a.defaultValue!==void 0?p==null?void 0:p(a.defaultValue):null)!=null?s:a.defaultValue,disabled:g||void 0,autoFocus:m,onCompositionStart:N,onCompositionEnd:M,onKeyDown:A,onChange:P,onFocus:F,onBlur:j},B,T);return ei()({ourProps:L,theirProps:y,slot:W,defaultTag:G2e,name:"Combobox.Input"})}let Y2e="button";function K2e(e,t){var n;let r=Md("Combobox.Button"),o=Gp("Combobox.Button"),i=Ms(t,o.setButtonElement),s=R.useId(),{id:a=`headlessui-combobox-button-${s}`,disabled:l=r.disabled||!1,autoFocus:c=!1,...u}=e,d=zz(r.inputElement),h=Xe(C=>{switch(C.key){case fr.Space:case fr.Enter:C.preventDefault(),C.stopPropagation(),r.comboboxState===1&&rn.flushSync(()=>o.openCombobox()),d();return;case fr.ArrowDown:C.preventDefault(),C.stopPropagation(),r.comboboxState===1&&(rn.flushSync(()=>o.openCombobox()),r.value||o.goToOption(Sn.First)),d();return;case fr.ArrowUp:C.preventDefault(),C.stopPropagation(),r.comboboxState===1&&(rn.flushSync(()=>o.openCombobox()),r.value||o.goToOption(Sn.Last)),d();return;case fr.Escape:if(r.comboboxState!==0)return;C.preventDefault(),r.optionsElement&&!r.optionsPropsRef.current.static&&C.stopPropagation(),rn.flushSync(()=>o.closeCombobox()),d();return;default:return}}),p=Xe(C=>{C.preventDefault(),!VSe(C.currentTarget)&&(C.button===ok.Left&&(r.comboboxState===0?o.closeCombobox():o.openCombobox()),d())}),g=sv([a]),{isFocusVisible:m,focusProps:b}=Sz({autoFocus:c}),{isHovered:y,hoverProps:v}=Cz({isDisabled:l}),{pressed:x,pressProps:S}=RSe({disabled:l}),_=R.useMemo(()=>({open:r.comboboxState===0,active:x||r.comboboxState===0,disabled:l,value:r.value,hover:y,focus:m}),[r,y,m,x,l]),E=ZR({ref:i,id:a,type:MEe(e,r.buttonElement),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":(n=r.optionsElement)==null?void 0:n.id,"aria-expanded":r.comboboxState===0,"aria-labelledby":g,disabled:l||void 0,autoFocus:c,onMouseDown:p,onKeyDown:h},b,v,S);return ei()({ourProps:E,theirProps:u,slot:_,defaultTag:Y2e,name:"Combobox.Button"})}let X2e="div",Q2e=_S.RenderStrategy|_S.Static;function Z2e(e,t){var n,r,o;let i=R.useId(),{id:s=`headlessui-combobox-options-${i}`,hold:a=!1,anchor:l,portal:c=!1,modal:u=!0,transition:d=!1,...h}=e,p=Md("Combobox.Options"),g=Gp("Combobox.Options"),m=d2e(l);m&&(c=!0);let[b,y]=p2e(m),[v,x]=R.useState(null),S=h2e(),_=Ms(t,m?b:null,g.setOptionsElement,x),E=av(p.optionsElement),C=v2e(),[k,N]=zEe(d,v,C!==null?(C&Ph.Open)===Ph.Open:p.comboboxState===0);yEe(k,p.inputElement,g.closeCombobox);let M=p.__demoMode?!1:u&&p.comboboxState===0;jEe(M,E);let A=p.__demoMode?!1:u&&p.comboboxState===0;bEe(A,{allowed:R.useCallback(()=>[p.inputElement,p.buttonElement,p.optionsElement],[p.inputElement,p.buttonElement,p.optionsElement])}),sn(()=>{var L;p.optionsPropsRef.current.static=(L=e.static)!=null?L:!1},[p.optionsPropsRef,e.static]),sn(()=>{p.optionsPropsRef.current.hold=a},[p.optionsPropsRef,a]),WEe(p.comboboxState===0,{container:p.optionsElement,accept(L){return L.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:L.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(L){L.setAttribute("role","none")}});let P=sv([(n=p.buttonElement)==null?void 0:n.id]),j=R.useMemo(()=>({open:p.comboboxState===0,option:void 0}),[p.comboboxState]),F=Xe(()=>{g.setActivationTrigger(0)}),I=Xe(L=>{L.preventDefault(),g.setActivationTrigger(0)}),O=ZR(m?S():{},{"aria-labelledby":P,role:"listbox","aria-multiselectable":p.mode===1?!0:void 0,id:s,ref:_,style:{...h.style,...y,"--input-width":_I(p.inputElement,!0).width,"--button-width":_I(p.buttonElement,!0).width},onWheel:p.activationTrigger===0?void 0:F,onMouseDown:I,...$Ee(N)}),$=k&&p.comboboxState===1,B=MS($,(r=p.virtual)==null?void 0:r.options),z=MS($,p.value),T=Xe(L=>p.compare(z,L));if(p.virtual){if(B===void 0)throw new Error("Missing `options` in virtual mode");Object.assign(h,{children:R.createElement(Dh.Provider,{value:B!==p.virtual.options?{...p,virtual:{...p.virtual,options:B}}:p},R.createElement(V2e,{slot:j},h.children))})}let W=ei();return R.createElement(O2e,{enabled:c?e.static||k:!1},R.createElement(Dh.Provider,{value:p.mode===1?p:{...p,isSelected:T}},W({ourProps:O,theirProps:{...h,children:R.createElement(y2e,{freeze:$},typeof h.children=="function"?(o=h.children)==null?void 0:o.call(h,j):h.children)},slot:j,defaultTag:X2e,features:Q2e,visible:k,name:"Combobox.Options"})))}let J2e="div";function e_e(e,t){var n,r,o,i;let s=Md("Combobox.Option"),a=Gp("Combobox.Option"),l=R.useId(),{id:c=`headlessui-combobox-option-${l}`,value:u,disabled:d=(o=(r=(n=s.virtual)==null?void 0:n.disabled)==null?void 0:r.call(n,u))!=null?o:!1,order:h=null,...p}=e,g=zz(s.inputElement),m=s.virtual?s.activeOptionIndex===s.calculateIndex(u):s.activeOptionIndex===null?!1:((i=s.options[s.activeOptionIndex])==null?void 0:i.id)===c,b=s.isSelected(u),y=R.useRef(null),v=vc({disabled:d,value:u,domRef:y,order:h}),x=R.useContext(Gz),S=Ms(t,y,x?x.measureElement:null),_=Xe(()=>{a.setIsTyping(!1),a.onChange(u)});sn(()=>a.registerOption(c,v),[v,c]);let E=R.useRef(!(s.virtual||s.__demoMode));sn(()=>{if(!s.virtual&&!s.__demoMode)return Ii().requestAnimationFrame(()=>{E.current=!0})},[s.virtual,s.__demoMode]),sn(()=>{if(E.current&&s.comboboxState===0&&m&&s.activationTrigger!==0)return Ii().requestAnimationFrame(()=>{var I,O;(O=(I=y.current)==null?void 0:I.scrollIntoView)==null||O.call(I,{block:"nearest"})})},[y,m,s.comboboxState,s.activationTrigger,s.activeOptionIndex]);let C=Xe(I=>{I.preventDefault(),I.button===ok.Left&&(d||(_(),$z()||requestAnimationFrame(()=>g()),s.mode===0&&a.closeCombobox()))}),k=Xe(()=>{if(d)return a.goToOption(Sn.Nothing);let I=s.calculateIndex(u);a.goToOption(Sn.Specific,I)}),N=OEe(),M=Xe(I=>N.update(I)),A=Xe(I=>{if(!N.wasMoved(I)||d||m)return;let O=s.calculateIndex(u);a.goToOption(Sn.Specific,O,0)}),P=Xe(I=>{N.wasMoved(I)&&(d||m&&(s.optionsPropsRef.current.hold||a.goToOption(Sn.Nothing)))}),j=R.useMemo(()=>({active:m,focus:m,selected:b,disabled:d}),[m,b,d]),F={id:c,ref:S,role:"option",tabIndex:d===!0?void 0:-1,"aria-disabled":d===!0?!0:void 0,"aria-selected":b,disabled:void 0,onMouseDown:C,onFocus:k,onPointerEnter:M,onMouseEnter:M,onPointerMove:A,onMouseMove:A,onPointerLeave:P,onMouseLeave:P};return ei()({ourProps:F,theirProps:p,slot:j,defaultTag:J2e,name:"Combobox.Option"})}let t_e=ti(U2e),qz=ti(K2e),Yz=ti(q2e),n_e=JSe,Kz=ti(Z2e),Xz=ti(e_e),r_e=Object.assign(t_e,{Input:Yz,Button:qz,Label:n_e,Options:Kz,Option:Xz});function o_e({elementId:e}){return R.useEffect(()=>{const t=document.getElementById(e);return t&&t.classList.add("semaphor-scope"),()=>{t&&t.classList.remove("semaphor-scope")}},[e]),null}function Qz({options:e,onChange:t,selectedOptions:n,multiple:r=!0,externalFilteredOptions:o,selectAllChecked:i,onSelectAllCheckedChange:s,inputClassName:a,renderFilterModeButton:l,showNegativeIndicator:c}){const[u,d]=R.useState(""),h=oe(v=>v.themeStyle),p=o||(u===""?e:e==null?void 0:e.filter(v=>{var x;return v!=null&&v.value?(x=v.value)==null?void 0:x.toLowerCase().includes(u==null?void 0:u.toLowerCase()):!1}));function g(v){return v!=null&&v.length?v==null?void 0:v.map(x=>x.value).join(", "):""}function m(v){Array.isArray(v)||(v=[v]),t(v)}function b(){return p&&p.length>0?null:f.jsx("div",{className:"relative cursor-default select-none px-4 py-2",children:"No records found."})}function y(){return!r||!(p!=null&&p.length)?null:f.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-b-muted px-4 py-2",children:[l==null?void 0:l(),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("span",{children:"All"}),f.jsx(zr,{className:"border-muted-foreground/50",checked:i,onCheckedChange:s})]})]})}return f.jsx(r_e,{multiple:r,value:n,onChange:m,onClose:()=>d(""),children:({open:v})=>f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"relative flex items-center gap-0.5",children:[c&&f.jsx("div",{className:"h-8 w-0.5 bg-red-400"}),f.jsx(Yz,{className:re("h-8 w-full rounded-sm border border-border bg-background py-1.5 pl-3 pr-8 text-sm","data-[focus]:outline-border-none focus:outline-none data-[focus]:outline-none data-[focus]:-outline-offset-2",a),style:{borderRadius:h==null?void 0:h.controlInputRadius},displayValue:g,onChange:x=>d(x.target.value)}),f.jsx(qz,{className:"group absolute inset-y-0 right-0 px-2.5",children:f.jsx(sa,{className:"size-4 text-muted-foreground hover:text-foreground"})})]}),f.jsxs(Kz,{anchor:"bottom",transition:!0,style:{borderRadius:h==null?void 0:h.controlInputRadius},className:$l("mt-1 !max-h-60 w-[var(--input-width)] overflow-y-auto rounded-sm border border-border bg-background p-1 text-sm [--anchor-gap:var(--spacing-1)] empty:invisible","transition duration-100 ease-in data-[leave]:data-[closed]:opacity-0"),children:[v&&f.jsx(o_e,{elementId:"headlessui-portal-root"}),b(),y(),p==null?void 0:p.map(x=>f.jsxs(Xz,{style:{borderRadius:h==null?void 0:h.controlInputRadius},value:x,className:"group flex cursor-default select-none items-start gap-2 rounded-sm px-3 py-1.5 data-[focus]:bg-muted",children:[f.jsx(ao,{className:"invisible size-4 shrink-0 group-data-[selected]:visible"}),x.value]},x.id))]})]})})}function i_e({filter:e}){const t=oe(d=>d.themeStyle),{filteredRecords:n,isSingleSelect:r,allSelected:o,handleChange:i,handleSelectAll:s,isLoading:a,isFetching:l,isError:c,selectedRecords:u}=KR(e);return a||l?f.jsx(ms,{style:{borderRadius:t==null?void 0:t.controlInputRadius},className:"h-8 w-full bg-foreground/10"}):c?f.jsx("div",{className:"flex h-8 w-full items-center bg-muted px-2 text-sm",children:"Error"}):f.jsx(Qz,{showNegativeIndicator:e.operation==="not in",renderFilterModeButton:()=>f.jsx(s_e,{filter:e}),inputClassName:"h-8",options:n,selectedOptions:u,onChange:i,multiple:!r,selectAllChecked:o,onSelectAllCheckedChange:s})}function s_e({filter:e}){const t=e.operation==="in"?"include":"exclude",{setFilterMode:n}=on();function r(){t==="include"?n(e.id,"exclude"):n(e.id,"include")}return f.jsx(Ee,{onClick:r,variant:"secondary",size:"sm",className:re("h-6 text-xs hover:underline",{}),children:RE(t)})}function a_e({filter:e}){var i;const{filteredRecords:t,handleChange:n,selectedRecords:r}=KR(e);function o(s){n([{value:s,id:s}])}return f.jsx(ba,{onValueChange:o,value:((i=r==null?void 0:r[0])==null?void 0:i.value)||"",className:"mt-2 flex gap-3 overflow-x-auto",children:t==null?void 0:t.map(s=>f.jsxs("div",{className:"flex gap-2",children:[f.jsx(Fr,{value:s.value,id:"r1"}),f.jsx(de,{className:"text-muted-foreground",htmlFor:"r1",children:s.value})]},s.value))})}function sk({filter:e}){return ic(e.dataType)?f.jsx(tSe,{filter:e}):e.uiType==="radio"&&e.type==="single"?f.jsx(a_e,{filter:e}):f.jsx(i_e,{filter:e})}function l_e({frame:e}){const[t,n]=R.useState(!1),r=e==null?void 0:e.cards[0],{data:o,isPending:i}=Ri(r),s=e==null?void 0:e.cards[1],{data:a,isLoading:l,isFetching:c}=Ri(s);return(s==null?void 0:s.type)!=="text"?f.jsx(Zb,{card:r,data:(o==null?void 0:o.records)||[],isPending:i}):f.jsxs(Rh,{className:re("group relative overflow-y-auto",t?"m-4":"mx-0"),children:[t?f.jsx("div",{className:"overflow-y-auto break-words p-1",children:f.jsx(t0,{card:s,data:(a==null?void 0:a.records)||[],isLoading:!1})}):f.jsx(Zb,{card:r,data:(o==null?void 0:o.records)||[],isPending:i}),f.jsx("div",{className:re("fixed z-10",{"invisible bottom-4 right-4 group-hover:visible":t,"right-6 top-6":!t}),children:f.jsx(wd,{disabled:l||c,className:re("h-7 p-1"),pressed:t,onPressedChange:n,"aria-label":"Toggle bold",children:t?f.jsx(uJ,{className:"size-4 text-muted-foreground/70"}):f.jsx(dJ,{className:"size-4 text-muted-foreground/70"})})})]})}function pt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function qp(e,t=[]){let n=[];function r(i,s){const a=w.createContext(s),l=n.length;n=[...n,s];const c=d=>{var y;const{scope:h,children:p,...g}=d,m=((y=h==null?void 0:h[e])==null?void 0:y[l])||a,b=w.useMemo(()=>g,Object.values(g));return f.jsx(m.Provider,{value:b,children:p})};c.displayName=i+"Provider";function u(d,h){var m;const p=((m=h==null?void 0:h[e])==null?void 0:m[l])||a,g=w.useContext(p);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[c,u]}const o=()=>{const i=n.map(s=>w.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return w.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,c_e(o,...t)]}function c_e(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(i)[`__scope${c}`];return{...a,...d}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var u_e=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Sr=u_e.reduce((e,t)=>{const n=xs(`Primitive.${t}`),r=w.forwardRef((o,i)=>{const{asChild:s,...a}=o,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(l,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Zz(e,t){e&&vs.flushSync(()=>e.dispatchEvent(t))}function BI(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Jz(...e){return t=>{let n=!1;const r=e.map(o=>{const i=BI(o,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<r.length;o++){const i=r[o];typeof i=="function"?i():BI(e[o],null)}}}}function Vr(...e){return w.useCallback(Jz(...e),e)}function eB(e){const t=e+"CollectionProvider",[n,r]=qp(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=m=>{const{scope:b,children:y}=m,v=R.useRef(null),x=R.useRef(new Map).current;return f.jsx(o,{scope:b,itemMap:x,collectionRef:v,children:y})};s.displayName=t;const a=e+"CollectionSlot",l=xs(a),c=R.forwardRef((m,b)=>{const{scope:y,children:v}=m,x=i(a,y),S=Vr(b,x.collectionRef);return f.jsx(l,{ref:S,children:v})});c.displayName=a;const u=e+"CollectionItemSlot",d="data-radix-collection-item",h=xs(u),p=R.forwardRef((m,b)=>{const{scope:y,children:v,...x}=m,S=R.useRef(null),_=Vr(b,S),E=i(u,y);return R.useEffect(()=>(E.itemMap.set(S,{ref:S,...x}),()=>void E.itemMap.delete(S))),f.jsx(h,{[d]:"",ref:_,children:v})});p.displayName=u;function g(m){const b=i(e+"CollectionConsumer",m);return R.useCallback(()=>{const v=b.collectionRef.current;if(!v)return[];const x=Array.from(v.querySelectorAll(`[${d}]`));return Array.from(b.itemMap.values()).sort((E,C)=>x.indexOf(E.ref.current)-x.indexOf(C.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:s,Slot:c,ItemSlot:p},g,r]}var d_e=w.createContext(void 0);function tB(e){const t=w.useContext(d_e);return e||t||"ltr"}function Ti(e){const t=w.useRef(e);return w.useEffect(()=>{t.current=e}),w.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function f_e(e,t=globalThis==null?void 0:globalThis.document){const n=Ti(e);w.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var h_e="DismissableLayer",PS="dismissableLayer.update",p_e="dismissableLayer.pointerDownOutside",m_e="dismissableLayer.focusOutside",VI,nB=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),rB=w.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:a,...l}=e,c=w.useContext(nB),[u,d]=w.useState(null),h=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=w.useState({}),g=Vr(t,C=>d(C)),m=Array.from(c.layers),[b]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),y=m.indexOf(b),v=u?m.indexOf(u):-1,x=c.layersWithOutsidePointerEventsDisabled.size>0,S=v>=y,_=y_e(C=>{const k=C.target,N=[...c.branches].some(M=>M.contains(k));!S||N||(o==null||o(C),s==null||s(C),C.defaultPrevented||a==null||a())},h),E=v_e(C=>{const k=C.target;[...c.branches].some(M=>M.contains(k))||(i==null||i(C),s==null||s(C),C.defaultPrevented||a==null||a())},h);return f_e(C=>{v===c.layers.size-1&&(r==null||r(C),!C.defaultPrevented&&a&&(C.preventDefault(),a()))},h),w.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(VI=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),HI(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=VI)}},[u,h,n,c]),w.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),HI())},[u,c]),w.useEffect(()=>{const C=()=>p({});return document.addEventListener(PS,C),()=>document.removeEventListener(PS,C)},[]),f.jsx(Sr.div,{...l,ref:g,style:{pointerEvents:x?S?"auto":"none":void 0,...e.style},onFocusCapture:pt(e.onFocusCapture,E.onFocusCapture),onBlurCapture:pt(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:pt(e.onPointerDownCapture,_.onPointerDownCapture)})});rB.displayName=h_e;var g_e="DismissableLayerBranch",b_e=w.forwardRef((e,t)=>{const n=w.useContext(nB),r=w.useRef(null),o=Vr(t,r);return w.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),f.jsx(Sr.div,{...e,ref:o})});b_e.displayName=g_e;function y_e(e,t=globalThis==null?void 0:globalThis.document){const n=Ti(e),r=w.useRef(!1),o=w.useRef(()=>{});return w.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let l=function(){oB(p_e,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=l,t.addEventListener("click",o.current,{once:!0})):l()}else t.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function v_e(e,t=globalThis==null?void 0:globalThis.document){const n=Ti(e),r=w.useRef(!1);return w.useEffect(()=>{const o=i=>{i.target&&!r.current&&oB(m_e,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function HI(){const e=new CustomEvent(PS);document.dispatchEvent(e)}function oB(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Zz(o,i):o.dispatchEvent(i)}var Dw=0;function x_e(){w.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??WI()),document.body.insertAdjacentElement("beforeend",e[1]??WI()),Dw++,()=>{Dw===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Dw--}},[])}function WI(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Aw="focusScope.autoFocusOnMount",Iw="focusScope.autoFocusOnUnmount",UI={bubbles:!1,cancelable:!0},w_e="FocusScope",iB=w.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...s}=e,[a,l]=w.useState(null),c=Ti(o),u=Ti(i),d=w.useRef(null),h=Vr(t,m=>l(m)),p=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(r){let m=function(x){if(p.paused||!a)return;const S=x.target;a.contains(S)?d.current=S:Vs(d.current,{select:!0})},b=function(x){if(p.paused||!a)return;const S=x.relatedTarget;S!==null&&(a.contains(S)||Vs(d.current,{select:!0}))},y=function(x){if(document.activeElement===document.body)for(const _ of x)_.removedNodes.length>0&&Vs(a)};document.addEventListener("focusin",m),document.addEventListener("focusout",b);const v=new MutationObserver(y);return a&&v.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",b),v.disconnect()}}},[r,a,p.paused]),w.useEffect(()=>{if(a){qI.add(p);const m=document.activeElement;if(!a.contains(m)){const y=new CustomEvent(Aw,UI);a.addEventListener(Aw,c),a.dispatchEvent(y),y.defaultPrevented||(C_e(k_e(sB(a)),{select:!0}),document.activeElement===m&&Vs(a))}return()=>{a.removeEventListener(Aw,c),setTimeout(()=>{const y=new CustomEvent(Iw,UI);a.addEventListener(Iw,u),a.dispatchEvent(y),y.defaultPrevented||Vs(m??document.body,{select:!0}),a.removeEventListener(Iw,u),qI.remove(p)},0)}}},[a,c,u,p]);const g=w.useCallback(m=>{if(!n&&!r||p.paused)return;const b=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,y=document.activeElement;if(b&&y){const v=m.currentTarget,[x,S]=S_e(v);x&&S?!m.shiftKey&&y===S?(m.preventDefault(),n&&Vs(x,{select:!0})):m.shiftKey&&y===x&&(m.preventDefault(),n&&Vs(S,{select:!0})):y===v&&m.preventDefault()}},[n,r,p.paused]);return f.jsx(Sr.div,{tabIndex:-1,...s,ref:h,onKeyDown:g})});iB.displayName=w_e;function C_e(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Vs(r,{select:t}),document.activeElement!==n)return}function S_e(e){const t=sB(e),n=GI(t,e),r=GI(t.reverse(),e);return[n,r]}function sB(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function GI(e,t){for(const n of e)if(!E_e(n,{upTo:t}))return n}function E_e(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function __e(e){return e instanceof HTMLInputElement&&"select"in e}function Vs(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&__e(e)&&t&&e.select()}}var qI=R_e();function R_e(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=YI(e,t),e.unshift(t)},remove(t){var n;e=YI(e,t),(n=e[0])==null||n.resume()}}}function YI(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function k_e(e){return e.filter(t=>t.tagName!=="A")}var Na=globalThis!=null&&globalThis.document?w.useLayoutEffect:()=>{},N_e=w[" useId ".trim().toString()]||(()=>{}),M_e=0;function P_e(e){const[t,n]=w.useState(N_e());return Na(()=>{n(r=>r??String(M_e++))},[e]),t?`radix-${t}`:""}var D_e="Arrow",aB=w.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return f.jsx(Sr.svg,{...i,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:f.jsx("polygon",{points:"0,0 30,0 15,10"})})});aB.displayName=D_e;var A_e=aB;function I_e(e){const[t,n]=w.useState(void 0);return Na(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,a;if("borderBoxSize"in i){const l=i.borderBoxSize,c=Array.isArray(l)?l[0]:l;s=c.inlineSize,a=c.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var ak="Popper",[lB,cB]=qp(ak),[T_e,uB]=lB(ak),dB=e=>{const{__scopePopper:t,children:n}=e,[r,o]=w.useState(null);return f.jsx(T_e,{scope:t,anchor:r,onAnchorChange:o,children:n})};dB.displayName=ak;var fB="PopperAnchor",hB=w.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=uB(fB,n),s=w.useRef(null),a=Vr(t,s);return w.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:f.jsx(Sr.div,{...o,ref:a})});hB.displayName=fB;var lk="PopperContent",[j_e,O_e]=lB(lk),pB=w.forwardRef((e,t)=>{var U,Y,K,Z,ee,Q;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:i="center",alignOffset:s=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:g,...m}=e,b=uB(lk,n),[y,v]=w.useState(null),x=Vr(t,ie=>v(ie)),[S,_]=w.useState(null),E=I_e(S),C=(E==null?void 0:E.width)??0,k=(E==null?void 0:E.height)??0,N=r+(i!=="center"?"-"+i:""),M=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},A=Array.isArray(c)?c:[c],P=A.length>0,j={padding:M,boundary:A.filter(L_e),altBoundary:P},{refs:F,floatingStyles:I,placement:O,isPositioned:$,middlewareData:B}=Y2({strategy:"fixed",placement:N,whileElementsMounted:(...ie)=>q2(...ie,{animationFrame:p==="always"}),elements:{reference:b.anchor},middleware:[hy({mainAxis:o+k,alignmentAxis:s}),l&&K2({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?t3():void 0,...j}),l&&X2({...j}),Q2({...j,apply:({elements:ie,rects:te,availableWidth:le,availableHeight:ue})=>{const{width:Re,height:be}=te.reference,we=ie.floating.style;we.setProperty("--radix-popper-available-width",`${le}px`),we.setProperty("--radix-popper-available-height",`${ue}px`),we.setProperty("--radix-popper-anchor-width",`${Re}px`),we.setProperty("--radix-popper-anchor-height",`${be}px`)}}),S&&r3({element:S,padding:a}),$_e({arrowWidth:C,arrowHeight:k}),h&&n3({strategy:"referenceHidden",...j})]}),[z,T]=bB(O),W=Ti(g);Na(()=>{$&&(W==null||W())},[$,W]);const L=(U=B.arrow)==null?void 0:U.x,D=(Y=B.arrow)==null?void 0:Y.y,H=((K=B.arrow)==null?void 0:K.centerOffset)!==0,[V,q]=w.useState();return Na(()=>{y&&q(window.getComputedStyle(y).zIndex)},[y]),f.jsx("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...I,transform:$?I.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:V,"--radix-popper-transform-origin":[(Z=B.transformOrigin)==null?void 0:Z.x,(ee=B.transformOrigin)==null?void 0:ee.y].join(" "),...((Q=B.hide)==null?void 0:Q.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:f.jsx(j_e,{scope:n,placedSide:z,onArrowChange:_,arrowX:L,arrowY:D,shouldHideArrow:H,children:f.jsx(Sr.div,{"data-side":z,"data-align":T,...m,ref:x,style:{...m.style,animation:$?void 0:"none"}})})})});pB.displayName=lk;var mB="PopperArrow",F_e={top:"bottom",right:"left",bottom:"top",left:"right"},gB=w.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,i=O_e(mB,r),s=F_e[i.placedSide];return f.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:f.jsx(A_e,{...o,ref:n,style:{...o.style,display:"block"}})})});gB.displayName=mB;function L_e(e){return e!==null}var $_e=e=>({name:"transformOrigin",options:e,fn(t){var b,y,v;const{placement:n,rects:r,middlewareData:o}=t,s=((b=o.arrow)==null?void 0:b.centerOffset)!==0,a=s?0:e.arrowWidth,l=s?0:e.arrowHeight,[c,u]=bB(n),d={start:"0%",center:"50%",end:"100%"}[u],h=(((y=o.arrow)==null?void 0:y.x)??0)+a/2,p=(((v=o.arrow)==null?void 0:v.y)??0)+l/2;let g="",m="";return c==="bottom"?(g=s?d:`${h}px`,m=`${-l}px`):c==="top"?(g=s?d:`${h}px`,m=`${r.floating.height+l}px`):c==="right"?(g=`${-l}px`,m=s?d:`${p}px`):c==="left"&&(g=`${r.floating.width+l}px`,m=s?d:`${p}px`),{data:{x:g,y:m}}}});function bB(e){const[t,n="center"]=e.split("-");return[t,n]}var z_e=dB,B_e=hB,V_e=pB,H_e=gB,W_e="Portal",yB=w.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,i]=w.useState(!1);Na(()=>i(!0),[]);const s=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return s?rn.createPortal(f.jsx(Sr.div,{...r,ref:t}),s):null});yB.displayName=W_e;function U_e(e,t){return w.useReducer((n,r)=>t[n][r]??n,e)}var Yp=e=>{const{present:t,children:n}=e,r=G_e(t),o=typeof n=="function"?n({present:r.isPresent}):w.Children.only(n),i=Vr(r.ref,q_e(o));return typeof n=="function"||r.isPresent?w.cloneElement(o,{ref:i}):null};Yp.displayName="Presence";function G_e(e){const[t,n]=w.useState(),r=w.useRef(null),o=w.useRef(e),i=w.useRef("none"),s=e?"mounted":"unmounted",[a,l]=U_e(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const c=hg(r.current);i.current=a==="mounted"?c:"none"},[a]),Na(()=>{const c=r.current,u=o.current;if(u!==e){const h=i.current,p=hg(c);e?l("MOUNT"):p==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&h!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),Na(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,d=p=>{const m=hg(r.current).includes(p.animationName);if(p.target===t&&m&&(l("ANIMATION_END"),!o.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},h=p=>{p.target===t&&(i.current=hg(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{u.clearTimeout(c),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:w.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function hg(e){return(e==null?void 0:e.animationName)||"none"}function q_e(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Y_e=w[" useInsertionEffect ".trim().toString()]||Na;function K_e({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,s]=X_e({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:o;{const u=w.useRef(e!==void 0);w.useEffect(()=>{const d=u.current;d!==a&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=a},[a,r])}const c=w.useCallback(u=>{var d;if(a){const h=Q_e(u)?u(e):u;h!==e&&((d=s.current)==null||d.call(s,h))}else i(u)},[a,e,i,s]);return[l,c]}function X_e({defaultProp:e,onChange:t}){const[n,r]=w.useState(e),o=w.useRef(n),i=w.useRef(t);return Y_e(()=>{i.current=t},[t]),w.useEffect(()=>{var s;o.current!==n&&((s=i.current)==null||s.call(i,n),o.current=n)},[n,o]),[n,r,i]}function Q_e(e){return typeof e=="function"}var Tw="rovingFocusGroup.onEntryFocus",Z_e={bubbles:!1,cancelable:!0},Kp="RovingFocusGroup",[DS,vB,J_e]=eB(Kp),[eRe,xB]=qp(Kp,[J_e]),[tRe,nRe]=eRe(Kp),wB=w.forwardRef((e,t)=>f.jsx(DS.Provider,{scope:e.__scopeRovingFocusGroup,children:f.jsx(DS.Slot,{scope:e.__scopeRovingFocusGroup,children:f.jsx(rRe,{...e,ref:t})})}));wB.displayName=Kp;var rRe=w.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=e,h=w.useRef(null),p=Vr(t,h),g=tB(i),[m,b]=K_e({prop:s,defaultProp:a??null,onChange:l,caller:Kp}),[y,v]=w.useState(!1),x=Ti(c),S=vB(n),_=w.useRef(!1),[E,C]=w.useState(0);return w.useEffect(()=>{const k=h.current;if(k)return k.addEventListener(Tw,x),()=>k.removeEventListener(Tw,x)},[x]),f.jsx(tRe,{scope:n,orientation:r,dir:g,loop:o,currentTabStopId:m,onItemFocus:w.useCallback(k=>b(k),[b]),onItemShiftTab:w.useCallback(()=>v(!0),[]),onFocusableItemAdd:w.useCallback(()=>C(k=>k+1),[]),onFocusableItemRemove:w.useCallback(()=>C(k=>k-1),[]),children:f.jsx(Sr.div,{tabIndex:y||E===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:"none",...e.style},onMouseDown:pt(e.onMouseDown,()=>{_.current=!0}),onFocus:pt(e.onFocus,k=>{const N=!_.current;if(k.target===k.currentTarget&&N&&!y){const M=new CustomEvent(Tw,Z_e);if(k.currentTarget.dispatchEvent(M),!M.defaultPrevented){const A=S().filter(O=>O.focusable),P=A.find(O=>O.active),j=A.find(O=>O.id===m),I=[P,j,...A].filter(Boolean).map(O=>O.ref.current);EB(I,u)}}_.current=!1}),onBlur:pt(e.onBlur,()=>v(!1))})})}),CB="RovingFocusGroupItem",SB=w.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:s,...a}=e,l=P_e(),c=i||l,u=nRe(CB,n),d=u.currentTabStopId===c,h=vB(n),{onFocusableItemAdd:p,onFocusableItemRemove:g,currentTabStopId:m}=u;return w.useEffect(()=>{if(r)return p(),()=>g()},[r,p,g]),f.jsx(DS.ItemSlot,{scope:n,id:c,focusable:r,active:o,children:f.jsx(Sr.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...a,ref:t,onMouseDown:pt(e.onMouseDown,b=>{r?u.onItemFocus(c):b.preventDefault()}),onFocus:pt(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:pt(e.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){u.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const y=sRe(b,u.orientation,u.dir);if(y!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let x=h().filter(S=>S.focusable).map(S=>S.ref.current);if(y==="last")x.reverse();else if(y==="prev"||y==="next"){y==="prev"&&x.reverse();const S=x.indexOf(b.currentTarget);x=u.loop?aRe(x,S+1):x.slice(S+1)}setTimeout(()=>EB(x))}}),children:typeof s=="function"?s({isCurrentTabStop:d,hasTabStop:m!=null}):s})})});SB.displayName=CB;var oRe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function iRe(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function sRe(e,t,n){const r=iRe(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return oRe[r]}function EB(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function aRe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var lRe=wB,cRe=SB,AS=["Enter"," "],uRe=["ArrowDown","PageUp","Home"],_B=["ArrowUp","PageDown","End"],dRe=[...uRe,..._B],fRe={ltr:[...AS,"ArrowRight"],rtl:[...AS,"ArrowLeft"]},hRe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Xp="Menu",[Ah,pRe,mRe]=eB(Xp),[xc,RB]=qp(Xp,[mRe,cB,xB]),lv=cB(),kB=xB(),[gRe,wc]=xc(Xp),[bRe,Qp]=xc(Xp),NB=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:i,modal:s=!0}=e,a=lv(t),[l,c]=w.useState(null),u=w.useRef(!1),d=Ti(i),h=tB(o);return w.useEffect(()=>{const p=()=>{u.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>u.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),f.jsx(z_e,{...a,children:f.jsx(gRe,{scope:t,open:n,onOpenChange:d,content:l,onContentChange:c,children:f.jsx(bRe,{scope:t,onClose:w.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:h,modal:s,children:r})})})};NB.displayName=Xp;var yRe="MenuAnchor",ck=w.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=lv(n);return f.jsx(B_e,{...o,...r,ref:t})});ck.displayName=yRe;var uk="MenuPortal",[vRe,MB]=xc(uk,{forceMount:void 0}),PB=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,i=wc(uk,t);return f.jsx(vRe,{scope:t,forceMount:n,children:f.jsx(Yp,{present:n||i.open,children:f.jsx(yB,{asChild:!0,container:o,children:r})})})};PB.displayName=uk;var Ro="MenuContent",[xRe,dk]=xc(Ro),DB=w.forwardRef((e,t)=>{const n=MB(Ro,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=wc(Ro,e.__scopeMenu),s=Qp(Ro,e.__scopeMenu);return f.jsx(Ah.Provider,{scope:e.__scopeMenu,children:f.jsx(Yp,{present:r||i.open,children:f.jsx(Ah.Slot,{scope:e.__scopeMenu,children:s.modal?f.jsx(wRe,{...o,ref:t}):f.jsx(CRe,{...o,ref:t})})})})}),wRe=w.forwardRef((e,t)=>{const n=wc(Ro,e.__scopeMenu),r=w.useRef(null),o=Vr(t,r);return w.useEffect(()=>{const i=r.current;if(i)return cd(i)},[]),f.jsx(fk,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:pt(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),CRe=w.forwardRef((e,t)=>{const n=wc(Ro,e.__scopeMenu);return f.jsx(fk,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),SRe=xs("MenuContent.ScrollLock"),fk=w.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:p,disableOutsideScroll:g,...m}=e,b=wc(Ro,n),y=Qp(Ro,n),v=lv(n),x=kB(n),S=pRe(n),[_,E]=w.useState(null),C=w.useRef(null),k=Vr(t,C,b.onContentChange),N=w.useRef(0),M=w.useRef(""),A=w.useRef(0),P=w.useRef(null),j=w.useRef("right"),F=w.useRef(0),I=g?hc:w.Fragment,O=g?{as:SRe,allowPinchZoom:!0}:void 0,$=z=>{var U,Y;const T=M.current+z,W=S().filter(K=>!K.disabled),L=document.activeElement,D=(U=W.find(K=>K.ref.current===L))==null?void 0:U.textValue,H=W.map(K=>K.textValue),V=jRe(H,T,D),q=(Y=W.find(K=>K.textValue===V))==null?void 0:Y.ref.current;(function K(Z){M.current=Z,window.clearTimeout(N.current),Z!==""&&(N.current=window.setTimeout(()=>K(""),1e3))})(T),q&&setTimeout(()=>q.focus())};w.useEffect(()=>()=>window.clearTimeout(N.current),[]),x_e();const B=w.useCallback(z=>{var W,L;return j.current===((W=P.current)==null?void 0:W.side)&&FRe(z,(L=P.current)==null?void 0:L.area)},[]);return f.jsx(xRe,{scope:n,searchRef:M,onItemEnter:w.useCallback(z=>{B(z)&&z.preventDefault()},[B]),onItemLeave:w.useCallback(z=>{var T;B(z)||((T=C.current)==null||T.focus(),E(null))},[B]),onTriggerLeave:w.useCallback(z=>{B(z)&&z.preventDefault()},[B]),pointerGraceTimerRef:A,onPointerGraceIntentChange:w.useCallback(z=>{P.current=z},[]),children:f.jsx(I,{...O,children:f.jsx(iB,{asChild:!0,trapped:o,onMountAutoFocus:pt(i,z=>{var T;z.preventDefault(),(T=C.current)==null||T.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:f.jsx(rB,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:p,children:f.jsx(lRe,{asChild:!0,...x,dir:y.dir,orientation:"vertical",loop:r,currentTabStopId:_,onCurrentTabStopIdChange:E,onEntryFocus:pt(l,z=>{y.isUsingKeyboardRef.current||z.preventDefault()}),preventScrollOnEntryFocus:!0,children:f.jsx(V_e,{role:"menu","aria-orientation":"vertical","data-state":qB(b.open),"data-radix-menu-content":"",dir:y.dir,...v,...m,ref:k,style:{outline:"none",...m.style},onKeyDown:pt(m.onKeyDown,z=>{const W=z.target.closest("[data-radix-menu-content]")===z.currentTarget,L=z.ctrlKey||z.altKey||z.metaKey,D=z.key.length===1;W&&(z.key==="Tab"&&z.preventDefault(),!L&&D&&$(z.key));const H=C.current;if(z.target!==H||!dRe.includes(z.key))return;z.preventDefault();const q=S().filter(U=>!U.disabled).map(U=>U.ref.current);_B.includes(z.key)&&q.reverse(),IRe(q)}),onBlur:pt(e.onBlur,z=>{z.currentTarget.contains(z.target)||(window.clearTimeout(N.current),M.current="")}),onPointerMove:pt(e.onPointerMove,Ih(z=>{const T=z.target,W=F.current!==z.clientX;if(z.currentTarget.contains(T)&&W){const L=z.clientX>F.current?"right":"left";j.current=L,F.current=z.clientX}}))})})})})})})});DB.displayName=Ro;var ERe="MenuGroup",hk=w.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.jsx(Sr.div,{role:"group",...r,ref:t})});hk.displayName=ERe;var _Re="MenuLabel",AB=w.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.jsx(Sr.div,{...r,ref:t})});AB.displayName=_Re;var f0="MenuItem",KI="menu.itemSelect",cv=w.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,i=w.useRef(null),s=Qp(f0,e.__scopeMenu),a=dk(f0,e.__scopeMenu),l=Vr(t,i),c=w.useRef(!1),u=()=>{const d=i.current;if(!n&&d){const h=new CustomEvent(KI,{bubbles:!0,cancelable:!0});d.addEventListener(KI,p=>r==null?void 0:r(p),{once:!0}),Zz(d,h),h.defaultPrevented?c.current=!1:s.onClose()}};return f.jsx(IB,{...o,ref:l,disabled:n,onClick:pt(e.onClick,u),onPointerDown:d=>{var h;(h=e.onPointerDown)==null||h.call(e,d),c.current=!0},onPointerUp:pt(e.onPointerUp,d=>{var h;c.current||(h=d.currentTarget)==null||h.click()}),onKeyDown:pt(e.onKeyDown,d=>{const h=a.searchRef.current!=="";n||h&&d.key===" "||AS.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});cv.displayName=f0;var IB=w.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...i}=e,s=dk(f0,n),a=kB(n),l=w.useRef(null),c=Vr(t,l),[u,d]=w.useState(!1),[h,p]=w.useState("");return w.useEffect(()=>{const g=l.current;g&&p((g.textContent??"").trim())},[i.children]),f.jsx(Ah.ItemSlot,{scope:n,disabled:r,textValue:o??h,children:f.jsx(cRe,{asChild:!0,...a,focusable:!r,children:f.jsx(Sr.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:c,onPointerMove:pt(e.onPointerMove,Ih(g=>{r?s.onItemLeave(g):(s.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:pt(e.onPointerLeave,Ih(g=>s.onItemLeave(g))),onFocus:pt(e.onFocus,()=>d(!0)),onBlur:pt(e.onBlur,()=>d(!1))})})})}),RRe="MenuCheckboxItem",TB=w.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return f.jsx($B,{scope:e.__scopeMenu,checked:n,children:f.jsx(cv,{role:"menuitemcheckbox","aria-checked":h0(n)?"mixed":n,...o,ref:t,"data-state":mk(n),onSelect:pt(o.onSelect,()=>r==null?void 0:r(h0(n)?!0:!n),{checkForDefaultPrevented:!1})})})});TB.displayName=RRe;var jB="MenuRadioGroup",[kRe,NRe]=xc(jB,{value:void 0,onValueChange:()=>{}}),OB=w.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,i=Ti(r);return f.jsx(kRe,{scope:e.__scopeMenu,value:n,onValueChange:i,children:f.jsx(hk,{...o,ref:t})})});OB.displayName=jB;var FB="MenuRadioItem",LB=w.forwardRef((e,t)=>{const{value:n,...r}=e,o=NRe(FB,e.__scopeMenu),i=n===o.value;return f.jsx($B,{scope:e.__scopeMenu,checked:i,children:f.jsx(cv,{role:"menuitemradio","aria-checked":i,...r,ref:t,"data-state":mk(i),onSelect:pt(r.onSelect,()=>{var s;return(s=o.onValueChange)==null?void 0:s.call(o,n)},{checkForDefaultPrevented:!1})})})});LB.displayName=FB;var pk="MenuItemIndicator",[$B,MRe]=xc(pk,{checked:!1}),zB=w.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,i=MRe(pk,n);return f.jsx(Yp,{present:r||h0(i.checked)||i.checked===!0,children:f.jsx(Sr.span,{...o,ref:t,"data-state":mk(i.checked)})})});zB.displayName=pk;var PRe="MenuSeparator",BB=w.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.jsx(Sr.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});BB.displayName=PRe;var DRe="MenuArrow",VB=w.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=lv(n);return f.jsx(H_e,{...o,...r,ref:t})});VB.displayName=DRe;var ARe="MenuSub",[ZLe,HB]=xc(ARe),bf="MenuSubTrigger",WB=w.forwardRef((e,t)=>{const n=wc(bf,e.__scopeMenu),r=Qp(bf,e.__scopeMenu),o=HB(bf,e.__scopeMenu),i=dk(bf,e.__scopeMenu),s=w.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=i,c={__scopeMenu:e.__scopeMenu},u=w.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return w.useEffect(()=>u,[u]),w.useEffect(()=>{const d=a.current;return()=>{window.clearTimeout(d),l(null)}},[a,l]),f.jsx(ck,{asChild:!0,...c,children:f.jsx(IB,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":qB(n.open),...e,ref:Jz(t,o.onTriggerChange),onClick:d=>{var h;(h=e.onClick)==null||h.call(e,d),!(e.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:pt(e.onPointerMove,Ih(d=>{i.onItemEnter(d),!d.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:pt(e.onPointerLeave,Ih(d=>{var p,g;u();const h=(p=n.content)==null?void 0:p.getBoundingClientRect();if(h){const m=(g=n.content)==null?void 0:g.dataset.side,b=m==="right",y=b?-5:5,v=h[b?"left":"right"],x=h[b?"right":"left"];i.onPointerGraceIntentChange({area:[{x:d.clientX+y,y:d.clientY},{x:v,y:h.top},{x,y:h.top},{x,y:h.bottom},{x:v,y:h.bottom}],side:m}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(d),d.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:pt(e.onKeyDown,d=>{var p;const h=i.searchRef.current!=="";e.disabled||h&&d.key===" "||fRe[r.dir].includes(d.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),d.preventDefault())})})})});WB.displayName=bf;var UB="MenuSubContent",GB=w.forwardRef((e,t)=>{const n=MB(Ro,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=wc(Ro,e.__scopeMenu),s=Qp(Ro,e.__scopeMenu),a=HB(UB,e.__scopeMenu),l=w.useRef(null),c=Vr(t,l);return f.jsx(Ah.Provider,{scope:e.__scopeMenu,children:f.jsx(Yp,{present:r||i.open,children:f.jsx(Ah.Slot,{scope:e.__scopeMenu,children:f.jsx(fk,{id:a.contentId,"aria-labelledby":a.triggerId,...o,ref:c,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{var d;s.isUsingKeyboardRef.current&&((d=l.current)==null||d.focus()),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:pt(e.onFocusOutside,u=>{u.target!==a.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:pt(e.onEscapeKeyDown,u=>{s.onClose(),u.preventDefault()}),onKeyDown:pt(e.onKeyDown,u=>{var p;const d=u.currentTarget.contains(u.target),h=hRe[s.dir].includes(u.key);d&&h&&(i.onOpenChange(!1),(p=a.trigger)==null||p.focus(),u.preventDefault())})})})})})});GB.displayName=UB;function qB(e){return e?"open":"closed"}function h0(e){return e==="indeterminate"}function mk(e){return h0(e)?"indeterminate":e?"checked":"unchecked"}function IRe(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function TRe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function jRe(e,t,n){const o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=TRe(e,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));const l=s.find(c=>c.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function ORe(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const a=t[i],l=t[s],c=a.x,u=a.y,d=l.x,h=l.y;u>r!=h>r&&n<(d-c)*(r-u)/(h-u)+c&&(o=!o)}return o}function FRe(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return ORe(n,t)}function Ih(e){return t=>t.pointerType==="mouse"?e(t):void 0}var LRe=NB,$Re=ck,zRe=PB,BRe=DB,VRe=hk,HRe=AB,WRe=cv,URe=TB,GRe=OB,qRe=LB,YRe=zB,KRe=BB,XRe=VB,QRe=WB,ZRe=GB,gk="ContextMenu",[JRe,JLe]=qp(gk,[RB]),Er=RB(),[eke,YB]=JRe(gk),KB=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,dir:o,modal:i=!0}=e,[s,a]=w.useState(!1),l=Er(t),c=Ti(r),u=w.useCallback(d=>{a(d),c(d)},[c]);return f.jsx(eke,{scope:t,open:s,onOpenChange:u,modal:i,children:f.jsx(LRe,{...l,dir:o,open:s,onOpenChange:u,modal:i,children:n})})};KB.displayName=gk;var XB="ContextMenuTrigger",QB=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,disabled:r=!1,...o}=e,i=YB(XB,n),s=Er(n),a=w.useRef({x:0,y:0}),l=w.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...a.current})}),c=w.useRef(0),u=w.useCallback(()=>window.clearTimeout(c.current),[]),d=h=>{a.current={x:h.clientX,y:h.clientY},i.onOpenChange(!0)};return w.useEffect(()=>u,[u]),w.useEffect(()=>void(r&&u()),[r,u]),f.jsxs(f.Fragment,{children:[f.jsx($Re,{...s,virtualRef:l}),f.jsx(Sr.span,{"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,...o,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:r?e.onContextMenu:pt(e.onContextMenu,h=>{u(),d(h),h.preventDefault()}),onPointerDown:r?e.onPointerDown:pt(e.onPointerDown,pg(h=>{u(),c.current=window.setTimeout(()=>d(h),700)})),onPointerMove:r?e.onPointerMove:pt(e.onPointerMove,pg(u)),onPointerCancel:r?e.onPointerCancel:pt(e.onPointerCancel,pg(u)),onPointerUp:r?e.onPointerUp:pt(e.onPointerUp,pg(u))})]})});QB.displayName=XB;var tke="ContextMenuPortal",ZB=e=>{const{__scopeContextMenu:t,...n}=e,r=Er(t);return f.jsx(zRe,{...r,...n})};ZB.displayName=tke;var JB="ContextMenuContent",eV=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=YB(JB,n),i=Er(n),s=w.useRef(!1);return f.jsx(BRe,{...i,...r,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:a=>{var l;(l=e.onCloseAutoFocus)==null||l.call(e,a),!a.defaultPrevented&&s.current&&a.preventDefault(),s.current=!1},onInteractOutside:a=>{var l;(l=e.onInteractOutside)==null||l.call(e,a),!a.defaultPrevented&&!o.modal&&(s.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});eV.displayName=JB;var nke="ContextMenuGroup",tV=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=Er(n);return f.jsx(VRe,{...o,...r,ref:t})});tV.displayName=nke;var rke="ContextMenuLabel",nV=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=Er(n);return f.jsx(HRe,{...o,...r,ref:t})});nV.displayName=rke;var oke="ContextMenuItem",rV=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=Er(n);return f.jsx(WRe,{...o,...r,ref:t})});rV.displayName=oke;var ike="ContextMenuCheckboxItem",oV=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=Er(n);return f.jsx(URe,{...o,...r,ref:t})});oV.displayName=ike;var ske="ContextMenuRadioGroup",ake=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=Er(n);return f.jsx(GRe,{...o,...r,ref:t})});ake.displayName=ske;var lke="ContextMenuRadioItem",iV=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=Er(n);return f.jsx(qRe,{...o,...r,ref:t})});iV.displayName=lke;var cke="ContextMenuItemIndicator",sV=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=Er(n);return f.jsx(YRe,{...o,...r,ref:t})});sV.displayName=cke;var uke="ContextMenuSeparator",aV=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=Er(n);return f.jsx(KRe,{...o,...r,ref:t})});aV.displayName=uke;var dke="ContextMenuArrow",fke=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=Er(n);return f.jsx(XRe,{...o,...r,ref:t})});fke.displayName=dke;var hke="ContextMenuSubTrigger",lV=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=Er(n);return f.jsx(QRe,{...o,...r,ref:t})});lV.displayName=hke;var pke="ContextMenuSubContent",cV=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=Er(n);return f.jsx(ZRe,{...o,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});cV.displayName=pke;function pg(e){return t=>t.pointerType!=="mouse"?e(t):void 0}var mke=KB,gke=QB,bke=ZB,uV=eV,yke=tV,dV=nV,fV=rV,hV=oV,pV=iV,mV=sV,gV=aV,bV=lV,yV=cV;const vke=mke,xke=gke,XI=yke,wke=w.forwardRef(({className:e,inset:t,children:n,...r},o)=>f.jsxs(bV,{ref:o,className:re("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",t&&"pl-8",e),...r,children:[n,f.jsx(_i,{className:"ml-auto h-4 w-4"})]}));wke.displayName=bV.displayName;const Cke=w.forwardRef(({className:e,...t},n)=>f.jsx(yV,{ref:n,className:re("z-50 min-w-[8rem] origin-[--radix-context-menu-content-transform-origin] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));Cke.displayName=yV.displayName;const vV=w.forwardRef(({className:e,...t},n)=>f.jsx(bke,{children:f.jsx(Qo,{children:f.jsx(uV,{ref:n,className:re("z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] origin-[--radix-context-menu-content-transform-origin] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t})})}));vV.displayName=uV.displayName;const IS=w.forwardRef(({className:e,inset:t,...n},r)=>f.jsx(fV,{ref:r,className:re("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));IS.displayName=fV.displayName;const Ske=w.forwardRef(({className:e,children:t,checked:n,...r},o)=>f.jsxs(hV,{ref:o,className:re("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(mV,{children:f.jsx(ao,{className:"h-4 w-4"})})}),t]}));Ske.displayName=hV.displayName;const Eke=w.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(pV,{ref:r,className:re("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(mV,{children:f.jsx(u2,{className:"h-2 w-2 fill-current"})})}),t]}));Eke.displayName=pV.displayName;const Ug=w.forwardRef(({className:e,inset:t,...n},r)=>f.jsx(dV,{ref:r,className:re("px-2 py-1.5 text-sm font-semibold text-foreground",t&&"pl-8",e),...n}));Ug.displayName=dV.displayName;const TS=w.forwardRef(({className:e,...t},n)=>f.jsx(gV,{ref:n,className:re("-mx-1 my-1 h-px bg-border",e),...t}));TS.displayName=gV.displayName;function _ke(e,t,n,r){var c;const o=e.breadcrumbs.length>0&&((c=e.breadcrumbs[e.breadcrumbs.length-1])==null?void 0:c.toField)||t,i=n.steps.findIndex(u=>u.field.id===o.id),s=i>-1?n.steps[i+1]:n.steps[0],a=new Set([o.id,...e.breadcrumbs.map(u=>{var d;return(d=u.toField)==null?void 0:d.id}),s==null?void 0:s.field.id]),l=r.filter(u=>!a.has(u.id)&&u.role==="groupby");return{contextualStep:s,otherFields:l,currentField:o}}function Rke(e){const{field:t,operator:n,value:r}=e,i={"=":"=","!=":"≠",">":">","<":"<",">=":"≥","<=":"≤",in:"in",not_in:"not in",contains:"contains",not_contains:"does not contain"}[n]??n,s=Array.isArray(r)?r.join(", "):String(r);return`${t.label} ${i} ${s}`}function kke({children:e,card:t,className:n}){var b,y,v,x,S,_;const r=C2(E=>E.context),o=no(E=>E.applyInteractionEvent),i=no(E=>E.interactionStates[t.id]),s=((b=t==null?void 0:t.interactionConfig)==null?void 0:b.drillHierarchies)||[],a=((y=t==null?void 0:t.interactionConfig)==null?void 0:y.allowedDrillTargets)||[],l={hierarchyId:i==null?void 0:i.hierarchyId,breadcrumbs:(i==null?void 0:i.breadcrumbs)||[]},c=a.filter(E=>!l.breadcrumbs.some(C=>{var k;return((k=C.toField)==null?void 0:k.id)===E.id})),u=(x=(v=t==null?void 0:t.config)==null?void 0:v.groupByColumns)==null?void 0:x[0],d=[...((S=t==null?void 0:t.config)==null?void 0:S.groupByColumns)||[],...((_=t==null?void 0:t.config)==null?void 0:_.pivotByColumns)||[]],h=r==null?void 0:r.conditions.map(Rke).join(", ");l.hierarchyId&&s.find(E=>E.id===l.hierarchyId),s.find(E=>E.default)||s[0];const p=E=>{const k=oC({intent:{mode:"dynamicDrill",drillField:E},card:t});k&&o(t.id,k,!0)},g=s.length>0,m=c.length>0;return!g&&!m?f.jsx("div",{className:re("flex grow",n),children:e}):f.jsxs(vke,{children:[f.jsx(xke,{className:re("flex grow",n),children:e}),f.jsxs(vV,{className:"w-64",children:[f.jsxs(Ug,{className:"flex items-center gap-1 text-muted-foreground",children:[f.jsx(yF,{className:"mr-1 h-3 w-3"}),h]}),f.jsx(TS,{}),s.map(E=>{const{contextualStep:C,currentField:k}=_ke(l,u||d[0],E,d);return C?f.jsxs(XI,{children:[f.jsxs(Ug,{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[f.jsx(bJ,{className:"h-3 w-3"}),E.label||E.id]}),f.jsxs(IS,{onSelect:()=>{const N={mode:"drillDown",hierarchyId:E.id,drillField:C.field},M=oC({intent:N,card:t});M&&o(t.id,M,!0)},className:"flex items-start gap-2",children:[f.jsx(cJ,{className:"mt-1 h-4 w-4 text-blue-500"}),f.jsxs("div",{className:"flex flex-col",children:[f.jsx("span",{children:C.label||C.field.label}),f.jsx("span",{className:"text-xs text-muted-foreground",children:l.breadcrumbs.length>0?`${k==null?void 0:k.label} → ${C.field.label}`:`Start with ${C.field.label}`})]})]}),f.jsx(TS,{})]},E.id):null}),f.jsxs(XI,{children:[f.jsxs(Ug,{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[f.jsx(_i,{className:"h-3 w-3"})," Other Fields"]}),f.jsx("div",{className:"my-2 max-h-64 overflow-y-auto",children:c&&c.length>0?c.map(E=>f.jsxs(IS,{onSelect:()=>p(E),className:"flex items-center gap-2 hover:bg-muted",children:[f.jsx(_i,{className:"h-4 w-4 text-muted-foreground"}),f.jsxs("div",{className:"flex flex-col",children:[f.jsx("span",{children:E.label}),f.jsx("span",{className:"text-xs text-muted-foreground",children:E.qualifiedEntityName})]})]},E.id)):f.jsxs("div",{className:"py-4 text-center text-sm text-muted-foreground",children:[f.jsx(hF,{className:"mx-auto mb-2 h-6 w-6"}),"No other fields available"]})})]})]})]})}function Nke(e){var d;const t=R.useRef([]),n=R.useRef(null),r=R.useRef(null),o=(d=e.interactionConfig)==null?void 0:d.clickFilterInteractions,i=Cf(h=>h.registerClearBlurCallback),s=Cf(h=>h.unregisterCard);R.useEffect(()=>{const h=()=>{r.current&&u(r.current)};return i(e.id,h),()=>{s(e.id)}},[e.id,i,s]);function a({chart:h,selectedSegments:p,storedOriginalColorsRef:g}){if(!h||!h.canvas||!h.canvas.ownerDocument){console.warn("Chart or canvas is null when trying to toggle blur segments");return}const m=h.data.datasets;g.current||(g.current=m.map((y,v)=>h.getDatasetMeta(v).data.map(S=>S.options.backgroundColor)));const b=g.current;m.forEach((y,v)=>{const x=b[v];if(p.length===0){y.backgroundColor=[...x];return}y.backgroundColor=x.map((S,_)=>p.some(C=>C.datasetIndex===v&&C.dataIndex===_)?S:l(S,.2))});try{h.update()}catch(y){console.warn("Failed to update chart during blur toggle:",y)}}function l(h,p=.2){if(h.startsWith("rgba"))return h.replace(/[\d.]+\)$/g,`${p})`);if(h.startsWith("#")){const g=parseInt(h.slice(1,3),16),m=parseInt(h.slice(3,5),16),b=parseInt(h.slice(5,7),16);return`rgba(${g}, ${m}, ${b}, ${p})`}return h}function c(h,p){var x;if(!o||!p)return;r.current=p;const g=p.getElementsAtEventForMode(h,"nearest",{intersect:!0},!0);if(!g.length)return;const{datasetIndex:m,index:b}=g[0],y={datasetIndex:m,dataIndex:b};if(((x=h.native)==null?void 0:x.shiftKey)||h.shiftKey){const S=t.current.findIndex(_=>_.datasetIndex===m&&_.dataIndex===b);S>=0?t.current.splice(S,1):t.current.push(y)}else{const S=t.current.length===1&&t.current[0].datasetIndex===m&&t.current[0].dataIndex===b;t.current=S?[]:[y]}a({chart:p,selectedSegments:t.current,storedOriginalColorsRef:n})}function u(h){h&&(t.current=[],n.current&&a({chart:h,selectedSegments:[],storedOriginalColorsRef:n}))}return{handleChartClick:c,clearBlur:u}}function Mke({resolvedCardConfig:e,card:t,records:n,chart:r,clickEvent:o}){var c,u,d,h,p,g,m,b,y;const i=r==null?void 0:r.getElementsAtEventForMode(o,"nearest",{intersect:!0},!0);if(!i.length)return;const s=i[0].datasetIndex,a=i[0].index,l=(u=(c=i[0].element)==null?void 0:c.$context)==null?void 0:u.raw;console.log("datasetIndex",s),console.log("clickIndex",a),console.log("value",l);try{if(!(n!=null&&n.length))return;const{keys:v}=un(n),{groupByColumns:x=[],pivotByColumns:S=[],metricColumns:_=[]}=e||t.config,E=C=>x.find(k=>k.label===C)||S.find(k=>k.label===C)||_.find(k=>k.label===C);if(t.type==="map"){const C=v[0],k=((h=(d=l==null?void 0:l.feature)==null?void 0:d.properties)==null?void 0:h.name)||((g=(p=l==null?void 0:l.feature)==null?void 0:p.properties)==null?void 0:g.NAME),N=E(C);return!N||k==null?void 0:{conditions:[{field:N,operator:"=",value:k}]}}if(["pie","funnel","doughnut"].includes(t.type)){const C=v[0],k=v==null?void 0:v[1+s],N=E(C),M=E(k),A=(m=n==null?void 0:n[a])==null?void 0:m[C];if(!N||A==null){console.log("no dim field or value",C,A);return}return{conditions:[{field:N,operator:"=",value:A}],metrics:M?[{field:M,value:l}]:void 0}}if(["stackedBar","bar","line"].includes(t.type)){const C=v[0],k=E(C),N=(b=n==null?void 0:n[a])==null?void 0:b[C];if(!k||N==null){console.log("no dim field or value for stacked bar",C,N);return}const M=_[0];if(!M){console.log("no metric field found");return}const A=(y=n==null?void 0:n[a])==null?void 0:y[M.label],P=S[0],F=Object.keys(n[0]).filter(O=>O!==C)[s],I=[{field:k,operator:"=",value:N}];return P&&F&&I.push({field:P,operator:"=",value:F}),{conditions:I,metrics:[{field:M,value:A}]}}}catch(v){console.error("getClickContextFromChart error",v)}}function Pke({cardId:e,className:t}){const n=no(u=>u.interactionStates[e]),r=no(u=>u.popInteractionStep),o=no(u=>u.resetInteractionState),i=(n==null?void 0:n.breadcrumbs)??[];if(n==null||n.hierarchyId,i.length===0)return null;const s=u=>{const d=i.length-u-1;for(let h=0;h<d;h++)r(e)},a=()=>{o(e)},l=u=>(u.sourceFilterGroups[0],u.toField?u.toField.label||u.toField.name:"Drill Step"),c=u=>{const d=u.sourceFilterGroups.flatMap(h=>h.filters).map(h=>`${h.field.label||h.field.name} = ${h.value}`);return f.jsxs("div",{className:"max-w-xs space-y-2 p-2 text-sm text-foreground/80",children:[d.length>0&&f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"flex items-center gap-2 font-medium",children:f.jsx(fb,{className:"h-4 w-4"})}),f.jsx("div",{className:"flex flex-wrap gap-1",children:d.map((h,p)=>f.jsx("span",{className:"",children:h},p))})]}),u.toField&&f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(yF,{className:"h-4 w-4"}),f.jsx(de,{children:u.toField.label||u.toField.name})]}),u.granularity&&f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Ou,{className:"h-4 w-4"}),f.jsxs(de,{children:["Granularity: ",u.granularity]})]}),u.metric&&f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(iJ,{className:"h-4 w-4"}),f.jsxs(de,{children:["Metric:"," ",u.metric.formattedValue||u.metric.value]})]})]})};return f.jsxs("div",{className:re("flex items-center gap-1 text-sm",t),children:[f.jsx(Sa,{children:f.jsx(Ea,{asChild:!0,children:f.jsx("button",{className:"flex items-center p-0 text-muted-foreground hover:text-foreground",onClick:a,"aria-label":"Reset drill path",children:f.jsx(dF,{className:"h-3.5 w-3.5"})})})}),f.jsx(_i,{className:"ml-0.5 h-3 w-3 text-muted-foreground"}),f.jsx("div",{className:"flex items-center",children:i.map((u,d)=>f.jsxs("div",{className:"flex items-center",children:[d>0&&f.jsx(_i,{className:"mx-1 h-3 w-3 text-muted-foreground"}),f.jsxs(Sa,{children:[f.jsx(Ea,{asChild:!0,children:f.jsx(Ee,{variant:"link",size:"sm",className:"h-6 px-1 text-muted-foreground hover:text-foreground",onClick:()=>s(d),"aria-label":`Go back to: ${l(u)}`,children:l(u)})}),f.jsx(q_,{side:"bottom",children:c(u)})]})]},d))})]})}function Dke({card:e,frame:t}){var B,z,T,W;const{customCards:n,placeholders:r}=ir(),o=no(L=>L.interactionStates[e.id]),i=((B=o==null?void 0:o.breadcrumbs)==null?void 0:B.length)>0,s=oe(L=>L.themeStyle),a=oe(L=>L.selectedSheetId),l=oe(L=>L.isDashboardEditing);oe(L=>L.selectedLensId);const c=oe(L=>L.dashboard.filters),u=c==null?void 0:c.find(L=>L.id===t.filterId&&!L.hide),{setCardTitle:d,setCardDescription:h,setSelectedFrameId:p,updateFilter:g}=on(),{updateFrame:m}=on(),{handleChartClick:b}=Nke(e),y=((z=e.customCardPreferences)==null?void 0:z.showCardHeader)??!0,{isError:v,isLoading:x,isFetching:S,cfg:_,isPending:E,data:C,handleDatapointClick:k}=J6(e),{handlePointerInteraction:N}=zJ(e),M=EF(e);function A(L,D){L.button===0&&b(L.nativeEvent,D);const H=Mke({resolvedCardConfig:M,card:e,records:(C==null?void 0:C.records)||[],chart:D,clickEvent:L.nativeEvent});if(!H)return;const V={shift:L.shiftKey,ctrl:L.ctrlKey,meta:L.metaKey};L.button===0?N({context:H,gesture:"leftClick",modifierKeys:V}):L.button===2&&N({context:H,gesture:"rightClick",modifierKeys:V})}function P(){var L,D,H;if(n&&n.length>0){const V=n.find(q=>q.cardId===e.id);if(V&&V.replaceDefault){const q=V.content;if(q)return f.jsx(q,{card:e})}}if(e.type==="kpi"){if(((L=t==null?void 0:t.cards)==null?void 0:L.length)===1)return f.jsx(Zb,{card:e,data:(C==null?void 0:C.records)||[],isPending:E});if(((D=t==null?void 0:t.cards)==null?void 0:D.length)>1)return f.jsx(l_e,{frame:t})}return e.type==="text"&&((H=t==null?void 0:t.cards)==null?void 0:H.length)===1?f.jsx(Rh,{className:"mx-3 my-6 overflow-y-auto break-words px-3",children:f.jsx(t0,{isLoading:x||S,card:e,data:(C==null?void 0:C.records)||[]})}):$}function j(){if(v)return f.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:[f.jsx(gF,{className:"size-8 text-destructive"}),f.jsx("p",{className:"text-sm text-muted-foreground",children:"Error fetching data. Check your card settings."})]});if(C!=null&&C.records&&(C==null?void 0:C.records.length)===0)return r!=null&&r.NoRecords?f.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:r.NoRecords}):f.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:[f.jsx(vF,{className:"size-8 text-muted-foreground"}),f.jsx("p",{className:"text-sm text-muted-foreground",children:"No results to display"})]});if(e.type==="table"&&(C!=null&&C.records)&&(C==null?void 0:C.records.length)>0)return f.jsx("div",{className:"relative flex h-full min-h-0 w-full flex-1 grow basis-0",children:f.jsx(e7,{card:e,data:(C==null?void 0:C.records)||[]})});if(e.type==="pivotTable"&&(C!=null&&C.records)&&(C==null?void 0:C.records.length)>0){const L=_;if((L==null?void 0:L.type)==="pivotTable"&&(L!=null&&L.data))return f.jsx("div",{className:"relative flex h-full min-h-0 w-full flex-1 grow basis-0",children:f.jsx(r7,{card:e,data:L.data,options:L.options})})}if(e.type==="text")return f.jsx(Rh,{className:"overflow-y-auto break-words pr-2",children:f.jsx(t0,{isLoading:x||S,card:e,data:(C==null?void 0:C.records)||[]})});if(e.type==="custom")return f.jsx(Np,{FallbackComponent:UL,children:f.jsx(Oye,{frame:t,card:e})});if(n&&n.length>0){const L=n.find(D=>D.cardId===e.id);if(L&&L.content){const D=L.content;return f.jsx(D,{card:e})}}if(_)return f.jsx(kke,{card:e,children:f.jsx(jR,{cfg:_,onChartClick:A,onDatapointClick:k})})}function F(){if(n&&n.length>0){const L=n.find(D=>D.cardId===e.id);if(L&&L.footer){const D=L.footer;if(D)return f.jsx(D,{card:e})}}return null}function I(){var H;const L=t.cards.filter(V=>{var q;return!((q=V.tabTitle)!=null&&q.endsWith("__Header"))&&(V.displayTab===!0||V.displayTab===void 0)}),D=s==null?void 0:s.controlInputRadius;return f.jsx(ld,{value:t.activeCardId,className:"flex items-center justify-end gap-3",onValueChange:V=>{const q={...t,activeCardId:V};m(a,q)},children:f.jsx(lc,{style:{borderRadius:s==null?void 0:s.controlInputRadius},className:"flex-end flex h-9 flex-wrap items-center border border-border bg-background p-0",children:(H=t.cards.filter(V=>{var q;return!((q=V.tabTitle)!=null&&q.endsWith("__Header"))&&(V.displayTab===!0||V.displayTab===void 0)}))==null?void 0:H.map((V,q)=>f.jsx(Jr,{className:re("h-full items-center rounded-none data-[state=active]:bg-muted data-[state=active]:shadow-none",{"border-r":q!==L.length-1}),style:{borderTopLeftRadius:q===0?D:0,borderTopRightRadius:q===L.length-1?D:0,borderBottomLeftRadius:q===0?D:0,borderBottomRightRadius:q===L.length-1?D:0},value:V.id,children:V.tabTitle||V.title},V.id))})})}function O(){let L=t.cards.find(D=>D.type==="kpi"&&D.tabTitle===`${e.tabTitle}__Header`);return L||(L=t.cards.find(D=>D.type==="kpi"&&D.tabTitle==="All__Header")),L?f.jsx("div",{className:"flex items-end gap-2",children:f.jsx(Xbe,{renderFilterInfo:()=>f.jsx($A,{cardId:e.id}),card:L})}):f.jsxs(f.Fragment,{children:[f.jsxs("div",{role:"card-title-container",className:"flex h-7 items-center gap-2",children:[f.jsx(wi,{enabled:l,text:e.title,onSave:D=>d(a,e.id,D),children:f.jsx(fa,{className:re("text-base",{}),children:e.title})}),(l||e.info)&&f.jsx(_9,{card:e}),e.refreshInterval&&f.jsxs(Sa,{children:[f.jsx(Ea,{className:"pr-1",children:f.jsx("div",{className:re("h-2 w-2 rounded-full bg-green-500 transition-opacity",{"opacity-10":x||S})})}),f.jsx(Jl,{side:"right",align:"center",children:f.jsx("p",{className:"text-xs",children:`Realtime (${e==null?void 0:e.refreshInterval})`})})]}),f.jsx($A,{cardId:e.id})]}),f.jsxs("div",{"data-content":"card-description-and-breadcrumb",className:"flex h-6 items-center overflow-y-auto",children:[!i&&f.jsx(wi,{enabled:l,text:(e==null?void 0:e.description)||"",onSave:D=>h(a,e.id,D),children:f.jsxs(jE,{className:re("",{}),children:[" ",e.description]})}),i&&f.jsx(Pke,{cardId:e.id})]})]})}if(!e.id)return null;const $=f.jsxs(f.Fragment,{children:[y?f.jsx(Tu,{children:f.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[f.jsx("div",{className:"flex-1 basis-0 scroll-pb-2 overflow-x-auto",role:"header-container",children:O()}),f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx("div",{children:u&&f.jsxs("div",{style:{borderRadius:(W=(T=s==null?void 0:s.chart)==null?void 0:T.options)==null?void 0:W.borderRadius},"data-content":"frame-filter-container",className:"flex shrink-0 items-center",children:[!ic(u.dataType)&&f.jsx(wi,{enabled:l,className:"my-1",containerClassName:"shrink-0",text:u.title||u.column,onSave:L=>g({...u,title:L}),children:f.jsx(de,{className:"px-3",children:u.title})}),f.jsx(sk,{filter:u})]})}),t.cards.length>1&&I()]})]})}):f.jsx("div",{className:"h-8"}),f.jsx(nh,{className:"relative flex min-h-0 grow flex-col",children:j()}),f.jsx(BO,{children:F()})]});return f.jsx("div",{className:re("flex h-full flex-col",{"animate-pulse":x||S}),children:P()})}function Ake({frame:e,footer:t,className:n,...r}){const o=R.useRef(null),i=oe(y=>y.themeStyle),s=oe(y=>y.isVisualEditing),a=oe(y=>y.selectedFrameId),l=oe(y=>y.isDashboardEditing),{setSelectedFrameId:c}=on(),{setSelectedConnectionId:u,setSelectedDatabaseName:d,setSelectedSchemaName:h,setSelectedTableName:p,setCard:g}=Zo();R.useEffect(()=>{if(a===e.id&&l&&!s){const y=o==null?void 0:o.current;y==null||y.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}},[a,e.id,l,s,o]);const m=e.cards.find(y=>y.id===e.activeCardId);function b(y){y.stopPropagation(),c(e.id),m&&g(m),m!=null&&m.connectionId&&u(m==null?void 0:m.connectionId),m!=null&&m.lastSelectedDatabase&&d(m==null?void 0:m.lastSelectedDatabase),m!=null&&m.lastSelectedSchema&&h(m==null?void 0:m.lastSelectedSchema),m!=null&&m.lastSelectedTable&&p(m==null?void 0:m.lastSelectedTable)}return f.jsx(Np,{FallbackComponent:d_,children:f.jsxs("div",{tabIndex:-1,ref:o,role:"card-frame",onClick:b,style:{borderRadius:i==null?void 0:i.cardBorderRadius},className:re("relative flex h-full flex-col rounded-sm border bg-background shadow-sm",{"border-dashed border-foreground/50":a===e.id&&l},i==null?void 0:i.dashboardCard,n,"semaphor-card-frame"),...r,children:[f.jsx(WL,{frame:e}),m&&f.jsx(Dke,{card:m,frame:e},m.id)]})})}const xV=w.forwardRef(({className:e,...t},n)=>f.jsx("textarea",{className:re("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));xV.displayName="Textarea";function Ike({label:e,onCheckedChange:t,checked:n}){return f.jsxs("div",{className:"flex items-center space-x-2",children:[f.jsx(zr,{onCheckedChange:t,id:"terms",checked:n}),f.jsx("label",{htmlFor:"terms",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:e})]})}function wV({text:e,className:t}){const[n,r]=R.useState(!1);return f.jsx(Ee,{className:re("h-7 w-fit px-1 font-mono text-xs text-muted-foreground/70",t),variant:"ghost",size:"icon",onClick:()=>{navigator.clipboard.writeText(e),r(!0),setTimeout(()=>{r(!1)},1e3)},children:n?f.jsx(X5,{className:"size-3.5"}):f.jsx(d2,{className:"size-3.5"})})}function Tke({filter:e}){const[t,n]=R.useState(e.sql),[r,o]=R.useState(!1),i=oe(h=>h.selectedSheetId),{updateFilter:s,updateFilterId:a}=on();function l(){const h={...e,sql:t};s(h),o(!1)}function c(h){const p={...e,type:h};s(p)}function u(h){const p={...e,uiType:h};s(p)}function d(h){if(!i)return;const p={...e,sheetId:h?i:void 0};s(p)}return f.jsxs(Ia,{open:r,onOpenChange:o,children:[f.jsx(Ta,{children:f.jsx(aa,{className:"invisible h-3 w-3 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"})}),f.jsxs(ks,{onMouseDown:h=>h.stopPropagation(),onDoubleClick:h=>h.stopPropagation(),className:"z-50 m-2 w-full min-w-[350px] space-y-4",children:[f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("p",{className:"font-semibold text-foreground",children:e.column}),f.jsx("div",{className:"flex items-center gap-2",children:f.jsxs(Xy,{openDelay:0,children:[f.jsx(Qy,{children:f.jsx(X0,{className:"size-3.5 cursor-pointer text-muted-foreground hover:text-foreground/80"})}),f.jsxs(Op,{align:"start",className:"w-auto px-3 py-2",children:[f.jsx(de,{children:"Filter ID"}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("p",{className:"font-mono text-xs text-muted-foreground",children:e.id}),f.jsx(wV,{text:e.id})]})]})]})})]}),f.jsx("p",{className:"text-sm text-muted-foreground",children:"Customize filter operation and SQL"})]}),f.jsx(_a,{}),f.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[f.jsxs("div",{className:"space-y-2",children:[f.jsx(de,{children:"Type"}),f.jsxs(ba,{onValueChange:c,value:e.type||"multiple",className:"flex gap-3",defaultValue:"x",children:[f.jsxs("div",{className:"flex items-center space-x-2",children:[f.jsx(Fr,{value:"multiple",id:"r1"}),f.jsx("label",{className:"text-sm",htmlFor:"r1",children:"Multiple"})]}),f.jsxs("div",{className:"flex items-center space-x-2",children:[f.jsx(Fr,{value:"single",id:"r2"}),f.jsx("label",{className:"text-sm",htmlFor:"r2",children:"Single"})]})]})]}),e.type==="single"&&f.jsxs("div",{className:"space-y-2",children:[f.jsx(de,{children:"Component"}),f.jsxs(ba,{onValueChange:u,value:e.uiType||"dropdown",className:"flex gap-3",defaultValue:"x",children:[f.jsxs("div",{className:"flex items-center space-x-2",children:[f.jsx(Fr,{value:"dropdown",id:"r2"}),f.jsx("label",{className:"text-sm",htmlFor:"r2",children:"Dropdown"})]}),f.jsxs("div",{className:"flex items-center space-x-2",children:[f.jsx(Fr,{value:"radio",id:"r1"}),f.jsx("label",{className:"text-sm",htmlFor:"r1",children:"Radio"})]})]})]})]}),f.jsxs("div",{className:"grid grid-cols-6 gap-4 text-sm",children:[f.jsxs("div",{className:"col-span-2 space-y-1",children:[f.jsx(de,{children:"Table Column"}),f.jsx(de,{className:"block rounded-md bg-muted px-3 py-1 text-sm",children:e.column})]}),f.jsxs("div",{className:"col-span-2 space-y-1",children:[f.jsx(de,{children:"Data Type"}),f.jsx(de,{className:"block rounded-md bg-muted px-3 py-1 text-sm",children:e.dataType})]})]}),f.jsxs("div",{className:"flex grow flex-col space-y-1",role:"container",children:[f.jsx(de,{className:"text-sm",children:"Values SQL"}),f.jsx(xV,{onKeyDown:h=>{h.stopPropagation()},value:t,onChange:h=>n(h.target.value),className:`min-w-full grow resize font-mono text-xs ${ps}`})]}),f.jsx("div",{children:f.jsx(Ike,{label:"Local to sheet",onCheckedChange:d,checked:!!e.sheetId})}),f.jsx("div",{className:"flex justify-end gap-2",children:f.jsxs(Ee,{onClick:l,size:"sm",variant:"outline",children:[f.jsx(ao,{className:"mr-2 size-4"}),"Accept"]})})]})]})}function CV({filter:e}){const t=oe(a=>a.isDashboardEditing),n=oe(a=>a.filterValues),r=n==null?void 0:n.some(a=>a.filterId===e.id),{removeFilterValues:o,removeFilter:i,updateFilter:s}=on();return f.jsxs("div",{className:"group mb-1 flex h-5 items-center justify-between",children:[f.jsxs("div",{className:"flex grow items-center gap-2",children:[f.jsx(wi,{enabled:t,className:"my-1",text:e.title||e.column,onSave:a=>s({...e,title:a}),children:f.jsx(de,{className:"inline-block text-sm",children:e.title})}),r&&f.jsx("button",{onClick:()=>o(e.id),className:"text-foreground/70",children:f.jsx(cF,{className:"size-3.5"})}),t&&f.jsx("button",{className:"invisible group-hover:visible",onClick:()=>{s({...e,hide:!e.hide})},children:e.hide?f.jsx(K0,{className:"size-3.5 text-foreground/50 hover:text-foreground/70"}):f.jsx(p2,{className:"size-3.5 text-foreground/50 hover:text-foreground/70"})}),t&&f.jsx(Tke,{filter:e})]}),f.jsx("div",{className:"flex items-center gap-2",children:t&&f.jsx(nr,{onClick:()=>{o(e.id),i(e.id)},className:"size-3 cursor-pointer text-foreground/30 hover:cursor-pointer hover:text-foreground/50"})})]})}const jke=_M.WidthProvider(_M.Responsive);function Oke({sheet:e}){var y,v;const t=oe(x=>x.isDashboardEditing),n=oe(x=>x.currentBreakpoint),r=oe(x=>x.themeStyle),o=oe(x=>x.selectedSheetId),i=e.layouts,s=oe(x=>x.dashboard.filters),a=e.frames,{setSheetLayouts:l,setCurrentBreakpoint:c}=oe(x=>x.actions);R.useEffect(()=>{document.documentElement.style.setProperty("--placeholder-border-radius",`${r==null?void 0:r.cardBorderRadius}px`)},[r==null?void 0:r.cardBorderRadius]);function u(x){c(x)}function d(x,S){o===e.id&&l(o,S)}if(!o)return null;const h=(x,S)=>f.jsx(SV,{className:"after:content-none",ref:S,handleAxis:x}),p=x=>x&&(x==null?void 0:x.h)===1&&(x==null?void 0:x.w)===1?{...x,h:8,minH:7,w:7}:null;function g(){const x=s==null?void 0:s.filter(S=>(S.sheetId===o||!S.sheetId)&&!S.hide);return x==null?void 0:x.map(S=>{var C;const _=(C=i==null?void 0:i[n])==null?void 0:C.find(k=>k.i===S.id);if(S.location==="frame")return null;const E=p(_);return f.jsxs("div",{style:{borderRadius:r==null?void 0:r.cardBorderRadius},className:re("z-50 flex flex-col rounded-md border bg-background px-3 py-2"),...E?{"data-grid":E}:{},children:[f.jsx(CV,{filter:S}),f.jsx(sk,{filter:S})]},S.id)})}function m(){return a==null?void 0:a.map(x=>f.jsx("div",{role:"dashboard-frame-container",className:re("group isolate overflow-hidden",r==null?void 0:r.dashboardCardContainer),children:f.jsx(Np,{FallbackComponent:({error:S,resetErrorBoundary:_})=>f.jsx(Use,{error:S,resetErrorBoundary:_,frame:x}),children:f.jsx(Ake,{frame:x})})},x.id))}const b=((y=r==null?void 0:r.gridLayout)==null?void 0:y.margin)||[10,10];return f.jsx(f.Fragment,{children:f.jsxs(jke,{margin:b,isDraggable:t,resizeHandles:t?["sw","nw","ne","se","e","w"]:[],className:re((v=r==null?void 0:r.gridLayout)==null?void 0:v.className),layouts:i,cols:{lg:48,md:36,sm:24,xs:12,xxs:6},rowHeight:1,onBreakpointChange:u,onLayoutChange:d,resizeHandle:h,children:[g(),m()]})})}const SV=R.forwardRef(({className:e,handleAxis:t,...n},r)=>{const o=oe(s=>s.themeStyle),i=(o==null?void 0:o.cardBorderRadius)||0;return f.jsx("div",{ref:r,className:re(`react-resizable-handle z-10 react-resizable-handle-${t} absolute border-foreground/40`,{"border-foreground/40 group-hover:border-2 group-hover:border-b-0 group-hover:border-r-0":t==="nw"&&i<11,"border-foreground/40 group-hover:border-2 group-hover:border-b-0 group-hover:border-l-0":t==="ne"&&i<11,"border-foreground/40 group-hover:border-2 group-hover:border-r-0 group-hover:border-t-0":t==="sw"&&i<11,"border-foreground/40 group-hover:border-2 group-hover:border-l-0 group-hover:border-t-0":t==="se"&&i<11,"border-foreground/40 group-hover:border-2 group-hover:border-b-0 group-hover:border-l-0 group-hover:border-t-0":t==="e","border-foreground/40 group-hover:border-2 group-hover:border-b-0 group-hover:border-r-0 group-hover:border-t-0":t==="w"},e),...n})});SV.displayName="ResizeHandle";const{createElement:nd,createContext:Fke,forwardRef:EV,useCallback:Mr,useContext:_V,useEffect:Fl,useImperativeHandle:RV,useLayoutEffect:Lke,useMemo:$ke,useRef:Tr,useState:du}=w,QI=w[`useId${Math.random()}`.slice(0,5)],zke=Lke,uv=Fke(null);uv.displayName="PanelGroupContext";const Ll=zke,Bke=typeof QI=="function"?QI:()=>null;let Vke=0;function bk(e=null){const t=Bke(),n=Tr(e||t||null);return n.current===null&&(n.current=""+Vke++),e??n.current}function kV({children:e,className:t="",collapsedSize:n,collapsible:r,defaultSize:o,forwardedRef:i,id:s,maxSize:a,minSize:l,onCollapse:c,onExpand:u,onResize:d,order:h,style:p,tagName:g="div",...m}){const b=_V(uv);if(b===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:y,expandPanel:v,getPanelSize:x,getPanelStyle:S,groupId:_,isPanelCollapsed:E,reevaluatePanelConstraints:C,registerPanel:k,resizePanel:N,unregisterPanel:M}=b,A=bk(s),P=Tr({callbacks:{onCollapse:c,onExpand:u,onResize:d},constraints:{collapsedSize:n,collapsible:r,defaultSize:o,maxSize:a,minSize:l},id:A,idIsFromProps:s!==void 0,order:h});Tr({didLogMissingDefaultSizeWarning:!1}),Ll(()=>{const{callbacks:F,constraints:I}=P.current,O={...I};P.current.id=A,P.current.idIsFromProps=s!==void 0,P.current.order=h,F.onCollapse=c,F.onExpand=u,F.onResize=d,I.collapsedSize=n,I.collapsible=r,I.defaultSize=o,I.maxSize=a,I.minSize=l,(O.collapsedSize!==I.collapsedSize||O.collapsible!==I.collapsible||O.maxSize!==I.maxSize||O.minSize!==I.minSize)&&C(P.current,O)}),Ll(()=>{const F=P.current;return k(F),()=>{M(F)}},[h,A,k,M]),RV(i,()=>({collapse:()=>{y(P.current)},expand:F=>{v(P.current,F)},getId(){return A},getSize(){return x(P.current)},isCollapsed(){return E(P.current)},isExpanded(){return!E(P.current)},resize:F=>{N(P.current,F)}}),[y,v,x,E,A,N]);const j=S(P.current,o);return nd(g,{...m,children:e,className:t,id:s,style:{...j,...p},"data-panel":"","data-panel-collapsible":r||void 0,"data-panel-group-id":_,"data-panel-id":A,"data-panel-size":parseFloat(""+j.flexGrow).toFixed(1)})}const NV=EV((e,t)=>nd(kV,{...e,forwardedRef:t}));kV.displayName="Panel";NV.displayName="forwardRef(Panel)";let jS=null,ml=null;function Hke(e,t){if(t){const n=(t&IV)!==0,r=(t&TV)!==0,o=(t&jV)!==0,i=(t&OV)!==0;if(n)return o?"se-resize":i?"ne-resize":"e-resize";if(r)return o?"sw-resize":i?"nw-resize":"w-resize";if(o)return"s-resize";if(i)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function Wke(){ml!==null&&(document.head.removeChild(ml),jS=null,ml=null)}function jw(e,t){const n=Hke(e,t);jS!==n&&(jS=n,ml===null&&(ml=document.createElement("style"),document.head.appendChild(ml)),ml.innerHTML=`*{cursor: ${n}!important;}`)}function MV(e){return e.type==="keydown"}function PV(e){return e.type.startsWith("pointer")}function DV(e){return e.type.startsWith("mouse")}function dv(e){if(PV(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(DV(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function Uke(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function Gke(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 qke(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:eT(e),b:eT(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;it(r,"Stacking order can only be calculated for elements with a common ancestor");const o={a:JI(ZI(n.a)),b:JI(ZI(n.b))};if(o.a===o.b){const i=r.childNodes,s={a:n.a.at(-1),b:n.b.at(-1)};let a=i.length;for(;a--;){const l=i[a];if(l===s.a)return 1;if(l===s.b)return-1}}return Math.sign(o.a-o.b)}const Yke=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Kke(e){var t;const n=getComputedStyle((t=AV(e))!==null&&t!==void 0?t:e).display;return n==="flex"||n==="inline-flex"}function Xke(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Kke(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"||Yke.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function ZI(e){let t=e.length;for(;t--;){const n=e[t];if(it(n,"Missing node"),Xke(n))return n}return null}function JI(e){return e&&Number(getComputedStyle(e).zIndex)||0}function eT(e){const t=[];for(;e;)t.push(e),e=AV(e);return t}function AV(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const IV=1,TV=2,jV=4,OV=8,Qke=Uke()==="coarse";let Ho=[],fu=!1,Us=new Map,fv=new Map;const Th=new Set;function Zke(e,t,n,r,o){var i;const{ownerDocument:s}=t,a={direction:n,element:t,hitAreaMargins:r,setResizeHandlerState:o},l=(i=Us.get(s))!==null&&i!==void 0?i:0;return Us.set(s,l+1),Th.add(a),p0(),function(){var u;fv.delete(e),Th.delete(a);const d=(u=Us.get(s))!==null&&u!==void 0?u:1;if(Us.set(s,d-1),p0(),d===1&&Us.delete(s),Ho.includes(a)){const h=Ho.indexOf(a);h>=0&&Ho.splice(h,1),vk(),o("up",!0,null)}}}function tT(e){const{target:t}=e,{x:n,y:r}=dv(e);fu=!0,yk({target:t,x:n,y:r}),p0(),Ho.length>0&&(m0("down",e),e.preventDefault(),e.stopPropagation())}function Zd(e){const{x:t,y:n}=dv(e);if(fu&&e.buttons===0&&(fu=!1,m0("up",e)),!fu){const{target:r}=e;yk({target:r,x:t,y:n})}m0("move",e),vk(),Ho.length>0&&e.preventDefault()}function $c(e){const{target:t}=e,{x:n,y:r}=dv(e);fv.clear(),fu=!1,Ho.length>0&&e.preventDefault(),m0("up",e),yk({target:t,x:n,y:r}),vk(),p0()}function yk({target:e,x:t,y:n}){Ho.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),Th.forEach(o=>{const{element:i,hitAreaMargins:s}=o,a=i.getBoundingClientRect(),{bottom:l,left:c,right:u,top:d}=a,h=Qke?s.coarse:s.fine;if(t>=c-h&&t<=u+h&&n>=d-h&&n<=l+h){if(r!==null&&document.contains(r)&&i!==r&&!i.contains(r)&&!r.contains(i)&&qke(r,i)>0){let g=r,m=!1;for(;g&&!g.contains(i);){if(Gke(g.getBoundingClientRect(),a)){m=!0;break}g=g.parentElement}if(m)return}Ho.push(o)}})}function Ow(e,t){fv.set(e,t)}function vk(){let e=!1,t=!1;Ho.forEach(r=>{const{direction:o}=r;o==="horizontal"?e=!0:t=!0});let n=0;fv.forEach(r=>{n|=r}),e&&t?jw("intersection",n):e?jw("horizontal",n):t?jw("vertical",n):Wke()}function p0(){Us.forEach((e,t)=>{const{body:n}=t;n.removeEventListener("contextmenu",$c),n.removeEventListener("pointerdown",tT),n.removeEventListener("pointerleave",Zd),n.removeEventListener("pointermove",Zd)}),window.removeEventListener("pointerup",$c),window.removeEventListener("pointercancel",$c),Th.size>0&&(fu?(Ho.length>0&&Us.forEach((e,t)=>{const{body:n}=t;e>0&&(n.addEventListener("contextmenu",$c),n.addEventListener("pointerleave",Zd),n.addEventListener("pointermove",Zd))}),window.addEventListener("pointerup",$c),window.addEventListener("pointercancel",$c)):Us.forEach((e,t)=>{const{body:n}=t;e>0&&(n.addEventListener("pointerdown",tT,{capture:!0}),n.addEventListener("pointermove",Zd))}))}function m0(e,t){Th.forEach(n=>{const{setResizeHandlerState:r}=n,o=Ho.includes(n);r(e,o,t)})}function Jke(){const[e,t]=du(0);return Mr(()=>t(n=>n+1),[])}function it(e,t){if(!e)throw console.error(t),Error(t)}const xk=10;function nc(e,t,n=xk){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function ss(e,t,n=xk){return nc(e,t,n)===0}function Xr(e,t,n){return nc(e,t,n)===0}function eNe(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){const o=e[r],i=t[r];if(!Xr(o,i,n))return!1}return!0}function Zc({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];it(r!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:o=0,collapsible:i,maxSize:s=100,minSize:a=0}=r;if(nc(n,a)<0)if(i){const l=(o+a)/2;nc(n,l)<0?n=o:n=a}else n=a;return n=Math.min(s,n),n=parseFloat(n.toFixed(xk)),n}function yf({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:o,trigger:i}){if(Xr(e,0))return t;const s=[...t],[a,l]=r;it(a!=null,"Invalid first pivot index"),it(l!=null,"Invalid second pivot index");let c=0;if(i==="keyboard"){{const d=e<0?l:a,h=n[d];it(h,`Panel constraints not found for index ${d}`);const{collapsedSize:p=0,collapsible:g,minSize:m=0}=h;if(g){const b=t[d];if(it(b!=null,`Previous layout not found for panel index ${d}`),Xr(b,p)){const y=m-b;nc(y,Math.abs(e))>0&&(e=e<0?0-y:y)}}}{const d=e<0?a:l,h=n[d];it(h,`No panel constraints found for index ${d}`);const{collapsedSize:p=0,collapsible:g,minSize:m=0}=h;if(g){const b=t[d];if(it(b!=null,`Previous layout not found for panel index ${d}`),Xr(b,m)){const y=b-p;nc(y,Math.abs(e))>0&&(e=e<0?0-y:y)}}}}{const d=e<0?1:-1;let h=e<0?l:a,p=0;for(;;){const m=t[h];it(m!=null,`Previous layout not found for panel index ${h}`);const y=Zc({panelConstraints:n,panelIndex:h,size:100})-m;if(p+=y,h+=d,h<0||h>=n.length)break}const g=Math.min(Math.abs(e),Math.abs(p));e=e<0?0-g:g}{let h=e<0?a:l;for(;h>=0&&h<n.length;){const p=Math.abs(e)-Math.abs(c),g=t[h];it(g!=null,`Previous layout not found for panel index ${h}`);const m=g-p,b=Zc({panelConstraints:n,panelIndex:h,size:m});if(!Xr(g,b)&&(c+=g-b,s[h]=b,c.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?h--:h++}}if(eNe(o,s))return o;{const d=e<0?l:a,h=t[d];it(h!=null,`Previous layout not found for panel index ${d}`);const p=h+c,g=Zc({panelConstraints:n,panelIndex:d,size:p});if(s[d]=g,!Xr(g,p)){let m=p-g,y=e<0?l:a;for(;y>=0&&y<n.length;){const v=s[y];it(v!=null,`Previous layout not found for panel index ${y}`);const x=v+m,S=Zc({panelConstraints:n,panelIndex:y,size:x});if(Xr(v,S)||(m-=S-v,s[y]=S),Xr(m,0))break;e>0?y--:y++}}}const u=s.reduce((d,h)=>h+d,0);return Xr(u,100)?s:o}function tNe({layout:e,panelsArray:t,pivotIndices:n}){let r=0,o=100,i=0,s=0;const a=n[0];it(a!=null,"No pivot index found"),t.forEach((d,h)=>{const{constraints:p}=d,{maxSize:g=100,minSize:m=0}=p;h===a?(r=m,o=g):(i+=m,s+=g)});const l=Math.min(o,100-i),c=Math.max(r,100-s),u=e[a];return{valueMax:l,valueMin:c,valueNow:u}}function jh(e,t=document){return Array.from(t.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function FV(e,t,n=document){const o=jh(e,n).findIndex(i=>i.getAttribute("data-panel-resize-handle-id")===t);return o??null}function LV(e,t,n){const r=FV(e,t,n);return r!=null?[r,r+1]:[-1,-1]}function $V(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 hv(e,t=document){const n=t.querySelector(`[data-panel-resize-handle-id="${e}"]`);return n||null}function nNe(e,t,n,r=document){var o,i,s,a;const l=hv(t,r),c=jh(e,r),u=l?c.indexOf(l):-1,d=(o=(i=n[u])===null||i===void 0?void 0:i.id)!==null&&o!==void 0?o:null,h=(s=(a=n[u+1])===null||a===void 0?void 0:a.id)!==null&&s!==void 0?s:null;return[d,h]}function rNe({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:r,panelDataArray:o,panelGroupElement:i,setLayout:s}){Tr({didWarnAboutMissingResizeHandle:!1}),Ll(()=>{if(!i)return;const a=jh(n,i);for(let l=0;l<o.length-1;l++){const{valueMax:c,valueMin:u,valueNow:d}=tNe({layout:r,panelsArray:o,pivotIndices:[l,l+1]}),h=a[l];if(h!=null){const p=o[l];it(p,`No panel data found for index "${l}"`),h.setAttribute("aria-controls",p.id),h.setAttribute("aria-valuemax",""+Math.round(c)),h.setAttribute("aria-valuemin",""+Math.round(u)),h.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,o,i]),Fl(()=>{if(!i)return;const a=t.current;it(a,"Eager values not found");const{panelDataArray:l}=a,c=$V(n,i);it(c!=null,`No group found for id "${n}"`);const u=jh(n,i);it(u,`No resize handles found for group id "${n}"`);const d=u.map(h=>{const p=h.getAttribute("data-panel-resize-handle-id");it(p,"Resize handle element has no handle id attribute");const[g,m]=nNe(n,p,l,i);if(g==null||m==null)return()=>{};const b=y=>{if(!y.defaultPrevented)switch(y.key){case"Enter":{y.preventDefault();const v=l.findIndex(x=>x.id===g);if(v>=0){const x=l[v];it(x,`No panel data found for index ${v}`);const S=r[v],{collapsedSize:_=0,collapsible:E,minSize:C=0}=x.constraints;if(S!=null&&E){const k=yf({delta:Xr(S,_)?C-_:_-S,initialLayout:r,panelConstraints:l.map(N=>N.constraints),pivotIndices:LV(n,p,i),prevLayout:r,trigger:"keyboard"});r!==k&&s(k)}}break}}};return h.addEventListener("keydown",b),()=>{h.removeEventListener("keydown",b)}});return()=>{d.forEach(h=>h())}},[i,e,t,n,r,o,s])}function nT(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 zV(e,t){const n=e==="horizontal",{x:r,y:o}=dv(t);return n?r:o}function oNe(e,t,n,r,o){const i=n==="horizontal",s=hv(t,o);it(s,`No resize handle element found for id "${t}"`);const a=s.getAttribute("data-panel-group-id");it(a,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=r;const c=zV(n,e),u=$V(a,o);it(u,`No group element found for id "${a}"`);const d=u.getBoundingClientRect(),h=i?d.width:d.height;return(c-l)/h*100}function iNe(e,t,n,r,o,i){if(MV(e)){const s=n==="horizontal";let a=0;e.shiftKey?a=100:o!=null?a=o: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:oNe(e,t,n,r,i)}function sNe({panelDataArray:e}){const t=Array(e.length),n=e.map(i=>i.constraints);let r=0,o=100;for(let i=0;i<e.length;i++){const s=n[i];it(s,`Panel constraints not found for index ${i}`);const{defaultSize:a}=s;a!=null&&(r++,t[i]=a,o-=a)}for(let i=0;i<e.length;i++){const s=n[i];it(s,`Panel constraints not found for index ${i}`);const{defaultSize:a}=s;if(a!=null)continue;const l=e.length-r,c=o/l;r++,t[i]=c,o-=c}return t}function zc(e,t,n){t.forEach((r,o)=>{const i=e[o];it(i,`Panel data not found for index ${o}`);const{callbacks:s,constraints:a,id:l}=i,{collapsedSize:c=0,collapsible:u}=a,d=n[l];if(d==null||r!==d){n[l]=r;const{onCollapse:h,onExpand:p,onResize:g}=s;g&&g(r,d),u&&(h||p)&&(p&&(d==null||ss(d,c))&&!ss(r,c)&&p(),h&&(d==null||!ss(d,c))&&ss(r,c)&&h())}})}function mg(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 aNe({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:o,precision:i=3}){const s=n[o];let a;return s==null?a=e!=null?e.toPrecision(i):"1":r.length===1?a="1":a=s.toPrecision(i),{flexBasis:0,flexGrow:a,flexShrink:1,overflow:"hidden",pointerEvents:t!==null?"none":void 0}}function lNe(e,t=10){let n=null;return(...o)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...o)},t)}}function rT(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 BV(e){return`react-resizable-panels:${e}`}function VV(e){return e.map(t=>{const{constraints:n,id:r,idIsFromProps:o,order:i}=t;return o?r:i?`${i}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((t,n)=>t.localeCompare(n)).join(",")}function HV(e,t){try{const n=BV(e),r=t.getItem(n);if(r){const o=JSON.parse(r);if(typeof o=="object"&&o!=null)return o}}catch{}return null}function cNe(e,t,n){var r,o;const i=(r=HV(e,n))!==null&&r!==void 0?r:{},s=VV(t);return(o=i[s])!==null&&o!==void 0?o:null}function uNe(e,t,n,r,o){var i;const s=BV(e),a=VV(t),l=(i=HV(e,o))!==null&&i!==void 0?i:{};l[a]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{o.setItem(s,JSON.stringify(l))}catch(c){console.error(c)}}function oT({layout:e,panelConstraints:t}){const n=[...e],r=n.reduce((i,s)=>i+s,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(i=>`${i}%`).join(", ")}`);if(!Xr(r,100)&&n.length>0)for(let i=0;i<t.length;i++){const s=n[i];it(s!=null,`No layout data found for index ${i}`);const a=100/r*s;n[i]=a}let o=0;for(let i=0;i<t.length;i++){const s=n[i];it(s!=null,`No layout data found for index ${i}`);const a=Zc({panelConstraints:t,panelIndex:i,size:s});s!=a&&(o+=s-a,n[i]=a)}if(!Xr(o,0))for(let i=0;i<t.length;i++){const s=n[i];it(s!=null,`No layout data found for index ${i}`);const a=s+o,l=Zc({panelConstraints:t,panelIndex:i,size:a});if(s!==l&&(o-=l-s,n[i]=l,Xr(o,0)))break}return n}const dNe=100,vf={getItem:e=>(rT(vf),vf.getItem(e)),setItem:(e,t)=>{rT(vf),vf.setItem(e,t)}},iT={};function WV({autoSaveId:e=null,children:t,className:n="",direction:r,forwardedRef:o,id:i=null,onLayout:s=null,keyboardResizeBy:a=null,storage:l=vf,style:c,tagName:u="div",...d}){const h=bk(i),p=Tr(null),[g,m]=du(null),[b,y]=du([]),v=Jke(),x=Tr({}),S=Tr(new Map),_=Tr(0),E=Tr({autoSaveId:e,direction:r,dragState:g,id:h,keyboardResizeBy:a,onLayout:s,storage:l}),C=Tr({layout:b,panelDataArray:[],panelDataArrayChanged:!1});Tr({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),RV(o,()=>({getId:()=>E.current.id,getLayout:()=>{const{layout:D}=C.current;return D},setLayout:D=>{const{onLayout:H}=E.current,{layout:V,panelDataArray:q}=C.current,U=oT({layout:D,panelConstraints:q.map(Y=>Y.constraints)});nT(V,U)||(y(U),C.current.layout=U,H&&H(U),zc(q,U,x.current))}}),[]),Ll(()=>{E.current.autoSaveId=e,E.current.direction=r,E.current.dragState=g,E.current.id=h,E.current.onLayout=s,E.current.storage=l}),rNe({committedValuesRef:E,eagerValuesRef:C,groupId:h,layout:b,panelDataArray:C.current.panelDataArray,setLayout:y,panelGroupElement:p.current}),Fl(()=>{const{panelDataArray:D}=C.current;if(e){if(b.length===0||b.length!==D.length)return;let H=iT[e];H==null&&(H=lNe(uNe,dNe),iT[e]=H);const V=[...D],q=new Map(S.current);H(e,V,q,b,l)}},[e,b,l]),Fl(()=>{});const k=Mr(D=>{const{onLayout:H}=E.current,{layout:V,panelDataArray:q}=C.current;if(D.constraints.collapsible){const U=q.map(ee=>ee.constraints),{collapsedSize:Y=0,panelSize:K,pivotIndices:Z}=Za(q,D,V);if(it(K!=null,`Panel size not found for panel "${D.id}"`),!ss(K,Y)){S.current.set(D.id,K);const Q=Uc(q,D)===q.length-1?K-Y:Y-K,ie=yf({delta:Q,initialLayout:V,panelConstraints:U,pivotIndices:Z,prevLayout:V,trigger:"imperative-api"});mg(V,ie)||(y(ie),C.current.layout=ie,H&&H(ie),zc(q,ie,x.current))}}},[]),N=Mr((D,H)=>{const{onLayout:V}=E.current,{layout:q,panelDataArray:U}=C.current;if(D.constraints.collapsible){const Y=U.map(te=>te.constraints),{collapsedSize:K=0,panelSize:Z=0,minSize:ee=0,pivotIndices:Q}=Za(U,D,q),ie=H??ee;if(ss(Z,K)){const te=S.current.get(D.id),le=te!=null&&te>=ie?te:ie,Re=Uc(U,D)===U.length-1?Z-le:le-Z,be=yf({delta:Re,initialLayout:q,panelConstraints:Y,pivotIndices:Q,prevLayout:q,trigger:"imperative-api"});mg(q,be)||(y(be),C.current.layout=be,V&&V(be),zc(U,be,x.current))}}},[]),M=Mr(D=>{const{layout:H,panelDataArray:V}=C.current,{panelSize:q}=Za(V,D,H);return it(q!=null,`Panel size not found for panel "${D.id}"`),q},[]),A=Mr((D,H)=>{const{panelDataArray:V}=C.current,q=Uc(V,D);return aNe({defaultSize:H,dragState:g,layout:b,panelData:V,panelIndex:q})},[g,b]),P=Mr(D=>{const{layout:H,panelDataArray:V}=C.current,{collapsedSize:q=0,collapsible:U,panelSize:Y}=Za(V,D,H);return it(Y!=null,`Panel size not found for panel "${D.id}"`),U===!0&&ss(Y,q)},[]),j=Mr(D=>{const{layout:H,panelDataArray:V}=C.current,{collapsedSize:q=0,collapsible:U,panelSize:Y}=Za(V,D,H);return it(Y!=null,`Panel size not found for panel "${D.id}"`),!U||nc(Y,q)>0},[]),F=Mr(D=>{const{panelDataArray:H}=C.current;H.push(D),H.sort((V,q)=>{const U=V.order,Y=q.order;return U==null&&Y==null?0:U==null?-1:Y==null?1:U-Y}),C.current.panelDataArrayChanged=!0,v()},[v]);Ll(()=>{if(C.current.panelDataArrayChanged){C.current.panelDataArrayChanged=!1;const{autoSaveId:D,onLayout:H,storage:V}=E.current,{layout:q,panelDataArray:U}=C.current;let Y=null;if(D){const Z=cNe(D,U,V);Z&&(S.current=new Map(Object.entries(Z.expandToSizes)),Y=Z.layout)}Y==null&&(Y=sNe({panelDataArray:U}));const K=oT({layout:Y,panelConstraints:U.map(Z=>Z.constraints)});nT(q,K)||(y(K),C.current.layout=K,H&&H(K),zc(U,K,x.current))}}),Ll(()=>{const D=C.current;return()=>{D.layout=[]}},[]);const I=Mr(D=>{let H=!1;const V=p.current;return V&&window.getComputedStyle(V,null).getPropertyValue("direction")==="rtl"&&(H=!0),function(U){U.preventDefault();const Y=p.current;if(!Y)return()=>null;const{direction:K,dragState:Z,id:ee,keyboardResizeBy:Q,onLayout:ie}=E.current,{layout:te,panelDataArray:le}=C.current,{initialLayout:ue}=Z??{},Re=LV(ee,D,Y);let be=iNe(U,D,K,Z,Q,Y);const we=K==="horizontal";we&&H&&(be=-be);const Pe=le.map(me=>me.constraints),Ye=yf({delta:be,initialLayout:ue??te,panelConstraints:Pe,pivotIndices:Re,prevLayout:te,trigger:MV(U)?"keyboard":"mouse-or-touch"}),_t=!mg(te,Ye);(PV(U)||DV(U))&&_.current!=be&&(_.current=be,!_t&&be!==0?we?Ow(D,be<0?IV:TV):Ow(D,be<0?jV:OV):Ow(D,0)),_t&&(y(Ye),C.current.layout=Ye,ie&&ie(Ye),zc(le,Ye,x.current))}},[]),O=Mr((D,H)=>{const{onLayout:V}=E.current,{layout:q,panelDataArray:U}=C.current,Y=U.map(te=>te.constraints),{panelSize:K,pivotIndices:Z}=Za(U,D,q);it(K!=null,`Panel size not found for panel "${D.id}"`);const Q=Uc(U,D)===U.length-1?K-H:H-K,ie=yf({delta:Q,initialLayout:q,panelConstraints:Y,pivotIndices:Z,prevLayout:q,trigger:"imperative-api"});mg(q,ie)||(y(ie),C.current.layout=ie,V&&V(ie),zc(U,ie,x.current))},[]),$=Mr((D,H)=>{const{layout:V,panelDataArray:q}=C.current,{collapsedSize:U=0,collapsible:Y}=H,{collapsedSize:K=0,collapsible:Z,maxSize:ee=100,minSize:Q=0}=D.constraints,{panelSize:ie}=Za(q,D,V);ie!=null&&(Y&&Z&&ss(ie,U)?ss(U,K)||O(D,K):ie<Q?O(D,Q):ie>ee&&O(D,ee))},[O]),B=Mr((D,H)=>{const{direction:V}=E.current,{layout:q}=C.current;if(!p.current)return;const U=hv(D,p.current);it(U,`Drag handle element not found for id "${D}"`);const Y=zV(V,H);m({dragHandleId:D,dragHandleRect:U.getBoundingClientRect(),initialCursorPosition:Y,initialLayout:q})},[]),z=Mr(()=>{m(null)},[]),T=Mr(D=>{const{panelDataArray:H}=C.current,V=Uc(H,D);V>=0&&(H.splice(V,1),delete x.current[D.id],C.current.panelDataArrayChanged=!0,v())},[v]),W=$ke(()=>({collapsePanel:k,direction:r,dragState:g,expandPanel:N,getPanelSize:M,getPanelStyle:A,groupId:h,isPanelCollapsed:P,isPanelExpanded:j,reevaluatePanelConstraints:$,registerPanel:F,registerResizeHandle:I,resizePanel:O,startDragging:B,stopDragging:z,unregisterPanel:T,panelGroupElement:p.current}),[k,g,r,N,M,A,h,P,j,$,F,I,O,B,z,T]),L={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return nd(uv.Provider,{value:W},nd(u,{...d,children:t,className:n,id:i,ref:p,style:{...L,...c},"data-panel-group":"","data-panel-group-direction":r,"data-panel-group-id":h}))}const UV=EV((e,t)=>nd(WV,{...e,forwardedRef:t}));WV.displayName="PanelGroup";UV.displayName="forwardRef(PanelGroup)";function Uc(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function Za(e,t,n){const r=Uc(e,t),i=r===e.length-1?[r-1,r]:[r,r+1],s=n[r];return{...t.constraints,panelSize:s,pivotIndices:i}}function fNe({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:r}){Fl(()=>{if(e||n==null||r==null)return;const o=hv(t,r);if(o==null)return;const i=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=o.getAttribute("data-panel-group-id");it(a,`No group element found for id "${a}"`);const l=jh(a,r),c=FV(a,t,r);it(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 o.addEventListener("keydown",i),()=>{o.removeEventListener("keydown",i)}},[r,e,t,n])}function wk({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:r,id:o,onBlur:i,onDragging:s,onFocus:a,style:l={},tabIndex:c=0,tagName:u="div",...d}){var h,p;const g=Tr(null),m=Tr({onDragging:s});Fl(()=>{m.current.onDragging=s});const b=_V(uv);if(b===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:y,groupId:v,registerResizeHandle:x,startDragging:S,stopDragging:_,panelGroupElement:E}=b,C=bk(o),[k,N]=du("inactive"),[M,A]=du(!1),[P,j]=du(null),F=Tr({state:k});Ll(()=>{F.current.state=k}),Fl(()=>{if(n)j(null);else{const B=x(C);j(()=>B)}},[n,C,x]);const I=(h=r==null?void 0:r.coarse)!==null&&h!==void 0?h:15,O=(p=r==null?void 0:r.fine)!==null&&p!==void 0?p:5;return Fl(()=>{if(n||P==null)return;const B=g.current;return it(B,"Element ref not attached"),Zke(C,B,y,{coarse:I,fine:O},(T,W,L)=>{if(W)switch(T){case"down":{N("drag"),it(L,'Expected event to be defined for "down" action'),S(C,L);const{onDragging:D}=m.current;D&&D(!0);break}case"move":{const{state:D}=F.current;D!=="drag"&&N("hover"),it(L,'Expected event to be defined for "move" action'),P(L);break}case"up":{N("hover"),_();const{onDragging:D}=m.current;D&&D(!1);break}}else N("inactive")})},[I,y,n,O,x,C,P,S,_]),fNe({disabled:n,handleId:C,resizeHandler:P,panelGroupElement:E}),nd(u,{...d,children:e,className:t,id:o,onBlur:()=>{A(!1),i==null||i()},onFocus:()=>{A(!0),a==null||a()},ref:g,role:"separator",style:{...{touchAction:"none",userSelect:"none"},...l},tabIndex:c,"data-panel-group-direction":y,"data-panel-group-id":v,"data-resize-handle":"","data-resize-handle-active":k==="drag"?"pointer":M?"keyboard":void 0,"data-resize-handle-state":k,"data-panel-resize-handle-enabled":!n,"data-panel-resize-handle-id":C})}wk.displayName="PanelResizeHandle";const GV=({className:e,...t})=>f.jsx(UV,{className:re("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t}),OS=NV,hNe=({withHandle:e,className:t,...n})=>f.jsx(wk,{className:re("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&&f.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:f.jsx(uF,{className:"h-2.5 w-2.5"})})}),pNe=({withHandle:e,className:t,onTabClick:n,open:r,...o})=>f.jsx(wk,{className:re("relative flex w-px items-start justify-end bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",{"justify-start":r},t),...o,children:e&&!r&&f.jsx("div",{className:re("z-50 flex items-center justify-start",{"border-l":r}),children:f.jsx(Ee,{variant:"secondary",className:re("h-7 p-2",{"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?f.jsx(pJ,{className:"size-4"}):f.jsx(mJ,{className:"size-4"})})})});var qV=w.forwardRef((e,t)=>{const{children:n,...r}=e,o=w.Children.toArray(n),i=o.find(mNe);if(i){const s=i.props.children,a=o.map(l=>l===i?w.Children.count(s)>1?w.Children.only(null):w.isValidElement(s)?s.props.children:null:l);return f.jsx(FS,{...r,ref:t,children:w.isValidElement(s)?w.cloneElement(s,void 0,a):null})}return f.jsx(FS,{...r,ref:t,children:n})});qV.displayName="Slot";var FS=w.forwardRef((e,t)=>{const{children:n,...r}=e;if(w.isValidElement(n)){const o=bNe(n),i=gNe(r,n.props);return n.type!==w.Fragment&&(i.ref=t?vr(t,o):o),w.cloneElement(n,i)}return w.Children.count(n)>1?w.Children.only(null):null});FS.displayName="SlotClone";var YV=({children:e})=>f.jsx(f.Fragment,{children:e});function mNe(e){return w.isValidElement(e)&&e.type===YV}function gNe(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function bNe(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Ck="Dialog",[KV,XV]=Pn(Ck),[yNe,ni]=KV(Ck),QV=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!0}=e,a=w.useRef(null),l=w.useRef(null),[c=!1,u]=or({prop:r,defaultProp:o,onChange:i});return f.jsx(yNe,{scope:t,triggerRef:a,contentRef:l,contentId:_n(),titleId:_n(),descriptionId:_n(),open:c,onOpenChange:u,onOpenToggle:w.useCallback(()=>u(d=>!d),[u]),modal:s,children:n})};QV.displayName=Ck;var ZV="DialogTrigger",JV=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ni(ZV,n),i=Ve(t,o.triggerRef);return f.jsx(_e.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":_k(o.open),...r,ref:i,onClick:fe(e.onClick,o.onOpenToggle)})});JV.displayName=ZV;var Sk="DialogPortal",[vNe,eH]=KV(Sk,{forceMount:void 0}),tH=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,i=ni(Sk,t);return f.jsx(vNe,{scope:t,forceMount:n,children:w.Children.map(r,s=>f.jsx(fn,{present:n||i.open,children:f.jsx(mc,{asChild:!0,container:o,children:s})}))})};tH.displayName=Sk;var g0="DialogOverlay",nH=w.forwardRef((e,t)=>{const n=eH(g0,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=ni(g0,e.__scopeDialog);return i.modal?f.jsx(fn,{present:r||i.open,children:f.jsx(xNe,{...o,ref:t})}):null});nH.displayName=g0;var xNe=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ni(g0,n);return f.jsx(hc,{as:qV,allowPinchZoom:!0,shards:[o.contentRef],children:f.jsx(_e.div,{"data-state":_k(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),rc="DialogContent",rH=w.forwardRef((e,t)=>{const n=eH(rc,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=ni(rc,e.__scopeDialog);return f.jsx(fn,{present:r||i.open,children:i.modal?f.jsx(wNe,{...o,ref:t}):f.jsx(CNe,{...o,ref:t})})});rH.displayName=rc;var wNe=w.forwardRef((e,t)=>{const n=ni(rc,e.__scopeDialog),r=w.useRef(null),o=Ve(t,n.contentRef,r);return w.useEffect(()=>{const i=r.current;if(i)return cd(i)},[]),f.jsx(oH,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:fe(e.onCloseAutoFocus,i=>{var s;i.preventDefault(),(s=n.triggerRef.current)==null||s.focus()}),onPointerDownOutside:fe(e.onPointerDownOutside,i=>{const s=i.detail.originalEvent,a=s.button===0&&s.ctrlKey===!0;(s.button===2||a)&&i.preventDefault()}),onFocusOutside:fe(e.onFocusOutside,i=>i.preventDefault())})}),CNe=w.forwardRef((e,t)=>{const n=ni(rc,e.__scopeDialog),r=w.useRef(!1),o=w.useRef(!1);return f.jsx(oH,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s,a;(s=e.onCloseAutoFocus)==null||s.call(e,i),i.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:i=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=i.target;((c=n.triggerRef.current)==null?void 0:c.contains(s))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),oH=w.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,...s}=e,a=ni(rc,n),l=w.useRef(null),c=Ve(t,l);return cy(),f.jsxs(f.Fragment,{children:[f.jsx(xp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:f.jsx(pc,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":_k(a.open),...s,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),f.jsxs(f.Fragment,{children:[f.jsx(ENe,{titleId:a.titleId}),f.jsx(RNe,{contentRef:l,descriptionId:a.descriptionId})]})]})}),Ek="DialogTitle",iH=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ni(Ek,n);return f.jsx(_e.h2,{id:o.titleId,...r,ref:t})});iH.displayName=Ek;var sH="DialogDescription",aH=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ni(sH,n);return f.jsx(_e.p,{id:o.descriptionId,...r,ref:t})});aH.displayName=sH;var lH="DialogClose",cH=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ni(lH,n);return f.jsx(_e.button,{type:"button",...r,ref:t,onClick:fe(e.onClick,()=>o.onOpenChange(!1))})});cH.displayName=lH;function _k(e){return e?"open":"closed"}var uH="DialogTitleWarning",[SNe,dH]=_K(uH,{contentName:rc,titleName:Ek,docsSlug:"dialog"}),ENe=({titleId:e})=>{const t=dH(uH),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
560
|
+
`)),[]});var LEe=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(LEe||{});function $Ee(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function zEe(e,t,n,r){let[o,i]=R.useState(n),{hasFlag:s,addFlag:a,removeFlag:l}=FEe(e&&o?3:0),c=R.useRef(!1),u=R.useRef(!1),d=Wp();return sn(()=>{var h;if(e){if(n&&i(!0),!t){n&&a(3);return}return(h=void 0)==null||h.call(r,n),BEe(t,{inFlight:c,prepare(){u.current?u.current=!1:u.current=c.current,c.current=!0,!u.current&&(n?(a(3),l(4)):(a(4),l(2)))},run(){u.current?n?(l(3),a(4)):(l(4),a(3)):n?l(1):a(1)},done(){var p;u.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(c.current=!1,l(7),n||i(!1),(p=void 0)==null||p.call(r,n))}})}},[e,n,t,d]),e?[o,{closed:s(1),enter:s(2),leave:s(4),transition:s(2)||s(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function BEe(e,{prepare:t,run:n,done:r,inFlight:o}){let i=Ii();return HEe(e,{prepare:t,inFlight:o}),i.nextFrame(()=>{n(),i.requestAnimationFrame(()=>{i.add(VEe(e,r))})}),i.dispose}function VEe(e,t){var n,r;let o=Ii();if(!e)return o.dispose;let i=!1;o.add(()=>{i=!0});let s=(r=(n=e.getAnimations)==null?void 0:n.call(e).filter(a=>a instanceof CSSTransition))!=null?r:[];return s.length===0?(t(),o.dispose):(Promise.allSettled(s.map(a=>a.finished)).then(()=>{i||t()}),o.dispose)}function HEe(e,{inFlight:t,prepare:n}){if(t!=null&&t.current){n();return}let r=e.style.transition;e.style.transition="none",n(),e.offsetHeight,e.style.transition=r}function WEe(e,{container:t,accept:n,walk:r}){let o=R.useRef(n),i=R.useRef(r);R.useEffect(()=>{o.current=n,i.current=r},[n,r]),sn(()=>{if(!t||!e)return;let s=Hp(t);if(!s)return;let a=o.current,l=i.current,c=Object.assign(d=>a(d),{acceptNode:a}),u=s.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,c,!1);for(;u.nextNode();)l(u.currentNode)},[t,e,o,i])}function AI(e,t){let n=R.useRef([]),r=Xe(e);R.useEffect(()=>{let o=[...n.current];for(let[i,s]of t.entries())if(n.current[i]!==s){let a=r(t,o);return n.current=t,a}},[r,...t])}function UEe(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}const Bz={...w},GEe=Bz.useInsertionEffect,qEe=GEe||(e=>e());function Vz(e){const t=w.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return qEe(()=>{t.current=e}),w.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}var NS=typeof document<"u"?R.useLayoutEffect:R.useEffect;let II=!1,YEe=0;const TI=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+YEe++;function KEe(){const[e,t]=w.useState(()=>II?TI():void 0);return NS(()=>{e==null&&t(TI())},[]),w.useEffect(()=>{II=!0},[]),e}const XEe=Bz.useId,QEe=XEe||KEe;let Mh;process.env.NODE_ENV!=="production"&&(Mh=new Set);function ZEe(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=Mh)!=null&&e.has(o))){var i;(i=Mh)==null||i.add(o),console.warn(o)}}function JEe(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=Mh)!=null&&e.has(o))){var i;(i=Mh)==null||i.add(o),console.error(o)}}function e2e(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,((r=e.get(t))==null?void 0:r.filter(o=>o!==n))||[])}}}const t2e=w.createContext(null),n2e=w.createContext(null),r2e=()=>{var e;return((e=w.useContext(t2e))==null?void 0:e.id)||null},o2e=()=>w.useContext(n2e),i2e="data-floating-ui-focusable";function s2e(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=QEe(),i=w.useRef({}),[s]=w.useState(()=>e2e()),a=r2e()!=null;if(process.env.NODE_ENV!=="production"){const p=r.reference;p&&!Qn(p)&&JEe("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[l,c]=w.useState(r.reference),u=Vz((p,g,m)=>{i.current.openEvent=p?g:void 0,s.emit("openchange",{open:p,event:g,reason:m,nested:a}),n==null||n(p,g,m)}),d=w.useMemo(()=>({setPositionReference:c}),[]),h=w.useMemo(()=>({reference:l||r.reference||null,floating:r.floating||null,domReference:r.reference}),[l,r.reference,r.floating]);return w.useMemo(()=>({dataRef:i,open:t,onOpenChange:u,elements:h,events:s,floatingId:o,refs:d}),[t,u,h,s,o,d])}function a2e(e){e===void 0&&(e={});const{nodeId:t}=e,n=s2e({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[i,s]=w.useState(null),[a,l]=w.useState(null),u=(o==null?void 0:o.domReference)||i,d=w.useRef(null),h=o2e();NS(()=>{u&&(d.current=u)},[u]);const p=Y2({...e,elements:{...o,...a&&{reference:a}}}),g=w.useCallback(x=>{const S=Qn(x)?{getBoundingClientRect:()=>x.getBoundingClientRect(),contextElement:x}:x;l(S),p.refs.setReference(S)},[p.refs]),m=w.useCallback(x=>{(Qn(x)||x===null)&&(d.current=x,s(x)),(Qn(p.refs.reference.current)||p.refs.reference.current===null||x!==null&&!Qn(x))&&p.refs.setReference(x)},[p.refs]),b=w.useMemo(()=>({...p.refs,setReference:m,setPositionReference:g,domReference:d}),[p.refs,m,g]),y=w.useMemo(()=>({...p.elements,domReference:u}),[p.elements,u]),v=w.useMemo(()=>({...p,...r,refs:b,elements:y,nodeId:t}),[p,b,y,t,r]);return NS(()=>{r.dataRef.current.floatingContext=v;const x=h==null?void 0:h.nodesRef.current.find(S=>S.id===t);x&&(x.context=v)}),w.useMemo(()=>({...p,context:v,refs:b,elements:y}),[p,b,y,v])}const jI="active",OI="selected";function Nw(e,t,n){const r=new Map,o=n==="item";let i=e;if(o&&e){const{[jI]:s,[OI]:a,...l}=e;i=l}return{...n==="floating"&&{tabIndex:-1,[i2e]:""},...i,...t.map(s=>{const a=s?s[n]:null;return typeof a=="function"?e?a(e):null:a}).concat(e).reduce((s,a)=>(a&&Object.entries(a).forEach(l=>{let[c,u]=l;if(!(o&&[jI,OI].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof u=="function"){var d;(d=r.get(c))==null||d.push(u),s[c]=function(){for(var h,p=arguments.length,g=new Array(p),m=0;m<p;m++)g[m]=arguments[m];return(h=r.get(c))==null?void 0:h.map(b=>b(...g)).find(b=>b!==void 0)}}}else s[c]=u}),s),{})}}function l2e(e){e===void 0&&(e=[]);const t=e.map(a=>a==null?void 0:a.reference),n=e.map(a=>a==null?void 0:a.floating),r=e.map(a=>a==null?void 0:a.item),o=w.useCallback(a=>Nw(a,e,"reference"),t),i=w.useCallback(a=>Nw(a,e,"floating"),n),s=w.useCallback(a=>Nw(a,e,"item"),r);return w.useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:s}),[o,i,s])}function FI(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const c2e=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:i=0,index:s=0,minItemsVisible:a=4,referenceOverflowThreshold:l=0,scrollRef:c,...u}=Ni(e,t),{rects:d,elements:{floating:h}}=t,p=n.current[s],g=(c==null?void 0:c.current)||h,m=h.clientTop||g.clientTop,b=h.clientTop!==0,y=g.clientTop!==0,v=h===g;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||ZEe('`placement` side must be "bottom" when using the `inner`',"middleware.")),!p)return{};const x={...t,...await hy(-p.offsetTop-h.clientTop-d.reference.height/2-p.offsetHeight/2-i).fn(t)},S=await Sx(FI(x,g.scrollHeight+m+h.clientTop),u),_=await Sx(x,{...u,elementContext:"reference"}),E=Xn(0,S.top),C=x.y+E,M=(g.scrollHeight>g.clientHeight?A=>A:uh)(Xn(0,g.scrollHeight+(b&&v||y?m*2:0)-E-Xn(0,S.bottom)));if(g.style.maxHeight=M+"px",g.scrollTop=E,o){const A=g.offsetHeight<p.offsetHeight*ws(a,n.current.length)-1||_.top>=-l||_.bottom>=-l;vs.flushSync(()=>o(A))}return r&&(r.current=await Sx(FI({...x,y:C},g.offsetHeight+m+h.clientTop),u)),{y:C}}});function u2e(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:i,scrollRef:s,onChange:a}=t,l=Vz(a),c=w.useRef(!1),u=w.useRef(null),d=w.useRef(null);w.useEffect(()=>{if(!o)return;function p(m){if(m.ctrlKey||!g||i.current==null)return;const b=m.deltaY,y=i.current.top>=-.5,v=i.current.bottom>=-.5,x=g.scrollHeight-g.clientHeight,S=b<0?-1:1,_=b<0?"max":"min";g.scrollHeight<=g.clientHeight||(!y&&b>0||!v&&b<0?(m.preventDefault(),vs.flushSync(()=>{l(E=>E+Math[_](b,x*S))})):/firefox/i.test(UEe())&&(g.scrollTop+=b))}const g=(s==null?void 0:s.current)||r.floating;if(n&&g)return g.addEventListener("wheel",p),requestAnimationFrame(()=>{u.current=g.scrollTop,i.current!=null&&(d.current={...i.current})}),()=>{u.current=null,d.current=null,g.removeEventListener("wheel",p)}},[o,n,r.floating,i,s,l]);const h=w.useMemo(()=>({onKeyDown(){c.current=!0},onWheel(){c.current=!1},onPointerMove(){c.current=!1},onScroll(){const p=(s==null?void 0:s.current)||r.floating;if(!(!i.current||!p||!c.current)){if(u.current!==null){const g=p.scrollTop-u.current;(i.current.bottom<-.5&&g<-1||i.current.top<-.5&&g>1)&&vs.flushSync(()=>l(m=>m+g))}requestAnimationFrame(()=>{u.current=p.scrollTop})}}}),[r.floating,l,i,s]);return w.useMemo(()=>o?{floating:h}:{},[o,h])}let Up=R.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Up.displayName="FloatingContext";let nk=R.createContext(null);nk.displayName="PlacementContext";function d2e(e){return R.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function f2e(){return R.useContext(Up).setReference}function h2e(){let{getFloatingProps:e,slot:t}=R.useContext(Up);return R.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function p2e(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=R.useContext(nk),n=R.useMemo(()=>e,[JSON.stringify(e,(o,i)=>{var s;return(s=i==null?void 0:i.outerHTML)!=null?s:i})]);sn(()=>{t==null||t(n??null)},[t,n]);let r=R.useContext(Up);return R.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let LI=4;function m2e({children:e,enabled:t=!0}){let[n,r]=R.useState(null),[o,i]=R.useState(0),s=R.useRef(null),[a,l]=R.useState(null);g2e(a);let c=t&&n!==null&&a!==null,{to:u="bottom",gap:d=0,offset:h=0,padding:p=0,inner:g}=b2e(n,a),[m,b="center"]=u.split(" ");sn(()=>{c&&i(0)},[c]);let{refs:y,floatingStyles:v,context:x}=a2e({open:c,placement:m==="selection"?b==="center"?"bottom":`bottom-${b}`:b==="center"?`${m}`:`${m}-${b}`,strategy:"absolute",transform:!1,middleware:[hy({mainAxis:m==="selection"?0:d,crossAxis:h}),K2({padding:p}),m!=="selection"&&X2({padding:p}),m==="selection"&&g?c2e({...g,padding:p,overflowRef:s,offset:o,minItemsVisible:LI,referenceOverflowThreshold:p,onFallbackChange(A){var P,j;if(!A)return;let F=x.elements.floating;if(!F)return;let I=parseFloat(getComputedStyle(F).scrollPaddingBottom)||0,O=Math.min(LI,F.childElementCount),$=0,B=0;for(let z of(j=(P=x.elements.floating)==null?void 0:P.childNodes)!=null?j:[])if(z instanceof HTMLElement){let T=z.offsetTop,W=T+z.clientHeight+I,L=F.scrollTop,D=L+F.clientHeight;if(T>=L&&W<=D)O--;else{B=Math.max(0,Math.min(W,D)-Math.max(T,L)),$=z.clientHeight;break}}O>=1&&i(z=>{let T=$*O-B+I;return z>=T?z:T})}}):null,Q2({padding:p,apply({availableWidth:A,availableHeight:P,elements:j}){Object.assign(j.floating.style,{overflow:"auto",maxWidth:`${A}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${P}px)`})}})].filter(Boolean),whileElementsMounted:q2}),[S=m,_=b]=x.placement.split("-");m==="selection"&&(S="selection");let E=R.useMemo(()=>({anchor:[S,_].filter(Boolean).join(" ")}),[S,_]),C=u2e(x,{overflowRef:s,onChange:i}),{getReferenceProps:k,getFloatingProps:N}=l2e([C]),M=Xe(A=>{l(A),y.setFloating(A)});return w.createElement(nk.Provider,{value:r},w.createElement(Up.Provider,{value:{setFloating:M,setReference:y.setReference,styles:v,getReferenceProps:k,getFloatingProps:N,slot:E}},e))}function g2e(e){sn(()=>{if(!e)return;let t=new MutationObserver(()=>{let n=window.getComputedStyle(e).maxHeight,r=parseFloat(n);if(isNaN(r))return;let o=parseInt(n);isNaN(o)||r!==o&&(e.style.maxHeight=`${Math.ceil(r)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}function b2e(e,t){var n,r,o;let i=Mw((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),s=Mw((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),a=Mw((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:i,offset:s,padding:a}}function Mw(e,t,n=void 0){let r=Wp(),o=Xe((l,c)=>{if(l==null)return[n,null];if(typeof l=="number")return[l,null];if(typeof l=="string"){if(!c)return[n,null];let u=$I(l,c);return[u,d=>{let h=Hz(l);{let p=h.map(g=>window.getComputedStyle(c).getPropertyValue(g));r.requestAnimationFrame(function g(){r.nextFrame(g);let m=!1;for(let[y,v]of h.entries()){let x=window.getComputedStyle(c).getPropertyValue(v);if(p[y]!==x){p[y]=x,m=!0;break}}if(!m)return;let b=$I(l,c);u!==b&&(d(b),u=b)})}return r.dispose}]}return[n,null]}),i=R.useMemo(()=>o(e,t)[0],[e,t]),[s=i,a]=R.useState();return sn(()=>{let[l,c]=o(e,t);if(a(l),!!c)return c(a)},[e,t]),s}function Hz(e){let t=/var\((.*)\)/.exec(e);if(t){let n=t[1].indexOf(",");if(n===-1)return[t[1]];let r=t[1].slice(0,n).trim(),o=t[1].slice(n+1).trim();return o?[r,...Hz(o)]:[r]}return[]}function $I(e,t){let n=document.createElement("div");t.appendChild(n),n.style.setProperty("margin-top","0px","important"),n.style.setProperty("margin-top",e,"important");let r=parseFloat(window.getComputedStyle(n).marginTop)||0;return t.removeChild(n),r}function y2e({children:e,freeze:t}){let n=MS(t,e);return R.createElement(R.Fragment,null,n)}function MS(e,t){let[n,r]=R.useState(t);return!e&&n!==t&&r(t),e?n:t}let rk=R.createContext(null);rk.displayName="OpenClosedContext";var Ph=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Ph||{});function v2e(){return R.useContext(rk)}function x2e({value:e,children:t}){return R.createElement(rk.Provider,{value:e},t)}function w2e(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let al=[];w2e(()=>{function e(t){if(!(t.target instanceof HTMLElement)||t.target===document.body||al[0]===t.target)return;let n=t.target;n=n.closest(kS),al.unshift(n??t.target),al=al.filter(r=>r!=null&&r.isConnected),al.splice(10)}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})});function C2e(e){throw new Error("Unexpected object: "+e)}var Sn=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(Sn||{});function zI(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),o=r??-1;switch(e.focus){case 0:{for(let i=0;i<n.length;++i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 1:{o===-1&&(o=n.length);for(let i=o-1;i>=0;--i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 2:{for(let i=o+1;i<n.length;++i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 3:{for(let i=n.length-1;i>=0;--i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 4:{for(let i=0;i<n.length;++i)if(t.resolveId(n[i],i,n)===e.id)return i;return r}case 5:return null;default:C2e(e)}}var ok=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(ok||{});function S2e(e){let t=Xe(e),n=R.useRef(!1);R.useEffect(()=>(n.current=!1,()=>{n.current=!0,Ez(()=>{n.current&&t()})}),[t])}function E2e(){let e=typeof document>"u";return"useSyncExternalStore"in w?(t=>t.useSyncExternalStore)(w)(()=>()=>{},()=>!1,()=>!e):!1}function _2e(){let e=E2e(),[t,n]=w.useState(Ol.isHandoffComplete);return t&&Ol.isHandoffComplete===!1&&n(!1),w.useEffect(()=>{t!==!0&&n(!0)},[t]),w.useEffect(()=>Ol.handoff(),[]),e?!1:t}let R2e=R.createContext(!1);function k2e(){return R.useContext(R2e)}function N2e(e){let t=k2e(),n=R.useContext(Uz),r=av(e),[o,i]=R.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(Ol.isServer)return null;let a=r==null?void 0:r.getElementById("headlessui-portal-root");if(a)return a;if(r===null)return null;let l=r.createElement("div");return l.setAttribute("id","headlessui-portal-root"),r.body.appendChild(l)});return R.useEffect(()=>{o!==null&&(r!=null&&r.body.contains(o)||r==null||r.body.appendChild(o))},[o,r]),R.useEffect(()=>{t||n!==null&&i(n.current)},[n,i,t]),o}let Wz=R.Fragment,M2e=ti(function(e,t){let n=e,r=R.useRef(null),o=Ms(WSe(d=>{r.current=d}),t),i=av(r),s=N2e(r),[a]=R.useState(()=>{var d;return Ol.isServer?null:(d=i==null?void 0:i.createElement("div"))!=null?d:null}),l=R.useContext(I2e),c=_2e();sn(()=>{!s||!a||s.contains(a)||(a.setAttribute("data-headlessui-portal",""),s.appendChild(a))},[s,a]),sn(()=>{if(a&&l)return l.register(a)},[l,a]),S2e(()=>{var d;!s||!a||(a instanceof Node&&s.contains(a)&&s.removeChild(a),s.childNodes.length<=0&&((d=s.parentElement)==null||d.removeChild(s)))});let u=ei();return c?!s||!a?null:rn.createPortal(u({ourProps:{ref:o},theirProps:n,slot:{},defaultTag:Wz,name:"Portal"}),a):null});function P2e(e,t){let n=Ms(t),{enabled:r=!0,...o}=e,i=ei();return r?R.createElement(M2e,{...o,ref:n}):i({ourProps:{ref:n},theirProps:o,slot:{},defaultTag:Wz,name:"Portal"})}let D2e=R.Fragment,Uz=R.createContext(null);function A2e(e,t){let{target:n,...r}=e,o={ref:Ms(t)},i=ei();return R.createElement(Uz.Provider,{value:n},i({ourProps:o,theirProps:r,defaultTag:D2e,name:"Popover.Group"}))}let I2e=R.createContext(null),T2e=ti(P2e),j2e=ti(A2e),O2e=Object.assign(T2e,{Group:j2e});var F2e=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(F2e||{}),L2e=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(L2e||{}),$2e=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))($2e||{}),z2e=(e=>(e[e.OpenCombobox=0]="OpenCombobox",e[e.CloseCombobox=1]="CloseCombobox",e[e.GoToOption=2]="GoToOption",e[e.SetTyping=3]="SetTyping",e[e.RegisterOption=4]="RegisterOption",e[e.UnregisterOption=5]="UnregisterOption",e[e.SetActivationTrigger=6]="SetActivationTrigger",e[e.UpdateVirtualConfiguration=7]="UpdateVirtualConfiguration",e[e.SetInputElement=8]="SetInputElement",e[e.SetButtonElement=9]="SetButtonElement",e[e.SetOptionsElement=10]="SetOptionsElement",e))(z2e||{});function Pw(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=t(e.options.slice()),o=r.length>0&&r[0].dataRef.current.order!==null?r.sort((s,a)=>s.dataRef.current.order-a.dataRef.current.order):EEe(r,s=>s.dataRef.current.domRef.current),i=n?o.indexOf(n):null;return i===-1&&(i=null),{options:o,activeOptionIndex:i}}let B2e={1(e){var t;return(t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===1?e:{...e,activeOptionIndex:null,comboboxState:1,isTyping:!1,activationTrigger:2,__demoMode:!1}},0(e){var t,n;if((t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===0)return e;if((n=e.dataRef.current)!=null&&n.value){let r=e.dataRef.current.calculateIndex(e.dataRef.current.value);if(r!==-1)return{...e,activeOptionIndex:r,comboboxState:0,__demoMode:!1}}return{...e,comboboxState:0,__demoMode:!1}},3(e,t){return e.isTyping===t.isTyping?e:{...e,isTyping:t.isTyping}},2(e,t){var n,r,o,i;if((n=e.dataRef.current)!=null&&n.disabled||e.optionsElement&&!((r=e.dataRef.current)!=null&&r.optionsPropsRef.current.static)&&e.comboboxState===1)return e;if(e.virtual){let{options:c,disabled:u}=e.virtual,d=t.focus===Sn.Specific?t.idx:zI(t,{resolveItems:()=>c,resolveActiveIndex:()=>{var p,g;return(g=(p=e.activeOptionIndex)!=null?p:c.findIndex(m=>!u(m)))!=null?g:null},resolveDisabled:u,resolveId(){throw new Error("Function not implemented.")}}),h=(o=t.trigger)!=null?o:2;return e.activeOptionIndex===d&&e.activationTrigger===h?e:{...e,activeOptionIndex:d,activationTrigger:h,isTyping:!1,__demoMode:!1}}let s=Pw(e);if(s.activeOptionIndex===null){let c=s.options.findIndex(u=>!u.dataRef.current.disabled);c!==-1&&(s.activeOptionIndex=c)}let a=t.focus===Sn.Specific?t.idx:zI(t,{resolveItems:()=>s.options,resolveActiveIndex:()=>s.activeOptionIndex,resolveId:c=>c.id,resolveDisabled:c=>c.dataRef.current.disabled}),l=(i=t.trigger)!=null?i:2;return e.activeOptionIndex===a&&e.activationTrigger===l?e:{...e,...s,isTyping:!1,activeOptionIndex:a,activationTrigger:l,__demoMode:!1}},4:(e,t)=>{var n,r,o;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:[...e.options,t.payload]};let i=t.payload,s=Pw(e,l=>(l.push(i),l));e.activeOptionIndex===null&&(r=e.dataRef.current)!=null&&r.isSelected(t.payload.dataRef.current.value)&&(s.activeOptionIndex=s.options.indexOf(i));let a={...e,...s,activationTrigger:2};return(o=e.dataRef.current)!=null&&o.__demoMode&&e.dataRef.current.value===void 0&&(a.activeOptionIndex=0),a},5:(e,t)=>{var n;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:e.options.filter(o=>o.id!==t.id)};let r=Pw(e,o=>{let i=o.findIndex(s=>s.id===t.id);return i!==-1&&o.splice(i,1),o});return{...e,...r,activationTrigger:2}},6:(e,t)=>e.activationTrigger===t.trigger?e:{...e,activationTrigger:t.trigger},7:(e,t)=>{var n,r;if(e.virtual===null)return{...e,virtual:{options:t.options,disabled:(n=t.disabled)!=null?n:()=>!1}};if(e.virtual.options===t.options&&e.virtual.disabled===t.disabled)return e;let o=e.activeOptionIndex;if(e.activeOptionIndex!==null){let i=t.options.indexOf(e.virtual.options[e.activeOptionIndex]);i!==-1?o=i:o=null}return{...e,activeOptionIndex:o,virtual:{options:t.options,disabled:(r=t.disabled)!=null?r:()=>!1}}},8:(e,t)=>e.inputElement===t.element?e:{...e,inputElement:t.element},9:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},10:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element}},ik=R.createContext(null);ik.displayName="ComboboxActionsContext";function Gp(e){let t=R.useContext(ik);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Gp),n}return t}let Gz=R.createContext(null);function V2e(e){let t=Md("VirtualProvider"),{options:n}=t.virtual,[r,o]=R.useMemo(()=>{let c=t.optionsElement;if(!c)return[0,0];let u=window.getComputedStyle(c);return[parseFloat(u.paddingBlockStart||u.paddingTop),parseFloat(u.paddingBlockEnd||u.paddingBottom)]},[t.optionsElement]),i=dEe({enabled:n.length!==0,scrollPaddingStart:r,scrollPaddingEnd:o,count:n.length,estimateSize(){return 40},getScrollElement(){return t.optionsElement},overscan:12}),[s,a]=R.useState(0);sn(()=>{a(c=>c+1)},[n]);let l=i.getVirtualItems();return l.length===0?null:R.createElement(Gz.Provider,{value:i},R.createElement("div",{style:{position:"relative",width:"100%",height:`${i.getTotalSize()}px`},ref:c=>{c&&t.activationTrigger!==0&&t.activeOptionIndex!==null&&n.length>t.activeOptionIndex&&i.scrollToIndex(t.activeOptionIndex)}},l.map(c=>{var u;return R.createElement(R.Fragment,{key:c.key},R.cloneElement((u=e.children)==null?void 0:u.call(e,{...e.slot,option:n[c.index]}),{key:`${s}-${c.key}`,"data-index":c.index,"aria-setsize":n.length,"aria-posinset":c.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${c.start}px)`,overflowAnchor:"none"}}))})))}let Dh=R.createContext(null);Dh.displayName="ComboboxDataContext";function Md(e){let t=R.useContext(Dh);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Md),n}return t}function H2e(e,t){return ys(t.type,B2e,e,t)}let W2e=R.Fragment;function U2e(e,t){var n,r;let o=QR(),{value:i,defaultValue:s,onChange:a,form:l,name:c,by:u,disabled:d=o||!1,onClose:h,__demoMode:p=!1,multiple:g=!1,immediate:m=!1,virtual:b=null,nullable:y,...v}=e,x=TSe(s),[S=g?[]:void 0,_]=ISe(i,a,x),[E,C]=R.useReducer(H2e,{dataRef:R.createRef(),comboboxState:p?0:1,isTyping:!1,options:[],virtual:b?{options:b.options,disabled:(n=b.disabled)!=null?n:()=>!1}:null,activeOptionIndex:null,activationTrigger:2,inputElement:null,buttonElement:null,optionsElement:null,__demoMode:p}),k=R.useRef(!1),N=R.useRef({static:!1,hold:!1}),M=hEe(u),A=Xe(te=>b?u===null?b.options.indexOf(te):b.options.findIndex(le=>M(le,te)):E.options.findIndex(le=>M(le.dataRef.current.value,te))),P=R.useCallback(te=>ys(F.mode,{1:()=>S.some(le=>M(le,te)),0:()=>M(S,te)}),[S]),j=Xe(te=>E.activeOptionIndex===A(te)),F=R.useMemo(()=>({...E,immediate:m,optionsPropsRef:N,value:S,defaultValue:x,disabled:d,mode:g?1:0,virtual:b?E.virtual:null,get activeOptionIndex(){if(k.current&&E.activeOptionIndex===null&&(b?b.options.length>0:E.options.length>0)){if(b){let le=b.options.findIndex(ue=>{var Re,be;return!((be=(Re=b.disabled)==null?void 0:Re.call(b,ue))!=null&&be)});if(le!==-1)return le}let te=E.options.findIndex(le=>!le.dataRef.current.disabled);if(te!==-1)return te}return E.activeOptionIndex},calculateIndex:A,compare:M,isSelected:P,isActive:j}),[S,x,d,g,p,E,b]);sn(()=>{var te;b&&C({type:7,options:b.options,disabled:(te=b.disabled)!=null?te:null})},[b,b==null?void 0:b.options,b==null?void 0:b.disabled]),sn(()=>{E.dataRef.current=F},[F]);let I=F.comboboxState===0;kEe(I,[F.buttonElement,F.inputElement,F.optionsElement],()=>Y.closeCombobox());let O=R.useMemo(()=>{var te,le,ue;return{open:F.comboboxState===0,disabled:d,activeIndex:F.activeOptionIndex,activeOption:F.activeOptionIndex===null?null:F.virtual?F.virtual.options[(te=F.activeOptionIndex)!=null?te:0]:(ue=(le=F.options[F.activeOptionIndex])==null?void 0:le.dataRef.current.value)!=null?ue:null,value:S}},[F,d,S]),$=Xe(()=>{if(F.activeOptionIndex!==null){if(Y.setIsTyping(!1),F.virtual)D(F.virtual.options[F.activeOptionIndex]);else{let{dataRef:te}=F.options[F.activeOptionIndex];D(te.current.value)}Y.goToOption(Sn.Specific,F.activeOptionIndex)}}),B=Xe(()=>{C({type:0}),k.current=!0}),z=Xe(()=>{C({type:1}),k.current=!1,h==null||h()}),T=Xe(te=>{C({type:3,isTyping:te})}),W=Xe((te,le,ue)=>(k.current=!1,te===Sn.Specific?C({type:2,focus:Sn.Specific,idx:le,trigger:ue}):C({type:2,focus:te,trigger:ue}))),L=Xe((te,le)=>(C({type:4,payload:{id:te,dataRef:le}}),()=>{F.isActive(le.current.value)&&(k.current=!0),C({type:5,id:te})})),D=Xe(te=>ys(F.mode,{0(){return _==null?void 0:_(te)},1(){let le=F.value.slice(),ue=le.findIndex(Re=>M(Re,te));return ue===-1?le.push(te):le.splice(ue,1),_==null?void 0:_(le)}})),H=Xe(te=>{C({type:6,trigger:te})}),V=Xe(te=>{C({type:8,element:te})}),q=Xe(te=>{C({type:9,element:te})}),U=Xe(te=>{C({type:10,element:te})}),Y=R.useMemo(()=>({onChange:D,registerOption:L,goToOption:W,setIsTyping:T,closeCombobox:z,openCombobox:B,setActivationTrigger:H,selectActiveOption:$,setInputElement:V,setButtonElement:q,setOptionsElement:U}),[]),[K,Z]=KSe(),ee=t===null?{}:{ref:t},Q=R.useCallback(()=>{if(x!==void 0)return _==null?void 0:_(x)},[_,x]),ie=ei();return R.createElement(Z,{value:K,props:{htmlFor:(r=F.inputElement)==null?void 0:r.id},slot:{open:F.comboboxState===0,disabled:d}},R.createElement(m2e,null,R.createElement(ik.Provider,{value:Y},R.createElement(Dh.Provider,{value:F},R.createElement(x2e,{value:ys(F.comboboxState,{0:Ph.Open,1:Ph.Closed})},c!=null&&R.createElement($Se,{disabled:d,data:S!=null?{[c]:S}:{},form:l,onReset:Q}),ie({ourProps:ee,theirProps:v,slot:O,defaultTag:W2e,name:"Combobox"}))))))}let G2e="input";function q2e(e,t){var n,r,o,i,s;let a=Md("Combobox.Input"),l=Gp("Combobox.Input"),c=R.useId(),u=Pz(),{id:d=u||`headlessui-combobox-input-${c}`,onChange:h,displayValue:p,disabled:g=a.disabled||!1,autoFocus:m=!1,type:b="text",...y}=e,v=R.useRef(null),x=Ms(v,t,f2e(),l.setInputElement),S=av(a.inputElement),_=Wp(),E=Xe(()=>{l.onChange(null),a.optionsElement&&(a.optionsElement.scrollTop=0),l.goToOption(Sn.Nothing)}),C=R.useMemo(()=>{var D;return typeof p=="function"&&a.value!==void 0?(D=p(a.value))!=null?D:"":typeof a.value=="string"?a.value:""},[a.value,p]);AI(([D,H],[V,q])=>{if(a.isTyping)return;let U=v.current;U&&((q===0&&H===1||D!==V)&&(U.value=D),requestAnimationFrame(()=>{if(a.isTyping||!U||(S==null?void 0:S.activeElement)!==U)return;let{selectionStart:Y,selectionEnd:K}=U;Math.abs((K??0)-(Y??0))===0&&Y===0&&U.setSelectionRange(U.value.length,U.value.length)}))},[C,a.comboboxState,S,a.isTyping]),AI(([D],[H])=>{if(D===0&&H===1){if(a.isTyping)return;let V=v.current;if(!V)return;let q=V.value,{selectionStart:U,selectionEnd:Y,selectionDirection:K}=V;V.value="",V.value=q,K!==null?V.setSelectionRange(U,Y,K):V.setSelectionRange(U,Y)}},[a.comboboxState]);let k=R.useRef(!1),N=Xe(()=>{k.current=!0}),M=Xe(()=>{_.nextFrame(()=>{k.current=!1})}),A=Xe(D=>{switch(l.setIsTyping(!0),D.key){case fr.Enter:if(a.comboboxState!==0||k.current)return;if(D.preventDefault(),D.stopPropagation(),a.activeOptionIndex===null){l.closeCombobox();return}l.selectActiveOption(),a.mode===0&&l.closeCombobox();break;case fr.ArrowDown:return D.preventDefault(),D.stopPropagation(),ys(a.comboboxState,{0:()=>l.goToOption(Sn.Next),1:()=>l.openCombobox()});case fr.ArrowUp:return D.preventDefault(),D.stopPropagation(),ys(a.comboboxState,{0:()=>l.goToOption(Sn.Previous),1:()=>{rn.flushSync(()=>l.openCombobox()),a.value||l.goToOption(Sn.Last)}});case fr.Home:if(D.shiftKey)break;return D.preventDefault(),D.stopPropagation(),l.goToOption(Sn.First);case fr.PageUp:return D.preventDefault(),D.stopPropagation(),l.goToOption(Sn.First);case fr.End:if(D.shiftKey)break;return D.preventDefault(),D.stopPropagation(),l.goToOption(Sn.Last);case fr.PageDown:return D.preventDefault(),D.stopPropagation(),l.goToOption(Sn.Last);case fr.Escape:return a.comboboxState!==0?void 0:(D.preventDefault(),a.optionsElement&&!a.optionsPropsRef.current.static&&D.stopPropagation(),a.mode===0&&a.value===null&&E(),l.closeCombobox());case fr.Tab:if(a.comboboxState!==0)return;a.mode===0&&a.activationTrigger!==1&&l.selectActiveOption(),l.closeCombobox();break}}),P=Xe(D=>{h==null||h(D),a.mode===0&&D.target.value===""&&E(),l.openCombobox()}),j=Xe(D=>{var H,V,q;let U=(H=D.relatedTarget)!=null?H:al.find(Y=>Y!==D.currentTarget);if(!((V=a.optionsElement)!=null&&V.contains(U))&&!((q=a.buttonElement)!=null&&q.contains(U))&&a.comboboxState===0)return D.preventDefault(),a.mode===0&&a.value===null&&E(),l.closeCombobox()}),F=Xe(D=>{var H,V,q;let U=(H=D.relatedTarget)!=null?H:al.find(Y=>Y!==D.currentTarget);(V=a.buttonElement)!=null&&V.contains(U)||(q=a.optionsElement)!=null&&q.contains(U)||a.disabled||a.immediate&&a.comboboxState!==0&&_.microTask(()=>{rn.flushSync(()=>l.openCombobox()),l.setActivationTrigger(1)})}),I=sv(),O=USe(),{isFocused:$,focusProps:B}=Sz({autoFocus:m}),{isHovered:z,hoverProps:T}=Cz({isDisabled:g}),W=R.useMemo(()=>({open:a.comboboxState===0,disabled:g,hover:z,focus:$,autofocus:m}),[a,z,$,m,g]),L=ZR({ref:x,id:d,role:"combobox",type:b,"aria-controls":(n=a.optionsElement)==null?void 0:n.id,"aria-expanded":a.comboboxState===0,"aria-activedescendant":a.activeOptionIndex===null?void 0:a.virtual?(r=a.options.find(D=>!D.dataRef.current.disabled&&a.compare(D.dataRef.current.value,a.virtual.options[a.activeOptionIndex])))==null?void 0:r.id:(o=a.options[a.activeOptionIndex])==null?void 0:o.id,"aria-labelledby":I,"aria-describedby":O,"aria-autocomplete":"list",defaultValue:(s=(i=e.defaultValue)!=null?i:a.defaultValue!==void 0?p==null?void 0:p(a.defaultValue):null)!=null?s:a.defaultValue,disabled:g||void 0,autoFocus:m,onCompositionStart:N,onCompositionEnd:M,onKeyDown:A,onChange:P,onFocus:F,onBlur:j},B,T);return ei()({ourProps:L,theirProps:y,slot:W,defaultTag:G2e,name:"Combobox.Input"})}let Y2e="button";function K2e(e,t){var n;let r=Md("Combobox.Button"),o=Gp("Combobox.Button"),i=Ms(t,o.setButtonElement),s=R.useId(),{id:a=`headlessui-combobox-button-${s}`,disabled:l=r.disabled||!1,autoFocus:c=!1,...u}=e,d=zz(r.inputElement),h=Xe(C=>{switch(C.key){case fr.Space:case fr.Enter:C.preventDefault(),C.stopPropagation(),r.comboboxState===1&&rn.flushSync(()=>o.openCombobox()),d();return;case fr.ArrowDown:C.preventDefault(),C.stopPropagation(),r.comboboxState===1&&(rn.flushSync(()=>o.openCombobox()),r.value||o.goToOption(Sn.First)),d();return;case fr.ArrowUp:C.preventDefault(),C.stopPropagation(),r.comboboxState===1&&(rn.flushSync(()=>o.openCombobox()),r.value||o.goToOption(Sn.Last)),d();return;case fr.Escape:if(r.comboboxState!==0)return;C.preventDefault(),r.optionsElement&&!r.optionsPropsRef.current.static&&C.stopPropagation(),rn.flushSync(()=>o.closeCombobox()),d();return;default:return}}),p=Xe(C=>{C.preventDefault(),!VSe(C.currentTarget)&&(C.button===ok.Left&&(r.comboboxState===0?o.closeCombobox():o.openCombobox()),d())}),g=sv([a]),{isFocusVisible:m,focusProps:b}=Sz({autoFocus:c}),{isHovered:y,hoverProps:v}=Cz({isDisabled:l}),{pressed:x,pressProps:S}=RSe({disabled:l}),_=R.useMemo(()=>({open:r.comboboxState===0,active:x||r.comboboxState===0,disabled:l,value:r.value,hover:y,focus:m}),[r,y,m,x,l]),E=ZR({ref:i,id:a,type:MEe(e,r.buttonElement),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":(n=r.optionsElement)==null?void 0:n.id,"aria-expanded":r.comboboxState===0,"aria-labelledby":g,disabled:l||void 0,autoFocus:c,onMouseDown:p,onKeyDown:h},b,v,S);return ei()({ourProps:E,theirProps:u,slot:_,defaultTag:Y2e,name:"Combobox.Button"})}let X2e="div",Q2e=_S.RenderStrategy|_S.Static;function Z2e(e,t){var n,r,o;let i=R.useId(),{id:s=`headlessui-combobox-options-${i}`,hold:a=!1,anchor:l,portal:c=!1,modal:u=!0,transition:d=!1,...h}=e,p=Md("Combobox.Options"),g=Gp("Combobox.Options"),m=d2e(l);m&&(c=!0);let[b,y]=p2e(m),[v,x]=R.useState(null),S=h2e(),_=Ms(t,m?b:null,g.setOptionsElement,x),E=av(p.optionsElement),C=v2e(),[k,N]=zEe(d,v,C!==null?(C&Ph.Open)===Ph.Open:p.comboboxState===0);yEe(k,p.inputElement,g.closeCombobox);let M=p.__demoMode?!1:u&&p.comboboxState===0;jEe(M,E);let A=p.__demoMode?!1:u&&p.comboboxState===0;bEe(A,{allowed:R.useCallback(()=>[p.inputElement,p.buttonElement,p.optionsElement],[p.inputElement,p.buttonElement,p.optionsElement])}),sn(()=>{var L;p.optionsPropsRef.current.static=(L=e.static)!=null?L:!1},[p.optionsPropsRef,e.static]),sn(()=>{p.optionsPropsRef.current.hold=a},[p.optionsPropsRef,a]),WEe(p.comboboxState===0,{container:p.optionsElement,accept(L){return L.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:L.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(L){L.setAttribute("role","none")}});let P=sv([(n=p.buttonElement)==null?void 0:n.id]),j=R.useMemo(()=>({open:p.comboboxState===0,option:void 0}),[p.comboboxState]),F=Xe(()=>{g.setActivationTrigger(0)}),I=Xe(L=>{L.preventDefault(),g.setActivationTrigger(0)}),O=ZR(m?S():{},{"aria-labelledby":P,role:"listbox","aria-multiselectable":p.mode===1?!0:void 0,id:s,ref:_,style:{...h.style,...y,"--input-width":_I(p.inputElement,!0).width,"--button-width":_I(p.buttonElement,!0).width},onWheel:p.activationTrigger===0?void 0:F,onMouseDown:I,...$Ee(N)}),$=k&&p.comboboxState===1,B=MS($,(r=p.virtual)==null?void 0:r.options),z=MS($,p.value),T=Xe(L=>p.compare(z,L));if(p.virtual){if(B===void 0)throw new Error("Missing `options` in virtual mode");Object.assign(h,{children:R.createElement(Dh.Provider,{value:B!==p.virtual.options?{...p,virtual:{...p.virtual,options:B}}:p},R.createElement(V2e,{slot:j},h.children))})}let W=ei();return R.createElement(O2e,{enabled:c?e.static||k:!1},R.createElement(Dh.Provider,{value:p.mode===1?p:{...p,isSelected:T}},W({ourProps:O,theirProps:{...h,children:R.createElement(y2e,{freeze:$},typeof h.children=="function"?(o=h.children)==null?void 0:o.call(h,j):h.children)},slot:j,defaultTag:X2e,features:Q2e,visible:k,name:"Combobox.Options"})))}let J2e="div";function e_e(e,t){var n,r,o,i;let s=Md("Combobox.Option"),a=Gp("Combobox.Option"),l=R.useId(),{id:c=`headlessui-combobox-option-${l}`,value:u,disabled:d=(o=(r=(n=s.virtual)==null?void 0:n.disabled)==null?void 0:r.call(n,u))!=null?o:!1,order:h=null,...p}=e,g=zz(s.inputElement),m=s.virtual?s.activeOptionIndex===s.calculateIndex(u):s.activeOptionIndex===null?!1:((i=s.options[s.activeOptionIndex])==null?void 0:i.id)===c,b=s.isSelected(u),y=R.useRef(null),v=vc({disabled:d,value:u,domRef:y,order:h}),x=R.useContext(Gz),S=Ms(t,y,x?x.measureElement:null),_=Xe(()=>{a.setIsTyping(!1),a.onChange(u)});sn(()=>a.registerOption(c,v),[v,c]);let E=R.useRef(!(s.virtual||s.__demoMode));sn(()=>{if(!s.virtual&&!s.__demoMode)return Ii().requestAnimationFrame(()=>{E.current=!0})},[s.virtual,s.__demoMode]),sn(()=>{if(E.current&&s.comboboxState===0&&m&&s.activationTrigger!==0)return Ii().requestAnimationFrame(()=>{var I,O;(O=(I=y.current)==null?void 0:I.scrollIntoView)==null||O.call(I,{block:"nearest"})})},[y,m,s.comboboxState,s.activationTrigger,s.activeOptionIndex]);let C=Xe(I=>{I.preventDefault(),I.button===ok.Left&&(d||(_(),$z()||requestAnimationFrame(()=>g()),s.mode===0&&a.closeCombobox()))}),k=Xe(()=>{if(d)return a.goToOption(Sn.Nothing);let I=s.calculateIndex(u);a.goToOption(Sn.Specific,I)}),N=OEe(),M=Xe(I=>N.update(I)),A=Xe(I=>{if(!N.wasMoved(I)||d||m)return;let O=s.calculateIndex(u);a.goToOption(Sn.Specific,O,0)}),P=Xe(I=>{N.wasMoved(I)&&(d||m&&(s.optionsPropsRef.current.hold||a.goToOption(Sn.Nothing)))}),j=R.useMemo(()=>({active:m,focus:m,selected:b,disabled:d}),[m,b,d]),F={id:c,ref:S,role:"option",tabIndex:d===!0?void 0:-1,"aria-disabled":d===!0?!0:void 0,"aria-selected":b,disabled:void 0,onMouseDown:C,onFocus:k,onPointerEnter:M,onMouseEnter:M,onPointerMove:A,onMouseMove:A,onPointerLeave:P,onMouseLeave:P};return ei()({ourProps:F,theirProps:p,slot:j,defaultTag:J2e,name:"Combobox.Option"})}let t_e=ti(U2e),qz=ti(K2e),Yz=ti(q2e),n_e=JSe,Kz=ti(Z2e),Xz=ti(e_e),r_e=Object.assign(t_e,{Input:Yz,Button:qz,Label:n_e,Options:Kz,Option:Xz});function o_e({elementId:e}){return R.useEffect(()=>{const t=document.getElementById(e);return t&&t.classList.add("semaphor-scope"),()=>{t&&t.classList.remove("semaphor-scope")}},[e]),null}function Qz({options:e,onChange:t,selectedOptions:n,multiple:r=!0,externalFilteredOptions:o,selectAllChecked:i,onSelectAllCheckedChange:s,inputClassName:a,renderFilterModeButton:l,showNegativeIndicator:c}){const[u,d]=R.useState(""),h=oe(v=>v.themeStyle),p=o||(u===""?e:e==null?void 0:e.filter(v=>{var x;return v!=null&&v.value?(x=v.value)==null?void 0:x.toLowerCase().includes(u==null?void 0:u.toLowerCase()):!1}));function g(v){return v!=null&&v.length?v==null?void 0:v.map(x=>x.value).join(", "):""}function m(v){Array.isArray(v)||(v=[v]),t(v)}function b(){return p&&p.length>0?null:f.jsx("div",{className:"relative cursor-default select-none px-4 py-2",children:"No records found."})}function y(){return!r||!(p!=null&&p.length)?null:f.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-b-muted px-4 py-2",children:[l==null?void 0:l(),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("span",{children:"All"}),f.jsx(zr,{className:"border-muted-foreground/50",checked:i,onCheckedChange:s})]})]})}return f.jsx(r_e,{multiple:r,value:n,onChange:m,onClose:()=>d(""),children:({open:v})=>f.jsxs("div",{children:[f.jsxs("div",{className:"relative flex items-center gap-0.5",children:[c&&f.jsx("div",{className:"h-8 w-0.5 bg-red-400"}),f.jsx(Yz,{className:re("h-8 w-full rounded-sm border border-border bg-background py-1.5 pl-3 pr-8 text-sm","data-[focus]:outline-border-none focus:outline-none data-[focus]:outline-none data-[focus]:-outline-offset-2",a),style:{borderRadius:h==null?void 0:h.controlInputRadius},displayValue:g,onChange:x=>d(x.target.value)}),f.jsx(qz,{className:"group absolute inset-y-0 right-0 px-2.5",children:f.jsx(sa,{className:"size-4 text-muted-foreground hover:text-foreground"})})]}),f.jsxs(Kz,{anchor:"bottom",transition:!0,style:{borderRadius:h==null?void 0:h.controlInputRadius},className:$l("mt-1 !max-h-60 w-[var(--input-width)] overflow-y-auto rounded-sm border border-border bg-background p-1 text-sm [--anchor-gap:var(--spacing-1)] empty:invisible","transition duration-100 ease-in data-[leave]:data-[closed]:opacity-0"),children:[v&&f.jsx(o_e,{elementId:"headlessui-portal-root"}),b(),y(),p==null?void 0:p.map(x=>f.jsxs(Xz,{style:{borderRadius:h==null?void 0:h.controlInputRadius},value:x,className:"group flex cursor-default select-none items-start gap-2 rounded-sm px-3 py-1.5 data-[focus]:bg-muted",children:[f.jsx(ao,{className:"invisible size-4 shrink-0 group-data-[selected]:visible"}),x.value]},x.id))]})]})})}function i_e({filter:e}){const t=oe(d=>d.themeStyle),{filteredRecords:n,isSingleSelect:r,allSelected:o,handleChange:i,handleSelectAll:s,isLoading:a,isFetching:l,isError:c,selectedRecords:u}=KR(e);return a||l?f.jsx(ms,{style:{borderRadius:t==null?void 0:t.controlInputRadius},className:"h-8 w-full bg-foreground/10"}):c?f.jsx("div",{className:"flex h-8 w-full items-center bg-muted px-2 text-sm",children:"Error"}):f.jsx(Qz,{showNegativeIndicator:e.operation==="not in",renderFilterModeButton:()=>f.jsx(s_e,{filter:e}),inputClassName:"h-8",options:n,selectedOptions:u,onChange:i,multiple:!r,selectAllChecked:o,onSelectAllCheckedChange:s})}function s_e({filter:e}){const t=e.operation==="in"?"include":"exclude",{setFilterMode:n}=on();function r(){t==="include"?n(e.id,"exclude"):n(e.id,"include")}return f.jsx(Ee,{onClick:r,variant:"secondary",size:"sm",className:re("h-6 text-xs hover:underline",{}),children:RE(t)})}function a_e({filter:e}){var i;const{filteredRecords:t,handleChange:n,selectedRecords:r}=KR(e);function o(s){n([{value:s,id:s}])}return f.jsx(ba,{onValueChange:o,value:((i=r==null?void 0:r[0])==null?void 0:i.value)||"",className:"mt-2 flex gap-3 overflow-x-auto",children:t==null?void 0:t.map(s=>f.jsxs("div",{className:"flex gap-2",children:[f.jsx(Fr,{value:s.value,id:"r1"}),f.jsx(de,{className:"text-muted-foreground",htmlFor:"r1",children:s.value})]},s.value))})}function sk({filter:e}){return ic(e.dataType)?f.jsx(tSe,{filter:e}):e.uiType==="radio"&&e.type==="single"?f.jsx(a_e,{filter:e}):f.jsx(i_e,{filter:e})}function l_e({frame:e}){const[t,n]=R.useState(!1),r=e==null?void 0:e.cards[0],{data:o,isPending:i}=Ri(r),s=e==null?void 0:e.cards[1],{data:a,isLoading:l,isFetching:c}=Ri(s);return(s==null?void 0:s.type)!=="text"?f.jsx(Zb,{card:r,data:(o==null?void 0:o.records)||[],isPending:i}):f.jsxs(Rh,{className:re("group relative overflow-y-auto",t?"m-4":"mx-0"),children:[t?f.jsx("div",{className:"overflow-y-auto break-words p-1",children:f.jsx(t0,{card:s,data:(a==null?void 0:a.records)||[],isLoading:!1})}):f.jsx(Zb,{card:r,data:(o==null?void 0:o.records)||[],isPending:i}),f.jsx("div",{className:re("fixed z-10",{"invisible bottom-4 right-4 group-hover:visible":t,"right-6 top-6":!t}),children:f.jsx(wd,{disabled:l||c,className:re("h-7 p-1"),pressed:t,onPressedChange:n,"aria-label":"Toggle bold",children:t?f.jsx(uJ,{className:"size-4 text-muted-foreground/70"}):f.jsx(dJ,{className:"size-4 text-muted-foreground/70"})})})]})}function pt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function qp(e,t=[]){let n=[];function r(i,s){const a=w.createContext(s),l=n.length;n=[...n,s];const c=d=>{var y;const{scope:h,children:p,...g}=d,m=((y=h==null?void 0:h[e])==null?void 0:y[l])||a,b=w.useMemo(()=>g,Object.values(g));return f.jsx(m.Provider,{value:b,children:p})};c.displayName=i+"Provider";function u(d,h){var m;const p=((m=h==null?void 0:h[e])==null?void 0:m[l])||a,g=w.useContext(p);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[c,u]}const o=()=>{const i=n.map(s=>w.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return w.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,c_e(o,...t)]}function c_e(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const d=l(i)[`__scope${c}`];return{...a,...d}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var u_e=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Sr=u_e.reduce((e,t)=>{const n=xs(`Primitive.${t}`),r=w.forwardRef((o,i)=>{const{asChild:s,...a}=o,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(l,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Zz(e,t){e&&vs.flushSync(()=>e.dispatchEvent(t))}function BI(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Jz(...e){return t=>{let n=!1;const r=e.map(o=>{const i=BI(o,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<r.length;o++){const i=r[o];typeof i=="function"?i():BI(e[o],null)}}}}function Vr(...e){return w.useCallback(Jz(...e),e)}function eB(e){const t=e+"CollectionProvider",[n,r]=qp(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=m=>{const{scope:b,children:y}=m,v=R.useRef(null),x=R.useRef(new Map).current;return f.jsx(o,{scope:b,itemMap:x,collectionRef:v,children:y})};s.displayName=t;const a=e+"CollectionSlot",l=xs(a),c=R.forwardRef((m,b)=>{const{scope:y,children:v}=m,x=i(a,y),S=Vr(b,x.collectionRef);return f.jsx(l,{ref:S,children:v})});c.displayName=a;const u=e+"CollectionItemSlot",d="data-radix-collection-item",h=xs(u),p=R.forwardRef((m,b)=>{const{scope:y,children:v,...x}=m,S=R.useRef(null),_=Vr(b,S),E=i(u,y);return R.useEffect(()=>(E.itemMap.set(S,{ref:S,...x}),()=>void E.itemMap.delete(S))),f.jsx(h,{[d]:"",ref:_,children:v})});p.displayName=u;function g(m){const b=i(e+"CollectionConsumer",m);return R.useCallback(()=>{const v=b.collectionRef.current;if(!v)return[];const x=Array.from(v.querySelectorAll(`[${d}]`));return Array.from(b.itemMap.values()).sort((E,C)=>x.indexOf(E.ref.current)-x.indexOf(C.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:s,Slot:c,ItemSlot:p},g,r]}var d_e=w.createContext(void 0);function tB(e){const t=w.useContext(d_e);return e||t||"ltr"}function Ti(e){const t=w.useRef(e);return w.useEffect(()=>{t.current=e}),w.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function f_e(e,t=globalThis==null?void 0:globalThis.document){const n=Ti(e);w.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var h_e="DismissableLayer",PS="dismissableLayer.update",p_e="dismissableLayer.pointerDownOutside",m_e="dismissableLayer.focusOutside",VI,nB=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),rB=w.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:a,...l}=e,c=w.useContext(nB),[u,d]=w.useState(null),h=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=w.useState({}),g=Vr(t,C=>d(C)),m=Array.from(c.layers),[b]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),y=m.indexOf(b),v=u?m.indexOf(u):-1,x=c.layersWithOutsidePointerEventsDisabled.size>0,S=v>=y,_=y_e(C=>{const k=C.target,N=[...c.branches].some(M=>M.contains(k));!S||N||(o==null||o(C),s==null||s(C),C.defaultPrevented||a==null||a())},h),E=v_e(C=>{const k=C.target;[...c.branches].some(M=>M.contains(k))||(i==null||i(C),s==null||s(C),C.defaultPrevented||a==null||a())},h);return f_e(C=>{v===c.layers.size-1&&(r==null||r(C),!C.defaultPrevented&&a&&(C.preventDefault(),a()))},h),w.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(VI=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),HI(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=VI)}},[u,h,n,c]),w.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),HI())},[u,c]),w.useEffect(()=>{const C=()=>p({});return document.addEventListener(PS,C),()=>document.removeEventListener(PS,C)},[]),f.jsx(Sr.div,{...l,ref:g,style:{pointerEvents:x?S?"auto":"none":void 0,...e.style},onFocusCapture:pt(e.onFocusCapture,E.onFocusCapture),onBlurCapture:pt(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:pt(e.onPointerDownCapture,_.onPointerDownCapture)})});rB.displayName=h_e;var g_e="DismissableLayerBranch",b_e=w.forwardRef((e,t)=>{const n=w.useContext(nB),r=w.useRef(null),o=Vr(t,r);return w.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),f.jsx(Sr.div,{...e,ref:o})});b_e.displayName=g_e;function y_e(e,t=globalThis==null?void 0:globalThis.document){const n=Ti(e),r=w.useRef(!1),o=w.useRef(()=>{});return w.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let l=function(){oB(p_e,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=l,t.addEventListener("click",o.current,{once:!0})):l()}else t.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function v_e(e,t=globalThis==null?void 0:globalThis.document){const n=Ti(e),r=w.useRef(!1);return w.useEffect(()=>{const o=i=>{i.target&&!r.current&&oB(m_e,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function HI(){const e=new CustomEvent(PS);document.dispatchEvent(e)}function oB(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Zz(o,i):o.dispatchEvent(i)}var Dw=0;function x_e(){w.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??WI()),document.body.insertAdjacentElement("beforeend",e[1]??WI()),Dw++,()=>{Dw===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Dw--}},[])}function WI(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Aw="focusScope.autoFocusOnMount",Iw="focusScope.autoFocusOnUnmount",UI={bubbles:!1,cancelable:!0},w_e="FocusScope",iB=w.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...s}=e,[a,l]=w.useState(null),c=Ti(o),u=Ti(i),d=w.useRef(null),h=Vr(t,m=>l(m)),p=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(r){let m=function(x){if(p.paused||!a)return;const S=x.target;a.contains(S)?d.current=S:Vs(d.current,{select:!0})},b=function(x){if(p.paused||!a)return;const S=x.relatedTarget;S!==null&&(a.contains(S)||Vs(d.current,{select:!0}))},y=function(x){if(document.activeElement===document.body)for(const _ of x)_.removedNodes.length>0&&Vs(a)};document.addEventListener("focusin",m),document.addEventListener("focusout",b);const v=new MutationObserver(y);return a&&v.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",b),v.disconnect()}}},[r,a,p.paused]),w.useEffect(()=>{if(a){qI.add(p);const m=document.activeElement;if(!a.contains(m)){const y=new CustomEvent(Aw,UI);a.addEventListener(Aw,c),a.dispatchEvent(y),y.defaultPrevented||(C_e(k_e(sB(a)),{select:!0}),document.activeElement===m&&Vs(a))}return()=>{a.removeEventListener(Aw,c),setTimeout(()=>{const y=new CustomEvent(Iw,UI);a.addEventListener(Iw,u),a.dispatchEvent(y),y.defaultPrevented||Vs(m??document.body,{select:!0}),a.removeEventListener(Iw,u),qI.remove(p)},0)}}},[a,c,u,p]);const g=w.useCallback(m=>{if(!n&&!r||p.paused)return;const b=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,y=document.activeElement;if(b&&y){const v=m.currentTarget,[x,S]=S_e(v);x&&S?!m.shiftKey&&y===S?(m.preventDefault(),n&&Vs(x,{select:!0})):m.shiftKey&&y===x&&(m.preventDefault(),n&&Vs(S,{select:!0})):y===v&&m.preventDefault()}},[n,r,p.paused]);return f.jsx(Sr.div,{tabIndex:-1,...s,ref:h,onKeyDown:g})});iB.displayName=w_e;function C_e(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Vs(r,{select:t}),document.activeElement!==n)return}function S_e(e){const t=sB(e),n=GI(t,e),r=GI(t.reverse(),e);return[n,r]}function sB(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function GI(e,t){for(const n of e)if(!E_e(n,{upTo:t}))return n}function E_e(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function __e(e){return e instanceof HTMLInputElement&&"select"in e}function Vs(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&__e(e)&&t&&e.select()}}var qI=R_e();function R_e(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=YI(e,t),e.unshift(t)},remove(t){var n;e=YI(e,t),(n=e[0])==null||n.resume()}}}function YI(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function k_e(e){return e.filter(t=>t.tagName!=="A")}var Na=globalThis!=null&&globalThis.document?w.useLayoutEffect:()=>{},N_e=w[" useId ".trim().toString()]||(()=>{}),M_e=0;function P_e(e){const[t,n]=w.useState(N_e());return Na(()=>{n(r=>r??String(M_e++))},[e]),t?`radix-${t}`:""}var D_e="Arrow",aB=w.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return f.jsx(Sr.svg,{...i,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:f.jsx("polygon",{points:"0,0 30,0 15,10"})})});aB.displayName=D_e;var A_e=aB;function I_e(e){const[t,n]=w.useState(void 0);return Na(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,a;if("borderBoxSize"in i){const l=i.borderBoxSize,c=Array.isArray(l)?l[0]:l;s=c.inlineSize,a=c.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var ak="Popper",[lB,cB]=qp(ak),[T_e,uB]=lB(ak),dB=e=>{const{__scopePopper:t,children:n}=e,[r,o]=w.useState(null);return f.jsx(T_e,{scope:t,anchor:r,onAnchorChange:o,children:n})};dB.displayName=ak;var fB="PopperAnchor",hB=w.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=uB(fB,n),s=w.useRef(null),a=Vr(t,s);return w.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:f.jsx(Sr.div,{...o,ref:a})});hB.displayName=fB;var lk="PopperContent",[j_e,O_e]=lB(lk),pB=w.forwardRef((e,t)=>{var U,Y,K,Z,ee,Q;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:i="center",alignOffset:s=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:g,...m}=e,b=uB(lk,n),[y,v]=w.useState(null),x=Vr(t,ie=>v(ie)),[S,_]=w.useState(null),E=I_e(S),C=(E==null?void 0:E.width)??0,k=(E==null?void 0:E.height)??0,N=r+(i!=="center"?"-"+i:""),M=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},A=Array.isArray(c)?c:[c],P=A.length>0,j={padding:M,boundary:A.filter(L_e),altBoundary:P},{refs:F,floatingStyles:I,placement:O,isPositioned:$,middlewareData:B}=Y2({strategy:"fixed",placement:N,whileElementsMounted:(...ie)=>q2(...ie,{animationFrame:p==="always"}),elements:{reference:b.anchor},middleware:[hy({mainAxis:o+k,alignmentAxis:s}),l&&K2({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?t3():void 0,...j}),l&&X2({...j}),Q2({...j,apply:({elements:ie,rects:te,availableWidth:le,availableHeight:ue})=>{const{width:Re,height:be}=te.reference,we=ie.floating.style;we.setProperty("--radix-popper-available-width",`${le}px`),we.setProperty("--radix-popper-available-height",`${ue}px`),we.setProperty("--radix-popper-anchor-width",`${Re}px`),we.setProperty("--radix-popper-anchor-height",`${be}px`)}}),S&&r3({element:S,padding:a}),$_e({arrowWidth:C,arrowHeight:k}),h&&n3({strategy:"referenceHidden",...j})]}),[z,T]=bB(O),W=Ti(g);Na(()=>{$&&(W==null||W())},[$,W]);const L=(U=B.arrow)==null?void 0:U.x,D=(Y=B.arrow)==null?void 0:Y.y,H=((K=B.arrow)==null?void 0:K.centerOffset)!==0,[V,q]=w.useState();return Na(()=>{y&&q(window.getComputedStyle(y).zIndex)},[y]),f.jsx("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...I,transform:$?I.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:V,"--radix-popper-transform-origin":[(Z=B.transformOrigin)==null?void 0:Z.x,(ee=B.transformOrigin)==null?void 0:ee.y].join(" "),...((Q=B.hide)==null?void 0:Q.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:f.jsx(j_e,{scope:n,placedSide:z,onArrowChange:_,arrowX:L,arrowY:D,shouldHideArrow:H,children:f.jsx(Sr.div,{"data-side":z,"data-align":T,...m,ref:x,style:{...m.style,animation:$?void 0:"none"}})})})});pB.displayName=lk;var mB="PopperArrow",F_e={top:"bottom",right:"left",bottom:"top",left:"right"},gB=w.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,i=O_e(mB,r),s=F_e[i.placedSide];return f.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:f.jsx(A_e,{...o,ref:n,style:{...o.style,display:"block"}})})});gB.displayName=mB;function L_e(e){return e!==null}var $_e=e=>({name:"transformOrigin",options:e,fn(t){var b,y,v;const{placement:n,rects:r,middlewareData:o}=t,s=((b=o.arrow)==null?void 0:b.centerOffset)!==0,a=s?0:e.arrowWidth,l=s?0:e.arrowHeight,[c,u]=bB(n),d={start:"0%",center:"50%",end:"100%"}[u],h=(((y=o.arrow)==null?void 0:y.x)??0)+a/2,p=(((v=o.arrow)==null?void 0:v.y)??0)+l/2;let g="",m="";return c==="bottom"?(g=s?d:`${h}px`,m=`${-l}px`):c==="top"?(g=s?d:`${h}px`,m=`${r.floating.height+l}px`):c==="right"?(g=`${-l}px`,m=s?d:`${p}px`):c==="left"&&(g=`${r.floating.width+l}px`,m=s?d:`${p}px`),{data:{x:g,y:m}}}});function bB(e){const[t,n="center"]=e.split("-");return[t,n]}var z_e=dB,B_e=hB,V_e=pB,H_e=gB,W_e="Portal",yB=w.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,i]=w.useState(!1);Na(()=>i(!0),[]);const s=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return s?rn.createPortal(f.jsx(Sr.div,{...r,ref:t}),s):null});yB.displayName=W_e;function U_e(e,t){return w.useReducer((n,r)=>t[n][r]??n,e)}var Yp=e=>{const{present:t,children:n}=e,r=G_e(t),o=typeof n=="function"?n({present:r.isPresent}):w.Children.only(n),i=Vr(r.ref,q_e(o));return typeof n=="function"||r.isPresent?w.cloneElement(o,{ref:i}):null};Yp.displayName="Presence";function G_e(e){const[t,n]=w.useState(),r=w.useRef(null),o=w.useRef(e),i=w.useRef("none"),s=e?"mounted":"unmounted",[a,l]=U_e(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const c=hg(r.current);i.current=a==="mounted"?c:"none"},[a]),Na(()=>{const c=r.current,u=o.current;if(u!==e){const h=i.current,p=hg(c);e?l("MOUNT"):p==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&h!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),Na(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,d=p=>{const m=hg(r.current).includes(p.animationName);if(p.target===t&&m&&(l("ANIMATION_END"),!o.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},h=p=>{p.target===t&&(i.current=hg(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{u.clearTimeout(c),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:w.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function hg(e){return(e==null?void 0:e.animationName)||"none"}function q_e(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Y_e=w[" useInsertionEffect ".trim().toString()]||Na;function K_e({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,s]=X_e({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:o;{const u=w.useRef(e!==void 0);w.useEffect(()=>{const d=u.current;d!==a&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=a},[a,r])}const c=w.useCallback(u=>{var d;if(a){const h=Q_e(u)?u(e):u;h!==e&&((d=s.current)==null||d.call(s,h))}else i(u)},[a,e,i,s]);return[l,c]}function X_e({defaultProp:e,onChange:t}){const[n,r]=w.useState(e),o=w.useRef(n),i=w.useRef(t);return Y_e(()=>{i.current=t},[t]),w.useEffect(()=>{var s;o.current!==n&&((s=i.current)==null||s.call(i,n),o.current=n)},[n,o]),[n,r,i]}function Q_e(e){return typeof e=="function"}var Tw="rovingFocusGroup.onEntryFocus",Z_e={bubbles:!1,cancelable:!0},Kp="RovingFocusGroup",[DS,vB,J_e]=eB(Kp),[eRe,xB]=qp(Kp,[J_e]),[tRe,nRe]=eRe(Kp),wB=w.forwardRef((e,t)=>f.jsx(DS.Provider,{scope:e.__scopeRovingFocusGroup,children:f.jsx(DS.Slot,{scope:e.__scopeRovingFocusGroup,children:f.jsx(rRe,{...e,ref:t})})}));wB.displayName=Kp;var rRe=w.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=e,h=w.useRef(null),p=Vr(t,h),g=tB(i),[m,b]=K_e({prop:s,defaultProp:a??null,onChange:l,caller:Kp}),[y,v]=w.useState(!1),x=Ti(c),S=vB(n),_=w.useRef(!1),[E,C]=w.useState(0);return w.useEffect(()=>{const k=h.current;if(k)return k.addEventListener(Tw,x),()=>k.removeEventListener(Tw,x)},[x]),f.jsx(tRe,{scope:n,orientation:r,dir:g,loop:o,currentTabStopId:m,onItemFocus:w.useCallback(k=>b(k),[b]),onItemShiftTab:w.useCallback(()=>v(!0),[]),onFocusableItemAdd:w.useCallback(()=>C(k=>k+1),[]),onFocusableItemRemove:w.useCallback(()=>C(k=>k-1),[]),children:f.jsx(Sr.div,{tabIndex:y||E===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:"none",...e.style},onMouseDown:pt(e.onMouseDown,()=>{_.current=!0}),onFocus:pt(e.onFocus,k=>{const N=!_.current;if(k.target===k.currentTarget&&N&&!y){const M=new CustomEvent(Tw,Z_e);if(k.currentTarget.dispatchEvent(M),!M.defaultPrevented){const A=S().filter(O=>O.focusable),P=A.find(O=>O.active),j=A.find(O=>O.id===m),I=[P,j,...A].filter(Boolean).map(O=>O.ref.current);EB(I,u)}}_.current=!1}),onBlur:pt(e.onBlur,()=>v(!1))})})}),CB="RovingFocusGroupItem",SB=w.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:s,...a}=e,l=P_e(),c=i||l,u=nRe(CB,n),d=u.currentTabStopId===c,h=vB(n),{onFocusableItemAdd:p,onFocusableItemRemove:g,currentTabStopId:m}=u;return w.useEffect(()=>{if(r)return p(),()=>g()},[r,p,g]),f.jsx(DS.ItemSlot,{scope:n,id:c,focusable:r,active:o,children:f.jsx(Sr.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...a,ref:t,onMouseDown:pt(e.onMouseDown,b=>{r?u.onItemFocus(c):b.preventDefault()}),onFocus:pt(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:pt(e.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){u.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const y=sRe(b,u.orientation,u.dir);if(y!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let x=h().filter(S=>S.focusable).map(S=>S.ref.current);if(y==="last")x.reverse();else if(y==="prev"||y==="next"){y==="prev"&&x.reverse();const S=x.indexOf(b.currentTarget);x=u.loop?aRe(x,S+1):x.slice(S+1)}setTimeout(()=>EB(x))}}),children:typeof s=="function"?s({isCurrentTabStop:d,hasTabStop:m!=null}):s})})});SB.displayName=CB;var oRe={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function iRe(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function sRe(e,t,n){const r=iRe(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return oRe[r]}function EB(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function aRe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var lRe=wB,cRe=SB,AS=["Enter"," "],uRe=["ArrowDown","PageUp","Home"],_B=["ArrowUp","PageDown","End"],dRe=[...uRe,..._B],fRe={ltr:[...AS,"ArrowRight"],rtl:[...AS,"ArrowLeft"]},hRe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Xp="Menu",[Ah,pRe,mRe]=eB(Xp),[xc,RB]=qp(Xp,[mRe,cB,xB]),lv=cB(),kB=xB(),[gRe,wc]=xc(Xp),[bRe,Qp]=xc(Xp),NB=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:i,modal:s=!0}=e,a=lv(t),[l,c]=w.useState(null),u=w.useRef(!1),d=Ti(i),h=tB(o);return w.useEffect(()=>{const p=()=>{u.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>u.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),f.jsx(z_e,{...a,children:f.jsx(gRe,{scope:t,open:n,onOpenChange:d,content:l,onContentChange:c,children:f.jsx(bRe,{scope:t,onClose:w.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:h,modal:s,children:r})})})};NB.displayName=Xp;var yRe="MenuAnchor",ck=w.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=lv(n);return f.jsx(B_e,{...o,...r,ref:t})});ck.displayName=yRe;var uk="MenuPortal",[vRe,MB]=xc(uk,{forceMount:void 0}),PB=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,i=wc(uk,t);return f.jsx(vRe,{scope:t,forceMount:n,children:f.jsx(Yp,{present:n||i.open,children:f.jsx(yB,{asChild:!0,container:o,children:r})})})};PB.displayName=uk;var Ro="MenuContent",[xRe,dk]=xc(Ro),DB=w.forwardRef((e,t)=>{const n=MB(Ro,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=wc(Ro,e.__scopeMenu),s=Qp(Ro,e.__scopeMenu);return f.jsx(Ah.Provider,{scope:e.__scopeMenu,children:f.jsx(Yp,{present:r||i.open,children:f.jsx(Ah.Slot,{scope:e.__scopeMenu,children:s.modal?f.jsx(wRe,{...o,ref:t}):f.jsx(CRe,{...o,ref:t})})})})}),wRe=w.forwardRef((e,t)=>{const n=wc(Ro,e.__scopeMenu),r=w.useRef(null),o=Vr(t,r);return w.useEffect(()=>{const i=r.current;if(i)return cd(i)},[]),f.jsx(fk,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:pt(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),CRe=w.forwardRef((e,t)=>{const n=wc(Ro,e.__scopeMenu);return f.jsx(fk,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),SRe=xs("MenuContent.ScrollLock"),fk=w.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:p,disableOutsideScroll:g,...m}=e,b=wc(Ro,n),y=Qp(Ro,n),v=lv(n),x=kB(n),S=pRe(n),[_,E]=w.useState(null),C=w.useRef(null),k=Vr(t,C,b.onContentChange),N=w.useRef(0),M=w.useRef(""),A=w.useRef(0),P=w.useRef(null),j=w.useRef("right"),F=w.useRef(0),I=g?hc:w.Fragment,O=g?{as:SRe,allowPinchZoom:!0}:void 0,$=z=>{var U,Y;const T=M.current+z,W=S().filter(K=>!K.disabled),L=document.activeElement,D=(U=W.find(K=>K.ref.current===L))==null?void 0:U.textValue,H=W.map(K=>K.textValue),V=jRe(H,T,D),q=(Y=W.find(K=>K.textValue===V))==null?void 0:Y.ref.current;(function K(Z){M.current=Z,window.clearTimeout(N.current),Z!==""&&(N.current=window.setTimeout(()=>K(""),1e3))})(T),q&&setTimeout(()=>q.focus())};w.useEffect(()=>()=>window.clearTimeout(N.current),[]),x_e();const B=w.useCallback(z=>{var W,L;return j.current===((W=P.current)==null?void 0:W.side)&&FRe(z,(L=P.current)==null?void 0:L.area)},[]);return f.jsx(xRe,{scope:n,searchRef:M,onItemEnter:w.useCallback(z=>{B(z)&&z.preventDefault()},[B]),onItemLeave:w.useCallback(z=>{var T;B(z)||((T=C.current)==null||T.focus(),E(null))},[B]),onTriggerLeave:w.useCallback(z=>{B(z)&&z.preventDefault()},[B]),pointerGraceTimerRef:A,onPointerGraceIntentChange:w.useCallback(z=>{P.current=z},[]),children:f.jsx(I,{...O,children:f.jsx(iB,{asChild:!0,trapped:o,onMountAutoFocus:pt(i,z=>{var T;z.preventDefault(),(T=C.current)==null||T.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:f.jsx(rB,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:p,children:f.jsx(lRe,{asChild:!0,...x,dir:y.dir,orientation:"vertical",loop:r,currentTabStopId:_,onCurrentTabStopIdChange:E,onEntryFocus:pt(l,z=>{y.isUsingKeyboardRef.current||z.preventDefault()}),preventScrollOnEntryFocus:!0,children:f.jsx(V_e,{role:"menu","aria-orientation":"vertical","data-state":qB(b.open),"data-radix-menu-content":"",dir:y.dir,...v,...m,ref:k,style:{outline:"none",...m.style},onKeyDown:pt(m.onKeyDown,z=>{const W=z.target.closest("[data-radix-menu-content]")===z.currentTarget,L=z.ctrlKey||z.altKey||z.metaKey,D=z.key.length===1;W&&(z.key==="Tab"&&z.preventDefault(),!L&&D&&$(z.key));const H=C.current;if(z.target!==H||!dRe.includes(z.key))return;z.preventDefault();const q=S().filter(U=>!U.disabled).map(U=>U.ref.current);_B.includes(z.key)&&q.reverse(),IRe(q)}),onBlur:pt(e.onBlur,z=>{z.currentTarget.contains(z.target)||(window.clearTimeout(N.current),M.current="")}),onPointerMove:pt(e.onPointerMove,Ih(z=>{const T=z.target,W=F.current!==z.clientX;if(z.currentTarget.contains(T)&&W){const L=z.clientX>F.current?"right":"left";j.current=L,F.current=z.clientX}}))})})})})})})});DB.displayName=Ro;var ERe="MenuGroup",hk=w.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.jsx(Sr.div,{role:"group",...r,ref:t})});hk.displayName=ERe;var _Re="MenuLabel",AB=w.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.jsx(Sr.div,{...r,ref:t})});AB.displayName=_Re;var f0="MenuItem",KI="menu.itemSelect",cv=w.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,i=w.useRef(null),s=Qp(f0,e.__scopeMenu),a=dk(f0,e.__scopeMenu),l=Vr(t,i),c=w.useRef(!1),u=()=>{const d=i.current;if(!n&&d){const h=new CustomEvent(KI,{bubbles:!0,cancelable:!0});d.addEventListener(KI,p=>r==null?void 0:r(p),{once:!0}),Zz(d,h),h.defaultPrevented?c.current=!1:s.onClose()}};return f.jsx(IB,{...o,ref:l,disabled:n,onClick:pt(e.onClick,u),onPointerDown:d=>{var h;(h=e.onPointerDown)==null||h.call(e,d),c.current=!0},onPointerUp:pt(e.onPointerUp,d=>{var h;c.current||(h=d.currentTarget)==null||h.click()}),onKeyDown:pt(e.onKeyDown,d=>{const h=a.searchRef.current!=="";n||h&&d.key===" "||AS.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})})});cv.displayName=f0;var IB=w.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...i}=e,s=dk(f0,n),a=kB(n),l=w.useRef(null),c=Vr(t,l),[u,d]=w.useState(!1),[h,p]=w.useState("");return w.useEffect(()=>{const g=l.current;g&&p((g.textContent??"").trim())},[i.children]),f.jsx(Ah.ItemSlot,{scope:n,disabled:r,textValue:o??h,children:f.jsx(cRe,{asChild:!0,...a,focusable:!r,children:f.jsx(Sr.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:c,onPointerMove:pt(e.onPointerMove,Ih(g=>{r?s.onItemLeave(g):(s.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:pt(e.onPointerLeave,Ih(g=>s.onItemLeave(g))),onFocus:pt(e.onFocus,()=>d(!0)),onBlur:pt(e.onBlur,()=>d(!1))})})})}),RRe="MenuCheckboxItem",TB=w.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return f.jsx($B,{scope:e.__scopeMenu,checked:n,children:f.jsx(cv,{role:"menuitemcheckbox","aria-checked":h0(n)?"mixed":n,...o,ref:t,"data-state":mk(n),onSelect:pt(o.onSelect,()=>r==null?void 0:r(h0(n)?!0:!n),{checkForDefaultPrevented:!1})})})});TB.displayName=RRe;var jB="MenuRadioGroup",[kRe,NRe]=xc(jB,{value:void 0,onValueChange:()=>{}}),OB=w.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,i=Ti(r);return f.jsx(kRe,{scope:e.__scopeMenu,value:n,onValueChange:i,children:f.jsx(hk,{...o,ref:t})})});OB.displayName=jB;var FB="MenuRadioItem",LB=w.forwardRef((e,t)=>{const{value:n,...r}=e,o=NRe(FB,e.__scopeMenu),i=n===o.value;return f.jsx($B,{scope:e.__scopeMenu,checked:i,children:f.jsx(cv,{role:"menuitemradio","aria-checked":i,...r,ref:t,"data-state":mk(i),onSelect:pt(r.onSelect,()=>{var s;return(s=o.onValueChange)==null?void 0:s.call(o,n)},{checkForDefaultPrevented:!1})})})});LB.displayName=FB;var pk="MenuItemIndicator",[$B,MRe]=xc(pk,{checked:!1}),zB=w.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,i=MRe(pk,n);return f.jsx(Yp,{present:r||h0(i.checked)||i.checked===!0,children:f.jsx(Sr.span,{...o,ref:t,"data-state":mk(i.checked)})})});zB.displayName=pk;var PRe="MenuSeparator",BB=w.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return f.jsx(Sr.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});BB.displayName=PRe;var DRe="MenuArrow",VB=w.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=lv(n);return f.jsx(H_e,{...o,...r,ref:t})});VB.displayName=DRe;var ARe="MenuSub",[ZLe,HB]=xc(ARe),bf="MenuSubTrigger",WB=w.forwardRef((e,t)=>{const n=wc(bf,e.__scopeMenu),r=Qp(bf,e.__scopeMenu),o=HB(bf,e.__scopeMenu),i=dk(bf,e.__scopeMenu),s=w.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=i,c={__scopeMenu:e.__scopeMenu},u=w.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return w.useEffect(()=>u,[u]),w.useEffect(()=>{const d=a.current;return()=>{window.clearTimeout(d),l(null)}},[a,l]),f.jsx(ck,{asChild:!0,...c,children:f.jsx(IB,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":qB(n.open),...e,ref:Jz(t,o.onTriggerChange),onClick:d=>{var h;(h=e.onClick)==null||h.call(e,d),!(e.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:pt(e.onPointerMove,Ih(d=>{i.onItemEnter(d),!d.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:pt(e.onPointerLeave,Ih(d=>{var p,g;u();const h=(p=n.content)==null?void 0:p.getBoundingClientRect();if(h){const m=(g=n.content)==null?void 0:g.dataset.side,b=m==="right",y=b?-5:5,v=h[b?"left":"right"],x=h[b?"right":"left"];i.onPointerGraceIntentChange({area:[{x:d.clientX+y,y:d.clientY},{x:v,y:h.top},{x,y:h.top},{x,y:h.bottom},{x:v,y:h.bottom}],side:m}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(d),d.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:pt(e.onKeyDown,d=>{var p;const h=i.searchRef.current!=="";e.disabled||h&&d.key===" "||fRe[r.dir].includes(d.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),d.preventDefault())})})})});WB.displayName=bf;var UB="MenuSubContent",GB=w.forwardRef((e,t)=>{const n=MB(Ro,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=wc(Ro,e.__scopeMenu),s=Qp(Ro,e.__scopeMenu),a=HB(UB,e.__scopeMenu),l=w.useRef(null),c=Vr(t,l);return f.jsx(Ah.Provider,{scope:e.__scopeMenu,children:f.jsx(Yp,{present:r||i.open,children:f.jsx(Ah.Slot,{scope:e.__scopeMenu,children:f.jsx(fk,{id:a.contentId,"aria-labelledby":a.triggerId,...o,ref:c,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{var d;s.isUsingKeyboardRef.current&&((d=l.current)==null||d.focus()),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:pt(e.onFocusOutside,u=>{u.target!==a.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:pt(e.onEscapeKeyDown,u=>{s.onClose(),u.preventDefault()}),onKeyDown:pt(e.onKeyDown,u=>{var p;const d=u.currentTarget.contains(u.target),h=hRe[s.dir].includes(u.key);d&&h&&(i.onOpenChange(!1),(p=a.trigger)==null||p.focus(),u.preventDefault())})})})})})});GB.displayName=UB;function qB(e){return e?"open":"closed"}function h0(e){return e==="indeterminate"}function mk(e){return h0(e)?"indeterminate":e?"checked":"unchecked"}function IRe(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function TRe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function jRe(e,t,n){const o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=TRe(e,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));const l=s.find(c=>c.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function ORe(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const a=t[i],l=t[s],c=a.x,u=a.y,d=l.x,h=l.y;u>r!=h>r&&n<(d-c)*(r-u)/(h-u)+c&&(o=!o)}return o}function FRe(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return ORe(n,t)}function Ih(e){return t=>t.pointerType==="mouse"?e(t):void 0}var LRe=NB,$Re=ck,zRe=PB,BRe=DB,VRe=hk,HRe=AB,WRe=cv,URe=TB,GRe=OB,qRe=LB,YRe=zB,KRe=BB,XRe=VB,QRe=WB,ZRe=GB,gk="ContextMenu",[JRe,JLe]=qp(gk,[RB]),Er=RB(),[eke,YB]=JRe(gk),KB=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,dir:o,modal:i=!0}=e,[s,a]=w.useState(!1),l=Er(t),c=Ti(r),u=w.useCallback(d=>{a(d),c(d)},[c]);return f.jsx(eke,{scope:t,open:s,onOpenChange:u,modal:i,children:f.jsx(LRe,{...l,dir:o,open:s,onOpenChange:u,modal:i,children:n})})};KB.displayName=gk;var XB="ContextMenuTrigger",QB=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,disabled:r=!1,...o}=e,i=YB(XB,n),s=Er(n),a=w.useRef({x:0,y:0}),l=w.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...a.current})}),c=w.useRef(0),u=w.useCallback(()=>window.clearTimeout(c.current),[]),d=h=>{a.current={x:h.clientX,y:h.clientY},i.onOpenChange(!0)};return w.useEffect(()=>u,[u]),w.useEffect(()=>void(r&&u()),[r,u]),f.jsxs(f.Fragment,{children:[f.jsx($Re,{...s,virtualRef:l}),f.jsx(Sr.span,{"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,...o,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:r?e.onContextMenu:pt(e.onContextMenu,h=>{u(),d(h),h.preventDefault()}),onPointerDown:r?e.onPointerDown:pt(e.onPointerDown,pg(h=>{u(),c.current=window.setTimeout(()=>d(h),700)})),onPointerMove:r?e.onPointerMove:pt(e.onPointerMove,pg(u)),onPointerCancel:r?e.onPointerCancel:pt(e.onPointerCancel,pg(u)),onPointerUp:r?e.onPointerUp:pt(e.onPointerUp,pg(u))})]})});QB.displayName=XB;var tke="ContextMenuPortal",ZB=e=>{const{__scopeContextMenu:t,...n}=e,r=Er(t);return f.jsx(zRe,{...r,...n})};ZB.displayName=tke;var JB="ContextMenuContent",eV=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=YB(JB,n),i=Er(n),s=w.useRef(!1);return f.jsx(BRe,{...i,...r,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:a=>{var l;(l=e.onCloseAutoFocus)==null||l.call(e,a),!a.defaultPrevented&&s.current&&a.preventDefault(),s.current=!1},onInteractOutside:a=>{var l;(l=e.onInteractOutside)==null||l.call(e,a),!a.defaultPrevented&&!o.modal&&(s.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});eV.displayName=JB;var nke="ContextMenuGroup",tV=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=Er(n);return f.jsx(VRe,{...o,...r,ref:t})});tV.displayName=nke;var rke="ContextMenuLabel",nV=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=Er(n);return f.jsx(HRe,{...o,...r,ref:t})});nV.displayName=rke;var oke="ContextMenuItem",rV=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=Er(n);return f.jsx(WRe,{...o,...r,ref:t})});rV.displayName=oke;var ike="ContextMenuCheckboxItem",oV=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=Er(n);return f.jsx(URe,{...o,...r,ref:t})});oV.displayName=ike;var ske="ContextMenuRadioGroup",ake=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=Er(n);return f.jsx(GRe,{...o,...r,ref:t})});ake.displayName=ske;var lke="ContextMenuRadioItem",iV=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=Er(n);return f.jsx(qRe,{...o,...r,ref:t})});iV.displayName=lke;var cke="ContextMenuItemIndicator",sV=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=Er(n);return f.jsx(YRe,{...o,...r,ref:t})});sV.displayName=cke;var uke="ContextMenuSeparator",aV=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=Er(n);return f.jsx(KRe,{...o,...r,ref:t})});aV.displayName=uke;var dke="ContextMenuArrow",fke=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=Er(n);return f.jsx(XRe,{...o,...r,ref:t})});fke.displayName=dke;var hke="ContextMenuSubTrigger",lV=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=Er(n);return f.jsx(QRe,{...o,...r,ref:t})});lV.displayName=hke;var pke="ContextMenuSubContent",cV=w.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,o=Er(n);return f.jsx(ZRe,{...o,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});cV.displayName=pke;function pg(e){return t=>t.pointerType!=="mouse"?e(t):void 0}var mke=KB,gke=QB,bke=ZB,uV=eV,yke=tV,dV=nV,fV=rV,hV=oV,pV=iV,mV=sV,gV=aV,bV=lV,yV=cV;const vke=mke,xke=gke,XI=yke,wke=w.forwardRef(({className:e,inset:t,children:n,...r},o)=>f.jsxs(bV,{ref:o,className:re("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",t&&"pl-8",e),...r,children:[n,f.jsx(_i,{className:"ml-auto h-4 w-4"})]}));wke.displayName=bV.displayName;const Cke=w.forwardRef(({className:e,...t},n)=>f.jsx(yV,{ref:n,className:re("z-50 min-w-[8rem] origin-[--radix-context-menu-content-transform-origin] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));Cke.displayName=yV.displayName;const vV=w.forwardRef(({className:e,...t},n)=>f.jsx(bke,{children:f.jsx(Qo,{children:f.jsx(uV,{ref:n,className:re("z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] origin-[--radix-context-menu-content-transform-origin] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t})})}));vV.displayName=uV.displayName;const IS=w.forwardRef(({className:e,inset:t,...n},r)=>f.jsx(fV,{ref:r,className:re("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));IS.displayName=fV.displayName;const Ske=w.forwardRef(({className:e,children:t,checked:n,...r},o)=>f.jsxs(hV,{ref:o,className:re("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(mV,{children:f.jsx(ao,{className:"h-4 w-4"})})}),t]}));Ske.displayName=hV.displayName;const Eke=w.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(pV,{ref:r,className:re("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(mV,{children:f.jsx(u2,{className:"h-2 w-2 fill-current"})})}),t]}));Eke.displayName=pV.displayName;const Ug=w.forwardRef(({className:e,inset:t,...n},r)=>f.jsx(dV,{ref:r,className:re("px-2 py-1.5 text-sm font-semibold text-foreground",t&&"pl-8",e),...n}));Ug.displayName=dV.displayName;const TS=w.forwardRef(({className:e,...t},n)=>f.jsx(gV,{ref:n,className:re("-mx-1 my-1 h-px bg-border",e),...t}));TS.displayName=gV.displayName;function _ke(e,t,n,r){var c;const o=e.breadcrumbs.length>0&&((c=e.breadcrumbs[e.breadcrumbs.length-1])==null?void 0:c.toField)||t,i=n.steps.findIndex(u=>u.field.id===o.id),s=i>-1?n.steps[i+1]:n.steps[0],a=new Set([o.id,...e.breadcrumbs.map(u=>{var d;return(d=u.toField)==null?void 0:d.id}),s==null?void 0:s.field.id]),l=r.filter(u=>!a.has(u.id)&&u.role==="groupby");return{contextualStep:s,otherFields:l,currentField:o}}function Rke(e){const{field:t,operator:n,value:r}=e,i={"=":"=","!=":"≠",">":">","<":"<",">=":"≥","<=":"≤",in:"in",not_in:"not in",contains:"contains",not_contains:"does not contain"}[n]??n,s=Array.isArray(r)?r.join(", "):String(r);return`${t.label} ${i} ${s}`}function kke({children:e,card:t,className:n}){var b,y,v,x,S,_;const r=C2(E=>E.context),o=no(E=>E.applyInteractionEvent),i=no(E=>E.interactionStates[t.id]),s=((b=t==null?void 0:t.interactionConfig)==null?void 0:b.drillHierarchies)||[],a=((y=t==null?void 0:t.interactionConfig)==null?void 0:y.allowedDrillTargets)||[],l={hierarchyId:i==null?void 0:i.hierarchyId,breadcrumbs:(i==null?void 0:i.breadcrumbs)||[]},c=a.filter(E=>!l.breadcrumbs.some(C=>{var k;return((k=C.toField)==null?void 0:k.id)===E.id})),u=(x=(v=t==null?void 0:t.config)==null?void 0:v.groupByColumns)==null?void 0:x[0],d=[...((S=t==null?void 0:t.config)==null?void 0:S.groupByColumns)||[],...((_=t==null?void 0:t.config)==null?void 0:_.pivotByColumns)||[]],h=r==null?void 0:r.conditions.map(Rke).join(", ");l.hierarchyId&&s.find(E=>E.id===l.hierarchyId),s.find(E=>E.default)||s[0];const p=E=>{const k=oC({intent:{mode:"dynamicDrill",drillField:E},card:t});k&&o(t.id,k,!0)},g=s.length>0,m=c.length>0;return!g&&!m?f.jsx("div",{className:re("flex grow",n),children:e}):f.jsxs(vke,{children:[f.jsx(xke,{className:re("flex grow",n),children:e}),f.jsxs(vV,{className:"w-64",children:[f.jsxs(Ug,{className:"flex items-center gap-1 text-muted-foreground",children:[f.jsx(yF,{className:"mr-1 h-3 w-3"}),h]}),f.jsx(TS,{}),s.map(E=>{const{contextualStep:C,currentField:k}=_ke(l,u||d[0],E,d);return C?f.jsxs(XI,{children:[f.jsxs(Ug,{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[f.jsx(bJ,{className:"h-3 w-3"}),E.label||E.id]}),f.jsxs(IS,{onSelect:()=>{const N={mode:"drillDown",hierarchyId:E.id,drillField:C.field},M=oC({intent:N,card:t});M&&o(t.id,M,!0)},className:"flex items-start gap-2",children:[f.jsx(cJ,{className:"mt-1 h-4 w-4 text-blue-500"}),f.jsxs("div",{className:"flex flex-col",children:[f.jsx("span",{children:C.label||C.field.label}),f.jsx("span",{className:"text-xs text-muted-foreground",children:l.breadcrumbs.length>0?`${k==null?void 0:k.label} → ${C.field.label}`:`Start with ${C.field.label}`})]})]}),f.jsx(TS,{})]},E.id):null}),f.jsxs(XI,{children:[f.jsxs(Ug,{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[f.jsx(_i,{className:"h-3 w-3"})," Other Fields"]}),f.jsx("div",{className:"my-2 max-h-64 overflow-y-auto",children:c&&c.length>0?c.map(E=>f.jsxs(IS,{onSelect:()=>p(E),className:"flex items-center gap-2 hover:bg-muted",children:[f.jsx(_i,{className:"h-4 w-4 text-muted-foreground"}),f.jsxs("div",{className:"flex flex-col",children:[f.jsx("span",{children:E.label}),f.jsx("span",{className:"text-xs text-muted-foreground",children:E.qualifiedEntityName})]})]},E.id)):f.jsxs("div",{className:"py-4 text-center text-sm text-muted-foreground",children:[f.jsx(hF,{className:"mx-auto mb-2 h-6 w-6"}),"No other fields available"]})})]})]})]})}function Nke(e){var d;const t=R.useRef([]),n=R.useRef(null),r=R.useRef(null),o=(d=e.interactionConfig)==null?void 0:d.clickFilterInteractions,i=Cf(h=>h.registerClearBlurCallback),s=Cf(h=>h.unregisterCard);R.useEffect(()=>{const h=()=>{r.current&&u(r.current)};return i(e.id,h),()=>{s(e.id)}},[e.id,i,s]);function a({chart:h,selectedSegments:p,storedOriginalColorsRef:g}){if(!h||!h.canvas||!h.canvas.ownerDocument){console.warn("Chart or canvas is null when trying to toggle blur segments");return}const m=h.data.datasets;g.current||(g.current=m.map((y,v)=>h.getDatasetMeta(v).data.map(S=>S.options.backgroundColor)));const b=g.current;m.forEach((y,v)=>{const x=b[v];if(p.length===0){y.backgroundColor=[...x];return}y.backgroundColor=x.map((S,_)=>p.some(C=>C.datasetIndex===v&&C.dataIndex===_)?S:l(S,.2))});try{h.update()}catch(y){console.warn("Failed to update chart during blur toggle:",y)}}function l(h,p=.2){if(h.startsWith("rgba"))return h.replace(/[\d.]+\)$/g,`${p})`);if(h.startsWith("#")){const g=parseInt(h.slice(1,3),16),m=parseInt(h.slice(3,5),16),b=parseInt(h.slice(5,7),16);return`rgba(${g}, ${m}, ${b}, ${p})`}return h}function c(h,p){var x;if(!o||!p)return;r.current=p;const g=p.getElementsAtEventForMode(h,"nearest",{intersect:!0},!0);if(!g.length)return;const{datasetIndex:m,index:b}=g[0],y={datasetIndex:m,dataIndex:b};if(((x=h.native)==null?void 0:x.shiftKey)||h.shiftKey){const S=t.current.findIndex(_=>_.datasetIndex===m&&_.dataIndex===b);S>=0?t.current.splice(S,1):t.current.push(y)}else{const S=t.current.length===1&&t.current[0].datasetIndex===m&&t.current[0].dataIndex===b;t.current=S?[]:[y]}a({chart:p,selectedSegments:t.current,storedOriginalColorsRef:n})}function u(h){h&&(t.current=[],n.current&&a({chart:h,selectedSegments:[],storedOriginalColorsRef:n}))}return{handleChartClick:c,clearBlur:u}}function Mke({resolvedCardConfig:e,card:t,records:n,chart:r,clickEvent:o}){var c,u,d,h,p,g,m,b,y;const i=r==null?void 0:r.getElementsAtEventForMode(o,"nearest",{intersect:!0},!0);if(!i.length)return;const s=i[0].datasetIndex,a=i[0].index,l=(u=(c=i[0].element)==null?void 0:c.$context)==null?void 0:u.raw;console.log("datasetIndex",s),console.log("clickIndex",a),console.log("value",l);try{if(!(n!=null&&n.length))return;const{keys:v}=un(n),{groupByColumns:x=[],pivotByColumns:S=[],metricColumns:_=[]}=e||t.config,E=C=>x.find(k=>k.label===C)||S.find(k=>k.label===C)||_.find(k=>k.label===C);if(t.type==="map"){const C=v[0],k=((h=(d=l==null?void 0:l.feature)==null?void 0:d.properties)==null?void 0:h.name)||((g=(p=l==null?void 0:l.feature)==null?void 0:p.properties)==null?void 0:g.NAME),N=E(C);return!N||k==null?void 0:{conditions:[{field:N,operator:"=",value:k}]}}if(["pie","funnel","doughnut"].includes(t.type)){const C=v[0],k=v==null?void 0:v[1+s],N=E(C),M=E(k),A=(m=n==null?void 0:n[a])==null?void 0:m[C];if(!N||A==null){console.log("no dim field or value",C,A);return}return{conditions:[{field:N,operator:"=",value:A}],metrics:M?[{field:M,value:l}]:void 0}}if(["stackedBar","bar","line"].includes(t.type)){const C=v[0],k=E(C),N=(b=n==null?void 0:n[a])==null?void 0:b[C];if(!k||N==null){console.log("no dim field or value for stacked bar",C,N);return}const M=_[0];if(!M){console.log("no metric field found");return}const A=(y=n==null?void 0:n[a])==null?void 0:y[M.label],P=S[0],F=Object.keys(n[0]).filter(O=>O!==C)[s],I=[{field:k,operator:"=",value:N}];return P&&F&&I.push({field:P,operator:"=",value:F}),{conditions:I,metrics:[{field:M,value:A}]}}}catch(v){console.error("getClickContextFromChart error",v)}}function Pke({cardId:e,className:t}){const n=no(u=>u.interactionStates[e]),r=no(u=>u.popInteractionStep),o=no(u=>u.resetInteractionState),i=(n==null?void 0:n.breadcrumbs)??[];if(n==null||n.hierarchyId,i.length===0)return null;const s=u=>{const d=i.length-u-1;for(let h=0;h<d;h++)r(e)},a=()=>{o(e)},l=u=>(u.sourceFilterGroups[0],u.toField?u.toField.label||u.toField.name:"Drill Step"),c=u=>{const d=u.sourceFilterGroups.flatMap(h=>h.filters).map(h=>`${h.field.label||h.field.name} = ${h.value}`);return f.jsxs("div",{className:"max-w-xs space-y-2 p-2 text-sm text-foreground/80",children:[d.length>0&&f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("div",{className:"flex items-center gap-2 font-medium",children:f.jsx(fb,{className:"h-4 w-4"})}),f.jsx("div",{className:"flex flex-wrap gap-1",children:d.map((h,p)=>f.jsx("span",{className:"",children:h},p))})]}),u.toField&&f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(yF,{className:"h-4 w-4"}),f.jsx(de,{children:u.toField.label||u.toField.name})]}),u.granularity&&f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(Ou,{className:"h-4 w-4"}),f.jsxs(de,{children:["Granularity: ",u.granularity]})]}),u.metric&&f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(iJ,{className:"h-4 w-4"}),f.jsxs(de,{children:["Metric:"," ",u.metric.formattedValue||u.metric.value]})]})]})};return f.jsxs("div",{className:re("flex items-center gap-1 text-sm",t),children:[f.jsx(Sa,{children:f.jsx(Ea,{asChild:!0,children:f.jsx("button",{className:"flex items-center p-0 text-muted-foreground hover:text-foreground",onClick:a,"aria-label":"Reset drill path",children:f.jsx(dF,{className:"h-3.5 w-3.5"})})})}),f.jsx(_i,{className:"ml-0.5 h-3 w-3 text-muted-foreground"}),f.jsx("div",{className:"flex items-center",children:i.map((u,d)=>f.jsxs("div",{className:"flex items-center",children:[d>0&&f.jsx(_i,{className:"mx-1 h-3 w-3 text-muted-foreground"}),f.jsxs(Sa,{children:[f.jsx(Ea,{asChild:!0,children:f.jsx(Ee,{variant:"link",size:"sm",className:"h-6 px-1 text-muted-foreground hover:text-foreground",onClick:()=>s(d),"aria-label":`Go back to: ${l(u)}`,children:l(u)})}),f.jsx(q_,{side:"bottom",children:c(u)})]})]},d))})]})}function Dke({card:e,frame:t}){var B,z,T,W;const{customCards:n,placeholders:r}=ir(),o=no(L=>L.interactionStates[e.id]),i=((B=o==null?void 0:o.breadcrumbs)==null?void 0:B.length)>0,s=oe(L=>L.themeStyle),a=oe(L=>L.selectedSheetId),l=oe(L=>L.isDashboardEditing);oe(L=>L.selectedLensId);const c=oe(L=>L.dashboard.filters),u=c==null?void 0:c.find(L=>L.id===t.filterId&&!L.hide),{setCardTitle:d,setCardDescription:h,setSelectedFrameId:p,updateFilter:g}=on(),{updateFrame:m}=on(),{handleChartClick:b}=Nke(e),y=((z=e.customCardPreferences)==null?void 0:z.showCardHeader)??!0,{isError:v,isLoading:x,isFetching:S,cfg:_,isPending:E,data:C,handleDatapointClick:k}=J6(e),{handlePointerInteraction:N}=zJ(e),M=EF(e);function A(L,D){L.button===0&&b(L.nativeEvent,D);const H=Mke({resolvedCardConfig:M,card:e,records:(C==null?void 0:C.records)||[],chart:D,clickEvent:L.nativeEvent});if(!H)return;const V={shift:L.shiftKey,ctrl:L.ctrlKey,meta:L.metaKey};L.button===0?N({context:H,gesture:"leftClick",modifierKeys:V}):L.button===2&&N({context:H,gesture:"rightClick",modifierKeys:V})}function P(){var L,D,H;if(n&&n.length>0){const V=n.find(q=>q.cardId===e.id);if(V&&V.replaceDefault){const q=V.content;if(q)return f.jsx(q,{card:e})}}if(e.type==="kpi"){if(((L=t==null?void 0:t.cards)==null?void 0:L.length)===1)return f.jsx(Zb,{card:e,data:(C==null?void 0:C.records)||[],isPending:E});if(((D=t==null?void 0:t.cards)==null?void 0:D.length)>1)return f.jsx(l_e,{frame:t})}return e.type==="text"&&((H=t==null?void 0:t.cards)==null?void 0:H.length)===1?f.jsx(Rh,{className:"mx-3 my-6 overflow-y-auto break-words px-3",children:f.jsx(t0,{isLoading:x||S,card:e,data:(C==null?void 0:C.records)||[]})}):$}function j(){if(v)return f.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:[f.jsx(gF,{className:"size-8 text-destructive"}),f.jsx("p",{className:"text-sm text-muted-foreground",children:"Error fetching data. Check your card settings."})]});if(C!=null&&C.records&&(C==null?void 0:C.records.length)===0)return r!=null&&r.NoRecords?f.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:r.NoRecords}):f.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:[f.jsx(vF,{className:"size-8 text-muted-foreground"}),f.jsx("p",{className:"text-sm text-muted-foreground",children:"No results to display"})]});if(e.type==="table"&&(C!=null&&C.records)&&(C==null?void 0:C.records.length)>0)return f.jsx("div",{className:"relative flex h-full min-h-0 w-full flex-1 grow basis-0",children:f.jsx(e7,{card:e,data:(C==null?void 0:C.records)||[]})});if(e.type==="pivotTable"&&(C!=null&&C.records)&&(C==null?void 0:C.records.length)>0){const L=_;if((L==null?void 0:L.type)==="pivotTable"&&(L!=null&&L.data))return f.jsx("div",{className:"relative flex h-full min-h-0 w-full flex-1 grow basis-0",children:f.jsx(r7,{card:e,data:L.data,options:L.options})})}if(e.type==="text")return f.jsx(Rh,{className:"overflow-y-auto break-words pr-2",children:f.jsx(t0,{isLoading:x||S,card:e,data:(C==null?void 0:C.records)||[]})});if(e.type==="custom")return f.jsx(Np,{FallbackComponent:UL,children:f.jsx(Oye,{frame:t,card:e})});if(n&&n.length>0){const L=n.find(D=>D.cardId===e.id);if(L&&L.content){const D=L.content;return f.jsx(D,{card:e})}}if(_)return f.jsx(kke,{card:e,children:f.jsx(jR,{cfg:_,onChartClick:A,onDatapointClick:k})})}function F(){if(n&&n.length>0){const L=n.find(D=>D.cardId===e.id);if(L&&L.footer){const D=L.footer;if(D)return f.jsx(D,{card:e})}}return null}function I(){var H;const L=t.cards.filter(V=>{var q;return!((q=V.tabTitle)!=null&&q.endsWith("__Header"))&&(V.displayTab===!0||V.displayTab===void 0)}),D=s==null?void 0:s.controlInputRadius;return f.jsx(ld,{value:t.activeCardId,className:"flex items-center justify-end gap-3",onValueChange:V=>{const q={...t,activeCardId:V};m(a,q)},children:f.jsx(lc,{style:{borderRadius:s==null?void 0:s.controlInputRadius},className:"flex-end flex h-9 flex-wrap items-center border border-border bg-background p-0",children:(H=t.cards.filter(V=>{var q;return!((q=V.tabTitle)!=null&&q.endsWith("__Header"))&&(V.displayTab===!0||V.displayTab===void 0)}))==null?void 0:H.map((V,q)=>f.jsx(Jr,{className:re("h-full items-center rounded-none data-[state=active]:bg-muted data-[state=active]:shadow-none",{"border-r":q!==L.length-1}),style:{borderTopLeftRadius:q===0?D:0,borderTopRightRadius:q===L.length-1?D:0,borderBottomLeftRadius:q===0?D:0,borderBottomRightRadius:q===L.length-1?D:0},value:V.id,children:V.tabTitle||V.title},V.id))})})}function O(){let L=t.cards.find(D=>D.type==="kpi"&&D.tabTitle===`${e.tabTitle}__Header`);return L||(L=t.cards.find(D=>D.type==="kpi"&&D.tabTitle==="All__Header")),L?f.jsx("div",{className:"flex items-end gap-2",children:f.jsx(Xbe,{renderFilterInfo:()=>f.jsx($A,{cardId:e.id}),card:L})}):f.jsxs(f.Fragment,{children:[f.jsxs("div",{role:"card-title-container",className:"flex h-7 items-center gap-2",children:[f.jsx(wi,{enabled:l,text:e.title,onSave:D=>d(a,e.id,D),children:f.jsx(fa,{className:re("text-base",{}),children:e.title})}),(l||e.info)&&f.jsx(_9,{card:e}),e.refreshInterval&&f.jsxs(Sa,{children:[f.jsx(Ea,{className:"pr-1",children:f.jsx("div",{className:re("h-2 w-2 rounded-full bg-green-500 transition-opacity",{"opacity-10":x||S})})}),f.jsx(Jl,{side:"right",align:"center",children:f.jsx("p",{className:"text-xs",children:`Realtime (${e==null?void 0:e.refreshInterval})`})})]}),f.jsx($A,{cardId:e.id})]}),f.jsxs("div",{"data-content":"card-description-and-breadcrumb",className:"flex h-6 items-center overflow-y-auto",children:[!i&&f.jsx(wi,{enabled:l,text:(e==null?void 0:e.description)||"",onSave:D=>h(a,e.id,D),children:f.jsxs(jE,{className:re("",{}),children:[" ",e.description]})}),i&&f.jsx(Pke,{cardId:e.id})]})]})}if(!e.id)return null;const $=f.jsxs(f.Fragment,{children:[y?f.jsx(Tu,{children:f.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[f.jsx("div",{className:"flex-1 basis-0 scroll-pb-2 overflow-x-auto",role:"header-container",children:O()}),f.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f.jsx("div",{children:u&&f.jsxs("div",{style:{borderRadius:(W=(T=s==null?void 0:s.chart)==null?void 0:T.options)==null?void 0:W.borderRadius},"data-content":"frame-filter-container",className:"flex shrink-0 items-center",children:[!ic(u.dataType)&&f.jsx(wi,{enabled:l,className:"my-1",containerClassName:"shrink-0",text:u.title||u.column,onSave:L=>g({...u,title:L}),children:f.jsx(de,{className:"px-3",children:u.title})}),f.jsx(sk,{filter:u})]})}),t.cards.length>1&&I()]})]})}):f.jsx("div",{className:"h-8"}),f.jsx(nh,{className:"relative flex min-h-0 grow flex-col",children:j()}),f.jsx(BO,{children:F()})]});return f.jsx("div",{className:re("flex h-full flex-col",{"animate-pulse":x||S}),children:P()})}function Ake({frame:e,footer:t,className:n,...r}){const o=R.useRef(null),i=oe(y=>y.themeStyle),s=oe(y=>y.isVisualEditing),a=oe(y=>y.selectedFrameId),l=oe(y=>y.isDashboardEditing),{setSelectedFrameId:c}=on(),{setSelectedConnectionId:u,setSelectedDatabaseName:d,setSelectedSchemaName:h,setSelectedTableName:p,setCard:g}=Zo();R.useEffect(()=>{if(a===e.id&&l&&!s){const y=o==null?void 0:o.current;y==null||y.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}},[a,e.id,l,s,o]);const m=e.cards.find(y=>y.id===e.activeCardId);function b(y){y.stopPropagation(),c(e.id),m&&g(m),m!=null&&m.connectionId&&u(m==null?void 0:m.connectionId),m!=null&&m.lastSelectedDatabase&&d(m==null?void 0:m.lastSelectedDatabase),m!=null&&m.lastSelectedSchema&&h(m==null?void 0:m.lastSelectedSchema),m!=null&&m.lastSelectedTable&&p(m==null?void 0:m.lastSelectedTable)}return f.jsx(Np,{FallbackComponent:d_,children:f.jsxs("div",{tabIndex:-1,ref:o,role:"card-frame",onClick:b,style:{borderRadius:i==null?void 0:i.cardBorderRadius},className:re("relative flex h-full flex-col rounded-sm border bg-background shadow-sm",{"border-dashed border-foreground/50":a===e.id&&l},i==null?void 0:i.dashboardCard,n,"semaphor-card-frame"),...r,children:[f.jsx(WL,{frame:e}),m&&f.jsx(Dke,{card:m,frame:e},m.id)]})})}const xV=w.forwardRef(({className:e,...t},n)=>f.jsx("textarea",{className:re("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));xV.displayName="Textarea";function Ike({label:e,onCheckedChange:t,checked:n}){return f.jsxs("div",{className:"flex items-center space-x-2",children:[f.jsx(zr,{onCheckedChange:t,id:"terms",checked:n}),f.jsx("label",{htmlFor:"terms",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:e})]})}function wV({text:e,className:t}){const[n,r]=R.useState(!1);return f.jsx(Ee,{className:re("h-7 w-fit px-1 font-mono text-xs text-muted-foreground/70",t),variant:"ghost",size:"icon",onClick:()=>{navigator.clipboard.writeText(e),r(!0),setTimeout(()=>{r(!1)},1e3)},children:n?f.jsx(X5,{className:"size-3.5"}):f.jsx(d2,{className:"size-3.5"})})}function Tke({filter:e}){const[t,n]=R.useState(e.sql),[r,o]=R.useState(!1),i=oe(h=>h.selectedSheetId),{updateFilter:s,updateFilterId:a}=on();function l(){const h={...e,sql:t};s(h),o(!1)}function c(h){const p={...e,type:h};s(p)}function u(h){const p={...e,uiType:h};s(p)}function d(h){if(!i)return;const p={...e,sheetId:h?i:void 0};s(p)}return f.jsxs(Ia,{open:r,onOpenChange:o,children:[f.jsx(Ta,{children:f.jsx(aa,{className:"invisible h-3 w-3 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"})}),f.jsxs(ks,{onMouseDown:h=>h.stopPropagation(),onDoubleClick:h=>h.stopPropagation(),className:"z-50 m-2 w-full min-w-[350px] space-y-4",children:[f.jsxs("div",{className:"space-y-2",children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("p",{className:"font-semibold text-foreground",children:e.column}),f.jsx("div",{className:"flex items-center gap-2",children:f.jsxs(Xy,{openDelay:0,children:[f.jsx(Qy,{children:f.jsx(X0,{className:"size-3.5 cursor-pointer text-muted-foreground hover:text-foreground/80"})}),f.jsxs(Op,{align:"start",className:"w-auto px-3 py-2",children:[f.jsx(de,{children:"Filter ID"}),f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx("p",{className:"font-mono text-xs text-muted-foreground",children:e.id}),f.jsx(wV,{text:e.id})]})]})]})})]}),f.jsx("p",{className:"text-sm text-muted-foreground",children:"Customize filter operation and SQL"})]}),f.jsx(_a,{}),f.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[f.jsxs("div",{className:"space-y-2",children:[f.jsx(de,{children:"Type"}),f.jsxs(ba,{onValueChange:c,value:e.type||"multiple",className:"flex gap-3",defaultValue:"x",children:[f.jsxs("div",{className:"flex items-center space-x-2",children:[f.jsx(Fr,{value:"multiple",id:"r1"}),f.jsx("label",{className:"text-sm",htmlFor:"r1",children:"Multiple"})]}),f.jsxs("div",{className:"flex items-center space-x-2",children:[f.jsx(Fr,{value:"single",id:"r2"}),f.jsx("label",{className:"text-sm",htmlFor:"r2",children:"Single"})]})]})]}),e.type==="single"&&f.jsxs("div",{className:"space-y-2",children:[f.jsx(de,{children:"Component"}),f.jsxs(ba,{onValueChange:u,value:e.uiType||"dropdown",className:"flex gap-3",defaultValue:"x",children:[f.jsxs("div",{className:"flex items-center space-x-2",children:[f.jsx(Fr,{value:"dropdown",id:"r2"}),f.jsx("label",{className:"text-sm",htmlFor:"r2",children:"Dropdown"})]}),f.jsxs("div",{className:"flex items-center space-x-2",children:[f.jsx(Fr,{value:"radio",id:"r1"}),f.jsx("label",{className:"text-sm",htmlFor:"r1",children:"Radio"})]})]})]})]}),f.jsxs("div",{className:"grid grid-cols-6 gap-4 text-sm",children:[f.jsxs("div",{className:"col-span-2 space-y-1",children:[f.jsx(de,{children:"Table Column"}),f.jsx(de,{className:"block rounded-md bg-muted px-3 py-1 text-sm",children:e.column})]}),f.jsxs("div",{className:"col-span-2 space-y-1",children:[f.jsx(de,{children:"Data Type"}),f.jsx(de,{className:"block rounded-md bg-muted px-3 py-1 text-sm",children:e.dataType})]})]}),f.jsxs("div",{className:"flex grow flex-col space-y-1",role:"container",children:[f.jsx(de,{className:"text-sm",children:"Values SQL"}),f.jsx(xV,{onKeyDown:h=>{h.stopPropagation()},value:t,onChange:h=>n(h.target.value),className:`min-w-full grow resize font-mono text-xs ${ps}`})]}),f.jsx("div",{children:f.jsx(Ike,{label:"Local to sheet",onCheckedChange:d,checked:!!e.sheetId})}),f.jsx("div",{className:"flex justify-end gap-2",children:f.jsxs(Ee,{onClick:l,size:"sm",variant:"outline",children:[f.jsx(ao,{className:"mr-2 size-4"}),"Accept"]})})]})]})}function CV({filter:e}){const t=oe(a=>a.isDashboardEditing),n=oe(a=>a.filterValues),r=n==null?void 0:n.some(a=>a.filterId===e.id),{removeFilterValues:o,removeFilter:i,updateFilter:s}=on();return f.jsxs("div",{className:"group mb-1 flex h-5 items-center justify-between",children:[f.jsxs("div",{className:"flex grow items-center gap-2",children:[f.jsx(wi,{enabled:t,className:"my-1",text:e.title||e.column,onSave:a=>s({...e,title:a}),children:f.jsx(de,{className:"inline-block text-sm",children:e.title})}),r&&f.jsx("button",{onClick:()=>o(e.id),className:"text-foreground/70",children:f.jsx(cF,{className:"size-3.5"})}),t&&f.jsx("button",{className:"invisible group-hover:visible",onClick:()=>{s({...e,hide:!e.hide})},children:e.hide?f.jsx(K0,{className:"size-3.5 text-foreground/50 hover:text-foreground/70"}):f.jsx(p2,{className:"size-3.5 text-foreground/50 hover:text-foreground/70"})}),t&&f.jsx(Tke,{filter:e})]}),f.jsx("div",{className:"flex items-center gap-2",children:t&&f.jsx(nr,{onClick:()=>{o(e.id),i(e.id)},className:"size-3 cursor-pointer text-foreground/30 hover:cursor-pointer hover:text-foreground/50"})})]})}const jke=_M.WidthProvider(_M.Responsive);function Oke({sheet:e}){var y,v;const t=oe(x=>x.isDashboardEditing),n=oe(x=>x.currentBreakpoint),r=oe(x=>x.themeStyle),o=oe(x=>x.selectedSheetId),i=e.layouts,s=oe(x=>x.dashboard.filters),a=e.frames,{setSheetLayouts:l,setCurrentBreakpoint:c}=oe(x=>x.actions);R.useEffect(()=>{document.documentElement.style.setProperty("--placeholder-border-radius",`${r==null?void 0:r.cardBorderRadius}px`)},[r==null?void 0:r.cardBorderRadius]);function u(x){c(x)}function d(x,S){o===e.id&&l(o,S)}if(!o)return null;const h=(x,S)=>f.jsx(SV,{className:"after:content-none",ref:S,handleAxis:x}),p=x=>x&&(x==null?void 0:x.h)===1&&(x==null?void 0:x.w)===1?{...x,h:8,minH:7,w:7}:null;function g(){const x=s==null?void 0:s.filter(S=>(S.sheetId===o||!S.sheetId)&&!S.hide);return x==null?void 0:x.map(S=>{var C;const _=(C=i==null?void 0:i[n])==null?void 0:C.find(k=>k.i===S.id);if(S.location==="frame")return null;const E=p(_);return f.jsxs("div",{style:{borderRadius:r==null?void 0:r.cardBorderRadius},className:re("z-50 flex flex-col rounded-md border bg-background px-3 py-2"),...E?{"data-grid":E}:{},children:[f.jsx(CV,{filter:S}),f.jsx(sk,{filter:S})]},S.id)})}function m(){return a==null?void 0:a.map(x=>f.jsx("div",{role:"dashboard-frame-container",className:re("group isolate overflow-hidden",r==null?void 0:r.dashboardCardContainer),children:f.jsx(Np,{FallbackComponent:({error:S,resetErrorBoundary:_})=>f.jsx(Use,{error:S,resetErrorBoundary:_,frame:x}),children:f.jsx(Ake,{frame:x})})},x.id))}const b=((y=r==null?void 0:r.gridLayout)==null?void 0:y.margin)||[10,10];return f.jsx(f.Fragment,{children:f.jsxs(jke,{margin:b,isDraggable:t,resizeHandles:t?["sw","nw","ne","se","e","w"]:[],className:re((v=r==null?void 0:r.gridLayout)==null?void 0:v.className),layouts:i,cols:{lg:48,md:36,sm:24,xs:12,xxs:6},rowHeight:1,onBreakpointChange:u,onLayoutChange:d,resizeHandle:h,children:[g(),m()]})})}const SV=R.forwardRef(({className:e,handleAxis:t,...n},r)=>{const o=oe(s=>s.themeStyle),i=(o==null?void 0:o.cardBorderRadius)||0;return f.jsx("div",{ref:r,className:re(`react-resizable-handle z-10 react-resizable-handle-${t} absolute border-foreground/40`,{"border-foreground/40 group-hover:border-2 group-hover:border-b-0 group-hover:border-r-0":t==="nw"&&i<11,"border-foreground/40 group-hover:border-2 group-hover:border-b-0 group-hover:border-l-0":t==="ne"&&i<11,"border-foreground/40 group-hover:border-2 group-hover:border-r-0 group-hover:border-t-0":t==="sw"&&i<11,"border-foreground/40 group-hover:border-2 group-hover:border-l-0 group-hover:border-t-0":t==="se"&&i<11,"border-foreground/40 group-hover:border-2 group-hover:border-b-0 group-hover:border-l-0 group-hover:border-t-0":t==="e","border-foreground/40 group-hover:border-2 group-hover:border-b-0 group-hover:border-r-0 group-hover:border-t-0":t==="w"},e),...n})});SV.displayName="ResizeHandle";const{createElement:nd,createContext:Fke,forwardRef:EV,useCallback:Mr,useContext:_V,useEffect:Fl,useImperativeHandle:RV,useLayoutEffect:Lke,useMemo:$ke,useRef:Tr,useState:du}=w,QI=w[`useId${Math.random()}`.slice(0,5)],zke=Lke,uv=Fke(null);uv.displayName="PanelGroupContext";const Ll=zke,Bke=typeof QI=="function"?QI:()=>null;let Vke=0;function bk(e=null){const t=Bke(),n=Tr(e||t||null);return n.current===null&&(n.current=""+Vke++),e??n.current}function kV({children:e,className:t="",collapsedSize:n,collapsible:r,defaultSize:o,forwardedRef:i,id:s,maxSize:a,minSize:l,onCollapse:c,onExpand:u,onResize:d,order:h,style:p,tagName:g="div",...m}){const b=_V(uv);if(b===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:y,expandPanel:v,getPanelSize:x,getPanelStyle:S,groupId:_,isPanelCollapsed:E,reevaluatePanelConstraints:C,registerPanel:k,resizePanel:N,unregisterPanel:M}=b,A=bk(s),P=Tr({callbacks:{onCollapse:c,onExpand:u,onResize:d},constraints:{collapsedSize:n,collapsible:r,defaultSize:o,maxSize:a,minSize:l},id:A,idIsFromProps:s!==void 0,order:h});Tr({didLogMissingDefaultSizeWarning:!1}),Ll(()=>{const{callbacks:F,constraints:I}=P.current,O={...I};P.current.id=A,P.current.idIsFromProps=s!==void 0,P.current.order=h,F.onCollapse=c,F.onExpand=u,F.onResize=d,I.collapsedSize=n,I.collapsible=r,I.defaultSize=o,I.maxSize=a,I.minSize=l,(O.collapsedSize!==I.collapsedSize||O.collapsible!==I.collapsible||O.maxSize!==I.maxSize||O.minSize!==I.minSize)&&C(P.current,O)}),Ll(()=>{const F=P.current;return k(F),()=>{M(F)}},[h,A,k,M]),RV(i,()=>({collapse:()=>{y(P.current)},expand:F=>{v(P.current,F)},getId(){return A},getSize(){return x(P.current)},isCollapsed(){return E(P.current)},isExpanded(){return!E(P.current)},resize:F=>{N(P.current,F)}}),[y,v,x,E,A,N]);const j=S(P.current,o);return nd(g,{...m,children:e,className:t,id:s,style:{...j,...p},"data-panel":"","data-panel-collapsible":r||void 0,"data-panel-group-id":_,"data-panel-id":A,"data-panel-size":parseFloat(""+j.flexGrow).toFixed(1)})}const NV=EV((e,t)=>nd(kV,{...e,forwardedRef:t}));kV.displayName="Panel";NV.displayName="forwardRef(Panel)";let jS=null,ml=null;function Hke(e,t){if(t){const n=(t&IV)!==0,r=(t&TV)!==0,o=(t&jV)!==0,i=(t&OV)!==0;if(n)return o?"se-resize":i?"ne-resize":"e-resize";if(r)return o?"sw-resize":i?"nw-resize":"w-resize";if(o)return"s-resize";if(i)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function Wke(){ml!==null&&(document.head.removeChild(ml),jS=null,ml=null)}function jw(e,t){const n=Hke(e,t);jS!==n&&(jS=n,ml===null&&(ml=document.createElement("style"),document.head.appendChild(ml)),ml.innerHTML=`*{cursor: ${n}!important;}`)}function MV(e){return e.type==="keydown"}function PV(e){return e.type.startsWith("pointer")}function DV(e){return e.type.startsWith("mouse")}function dv(e){if(PV(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(DV(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function Uke(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function Gke(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 qke(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:eT(e),b:eT(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;it(r,"Stacking order can only be calculated for elements with a common ancestor");const o={a:JI(ZI(n.a)),b:JI(ZI(n.b))};if(o.a===o.b){const i=r.childNodes,s={a:n.a.at(-1),b:n.b.at(-1)};let a=i.length;for(;a--;){const l=i[a];if(l===s.a)return 1;if(l===s.b)return-1}}return Math.sign(o.a-o.b)}const Yke=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Kke(e){var t;const n=getComputedStyle((t=AV(e))!==null&&t!==void 0?t:e).display;return n==="flex"||n==="inline-flex"}function Xke(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Kke(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"||Yke.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function ZI(e){let t=e.length;for(;t--;){const n=e[t];if(it(n,"Missing node"),Xke(n))return n}return null}function JI(e){return e&&Number(getComputedStyle(e).zIndex)||0}function eT(e){const t=[];for(;e;)t.push(e),e=AV(e);return t}function AV(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const IV=1,TV=2,jV=4,OV=8,Qke=Uke()==="coarse";let Ho=[],fu=!1,Us=new Map,fv=new Map;const Th=new Set;function Zke(e,t,n,r,o){var i;const{ownerDocument:s}=t,a={direction:n,element:t,hitAreaMargins:r,setResizeHandlerState:o},l=(i=Us.get(s))!==null&&i!==void 0?i:0;return Us.set(s,l+1),Th.add(a),p0(),function(){var u;fv.delete(e),Th.delete(a);const d=(u=Us.get(s))!==null&&u!==void 0?u:1;if(Us.set(s,d-1),p0(),d===1&&Us.delete(s),Ho.includes(a)){const h=Ho.indexOf(a);h>=0&&Ho.splice(h,1),vk(),o("up",!0,null)}}}function tT(e){const{target:t}=e,{x:n,y:r}=dv(e);fu=!0,yk({target:t,x:n,y:r}),p0(),Ho.length>0&&(m0("down",e),e.preventDefault(),e.stopPropagation())}function Zd(e){const{x:t,y:n}=dv(e);if(fu&&e.buttons===0&&(fu=!1,m0("up",e)),!fu){const{target:r}=e;yk({target:r,x:t,y:n})}m0("move",e),vk(),Ho.length>0&&e.preventDefault()}function $c(e){const{target:t}=e,{x:n,y:r}=dv(e);fv.clear(),fu=!1,Ho.length>0&&e.preventDefault(),m0("up",e),yk({target:t,x:n,y:r}),vk(),p0()}function yk({target:e,x:t,y:n}){Ho.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),Th.forEach(o=>{const{element:i,hitAreaMargins:s}=o,a=i.getBoundingClientRect(),{bottom:l,left:c,right:u,top:d}=a,h=Qke?s.coarse:s.fine;if(t>=c-h&&t<=u+h&&n>=d-h&&n<=l+h){if(r!==null&&document.contains(r)&&i!==r&&!i.contains(r)&&!r.contains(i)&&qke(r,i)>0){let g=r,m=!1;for(;g&&!g.contains(i);){if(Gke(g.getBoundingClientRect(),a)){m=!0;break}g=g.parentElement}if(m)return}Ho.push(o)}})}function Ow(e,t){fv.set(e,t)}function vk(){let e=!1,t=!1;Ho.forEach(r=>{const{direction:o}=r;o==="horizontal"?e=!0:t=!0});let n=0;fv.forEach(r=>{n|=r}),e&&t?jw("intersection",n):e?jw("horizontal",n):t?jw("vertical",n):Wke()}function p0(){Us.forEach((e,t)=>{const{body:n}=t;n.removeEventListener("contextmenu",$c),n.removeEventListener("pointerdown",tT),n.removeEventListener("pointerleave",Zd),n.removeEventListener("pointermove",Zd)}),window.removeEventListener("pointerup",$c),window.removeEventListener("pointercancel",$c),Th.size>0&&(fu?(Ho.length>0&&Us.forEach((e,t)=>{const{body:n}=t;e>0&&(n.addEventListener("contextmenu",$c),n.addEventListener("pointerleave",Zd),n.addEventListener("pointermove",Zd))}),window.addEventListener("pointerup",$c),window.addEventListener("pointercancel",$c)):Us.forEach((e,t)=>{const{body:n}=t;e>0&&(n.addEventListener("pointerdown",tT,{capture:!0}),n.addEventListener("pointermove",Zd))}))}function m0(e,t){Th.forEach(n=>{const{setResizeHandlerState:r}=n,o=Ho.includes(n);r(e,o,t)})}function Jke(){const[e,t]=du(0);return Mr(()=>t(n=>n+1),[])}function it(e,t){if(!e)throw console.error(t),Error(t)}const xk=10;function nc(e,t,n=xk){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function ss(e,t,n=xk){return nc(e,t,n)===0}function Xr(e,t,n){return nc(e,t,n)===0}function eNe(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){const o=e[r],i=t[r];if(!Xr(o,i,n))return!1}return!0}function Zc({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];it(r!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:o=0,collapsible:i,maxSize:s=100,minSize:a=0}=r;if(nc(n,a)<0)if(i){const l=(o+a)/2;nc(n,l)<0?n=o:n=a}else n=a;return n=Math.min(s,n),n=parseFloat(n.toFixed(xk)),n}function yf({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:o,trigger:i}){if(Xr(e,0))return t;const s=[...t],[a,l]=r;it(a!=null,"Invalid first pivot index"),it(l!=null,"Invalid second pivot index");let c=0;if(i==="keyboard"){{const d=e<0?l:a,h=n[d];it(h,`Panel constraints not found for index ${d}`);const{collapsedSize:p=0,collapsible:g,minSize:m=0}=h;if(g){const b=t[d];if(it(b!=null,`Previous layout not found for panel index ${d}`),Xr(b,p)){const y=m-b;nc(y,Math.abs(e))>0&&(e=e<0?0-y:y)}}}{const d=e<0?a:l,h=n[d];it(h,`No panel constraints found for index ${d}`);const{collapsedSize:p=0,collapsible:g,minSize:m=0}=h;if(g){const b=t[d];if(it(b!=null,`Previous layout not found for panel index ${d}`),Xr(b,m)){const y=b-p;nc(y,Math.abs(e))>0&&(e=e<0?0-y:y)}}}}{const d=e<0?1:-1;let h=e<0?l:a,p=0;for(;;){const m=t[h];it(m!=null,`Previous layout not found for panel index ${h}`);const y=Zc({panelConstraints:n,panelIndex:h,size:100})-m;if(p+=y,h+=d,h<0||h>=n.length)break}const g=Math.min(Math.abs(e),Math.abs(p));e=e<0?0-g:g}{let h=e<0?a:l;for(;h>=0&&h<n.length;){const p=Math.abs(e)-Math.abs(c),g=t[h];it(g!=null,`Previous layout not found for panel index ${h}`);const m=g-p,b=Zc({panelConstraints:n,panelIndex:h,size:m});if(!Xr(g,b)&&(c+=g-b,s[h]=b,c.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?h--:h++}}if(eNe(o,s))return o;{const d=e<0?l:a,h=t[d];it(h!=null,`Previous layout not found for panel index ${d}`);const p=h+c,g=Zc({panelConstraints:n,panelIndex:d,size:p});if(s[d]=g,!Xr(g,p)){let m=p-g,y=e<0?l:a;for(;y>=0&&y<n.length;){const v=s[y];it(v!=null,`Previous layout not found for panel index ${y}`);const x=v+m,S=Zc({panelConstraints:n,panelIndex:y,size:x});if(Xr(v,S)||(m-=S-v,s[y]=S),Xr(m,0))break;e>0?y--:y++}}}const u=s.reduce((d,h)=>h+d,0);return Xr(u,100)?s:o}function tNe({layout:e,panelsArray:t,pivotIndices:n}){let r=0,o=100,i=0,s=0;const a=n[0];it(a!=null,"No pivot index found"),t.forEach((d,h)=>{const{constraints:p}=d,{maxSize:g=100,minSize:m=0}=p;h===a?(r=m,o=g):(i+=m,s+=g)});const l=Math.min(o,100-i),c=Math.max(r,100-s),u=e[a];return{valueMax:l,valueMin:c,valueNow:u}}function jh(e,t=document){return Array.from(t.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function FV(e,t,n=document){const o=jh(e,n).findIndex(i=>i.getAttribute("data-panel-resize-handle-id")===t);return o??null}function LV(e,t,n){const r=FV(e,t,n);return r!=null?[r,r+1]:[-1,-1]}function $V(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 hv(e,t=document){const n=t.querySelector(`[data-panel-resize-handle-id="${e}"]`);return n||null}function nNe(e,t,n,r=document){var o,i,s,a;const l=hv(t,r),c=jh(e,r),u=l?c.indexOf(l):-1,d=(o=(i=n[u])===null||i===void 0?void 0:i.id)!==null&&o!==void 0?o:null,h=(s=(a=n[u+1])===null||a===void 0?void 0:a.id)!==null&&s!==void 0?s:null;return[d,h]}function rNe({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:r,panelDataArray:o,panelGroupElement:i,setLayout:s}){Tr({didWarnAboutMissingResizeHandle:!1}),Ll(()=>{if(!i)return;const a=jh(n,i);for(let l=0;l<o.length-1;l++){const{valueMax:c,valueMin:u,valueNow:d}=tNe({layout:r,panelsArray:o,pivotIndices:[l,l+1]}),h=a[l];if(h!=null){const p=o[l];it(p,`No panel data found for index "${l}"`),h.setAttribute("aria-controls",p.id),h.setAttribute("aria-valuemax",""+Math.round(c)),h.setAttribute("aria-valuemin",""+Math.round(u)),h.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,o,i]),Fl(()=>{if(!i)return;const a=t.current;it(a,"Eager values not found");const{panelDataArray:l}=a,c=$V(n,i);it(c!=null,`No group found for id "${n}"`);const u=jh(n,i);it(u,`No resize handles found for group id "${n}"`);const d=u.map(h=>{const p=h.getAttribute("data-panel-resize-handle-id");it(p,"Resize handle element has no handle id attribute");const[g,m]=nNe(n,p,l,i);if(g==null||m==null)return()=>{};const b=y=>{if(!y.defaultPrevented)switch(y.key){case"Enter":{y.preventDefault();const v=l.findIndex(x=>x.id===g);if(v>=0){const x=l[v];it(x,`No panel data found for index ${v}`);const S=r[v],{collapsedSize:_=0,collapsible:E,minSize:C=0}=x.constraints;if(S!=null&&E){const k=yf({delta:Xr(S,_)?C-_:_-S,initialLayout:r,panelConstraints:l.map(N=>N.constraints),pivotIndices:LV(n,p,i),prevLayout:r,trigger:"keyboard"});r!==k&&s(k)}}break}}};return h.addEventListener("keydown",b),()=>{h.removeEventListener("keydown",b)}});return()=>{d.forEach(h=>h())}},[i,e,t,n,r,o,s])}function nT(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 zV(e,t){const n=e==="horizontal",{x:r,y:o}=dv(t);return n?r:o}function oNe(e,t,n,r,o){const i=n==="horizontal",s=hv(t,o);it(s,`No resize handle element found for id "${t}"`);const a=s.getAttribute("data-panel-group-id");it(a,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=r;const c=zV(n,e),u=$V(a,o);it(u,`No group element found for id "${a}"`);const d=u.getBoundingClientRect(),h=i?d.width:d.height;return(c-l)/h*100}function iNe(e,t,n,r,o,i){if(MV(e)){const s=n==="horizontal";let a=0;e.shiftKey?a=100:o!=null?a=o: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:oNe(e,t,n,r,i)}function sNe({panelDataArray:e}){const t=Array(e.length),n=e.map(i=>i.constraints);let r=0,o=100;for(let i=0;i<e.length;i++){const s=n[i];it(s,`Panel constraints not found for index ${i}`);const{defaultSize:a}=s;a!=null&&(r++,t[i]=a,o-=a)}for(let i=0;i<e.length;i++){const s=n[i];it(s,`Panel constraints not found for index ${i}`);const{defaultSize:a}=s;if(a!=null)continue;const l=e.length-r,c=o/l;r++,t[i]=c,o-=c}return t}function zc(e,t,n){t.forEach((r,o)=>{const i=e[o];it(i,`Panel data not found for index ${o}`);const{callbacks:s,constraints:a,id:l}=i,{collapsedSize:c=0,collapsible:u}=a,d=n[l];if(d==null||r!==d){n[l]=r;const{onCollapse:h,onExpand:p,onResize:g}=s;g&&g(r,d),u&&(h||p)&&(p&&(d==null||ss(d,c))&&!ss(r,c)&&p(),h&&(d==null||!ss(d,c))&&ss(r,c)&&h())}})}function mg(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 aNe({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:o,precision:i=3}){const s=n[o];let a;return s==null?a=e!=null?e.toPrecision(i):"1":r.length===1?a="1":a=s.toPrecision(i),{flexBasis:0,flexGrow:a,flexShrink:1,overflow:"hidden",pointerEvents:t!==null?"none":void 0}}function lNe(e,t=10){let n=null;return(...o)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...o)},t)}}function rT(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 BV(e){return`react-resizable-panels:${e}`}function VV(e){return e.map(t=>{const{constraints:n,id:r,idIsFromProps:o,order:i}=t;return o?r:i?`${i}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((t,n)=>t.localeCompare(n)).join(",")}function HV(e,t){try{const n=BV(e),r=t.getItem(n);if(r){const o=JSON.parse(r);if(typeof o=="object"&&o!=null)return o}}catch{}return null}function cNe(e,t,n){var r,o;const i=(r=HV(e,n))!==null&&r!==void 0?r:{},s=VV(t);return(o=i[s])!==null&&o!==void 0?o:null}function uNe(e,t,n,r,o){var i;const s=BV(e),a=VV(t),l=(i=HV(e,o))!==null&&i!==void 0?i:{};l[a]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{o.setItem(s,JSON.stringify(l))}catch(c){console.error(c)}}function oT({layout:e,panelConstraints:t}){const n=[...e],r=n.reduce((i,s)=>i+s,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(i=>`${i}%`).join(", ")}`);if(!Xr(r,100)&&n.length>0)for(let i=0;i<t.length;i++){const s=n[i];it(s!=null,`No layout data found for index ${i}`);const a=100/r*s;n[i]=a}let o=0;for(let i=0;i<t.length;i++){const s=n[i];it(s!=null,`No layout data found for index ${i}`);const a=Zc({panelConstraints:t,panelIndex:i,size:s});s!=a&&(o+=s-a,n[i]=a)}if(!Xr(o,0))for(let i=0;i<t.length;i++){const s=n[i];it(s!=null,`No layout data found for index ${i}`);const a=s+o,l=Zc({panelConstraints:t,panelIndex:i,size:a});if(s!==l&&(o-=l-s,n[i]=l,Xr(o,0)))break}return n}const dNe=100,vf={getItem:e=>(rT(vf),vf.getItem(e)),setItem:(e,t)=>{rT(vf),vf.setItem(e,t)}},iT={};function WV({autoSaveId:e=null,children:t,className:n="",direction:r,forwardedRef:o,id:i=null,onLayout:s=null,keyboardResizeBy:a=null,storage:l=vf,style:c,tagName:u="div",...d}){const h=bk(i),p=Tr(null),[g,m]=du(null),[b,y]=du([]),v=Jke(),x=Tr({}),S=Tr(new Map),_=Tr(0),E=Tr({autoSaveId:e,direction:r,dragState:g,id:h,keyboardResizeBy:a,onLayout:s,storage:l}),C=Tr({layout:b,panelDataArray:[],panelDataArrayChanged:!1});Tr({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),RV(o,()=>({getId:()=>E.current.id,getLayout:()=>{const{layout:D}=C.current;return D},setLayout:D=>{const{onLayout:H}=E.current,{layout:V,panelDataArray:q}=C.current,U=oT({layout:D,panelConstraints:q.map(Y=>Y.constraints)});nT(V,U)||(y(U),C.current.layout=U,H&&H(U),zc(q,U,x.current))}}),[]),Ll(()=>{E.current.autoSaveId=e,E.current.direction=r,E.current.dragState=g,E.current.id=h,E.current.onLayout=s,E.current.storage=l}),rNe({committedValuesRef:E,eagerValuesRef:C,groupId:h,layout:b,panelDataArray:C.current.panelDataArray,setLayout:y,panelGroupElement:p.current}),Fl(()=>{const{panelDataArray:D}=C.current;if(e){if(b.length===0||b.length!==D.length)return;let H=iT[e];H==null&&(H=lNe(uNe,dNe),iT[e]=H);const V=[...D],q=new Map(S.current);H(e,V,q,b,l)}},[e,b,l]),Fl(()=>{});const k=Mr(D=>{const{onLayout:H}=E.current,{layout:V,panelDataArray:q}=C.current;if(D.constraints.collapsible){const U=q.map(ee=>ee.constraints),{collapsedSize:Y=0,panelSize:K,pivotIndices:Z}=Za(q,D,V);if(it(K!=null,`Panel size not found for panel "${D.id}"`),!ss(K,Y)){S.current.set(D.id,K);const Q=Uc(q,D)===q.length-1?K-Y:Y-K,ie=yf({delta:Q,initialLayout:V,panelConstraints:U,pivotIndices:Z,prevLayout:V,trigger:"imperative-api"});mg(V,ie)||(y(ie),C.current.layout=ie,H&&H(ie),zc(q,ie,x.current))}}},[]),N=Mr((D,H)=>{const{onLayout:V}=E.current,{layout:q,panelDataArray:U}=C.current;if(D.constraints.collapsible){const Y=U.map(te=>te.constraints),{collapsedSize:K=0,panelSize:Z=0,minSize:ee=0,pivotIndices:Q}=Za(U,D,q),ie=H??ee;if(ss(Z,K)){const te=S.current.get(D.id),le=te!=null&&te>=ie?te:ie,Re=Uc(U,D)===U.length-1?Z-le:le-Z,be=yf({delta:Re,initialLayout:q,panelConstraints:Y,pivotIndices:Q,prevLayout:q,trigger:"imperative-api"});mg(q,be)||(y(be),C.current.layout=be,V&&V(be),zc(U,be,x.current))}}},[]),M=Mr(D=>{const{layout:H,panelDataArray:V}=C.current,{panelSize:q}=Za(V,D,H);return it(q!=null,`Panel size not found for panel "${D.id}"`),q},[]),A=Mr((D,H)=>{const{panelDataArray:V}=C.current,q=Uc(V,D);return aNe({defaultSize:H,dragState:g,layout:b,panelData:V,panelIndex:q})},[g,b]),P=Mr(D=>{const{layout:H,panelDataArray:V}=C.current,{collapsedSize:q=0,collapsible:U,panelSize:Y}=Za(V,D,H);return it(Y!=null,`Panel size not found for panel "${D.id}"`),U===!0&&ss(Y,q)},[]),j=Mr(D=>{const{layout:H,panelDataArray:V}=C.current,{collapsedSize:q=0,collapsible:U,panelSize:Y}=Za(V,D,H);return it(Y!=null,`Panel size not found for panel "${D.id}"`),!U||nc(Y,q)>0},[]),F=Mr(D=>{const{panelDataArray:H}=C.current;H.push(D),H.sort((V,q)=>{const U=V.order,Y=q.order;return U==null&&Y==null?0:U==null?-1:Y==null?1:U-Y}),C.current.panelDataArrayChanged=!0,v()},[v]);Ll(()=>{if(C.current.panelDataArrayChanged){C.current.panelDataArrayChanged=!1;const{autoSaveId:D,onLayout:H,storage:V}=E.current,{layout:q,panelDataArray:U}=C.current;let Y=null;if(D){const Z=cNe(D,U,V);Z&&(S.current=new Map(Object.entries(Z.expandToSizes)),Y=Z.layout)}Y==null&&(Y=sNe({panelDataArray:U}));const K=oT({layout:Y,panelConstraints:U.map(Z=>Z.constraints)});nT(q,K)||(y(K),C.current.layout=K,H&&H(K),zc(U,K,x.current))}}),Ll(()=>{const D=C.current;return()=>{D.layout=[]}},[]);const I=Mr(D=>{let H=!1;const V=p.current;return V&&window.getComputedStyle(V,null).getPropertyValue("direction")==="rtl"&&(H=!0),function(U){U.preventDefault();const Y=p.current;if(!Y)return()=>null;const{direction:K,dragState:Z,id:ee,keyboardResizeBy:Q,onLayout:ie}=E.current,{layout:te,panelDataArray:le}=C.current,{initialLayout:ue}=Z??{},Re=LV(ee,D,Y);let be=iNe(U,D,K,Z,Q,Y);const we=K==="horizontal";we&&H&&(be=-be);const Pe=le.map(me=>me.constraints),Ye=yf({delta:be,initialLayout:ue??te,panelConstraints:Pe,pivotIndices:Re,prevLayout:te,trigger:MV(U)?"keyboard":"mouse-or-touch"}),_t=!mg(te,Ye);(PV(U)||DV(U))&&_.current!=be&&(_.current=be,!_t&&be!==0?we?Ow(D,be<0?IV:TV):Ow(D,be<0?jV:OV):Ow(D,0)),_t&&(y(Ye),C.current.layout=Ye,ie&&ie(Ye),zc(le,Ye,x.current))}},[]),O=Mr((D,H)=>{const{onLayout:V}=E.current,{layout:q,panelDataArray:U}=C.current,Y=U.map(te=>te.constraints),{panelSize:K,pivotIndices:Z}=Za(U,D,q);it(K!=null,`Panel size not found for panel "${D.id}"`);const Q=Uc(U,D)===U.length-1?K-H:H-K,ie=yf({delta:Q,initialLayout:q,panelConstraints:Y,pivotIndices:Z,prevLayout:q,trigger:"imperative-api"});mg(q,ie)||(y(ie),C.current.layout=ie,V&&V(ie),zc(U,ie,x.current))},[]),$=Mr((D,H)=>{const{layout:V,panelDataArray:q}=C.current,{collapsedSize:U=0,collapsible:Y}=H,{collapsedSize:K=0,collapsible:Z,maxSize:ee=100,minSize:Q=0}=D.constraints,{panelSize:ie}=Za(q,D,V);ie!=null&&(Y&&Z&&ss(ie,U)?ss(U,K)||O(D,K):ie<Q?O(D,Q):ie>ee&&O(D,ee))},[O]),B=Mr((D,H)=>{const{direction:V}=E.current,{layout:q}=C.current;if(!p.current)return;const U=hv(D,p.current);it(U,`Drag handle element not found for id "${D}"`);const Y=zV(V,H);m({dragHandleId:D,dragHandleRect:U.getBoundingClientRect(),initialCursorPosition:Y,initialLayout:q})},[]),z=Mr(()=>{m(null)},[]),T=Mr(D=>{const{panelDataArray:H}=C.current,V=Uc(H,D);V>=0&&(H.splice(V,1),delete x.current[D.id],C.current.panelDataArrayChanged=!0,v())},[v]),W=$ke(()=>({collapsePanel:k,direction:r,dragState:g,expandPanel:N,getPanelSize:M,getPanelStyle:A,groupId:h,isPanelCollapsed:P,isPanelExpanded:j,reevaluatePanelConstraints:$,registerPanel:F,registerResizeHandle:I,resizePanel:O,startDragging:B,stopDragging:z,unregisterPanel:T,panelGroupElement:p.current}),[k,g,r,N,M,A,h,P,j,$,F,I,O,B,z,T]),L={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return nd(uv.Provider,{value:W},nd(u,{...d,children:t,className:n,id:i,ref:p,style:{...L,...c},"data-panel-group":"","data-panel-group-direction":r,"data-panel-group-id":h}))}const UV=EV((e,t)=>nd(WV,{...e,forwardedRef:t}));WV.displayName="PanelGroup";UV.displayName="forwardRef(PanelGroup)";function Uc(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function Za(e,t,n){const r=Uc(e,t),i=r===e.length-1?[r-1,r]:[r,r+1],s=n[r];return{...t.constraints,panelSize:s,pivotIndices:i}}function fNe({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:r}){Fl(()=>{if(e||n==null||r==null)return;const o=hv(t,r);if(o==null)return;const i=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=o.getAttribute("data-panel-group-id");it(a,`No group element found for id "${a}"`);const l=jh(a,r),c=FV(a,t,r);it(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 o.addEventListener("keydown",i),()=>{o.removeEventListener("keydown",i)}},[r,e,t,n])}function wk({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:r,id:o,onBlur:i,onDragging:s,onFocus:a,style:l={},tabIndex:c=0,tagName:u="div",...d}){var h,p;const g=Tr(null),m=Tr({onDragging:s});Fl(()=>{m.current.onDragging=s});const b=_V(uv);if(b===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:y,groupId:v,registerResizeHandle:x,startDragging:S,stopDragging:_,panelGroupElement:E}=b,C=bk(o),[k,N]=du("inactive"),[M,A]=du(!1),[P,j]=du(null),F=Tr({state:k});Ll(()=>{F.current.state=k}),Fl(()=>{if(n)j(null);else{const B=x(C);j(()=>B)}},[n,C,x]);const I=(h=r==null?void 0:r.coarse)!==null&&h!==void 0?h:15,O=(p=r==null?void 0:r.fine)!==null&&p!==void 0?p:5;return Fl(()=>{if(n||P==null)return;const B=g.current;return it(B,"Element ref not attached"),Zke(C,B,y,{coarse:I,fine:O},(T,W,L)=>{if(W)switch(T){case"down":{N("drag"),it(L,'Expected event to be defined for "down" action'),S(C,L);const{onDragging:D}=m.current;D&&D(!0);break}case"move":{const{state:D}=F.current;D!=="drag"&&N("hover"),it(L,'Expected event to be defined for "move" action'),P(L);break}case"up":{N("hover"),_();const{onDragging:D}=m.current;D&&D(!1);break}}else N("inactive")})},[I,y,n,O,x,C,P,S,_]),fNe({disabled:n,handleId:C,resizeHandler:P,panelGroupElement:E}),nd(u,{...d,children:e,className:t,id:o,onBlur:()=>{A(!1),i==null||i()},onFocus:()=>{A(!0),a==null||a()},ref:g,role:"separator",style:{...{touchAction:"none",userSelect:"none"},...l},tabIndex:c,"data-panel-group-direction":y,"data-panel-group-id":v,"data-resize-handle":"","data-resize-handle-active":k==="drag"?"pointer":M?"keyboard":void 0,"data-resize-handle-state":k,"data-panel-resize-handle-enabled":!n,"data-panel-resize-handle-id":C})}wk.displayName="PanelResizeHandle";const GV=({className:e,...t})=>f.jsx(UV,{className:re("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t}),OS=NV,hNe=({withHandle:e,className:t,...n})=>f.jsx(wk,{className:re("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&&f.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:f.jsx(uF,{className:"h-2.5 w-2.5"})})}),pNe=({withHandle:e,className:t,onTabClick:n,open:r,...o})=>f.jsx(wk,{className:re("relative flex w-px items-start justify-end bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",{"justify-start":r},t),...o,children:e&&!r&&f.jsx("div",{className:re("z-50 flex items-center justify-start",{"border-l":r}),children:f.jsx(Ee,{variant:"secondary",className:re("h-7 p-2",{"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?f.jsx(pJ,{className:"size-4"}):f.jsx(mJ,{className:"size-4"})})})});var qV=w.forwardRef((e,t)=>{const{children:n,...r}=e,o=w.Children.toArray(n),i=o.find(mNe);if(i){const s=i.props.children,a=o.map(l=>l===i?w.Children.count(s)>1?w.Children.only(null):w.isValidElement(s)?s.props.children:null:l);return f.jsx(FS,{...r,ref:t,children:w.isValidElement(s)?w.cloneElement(s,void 0,a):null})}return f.jsx(FS,{...r,ref:t,children:n})});qV.displayName="Slot";var FS=w.forwardRef((e,t)=>{const{children:n,...r}=e;if(w.isValidElement(n)){const o=bNe(n),i=gNe(r,n.props);return n.type!==w.Fragment&&(i.ref=t?vr(t,o):o),w.cloneElement(n,i)}return w.Children.count(n)>1?w.Children.only(null):null});FS.displayName="SlotClone";var YV=({children:e})=>f.jsx(f.Fragment,{children:e});function mNe(e){return w.isValidElement(e)&&e.type===YV}function gNe(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function bNe(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Ck="Dialog",[KV,XV]=Pn(Ck),[yNe,ni]=KV(Ck),QV=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!0}=e,a=w.useRef(null),l=w.useRef(null),[c=!1,u]=or({prop:r,defaultProp:o,onChange:i});return f.jsx(yNe,{scope:t,triggerRef:a,contentRef:l,contentId:_n(),titleId:_n(),descriptionId:_n(),open:c,onOpenChange:u,onOpenToggle:w.useCallback(()=>u(d=>!d),[u]),modal:s,children:n})};QV.displayName=Ck;var ZV="DialogTrigger",JV=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ni(ZV,n),i=Ve(t,o.triggerRef);return f.jsx(_e.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":_k(o.open),...r,ref:i,onClick:fe(e.onClick,o.onOpenToggle)})});JV.displayName=ZV;var Sk="DialogPortal",[vNe,eH]=KV(Sk,{forceMount:void 0}),tH=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,i=ni(Sk,t);return f.jsx(vNe,{scope:t,forceMount:n,children:w.Children.map(r,s=>f.jsx(fn,{present:n||i.open,children:f.jsx(mc,{asChild:!0,container:o,children:s})}))})};tH.displayName=Sk;var g0="DialogOverlay",nH=w.forwardRef((e,t)=>{const n=eH(g0,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=ni(g0,e.__scopeDialog);return i.modal?f.jsx(fn,{present:r||i.open,children:f.jsx(xNe,{...o,ref:t})}):null});nH.displayName=g0;var xNe=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ni(g0,n);return f.jsx(hc,{as:qV,allowPinchZoom:!0,shards:[o.contentRef],children:f.jsx(_e.div,{"data-state":_k(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),rc="DialogContent",rH=w.forwardRef((e,t)=>{const n=eH(rc,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=ni(rc,e.__scopeDialog);return f.jsx(fn,{present:r||i.open,children:i.modal?f.jsx(wNe,{...o,ref:t}):f.jsx(CNe,{...o,ref:t})})});rH.displayName=rc;var wNe=w.forwardRef((e,t)=>{const n=ni(rc,e.__scopeDialog),r=w.useRef(null),o=Ve(t,n.contentRef,r);return w.useEffect(()=>{const i=r.current;if(i)return cd(i)},[]),f.jsx(oH,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:fe(e.onCloseAutoFocus,i=>{var s;i.preventDefault(),(s=n.triggerRef.current)==null||s.focus()}),onPointerDownOutside:fe(e.onPointerDownOutside,i=>{const s=i.detail.originalEvent,a=s.button===0&&s.ctrlKey===!0;(s.button===2||a)&&i.preventDefault()}),onFocusOutside:fe(e.onFocusOutside,i=>i.preventDefault())})}),CNe=w.forwardRef((e,t)=>{const n=ni(rc,e.__scopeDialog),r=w.useRef(!1),o=w.useRef(!1);return f.jsx(oH,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s,a;(s=e.onCloseAutoFocus)==null||s.call(e,i),i.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:i=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=i.target;((c=n.triggerRef.current)==null?void 0:c.contains(s))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),oH=w.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,...s}=e,a=ni(rc,n),l=w.useRef(null),c=Ve(t,l);return cy(),f.jsxs(f.Fragment,{children:[f.jsx(xp,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:f.jsx(pc,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":_k(a.open),...s,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),f.jsxs(f.Fragment,{children:[f.jsx(ENe,{titleId:a.titleId}),f.jsx(RNe,{contentRef:l,descriptionId:a.descriptionId})]})]})}),Ek="DialogTitle",iH=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ni(Ek,n);return f.jsx(_e.h2,{id:o.titleId,...r,ref:t})});iH.displayName=Ek;var sH="DialogDescription",aH=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ni(sH,n);return f.jsx(_e.p,{id:o.descriptionId,...r,ref:t})});aH.displayName=sH;var lH="DialogClose",cH=w.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ni(lH,n);return f.jsx(_e.button,{type:"button",...r,ref:t,onClick:fe(e.onClick,()=>o.onOpenChange(!1))})});cH.displayName=lH;function _k(e){return e?"open":"closed"}var uH="DialogTitleWarning",[SNe,dH]=_K(uH,{contentName:rc,titleName:Ek,docsSlug:"dialog"}),ENe=({titleId:e})=>{const t=dH(uH),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
561
561
|
|
|
562
562
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
563
563
|
|