@meyicloud/meyi-cost-ui 1.7.2 → 1.7.3

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/index.js CHANGED
@@ -1,29 +1,29 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react"),Zo=require("react-dom");function Qo(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const S=Qo(P),ea=Qo(Zo);var fn={exports:{}},zt={};var ws;function fc(){if(ws)return zt;ws=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,s,o){var i=null;if(o!==void 0&&(i=""+o),s.key!==void 0&&(i=""+s.key),"key"in s){o={};for(var c in s)c!=="key"&&(o[c]=s[c])}else o=s;return s=o.ref,{$$typeof:e,type:r,key:i,ref:s!==void 0?s:null,props:o}}return zt.Fragment=t,zt.jsx=n,zt.jsxs=n,zt}var Wt={};var Ss;function hc(){return Ss||(Ss=1,process.env.NODE_ENV!=="production"&&(function(){function e(E){if(E==null)return null;if(typeof E=="function")return E.$$typeof===A?null:E.displayName||E.name||null;if(typeof E=="string")return E;switch(E){case x:return"Fragment";case y:return"Profiler";case b:return"StrictMode";case k:return"Suspense";case C:return"SuspenseList";case L:return"Activity"}if(typeof E=="object")switch(typeof E.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),E.$$typeof){case p:return"Portal";case N:return E.displayName||"Context";case v:return(E._context.displayName||"Context")+".Consumer";case j:var B=E.render;return E=E.displayName,E||(E=B.displayName||B.name||"",E=E!==""?"ForwardRef("+E+")":"ForwardRef"),E;case R:return B=E.displayName||null,B!==null?B:e(E.type)||"Memo";case _:B=E._payload,E=E._init;try{return e(E(B))}catch{}}return null}function t(E){return""+E}function n(E){try{t(E);var B=!1}catch{B=!0}if(B){B=console;var q=B.error,K=typeof Symbol=="function"&&Symbol.toStringTag&&E[Symbol.toStringTag]||E.constructor.name||"Object";return q.call(B,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",K),t(E)}}function r(E){if(E===x)return"<>";if(typeof E=="object"&&E!==null&&E.$$typeof===_)return"<...>";try{var B=e(E);return B?"<"+B+">":"<...>"}catch{return"<...>"}}function s(){var E=D.A;return E===null?null:E.getOwner()}function o(){return Error("react-stack-top-frame")}function i(E){if(O.call(E,"key")){var B=Object.getOwnPropertyDescriptor(E,"key").get;if(B&&B.isReactWarning)return!1}return E.key!==void 0}function c(E,B){function q(){Y||(Y=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",B))}q.isReactWarning=!0,Object.defineProperty(E,"key",{get:q,configurable:!0})}function u(){var E=e(this.type);return Q[E]||(Q[E]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),E=this.props.ref,E!==void 0?E:null}function d(E,B,q,K,H,z){var U=q.ref;return E={$$typeof:g,type:E,key:B,props:q,_owner:K},(U!==void 0?U:null)!==null?Object.defineProperty(E,"ref",{enumerable:!1,get:u}):Object.defineProperty(E,"ref",{enumerable:!1,value:null}),E._store={},Object.defineProperty(E._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(E,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(E,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:H}),Object.defineProperty(E,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:z}),Object.freeze&&(Object.freeze(E.props),Object.freeze(E)),E}function f(E,B,q,K,H,z){var U=B.children;if(U!==void 0)if(K)if($(U)){for(K=0;K<U.length;K++)l(U[K]);Object.freeze&&Object.freeze(U)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else l(U);if(O.call(B,"key")){U=e(E);var Z=Object.keys(B).filter(function(ie){return ie!=="key"});K=0<Z.length?"{key: someKey, "+Z.join(": ..., ")+": ...}":"{key: someKey}",I[U+K]||(Z=0<Z.length?"{"+Z.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react"),Zo=require("react-dom");function Qo(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const S=Qo(P),ea=Qo(Zo);var fn={exports:{}},Bt={};var ws;function fc(){if(ws)return Bt;ws=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,s,o){var i=null;if(o!==void 0&&(i=""+o),s.key!==void 0&&(i=""+s.key),"key"in s){o={};for(var c in s)c!=="key"&&(o[c]=s[c])}else o=s;return s=o.ref,{$$typeof:e,type:r,key:i,ref:s!==void 0?s:null,props:o}}return Bt.Fragment=t,Bt.jsx=n,Bt.jsxs=n,Bt}var zt={};var Ss;function hc(){return Ss||(Ss=1,process.env.NODE_ENV!=="production"&&(function(){function e(E){if(E==null)return null;if(typeof E=="function")return E.$$typeof===A?null:E.displayName||E.name||null;if(typeof E=="string")return E;switch(E){case x:return"Fragment";case y:return"Profiler";case b:return"StrictMode";case k:return"Suspense";case C:return"SuspenseList";case L:return"Activity"}if(typeof E=="object")switch(typeof E.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),E.$$typeof){case p:return"Portal";case N:return E.displayName||"Context";case v:return(E._context.displayName||"Context")+".Consumer";case j:var B=E.render;return E=E.displayName,E||(E=B.displayName||B.name||"",E=E!==""?"ForwardRef("+E+")":"ForwardRef"),E;case R:return B=E.displayName||null,B!==null?B:e(E.type)||"Memo";case _:B=E._payload,E=E._init;try{return e(E(B))}catch{}}return null}function t(E){return""+E}function n(E){try{t(E);var B=!1}catch{B=!0}if(B){B=console;var q=B.error,K=typeof Symbol=="function"&&Symbol.toStringTag&&E[Symbol.toStringTag]||E.constructor.name||"Object";return q.call(B,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",K),t(E)}}function r(E){if(E===x)return"<>";if(typeof E=="object"&&E!==null&&E.$$typeof===_)return"<...>";try{var B=e(E);return B?"<"+B+">":"<...>"}catch{return"<...>"}}function s(){var E=D.A;return E===null?null:E.getOwner()}function o(){return Error("react-stack-top-frame")}function i(E){if(O.call(E,"key")){var B=Object.getOwnPropertyDescriptor(E,"key").get;if(B&&B.isReactWarning)return!1}return E.key!==void 0}function c(E,B){function q(){Y||(Y=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",B))}q.isReactWarning=!0,Object.defineProperty(E,"key",{get:q,configurable:!0})}function u(){var E=e(this.type);return Q[E]||(Q[E]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),E=this.props.ref,E!==void 0?E:null}function d(E,B,q,K,H,z){var U=q.ref;return E={$$typeof:g,type:E,key:B,props:q,_owner:K},(U!==void 0?U:null)!==null?Object.defineProperty(E,"ref",{enumerable:!1,get:u}):Object.defineProperty(E,"ref",{enumerable:!1,value:null}),E._store={},Object.defineProperty(E._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(E,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(E,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:H}),Object.defineProperty(E,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:z}),Object.freeze&&(Object.freeze(E.props),Object.freeze(E)),E}function f(E,B,q,K,H,z){var U=B.children;if(U!==void 0)if(K)if($(U)){for(K=0;K<U.length;K++)l(U[K]);Object.freeze&&Object.freeze(U)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else l(U);if(O.call(B,"key")){U=e(E);var Z=Object.keys(B).filter(function(ie){return ie!=="key"});K=0<Z.length?"{key: someKey, "+Z.join(": ..., ")+": ...}":"{key: someKey}",I[U+K]||(Z=0<Z.length?"{"+Z.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
2
  let props = %s;
3
3
  <%s {...props} />
4
4
  React keys must be passed directly to JSX without using spread:
5
5
  let props = %s;
6
- <%s key={someKey} {...props} />`,K,U,Z,U),I[U+K]=!0)}if(U=null,q!==void 0&&(n(q),U=""+q),i(B)&&(n(B.key),U=""+B.key),"key"in B){q={};for(var V in B)V!=="key"&&(q[V]=B[V])}else q=B;return U&&c(q,typeof E=="function"?E.displayName||E.name||"Unknown":E),d(E,U,q,s(),H,z)}function l(E){h(E)?E._store&&(E._store.validated=1):typeof E=="object"&&E!==null&&E.$$typeof===_&&(E._payload.status==="fulfilled"?h(E._payload.value)&&E._payload.value._store&&(E._payload.value._store.validated=1):E._store&&(E._store.validated=1))}function h(E){return typeof E=="object"&&E!==null&&E.$$typeof===g}var m=P,g=Symbol.for("react.transitional.element"),p=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),y=Symbol.for("react.profiler"),v=Symbol.for("react.consumer"),N=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),L=Symbol.for("react.activity"),A=Symbol.for("react.client.reference"),D=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O=Object.prototype.hasOwnProperty,$=Array.isArray,J=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(E){return E()}};var Y,Q={},he=m.react_stack_bottom_frame.bind(m,o)(),me=J(r(o)),I={};Wt.Fragment=x,Wt.jsx=function(E,B,q){var K=1e4>D.recentlyCreatedOwnerStacks++;return f(E,B,q,!1,K?Error("react-stack-top-frame"):he,K?J(r(E)):me)},Wt.jsxs=function(E,B,q){var K=1e4>D.recentlyCreatedOwnerStacks++;return f(E,B,q,!0,K?Error("react-stack-top-frame"):he,K?J(r(E)):me)}})()),Wt}var Rs;function mc(){return Rs||(Rs=1,process.env.NODE_ENV==="production"?fn.exports=fc():fn.exports=hc()),fn.exports}var a=mc(),Zt=typeof window<"u"?S.useLayoutEffect:S.useEffect;function dr(e){const t=S.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function pc(e,t,n={},r={}){S.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!="function")return;const s=new IntersectionObserver(([o])=>{t(o)},n);return s.observe(e.current),()=>{s.disconnect()}},[t,n,r.disabled,e])}function gc(e){const t=S.useRef(null);return S.useImperativeHandle(e,()=>t.current,[]),t}const ta=!1;function Qt(e){return e[e.length-1]}function xc(e){return typeof e=="function"}function st(e,t){return xc(e)?e(t):e}const na=Object.prototype.hasOwnProperty,Ns=Object.prototype.propertyIsEnumerable;function ra(e){for(const t in e)if(na.call(e,t))return!0;return!1}const bc=()=>Object.create(null),tt=(e,t)=>ot(e,t,bc);function ot(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;const s=t,o=Es(e)&&Es(s);if(!o&&!($n(e)&&$n(s)))return s;const i=o?e:Cs(e);if(!i)return s;const c=o?s:Cs(s);if(!c)return s;const u=i.length,d=c.length,f=o?new Array(d):n();let l=0;for(let h=0;h<d;h++){const m=o?h:c[h],g=e[m],p=s[m];if(g===p){f[m]=g,(o?h<u:na.call(e,m))&&l++;continue}if(g===null||p===null||typeof g!="object"||typeof p!="object"){f[m]=p;continue}const x=ot(g,p,n,r+1);f[m]=x,x===g&&l++}return u===d&&l===u?e:f}function Cs(e){const t=Object.getOwnPropertyNames(e);for(const s of t)if(!Ns.call(e,s))return!1;const n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;const r=t;for(const s of n){if(!Ns.call(e,s))return!1;r.push(s)}return r}function $n(e){if(!js(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const n=t.prototype;return!(!js(n)||!n.hasOwnProperty("isPrototypeOf"))}function js(e){return Object.prototype.toString.call(e)==="[object Object]"}function Es(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function lt(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,s=e.length;r<s;r++)if(!lt(e[r],t[r],n))return!1;return!0}if($n(e)&&$n(t)){const r=n?.ignoreUndefined??!0;if(n?.partial){for(const i in t)if((!r||t[i]!==void 0)&&!lt(e[i],t[i],n))return!1;return!0}let s=0;if(!r)s=Object.keys(e).length;else for(const i in e)e[i]!==void 0&&s++;let o=0;for(const i in t)if((!r||t[i]!==void 0)&&(o++,o>s||!lt(e[i],t[i],n)))return!1;return s===o}return!1}function At(e){let t,n;const r=new Promise((s,o)=>{t=s,n=o});return r.status="pending",r.resolve=s=>{r.status="resolved",r.value=s,t(s),e?.(s)},r.reject=s=>{r.status="rejected",n(s)},r}function en(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}function ks(e,t){for(let n=e.length-1;n>=0;n--){const r=e[n];if(t(r))return r}}const yc=/[\x00-\x1f\x7f"<>`{}]/g;function vc(e){return e.replace(yc,t=>"%"+t.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0"))}function _s(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,n=>{try{return decodeURI(n)}catch{return n}})}return vc(t)}const wc=["http:","https:","mailto:","tel:"];function Bn(e,t){if(!e)return!1;try{const n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function Vt(e){if(!e)return{path:e,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith("//"))return{path:e,handledProtocolRelativeURL:!1};const t=/%25|%5C/gi;let n=0,r="",s;for(;(s=t.exec(e))!==null;)r+=_s(e.slice(n,s.index))+s[0],n=t.lastIndex;r=r+_s(n?e.slice(n):e);let o=!1;return r.startsWith("//")&&(o=!0,r="/"+r.replace(/^\/+/,"")),{path:r,handledProtocolRelativeURL:o}}function Sc(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Rc(e,t){if(e===t)return!0;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 Be(){throw new Error("Invariant failed")}function tn(e){const t=new Map;let n,r;const s=o=>{o.next&&(o.prev?(o.prev.next=o.next,o.next.prev=o.prev,o.next=void 0,r&&(r.next=o,o.prev=r)):(o.next.prev=void 0,n=o.next,o.next=void 0,r&&(o.prev=r,r.next=o)),r=o)};return{get(o){const i=t.get(o);if(i)return s(i),i.value},set(o,i){if(t.size>=e&&n){const u=n;t.delete(u.key),u.next&&(n=u.next,u.next.prev=void 0),u===r&&(r=void 0)}const c=t.get(o);if(c)c.value=i,s(c);else{const u={key:o,value:i,prev:r};r&&(r.next=u),r=u,n||(n=u),t.set(o,u)}},clear(){t.clear(),n=void 0,r=void 0}}}const Ke=4,sa=5;function Nc(e){const t=e.indexOf("{");if(t===-1)return null;const n=e.indexOf("}",t);return n===-1||t+1>=e.length?null:[t,n]}function oa(e,t,n=new Uint16Array(6)){const r=e.indexOf("/",t),s=r===-1?e.length:r,o=e.substring(t,s);if(!o||!o.includes("$"))return n[0]=0,n[1]=t,n[2]=t,n[3]=s,n[4]=s,n[5]=s,n;if(o==="$"){const c=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=c,n[4]=c,n[5]=c,n}if(o.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=s,n[4]=s,n[5]=s,n;const i=Nc(o);if(i){const[c,u]=i,d=o.charCodeAt(c+1);if(d===45){if(c+2<o.length&&o.charCodeAt(c+2)===36){const f=c+3,l=u;if(f<l)return n[0]=3,n[1]=t+c,n[2]=t+f,n[3]=t+l,n[4]=t+u+1,n[5]=s,n}}else if(d===36){const f=c+1,l=c+2;return l===u?(n[0]=2,n[1]=t+c,n[2]=t+f,n[3]=t+l,n[4]=t+u+1,n[5]=e.length,n):(n[0]=1,n[1]=t+c,n[2]=t+l,n[3]=t+u,n[4]=t+u+1,n[5]=s,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=s,n[4]=s,n[5]=s,n}function er(e,t,n,r,s,o,i){i?.(n);let c=r;{const u=n.fullPath??n.from,d=u.length,f=n.options?.caseSensitive??e,l=n.options?.params?.parse??n.options?.parseParams;for(;c<d;){const m=oa(u,c,t);let g;const p=c,x=m[5];switch(c=x+1,o++,m[0]){case 0:{const b=u.substring(m[2],m[3]);if(f){const y=s.static?.get(b);if(y)g=y;else{s.static??=new Map;const v=at(n.fullPath??n.from);v.parent=s,v.depth=o,g=v,s.static.set(b,v)}}else{const y=b.toLowerCase(),v=s.staticInsensitive?.get(y);if(v)g=v;else{s.staticInsensitive??=new Map;const N=at(n.fullPath??n.from);N.parent=s,N.depth=o,g=N,s.staticInsensitive.set(y,N)}}break}case 1:{const b=u.substring(p,m[1]),y=u.substring(m[4],x),v=f&&!!(b||y),N=b?v?b:b.toLowerCase():void 0,j=y?v?y:y.toLowerCase():void 0,k=!l&&s.dynamic?.find(C=>!C.parse&&C.caseSensitive===v&&C.prefix===N&&C.suffix===j);if(k)g=k;else{const C=hr(1,n.fullPath??n.from,v,N,j);g=C,C.depth=o,C.parent=s,s.dynamic??=[],s.dynamic.push(C)}break}case 3:{const b=u.substring(p,m[1]),y=u.substring(m[4],x),v=f&&!!(b||y),N=b?v?b:b.toLowerCase():void 0,j=y?v?y:y.toLowerCase():void 0,k=!l&&s.optional?.find(C=>!C.parse&&C.caseSensitive===v&&C.prefix===N&&C.suffix===j);if(k)g=k;else{const C=hr(3,n.fullPath??n.from,v,N,j);g=C,C.parent=s,C.depth=o,s.optional??=[],s.optional.push(C)}break}case 2:{const b=u.substring(p,m[1]),y=u.substring(m[4],x),v=f&&!!(b||y),N=b?v?b:b.toLowerCase():void 0,j=y?v?y:y.toLowerCase():void 0,k=hr(2,n.fullPath??n.from,v,N,j);g=k,k.parent=s,k.depth=o,s.wildcard??=[],s.wildcard.push(k)}}s=g}if(l&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf("/")+1)===95){const m=at(n.fullPath??n.from);m.kind=sa,m.parent=s,o++,m.depth=o,s.pathless??=[],s.pathless.push(m),s=m}const h=(n.path||!n.children)&&!n.isRoot;if(h&&u.endsWith("/")){const m=at(n.fullPath??n.from);m.kind=Ke,m.parent=s,o++,m.depth=o,s.index=m,s=m}s.parse=l??null,s.priority=n.options?.params?.priority??0,h&&!s.route&&(s.route=n,s.fullPath=n.fullPath??n.from)}if(n.children)for(const u of n.children)er(e,t,u,c,s,o,i)}function fr(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function Ge(e){if(e.pathless)for(const t of e.pathless)Ge(t);if(e.static)for(const t of e.static.values())Ge(t);if(e.staticInsensitive)for(const t of e.staticInsensitive.values())Ge(t);if(e.dynamic?.length){e.dynamic.sort(fr);for(const t of e.dynamic)Ge(t)}if(e.optional?.length){e.optional.sort(fr);for(const t of e.optional)Ge(t)}if(e.wildcard?.length){e.wildcard.sort(fr);for(const t of e.wildcard)Ge(t)}}function at(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function hr(e,t,n,r,s){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:s}}function Cc(e,t){const n=at("/"),r=new Uint16Array(6);for(const s of e)er(!1,r,s,1,n,0);Ge(n),t.masksTree=n,t.flatCache=tn(1e3)}function jc(e,t){e||="/";const n=t.flatCache.get(e);if(n)return n;const r=es(e,t.masksTree);return t.flatCache.set(e,r),r}function Ec(e,t,n,r,s){e||="/",r||="/";const o=t?`case\0${e}`:e;let i=s.singleCache.get(o);return i||(i=at("/"),er(t,new Uint16Array(6),{from:e},1,i,0),s.singleCache.set(o,i)),es(r,i,n)}function kc(e,t,n=!1){const r=n?e:`nofuzz\0${e}`,s=t.matchCache.get(r);if(s!==void 0)return s;e||="/";let o;try{o=es(e,t.segmentTree,n)}catch(i){if(i instanceof URIError)o=null;else throw i}return o&&(o.branch=ia(o.route)),t.matchCache.set(r,o),o}function _c(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function Pc(e,t=!1,n){const r=at(e.fullPath),s=new Uint16Array(6),o={},i={};let c=0;return er(t,s,e,1,r,0,u=>{if(n?.(u,c),u.id in o){if(process.env.NODE_ENV!=="production")throw new Error(`Invariant failed: Duplicate routes found with id: ${String(u.id)}`);Be()}if(o[u.id]=u,c!==0&&u.path){const d=_c(u.fullPath);(!i[d]||u.fullPath.endsWith("/"))&&(i[d]=u)}c++}),Ge(r),{processedTree:{segmentTree:r,singleCache:tn(1e3),matchCache:tn(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:i}}function es(e,t,n=!1){const r=e.split("/"),s=Oc(e,r,t,n);if(!s)return null;const[o]=aa(e,r,s);return{route:s.node.route,rawParams:o}}function aa(e,t,n){const r=Ac(n.node);let s=null;const o=Object.create(null);let i=n.extract?.part??0,c=n.extract?.node??0,u=n.extract?.path??0,d=n.extract?.segment??0;for(;c<r.length;i++,c++,u++,d++){const f=r[c];if(f.kind===Ke)break;if(f.kind===sa){d--,i--,u--;continue}const l=t[i],h=u;if(l&&(u+=l.length),f.kind===1){s??=n.node.fullPath.split("/");const m=s[d],g=f.prefix?.length??0;if(m.charCodeAt(g)===123){const p=f.suffix?.length??0,x=m.substring(g+2,m.length-p-1),b=l.substring(g,l.length-p);o[x]=decodeURIComponent(b)}else{const p=m.substring(1);o[p]=decodeURIComponent(l)}}else if(f.kind===3){if(n.skipped&1<<c){i--,u=h-1;continue}s??=n.node.fullPath.split("/");const m=s[d],g=f.prefix?.length??0,p=f.suffix?.length??0,x=m.substring(g+3,m.length-p-1),b=f.suffix||f.prefix?l.substring(g,l.length-p):l;b&&(o[x]=decodeURIComponent(b))}else if(f.kind===2){const m=f,g=e.substring(h+(m.prefix?.length??0),e.length-(m.suffix?.length??0)),p=decodeURIComponent(g);o["*"]=p,o._splat=p;break}}return n.rawParams&&Object.assign(o,n.rawParams),[o,{part:i,node:c,path:u,segment:d}]}function ia(e){const t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function Ac(e){const t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function Oc(e,t,n,r){if(e==="/"&&n.index)return{node:n.index,skipped:0};const s=!Qt(t),o=s&&e!=="/",i=t.length-(s?1:0),c=[{node:n,index:1,skipped:0,depth:1,statics:0,dynamics:0,optionals:0}];let u=null,d=null;for(;c.length;){const f=c.pop(),{node:l,index:h,skipped:m,depth:g,statics:p,dynamics:x,optionals:b}=f;let{extract:y,rawParams:v}=f;if(l.kind===2&&l.route&&!mn(d,f))continue;if(l.parse){if(!Ps(e,t,f))continue;v=f.rawParams,y=f.extract}r&&l.route&&l.kind!==Ke&&mn(u,f)&&(u=f);const N=h===i;if(N&&(l.route&&(!o||l.kind===Ke||l.kind===2)&&mn(d,f)&&(d=f),!l.optional&&!l.wildcard&&!l.index&&!l.pathless))continue;const j=N?void 0:t[h];let k;if(N&&l.index){const C={node:l.index,index:h,skipped:m,depth:g+1,statics:p,dynamics:x,optionals:b,extract:y,rawParams:v};let R=!0;if(l.index.parse&&(Ps(e,t,C)||(R=!1)),R){if(!x&&!b&&!m&&Tc(p,i))return C;mn(d,C)&&(d=C)}}if(l.wildcard)for(let C=l.wildcard.length-1;C>=0;C--){const R=l.wildcard[C],{prefix:_,suffix:L}=R;if(!(_&&(N||!(R.caseSensitive?j:k??=j.toLowerCase()).startsWith(_)))){if(L){if(N)continue;const A=t.slice(h).join("/").slice(-L.length);if((R.caseSensitive?A:A.toLowerCase())!==L)continue}c.push({node:R,index:i,skipped:m,depth:g+1,statics:p,dynamics:x,optionals:b,extract:y,rawParams:v})}}if(l.optional){const C=m|1<<g,R=g+1;for(let _=l.optional.length-1;_>=0;_--){const L=l.optional[_];c.push({node:L,index:h,skipped:C,depth:R,statics:p,dynamics:x,optionals:b,extract:y,rawParams:v})}if(!N)for(let _=l.optional.length-1;_>=0;_--){const L=l.optional[_],{prefix:A,suffix:D}=L;if(A||D){const O=L.caseSensitive?j:k??=j.toLowerCase();if(A&&!O.startsWith(A)||D&&!O.endsWith(D))continue}c.push({node:L,index:h+1,skipped:m,depth:R,statics:p,dynamics:x,optionals:b+hn(i,h),extract:y,rawParams:v})}}if(!N&&l.dynamic&&j)for(let C=l.dynamic.length-1;C>=0;C--){const R=l.dynamic[C],{prefix:_,suffix:L}=R;if(_||L){const A=R.caseSensitive?j:k??=j.toLowerCase();if(_&&!A.startsWith(_)||L&&!A.endsWith(L))continue}c.push({node:R,index:h+1,skipped:m,depth:g+1,statics:p,dynamics:x+hn(i,h),optionals:b,extract:y,rawParams:v})}if(!N&&l.staticInsensitive){const C=l.staticInsensitive.get(k??=j.toLowerCase());C&&c.push({node:C,index:h+1,skipped:m,depth:g+1,statics:p+hn(i,h),dynamics:x,optionals:b,extract:y,rawParams:v})}if(!N&&l.static){const C=l.static.get(j);C&&c.push({node:C,index:h+1,skipped:m,depth:g+1,statics:p+hn(i,h),dynamics:x,optionals:b,extract:y,rawParams:v})}if(l.pathless){const C=g+1;for(let R=l.pathless.length-1;R>=0;R--){const _=l.pathless[R];c.push({node:_,index:h,skipped:m,depth:C,statics:p,dynamics:x,optionals:b,extract:y,rawParams:v})}}}if(d)return d;if(r&&u){let f=u.index;for(let h=0;h<u.index;h++)f+=t[h].length;const l=f===e.length?"/":e.slice(f);return u.rawParams??=Object.create(null),u.rawParams["**"]=decodeURIComponent(l),u}return null}function hn(e,t){return 2**(e-t-1)}function Tc(e,t){return e===2**(t-1)-1}function Ps(e,t,n){let r,s;try{[r,s]=aa(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=s,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function mn(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===Ke)>(e.node.kind===Ke)||t.node.kind===Ke==(e.node.kind===Ke)&&t.depth>e.depth))):!0}function An(e){return ts(e.filter(t=>t!==void 0).join("/"))}function ts(e){return e.replace(/\/{2,}/g,"/")}function ca(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function $e(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/{1,}$/,""):e}function la(e){return $e(ca(e))}function zn(e,t){return e?.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function Lc(e,t,n){return zn(e,n)===zn(t,n)}function Ic({base:e,to:t,trailingSlash:n="never",cache:r}){const s=t.startsWith("/"),o=!s&&t===".";let i;if(r){i=s?t:o?e:e+"\0"+t;const d=r.get(i);if(d)return d}let c;if(o)c=e.split("/");else if(s)c=t.split("/");else{for(c=e.split("/");c.length>1&&Qt(c)==="";)c.pop();const d=t.split("/");for(let f=0,l=d.length;f<l;f++){const h=d[f];h===""?f?f===l-1&&c.push(h):c=[h]:h===".."?c.pop():h==="."||c.push(h)}}c.length>1&&(Qt(c)===""?n==="never"&&c.pop():n==="always"&&c.push(""));const u=ts(c.join("/"))||"/";return i&&r&&r.set(i,u),u}function Mc(e){const t=new Map(e.map(s=>[encodeURIComponent(s),s])),n=Array.from(t.keys()).map(s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),r=new RegExp(n,"g");return s=>s.replace(r,o=>t.get(o)??o)}function mr(e,t,n){const r=t[e];return typeof r!="string"?r:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split("/").map(s=>Os(s,n)).join("/"):Os(r,n)}function As({path:e,params:t,decoder:n,...r}){let s=!1;const o=Object.create(null);if(!e||e==="/")return{interpolatedPath:"/",usedParams:o,isMissingParams:s};if(!e.includes("$"))return{interpolatedPath:e,usedParams:o,isMissingParams:s};const i=e.length;let c=0,u,d="";for(;c<i;){const f=c;u=oa(e,f,u);const l=u[5];if(c=l+1,f===l)continue;const h=u[0];if(h===0){d+="/"+e.substring(f,l);continue}if(h===2){const m=t._splat;o._splat=m,o["*"]=m;const g=e.substring(f,u[1]),p=e.substring(u[4],l);if(!m){s=!0,(g||p)&&(d+="/"+g+p);continue}const x=mr("_splat",t,n);d+="/"+g+x+p;continue}if(h===1){const m=e.substring(u[2],u[3]);!s&&!(m in t)&&(s=!0),o[m]=t[m];const g=e.substring(f,u[1]),p=e.substring(u[4],l),x=mr(m,t,n)??"undefined";d+="/"+g+x+p;continue}if(h===3){const m=e.substring(u[2],u[3]),g=t[m];if(g==null)continue;o[m]=g;const p=e.substring(f,u[1]),x=e.substring(u[4],l),b=mr(m,t,n)??"";d+="/"+p+b+x;continue}}return e.endsWith("/")&&(d+="/"),{usedParams:o,interpolatedPath:d||"/",isMissingParams:s}}function Os(e,t){const n=encodeURIComponent(e);return t?.(n)??n}function xe(e){return e?.isNotFound===!0}function Dc(e,t=String){const n=new URLSearchParams;for(const r in e){const s=e[r];s!==void 0&&n.set(r,t(s))}return n.toString()}function pr(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function Fc(e){const t=new URLSearchParams(e),n=Object.create(null);for(const[r,s]of t.entries()){const o=n[r];o==null?n[r]=pr(s):Array.isArray(o)?o.push(pr(s)):n[r]=[o,pr(s)]}return n}const Uc=Bc(JSON.parse),$c=zc(JSON.stringify,JSON.parse);function Bc(e){return t=>{t[0]==="?"&&(t=t.substring(1));const n=Fc(t);for(const r in n){const s=n[r];if(typeof s=="string")try{n[r]=e(s)}catch{}}return n}}function zc(e,t){const n=typeof t=="function";function r(s){if(typeof s=="object"&&s!==null)try{return e(s)}catch{}else if(n&&typeof s=="string")try{return t(s),e(s)}catch{}return s}return s=>{const o=Dc(s,r);return o?`?${o}`:""}}const ut="__root__";function Wc(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href=="string")try{new URL(e.href),e.reloadDocument=!0}catch{}const t=new Headers(e.headers);e.href&&t.get("Location")===null&&t.set("Location",e.href);const n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function we(e){return e instanceof Response&&!!e.options}const Fr=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},Vc=e=>e.stores.matchesId.get().some(t=>e.stores.matchStores.get(t)?.get()._forcePending),tr=(e,t)=>!!(e.preload&&!e.router.stores.matchStores.has(t)),dt=(e,t,n=!0)=>{const r={...e.router.options.context??{}},s=n?t:t-1;for(let o=0;o<=s;o++){const i=e.matches[o];if(!i)continue;const c=e.router.getMatch(i.id);c&&Object.assign(r,c.__routeContext,c.__beforeLoadContext)}return r},Ts=(e,t)=>{if(!e.matches.length)return;const n=t.routeId,r=e.matches.findIndex(i=>i.routeId===e.router.routeTree.id),s=r>=0?r:0;let o=n?e.matches.findIndex(i=>i.routeId===n):e.firstBadMatchIndex??e.matches.length-1;o<0&&(o=s);for(let i=o;i>=0;i--){const c=e.matches[i];if(e.router.looseRoutesById[c.routeId].options.notFoundComponent)return i}return n?o:s},Ye=(e,t,n)=>{if(!(!we(n)&&!xe(n)))throw we(n)&&n.redirectHandled&&!n.options.reloadDocument||(t&&(t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=n,e.updateMatch(t.id,r=>({...r,status:we(n)?"redirected":xe(n)?"notFound":r.status==="pending"?"success":r.status,context:dt(e,t.index),isFetching:!1,error:n})),xe(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()),we(n)&&(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n))),n},ua=(e,t)=>{const n=e.router.getMatch(t);return!!(!n||n._nonReactive.dehydrated)},Ls=(e,t,n)=>{const r=dt(e,n);e.updateMatch(t,s=>({...s,context:r}))},Ht=(e,t,n)=>{const{id:r,routeId:s}=e.matches[t],o=e.router.looseRoutesById[s];if(n instanceof Promise)throw n;e.firstBadMatchIndex??=t,Ye(e,e.router.getMatch(r),n);try{o.options.onError?.(n)}catch(i){n=i,Ye(e,e.router.getMatch(r),n)}e.updateMatch(r,i=>(i._nonReactive.beforeLoadPromise?.resolve(),i._nonReactive.beforeLoadPromise=void 0,i._nonReactive.loadPromise?.resolve(),{...i,error:n,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})),!e.preload&&!we(n)&&!xe(n)&&(e.serialError??=n)},da=(e,t,n,r)=>{if(r._nonReactive.pendingTimeout!==void 0)return;const s=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!tr(e,t)&&(n.options.loader||n.options.beforeLoad||ha(n))&&typeof s=="number"&&s!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent)){const o=setTimeout(()=>{Fr(e)},s);r._nonReactive.pendingTimeout=o}},Hc=(e,t,n)=>{const r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;da(e,t,n,r);const s=()=>{const o=e.router.getMatch(t);o.preload&&(o.status==="redirected"||o.status==="notFound")&&Ye(e,o,o.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(s):s()},qc=(e,t,n,r)=>{const s=e.router.getMatch(t);let o=s._nonReactive.loadPromise;s._nonReactive.loadPromise=At(()=>{o?.resolve(),o=void 0});const{paramsError:i,searchError:c}=s;i&&Ht(e,n,i),c&&Ht(e,n,c),da(e,t,r,s);const u=new AbortController;let d=!1;const f=()=>{d||(d=!0,e.updateMatch(t,N=>({...N,isFetching:"beforeLoad",fetchCount:N.fetchCount+1,abortController:u})))},l=()=>{s._nonReactive.beforeLoadPromise?.resolve(),s._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,N=>({...N,isFetching:!1}))};if(!r.options.beforeLoad){e.router.batch(()=>{f(),l()});return}s._nonReactive.beforeLoadPromise=At();const h={...dt(e,n,!1),...s.__routeContext},{search:m,params:g,cause:p}=s,x=tr(e,t),b={search:m,abortController:u,params:g,preload:x,context:h,location:e.location,navigate:N=>e.router.navigate({...N,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:x?"preload":p,matches:e.matches,routeId:r.id,...e.router.options.additionalContext},y=N=>{if(N===void 0){e.router.batch(()=>{f(),l()});return}(we(N)||xe(N))&&(f(),Ht(e,n,N)),e.router.batch(()=>{f(),e.updateMatch(t,j=>({...j,__beforeLoadContext:N})),l()})};let v;try{if(v=r.options.beforeLoad(b),en(v))return f(),v.catch(N=>{Ht(e,n,N)}).then(y)}catch(N){f(),Ht(e,n,N)}y(v)},Gc=(e,t)=>{const{id:n,routeId:r}=e.matches[t],s=e.router.looseRoutesById[r],o=()=>c(),i=()=>qc(e,n,t,s),c=()=>{if(ua(e,n))return;const u=Hc(e,n,s);return en(u)?u.then(i):i()};return o()},Kc=(e,t,n)=>{const r=e.router.getMatch(t);if(!r||!n.options.head&&!n.options.scripts&&!n.options.headers)return;const s={ssr:e.router.options.ssr,matches:e.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([n.options.head?.(s),n.options.scripts?.(s),n.options.headers?.(s)]).then(([o,i,c])=>({meta:o?.meta,links:o?.links,headScripts:o?.scripts,headers:c,scripts:i,styles:o?.styles}))},fa=(e,t,n,r,s)=>{const o=t[r-1],{params:i,loaderDeps:c,abortController:u,cause:d}=e.router.getMatch(n),f=dt(e,r),l=tr(e,n);return{params:i,deps:c,preload:!!l,parentMatchPromise:o,abortController:u,context:f,location:e.location,navigate:h=>e.router.navigate({...h,_fromLocation:e.location}),cause:l?"preload":d,route:s,...e.router.options.additionalContext}},Is=async(e,t,n,r,s)=>{try{const o=e.router.getMatch(n);try{(!(ta??e.router.isServer)||o.ssr===!0)&&nn(s);const i=s.options.loader,c=typeof i=="function"?i:i?.handler,u=c?.(fa(e,t,n,r,s)),d=!!c&&en(u);if((d||s._lazyPromise||s._componentsPromise||s.options.head||s.options.scripts||s.options.headers||o._nonReactive.minPendingPromise)&&e.updateMatch(n,l=>({...l,isFetching:"loader"})),c){const l=d?await u:u;Ye(e,e.router.getMatch(n),l),l!==void 0&&e.updateMatch(n,h=>({...h,loaderData:l}))}s._lazyPromise&&await s._lazyPromise;const f=o._nonReactive.minPendingPromise;f&&await f,s._componentsPromise&&await s._componentsPromise,e.updateMatch(n,l=>({...l,error:void 0,context:dt(e,r),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(i){let c=i;if(c?.name==="AbortError"){if(o.abortController.signal.aborted){o._nonReactive.loaderPromise?.resolve(),o._nonReactive.loaderPromise=void 0;return}e.updateMatch(n,d=>({...d,status:d.status==="pending"?"success":d.status,isFetching:!1,context:dt(e,r)}));return}const u=o._nonReactive.minPendingPromise;u&&await u,xe(i)&&await s.options.notFoundComponent?.preload?.(),Ye(e,e.router.getMatch(n),i);try{s.options.onError?.(i)}catch(d){c=d,Ye(e,e.router.getMatch(n),d)}!we(c)&&!xe(c)&&await nn(s,["errorComponent"]),e.updateMatch(n,d=>({...d,error:c,context:dt(e,r),status:"error",isFetching:!1}))}}catch(o){const i=e.router.getMatch(n);i&&(i._nonReactive.loaderPromise=void 0),Ye(e,i,o)}},Yc=async(e,t,n)=>{async function r(m,g,p,x,b){const y=Date.now()-g.updatedAt,v=m?b.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:b.options.staleTime??e.router.options.defaultStaleTime??0,N=b.options.shouldReload,j=typeof N=="function"?N(fa(e,t,s,n,b)):N,{status:k,invalid:C}=x,R=y>=v&&(!!e.forceStaleReload||x.cause==="enter"||p!==void 0&&p!==x.id);i=k==="success"&&(C||(j??R)),m&&b.options.preload===!1||(i&&!e.sync&&f?(c=!0,(async()=>{try{await Is(e,t,s,n,b);const _=e.router.getMatch(s);_._nonReactive.loaderPromise?.resolve(),_._nonReactive.loadPromise?.resolve(),_._nonReactive.loaderPromise=void 0,_._nonReactive.loadPromise=void 0}catch(_){we(_)&&await e.router.navigate(_.options)}})()):k!=="success"||i?await Is(e,t,s,n,b):Ls(e,s,n))}const{id:s,routeId:o}=e.matches[n];let i=!1,c=!1;const u=e.router.looseRoutesById[o],d=u.options.loader,f=((typeof d=="function"?void 0:d?.staleReloadMode)??e.router.options.defaultStaleReloadMode)!=="blocking";if(ua(e,s)){if(!e.router.getMatch(s))return e.matches[n];Ls(e,s,n)}else{const m=e.router.getMatch(s),g=e.router.stores.matchesId.get()[n],p=(g&&e.router.stores.matchStores.get(g)||null)?.routeId===o?g:e.router.stores.matches.get().find(b=>b.routeId===o)?.id,x=tr(e,s);if(m._nonReactive.loaderPromise){if(m.status==="success"&&!e.sync&&!m.preload&&f)return m;await m._nonReactive.loaderPromise;const b=e.router.getMatch(s),y=b._nonReactive.error||b.error;y&&Ye(e,b,y),b.status==="pending"&&await r(x,m,p,b,u)}else{const b=x&&!e.router.stores.matchStores.has(s),y=e.router.getMatch(s);y._nonReactive.loaderPromise=At(),b!==y.preload&&e.updateMatch(s,v=>({...v,preload:b})),await r(x,m,p,y,u)}}const l=e.router.getMatch(s);c||(l._nonReactive.loaderPromise?.resolve(),l._nonReactive.loadPromise?.resolve(),l._nonReactive.loadPromise=void 0),clearTimeout(l._nonReactive.pendingTimeout),l._nonReactive.pendingTimeout=void 0,c||(l._nonReactive.loaderPromise=void 0),l._nonReactive.dehydrated=void 0;const h=c?l.isFetching:!1;return h!==l.isFetching||l.invalid!==!1?(e.updateMatch(s,m=>({...m,isFetching:h,invalid:!1})),e.router.getMatch(s)):l};async function Ms(e){const t=e,n=[];Vc(t.router)&&Fr(t);let r;for(let h=0;h<t.matches.length;h++){try{const m=Gc(t,h);en(m)&&await m}catch(m){if(we(m))throw m;if(xe(m))r=m;else if(!t.preload)throw m;break}if(t.serialError||t.firstBadMatchIndex!=null)break}const s=t.firstBadMatchIndex??t.matches.length,o=r&&!t.preload?Ts(t,r):void 0,i=r&&t.preload?0:o!==void 0?Math.min(o+1,s):s;let c,u;for(let h=0;h<i;h++)n.push(Yc(t,n,h));try{await Promise.all(n)}catch{const h=await Promise.allSettled(n);for(const m of h){if(m.status!=="rejected")continue;const g=m.reason;if(we(g))throw g;xe(g)?c??=g:u??=g}if(u!==void 0)throw u}const d=c??(r&&!t.preload?r:void 0);let f=t.firstBadMatchIndex!==void 0?t.firstBadMatchIndex:t.matches.length-1;if(!d&&r&&t.preload)return t.matches;if(d){const h=Ts(t,d);if(h===void 0){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Could not find match for notFound boundary");Be()}const m=t.matches[h],g=t.router.looseRoutesById[m.routeId],p=t.router.options?.defaultNotFoundComponent;!g.options.notFoundComponent&&p&&(g.options.notFoundComponent=p),d.routeId=m.routeId;const x=m.routeId===t.router.routeTree.id;t.updateMatch(m.id,b=>({...b,...x?{status:"success",globalNotFound:!0,error:void 0}:{status:"notFound",error:d},isFetching:!1})),f=h,await nn(g,["notFoundComponent"])}else if(!t.preload){const h=t.matches[0];h.globalNotFound||t.router.getMatch(h.id)?.globalNotFound&&t.updateMatch(h.id,m=>({...m,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){const h=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await nn(h,["errorComponent"])}for(let h=0;h<=f;h++){const{id:m,routeId:g}=t.matches[h],p=t.router.looseRoutesById[g];try{const x=Kc(t,m,p);if(x){const b=await x;t.updateMatch(m,y=>({...y,...b}))}}catch(x){console.error(`Error executing head for route ${g}:`,x)}}const l=Fr(t);if(en(l)&&await l,d)throw d;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function Ds(e,t){const n=t.map(r=>e.options[r]?.preload?.()).filter(Boolean);if(n.length!==0)return Promise.all(n)}function nn(e,t=On){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(r=>{const{id:s,...o}=r.options;Object.assign(e.options,o),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);const n=()=>e._componentsLoaded?void 0:t===On?(()=>{if(e._componentsPromise===void 0){const r=Ds(e,On);r?e._componentsPromise=r.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():Ds(e,t);return e._lazyPromise?e._lazyPromise.then(n):n()}function ha(e){for(const t of On)if(e.options[t]?.preload)return!0;return!1}const On=["component","errorComponent","pendingComponent","notFoundComponent"];function Jc(e){return{input:({url:t})=>{for(const n of e)t=Ur(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=ma(e[n],t);return t}}}function Xc(e){const t=la(e.basepath),n=`/${t}`,r=e.caseSensitive?n:n.toLowerCase(),s=`${r}/`;return{input:({url:o})=>{const i=e.caseSensitive?o.pathname:o.pathname.toLowerCase();return i===r?o.pathname="/":i.startsWith(s)&&(o.pathname=o.pathname.slice(n.length)),o},output:({url:o})=>(o.pathname=An(["/",t,o.pathname]),o)}}function Ur(e,t){const n=e?.input?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function ma(e,t){const n=e?.output?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function Zc(e,t){const{createMutableStore:n,createReadonlyStore:r,batch:s,init:o}=t,i=new Map,c=new Map,u=new Map,d=n(e.status),f=n(e.loadedAt),l=n(e.isLoading),h=n(e.isTransitioning),m=n(e.location),g=n(e.resolvedLocation),p=n(e.statusCode),x=n(e.redirect),b=n([]),y=n([]),v=n([]),N=r(()=>gr(i,b.get())),j=r(()=>gr(c,y.get())),k=r(()=>gr(u,v.get())),C=r(()=>b.get()[0]),R=r(()=>b.get().some(Q=>i.get(Q)?.get().status==="pending")),_=r(()=>({locationHref:m.get().href,resolvedLocationHref:g.get()?.href,status:d.get()})),L=r(()=>({status:d.get(),loadedAt:f.get(),isLoading:l.get(),isTransitioning:h.get(),matches:N.get(),location:m.get(),resolvedLocation:g.get(),statusCode:p.get(),redirect:x.get()})),A=tn(64);function D(Q){let he=A.get(Q);return he||(he=r(()=>{const me=b.get();for(const I of me){const E=i.get(I);if(E&&E.routeId===Q)return E.get()}}),A.set(Q,he)),he}const O={status:d,loadedAt:f,isLoading:l,isTransitioning:h,location:m,resolvedLocation:g,statusCode:p,redirect:x,matchesId:b,pendingIds:y,cachedIds:v,matches:N,pendingMatches:j,cachedMatches:k,firstId:C,hasPending:R,matchRouteDeps:_,matchStores:i,pendingMatchStores:c,cachedMatchStores:u,__store:L,getRouteMatchStore:D,setMatches:$,setPending:J,setCached:Y};$(e.matches),o?.(O);function $(Q){xr(Q,i,b,n,s)}function J(Q){xr(Q,c,y,n,s)}function Y(Q){xr(Q,u,v,n,s)}return O}function gr(e,t){const n=[];for(const r of t){const s=e.get(r);s&&n.push(s.get())}return n}function xr(e,t,n,r,s){const o=e.map(c=>c.id),i=new Set(o);s(()=>{for(const c of t.keys())i.has(c)||t.delete(c);for(const c of e){const u=t.get(c.id);if(!u){const d=r(c);d.routeId=c.routeId,t.set(c.id,d);continue}u.routeId=c.routeId,u.get()!==c&&u.set(c)}Rc(n.get(),o)||n.set(o)})}var Je="__TSR_index",Fs="popstate",Us="beforeunload";function Qc(e){let t=e.getLocation();const n=new Set,r=i=>{t=e.getLocation(),n.forEach(c=>c({location:t,action:i}))},s=i=>{e.notifyOnIndexChange??!0?r(i):t=e.getLocation()},o=async({task:i,navigateOpts:c,...u})=>{if(c?.ignoreBlocker??!1){i();return}const d=e.getBlockers?.()??[],f=u.type==="PUSH"||u.type==="REPLACE";if(typeof document<"u"&&d.length&&f)for(const l of d){const h=Wn(u.path,u.state);if(await l.blockerFn({currentLocation:t,nextLocation:h,action:u.type})){e.onBlocked?.();return}}i()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:i=>(n.add(i),()=>{n.delete(i)}),push:(i,c,u)=>{const d=t.state[Je];c=$s(d+1,c),o({task:()=>{e.pushState(i,c),r({type:"PUSH"})},navigateOpts:u,type:"PUSH",path:i,state:c})},replace:(i,c,u)=>{const d=t.state[Je];c=$s(d,c),o({task:()=>{e.replaceState(i,c),r({type:"REPLACE"})},navigateOpts:u,type:"REPLACE",path:i,state:c})},go:(i,c)=>{o({task:()=>{e.go(i),s({type:"GO",index:i})},navigateOpts:c,type:"GO"})},back:i=>{o({task:()=>{e.back(i?.ignoreBlocker??!1),s({type:"BACK"})},navigateOpts:i,type:"BACK"})},forward:i=>{o({task:()=>{e.forward(i?.ignoreBlocker??!1),s({type:"FORWARD"})},navigateOpts:i,type:"FORWARD"})},canGoBack:()=>t.state[Je]!==0,createHref:i=>e.createHref(i),block:i=>{if(!e.setBlockers)return()=>{};const c=e.getBlockers?.()??[];return e.setBlockers([...c,i]),()=>{const u=e.getBlockers?.()??[];e.setBlockers?.(u.filter(d=>d!==i))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function $s(e,t){t||(t={});const n=ns();return{...t,key:n,__TSR_key:n,[Je]:e}}function el(e){const t=typeof document<"u"?window:void 0,n=t.history.pushState,r=t.history.replaceState;let s=[];const o=()=>s,i=R=>s=R,c=(R=>R),u=(()=>Wn(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){const R=ns();t.history.replaceState({[Je]:0,key:R,__TSR_key:R},"")}let d=u(),f,l=!1,h=!1,m=!1,g=!1;const p=()=>d;let x,b;const y=()=>{x&&(C._ignoreSubscribers=!0,(x.isPush?t.history.pushState:t.history.replaceState)(x.state,"",x.href),C._ignoreSubscribers=!1,x=void 0,b=void 0,f=void 0)},v=(R,_,L)=>{const A=c(_);b||(f=d),d=Wn(_,L),x={href:A,state:L,isPush:x?.isPush||R==="push"},b||(b=Promise.resolve().then(()=>y()))},N=R=>{d=u(),C.notify({type:R})},j=async()=>{if(h){h=!1;return}const R=u(),_=R.state[Je]-d.state[Je],L=_===1,A=_===-1,D=!L&&!A||l;l=!1;const O=D?"GO":A?"BACK":"FORWARD",$=D?{type:"GO",index:_}:{type:A?"BACK":"FORWARD"};if(m)m=!1;else{const J=o();if(typeof document<"u"&&J.length){for(const Y of J)if(await Y.blockerFn({currentLocation:d,nextLocation:R,action:O})){h=!0,t.history.go(1),C.notify($);return}}}d=u(),C.notify($)},k=R=>{if(g){g=!1;return}let _=!1;const L=o();if(typeof document<"u"&&L.length)for(const A of L){const D=A.enableBeforeUnload??!0;if(D===!0){_=!0;break}if(typeof D=="function"&&D()===!0){_=!0;break}}if(_)return R.preventDefault(),R.returnValue=""},C=Qc({getLocation:p,getLength:()=>t.history.length,pushState:(R,_)=>v("push",R,_),replaceState:(R,_)=>v("replace",R,_),back:R=>(R&&(m=!0),g=!0,t.history.back()),forward:R=>{R&&(m=!0),g=!0,t.history.forward()},go:R=>{l=!0,t.history.go(R)},createHref:R=>c(R),flush:y,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(Us,k,{capture:!0}),t.removeEventListener(Fs,j)},onBlocked:()=>{f&&d!==f&&(d=f)},getBlockers:o,setBlockers:i,notifyOnIndexChange:!1});return t.addEventListener(Us,k,{capture:!0}),t.addEventListener(Fs,j),t.history.pushState=function(...R){const _=n.apply(t.history,R);return C._ignoreSubscribers||N("PUSH"),_},t.history.replaceState=function(...R){const _=r.apply(t.history,R);return C._ignoreSubscribers||N("REPLACE"),_},C}function tl(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function Wn(e,t){const n=tl(e),r=n.indexOf("#"),s=n.indexOf("?"),o=ns();return{href:n,pathname:n.substring(0,r>0?s>0?Math.min(r,s):r:s>0?s:n.length),hash:r>-1?n.substring(r):"",search:s>-1?n.slice(s,r===-1?void 0:r):"",state:t||{[Je]:0,key:o,__TSR_key:o}}}function ns(){return(Math.random()+1).toString(36).substring(7)}function _t(e,t){const n=t,r=e;return{fromLocation:n,toLocation:r,pathChanged:n?.pathname!==r.pathname,hrefChanged:n?.href!==r.href,hashChanged:n?.hash!==r.hash}}const $r=new WeakMap;var nl=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.routeBranchCache=new WeakMap,this.lightweightCache=new WeakMap,this.startTransition=n=>n(),this.update=n=>{process.env.NODE_ENV!=="production"&&n.notFoundRoute&&console.warn("The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info.");const r=this.options,s=this.basepath??r?.basepath??"/",o=this.basepath===void 0,i=r?.rewrite;if(this.options={...r,...n},this.isServer=this.options.isServer??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=Mc(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=el()),this.origin=this.options.origin,this.origin||(window?.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let f;this.resolvePathCache=tn(1e3),f=this.buildRouteTree(),this.setRoutes(f)}if(!this.stores&&this.latestLocation){const f=this.getStoreConfig(this);this.batch=f.batch,this.stores=Zc(sl(this.latestLocation),f),pl(this)}let c=!1;const u=this.options.basepath??"/",d=this.options.rewrite;if(o||s!==u||i!==d){this.basepath=u;const f=[],l=la(u);l&&l!=="/"&&f.push(Xc({basepath:u})),d&&f.push(d),this.rewrite=f.length===0?void 0:f.length===1?f[0]:Jc(f),this.history&&this.updateLatestLocation(),c=!0}c&&this.stores&&this.stores.location.set(this.latestLocation),typeof window<"u"&&"CSS"in window&&typeof window.CSS?.supports=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a))"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const n=Pc(this.routeTree,this.options.caseSensitive,(r,s)=>{r.init({originalIndex:s})});return this.options.routeMasks&&Cc(this.options.routeMasks,n.processedTree),n},this.subscribe=(n,r)=>{const s={eventType:n,fn:r};return this.subscribers.add(s),()=>{this.subscribers.delete(s)}},this.emit=n=>{this.subscribers.forEach(r=>{r.eventType===n.type&&r.fn(n)})},this.parseLocation=(n,r)=>{const s=({pathname:u,search:d,hash:f,href:l,state:h})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(u)){const b=this.options.parseSearch(d),y=this.options.stringifySearch(b);return{href:u+y+f,publicHref:u+y+f,pathname:Vt(u).path,external:!1,searchStr:y,search:tt(r?.search,b),hash:Vt(f.slice(1)).path,state:ot(r?.state,h)}}const m=new URL(l,this.origin),g=Ur(this.rewrite,m),p=this.options.parseSearch(g.search),x=this.options.stringifySearch(p);return g.search=x,{href:g.href.replace(g.origin,""),publicHref:l,pathname:Vt(g.pathname).path,external:!!this.rewrite&&g.origin!==this.origin,searchStr:x,search:tt(r?.search,p),hash:Vt(g.hash.slice(1)).path,state:ot(r?.state,h)}},o=s(n),{__tempLocation:i,__tempKey:c}=o.state;if(i&&(!c||c===this.tempLocationKey)){const u=s(i);return u.state.key=o.state.key,u.state.__TSR_key=o.state.__TSR_key,delete u.state.__tempLocation,{...u,maskedLocation:o}}return o},this.resolvePathWithBase=(n,r)=>Ic({base:n,to:r.includes("//")?ts(r):r,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(n,r,s)=>typeof n=="string"?this.matchRoutesInternal({pathname:n,search:r},s):this.matchRoutesInternal(n,r),this.getMatchedRoutes=n=>ol({pathname:n,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=n=>{const r=this.getMatch(n);r&&(r.abortController.abort(),clearTimeout(r._nonReactive.pendingTimeout),r._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingIds.get().forEach(n=>{this.cancelMatch(n)}),this.stores.matchesId.get().forEach(n=>{if(this.stores.pendingMatchStores.has(n))return;const r=this.stores.matchStores.get(n)?.get();r&&(r.status==="pending"||r.isFetching==="loader")&&this.cancelMatch(n)})},this.buildLocation=n=>{const r=(o={})=>{const i=o._fromLocation||this.pendingBuiltLocation||this.latestLocation,c=this.matchRoutesLightweight(i);if(o.from&&process.env.NODE_ENV!=="production"&&o._isNavigate){const A=this.getMatchedRoutes(o.from).matchedRoutes,D=ks(c.matchedRoutes,$=>zs($.fullPath,o.from)),O=ks(A,$=>zs($.fullPath,c.fullPath));!D&&!O&&console.warn(`Could not find match for from: ${o.from}`)}const u=o.unsafeRelative==="path"?i.pathname:o.from??c.fullPath,d=o.to?`${o.to}`:void 0,f=c.search,l=Object.assign(Object.create(null),c.params),h=d?.charCodeAt(0)===47?"/":this.resolvePathWithBase(u,"."),m=d?this.resolvePathWithBase(h,d):h,g=o.params===!1||o.params===null?Object.create(null):(o.params??!0)===!0?l:Object.assign(l,st(o.params,l)),p=this.routesByPath[$e(m)];let x;if(p)x=this.getRouteBranch(p);else if(m.includes("$"))x=[];else{const A=this.getMatchedRoutes(m);x=A.matchedRoutes,this.options.notFoundRoute&&(!A.foundRoute||A.foundRoute.path!=="/"&&A.routeParams["**"])&&(x=[...x,this.options.notFoundRoute])}if(x.length&&ra(g))for(const A of x){const D=A.options.params?.stringify??A.options.stringifyParams;if(D)try{Object.assign(g,D(g))}catch{}}const b=n.leaveParams?m:Vt(As({path:m,params:g,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;if(process.env.NODE_ENV!=="production"&&p&&!n.leaveParams)try{const A=this.getMatchedRoutes(b);A.foundRoute?.id!==p.id&&console.warn(`Generated path "${b}" for route "${p.id}" matched route "${A.foundRoute?.id}" instead. This can happen when multiple route templates resolve to the same URL. Use the route template that matches the intended route, or adjust params.stringify if it changed the target path.`)}catch{}let y=f;if(n._includeValidateSearch&&this.options.search?.strict){const A={};x.forEach(D=>{if(D.options.validateSearch)try{Object.assign(A,Tn(D.options.validateSearch,{...A,...y}))}catch{}}),y=A}y=al({search:y,dest:o,destRoutes:x,_includeValidateSearch:n._includeValidateSearch}),y=tt(f,y);const v=this.options.stringifySearch(y),N=o.hash===!0?i.hash:o.hash?st(o.hash,i.hash):void 0,j=N?`#${N}`:"";let k=o.state===!0?i.state:o.state?st(o.state,i.state):{};k=ot(i.state,k);const C=`${b}${v}${j}`;let R,_,L=!1;if(this.rewrite){const A=new URL(C,this.origin),D=ma(this.rewrite,A);R=A.href.replace(A.origin,""),D.origin!==this.origin?(_=D.href,L=!0):_=D.pathname+D.search+D.hash}else R=Sc(C),_=R;return{publicHref:_,href:R,pathname:b,search:y,searchStr:v,state:k,hash:N??"",external:L,unmaskOnReload:o.unmaskOnReload}},s=(o={},i)=>{const c=r(o);let u=i?r(i):void 0;if(!u){const d=Object.create(null);if(this.options.routeMasks){const f=jc(c.pathname,this.processedTree);if(f){Object.assign(d,f.rawParams);const{from:l,params:h,...m}=f.route,g=h===!1||h===null?Object.create(null):(h??!0)===!0?d:Object.assign(d,st(h,d));i={from:n.from,...m,params:g},u=r(i)}}}return u&&(c.maskedLocation=u),c};return n.mask?s(n,{from:n.from,...n.mask}):s(n)},this.commitLocation=async({viewTransition:n,ignoreBlocker:r,...s})=>{let o;const i=()=>{const d=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];d.forEach(l=>{s.state[l]=this.latestLocation.state[l]});const f=lt(s.state,this.latestLocation.state);return d.forEach(l=>{delete s.state[l]}),f},c=$e(this.latestLocation.href)===$e(s.href);let u=this.commitLocationPromise;if(this.commitLocationPromise=At(()=>{u?.resolve(),u=void 0}),c&&i())this.load();else{let{maskedLocation:d,hashScrollIntoView:f,...l}=s;d&&(l={...d,state:{...d.state,__tempKey:void 0,__tempLocation:{...l,search:l.searchStr,state:{...l.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(l.unmaskOnReload??this.options.unmaskOnReload??!1)&&(l.state.__tempKey=this.tempLocationKey)),l.state.__hashScrollIntoViewOptions=f??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=n,o=s.replace?"REPLACE":"PUSH",this.history[o==="REPLACE"?"replace":"push"](l.publicHref,l.state,{ignoreBlocker:r})}return this._scroll.next=s.resetScroll??!0,this.history.subscribers.size||this.load(o?{action:{type:o}}:void 0),this.commitLocationPromise},this.buildAndCommitLocation=({replace:n,resetScroll:r,hashScrollIntoView:s,viewTransition:o,ignoreBlocker:i,href:c,...u}={})=>{if(c){const l=this.history.location.state.__TSR_index,h=Wn(c,{__TSR_index:n?l:l+1}),m=new URL(h.pathname,this.origin);u.to=Ur(this.rewrite,m).pathname,u.search=this.options.parseSearch(h.search),u.hash=h.hash.slice(1)}const d=this.buildLocation({...u,_includeValidateSearch:!0});this.pendingBuiltLocation=d;const f=this.commitLocation({...d,viewTransition:o,replace:n,resetScroll:r,hashScrollIntoView:s,ignoreBlocker:i});return queueMicrotask(()=>{this.pendingBuiltLocation===d&&(this.pendingBuiltLocation=void 0)}),f},this.navigate=async({to:n,reloadDocument:r,href:s,publicHref:o,...i})=>{let c=!1;if(s)try{new URL(`${s}`),c=!0}catch{}if(c&&!r&&(r=!0),r){if(n!==void 0||!s){const d=this.buildLocation({to:n,...i});s=s??d.publicHref,o=o??d.publicHref}const u=!c&&o?o:s;if(Bn(u,this.protocolAllowlist)){process.env.NODE_ENV!=="production"&&console.warn(`Blocked navigation to dangerous protocol: ${u}`);return}if(!i.ignoreBlocker){const d=this.history.getBlockers?.()??[];for(const f of d)if(f?.blockerFn&&await f.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return}i.replace?window.location.replace(u):window.location.href=u;return}return this.buildAndCommitLocation({...i,href:s,to:n,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();const n=this.matchRoutes(this.latestLocation),r=this.stores.cachedMatches.get().filter(s=>!n.some(o=>o.id===s.id));this.batch(()=>{this.stores.status.set("pending"),this.stores.statusCode.set(200),this.stores.isLoading.set(!0),this.stores.location.set(this.latestLocation),this.stores.setPending(n),this.stores.setCached(r)})},this.load=async n=>{const r=n?.action?.type;let s,o,i;const c=this.stores.resolvedLocation.get()??this.stores.location.get();for(i=new Promise(d=>{this.startTransition(async()=>{try{this.beforeLoad(),r?$r.set(this.latestLocation,r):$r.delete(this.latestLocation);const f=this.latestLocation,l=_t(f,this.stores.resolvedLocation.get());this.stores.redirect.get()||this.emit({type:"onBeforeNavigate",...l}),this.emit({type:"onBeforeLoad",...l}),await Ms({router:this,sync:n?.sync,forceStaleReload:c.href===f.href,matches:this.stores.pendingMatches.get(),location:f,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let h=null,m=null,g=null,p=null;this.batch(()=>{const x=this.stores.pendingMatches.get(),b=x.length,y=this.stores.matches.get();h=b?y.filter(j=>!this.stores.pendingMatchStores.has(j.id)):null;const v=new Set;for(const j of this.stores.pendingMatchStores.values())j.routeId&&v.add(j.routeId);const N=new Set;for(const j of this.stores.matchStores.values())j.routeId&&N.add(j.routeId);m=b?y.filter(j=>!v.has(j.routeId)):null,g=b?x.filter(j=>!N.has(j.routeId)):null,p=b?x.filter(j=>N.has(j.routeId)):y,this.stores.isLoading.set(!1),this.stores.loadedAt.set(Date.now()),b&&(this.stores.setMatches(x),this.stores.setPending([]),this.stores.setCached([...this.stores.cachedMatches.get(),...h.filter(j=>j.status!=="error"&&j.status!=="notFound"&&j.status!=="redirected")]),this.clearExpiredCache())});for(const[x,b]of[[m,"onLeave"],[g,"onEnter"],[p,"onStay"]])if(x)for(const y of x)this.looseRoutesById[y.routeId].options[b]?.(y)})})}})}catch(f){we(f)?(s=f,this.navigate({...s.options,replace:!0,ignoreBlocker:!0})):xe(f)&&(o=f);const l=s?s.status:o?404:this.stores.matches.get().some(h=>h.status==="error")?500:200;this.batch(()=>{this.stores.statusCode.set(l),this.stores.redirect.set(s)})}this.latestLoadPromise===i&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),d()})}),this.latestLoadPromise=i,await i;this.latestLoadPromise&&i!==this.latestLoadPromise;)await this.latestLoadPromise;let u;this.hasNotFoundMatch()?u=404:this.stores.matches.get().some(d=>d.status==="error")&&(u=500),u!==void 0&&this.stores.statusCode.set(u)},this.startViewTransition=n=>{const r=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,r&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let s;if(typeof r=="object"&&this.isViewTransitionTypesSupported){const o=this.latestLocation,i=this.stores.resolvedLocation.get(),c=typeof r.types=="function"?r.types(_t(o,i)):r.types;if(c===!1){n();return}s={update:n,types:c}}else s=n;document.startViewTransition(s)}else n()},this.updateMatch=(n,r)=>{this.startTransition(()=>{const s=this.stores.pendingMatchStores.get(n);if(s){s.set(r);return}const o=this.stores.matchStores.get(n);if(o){o.set(r);return}const i=this.stores.cachedMatchStores.get(n);if(i){const c=r(i.get());c.status==="redirected"?this.stores.cachedMatchStores.delete(n)&&this.stores.cachedIds.set(u=>u.filter(d=>d!==n)):i.set(c)}})},this.getMatch=n=>this.stores.cachedMatchStores.get(n)?.get()??this.stores.pendingMatchStores.get(n)?.get()??this.stores.matchStores.get(n)?.get(),this.invalidate=n=>{const r=s=>n?.filter?.(s)??!0?{...s,invalid:!0,...n?.forcePending||s.status==="error"||s.status==="notFound"?{status:"pending",error:void 0}:void 0}:s;return this.batch(()=>{this.stores.setMatches(this.stores.matches.get().map(r)),this.stores.setCached(this.stores.cachedMatches.get().map(r)),this.stores.setPending(this.stores.pendingMatches.get().map(r))}),this.shouldViewTransition=!1,this.load({sync:n?.sync})},this.getParsedLocationHref=n=>n.publicHref||"/",this.resolveRedirect=n=>{const r=n.headers.get("Location");if(!n.options.href||n.options._builtLocation){const s=n.options._builtLocation??this.buildLocation(n.options),o=this.getParsedLocationHref(s);n.options.href=o,n.headers.set("Location",o)}else if(r)try{const s=new URL(r);if(this.origin&&s.origin===this.origin){const o=s.pathname+s.search+s.hash;n.options.href=o,n.headers.set("Location",o)}}catch{}if(n.options.href&&!n.options._builtLocation&&Bn(n.options.href,this.protocolAllowlist))throw new Error(process.env.NODE_ENV!=="production"?`Redirect blocked: unsafe protocol in href "${n.options.href}". Allowed protocols: ${Array.from(this.protocolAllowlist).join(", ")}.`:"Redirect blocked: unsafe protocol");return n.headers.get("Location")||n.headers.set("Location",n.options.href),n},this.clearCache=n=>{const r=n?.filter;r!==void 0?this.stores.setCached(this.stores.cachedMatches.get().filter(s=>!r(s))):this.stores.setCached([])},this.clearExpiredCache=()=>{const n=Date.now(),r=s=>{const o=this.looseRoutesById[s.routeId];if(!o.options.loader)return!0;const i=(s.preload?o.options.preloadGcTime??this.options.defaultPreloadGcTime:o.options.gcTime??this.options.defaultGcTime)??300*1e3;return s.status==="error"?!0:n-s.updatedAt>=i};this.clearCache({filter:r})},this.loadRouteChunk=nn,this.preloadRoute=async n=>{const r=n._builtLocation??this.buildLocation(n);let s=this.matchRoutes(r,{throwOnError:!0,preload:!0,dest:n});const o=new Set([...this.stores.matchesId.get(),...this.stores.pendingIds.get()]),i=new Set([...o,...this.stores.cachedIds.get()]),c=s.filter(u=>!i.has(u.id));if(c.length){const u=this.stores.cachedMatches.get();this.stores.setCached([...u,...c])}try{return s=await Ms({router:this,matches:s,location:r,preload:!0,updateMatch:(u,d)=>{o.has(u)?s=s.map(f=>f.id===u?d(f):f):this.updateMatch(u,d)}}),s}catch(u){if(we(u))return u.options.reloadDocument?void 0:await this.preloadRoute({...u.options,_fromLocation:r});xe(u)||console.error(u);return}},this.matchRoute=(n,r)=>{const s={...n,to:n.to?this.resolvePathWithBase(n.from||"",n.to):void 0,params:n.params||{},leaveParams:!0},o=this.buildLocation(s);if(r?.pending&&this.stores.status.get()!=="pending")return!1;const i=(r?.pending===void 0?!this.stores.isLoading.get():r.pending)?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),c=Ec(o.pathname,r?.caseSensitive??!1,r?.fuzzy??!1,i.pathname,this.processedTree);return!c||n.params&&!lt(c.rawParams,n.params,{partial:!0})?!1:r?.includeSearch??!0?lt(i.search,o.search,{partial:!0})?c.rawParams:!1:c.rawParams},this.hasNotFoundMatch=()=>this.stores.matches.get().some(n=>n.status==="notFound"||n.globalNotFound),this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??"fuzzy",stringifySearch:e.stringifySearch??$c,parseSearch:e.parseSearch??Uc,protocolAllowlist:e.protocolAllowlist??wc}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;const r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=ia(e),this.routeBranchCache.set(e,t)),t}get looseRoutesById(){return this.routesById}getParentContext(e){return e?.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,t){const n=this.getMatchedRoutes(e.pathname),{foundRoute:r,routeParams:s}=n;let{matchedRoutes:o}=n,i=!1;(r?r.path!=="/"&&s["**"]:$e(e.pathname))&&(this.options.notFoundRoute?o=[...o,this.options.notFoundRoute]:i=!0);const c=i?cl(this.options.notFoundMode,o):void 0,u=new Array(o.length),d=new Map;for(const f of this.stores.matchStores.values())f.routeId&&d.set(f.routeId,f.get());for(let f=0;f<o.length;f++){const l=o[f],h=u[f-1];let m,g,p;{const D=h?.search??e.search,O=h?._strictSearch??void 0;try{const $=Tn(l.options.validateSearch,{...D})??void 0;m={...D,...$},g={...O,...$},p=void 0}catch($){let J=$;if($ instanceof Vn||(J=new Vn($.message,{cause:$})),t?.throwOnError)throw J;m=D,g={},p=J}}const x=l.options.loaderDeps?.({search:m})??"",b=x?JSON.stringify(x):"",{interpolatedPath:y,usedParams:v}=As({path:l.fullPath,params:s,decoder:this.pathParamsDecoder,server:this.isServer}),N=l.id+y+b,j=this.getMatch(N),k=d.get(l.id),C=j?._strictParams??v;let R;if(!j)try{Ws(l,C)}catch(D){if(xe(D)||we(D)?R=D:R=new rl(D.message,{cause:D}),t?.throwOnError)throw R}Object.assign(s,C);const _=k?"stay":"enter";let L;if(j)L={...j,cause:_,params:k?.params??s,_strictParams:C,search:tt(k?k.search:j.search,m),_strictSearch:g};else{const D=l.options.loader||l.options.beforeLoad||l.lazyFn||ha(l)?"pending":"success";L={id:N,ssr:l.options.ssr,index:f,routeId:l.id,params:k?.params??s,_strictParams:C,pathname:y,updatedAt:Date.now(),search:k?tt(k.search,m):m,_strictSearch:g,searchError:void 0,status:D,isFetching:!1,error:void 0,paramsError:R,__routeContext:void 0,_nonReactive:{loadPromise:At()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:_,loaderDeps:k?ot(k.loaderDeps,x):x,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:l.options.staticData||{},fullPath:l.fullPath}}t?.preload||(L.globalNotFound=c===l.id),L.searchError=p;const A=this.getParentContext(h);L.context={...A,...L.__routeContext,...L.__beforeLoadContext},u[f]=L}for(let f=0;f<u.length;f++){const l=u[f],h=this.looseRoutesById[l.routeId],m=this.getMatch(l.id),g=d.get(l.routeId);if(l.params=g?tt(g.params,s):s,!m){const p=u[f-1],x=this.getParentContext(p);if(h.options.context){const b={deps:l.loaderDeps,params:l.params,context:x??{},location:e,navigate:y=>this.navigate({...y,_fromLocation:e}),buildLocation:this.buildLocation,cause:l.cause,abortController:l.abortController,preload:!!l.preload,matches:u,routeId:h.id};l.__routeContext=h.options.context(b)??void 0}l.context={...x,...l.__routeContext,...l.__beforeLoadContext}}}return u}matchRoutesLightweight(e){const t=Qt(this.stores.matchesId.get()),n=this.lightweightCache.get(e);if(n&&n[0]===t)return n[1];const{matchedRoutes:r,routeParams:s}=this.getMatchedRoutes(e.pathname),o=Qt(r),i={...e.search};for(const l of r)try{Object.assign(i,Tn(l.options.validateSearch,i))}catch{}const c=t&&this.stores.matchStores.get(t)?.get(),u=c&&c.routeId===o.id&&c.pathname===e.pathname;let d;if(u)d=c.params;else{const l=Object.assign(Object.create(null),s);for(const h of r)try{Ws(h,l)}catch{}d=l}const f={matchedRoutes:r,fullPath:o.fullPath,search:i,params:d};return this.lightweightCache.set(e,[t,f]),f}},Vn=class extends Error{},rl=class extends Error{};const Bs=e=>e.endsWith("/")&&e.length>1?e.slice(0,-1):e;function zs(e,t){return Bs(e)===Bs(t)}function sl(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:e,matches:[],statusCode:200}}function Tn(e,t){if(e==null)return{};if("~standard"in e){const n=e["~standard"].validate(t);if(n instanceof Promise)throw new Vn("Async validation not supported");if(n.issues)throw new Vn(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return"parse"in e?e.parse(t):typeof e=="function"?e(t):{}}function ol({pathname:e,routesById:t,processedTree:n}){const r=Object.create(null),s=$e(e);let o;const i=kc(s,n,!0);return i&&(o=i.route,Object.assign(r,i.rawParams)),{matchedRoutes:i?.branch||[t.__root__],routeParams:r,foundRoute:o}}function al({search:e,dest:t,destRoutes:n,_includeValidateSearch:r}){return il(n)(e,t,r??!1)}function il(e){let t,n;const r=[];for(const o of e){const i=o.options;if("search"in i)i.search?.middlewares&&r.push(...i.search.middlewares);else if(i.preSearchFilters||i.postSearchFilters){const u=({search:d,next:f})=>{const l=f(i.preSearchFilters?i.preSearchFilters.reduce((h,m)=>m(h),d):d);return i.postSearchFilters?i.postSearchFilters.reduce((h,m)=>m(h),l):l};r.push(u)}const c=i.validateSearch;if(c){const u=({search:d,next:f,meta:l})=>{const h=f(d);if(n)try{const m=Tn(c,h);if(l&&m)for(const g in m)g in h||(l.defaulted||=new Map).set(g,m[g]);return{...h,...m}}catch{}return h};r.push(u)}}const s=(o,i,c)=>{if(o>=r.length){if(!t.search)return{};if(t.search===!0)return i;const d=st(t.search,i);return c&&(c.explicit=d),d}const u=(d,f)=>{if(f){const l=c||{};return{search:s(o+1,d,l),meta:l}}return s(o+1,d,c)};return r[o]({search:i,next:u,meta:c})};return function(i,c,u){return t=c,n=u,s(0,i)}}function cl(e,t){if(e!=="root")for(let n=t.length-1;n>=0;n--){const r=t[n];if(r.children)return r.id}return ut}function Ws(e,t){const n=e.options.params?.parse??e.options.parseParams;if(n){const r=n(t);if(r===!1)throw new Error("Route params.parse returned false for a matched route");Object.assign(t,r)}}function ll(){try{return sessionStorage}catch{return}}const ul="tsr-scroll-restoration-v1_3",pa=ll();function dl(){try{return JSON.parse(pa?.getItem("tsr-scroll-restoration-v1_3")||"{}")}catch{return{}}}function fl(){try{pa?.setItem(ul,JSON.stringify(jt))}catch{process.env.NODE_ENV!=="production"&&console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}const jt=dl(),Vs="data-scroll-restoration-id",hl=e=>e.state.__TSR_key||e.href;function ml(e){const t=e.getAttribute(Vs);if(t)return`[${Vs}="${t}"]`;let n="",r=e,s;for(;s=r.parentNode;){let o=1,i=r;for(;i=i.previousElementSibling;)o++;const c=`${r.localName}:nth-child(${o})`;n=n?`${c} > ${n}`:c,r=s}return n}let pn=!1;const Et="window";function Br(e){try{return typeof e=="function"?e():document.querySelector(e)}catch{}}function Hs(e){const t=[];for(const n of e){if(n===Et)continue;const r=Br(n);r&&t.push(r)}return t}function pl(e,t){const n=e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);const s=e.options.getScrollRestorationKey||hl,o=new Map,i=(d,f,l)=>{const h=o.get(d)||{};h.scrollX=f,h.scrollY=l,o.set(d,h)},c=d=>{if(!(pn||!r.restoring))if(d.target===document)i(Et,scrollX,scrollY);else{const f=d.target;i(f,f.scrollLeft,f.scrollTop)}},u=d=>{if(!r.restoring)return;const f=jt[d]||={};for(const[l,h]of o)l===Et?f[Et]=h:l.isConnected&&(f[ml(l)]=h)};n&&!r.restoration&&(r.restoration=!0,pn=!1,history.scrollRestoration="manual",document.addEventListener("scroll",c,!0),e.subscribe("onBeforeLoad",d=>{d.fromLocation&&u(s(d.fromLocation)),o.clear()}),addEventListener("pagehide",()=>{u(s(e.stores.resolvedLocation.get()??e.stores.location.get())),fl()})),!r.reset&&(r.reset=!0,e.subscribe("onRendered",d=>{const f=e.options.scrollRestorationBehavior,l=e.options.scrollToTopSelectors,h=r.next;let m;if(o.clear(),h||(r.next=!0),typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation}))return;const g=s(d.toLocation),p=d.fromLocation&&s(d.fromLocation);if(r.restoring&&p&&p!==g){const x=jt[p];if(x){let b=jt[g];for(const y in x){if(y===Et){if(h)continue}else{const v=Br(y);if(!v||h&&l&&(m??=Hs(l),m.includes(v)))continue}b||(b=jt[g]={}),b[y]??=x[y]}}}pn=!0;try{const x=d.toLocation.hash,b=d.toLocation.state.__hashScrollIntoViewOptions??!0;let y=!1;if(h){const v=$r.get(d.toLocation),N=x&&b&&(v==="PUSH"||v==="REPLACE"),j=r.restoring?jt[g]:void 0;if(j)for(const k in j){const{scrollX:C,scrollY:R}=j[k];if(k===Et){if(N)continue;scrollTo({top:R,left:C,behavior:f}),y=!0}else{const _=Br(k);_&&(_.scrollLeft=C,_.scrollTop=R)}}if(!y&&!x){const k={top:0,left:0,behavior:f};if(scrollTo(k),l){m??=Hs(l);for(const C of m)C.scrollTo(k)}}}!y&&x&&b&&document.getElementById(x)?.scrollIntoView(b)}finally{pn=!1}}))}const gl="Error preloading route! ☝️";var ga=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=t=>{this.originalIndex=t.originalIndex;const n=this.options,r=!n?.path&&!n?.id;if(this.parentRoute=this.options.getParentRoute?.(),r)this._path=ut;else if(!this.parentRoute){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.");Be()}let s=r?ut:n?.path;s&&s!=="/"&&(s=ca(s));const o=n?.id||s;let i=r?ut:An([this.parentRoute.id==="__root__"?"":this.parentRoute.id,o]);s==="__root__"&&(s="/"),i!=="__root__"&&(i=An(["/",i]));const c=i==="__root__"?"/":An([this.parentRoute.fullPath,s]);this._path=s,this._id=i,this._fullPath=c,this._to=$e(c)},this.addChildren=t=>this._addFileChildren(t),this._addFileChildren=t=>(Array.isArray(t)&&(this.children=t),typeof t=="object"&&t!==null&&(this.children=Object.values(t)),this),this._addFileTypes=()=>this,this.updateLoader=t=>(Object.assign(this.options,t),this),this.update=t=>(Object.assign(this.options,t),this),this.lazy=t=>(this.lazyFn=t,this),this.redirect=t=>Wc({from:this.fullPath,...t}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw new Error("Route cannot have both an 'id' and a 'path' option.")}},xl=class extends ga{constructor(e){super(e)}};function rs(e){const t=e.errorComponent??ss;return a.jsx(bl,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?S.createElement(t,{error:n,reset:r}):e.children})}var bl=class extends S.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e,t){const n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.error,reset:()=>{this.reset()}})}};function ss({error:e}){const[t,n]=S.useState(process.env.NODE_ENV!=="production");return a.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[a.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),a.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>n(r=>!r),children:t?"Hide Error":"Show Error"})]}),a.jsx("div",{style:{height:".25rem"}}),t?a.jsx("div",{children:a.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?a.jsx("code",{children:e.message}):null})}):null]})}function yl({children:e,fallback:t=null}){return xa()?a.jsx(P.Fragment,{children:e}):a.jsx(P.Fragment,{children:t})}function xa(){return P.useSyncExternalStore(vl,()=>!0,()=>!1)}function vl(){return()=>{}}var ba=S.createContext(null);function Ee(e){const t=S.useContext(ba);return process.env.NODE_ENV!=="production"&&(t||console.warn("Warning: useRouter must be used inside a <RouterProvider> component!")),t}var nr=S.createContext(void 0),wl=S.createContext(void 0),se=(e=>(e[e.None=0]="None",e[e.Mutable=1]="Mutable",e[e.Watching=2]="Watching",e[e.RecursedCheck=4]="RecursedCheck",e[e.Recursed=8]="Recursed",e[e.Dirty=16]="Dirty",e[e.Pending=32]="Pending",e))(se||{});function Sl({update:e,notify:t,unwatched:n}){return{link:r,unlink:s,propagate:o,checkDirty:i,shallowPropagate:c};function r(d,f,l){const h=f.depsTail;if(h!==void 0&&h.dep===d)return;const m=h!==void 0?h.nextDep:f.deps;if(m!==void 0&&m.dep===d){m.version=l,f.depsTail=m;return}const g=d.subsTail;if(g!==void 0&&g.version===l&&g.sub===f)return;const p=f.depsTail=d.subsTail={version:l,dep:d,sub:f,prevDep:h,nextDep:m,prevSub:g,nextSub:void 0};m!==void 0&&(m.prevDep=p),h!==void 0?h.nextDep=p:f.deps=p,g!==void 0?g.nextSub=p:d.subs=p}function s(d,f=d.sub){const l=d.dep,h=d.prevDep,m=d.nextDep,g=d.nextSub,p=d.prevSub;return m!==void 0?m.prevDep=h:f.depsTail=h,h!==void 0?h.nextDep=m:f.deps=m,g!==void 0?g.prevSub=p:l.subsTail=p,p!==void 0?p.nextSub=g:(l.subs=g)===void 0&&n(l),m}function o(d){let f=d.nextSub,l;e:do{const h=d.sub;let m=h.flags;if(m&60?m&12?m&4?!(m&48)&&u(d,h)?(h.flags=m|40,m&=1):m=0:h.flags=m&-9|32:m=0:h.flags=m|32,m&2&&t(h),m&1){const g=h.subs;if(g!==void 0){const p=(d=g).nextSub;p!==void 0&&(l={value:f,prev:l},f=p);continue}}if((d=f)!==void 0){f=d.nextSub;continue}for(;l!==void 0;)if(d=l.value,l=l.prev,d!==void 0){f=d.nextSub;continue e}break}while(!0)}function i(d,f){let l,h=0,m=!1;e:do{const g=d.dep,p=g.flags;if(f.flags&16)m=!0;else if((p&17)===17){if(e(g)){const x=g.subs;x.nextSub!==void 0&&c(x),m=!0}}else if((p&33)===33){(d.nextSub!==void 0||d.prevSub!==void 0)&&(l={value:d,prev:l}),d=g.deps,f=g,++h;continue}if(!m){const x=d.nextDep;if(x!==void 0){d=x;continue}}for(;h--;){const x=f.subs,b=x.nextSub!==void 0;if(b?(d=l.value,l=l.prev):d=x,m){if(e(f)){b&&c(x),f=d.sub;continue}m=!1}else f.flags&=-33;f=d.sub;const y=d.nextDep;if(y!==void 0){d=y;continue e}}return m}while(!0)}function c(d){do{const f=d.sub,l=f.flags;(l&48)===32&&(f.flags=l|16,(l&6)===2&&t(f))}while((d=d.nextSub)!==void 0)}function u(d,f){let l=f.depsTail;for(;l!==void 0;){if(l===d)return!0;l=l.prevDep}return!1}}function Rl(e,t,n){const r=typeof e=="object",s=r?e:void 0;return{next:(r?e.next:e)?.bind(s),error:(r?e.error:t)?.bind(s),complete:(r?e.complete:n)?.bind(s)}}const zr=[];let Ln=0;const{link:qs,unlink:Nl,propagate:Cl,checkDirty:ya,shallowPropagate:Gs}=Sl({update(e){return e._update()},notify(e){zr[Wr++]=e,e.flags&=~se.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=se.Mutable|se.Dirty,Hn(e))}});let gn=0,Wr=0,Ie,Vr=0;function va(e){try{++Vr,e()}finally{--Vr||wa()}}function Hn(e){const t=e.depsTail;let n=t!==void 0?t.nextDep:e.deps;for(;n!==void 0;)n=Nl(n,e)}function wa(){if(!(Vr>0)){for(;gn<Wr;){const e=zr[gn];zr[gn++]=void 0,e.notify()}gn=0,Wr=0}}function Ks(e,t){const n=typeof e=="function",r=e,s={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?se.None:se.Mutable,get(){return Ie!==void 0&&qs(s,Ie,Ln),s._snapshot},subscribe(o){const i=Rl(o),c={current:!1},u=jl(()=>{s.get(),c.current?i.next?.(s._snapshot):c.current=!0});return{unsubscribe:()=>{u.stop()}}},_update(o){const i=Ie,c=t?.compare??Object.is;if(n)Ie=s,++Ln,s.depsTail=void 0;else if(o===void 0)return!1;n&&(s.flags=se.Mutable|se.RecursedCheck);try{const u=s._snapshot,d=typeof o=="function"?o(u):o===void 0&&n?r(u):o;return u===void 0||!c(u,d)?(s._snapshot=d,!0):!1}finally{Ie=i,n&&(s.flags&=~se.RecursedCheck),Hn(s)}}};return n?(s.flags=se.Mutable|se.Dirty,s.get=function(){const o=s.flags;if(o&se.Dirty||o&se.Pending&&ya(s.deps,s)){if(s._update()){const i=s.subs;i!==void 0&&Gs(i)}}else o&se.Pending&&(s.flags=o&~se.Pending);return Ie!==void 0&&qs(s,Ie,Ln),s._snapshot}):s.set=function(o){if(s._update(o)){const i=s.subs;i!==void 0&&(Cl(i),Gs(i),wa())}},s}function jl(e){const t=()=>{const r=Ie;Ie=n,++Ln,n.depsTail=void 0,n.flags=se.Watching|se.RecursedCheck;try{return e()}finally{Ie=r,n.flags&=~se.RecursedCheck,Hn(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:se.Watching|se.RecursedCheck,notify(){const r=this.flags;r&se.Dirty||r&se.Pending&&ya(this.deps,this)?t():this.flags=se.Watching},stop(){this.flags=se.None,this.depsTail=void 0,Hn(this)}};return t(),n}var xn={exports:{}},br={},bn={exports:{}},yr={};var Ys;function El(){if(Ys)return yr;Ys=1;var e=P;function t(l,h){return l===h&&(l!==0||1/l===1/h)||l!==l&&h!==h}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,o=e.useLayoutEffect,i=e.useDebugValue;function c(l,h){var m=h(),g=r({inst:{value:m,getSnapshot:h}}),p=g[0].inst,x=g[1];return o(function(){p.value=m,p.getSnapshot=h,u(p)&&x({inst:p})},[l,m,h]),s(function(){return u(p)&&x({inst:p}),l(function(){u(p)&&x({inst:p})})},[l]),i(m),m}function u(l){var h=l.getSnapshot;l=l.value;try{var m=h();return!n(l,m)}catch{return!0}}function d(l,h){return h()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:c;return yr.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,yr}var vr={};var Js;function kl(){return Js||(Js=1,process.env.NODE_ENV!=="production"&&(function(){function e(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}function t(m,g){f||s.startTransition===void 0||(f=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var p=g();if(!l){var x=g();o(p,x)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),l=!0)}x=i({inst:{value:p,getSnapshot:g}});var b=x[0].inst,y=x[1];return u(function(){b.value=p,b.getSnapshot=g,n(b)&&y({inst:b})},[m,p,g]),c(function(){return n(b)&&y({inst:b}),m(function(){n(b)&&y({inst:b})})},[m]),d(p),p}function n(m){var g=m.getSnapshot;m=m.value;try{var p=g();return!o(m,p)}catch{return!0}}function r(m,g){return g()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=P,o=typeof Object.is=="function"?Object.is:e,i=s.useState,c=s.useEffect,u=s.useLayoutEffect,d=s.useDebugValue,f=!1,l=!1,h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;vr.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:h,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),vr}var Xs;function Sa(){return Xs||(Xs=1,process.env.NODE_ENV==="production"?bn.exports=El():bn.exports=kl()),bn.exports}var Zs;function _l(){if(Zs)return br;Zs=1;var e=P,t=Sa();function n(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var r=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,o=e.useRef,i=e.useEffect,c=e.useMemo,u=e.useDebugValue;return br.useSyncExternalStoreWithSelector=function(d,f,l,h,m){var g=o(null);if(g.current===null){var p={hasValue:!1,value:null};g.current=p}else p=g.current;g=c(function(){function b(k){if(!y){if(y=!0,v=k,k=h(k),m!==void 0&&p.hasValue){var C=p.value;if(m(C,k))return N=C}return N=k}if(C=N,r(v,k))return C;var R=h(k);return m!==void 0&&m(C,R)?(v=k,C):(v=k,N=R)}var y=!1,v,N,j=l===void 0?null:l;return[function(){return b(f())},j===null?void 0:function(){return b(j())}]},[f,l,h,m]);var x=s(d,g[0],g[1]);return i(function(){p.hasValue=!0,p.value=x},[x]),u(x),x},br}var wr={};var Qs;function Pl(){return Qs||(Qs=1,process.env.NODE_ENV!=="production"&&(function(){function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=P,n=Sa(),r=typeof Object.is=="function"?Object.is:e,s=n.useSyncExternalStore,o=t.useRef,i=t.useEffect,c=t.useMemo,u=t.useDebugValue;wr.useSyncExternalStoreWithSelector=function(d,f,l,h,m){var g=o(null);if(g.current===null){var p={hasValue:!1,value:null};g.current=p}else p=g.current;g=c(function(){function b(k){if(!y){if(y=!0,v=k,k=h(k),m!==void 0&&p.hasValue){var C=p.value;if(m(C,k))return N=C}return N=k}if(C=N,r(v,k))return C;var R=h(k);return m!==void 0&&m(C,R)?(v=k,C):(v=k,N=R)}var y=!1,v,N,j=l===void 0?null:l;return[function(){return b(f())},j===null?void 0:function(){return b(j())}]},[f,l,h,m]);var x=s(d,g[0],g[1]);return i(function(){p.hasValue=!0,p.value=x},[x]),u(x),x},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),wr}var eo;function Al(){return eo||(eo=1,process.env.NODE_ENV==="production"?xn.exports=_l():xn.exports=Pl()),xn.exports}var Ol=Al();function Tl(e,t){return e===t}function Ne(e,t,n=Tl){const r=P.useCallback(i=>{if(!e)return()=>{};const{unsubscribe:c}=e.subscribe(i);return c},[e]),s=P.useCallback(()=>e?.get(),[e]);return Ol.useSyncExternalStoreWithSelector(r,s,s,t,n)}var Sr={get(){},subscribe(){return{unsubscribe(){}}}};function Ll(e,t){const n=S.useRef();return r=>{const s=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=ot(n.current,s):s}}function xt(e){const t=Ee(),n=S.useContext(e.from?wl:nr),r=e.from?t.stores.getRouteMatchStore(e.from):t.stores.matchStores.get(n),s=Ll(e,t),o=Ne(r??Sr,i=>i?s(i):Sr);if(o!==Sr)return o;if(e.shouldThrow??!0){if(process.env.NODE_ENV!=="production")throw new Error(`Invariant failed: Could not find ${e.from?`an active match from "${e.from}"`:"a nearest match!"}`);Be()}}function Ra(e){return xt({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Na(e){const{select:t,...n}=e;return xt({...n,select:r=>t?t(r.loaderDeps):r.loaderDeps})}function Ca(e){return xt({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function ja(e){return xt({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Ea(e){const t=Ee();return S.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function ka(e){return xt({...e,select:t=>e.select?e.select(t.context):t.context})}function Il(e,t){const n=Ee(),r=gc(t),{activeProps:s,inactiveProps:o,activeOptions:i,to:c,preload:u,preloadDelay:d,preloadIntentProximity:f,hashScrollIntoView:l,replace:h,startTransition:m,resetScroll:g,viewTransition:p,children:x,target:b,disabled:y,style:v,className:N,onClick:j,onBlur:k,onFocus:C,onMouseEnter:R,onMouseLeave:_,onTouchStart:L,ignoreBlocker:A,params:D,search:O,hash:$,state:J,mask:Y,reloadDocument:Q,unsafeRelative:he,from:me,_fromLocation:I,...E}=e,B=xa(),q=S.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),K=Ne(n.stores.location,re=>re,(re,ve)=>re.href===ve.href),H=S.useMemo(()=>{const re={_fromLocation:K,...q};return n.buildLocation(re)},[n,K,q]),z=H.maskedLocation?H.maskedLocation.publicHref:H.publicHref,U=H.maskedLocation?H.maskedLocation.external:H.external,Z=S.useMemo(()=>Bl(z,U,n.history,y),[y,U,z,n.history]),V=S.useMemo(()=>{if(Z?.external){if(Bn(Z.href,n.protocolAllowlist)){process.env.NODE_ENV!=="production"&&console.warn(`Blocked Link with dangerous protocol: ${Z.href}`);return}return Z.href}if(!zl(c)&&!(typeof c!="string"||c.indexOf(":")===-1))try{if(new URL(c),Bn(c,n.protocolAllowlist)){process.env.NODE_ENV!=="production"&&console.warn(`Blocked Link with dangerous protocol: ${c}`);return}return c}catch{}},[c,Z,n.protocolAllowlist]),ie=S.useMemo(()=>{if(V)return!1;if(i?.exact){if(!Lc(K.pathname,H.pathname,n.basepath))return!1}else{const re=zn(K.pathname,n.basepath),ve=zn(H.pathname,n.basepath);if(!(re.startsWith(ve)&&(re.length===ve.length||re[ve.length]==="/")))return!1}return(i?.includeSearch??!0)&&!lt(K.search,H.search,{partial:!i?.exact,ignoreUndefined:!i?.explicitUndefined})?!1:i?.includeHash?B&&K.hash===H.hash:!0},[i?.exact,i?.explicitUndefined,i?.includeHash,i?.includeSearch,K,V,B,H.hash,H.pathname,H.search,n.basepath]),le=ie?st(s,{})??Ml:Rr,te=ie?Rr:st(o,{})??Rr,je=[N,le.className,te.className].filter(Boolean).join(" "),Ce=(v||le.style||te.style)&&{...v,...le.style,...te.style},[ke,W]=S.useState(!1),pe=S.useRef(!1),ye=e.reloadDocument||V?!1:u??n.options.defaultPreload,_e=d??n.options.defaultPreloadDelay??0,Te=S.useCallback(()=>{n.preloadRoute({...q,_builtLocation:H}).catch(re=>{console.warn(re),console.warn(gl)})},[n,q,H]);pc(r,S.useCallback(re=>{re?.isIntersecting&&Te()},[Te]),$l,{disabled:!!y||ye!=="viewport"}),S.useEffect(()=>{pe.current||!y&&ye==="render"&&(Te(),pe.current=!0)},[y,Te,ye]);const ur=re=>{const ve=re.currentTarget.getAttribute("target"),et=b!==void 0?b:ve;if(!y&&!Wl(re)&&!re.defaultPrevented&&(!et||et==="_self")&&re.button===0){re.preventDefault(),Zo.flushSync(()=>{W(!0)});const dc=n.subscribe("onResolved",()=>{dc(),W(!1)});n.navigate({...q,replace:h,resetScroll:g,hashScrollIntoView:l,startTransition:m,viewTransition:p,ignoreBlocker:A})}};if(V)return{...E,ref:r,href:V,...x&&{children:x},...b&&{target:b},...y&&{disabled:y},...v&&{style:v},...N&&{className:N},...j&&{onClick:j},...k&&{onBlur:k},...C&&{onFocus:C},...R&&{onMouseEnter:R},..._&&{onMouseLeave:_},...L&&{onTouchStart:L}};const Ve=re=>{if(y||ye!=="intent")return;if(!_e){Te();return}const ve=re.currentTarget;if(qt.has(ve))return;const et=setTimeout(()=>{qt.delete(ve),Te()},_e);qt.set(ve,et)},uc=re=>{y||ye!=="intent"||Te()},vs=re=>{if(y||!ye||!_e)return;const ve=re.currentTarget,et=qt.get(ve);et&&(clearTimeout(et),qt.delete(ve))};return{...E,...le,...te,href:Z?.href,ref:r,onClick:vt([j,ur]),onBlur:vt([k,vs]),onFocus:vt([C,Ve]),onMouseEnter:vt([R,Ve]),onMouseLeave:vt([_,vs]),onTouchStart:vt([L,uc]),disabled:!!y,target:b,...Ce&&{style:Ce},...je&&{className:je},...y&&Dl,...ie&&Fl,...B&&ke&&Ul}}var Rr={},Ml={className:"active"},Dl={role:"link","aria-disabled":!0},Fl={"data-status":"active","aria-current":"page"},Ul={"data-transitioning":"transitioning"},qt=new WeakMap,$l={rootMargin:"100px"},vt=e=>t=>{for(const n of e)if(n){if(t.defaultPrevented)return;n(t)}};function Bl(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||"/",external:!1}}function zl(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var qn=S.forwardRef((e,t)=>{const{_asChild:n,...r}=e,{type:s,...o}=Il(r,t),i=typeof r.children=="function"?r.children({isActive:o["data-status"]==="active"}):r.children;if(!n){const{disabled:c,...u}=o;return S.createElement("a",u,i)}return S.createElement(n,o,i)});function Wl(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var Vl=class extends ga{constructor(e){super(e),this.useMatch=t=>xt({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>ka({...t,from:this.id}),this.useSearch=t=>ja({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>Ca({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>Na({...t,from:this.id}),this.useLoaderData=t=>Ra({...t,from:this.id}),this.useNavigate=()=>Ea({from:this.fullPath}),this.Link=P.forwardRef((t,n)=>a.jsx(qn,{ref:n,from:this.fullPath,...t}))}};function an(e){return new Vl(e)}var Hl=class extends xl{constructor(e){super(e),this.useMatch=t=>xt({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>ka({...t,from:this.id}),this.useSearch=t=>ja({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>Ca({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>Na({...t,from:this.id}),this.useLoaderData=t=>Ra({...t,from:this.id}),this.useNavigate=()=>Ea({from:this.fullPath}),this.Link=P.forwardRef((t,n)=>a.jsx(qn,{ref:n,from:this.fullPath,...t}))}};function ql(e){return new Hl(e)}function Gl(e){const t=Ee(),n=`not-found-${Ne(t.stores.location,r=>r.pathname)}-${Ne(t.stores.status,r=>r)}`;return a.jsx(rs,{getResetKey:()=>n,onCatch:(r,s)=>{if(xe(r))e.onCatch?.(r,s);else throw r},errorComponent:({error:r})=>{if(xe(r))return e.fallback?.(r);throw r},children:e.children})}function Kl(){return a.jsx("p",{children:"Not Found"})}function kt(e){return a.jsx(a.Fragment,{children:e.children})}function _a(e,t,n){return t.options.notFoundComponent?a.jsx(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?a.jsx(e.options.defaultNotFoundComponent,{...n}):(process.env.NODE_ENV!=="production"&&(t.options.notFoundComponent||console.warn(`Warning: A notFoundError was encountered on the route with ID "${t.id}", but a notFoundComponent option was not configured, nor was a router level defaultNotFoundComponent configured. Consider configuring at least one of these to avoid TanStack Router's overly generic defaultNotFoundComponent (<p>Not Found</p>)`)),a.jsx(Kl,{}))}function Yl(e){return null}function Jl(){return Yl(Ee()),null}var Xl=(e,t)=>e.routeId===t.routeId&&e._displayPending===t._displayPending,Zl=(e,t)=>e[0]===t[0]&&e[1]===t[1],Pa=S.memo(function({matchId:t}){const n=Ee(),r=n.stores.matchStores.get(t);if(!r){if(process.env.NODE_ENV!=="production")throw new Error(`Invariant failed: Could not find match for matchId "${t}". Please file an issue!`);Be()}const s=Ne(n.stores.loadedAt,i=>i),o=Ne(r,i=>i,Xl);return a.jsx(Ql,{router:n,matchId:t,resetKey:s,matchState:S.useMemo(()=>{const i=o.routeId,c=n.routesById[i].parentRoute?.id;return{routeId:i,ssr:o.ssr,_displayPending:o._displayPending,parentRouteId:c}},[o._displayPending,o.routeId,o.ssr,n.routesById])})});function Ql({router:e,matchId:t,resetKey:n,matchState:r}){const s=e.routesById[r.routeId],o=s.options.pendingComponent??e.options.defaultPendingComponent,i=o?a.jsx(o,{}):null,c=s.options.errorComponent??e.options.defaultErrorComponent,u=s.options.onCatch??e.options.defaultOnCatch,d=s.isRoot?s.options.notFoundComponent??e.options.notFoundRoute?.options.component:s.options.notFoundComponent,f=r.ssr===!1||r.ssr==="data-only",l=(!s.isRoot||s.options.wrapInSuspense||f)&&(s.options.wrapInSuspense??o??(s.options.errorComponent?.preload||f))?S.Suspense:kt,h=c?rs:kt,m=d?Gl:kt;return a.jsxs(s.isRoot?s.options.shellComponent??kt:kt,{children:[a.jsx(nr.Provider,{value:t,children:a.jsx(l,{fallback:i,children:a.jsx(h,{getResetKey:()=>n,errorComponent:c||ss,onCatch:(g,p)=>{if(xe(g))throw g.routeId??=r.routeId,g;process.env.NODE_ENV!=="production"&&console.warn(`Warning: Error in route match: ${t}`),u?.(g,p)},children:a.jsx(m,{fallback:g=>{if(g.routeId??=r.routeId,!d||g.routeId&&g.routeId!==r.routeId||!g.routeId&&!s.isRoot)throw g;return S.createElement(d,g)},children:f||r._displayPending?a.jsx(yl,{fallback:i,children:a.jsx(to,{matchId:t})}):a.jsx(to,{matchId:t})})})})}),r.parentRouteId===ut?a.jsxs(a.Fragment,{children:[a.jsx(eu,{}),e.options.scrollRestoration&&ta?a.jsx(Jl,{}):null]}):null]})}function eu(){const e=Ee(),t=S.useRef();return Zt(()=>{const n=e.stores.resolvedLocation.get(),r=t.current;n&&(!r||r.href!==n.href)&&e.emit({type:"onRendered",..._t(e.stores.location.get(),r??n)}),t.current=n},[Ne(e.stores.resolvedLocation,n=>n?.state.__TSR_key),e]),null}var to=S.memo(function({matchId:t}){const n=Ee(),r=(f,l)=>n.getMatch(f.id)?._nonReactive[l]??f._nonReactive[l],s=n.stores.matchStores.get(t);if(!s){if(process.env.NODE_ENV!=="production")throw new Error(`Invariant failed: Could not find match for matchId "${t}". Please file an issue!`);Be()}const o=Ne(s,f=>f),i=o.routeId,c=n.routesById[i],u=S.useMemo(()=>{const f=(n.routesById[i].options.remountDeps??n.options.defaultRemountDeps)?.({routeId:i,loaderDeps:o.loaderDeps,params:o._strictParams,search:o._strictSearch});return f?JSON.stringify(f):void 0},[i,o.loaderDeps,o._strictParams,o._strictSearch,n.options.defaultRemountDeps,n.routesById]),d=S.useMemo(()=>{const f=c.options.component??n.options.defaultComponent;return f?a.jsx(f,{},u):a.jsx(Aa,{})},[u,c.options.component,n.options.defaultComponent]);if(o._displayPending)throw r(o,"displayPendingPromise");if(o._forcePending)throw r(o,"minPendingPromise");if(o.status==="pending"){const f=c.options.pendingMinMs??n.options.defaultPendingMinMs;if(f){const l=n.getMatch(o.id);if(l&&!l._nonReactive.minPendingPromise){const h=At();l._nonReactive.minPendingPromise=h,setTimeout(()=>{h.resolve(),l._nonReactive.minPendingPromise=void 0},f)}}throw r(o,"loadPromise")}if(o.status==="notFound"){if(!xe(o.error)){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Expected a notFound error");Be()}return _a(n,c,o.error)}if(o.status==="redirected"){if(!we(o.error)){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Expected a redirect error");Be()}throw r(o,"loadPromise")}if(o.status==="error")throw o.error;return d}),Aa=S.memo(function(){const t=Ee(),n=S.useContext(nr);let r,s=!1,o;{const d=n?t.stores.matchStores.get(n):void 0;[r,s]=Ne(d,f=>[f?.routeId,f?.globalNotFound??!1],Zl),o=Ne(t.stores.matchesId,f=>f[f.findIndex(l=>l===n)+1])}const i=r?t.routesById[r]:void 0,c=t.options.defaultPendingComponent?a.jsx(t.options.defaultPendingComponent,{}):null;if(s){if(!i){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Could not resolve route for Outlet render");Be()}return _a(t,i,void 0)}if(!o)return null;const u=a.jsx(Pa,{matchId:o});return r===ut?a.jsx(S.Suspense,{fallback:c,children:u}):u});function tu(){const e=Ee(),t=S.useRef({router:e,mounted:!1}),[n,r]=S.useState(!1),s=Ne(e.stores.isLoading,l=>l),o=Ne(e.stores.hasPending,l=>l),i=dr(s),c=s||n||o,u=dr(c),d=s||o,f=dr(d);return e.startTransition=l=>{r(!0),S.startTransition(()=>{l(),r(!1)})},S.useEffect(()=>{const l=e.history.subscribe(e.load),h=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return $e(e.latestLocation.publicHref)!==$e(h.publicHref)&&e.commitLocation({...h,replace:!0}),()=>{l()}},[e,e.history]),Zt(()=>{if(typeof window<"u"&&e.ssr||t.current.router===e&&t.current.mounted)return;t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(h){console.error(h)}})()},[e]),Zt(()=>{i&&!s&&e.emit({type:"onLoad",..._t(e.stores.location.get(),e.stores.resolvedLocation.get())})},[i,e,s]),Zt(()=>{f&&!d&&e.emit({type:"onBeforeRouteMount",..._t(e.stores.location.get(),e.stores.resolvedLocation.get())})},[d,f,e]),Zt(()=>{if(u&&!c){const l=_t(e.stores.location.get(),e.stores.resolvedLocation.get());e.emit({type:"onResolved",...l}),va(()=>{e.stores.status.set("idle"),e.stores.resolvedLocation.set(e.stores.location.get())})}},[c,u,e]),null}function nu(){const e=Ee(),t=e.routesById[ut].options.pendingComponent??e.options.defaultPendingComponent,n=t?a.jsx(t,{}):null,r=a.jsxs(typeof document<"u"&&e.ssr?kt:S.Suspense,{fallback:n,children:[a.jsx(tu,{}),a.jsx(ru,{})]});return e.options.InnerWrap?a.jsx(e.options.InnerWrap,{children:r}):r}function ru(){const e=Ee(),t=Ne(e.stores.firstId,s=>s),n=Ne(e.stores.loadedAt,s=>s),r=t?a.jsx(Pa,{matchId:t}):null;return a.jsx(nr.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:a.jsx(rs,{getResetKey:()=>n,errorComponent:ss,onCatch:process.env.NODE_ENV!=="production"?s=>{console.warn("Warning: The following error wasn't caught by any route! At the very least, consider setting an 'errorComponent' in your RootRoute!"),console.warn(`Warning: ${s.message||s.toString()}`)}:void 0,children:r})})}var su=e=>({createMutableStore:Ks,createReadonlyStore:Ks,batch:va}),Oa=e=>new ou(e),ou=class extends nl{constructor(e){super(e,su)}};function au({router:e,children:t,...n}){ra(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});const r=a.jsx(ba.Provider,{value:e,children:t});return e.options.Wrap?a.jsx(e.options.Wrap,{children:r}):r}function iu({router:e,...t}){return a.jsx(au,{router:e,...t,children:a.jsx(nu,{})})}function Ta(e,t){return function(){return e.apply(t,arguments)}}const{toString:cu}=Object.prototype,{getPrototypeOf:Ot}=Object,{iterator:cn,toStringTag:La}=Symbol,Gn=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),rn=(e,t)=>{let n=e;const r=[];for(;n!=null&&n!==Object.prototype;){if(r.indexOf(n)!==-1)return!1;if(r.push(n),Gn(n,t))return!0;n=Ot(n)}return!1},lu=(e,t)=>e!=null&&rn(e,t)?e[t]:void 0,os=(e=>t=>{const n=cu.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Ae=e=>(e=e.toLowerCase(),t=>os(t)===e),rr=e=>t=>typeof t===e,{isArray:pt}=Array,Tt=rr("undefined");function Dt(e){return e!==null&&!Tt(e)&&e.constructor!==null&&!Tt(e.constructor)&&Se(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Ia=Ae("ArrayBuffer");function uu(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Ia(e.buffer),t}const du=rr("string"),Se=rr("function"),Ma=rr("number"),Ft=e=>e!==null&&typeof e=="object",fu=e=>e===!0||e===!1,In=e=>{if(!Ft(e))return!1;const t=Ot(e);return(t===null||t===Object.prototype||Ot(t)===null)&&!rn(e,La)&&!rn(e,cn)},hu=e=>{if(!Ft(e)||Dt(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},mu=Ae("Date"),pu=Ae("File"),gu=e=>!!(e&&typeof e.uri<"u"),xu=e=>e&&typeof e.getParts<"u",bu=Ae("Blob"),yu=Ae("FileList"),vu=e=>Ft(e)&&Se(e.pipe);function wu(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const no=wu(),ro=typeof no.FormData<"u"?no.FormData:void 0,Su=e=>{if(!e)return!1;if(ro&&e instanceof ro)return!0;const t=Ot(e);if(!t||t===Object.prototype||!Se(e.append))return!1;const n=os(e);return n==="formdata"||n==="object"&&Se(e.toString)&&e.toString()==="[object FormData]"},Ru=Ae("URLSearchParams"),[Nu,Cu,ju,Eu]=["ReadableStream","Request","Response","Headers"].map(Ae),ku=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ln(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),pt(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(Dt(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let c;for(r=0;r<i;r++)c=o[r],t.call(null,e[c],c,e)}}function Da(e,t){if(Dt(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const it=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Fa=e=>!Tt(e)&&e!==it;function Hr(...e){const{caseless:t,skipUndefined:n}=Fa(this)&&this||{},r={},s=(o,i)=>{if(i==="__proto__"||i==="constructor"||i==="prototype")return;const c=t&&typeof i=="string"&&Da(r,i)||i,u=Gn(r,c)?r[c]:void 0;In(u)&&In(o)?r[c]=Hr(u,o):In(o)?r[c]=Hr({},o):pt(o)?r[c]=o.slice():(!n||!Tt(o))&&(r[c]=o)};for(let o=0,i=e.length;o<i;o++){const c=e[o];if(!c||Dt(c)||(ln(c,s),typeof c!="object"||pt(c)))continue;const u=Object.getOwnPropertySymbols(c);for(let d=0;d<u.length;d++){const f=u[d];$u.call(c,f)&&s(c[f],f)}}return r}const _u=(e,t,n,{allOwnKeys:r}={})=>(ln(t,(s,o)=>{n&&Se(s)?Object.defineProperty(e,o,{__proto__:null,value:Ta(s,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,o,{__proto__:null,value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),Pu=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Au=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},Ou=(e,t,n,r)=>{let s,o,i;const c={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],(!r||r(i,e,t))&&!c[i]&&(t[i]=e[i],c[i]=!0);e=n!==!1&&Ot(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Tu=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},Lu=e=>{if(!e)return null;if(pt(e))return e;let t=e.length;if(!Ma(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Iu=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Ot(Uint8Array)),Mu=(e,t)=>{const r=(e&&e[cn]).call(e);let s;for(;(s=r.next())&&!s.done;){const o=s.value;t.call(e,o[0],o[1])}},Du=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Fu=Ae("HTMLFormElement"),Uu=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),{propertyIsEnumerable:$u}=Object.prototype,Bu=Ae("RegExp"),Ua=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};ln(n,(s,o)=>{let i;(i=t(s,o,e))!==!1&&(r[o]=i||s)}),Object.defineProperties(e,r)},zu=e=>{Ua(e,(t,n)=>{if(Se(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];if(Se(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Wu=(e,t)=>{const n={},r=s=>{s.forEach(o=>{n[o]=!0})};return pt(e)?r(e):r(String(e).split(t)),n},Vu=()=>{},Hu=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function qu(e){return!!(e&&Se(e.append)&&e[La]==="FormData"&&e[cn])}const Gu=e=>{const t=new WeakSet,n=r=>{if(Ft(r)){if(t.has(r))return;if(Dt(r))return r;if(!("toJSON"in r)){t.add(r);const s=pt(r)?[]:{};return ln(r,(o,i)=>{const c=n(o);!Tt(c)&&(s[i]=c)}),t.delete(r),s}}return r};return n(e)},Ku=Ae("AsyncFunction"),Yu=e=>e&&(Ft(e)||Se(e))&&Se(e.then)&&Se(e.catch),$a=((e,t)=>e?setImmediate:t?((n,r)=>(it.addEventListener("message",({source:s,data:o})=>{s===it&&o===n&&r.length&&r.shift()()},!1),s=>{r.push(s),it.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Se(it.postMessage)),Ju=typeof queueMicrotask<"u"?queueMicrotask.bind(it):typeof process<"u"&&process.nextTick||$a,Ba=e=>e!=null&&Se(e[cn]),Xu=e=>e!=null&&rn(e,cn)&&Ba(e),w={isArray:pt,isArrayBuffer:Ia,isBuffer:Dt,isFormData:Su,isArrayBufferView:uu,isString:du,isNumber:Ma,isBoolean:fu,isObject:Ft,isPlainObject:In,isEmptyObject:hu,isReadableStream:Nu,isRequest:Cu,isResponse:ju,isHeaders:Eu,isUndefined:Tt,isDate:mu,isFile:pu,isReactNativeBlob:gu,isReactNative:xu,isBlob:bu,isRegExp:Bu,isFunction:Se,isStream:vu,isURLSearchParams:Ru,isTypedArray:Iu,isFileList:yu,forEach:ln,merge:Hr,extend:_u,trim:ku,stripBOM:Pu,inherits:Au,toFlatObject:Ou,kindOf:os,kindOfTest:Ae,endsWith:Tu,toArray:Lu,forEachEntry:Mu,matchAll:Du,isHTMLForm:Fu,hasOwnProperty:Gn,hasOwnProp:Gn,hasOwnInPrototypeChain:rn,getSafeProp:lu,reduceDescriptors:Ua,freezeMethods:zu,toObjectSet:Wu,toCamelCase:Uu,noop:Vu,toFiniteNumber:Hu,findKey:Da,global:it,isContextDefined:Fa,isSpecCompliantForm:qu,toJSONObject:Gu,isAsyncFn:Ku,isThenable:Yu,setImmediate:$a,asap:Ju,isIterable:Ba,isSafeIterable:Xu},Zu=w.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Qu=e=>{const t={};let n,r,s;return e&&e.split(`
7
- `).forEach(function(i){s=i.indexOf(":"),n=i.substring(0,s).trim().toLowerCase(),r=i.substring(s+1).trim(),!(!n||t[n]&&Zu[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t};function ed(e){let t=0,n=e.length;for(;t<n;){const r=e.charCodeAt(t);if(r!==9&&r!==32)break;t+=1}for(;n>t;){const r=e.charCodeAt(n-1);if(r!==9&&r!==32)break;n-=1}return t===0&&n===e.length?e:e.slice(t,n)}const td=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),nd=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function as(e,t){return w.isArray(e)?e.map(n=>as(n,t)):ed(String(e).replace(t,""))}const rd=e=>as(e,td),sd=e=>as(e,nd);function za(e){const t=Object.create(null);return w.forEach(e.toJSON(),(n,r)=>{t[r]=sd(n)}),t}const so=Symbol("internals");function Gt(e){return e&&String(e).trim().toLowerCase()}function Mn(e){return e===!1||e==null?e:w.isArray(e)?e.map(Mn):rd(String(e))}function od(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const ad=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Nr(e,t,n,r,s){if(w.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!w.isString(t)){if(w.isString(r))return t.indexOf(r)!==-1;if(w.isRegExp(r))return r.test(t)}}function id(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function cd(e,t){const n=w.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{__proto__:null,value:function(s,o,i){return this[r].call(this,t,s,o,i)},configurable:!0})})}let be=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function o(c,u,d){const f=Gt(u);if(!f)return;const l=w.findKey(s,f);(!l||s[l]===void 0||d===!0||d===void 0&&s[l]!==!1)&&(s[l||u]=Mn(c))}const i=(c,u)=>w.forEach(c,(d,f)=>o(d,f,u));if(w.isPlainObject(t)||t instanceof this.constructor)i(t,n);else if(w.isString(t)&&(t=t.trim())&&!ad(t))i(Qu(t),n);else if(w.isObject(t)&&w.isSafeIterable(t)){let c=Object.create(null),u,d;for(const f of t){if(!w.isArray(f))throw new TypeError("Object iterator must return a key-value pair");d=f[0],w.hasOwnProp(c,d)?(u=c[d],c[d]=w.isArray(u)?[...u,f[1]]:[u,f[1]]):c[d]=f[1]}i(c,n)}else t!=null&&o(n,t,r);return this}get(t,n){if(t=Gt(t),t){const r=w.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return od(s);if(w.isFunction(n))return n.call(this,s,r);if(w.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Gt(t),t){const r=w.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||Nr(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function o(i){if(i=Gt(i),i){const c=w.findKey(r,i);c&&(!n||Nr(r,r[c],c,n))&&(delete r[c],s=!0)}}return w.isArray(t)?t.forEach(o):o(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const o=n[r];(!t||Nr(this,this[o],o,t,!0))&&(delete this[o],s=!0)}return s}normalize(t){const n=this,r={};return w.forEach(this,(s,o)=>{const i=w.findKey(r,o);if(i){n[i]=Mn(s),delete n[o];return}const c=t?id(o):String(o).trim();c!==o&&delete n[o],n[c]=Mn(s),r[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return w.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&w.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
8
- `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[so]=this[so]={accessors:{}}).accessors,s=this.prototype;function o(i){const c=Gt(i);r[c]||(cd(s,i),r[c]=!0)}return w.isArray(t)?t.forEach(o):o(t),this}};be.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);w.reduceDescriptors(be.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});w.freezeMethods(be);const ld="[REDACTED ****]";function ud(e){if(w.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(w.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function dd(e,t){const n=new Set(t.map(o=>String(o).toLowerCase())),r=[],s=o=>{if(o===null||typeof o!="object"||w.isBuffer(o))return o;if(r.indexOf(o)!==-1)return;o instanceof be&&(o=o.toJSON()),r.push(o);let i;if(w.isArray(o))i=[],o.forEach((c,u)=>{const d=s(c);w.isUndefined(d)||(i[u]=d)});else{if(!w.isPlainObject(o)&&ud(o))return r.pop(),o;i=Object.create(null);for(const[c,u]of Object.entries(o)){const d=n.has(c.toLowerCase())?ld:s(u);w.isUndefined(d)||(i[c]=d)}}return r.pop(),i};return s(e)}let T=class Wa extends Error{static from(t,n,r,s,o,i){const c=new Wa(t.message,n||t.code,r,s,o);return Object.defineProperty(c,"cause",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),c.name=t.name,t.status!=null&&c.status==null&&(c.status=t.status),i&&Object.assign(c,i),c}constructor(t,n,r,s,o){super(t),Object.defineProperty(this,"message",{__proto__:null,value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),r&&(this.config=r),s&&(this.request=s),o&&(this.response=o,this.status=o.status)}toJSON(){const t=this.config,n=t&&w.hasOwnProp(t,"redact")?t.redact:void 0,r=w.isArray(n)&&n.length>0?dd(t,n):w.toJSONObject(t);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:r,code:this.code,status:this.status}}};T.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";T.ERR_BAD_OPTION="ERR_BAD_OPTION";T.ECONNABORTED="ECONNABORTED";T.ETIMEDOUT="ETIMEDOUT";T.ECONNREFUSED="ECONNREFUSED";T.ERR_NETWORK="ERR_NETWORK";T.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";T.ERR_DEPRECATED="ERR_DEPRECATED";T.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";T.ERR_BAD_REQUEST="ERR_BAD_REQUEST";T.ERR_CANCELED="ERR_CANCELED";T.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";T.ERR_INVALID_URL="ERR_INVALID_URL";T.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const fd=null,Va=100;function qr(e){return w.isPlainObject(e)||w.isArray(e)}function Ha(e){return w.endsWith(e,"[]")?e.slice(0,-2):e}function Cr(e,t,n){return e?e.concat(t).map(function(s,o){return s=Ha(s),!n&&o?"["+s+"]":s}).join(n?".":""):t}function hd(e){return w.isArray(e)&&!e.some(qr)}const md=w.toFlatObject(w,{},null,function(t){return/^is[A-Z]/.test(t)});function sr(e,t,n){if(!w.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=w.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,v){return!w.isUndefined(v[y])});const r=n.metaTokens,s=n.visitor||g,o=n.dots,i=n.indexes,c=n.Blob||typeof Blob<"u"&&Blob,u=n.maxDepth===void 0?Va:n.maxDepth,d=c&&w.isSpecCompliantForm(t),f=[];if(!w.isFunction(s))throw new TypeError("visitor must be a function");function l(b){if(b===null)return"";if(w.isDate(b))return b.toISOString();if(w.isBoolean(b))return b.toString();if(!d&&w.isBlob(b))throw new T("Blob is not supported. Use a Buffer instead.");if(w.isArrayBuffer(b)||w.isTypedArray(b)){if(d&&typeof c=="function")return new c([b]);if(typeof Buffer<"u")return Buffer.from(b);throw new T("Blob is not supported. Use a Buffer instead.",T.ERR_NOT_SUPPORT)}return b}function h(b){if(b>u)throw new T("Object is too deeply nested ("+b+" levels). Max depth: "+u,T.ERR_FORM_DATA_DEPTH_EXCEEDED)}function m(b,y){if(u===1/0)return JSON.stringify(b);const v=[];return JSON.stringify(b,function(j,k){if(!w.isObject(k))return k;for(;v.length&&v[v.length-1]!==this;)v.pop();return v.push(k),h(y+v.length-1),k})}function g(b,y,v){let N=b;if(w.isReactNative(t)&&w.isReactNativeBlob(b))return t.append(Cr(v,y,o),l(b)),!1;if(b&&!v&&typeof b=="object"){if(w.endsWith(y,"{}"))y=r?y:y.slice(0,-2),b=m(b,1);else if(w.isArray(b)&&hd(b)||(w.isFileList(b)||w.endsWith(y,"[]"))&&(N=w.toArray(b)))return y=Ha(y),N.forEach(function(k,C){!(w.isUndefined(k)||k===null)&&t.append(i===!0?Cr([y],C,o):i===null?y:y+"[]",l(k))}),!1}return qr(b)?!0:(t.append(Cr(v,y,o),l(b)),!1)}const p=Object.assign(md,{defaultVisitor:g,convertValue:l,isVisitable:qr});function x(b,y,v=0){if(!w.isUndefined(b)){if(h(v),f.indexOf(b)!==-1)throw new Error("Circular reference detected in "+y.join("."));f.push(b),w.forEach(b,function(j,k){(!(w.isUndefined(j)||j===null)&&s.call(t,j,w.isString(k)?k.trim():k,y,p))===!0&&x(j,y?y.concat(k):[k],v+1)}),f.pop()}}if(!w.isObject(e))throw new TypeError("data must be an object");return x(e),t}function oo(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(r){return t[r]})}function is(e,t){this._pairs=[],e&&sr(e,this,t)}const qa=is.prototype;qa.append=function(t,n){this._pairs.push([t,n])};qa.toString=function(t){const n=t?r=>t.call(this,r,oo):oo;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function pd(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ga(e,t,n){if(!t)return e;e=e||"";const r=w.isFunction(n)?{serialize:n}:n,s=w.getSafeProp(r,"encode")||pd,o=w.getSafeProp(r,"serialize");let i;if(o?i=o(t,r):i=w.isURLSearchParams(t)?t.toString():new is(t,r).toString(s),i){const c=e.indexOf("#");c!==-1&&(e=e.slice(0,c)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class ao{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){w.forEach(this.handlers,function(r){r!==null&&t(r)})}}const cs={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},gd=typeof URLSearchParams<"u"?URLSearchParams:is,xd=typeof FormData<"u"?FormData:null,bd=typeof Blob<"u"?Blob:null,yd={isBrowser:!0,classes:{URLSearchParams:gd,FormData:xd,Blob:bd},protocols:["http","https","file","blob","url","data"]},ls=typeof window<"u"&&typeof document<"u",Gr=typeof navigator=="object"&&navigator||void 0,vd=ls&&(!Gr||["ReactNative","NativeScript","NS"].indexOf(Gr.product)<0),wd=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Sd=ls&&window.location.href||"http://localhost",Rd=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:ls,hasStandardBrowserEnv:vd,hasStandardBrowserWebWorkerEnv:wd,navigator:Gr,origin:Sd},Symbol.toStringTag,{value:"Module"})),fe={...Rd,...yd};function Nd(e,t){return sr(e,new fe.classes.URLSearchParams,{visitor:function(n,r,s,o){return fe.isNode&&w.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}const io=Va;function Ka(e){if(e>io)throw new T("FormData field is too deeply nested ("+e+" levels). Max depth: "+io,T.ERR_FORM_DATA_DEPTH_EXCEEDED)}function Cd(e){const t=[],n=/\w+|\[(\w*)]/g;let r;for(;(r=n.exec(e))!==null;)Ka(t.length),t.push(r[0]==="[]"?"":r[1]||r[0]);return t}function jd(e){const t={},n=Object.keys(e);let r;const s=n.length;let o;for(r=0;r<s;r++)o=n[r],t[o]=e[o];return t}function Ya(e){function t(n,r,s,o){Ka(o);let i=n[o++];if(i==="__proto__")return!0;const c=Number.isFinite(+i),u=o>=n.length;return i=!i&&w.isArray(s)?s.length:i,u?(w.hasOwnProp(s,i)?s[i]=w.isArray(s[i])?s[i].concat(r):[s[i],r]:s[i]=r,!c):((!w.hasOwnProp(s,i)||!w.isObject(s[i]))&&(s[i]=[]),t(n,r,s[i],o)&&w.isArray(s[i])&&(s[i]=jd(s[i])),!c)}if(w.isFormData(e)&&w.isFunction(e.entries)){const n={};return w.forEachEntry(e,(r,s)=>{t(Cd(r),s,n,0)}),n}return null}const wt=(e,t)=>e!=null&&w.hasOwnProp(e,t)?e[t]:void 0;function Ed(e,t,n){if(w.isString(e))try{return(t||JSON.parse)(e),w.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const un={transitional:cs,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,o=w.isObject(t);if(o&&w.isHTMLForm(t)&&(t=new FormData(t)),w.isFormData(t))return s?JSON.stringify(Ya(t)):t;if(w.isArrayBuffer(t)||w.isBuffer(t)||w.isStream(t)||w.isFile(t)||w.isBlob(t)||w.isReadableStream(t))return t;if(w.isArrayBufferView(t))return t.buffer;if(w.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(o){const u=wt(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return Nd(t,u).toString();if((c=w.isFileList(t))||r.indexOf("multipart/form-data")>-1){const d=wt(this,"env"),f=d&&d.FormData;return sr(c?{"files[]":t}:t,f&&new f,u)}}return o||s?(n.setContentType("application/json",!1),Ed(t)):t}],transformResponse:[function(t){const n=wt(this,"transitional")||un.transitional,r=n&&n.forcedJSONParsing,s=wt(this,"responseType"),o=s==="json";if(w.isResponse(t)||w.isReadableStream(t))return t;if(t&&w.isString(t)&&(r&&!s||o)){const c=!(n&&n.silentJSONParsing)&&o;try{return JSON.parse(t,wt(this,"parseReviver"))}catch(u){if(c)throw u.name==="SyntaxError"?T.from(u,T.ERR_BAD_RESPONSE,this,null,wt(this,"response")):u}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:fe.classes.FormData,Blob:fe.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};w.forEach(["delete","get","head","post","put","patch","query"],e=>{un.headers[e]={}});function jr(e,t){const n=this||un,r=t||n,s=be.from(r.headers);let o=r.data;return w.forEach(e,function(c){o=c.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function Ja(e){return!!(e&&e.__CANCEL__)}let dn=class extends T{constructor(t,n,r){super(t??"canceled",T.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function Xa(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new T("Request failed with status code "+n.status,n.status>=400&&n.status<500?T.ERR_BAD_REQUEST:T.ERR_BAD_RESPONSE,n.config,n.request,n))}function kd(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function _d(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,o=0,i;return t=t!==void 0?t:1e3,function(u){const d=Date.now(),f=r[o];i||(i=d),n[s]=u,r[s]=d;let l=o,h=0;for(;l!==s;)h+=n[l++],l=l%e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),d-i<t)return;const m=f&&d-f;return m?Math.round(h*1e3/m):void 0}}function Pd(e,t){let n=0,r=1e3/t,s,o;const i=(d,f=Date.now())=>{n=f,s=null,o&&(clearTimeout(o),o=null),e(...d)};return[(...d)=>{const f=Date.now(),l=f-n;l>=r?i(d,f):(s=d,o||(o=setTimeout(()=>{o=null,i(s)},r-l)))},()=>s&&i(s)]}const Kn=(e,t,n=3)=>{let r=0;const s=_d(50,250);return Pd(o=>{if(!o||typeof o.loaded!="number")return;const i=o.loaded,c=o.lengthComputable?o.total:void 0,u=c!=null?Math.min(i,c):i,d=Math.max(0,u-r),f=s(d);r=Math.max(r,u);const l={loaded:u,total:c,progress:c?u/c:void 0,bytes:d,rate:f||void 0,estimated:f&&c?(c-u)/f:void 0,event:o,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(l)},n)},co=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},lo=e=>(...t)=>w.asap(()=>e(...t)),Ad=fe.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,fe.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(fe.origin),fe.navigator&&/(msie|trident)/i.test(fe.navigator.userAgent)):()=>!0,Od=fe.hasStandardBrowserEnv?{write(e,t,n,r,s,o,i){if(typeof document>"u")return;const c=[`${e}=${encodeURIComponent(t)}`];w.isNumber(n)&&c.push(`expires=${new Date(n).toUTCString()}`),w.isString(r)&&c.push(`path=${r}`),w.isString(s)&&c.push(`domain=${s}`),o===!0&&c.push("secure"),w.isString(i)&&c.push(`SameSite=${i}`),document.cookie=c.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.split(";");for(let n=0;n<t.length;n++){const r=t[n].replace(/^\s+/,""),s=r.indexOf("=");if(s!==-1&&r.slice(0,s)===e)try{return decodeURIComponent(r.slice(s+1))}catch{return r.slice(s+1)}}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Td(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Ld(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const Id=/^https?:(?!\/\/)/i,Md=/[\t\n\r]/g;function Dd(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function Fd(e){return Dd(e).replace(Md,"")}function uo(e,t){if(typeof e=="string"&&Id.test(Fd(e)))throw new T('Invalid URL: missing "//" after protocol',T.ERR_INVALID_URL,t)}function Za(e,t,n,r){uo(t,r);let s=!Td(t);return e&&(s||n===!1)?(uo(e,r),Ld(e,t)):t}const fo=e=>e instanceof be?{...e}:e;function gt(e,t){e=e||{},t=t||{};const n=Object.create(null);Object.defineProperty(n,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function r(f,l,h,m){return w.isPlainObject(f)&&w.isPlainObject(l)?w.merge.call({caseless:m},f,l):w.isPlainObject(l)?w.merge({},l):w.isArray(l)?l.slice():l}function s(f,l,h,m){if(w.isUndefined(l)){if(!w.isUndefined(f))return r(void 0,f,h,m)}else return r(f,l,h,m)}function o(f,l){if(!w.isUndefined(l))return r(void 0,l)}function i(f,l){if(w.isUndefined(l)){if(!w.isUndefined(f))return r(void 0,f)}else return r(void 0,l)}function c(f){const l=w.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!w.isUndefined(l))if(w.isPlainObject(l)){if(w.hasOwnProp(l,f))return l[f]}else return;const h=w.hasOwnProp(e,"transitional")?e.transitional:void 0;if(w.isPlainObject(h)&&w.hasOwnProp(h,f))return h[f]}function u(f,l,h){if(w.hasOwnProp(t,h))return r(f,l);if(w.hasOwnProp(e,h))return r(void 0,f)}const d={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,allowedSocketPaths:i,responseEncoding:i,validateStatus:u,headers:(f,l,h)=>s(fo(f),fo(l),h,!0)};return w.forEach(Object.keys({...e,...t}),function(l){if(l==="__proto__"||l==="constructor"||l==="prototype")return;const h=w.hasOwnProp(d,l)?d[l]:s,m=w.hasOwnProp(e,l)?e[l]:void 0,g=w.hasOwnProp(t,l)?t[l]:void 0,p=h(m,g,l);w.isUndefined(p)&&h!==u||(n[l]=p)}),w.hasOwnProp(t,"validateStatus")&&w.isUndefined(t.validateStatus)&&c("validateStatusUndefinedResolves")===!1&&(w.hasOwnProp(e,"validateStatus")?n.validateStatus=r(void 0,e.validateStatus):delete n.validateStatus),n}const Ud=["content-type","content-length"];function $d(e,t,n){if(n!=="content-only"){e.set(t);return}Object.entries(t||{}).forEach(([r,s])=>{Ud.includes(r.toLowerCase())&&e.set(r,s)})}const Bd=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16)));function Qa(e){const t=gt({},e),n=h=>w.hasOwnProp(t,h)?t[h]:void 0,r=n("data");let s=n("withXSRFToken");const o=n("xsrfHeaderName"),i=n("xsrfCookieName");let c=n("headers");const u=n("auth"),d=n("baseURL"),f=n("allowAbsoluteUrls"),l=n("url");if(t.headers=c=be.from(c),t.url=Ga(Za(d,l,f,t),n("params"),n("paramsSerializer")),u){const h=w.getSafeProp(u,"username")||"",m=w.getSafeProp(u,"password")||"";try{c.set("Authorization","Basic "+btoa(h+":"+(m?Bd(m):"")))}catch(g){throw T.from(g,T.ERR_BAD_OPTION_VALUE,e)}}if(w.isFormData(r)&&(fe.hasStandardBrowserEnv||fe.hasStandardBrowserWebWorkerEnv||w.isReactNative(r)?c.setContentType(void 0):w.isFunction(r.getHeaders)&&$d(c,r.getHeaders(),n("formDataHeaderPolicy"))),fe.hasStandardBrowserEnv&&(w.isFunction(s)&&(s=s(t)),s===!0||s==null&&Ad(t.url))){const m=o&&i&&Od.read(i);m&&c.set(o,m)}return t}const zd=typeof XMLHttpRequest<"u",Wd=zd&&function(e){return new Promise(function(n,r){const s=Qa(e);let o=s.data;const i=be.from(s.headers).normalize();let{responseType:c,onUploadProgress:u,onDownloadProgress:d}=s,f,l,h,m,g;function p(){m&&m(),g&&g(),s.cancelToken&&s.cancelToken.unsubscribe(f),s.signal&&s.signal.removeEventListener("abort",f)}let x=new XMLHttpRequest;x.open(s.method.toUpperCase(),s.url,!0),x.timeout=s.timeout;function b(){if(!x)return;const v=be.from("getAllResponseHeaders"in x&&x.getAllResponseHeaders()),j={data:!c||c==="text"||c==="json"?x.responseText:x.response,status:x.status,statusText:x.statusText,headers:v,config:e,request:x};Xa(function(C){n(C),p()},function(C){r(C),p()},j),x=null}"onloadend"in x?x.onloadend=b:x.onreadystatechange=function(){!x||x.readyState!==4||x.status===0&&!(x.responseURL&&x.responseURL.startsWith("file:"))||setTimeout(b)},x.onabort=function(){x&&(r(new T("Request aborted",T.ECONNABORTED,e,x)),p(),x=null)},x.onerror=function(N){const j=N&&N.message?N.message:"Network Error",k=new T(j,T.ERR_NETWORK,e,x);k.event=N||null,r(k),p(),x=null},x.ontimeout=function(){let N=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const j=s.transitional||cs;s.timeoutErrorMessage&&(N=s.timeoutErrorMessage),r(new T(N,j.clarifyTimeoutError?T.ETIMEDOUT:T.ECONNABORTED,e,x)),p(),x=null},o===void 0&&i.setContentType(null),"setRequestHeader"in x&&w.forEach(za(i),function(N,j){x.setRequestHeader(j,N)}),w.isUndefined(s.withCredentials)||(x.withCredentials=!!s.withCredentials),c&&c!=="json"&&(x.responseType=s.responseType),d&&([h,g]=Kn(d,!0),x.addEventListener("progress",h)),u&&x.upload&&([l,m]=Kn(u),x.upload.addEventListener("progress",l),x.upload.addEventListener("loadend",m)),(s.cancelToken||s.signal)&&(f=v=>{x&&(r(!v||v.type?new dn(null,e,x):v),x.abort(),p(),x=null)},s.cancelToken&&s.cancelToken.subscribe(f),s.signal&&(s.signal.aborted?f():s.signal.addEventListener("abort",f)));const y=kd(s.url);if(y&&!fe.protocols.includes(y)){r(new T("Unsupported protocol "+y+":",T.ERR_BAD_REQUEST,e)),p();return}x.send(o||null)})},Vd=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const n=new AbortController;let r=!1;const s=function(u){if(!r){r=!0,i();const d=u instanceof Error?u:this.reason;n.abort(d instanceof T?d:new dn(d instanceof Error?d.message:d))}};let o=t&&setTimeout(()=>{o=null,s(new T(`timeout of ${t}ms exceeded`,T.ETIMEDOUT))},t);const i=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(s):u.removeEventListener("abort",s)}),e=null)};e.forEach(u=>u.addEventListener("abort",s,{once:!0}));const{signal:c}=n;return c.unsubscribe=()=>w.asap(i),c},Hd=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,s;for(;r<n;)s=r+t,yield e.slice(r,s),r=s},qd=async function*(e,t){for await(const n of Gd(e))yield*Hd(n,t)},Gd=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},ho=(e,t,n,r)=>{const s=qd(e,t);let o=0,i,c=u=>{i||(i=!0,r&&r(u))};return new ReadableStream({async pull(u){try{const{done:d,value:f}=await s.next();if(d){c(),u.close();return}let l=f.byteLength;if(n){let h=o+=l;n(h)}u.enqueue(new Uint8Array(f))}catch(d){throw c(d),d}},cancel(u){return c(u),s.return()}},{highWaterMark:2})},Yn=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,Kd=(e,t,n)=>t+2<n&&Yn(e.charCodeAt(t+1))&&Yn(e.charCodeAt(t+2));function Yd(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const n=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(n)){let i=r.length;const c=r.length;for(let m=0;m<c;m++)if(r.charCodeAt(m)===37&&m+2<c){const g=r.charCodeAt(m+1),p=r.charCodeAt(m+2);Yn(g)&&Yn(p)&&(i-=2,m+=2)}let u=0,d=c-1;const f=m=>m>=2&&r.charCodeAt(m-2)===37&&r.charCodeAt(m-1)===51&&(r.charCodeAt(m)===68||r.charCodeAt(m)===100);d>=0&&(r.charCodeAt(d)===61?(u++,d--):f(d)&&(u++,d-=3)),u===1&&d>=0&&(r.charCodeAt(d)===61||f(d))&&u++;const h=Math.floor(i/4)*3-(u||0);return h>0?h:0}let o=0;for(let i=0,c=r.length;i<c;i++){const u=r.charCodeAt(i);if(u===37&&Kd(r,i,c))o+=1,i+=2;else if(u<128)o+=1;else if(u<2048)o+=2;else if(u>=55296&&u<=56319&&i+1<c){const d=r.charCodeAt(i+1);d>=56320&&d<=57343?(o+=4,i++):o+=3}else o+=3}return o}const us="1.18.1",mo=64*1024,{isFunction:yn}=w,Jd=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16))),po=e=>{if(!w.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},go=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Xd=e=>{const t=e.indexOf("://");let n=e;return t!==-1&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")},Zd=e=>{const t=w.global!==void 0&&w.global!==null?w.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=w.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:s,Request:o,Response:i}=e,c=s?yn(s):typeof fetch=="function",u=yn(o),d=yn(i);if(!c)return!1;const f=c&&yn(n),l=c&&(typeof r=="function"?(b=>y=>b.encode(y))(new r):async b=>new Uint8Array(await new o(b).arrayBuffer())),h=u&&f&&go(()=>{let b=!1;const y=new o(fe.origin,{body:new n,method:"POST",get duplex(){return b=!0,"half"}}),v=y.headers.has("Content-Type");return y.body!=null&&y.body.cancel(),b&&!v}),m=d&&f&&go(()=>w.isReadableStream(new i("").body)),g={stream:m&&(b=>b.body)};c&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!g[b]&&(g[b]=(y,v)=>{let N=y&&y[b];if(N)return N.call(y);throw new T(`Response type '${b}' is not supported`,T.ERR_NOT_SUPPORT,v)})});const p=async b=>{if(b==null)return 0;if(w.isBlob(b))return b.size;if(w.isSpecCompliantForm(b))return(await new o(fe.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(w.isArrayBufferView(b)||w.isArrayBuffer(b))return b.byteLength;if(w.isURLSearchParams(b)&&(b=b+""),w.isString(b))return(await l(b)).byteLength},x=async(b,y)=>{const v=w.toFiniteNumber(b.getContentLength());return v??p(y)};return async b=>{let{url:y,method:v,data:N,signal:j,cancelToken:k,timeout:C,onDownloadProgress:R,onUploadProgress:_,responseType:L,headers:A,withCredentials:D="same-origin",fetchOptions:O,maxContentLength:$,maxBodyLength:J}=Qa(b);const Y=w.isNumber($)&&$>-1,Q=w.isNumber(J)&&J>-1,he=z=>w.hasOwnProp(b,z)?b[z]:void 0;let me=s||fetch;L=L?(L+"").toLowerCase():"text";let I=Vd([j,k&&k.toAbortSignal()],C),E=null;const B=I&&I.unsubscribe&&(()=>{I.unsubscribe()});let q,K=null;const H=()=>new T("Request body larger than maxBodyLength limit",T.ERR_BAD_REQUEST,b,E);try{let z;const U=he("auth");if(U){const W=w.getSafeProp(U,"username")||"",pe=w.getSafeProp(U,"password")||"";z={username:W,password:pe}}if(Xd(y)){const W=new URL(y,fe.origin);if(!z&&(W.username||W.password)){const pe=po(W.username),ye=po(W.password);z={username:pe,password:ye}}(W.username||W.password)&&(W.username="",W.password="",y=W.href)}if(z&&(A.delete("authorization"),A.set("Authorization","Basic "+btoa(Jd((z.username||"")+":"+(z.password||""))))),Y&&typeof y=="string"&&y.startsWith("data:")&&Yd(y)>$)throw new T("maxContentLength size of "+$+" exceeded",T.ERR_BAD_RESPONSE,b,E);if(Q&&v!=="get"&&v!=="head"){const W=await p(N);if(typeof W=="number"&&isFinite(W)&&(q=W,W>J))throw H()}const Z=Q&&(w.isReadableStream(N)||w.isStream(N)),V=(W,pe,ye)=>ho(W,mo,_e=>{if(Q&&_e>J)throw K=H();pe&&pe(_e)},ye);if(h&&v!=="get"&&v!=="head"&&(_||Z)){if(q=q??await x(A,N),q!==0||Z){let W=new o(y,{method:"POST",body:N,duplex:"half"}),pe;if(w.isFormData(N)&&(pe=W.headers.get("content-type"))&&A.setContentType(pe),W.body){const[ye,_e]=_&&co(q,Kn(lo(_)))||[];N=V(W.body,ye,_e)}}}else if(Z&&!u&&f&&v!=="get"&&v!=="head")N=V(N);else if(Z&&u&&!h&&v!=="get"&&v!=="head")throw new T("Stream request bodies are not supported by the current fetch implementation",T.ERR_NOT_SUPPORT,b,E);w.isString(D)||(D=D?"include":"omit");const ie=u&&"credentials"in o.prototype;if(w.isFormData(N)){const W=A.getContentType();W&&/^multipart\/form-data/i.test(W)&&!/boundary=/i.test(W)&&A.delete("content-type")}A.set("User-Agent","axios/"+us,!1);const le={...O,signal:I,method:v.toUpperCase(),headers:za(A.normalize()),body:N,duplex:"half",credentials:ie?D:void 0};E=u&&new o(y,le);let te=await(u?me(E,O):me(y,le));const je=be.from(te.headers);if(Y){const W=w.toFiniteNumber(je.getContentLength());if(W!=null&&W>$)throw new T("maxContentLength size of "+$+" exceeded",T.ERR_BAD_RESPONSE,b,E)}const Ce=m&&(L==="stream"||L==="response");if(m&&te.body&&(R||Y||Ce&&B)){const W={};["status","statusText","headers"].forEach(Ve=>{W[Ve]=te[Ve]});const pe=w.toFiniteNumber(je.getContentLength()),[ye,_e]=R&&co(pe,Kn(lo(R),!0))||[];let Te=0;const ur=Ve=>{if(Y&&(Te=Ve,Te>$))throw new T("maxContentLength size of "+$+" exceeded",T.ERR_BAD_RESPONSE,b,E);ye&&ye(Ve)};te=new i(ho(te.body,mo,ur,()=>{_e&&_e(),B&&B()}),W)}L=L||"text";let ke=await g[w.findKey(g,L)||"text"](te,b);if(Y&&!m&&!Ce){let W;if(ke!=null&&(typeof ke.byteLength=="number"?W=ke.byteLength:typeof ke.size=="number"?W=ke.size:typeof ke=="string"&&(W=typeof r=="function"?new r().encode(ke).byteLength:ke.length)),typeof W=="number"&&W>$)throw new T("maxContentLength size of "+$+" exceeded",T.ERR_BAD_RESPONSE,b,E)}return!Ce&&B&&B(),await new Promise((W,pe)=>{Xa(W,pe,{data:ke,headers:be.from(te.headers),status:te.status,statusText:te.statusText,config:b,request:E})})}catch(z){if(B&&B(),I&&I.aborted&&I.reason instanceof T){const U=I.reason;throw U.config=b,E&&(U.request=E),z!==U&&Object.defineProperty(U,"cause",{__proto__:null,value:z,writable:!0,enumerable:!1,configurable:!0}),U}if(K)throw E&&!K.request&&(K.request=E),K;if(z instanceof T)throw E&&!z.request&&(z.request=E),z;if(z&&z.name==="TypeError"&&/Load failed|fetch/i.test(z.message)){const U=new T("Network Error",T.ERR_NETWORK,b,E,z&&z.response);throw Object.defineProperty(U,"cause",{__proto__:null,value:z.cause||z,writable:!0,enumerable:!1,configurable:!0}),U}throw T.from(z,z&&z.code,b,E,z&&z.response)}}},Qd=new Map,ei=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,o=[r,s,n];let i=o.length,c=i,u,d,f=Qd;for(;c--;)u=o[c],d=f.get(u),d===void 0&&f.set(u,d=c?new Map:Zd(t)),f=d;return d};ei();const ds={http:fd,xhr:Wd,fetch:{get:ei}};w.forEach(ds,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const xo=e=>`- ${e}`,ef=e=>w.isFunction(e)||e===null||e===!1;function tf(e,t){e=w.isArray(e)?e:[e];const{length:n}=e;let r,s;const o={};for(let i=0;i<n;i++){r=e[i];let c;if(s=r,!ef(r)&&(s=ds[(c=String(r)).toLowerCase()],s===void 0))throw new T(`Unknown adapter '${c}'`);if(s&&(w.isFunction(s)||(s=s.get(t))))break;o[c||"#"+i]=s}if(!s){const i=Object.entries(o).map(([u,d])=>`adapter ${u} `+(d===!1?"is not supported by the environment":"is not available in the build"));let c=n?i.length>1?`since :
6
+ <%s key={someKey} {...props} />`,K,U,Z,U),I[U+K]=!0)}if(U=null,q!==void 0&&(n(q),U=""+q),i(B)&&(n(B.key),U=""+B.key),"key"in B){q={};for(var V in B)V!=="key"&&(q[V]=B[V])}else q=B;return U&&c(q,typeof E=="function"?E.displayName||E.name||"Unknown":E),d(E,U,q,s(),H,z)}function l(E){h(E)?E._store&&(E._store.validated=1):typeof E=="object"&&E!==null&&E.$$typeof===_&&(E._payload.status==="fulfilled"?h(E._payload.value)&&E._payload.value._store&&(E._payload.value._store.validated=1):E._store&&(E._store.validated=1))}function h(E){return typeof E=="object"&&E!==null&&E.$$typeof===g}var m=P,g=Symbol.for("react.transitional.element"),p=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),y=Symbol.for("react.profiler"),v=Symbol.for("react.consumer"),N=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),L=Symbol.for("react.activity"),A=Symbol.for("react.client.reference"),D=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O=Object.prototype.hasOwnProperty,$=Array.isArray,J=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(E){return E()}};var Y,Q={},he=m.react_stack_bottom_frame.bind(m,o)(),me=J(r(o)),I={};zt.Fragment=x,zt.jsx=function(E,B,q){var K=1e4>D.recentlyCreatedOwnerStacks++;return f(E,B,q,!1,K?Error("react-stack-top-frame"):he,K?J(r(E)):me)},zt.jsxs=function(E,B,q){var K=1e4>D.recentlyCreatedOwnerStacks++;return f(E,B,q,!0,K?Error("react-stack-top-frame"):he,K?J(r(E)):me)}})()),zt}var Rs;function mc(){return Rs||(Rs=1,process.env.NODE_ENV==="production"?fn.exports=fc():fn.exports=hc()),fn.exports}var a=mc(),Zt=typeof window<"u"?S.useLayoutEffect:S.useEffect;function dr(e){const t=S.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function pc(e,t,n={},r={}){S.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!="function")return;const s=new IntersectionObserver(([o])=>{t(o)},n);return s.observe(e.current),()=>{s.disconnect()}},[t,n,r.disabled,e])}function gc(e){const t=S.useRef(null);return S.useImperativeHandle(e,()=>t.current,[]),t}const ta=!1;function Qt(e){return e[e.length-1]}function xc(e){return typeof e=="function"}function rt(e,t){return xc(e)?e(t):e}const na=Object.prototype.hasOwnProperty,Ns=Object.prototype.propertyIsEnumerable;function ra(e){for(const t in e)if(na.call(e,t))return!0;return!1}const bc=()=>Object.create(null),et=(e,t)=>st(e,t,bc);function st(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;const s=t,o=Es(e)&&Es(s);if(!o&&!($n(e)&&$n(s)))return s;const i=o?e:Cs(e);if(!i)return s;const c=o?s:Cs(s);if(!c)return s;const u=i.length,d=c.length,f=o?new Array(d):n();let l=0;for(let h=0;h<d;h++){const m=o?h:c[h],g=e[m],p=s[m];if(g===p){f[m]=g,(o?h<u:na.call(e,m))&&l++;continue}if(g===null||p===null||typeof g!="object"||typeof p!="object"){f[m]=p;continue}const x=st(g,p,n,r+1);f[m]=x,x===g&&l++}return u===d&&l===u?e:f}function Cs(e){const t=Object.getOwnPropertyNames(e);for(const s of t)if(!Ns.call(e,s))return!1;const n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;const r=t;for(const s of n){if(!Ns.call(e,s))return!1;r.push(s)}return r}function $n(e){if(!js(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const n=t.prototype;return!(!js(n)||!n.hasOwnProperty("isPrototypeOf"))}function js(e){return Object.prototype.toString.call(e)==="[object Object]"}function Es(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ct(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,s=e.length;r<s;r++)if(!ct(e[r],t[r],n))return!1;return!0}if($n(e)&&$n(t)){const r=n?.ignoreUndefined??!0;if(n?.partial){for(const i in t)if((!r||t[i]!==void 0)&&!ct(e[i],t[i],n))return!1;return!0}let s=0;if(!r)s=Object.keys(e).length;else for(const i in e)e[i]!==void 0&&s++;let o=0;for(const i in t)if((!r||t[i]!==void 0)&&(o++,o>s||!ct(e[i],t[i],n)))return!1;return s===o}return!1}function Pt(e){let t,n;const r=new Promise((s,o)=>{t=s,n=o});return r.status="pending",r.resolve=s=>{r.status="resolved",r.value=s,t(s),e?.(s)},r.reject=s=>{r.status="rejected",n(s)},r}function en(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}function ks(e,t){for(let n=e.length-1;n>=0;n--){const r=e[n];if(t(r))return r}}const yc=/[\x00-\x1f\x7f"<>`{}]/g;function vc(e){return e.replace(yc,t=>"%"+t.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0"))}function _s(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,n=>{try{return decodeURI(n)}catch{return n}})}return vc(t)}const wc=["http:","https:","mailto:","tel:"];function Bn(e,t){if(!e)return!1;try{const n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function Wt(e){if(!e)return{path:e,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith("//"))return{path:e,handledProtocolRelativeURL:!1};const t=/%25|%5C/gi;let n=0,r="",s;for(;(s=t.exec(e))!==null;)r+=_s(e.slice(n,s.index))+s[0],n=t.lastIndex;r=r+_s(n?e.slice(n):e);let o=!1;return r.startsWith("//")&&(o=!0,r="/"+r.replace(/^\/+/,"")),{path:r,handledProtocolRelativeURL:o}}function Sc(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Rc(e,t){if(e===t)return!0;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 $e(){throw new Error("Invariant failed")}function tn(e){const t=new Map;let n,r;const s=o=>{o.next&&(o.prev?(o.prev.next=o.next,o.next.prev=o.prev,o.next=void 0,r&&(r.next=o,o.prev=r)):(o.next.prev=void 0,n=o.next,o.next=void 0,r&&(o.prev=r,r.next=o)),r=o)};return{get(o){const i=t.get(o);if(i)return s(i),i.value},set(o,i){if(t.size>=e&&n){const u=n;t.delete(u.key),u.next&&(n=u.next,u.next.prev=void 0),u===r&&(r=void 0)}const c=t.get(o);if(c)c.value=i,s(c);else{const u={key:o,value:i,prev:r};r&&(r.next=u),r=u,n||(n=u),t.set(o,u)}},clear(){t.clear(),n=void 0,r=void 0}}}const Ge=4,sa=5;function Nc(e){const t=e.indexOf("{");if(t===-1)return null;const n=e.indexOf("}",t);return n===-1||t+1>=e.length?null:[t,n]}function oa(e,t,n=new Uint16Array(6)){const r=e.indexOf("/",t),s=r===-1?e.length:r,o=e.substring(t,s);if(!o||!o.includes("$"))return n[0]=0,n[1]=t,n[2]=t,n[3]=s,n[4]=s,n[5]=s,n;if(o==="$"){const c=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=c,n[4]=c,n[5]=c,n}if(o.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=s,n[4]=s,n[5]=s,n;const i=Nc(o);if(i){const[c,u]=i,d=o.charCodeAt(c+1);if(d===45){if(c+2<o.length&&o.charCodeAt(c+2)===36){const f=c+3,l=u;if(f<l)return n[0]=3,n[1]=t+c,n[2]=t+f,n[3]=t+l,n[4]=t+u+1,n[5]=s,n}}else if(d===36){const f=c+1,l=c+2;return l===u?(n[0]=2,n[1]=t+c,n[2]=t+f,n[3]=t+l,n[4]=t+u+1,n[5]=e.length,n):(n[0]=1,n[1]=t+c,n[2]=t+l,n[3]=t+u,n[4]=t+u+1,n[5]=s,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=s,n[4]=s,n[5]=s,n}function er(e,t,n,r,s,o,i){i?.(n);let c=r;{const u=n.fullPath??n.from,d=u.length,f=n.options?.caseSensitive??e,l=n.options?.params?.parse??n.options?.parseParams;for(;c<d;){const m=oa(u,c,t);let g;const p=c,x=m[5];switch(c=x+1,o++,m[0]){case 0:{const b=u.substring(m[2],m[3]);if(f){const y=s.static?.get(b);if(y)g=y;else{s.static??=new Map;const v=ot(n.fullPath??n.from);v.parent=s,v.depth=o,g=v,s.static.set(b,v)}}else{const y=b.toLowerCase(),v=s.staticInsensitive?.get(y);if(v)g=v;else{s.staticInsensitive??=new Map;const N=ot(n.fullPath??n.from);N.parent=s,N.depth=o,g=N,s.staticInsensitive.set(y,N)}}break}case 1:{const b=u.substring(p,m[1]),y=u.substring(m[4],x),v=f&&!!(b||y),N=b?v?b:b.toLowerCase():void 0,j=y?v?y:y.toLowerCase():void 0,k=!l&&s.dynamic?.find(C=>!C.parse&&C.caseSensitive===v&&C.prefix===N&&C.suffix===j);if(k)g=k;else{const C=hr(1,n.fullPath??n.from,v,N,j);g=C,C.depth=o,C.parent=s,s.dynamic??=[],s.dynamic.push(C)}break}case 3:{const b=u.substring(p,m[1]),y=u.substring(m[4],x),v=f&&!!(b||y),N=b?v?b:b.toLowerCase():void 0,j=y?v?y:y.toLowerCase():void 0,k=!l&&s.optional?.find(C=>!C.parse&&C.caseSensitive===v&&C.prefix===N&&C.suffix===j);if(k)g=k;else{const C=hr(3,n.fullPath??n.from,v,N,j);g=C,C.parent=s,C.depth=o,s.optional??=[],s.optional.push(C)}break}case 2:{const b=u.substring(p,m[1]),y=u.substring(m[4],x),v=f&&!!(b||y),N=b?v?b:b.toLowerCase():void 0,j=y?v?y:y.toLowerCase():void 0,k=hr(2,n.fullPath??n.from,v,N,j);g=k,k.parent=s,k.depth=o,s.wildcard??=[],s.wildcard.push(k)}}s=g}if(l&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf("/")+1)===95){const m=ot(n.fullPath??n.from);m.kind=sa,m.parent=s,o++,m.depth=o,s.pathless??=[],s.pathless.push(m),s=m}const h=(n.path||!n.children)&&!n.isRoot;if(h&&u.endsWith("/")){const m=ot(n.fullPath??n.from);m.kind=Ge,m.parent=s,o++,m.depth=o,s.index=m,s=m}s.parse=l??null,s.priority=n.options?.params?.priority??0,h&&!s.route&&(s.route=n,s.fullPath=n.fullPath??n.from)}if(n.children)for(const u of n.children)er(e,t,u,c,s,o,i)}function fr(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function qe(e){if(e.pathless)for(const t of e.pathless)qe(t);if(e.static)for(const t of e.static.values())qe(t);if(e.staticInsensitive)for(const t of e.staticInsensitive.values())qe(t);if(e.dynamic?.length){e.dynamic.sort(fr);for(const t of e.dynamic)qe(t)}if(e.optional?.length){e.optional.sort(fr);for(const t of e.optional)qe(t)}if(e.wildcard?.length){e.wildcard.sort(fr);for(const t of e.wildcard)qe(t)}}function ot(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function hr(e,t,n,r,s){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:s}}function Cc(e,t){const n=ot("/"),r=new Uint16Array(6);for(const s of e)er(!1,r,s,1,n,0);qe(n),t.masksTree=n,t.flatCache=tn(1e3)}function jc(e,t){e||="/";const n=t.flatCache.get(e);if(n)return n;const r=es(e,t.masksTree);return t.flatCache.set(e,r),r}function Ec(e,t,n,r,s){e||="/",r||="/";const o=t?`case\0${e}`:e;let i=s.singleCache.get(o);return i||(i=ot("/"),er(t,new Uint16Array(6),{from:e},1,i,0),s.singleCache.set(o,i)),es(r,i,n)}function kc(e,t,n=!1){const r=n?e:`nofuzz\0${e}`,s=t.matchCache.get(r);if(s!==void 0)return s;e||="/";let o;try{o=es(e,t.segmentTree,n)}catch(i){if(i instanceof URIError)o=null;else throw i}return o&&(o.branch=ia(o.route)),t.matchCache.set(r,o),o}function _c(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function Pc(e,t=!1,n){const r=ot(e.fullPath),s=new Uint16Array(6),o={},i={};let c=0;return er(t,s,e,1,r,0,u=>{if(n?.(u,c),u.id in o){if(process.env.NODE_ENV!=="production")throw new Error(`Invariant failed: Duplicate routes found with id: ${String(u.id)}`);$e()}if(o[u.id]=u,c!==0&&u.path){const d=_c(u.fullPath);(!i[d]||u.fullPath.endsWith("/"))&&(i[d]=u)}c++}),qe(r),{processedTree:{segmentTree:r,singleCache:tn(1e3),matchCache:tn(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:i}}function es(e,t,n=!1){const r=e.split("/"),s=Oc(e,r,t,n);if(!s)return null;const[o]=aa(e,r,s);return{route:s.node.route,rawParams:o}}function aa(e,t,n){const r=Ac(n.node);let s=null;const o=Object.create(null);let i=n.extract?.part??0,c=n.extract?.node??0,u=n.extract?.path??0,d=n.extract?.segment??0;for(;c<r.length;i++,c++,u++,d++){const f=r[c];if(f.kind===Ge)break;if(f.kind===sa){d--,i--,u--;continue}const l=t[i],h=u;if(l&&(u+=l.length),f.kind===1){s??=n.node.fullPath.split("/");const m=s[d],g=f.prefix?.length??0;if(m.charCodeAt(g)===123){const p=f.suffix?.length??0,x=m.substring(g+2,m.length-p-1),b=l.substring(g,l.length-p);o[x]=decodeURIComponent(b)}else{const p=m.substring(1);o[p]=decodeURIComponent(l)}}else if(f.kind===3){if(n.skipped&1<<c){i--,u=h-1;continue}s??=n.node.fullPath.split("/");const m=s[d],g=f.prefix?.length??0,p=f.suffix?.length??0,x=m.substring(g+3,m.length-p-1),b=f.suffix||f.prefix?l.substring(g,l.length-p):l;b&&(o[x]=decodeURIComponent(b))}else if(f.kind===2){const m=f,g=e.substring(h+(m.prefix?.length??0),e.length-(m.suffix?.length??0)),p=decodeURIComponent(g);o["*"]=p,o._splat=p;break}}return n.rawParams&&Object.assign(o,n.rawParams),[o,{part:i,node:c,path:u,segment:d}]}function ia(e){const t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function Ac(e){const t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function Oc(e,t,n,r){if(e==="/"&&n.index)return{node:n.index,skipped:0};const s=!Qt(t),o=s&&e!=="/",i=t.length-(s?1:0),c=[{node:n,index:1,skipped:0,depth:1,statics:0,dynamics:0,optionals:0}];let u=null,d=null;for(;c.length;){const f=c.pop(),{node:l,index:h,skipped:m,depth:g,statics:p,dynamics:x,optionals:b}=f;let{extract:y,rawParams:v}=f;if(l.kind===2&&l.route&&!mn(d,f))continue;if(l.parse){if(!Ps(e,t,f))continue;v=f.rawParams,y=f.extract}r&&l.route&&l.kind!==Ge&&mn(u,f)&&(u=f);const N=h===i;if(N&&(l.route&&(!o||l.kind===Ge||l.kind===2)&&mn(d,f)&&(d=f),!l.optional&&!l.wildcard&&!l.index&&!l.pathless))continue;const j=N?void 0:t[h];let k;if(N&&l.index){const C={node:l.index,index:h,skipped:m,depth:g+1,statics:p,dynamics:x,optionals:b,extract:y,rawParams:v};let R=!0;if(l.index.parse&&(Ps(e,t,C)||(R=!1)),R){if(!x&&!b&&!m&&Tc(p,i))return C;mn(d,C)&&(d=C)}}if(l.wildcard)for(let C=l.wildcard.length-1;C>=0;C--){const R=l.wildcard[C],{prefix:_,suffix:L}=R;if(!(_&&(N||!(R.caseSensitive?j:k??=j.toLowerCase()).startsWith(_)))){if(L){if(N)continue;const A=t.slice(h).join("/").slice(-L.length);if((R.caseSensitive?A:A.toLowerCase())!==L)continue}c.push({node:R,index:i,skipped:m,depth:g+1,statics:p,dynamics:x,optionals:b,extract:y,rawParams:v})}}if(l.optional){const C=m|1<<g,R=g+1;for(let _=l.optional.length-1;_>=0;_--){const L=l.optional[_];c.push({node:L,index:h,skipped:C,depth:R,statics:p,dynamics:x,optionals:b,extract:y,rawParams:v})}if(!N)for(let _=l.optional.length-1;_>=0;_--){const L=l.optional[_],{prefix:A,suffix:D}=L;if(A||D){const O=L.caseSensitive?j:k??=j.toLowerCase();if(A&&!O.startsWith(A)||D&&!O.endsWith(D))continue}c.push({node:L,index:h+1,skipped:m,depth:R,statics:p,dynamics:x,optionals:b+hn(i,h),extract:y,rawParams:v})}}if(!N&&l.dynamic&&j)for(let C=l.dynamic.length-1;C>=0;C--){const R=l.dynamic[C],{prefix:_,suffix:L}=R;if(_||L){const A=R.caseSensitive?j:k??=j.toLowerCase();if(_&&!A.startsWith(_)||L&&!A.endsWith(L))continue}c.push({node:R,index:h+1,skipped:m,depth:g+1,statics:p,dynamics:x+hn(i,h),optionals:b,extract:y,rawParams:v})}if(!N&&l.staticInsensitive){const C=l.staticInsensitive.get(k??=j.toLowerCase());C&&c.push({node:C,index:h+1,skipped:m,depth:g+1,statics:p+hn(i,h),dynamics:x,optionals:b,extract:y,rawParams:v})}if(!N&&l.static){const C=l.static.get(j);C&&c.push({node:C,index:h+1,skipped:m,depth:g+1,statics:p+hn(i,h),dynamics:x,optionals:b,extract:y,rawParams:v})}if(l.pathless){const C=g+1;for(let R=l.pathless.length-1;R>=0;R--){const _=l.pathless[R];c.push({node:_,index:h,skipped:m,depth:C,statics:p,dynamics:x,optionals:b,extract:y,rawParams:v})}}}if(d)return d;if(r&&u){let f=u.index;for(let h=0;h<u.index;h++)f+=t[h].length;const l=f===e.length?"/":e.slice(f);return u.rawParams??=Object.create(null),u.rawParams["**"]=decodeURIComponent(l),u}return null}function hn(e,t){return 2**(e-t-1)}function Tc(e,t){return e===2**(t-1)-1}function Ps(e,t,n){let r,s;try{[r,s]=aa(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=s,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function mn(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===Ge)>(e.node.kind===Ge)||t.node.kind===Ge==(e.node.kind===Ge)&&t.depth>e.depth))):!0}function An(e){return ts(e.filter(t=>t!==void 0).join("/"))}function ts(e){return e.replace(/\/{2,}/g,"/")}function ca(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function Ue(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/{1,}$/,""):e}function la(e){return Ue(ca(e))}function zn(e,t){return e?.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function Lc(e,t,n){return zn(e,n)===zn(t,n)}function Ic({base:e,to:t,trailingSlash:n="never",cache:r}){const s=t.startsWith("/"),o=!s&&t===".";let i;if(r){i=s?t:o?e:e+"\0"+t;const d=r.get(i);if(d)return d}let c;if(o)c=e.split("/");else if(s)c=t.split("/");else{for(c=e.split("/");c.length>1&&Qt(c)==="";)c.pop();const d=t.split("/");for(let f=0,l=d.length;f<l;f++){const h=d[f];h===""?f?f===l-1&&c.push(h):c=[h]:h===".."?c.pop():h==="."||c.push(h)}}c.length>1&&(Qt(c)===""?n==="never"&&c.pop():n==="always"&&c.push(""));const u=ts(c.join("/"))||"/";return i&&r&&r.set(i,u),u}function Mc(e){const t=new Map(e.map(s=>[encodeURIComponent(s),s])),n=Array.from(t.keys()).map(s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),r=new RegExp(n,"g");return s=>s.replace(r,o=>t.get(o)??o)}function mr(e,t,n){const r=t[e];return typeof r!="string"?r:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split("/").map(s=>Os(s,n)).join("/"):Os(r,n)}function As({path:e,params:t,decoder:n,...r}){let s=!1;const o=Object.create(null);if(!e||e==="/")return{interpolatedPath:"/",usedParams:o,isMissingParams:s};if(!e.includes("$"))return{interpolatedPath:e,usedParams:o,isMissingParams:s};const i=e.length;let c=0,u,d="";for(;c<i;){const f=c;u=oa(e,f,u);const l=u[5];if(c=l+1,f===l)continue;const h=u[0];if(h===0){d+="/"+e.substring(f,l);continue}if(h===2){const m=t._splat;o._splat=m,o["*"]=m;const g=e.substring(f,u[1]),p=e.substring(u[4],l);if(!m){s=!0,(g||p)&&(d+="/"+g+p);continue}const x=mr("_splat",t,n);d+="/"+g+x+p;continue}if(h===1){const m=e.substring(u[2],u[3]);!s&&!(m in t)&&(s=!0),o[m]=t[m];const g=e.substring(f,u[1]),p=e.substring(u[4],l),x=mr(m,t,n)??"undefined";d+="/"+g+x+p;continue}if(h===3){const m=e.substring(u[2],u[3]),g=t[m];if(g==null)continue;o[m]=g;const p=e.substring(f,u[1]),x=e.substring(u[4],l),b=mr(m,t,n)??"";d+="/"+p+b+x;continue}}return e.endsWith("/")&&(d+="/"),{usedParams:o,interpolatedPath:d||"/",isMissingParams:s}}function Os(e,t){const n=encodeURIComponent(e);return t?.(n)??n}function xe(e){return e?.isNotFound===!0}function Dc(e,t=String){const n=new URLSearchParams;for(const r in e){const s=e[r];s!==void 0&&n.set(r,t(s))}return n.toString()}function pr(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function Fc(e){const t=new URLSearchParams(e),n=Object.create(null);for(const[r,s]of t.entries()){const o=n[r];o==null?n[r]=pr(s):Array.isArray(o)?o.push(pr(s)):n[r]=[o,pr(s)]}return n}const Uc=Bc(JSON.parse),$c=zc(JSON.stringify,JSON.parse);function Bc(e){return t=>{t[0]==="?"&&(t=t.substring(1));const n=Fc(t);for(const r in n){const s=n[r];if(typeof s=="string")try{n[r]=e(s)}catch{}}return n}}function zc(e,t){const n=typeof t=="function";function r(s){if(typeof s=="object"&&s!==null)try{return e(s)}catch{}else if(n&&typeof s=="string")try{return t(s),e(s)}catch{}return s}return s=>{const o=Dc(s,r);return o?`?${o}`:""}}const lt="__root__";function Wc(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href=="string")try{new URL(e.href),e.reloadDocument=!0}catch{}const t=new Headers(e.headers);e.href&&t.get("Location")===null&&t.set("Location",e.href);const n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function we(e){return e instanceof Response&&!!e.options}const Fr=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},Vc=e=>e.stores.matchesId.get().some(t=>e.stores.matchStores.get(t)?.get()._forcePending),tr=(e,t)=>!!(e.preload&&!e.router.stores.matchStores.has(t)),ut=(e,t,n=!0)=>{const r={...e.router.options.context??{}},s=n?t:t-1;for(let o=0;o<=s;o++){const i=e.matches[o];if(!i)continue;const c=e.router.getMatch(i.id);c&&Object.assign(r,c.__routeContext,c.__beforeLoadContext)}return r},Ts=(e,t)=>{if(!e.matches.length)return;const n=t.routeId,r=e.matches.findIndex(i=>i.routeId===e.router.routeTree.id),s=r>=0?r:0;let o=n?e.matches.findIndex(i=>i.routeId===n):e.firstBadMatchIndex??e.matches.length-1;o<0&&(o=s);for(let i=o;i>=0;i--){const c=e.matches[i];if(e.router.looseRoutesById[c.routeId].options.notFoundComponent)return i}return n?o:s},Ke=(e,t,n)=>{if(!(!we(n)&&!xe(n)))throw we(n)&&n.redirectHandled&&!n.options.reloadDocument||(t&&(t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=n,e.updateMatch(t.id,r=>({...r,status:we(n)?"redirected":xe(n)?"notFound":r.status==="pending"?"success":r.status,context:ut(e,t.index),isFetching:!1,error:n})),xe(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()),we(n)&&(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n))),n},ua=(e,t)=>{const n=e.router.getMatch(t);return!!(!n||n._nonReactive.dehydrated)},Ls=(e,t,n)=>{const r=ut(e,n);e.updateMatch(t,s=>({...s,context:r}))},Vt=(e,t,n)=>{const{id:r,routeId:s}=e.matches[t],o=e.router.looseRoutesById[s];if(n instanceof Promise)throw n;e.firstBadMatchIndex??=t,Ke(e,e.router.getMatch(r),n);try{o.options.onError?.(n)}catch(i){n=i,Ke(e,e.router.getMatch(r),n)}e.updateMatch(r,i=>(i._nonReactive.beforeLoadPromise?.resolve(),i._nonReactive.beforeLoadPromise=void 0,i._nonReactive.loadPromise?.resolve(),{...i,error:n,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})),!e.preload&&!we(n)&&!xe(n)&&(e.serialError??=n)},da=(e,t,n,r)=>{if(r._nonReactive.pendingTimeout!==void 0)return;const s=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!tr(e,t)&&(n.options.loader||n.options.beforeLoad||ha(n))&&typeof s=="number"&&s!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent)){const o=setTimeout(()=>{Fr(e)},s);r._nonReactive.pendingTimeout=o}},Hc=(e,t,n)=>{const r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;da(e,t,n,r);const s=()=>{const o=e.router.getMatch(t);o.preload&&(o.status==="redirected"||o.status==="notFound")&&Ke(e,o,o.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(s):s()},qc=(e,t,n,r)=>{const s=e.router.getMatch(t);let o=s._nonReactive.loadPromise;s._nonReactive.loadPromise=Pt(()=>{o?.resolve(),o=void 0});const{paramsError:i,searchError:c}=s;i&&Vt(e,n,i),c&&Vt(e,n,c),da(e,t,r,s);const u=new AbortController;let d=!1;const f=()=>{d||(d=!0,e.updateMatch(t,N=>({...N,isFetching:"beforeLoad",fetchCount:N.fetchCount+1,abortController:u})))},l=()=>{s._nonReactive.beforeLoadPromise?.resolve(),s._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,N=>({...N,isFetching:!1}))};if(!r.options.beforeLoad){e.router.batch(()=>{f(),l()});return}s._nonReactive.beforeLoadPromise=Pt();const h={...ut(e,n,!1),...s.__routeContext},{search:m,params:g,cause:p}=s,x=tr(e,t),b={search:m,abortController:u,params:g,preload:x,context:h,location:e.location,navigate:N=>e.router.navigate({...N,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:x?"preload":p,matches:e.matches,routeId:r.id,...e.router.options.additionalContext},y=N=>{if(N===void 0){e.router.batch(()=>{f(),l()});return}(we(N)||xe(N))&&(f(),Vt(e,n,N)),e.router.batch(()=>{f(),e.updateMatch(t,j=>({...j,__beforeLoadContext:N})),l()})};let v;try{if(v=r.options.beforeLoad(b),en(v))return f(),v.catch(N=>{Vt(e,n,N)}).then(y)}catch(N){f(),Vt(e,n,N)}y(v)},Gc=(e,t)=>{const{id:n,routeId:r}=e.matches[t],s=e.router.looseRoutesById[r],o=()=>c(),i=()=>qc(e,n,t,s),c=()=>{if(ua(e,n))return;const u=Hc(e,n,s);return en(u)?u.then(i):i()};return o()},Kc=(e,t,n)=>{const r=e.router.getMatch(t);if(!r||!n.options.head&&!n.options.scripts&&!n.options.headers)return;const s={ssr:e.router.options.ssr,matches:e.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([n.options.head?.(s),n.options.scripts?.(s),n.options.headers?.(s)]).then(([o,i,c])=>({meta:o?.meta,links:o?.links,headScripts:o?.scripts,headers:c,scripts:i,styles:o?.styles}))},fa=(e,t,n,r,s)=>{const o=t[r-1],{params:i,loaderDeps:c,abortController:u,cause:d}=e.router.getMatch(n),f=ut(e,r),l=tr(e,n);return{params:i,deps:c,preload:!!l,parentMatchPromise:o,abortController:u,context:f,location:e.location,navigate:h=>e.router.navigate({...h,_fromLocation:e.location}),cause:l?"preload":d,route:s,...e.router.options.additionalContext}},Is=async(e,t,n,r,s)=>{try{const o=e.router.getMatch(n);try{(!(ta??e.router.isServer)||o.ssr===!0)&&nn(s);const i=s.options.loader,c=typeof i=="function"?i:i?.handler,u=c?.(fa(e,t,n,r,s)),d=!!c&&en(u);if((d||s._lazyPromise||s._componentsPromise||s.options.head||s.options.scripts||s.options.headers||o._nonReactive.minPendingPromise)&&e.updateMatch(n,l=>({...l,isFetching:"loader"})),c){const l=d?await u:u;Ke(e,e.router.getMatch(n),l),l!==void 0&&e.updateMatch(n,h=>({...h,loaderData:l}))}s._lazyPromise&&await s._lazyPromise;const f=o._nonReactive.minPendingPromise;f&&await f,s._componentsPromise&&await s._componentsPromise,e.updateMatch(n,l=>({...l,error:void 0,context:ut(e,r),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(i){let c=i;if(c?.name==="AbortError"){if(o.abortController.signal.aborted){o._nonReactive.loaderPromise?.resolve(),o._nonReactive.loaderPromise=void 0;return}e.updateMatch(n,d=>({...d,status:d.status==="pending"?"success":d.status,isFetching:!1,context:ut(e,r)}));return}const u=o._nonReactive.minPendingPromise;u&&await u,xe(i)&&await s.options.notFoundComponent?.preload?.(),Ke(e,e.router.getMatch(n),i);try{s.options.onError?.(i)}catch(d){c=d,Ke(e,e.router.getMatch(n),d)}!we(c)&&!xe(c)&&await nn(s,["errorComponent"]),e.updateMatch(n,d=>({...d,error:c,context:ut(e,r),status:"error",isFetching:!1}))}}catch(o){const i=e.router.getMatch(n);i&&(i._nonReactive.loaderPromise=void 0),Ke(e,i,o)}},Yc=async(e,t,n)=>{async function r(m,g,p,x,b){const y=Date.now()-g.updatedAt,v=m?b.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:b.options.staleTime??e.router.options.defaultStaleTime??0,N=b.options.shouldReload,j=typeof N=="function"?N(fa(e,t,s,n,b)):N,{status:k,invalid:C}=x,R=y>=v&&(!!e.forceStaleReload||x.cause==="enter"||p!==void 0&&p!==x.id);i=k==="success"&&(C||(j??R)),m&&b.options.preload===!1||(i&&!e.sync&&f?(c=!0,(async()=>{try{await Is(e,t,s,n,b);const _=e.router.getMatch(s);_._nonReactive.loaderPromise?.resolve(),_._nonReactive.loadPromise?.resolve(),_._nonReactive.loaderPromise=void 0,_._nonReactive.loadPromise=void 0}catch(_){we(_)&&await e.router.navigate(_.options)}})()):k!=="success"||i?await Is(e,t,s,n,b):Ls(e,s,n))}const{id:s,routeId:o}=e.matches[n];let i=!1,c=!1;const u=e.router.looseRoutesById[o],d=u.options.loader,f=((typeof d=="function"?void 0:d?.staleReloadMode)??e.router.options.defaultStaleReloadMode)!=="blocking";if(ua(e,s)){if(!e.router.getMatch(s))return e.matches[n];Ls(e,s,n)}else{const m=e.router.getMatch(s),g=e.router.stores.matchesId.get()[n],p=(g&&e.router.stores.matchStores.get(g)||null)?.routeId===o?g:e.router.stores.matches.get().find(b=>b.routeId===o)?.id,x=tr(e,s);if(m._nonReactive.loaderPromise){if(m.status==="success"&&!e.sync&&!m.preload&&f)return m;await m._nonReactive.loaderPromise;const b=e.router.getMatch(s),y=b._nonReactive.error||b.error;y&&Ke(e,b,y),b.status==="pending"&&await r(x,m,p,b,u)}else{const b=x&&!e.router.stores.matchStores.has(s),y=e.router.getMatch(s);y._nonReactive.loaderPromise=Pt(),b!==y.preload&&e.updateMatch(s,v=>({...v,preload:b})),await r(x,m,p,y,u)}}const l=e.router.getMatch(s);c||(l._nonReactive.loaderPromise?.resolve(),l._nonReactive.loadPromise?.resolve(),l._nonReactive.loadPromise=void 0),clearTimeout(l._nonReactive.pendingTimeout),l._nonReactive.pendingTimeout=void 0,c||(l._nonReactive.loaderPromise=void 0),l._nonReactive.dehydrated=void 0;const h=c?l.isFetching:!1;return h!==l.isFetching||l.invalid!==!1?(e.updateMatch(s,m=>({...m,isFetching:h,invalid:!1})),e.router.getMatch(s)):l};async function Ms(e){const t=e,n=[];Vc(t.router)&&Fr(t);let r;for(let h=0;h<t.matches.length;h++){try{const m=Gc(t,h);en(m)&&await m}catch(m){if(we(m))throw m;if(xe(m))r=m;else if(!t.preload)throw m;break}if(t.serialError||t.firstBadMatchIndex!=null)break}const s=t.firstBadMatchIndex??t.matches.length,o=r&&!t.preload?Ts(t,r):void 0,i=r&&t.preload?0:o!==void 0?Math.min(o+1,s):s;let c,u;for(let h=0;h<i;h++)n.push(Yc(t,n,h));try{await Promise.all(n)}catch{const h=await Promise.allSettled(n);for(const m of h){if(m.status!=="rejected")continue;const g=m.reason;if(we(g))throw g;xe(g)?c??=g:u??=g}if(u!==void 0)throw u}const d=c??(r&&!t.preload?r:void 0);let f=t.firstBadMatchIndex!==void 0?t.firstBadMatchIndex:t.matches.length-1;if(!d&&r&&t.preload)return t.matches;if(d){const h=Ts(t,d);if(h===void 0){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Could not find match for notFound boundary");$e()}const m=t.matches[h],g=t.router.looseRoutesById[m.routeId],p=t.router.options?.defaultNotFoundComponent;!g.options.notFoundComponent&&p&&(g.options.notFoundComponent=p),d.routeId=m.routeId;const x=m.routeId===t.router.routeTree.id;t.updateMatch(m.id,b=>({...b,...x?{status:"success",globalNotFound:!0,error:void 0}:{status:"notFound",error:d},isFetching:!1})),f=h,await nn(g,["notFoundComponent"])}else if(!t.preload){const h=t.matches[0];h.globalNotFound||t.router.getMatch(h.id)?.globalNotFound&&t.updateMatch(h.id,m=>({...m,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){const h=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await nn(h,["errorComponent"])}for(let h=0;h<=f;h++){const{id:m,routeId:g}=t.matches[h],p=t.router.looseRoutesById[g];try{const x=Kc(t,m,p);if(x){const b=await x;t.updateMatch(m,y=>({...y,...b}))}}catch(x){console.error(`Error executing head for route ${g}:`,x)}}const l=Fr(t);if(en(l)&&await l,d)throw d;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function Ds(e,t){const n=t.map(r=>e.options[r]?.preload?.()).filter(Boolean);if(n.length!==0)return Promise.all(n)}function nn(e,t=On){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(r=>{const{id:s,...o}=r.options;Object.assign(e.options,o),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);const n=()=>e._componentsLoaded?void 0:t===On?(()=>{if(e._componentsPromise===void 0){const r=Ds(e,On);r?e._componentsPromise=r.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():Ds(e,t);return e._lazyPromise?e._lazyPromise.then(n):n()}function ha(e){for(const t of On)if(e.options[t]?.preload)return!0;return!1}const On=["component","errorComponent","pendingComponent","notFoundComponent"];function Jc(e){return{input:({url:t})=>{for(const n of e)t=Ur(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=ma(e[n],t);return t}}}function Xc(e){const t=la(e.basepath),n=`/${t}`,r=e.caseSensitive?n:n.toLowerCase(),s=`${r}/`;return{input:({url:o})=>{const i=e.caseSensitive?o.pathname:o.pathname.toLowerCase();return i===r?o.pathname="/":i.startsWith(s)&&(o.pathname=o.pathname.slice(n.length)),o},output:({url:o})=>(o.pathname=An(["/",t,o.pathname]),o)}}function Ur(e,t){const n=e?.input?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function ma(e,t){const n=e?.output?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function Zc(e,t){const{createMutableStore:n,createReadonlyStore:r,batch:s,init:o}=t,i=new Map,c=new Map,u=new Map,d=n(e.status),f=n(e.loadedAt),l=n(e.isLoading),h=n(e.isTransitioning),m=n(e.location),g=n(e.resolvedLocation),p=n(e.statusCode),x=n(e.redirect),b=n([]),y=n([]),v=n([]),N=r(()=>gr(i,b.get())),j=r(()=>gr(c,y.get())),k=r(()=>gr(u,v.get())),C=r(()=>b.get()[0]),R=r(()=>b.get().some(Q=>i.get(Q)?.get().status==="pending")),_=r(()=>({locationHref:m.get().href,resolvedLocationHref:g.get()?.href,status:d.get()})),L=r(()=>({status:d.get(),loadedAt:f.get(),isLoading:l.get(),isTransitioning:h.get(),matches:N.get(),location:m.get(),resolvedLocation:g.get(),statusCode:p.get(),redirect:x.get()})),A=tn(64);function D(Q){let he=A.get(Q);return he||(he=r(()=>{const me=b.get();for(const I of me){const E=i.get(I);if(E&&E.routeId===Q)return E.get()}}),A.set(Q,he)),he}const O={status:d,loadedAt:f,isLoading:l,isTransitioning:h,location:m,resolvedLocation:g,statusCode:p,redirect:x,matchesId:b,pendingIds:y,cachedIds:v,matches:N,pendingMatches:j,cachedMatches:k,firstId:C,hasPending:R,matchRouteDeps:_,matchStores:i,pendingMatchStores:c,cachedMatchStores:u,__store:L,getRouteMatchStore:D,setMatches:$,setPending:J,setCached:Y};$(e.matches),o?.(O);function $(Q){xr(Q,i,b,n,s)}function J(Q){xr(Q,c,y,n,s)}function Y(Q){xr(Q,u,v,n,s)}return O}function gr(e,t){const n=[];for(const r of t){const s=e.get(r);s&&n.push(s.get())}return n}function xr(e,t,n,r,s){const o=e.map(c=>c.id),i=new Set(o);s(()=>{for(const c of t.keys())i.has(c)||t.delete(c);for(const c of e){const u=t.get(c.id);if(!u){const d=r(c);d.routeId=c.routeId,t.set(c.id,d);continue}u.routeId=c.routeId,u.get()!==c&&u.set(c)}Rc(n.get(),o)||n.set(o)})}var Ye="__TSR_index",Fs="popstate",Us="beforeunload";function Qc(e){let t=e.getLocation();const n=new Set,r=i=>{t=e.getLocation(),n.forEach(c=>c({location:t,action:i}))},s=i=>{e.notifyOnIndexChange??!0?r(i):t=e.getLocation()},o=async({task:i,navigateOpts:c,...u})=>{if(c?.ignoreBlocker??!1){i();return}const d=e.getBlockers?.()??[],f=u.type==="PUSH"||u.type==="REPLACE";if(typeof document<"u"&&d.length&&f)for(const l of d){const h=Wn(u.path,u.state);if(await l.blockerFn({currentLocation:t,nextLocation:h,action:u.type})){e.onBlocked?.();return}}i()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:i=>(n.add(i),()=>{n.delete(i)}),push:(i,c,u)=>{const d=t.state[Ye];c=$s(d+1,c),o({task:()=>{e.pushState(i,c),r({type:"PUSH"})},navigateOpts:u,type:"PUSH",path:i,state:c})},replace:(i,c,u)=>{const d=t.state[Ye];c=$s(d,c),o({task:()=>{e.replaceState(i,c),r({type:"REPLACE"})},navigateOpts:u,type:"REPLACE",path:i,state:c})},go:(i,c)=>{o({task:()=>{e.go(i),s({type:"GO",index:i})},navigateOpts:c,type:"GO"})},back:i=>{o({task:()=>{e.back(i?.ignoreBlocker??!1),s({type:"BACK"})},navigateOpts:i,type:"BACK"})},forward:i=>{o({task:()=>{e.forward(i?.ignoreBlocker??!1),s({type:"FORWARD"})},navigateOpts:i,type:"FORWARD"})},canGoBack:()=>t.state[Ye]!==0,createHref:i=>e.createHref(i),block:i=>{if(!e.setBlockers)return()=>{};const c=e.getBlockers?.()??[];return e.setBlockers([...c,i]),()=>{const u=e.getBlockers?.()??[];e.setBlockers?.(u.filter(d=>d!==i))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function $s(e,t){t||(t={});const n=ns();return{...t,key:n,__TSR_key:n,[Ye]:e}}function el(e){const t=typeof document<"u"?window:void 0,n=t.history.pushState,r=t.history.replaceState;let s=[];const o=()=>s,i=R=>s=R,c=(R=>R),u=(()=>Wn(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){const R=ns();t.history.replaceState({[Ye]:0,key:R,__TSR_key:R},"")}let d=u(),f,l=!1,h=!1,m=!1,g=!1;const p=()=>d;let x,b;const y=()=>{x&&(C._ignoreSubscribers=!0,(x.isPush?t.history.pushState:t.history.replaceState)(x.state,"",x.href),C._ignoreSubscribers=!1,x=void 0,b=void 0,f=void 0)},v=(R,_,L)=>{const A=c(_);b||(f=d),d=Wn(_,L),x={href:A,state:L,isPush:x?.isPush||R==="push"},b||(b=Promise.resolve().then(()=>y()))},N=R=>{d=u(),C.notify({type:R})},j=async()=>{if(h){h=!1;return}const R=u(),_=R.state[Ye]-d.state[Ye],L=_===1,A=_===-1,D=!L&&!A||l;l=!1;const O=D?"GO":A?"BACK":"FORWARD",$=D?{type:"GO",index:_}:{type:A?"BACK":"FORWARD"};if(m)m=!1;else{const J=o();if(typeof document<"u"&&J.length){for(const Y of J)if(await Y.blockerFn({currentLocation:d,nextLocation:R,action:O})){h=!0,t.history.go(1),C.notify($);return}}}d=u(),C.notify($)},k=R=>{if(g){g=!1;return}let _=!1;const L=o();if(typeof document<"u"&&L.length)for(const A of L){const D=A.enableBeforeUnload??!0;if(D===!0){_=!0;break}if(typeof D=="function"&&D()===!0){_=!0;break}}if(_)return R.preventDefault(),R.returnValue=""},C=Qc({getLocation:p,getLength:()=>t.history.length,pushState:(R,_)=>v("push",R,_),replaceState:(R,_)=>v("replace",R,_),back:R=>(R&&(m=!0),g=!0,t.history.back()),forward:R=>{R&&(m=!0),g=!0,t.history.forward()},go:R=>{l=!0,t.history.go(R)},createHref:R=>c(R),flush:y,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(Us,k,{capture:!0}),t.removeEventListener(Fs,j)},onBlocked:()=>{f&&d!==f&&(d=f)},getBlockers:o,setBlockers:i,notifyOnIndexChange:!1});return t.addEventListener(Us,k,{capture:!0}),t.addEventListener(Fs,j),t.history.pushState=function(...R){const _=n.apply(t.history,R);return C._ignoreSubscribers||N("PUSH"),_},t.history.replaceState=function(...R){const _=r.apply(t.history,R);return C._ignoreSubscribers||N("REPLACE"),_},C}function tl(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function Wn(e,t){const n=tl(e),r=n.indexOf("#"),s=n.indexOf("?"),o=ns();return{href:n,pathname:n.substring(0,r>0?s>0?Math.min(r,s):r:s>0?s:n.length),hash:r>-1?n.substring(r):"",search:s>-1?n.slice(s,r===-1?void 0:r):"",state:t||{[Ye]:0,key:o,__TSR_key:o}}}function ns(){return(Math.random()+1).toString(36).substring(7)}function kt(e,t){const n=t,r=e;return{fromLocation:n,toLocation:r,pathChanged:n?.pathname!==r.pathname,hrefChanged:n?.href!==r.href,hashChanged:n?.hash!==r.hash}}const $r=new WeakMap;var nl=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.routeBranchCache=new WeakMap,this.lightweightCache=new WeakMap,this.startTransition=n=>n(),this.update=n=>{process.env.NODE_ENV!=="production"&&n.notFoundRoute&&console.warn("The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info.");const r=this.options,s=this.basepath??r?.basepath??"/",o=this.basepath===void 0,i=r?.rewrite;if(this.options={...r,...n},this.isServer=this.options.isServer??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=Mc(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=el()),this.origin=this.options.origin,this.origin||(window?.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let f;this.resolvePathCache=tn(1e3),f=this.buildRouteTree(),this.setRoutes(f)}if(!this.stores&&this.latestLocation){const f=this.getStoreConfig(this);this.batch=f.batch,this.stores=Zc(sl(this.latestLocation),f),pl(this)}let c=!1;const u=this.options.basepath??"/",d=this.options.rewrite;if(o||s!==u||i!==d){this.basepath=u;const f=[],l=la(u);l&&l!=="/"&&f.push(Xc({basepath:u})),d&&f.push(d),this.rewrite=f.length===0?void 0:f.length===1?f[0]:Jc(f),this.history&&this.updateLatestLocation(),c=!0}c&&this.stores&&this.stores.location.set(this.latestLocation),typeof window<"u"&&"CSS"in window&&typeof window.CSS?.supports=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a))"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const n=Pc(this.routeTree,this.options.caseSensitive,(r,s)=>{r.init({originalIndex:s})});return this.options.routeMasks&&Cc(this.options.routeMasks,n.processedTree),n},this.subscribe=(n,r)=>{const s={eventType:n,fn:r};return this.subscribers.add(s),()=>{this.subscribers.delete(s)}},this.emit=n=>{this.subscribers.forEach(r=>{r.eventType===n.type&&r.fn(n)})},this.parseLocation=(n,r)=>{const s=({pathname:u,search:d,hash:f,href:l,state:h})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(u)){const b=this.options.parseSearch(d),y=this.options.stringifySearch(b);return{href:u+y+f,publicHref:u+y+f,pathname:Wt(u).path,external:!1,searchStr:y,search:et(r?.search,b),hash:Wt(f.slice(1)).path,state:st(r?.state,h)}}const m=new URL(l,this.origin),g=Ur(this.rewrite,m),p=this.options.parseSearch(g.search),x=this.options.stringifySearch(p);return g.search=x,{href:g.href.replace(g.origin,""),publicHref:l,pathname:Wt(g.pathname).path,external:!!this.rewrite&&g.origin!==this.origin,searchStr:x,search:et(r?.search,p),hash:Wt(g.hash.slice(1)).path,state:st(r?.state,h)}},o=s(n),{__tempLocation:i,__tempKey:c}=o.state;if(i&&(!c||c===this.tempLocationKey)){const u=s(i);return u.state.key=o.state.key,u.state.__TSR_key=o.state.__TSR_key,delete u.state.__tempLocation,{...u,maskedLocation:o}}return o},this.resolvePathWithBase=(n,r)=>Ic({base:n,to:r.includes("//")?ts(r):r,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(n,r,s)=>typeof n=="string"?this.matchRoutesInternal({pathname:n,search:r},s):this.matchRoutesInternal(n,r),this.getMatchedRoutes=n=>ol({pathname:n,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=n=>{const r=this.getMatch(n);r&&(r.abortController.abort(),clearTimeout(r._nonReactive.pendingTimeout),r._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingIds.get().forEach(n=>{this.cancelMatch(n)}),this.stores.matchesId.get().forEach(n=>{if(this.stores.pendingMatchStores.has(n))return;const r=this.stores.matchStores.get(n)?.get();r&&(r.status==="pending"||r.isFetching==="loader")&&this.cancelMatch(n)})},this.buildLocation=n=>{const r=(o={})=>{const i=o._fromLocation||this.pendingBuiltLocation||this.latestLocation,c=this.matchRoutesLightweight(i);if(o.from&&process.env.NODE_ENV!=="production"&&o._isNavigate){const A=this.getMatchedRoutes(o.from).matchedRoutes,D=ks(c.matchedRoutes,$=>zs($.fullPath,o.from)),O=ks(A,$=>zs($.fullPath,c.fullPath));!D&&!O&&console.warn(`Could not find match for from: ${o.from}`)}const u=o.unsafeRelative==="path"?i.pathname:o.from??c.fullPath,d=o.to?`${o.to}`:void 0,f=c.search,l=Object.assign(Object.create(null),c.params),h=d?.charCodeAt(0)===47?"/":this.resolvePathWithBase(u,"."),m=d?this.resolvePathWithBase(h,d):h,g=o.params===!1||o.params===null?Object.create(null):(o.params??!0)===!0?l:Object.assign(l,rt(o.params,l)),p=this.routesByPath[Ue(m)];let x;if(p)x=this.getRouteBranch(p);else if(m.includes("$"))x=[];else{const A=this.getMatchedRoutes(m);x=A.matchedRoutes,this.options.notFoundRoute&&(!A.foundRoute||A.foundRoute.path!=="/"&&A.routeParams["**"])&&(x=[...x,this.options.notFoundRoute])}if(x.length&&ra(g))for(const A of x){const D=A.options.params?.stringify??A.options.stringifyParams;if(D)try{Object.assign(g,D(g))}catch{}}const b=n.leaveParams?m:Wt(As({path:m,params:g,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;if(process.env.NODE_ENV!=="production"&&p&&!n.leaveParams)try{const A=this.getMatchedRoutes(b);A.foundRoute?.id!==p.id&&console.warn(`Generated path "${b}" for route "${p.id}" matched route "${A.foundRoute?.id}" instead. This can happen when multiple route templates resolve to the same URL. Use the route template that matches the intended route, or adjust params.stringify if it changed the target path.`)}catch{}let y=f;if(n._includeValidateSearch&&this.options.search?.strict){const A={};x.forEach(D=>{if(D.options.validateSearch)try{Object.assign(A,Tn(D.options.validateSearch,{...A,...y}))}catch{}}),y=A}y=al({search:y,dest:o,destRoutes:x,_includeValidateSearch:n._includeValidateSearch}),y=et(f,y);const v=this.options.stringifySearch(y),N=o.hash===!0?i.hash:o.hash?rt(o.hash,i.hash):void 0,j=N?`#${N}`:"";let k=o.state===!0?i.state:o.state?rt(o.state,i.state):{};k=st(i.state,k);const C=`${b}${v}${j}`;let R,_,L=!1;if(this.rewrite){const A=new URL(C,this.origin),D=ma(this.rewrite,A);R=A.href.replace(A.origin,""),D.origin!==this.origin?(_=D.href,L=!0):_=D.pathname+D.search+D.hash}else R=Sc(C),_=R;return{publicHref:_,href:R,pathname:b,search:y,searchStr:v,state:k,hash:N??"",external:L,unmaskOnReload:o.unmaskOnReload}},s=(o={},i)=>{const c=r(o);let u=i?r(i):void 0;if(!u){const d=Object.create(null);if(this.options.routeMasks){const f=jc(c.pathname,this.processedTree);if(f){Object.assign(d,f.rawParams);const{from:l,params:h,...m}=f.route,g=h===!1||h===null?Object.create(null):(h??!0)===!0?d:Object.assign(d,rt(h,d));i={from:n.from,...m,params:g},u=r(i)}}}return u&&(c.maskedLocation=u),c};return n.mask?s(n,{from:n.from,...n.mask}):s(n)},this.commitLocation=async({viewTransition:n,ignoreBlocker:r,...s})=>{let o;const i=()=>{const d=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];d.forEach(l=>{s.state[l]=this.latestLocation.state[l]});const f=ct(s.state,this.latestLocation.state);return d.forEach(l=>{delete s.state[l]}),f},c=Ue(this.latestLocation.href)===Ue(s.href);let u=this.commitLocationPromise;if(this.commitLocationPromise=Pt(()=>{u?.resolve(),u=void 0}),c&&i())this.load();else{let{maskedLocation:d,hashScrollIntoView:f,...l}=s;d&&(l={...d,state:{...d.state,__tempKey:void 0,__tempLocation:{...l,search:l.searchStr,state:{...l.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(l.unmaskOnReload??this.options.unmaskOnReload??!1)&&(l.state.__tempKey=this.tempLocationKey)),l.state.__hashScrollIntoViewOptions=f??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=n,o=s.replace?"REPLACE":"PUSH",this.history[o==="REPLACE"?"replace":"push"](l.publicHref,l.state,{ignoreBlocker:r})}return this._scroll.next=s.resetScroll??!0,this.history.subscribers.size||this.load(o?{action:{type:o}}:void 0),this.commitLocationPromise},this.buildAndCommitLocation=({replace:n,resetScroll:r,hashScrollIntoView:s,viewTransition:o,ignoreBlocker:i,href:c,...u}={})=>{if(c){const l=this.history.location.state.__TSR_index,h=Wn(c,{__TSR_index:n?l:l+1}),m=new URL(h.pathname,this.origin);u.to=Ur(this.rewrite,m).pathname,u.search=this.options.parseSearch(h.search),u.hash=h.hash.slice(1)}const d=this.buildLocation({...u,_includeValidateSearch:!0});this.pendingBuiltLocation=d;const f=this.commitLocation({...d,viewTransition:o,replace:n,resetScroll:r,hashScrollIntoView:s,ignoreBlocker:i});return queueMicrotask(()=>{this.pendingBuiltLocation===d&&(this.pendingBuiltLocation=void 0)}),f},this.navigate=async({to:n,reloadDocument:r,href:s,publicHref:o,...i})=>{let c=!1;if(s)try{new URL(`${s}`),c=!0}catch{}if(c&&!r&&(r=!0),r){if(n!==void 0||!s){const d=this.buildLocation({to:n,...i});s=s??d.publicHref,o=o??d.publicHref}const u=!c&&o?o:s;if(Bn(u,this.protocolAllowlist)){process.env.NODE_ENV!=="production"&&console.warn(`Blocked navigation to dangerous protocol: ${u}`);return}if(!i.ignoreBlocker){const d=this.history.getBlockers?.()??[];for(const f of d)if(f?.blockerFn&&await f.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return}i.replace?window.location.replace(u):window.location.href=u;return}return this.buildAndCommitLocation({...i,href:s,to:n,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();const n=this.matchRoutes(this.latestLocation),r=this.stores.cachedMatches.get().filter(s=>!n.some(o=>o.id===s.id));this.batch(()=>{this.stores.status.set("pending"),this.stores.statusCode.set(200),this.stores.isLoading.set(!0),this.stores.location.set(this.latestLocation),this.stores.setPending(n),this.stores.setCached(r)})},this.load=async n=>{const r=n?.action?.type;let s,o,i;const c=this.stores.resolvedLocation.get()??this.stores.location.get();for(i=new Promise(d=>{this.startTransition(async()=>{try{this.beforeLoad(),r?$r.set(this.latestLocation,r):$r.delete(this.latestLocation);const f=this.latestLocation,l=kt(f,this.stores.resolvedLocation.get());this.stores.redirect.get()||this.emit({type:"onBeforeNavigate",...l}),this.emit({type:"onBeforeLoad",...l}),await Ms({router:this,sync:n?.sync,forceStaleReload:c.href===f.href,matches:this.stores.pendingMatches.get(),location:f,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let h=null,m=null,g=null,p=null;this.batch(()=>{const x=this.stores.pendingMatches.get(),b=x.length,y=this.stores.matches.get();h=b?y.filter(j=>!this.stores.pendingMatchStores.has(j.id)):null;const v=new Set;for(const j of this.stores.pendingMatchStores.values())j.routeId&&v.add(j.routeId);const N=new Set;for(const j of this.stores.matchStores.values())j.routeId&&N.add(j.routeId);m=b?y.filter(j=>!v.has(j.routeId)):null,g=b?x.filter(j=>!N.has(j.routeId)):null,p=b?x.filter(j=>N.has(j.routeId)):y,this.stores.isLoading.set(!1),this.stores.loadedAt.set(Date.now()),b&&(this.stores.setMatches(x),this.stores.setPending([]),this.stores.setCached([...this.stores.cachedMatches.get(),...h.filter(j=>j.status!=="error"&&j.status!=="notFound"&&j.status!=="redirected")]),this.clearExpiredCache())});for(const[x,b]of[[m,"onLeave"],[g,"onEnter"],[p,"onStay"]])if(x)for(const y of x)this.looseRoutesById[y.routeId].options[b]?.(y)})})}})}catch(f){we(f)?(s=f,this.navigate({...s.options,replace:!0,ignoreBlocker:!0})):xe(f)&&(o=f);const l=s?s.status:o?404:this.stores.matches.get().some(h=>h.status==="error")?500:200;this.batch(()=>{this.stores.statusCode.set(l),this.stores.redirect.set(s)})}this.latestLoadPromise===i&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),d()})}),this.latestLoadPromise=i,await i;this.latestLoadPromise&&i!==this.latestLoadPromise;)await this.latestLoadPromise;let u;this.hasNotFoundMatch()?u=404:this.stores.matches.get().some(d=>d.status==="error")&&(u=500),u!==void 0&&this.stores.statusCode.set(u)},this.startViewTransition=n=>{const r=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,r&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let s;if(typeof r=="object"&&this.isViewTransitionTypesSupported){const o=this.latestLocation,i=this.stores.resolvedLocation.get(),c=typeof r.types=="function"?r.types(kt(o,i)):r.types;if(c===!1){n();return}s={update:n,types:c}}else s=n;document.startViewTransition(s)}else n()},this.updateMatch=(n,r)=>{this.startTransition(()=>{const s=this.stores.pendingMatchStores.get(n);if(s){s.set(r);return}const o=this.stores.matchStores.get(n);if(o){o.set(r);return}const i=this.stores.cachedMatchStores.get(n);if(i){const c=r(i.get());c.status==="redirected"?this.stores.cachedMatchStores.delete(n)&&this.stores.cachedIds.set(u=>u.filter(d=>d!==n)):i.set(c)}})},this.getMatch=n=>this.stores.cachedMatchStores.get(n)?.get()??this.stores.pendingMatchStores.get(n)?.get()??this.stores.matchStores.get(n)?.get(),this.invalidate=n=>{const r=s=>n?.filter?.(s)??!0?{...s,invalid:!0,...n?.forcePending||s.status==="error"||s.status==="notFound"?{status:"pending",error:void 0}:void 0}:s;return this.batch(()=>{this.stores.setMatches(this.stores.matches.get().map(r)),this.stores.setCached(this.stores.cachedMatches.get().map(r)),this.stores.setPending(this.stores.pendingMatches.get().map(r))}),this.shouldViewTransition=!1,this.load({sync:n?.sync})},this.getParsedLocationHref=n=>n.publicHref||"/",this.resolveRedirect=n=>{const r=n.headers.get("Location");if(!n.options.href||n.options._builtLocation){const s=n.options._builtLocation??this.buildLocation(n.options),o=this.getParsedLocationHref(s);n.options.href=o,n.headers.set("Location",o)}else if(r)try{const s=new URL(r);if(this.origin&&s.origin===this.origin){const o=s.pathname+s.search+s.hash;n.options.href=o,n.headers.set("Location",o)}}catch{}if(n.options.href&&!n.options._builtLocation&&Bn(n.options.href,this.protocolAllowlist))throw new Error(process.env.NODE_ENV!=="production"?`Redirect blocked: unsafe protocol in href "${n.options.href}". Allowed protocols: ${Array.from(this.protocolAllowlist).join(", ")}.`:"Redirect blocked: unsafe protocol");return n.headers.get("Location")||n.headers.set("Location",n.options.href),n},this.clearCache=n=>{const r=n?.filter;r!==void 0?this.stores.setCached(this.stores.cachedMatches.get().filter(s=>!r(s))):this.stores.setCached([])},this.clearExpiredCache=()=>{const n=Date.now(),r=s=>{const o=this.looseRoutesById[s.routeId];if(!o.options.loader)return!0;const i=(s.preload?o.options.preloadGcTime??this.options.defaultPreloadGcTime:o.options.gcTime??this.options.defaultGcTime)??300*1e3;return s.status==="error"?!0:n-s.updatedAt>=i};this.clearCache({filter:r})},this.loadRouteChunk=nn,this.preloadRoute=async n=>{const r=n._builtLocation??this.buildLocation(n);let s=this.matchRoutes(r,{throwOnError:!0,preload:!0,dest:n});const o=new Set([...this.stores.matchesId.get(),...this.stores.pendingIds.get()]),i=new Set([...o,...this.stores.cachedIds.get()]),c=s.filter(u=>!i.has(u.id));if(c.length){const u=this.stores.cachedMatches.get();this.stores.setCached([...u,...c])}try{return s=await Ms({router:this,matches:s,location:r,preload:!0,updateMatch:(u,d)=>{o.has(u)?s=s.map(f=>f.id===u?d(f):f):this.updateMatch(u,d)}}),s}catch(u){if(we(u))return u.options.reloadDocument?void 0:await this.preloadRoute({...u.options,_fromLocation:r});xe(u)||console.error(u);return}},this.matchRoute=(n,r)=>{const s={...n,to:n.to?this.resolvePathWithBase(n.from||"",n.to):void 0,params:n.params||{},leaveParams:!0},o=this.buildLocation(s);if(r?.pending&&this.stores.status.get()!=="pending")return!1;const i=(r?.pending===void 0?!this.stores.isLoading.get():r.pending)?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),c=Ec(o.pathname,r?.caseSensitive??!1,r?.fuzzy??!1,i.pathname,this.processedTree);return!c||n.params&&!ct(c.rawParams,n.params,{partial:!0})?!1:r?.includeSearch??!0?ct(i.search,o.search,{partial:!0})?c.rawParams:!1:c.rawParams},this.hasNotFoundMatch=()=>this.stores.matches.get().some(n=>n.status==="notFound"||n.globalNotFound),this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??"fuzzy",stringifySearch:e.stringifySearch??$c,parseSearch:e.parseSearch??Uc,protocolAllowlist:e.protocolAllowlist??wc}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;const r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=ia(e),this.routeBranchCache.set(e,t)),t}get looseRoutesById(){return this.routesById}getParentContext(e){return e?.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,t){const n=this.getMatchedRoutes(e.pathname),{foundRoute:r,routeParams:s}=n;let{matchedRoutes:o}=n,i=!1;(r?r.path!=="/"&&s["**"]:Ue(e.pathname))&&(this.options.notFoundRoute?o=[...o,this.options.notFoundRoute]:i=!0);const c=i?cl(this.options.notFoundMode,o):void 0,u=new Array(o.length),d=new Map;for(const f of this.stores.matchStores.values())f.routeId&&d.set(f.routeId,f.get());for(let f=0;f<o.length;f++){const l=o[f],h=u[f-1];let m,g,p;{const D=h?.search??e.search,O=h?._strictSearch??void 0;try{const $=Tn(l.options.validateSearch,{...D})??void 0;m={...D,...$},g={...O,...$},p=void 0}catch($){let J=$;if($ instanceof Vn||(J=new Vn($.message,{cause:$})),t?.throwOnError)throw J;m=D,g={},p=J}}const x=l.options.loaderDeps?.({search:m})??"",b=x?JSON.stringify(x):"",{interpolatedPath:y,usedParams:v}=As({path:l.fullPath,params:s,decoder:this.pathParamsDecoder,server:this.isServer}),N=l.id+y+b,j=this.getMatch(N),k=d.get(l.id),C=j?._strictParams??v;let R;if(!j)try{Ws(l,C)}catch(D){if(xe(D)||we(D)?R=D:R=new rl(D.message,{cause:D}),t?.throwOnError)throw R}Object.assign(s,C);const _=k?"stay":"enter";let L;if(j)L={...j,cause:_,params:k?.params??s,_strictParams:C,search:et(k?k.search:j.search,m),_strictSearch:g};else{const D=l.options.loader||l.options.beforeLoad||l.lazyFn||ha(l)?"pending":"success";L={id:N,ssr:l.options.ssr,index:f,routeId:l.id,params:k?.params??s,_strictParams:C,pathname:y,updatedAt:Date.now(),search:k?et(k.search,m):m,_strictSearch:g,searchError:void 0,status:D,isFetching:!1,error:void 0,paramsError:R,__routeContext:void 0,_nonReactive:{loadPromise:Pt()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:_,loaderDeps:k?st(k.loaderDeps,x):x,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:l.options.staticData||{},fullPath:l.fullPath}}t?.preload||(L.globalNotFound=c===l.id),L.searchError=p;const A=this.getParentContext(h);L.context={...A,...L.__routeContext,...L.__beforeLoadContext},u[f]=L}for(let f=0;f<u.length;f++){const l=u[f],h=this.looseRoutesById[l.routeId],m=this.getMatch(l.id),g=d.get(l.routeId);if(l.params=g?et(g.params,s):s,!m){const p=u[f-1],x=this.getParentContext(p);if(h.options.context){const b={deps:l.loaderDeps,params:l.params,context:x??{},location:e,navigate:y=>this.navigate({...y,_fromLocation:e}),buildLocation:this.buildLocation,cause:l.cause,abortController:l.abortController,preload:!!l.preload,matches:u,routeId:h.id};l.__routeContext=h.options.context(b)??void 0}l.context={...x,...l.__routeContext,...l.__beforeLoadContext}}}return u}matchRoutesLightweight(e){const t=Qt(this.stores.matchesId.get()),n=this.lightweightCache.get(e);if(n&&n[0]===t)return n[1];const{matchedRoutes:r,routeParams:s}=this.getMatchedRoutes(e.pathname),o=Qt(r),i={...e.search};for(const l of r)try{Object.assign(i,Tn(l.options.validateSearch,i))}catch{}const c=t&&this.stores.matchStores.get(t)?.get(),u=c&&c.routeId===o.id&&c.pathname===e.pathname;let d;if(u)d=c.params;else{const l=Object.assign(Object.create(null),s);for(const h of r)try{Ws(h,l)}catch{}d=l}const f={matchedRoutes:r,fullPath:o.fullPath,search:i,params:d};return this.lightweightCache.set(e,[t,f]),f}},Vn=class extends Error{},rl=class extends Error{};const Bs=e=>e.endsWith("/")&&e.length>1?e.slice(0,-1):e;function zs(e,t){return Bs(e)===Bs(t)}function sl(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:e,matches:[],statusCode:200}}function Tn(e,t){if(e==null)return{};if("~standard"in e){const n=e["~standard"].validate(t);if(n instanceof Promise)throw new Vn("Async validation not supported");if(n.issues)throw new Vn(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return"parse"in e?e.parse(t):typeof e=="function"?e(t):{}}function ol({pathname:e,routesById:t,processedTree:n}){const r=Object.create(null),s=Ue(e);let o;const i=kc(s,n,!0);return i&&(o=i.route,Object.assign(r,i.rawParams)),{matchedRoutes:i?.branch||[t.__root__],routeParams:r,foundRoute:o}}function al({search:e,dest:t,destRoutes:n,_includeValidateSearch:r}){return il(n)(e,t,r??!1)}function il(e){let t,n;const r=[];for(const o of e){const i=o.options;if("search"in i)i.search?.middlewares&&r.push(...i.search.middlewares);else if(i.preSearchFilters||i.postSearchFilters){const u=({search:d,next:f})=>{const l=f(i.preSearchFilters?i.preSearchFilters.reduce((h,m)=>m(h),d):d);return i.postSearchFilters?i.postSearchFilters.reduce((h,m)=>m(h),l):l};r.push(u)}const c=i.validateSearch;if(c){const u=({search:d,next:f,meta:l})=>{const h=f(d);if(n)try{const m=Tn(c,h);if(l&&m)for(const g in m)g in h||(l.defaulted||=new Map).set(g,m[g]);return{...h,...m}}catch{}return h};r.push(u)}}const s=(o,i,c)=>{if(o>=r.length){if(!t.search)return{};if(t.search===!0)return i;const d=rt(t.search,i);return c&&(c.explicit=d),d}const u=(d,f)=>{if(f){const l=c||{};return{search:s(o+1,d,l),meta:l}}return s(o+1,d,c)};return r[o]({search:i,next:u,meta:c})};return function(i,c,u){return t=c,n=u,s(0,i)}}function cl(e,t){if(e!=="root")for(let n=t.length-1;n>=0;n--){const r=t[n];if(r.children)return r.id}return lt}function Ws(e,t){const n=e.options.params?.parse??e.options.parseParams;if(n){const r=n(t);if(r===!1)throw new Error("Route params.parse returned false for a matched route");Object.assign(t,r)}}function ll(){try{return sessionStorage}catch{return}}const ul="tsr-scroll-restoration-v1_3",pa=ll();function dl(){try{return JSON.parse(pa?.getItem("tsr-scroll-restoration-v1_3")||"{}")}catch{return{}}}function fl(){try{pa?.setItem(ul,JSON.stringify(Ct))}catch{process.env.NODE_ENV!=="production"&&console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}const Ct=dl(),Vs="data-scroll-restoration-id",hl=e=>e.state.__TSR_key||e.href;function ml(e){const t=e.getAttribute(Vs);if(t)return`[${Vs}="${t}"]`;let n="",r=e,s;for(;s=r.parentNode;){let o=1,i=r;for(;i=i.previousElementSibling;)o++;const c=`${r.localName}:nth-child(${o})`;n=n?`${c} > ${n}`:c,r=s}return n}let pn=!1;const jt="window";function Br(e){try{return typeof e=="function"?e():document.querySelector(e)}catch{}}function Hs(e){const t=[];for(const n of e){if(n===jt)continue;const r=Br(n);r&&t.push(r)}return t}function pl(e,t){const n=e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);const s=e.options.getScrollRestorationKey||hl,o=new Map,i=(d,f,l)=>{const h=o.get(d)||{};h.scrollX=f,h.scrollY=l,o.set(d,h)},c=d=>{if(!(pn||!r.restoring))if(d.target===document)i(jt,scrollX,scrollY);else{const f=d.target;i(f,f.scrollLeft,f.scrollTop)}},u=d=>{if(!r.restoring)return;const f=Ct[d]||={};for(const[l,h]of o)l===jt?f[jt]=h:l.isConnected&&(f[ml(l)]=h)};n&&!r.restoration&&(r.restoration=!0,pn=!1,history.scrollRestoration="manual",document.addEventListener("scroll",c,!0),e.subscribe("onBeforeLoad",d=>{d.fromLocation&&u(s(d.fromLocation)),o.clear()}),addEventListener("pagehide",()=>{u(s(e.stores.resolvedLocation.get()??e.stores.location.get())),fl()})),!r.reset&&(r.reset=!0,e.subscribe("onRendered",d=>{const f=e.options.scrollRestorationBehavior,l=e.options.scrollToTopSelectors,h=r.next;let m;if(o.clear(),h||(r.next=!0),typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation}))return;const g=s(d.toLocation),p=d.fromLocation&&s(d.fromLocation);if(r.restoring&&p&&p!==g){const x=Ct[p];if(x){let b=Ct[g];for(const y in x){if(y===jt){if(h)continue}else{const v=Br(y);if(!v||h&&l&&(m??=Hs(l),m.includes(v)))continue}b||(b=Ct[g]={}),b[y]??=x[y]}}}pn=!0;try{const x=d.toLocation.hash,b=d.toLocation.state.__hashScrollIntoViewOptions??!0;let y=!1;if(h){const v=$r.get(d.toLocation),N=x&&b&&(v==="PUSH"||v==="REPLACE"),j=r.restoring?Ct[g]:void 0;if(j)for(const k in j){const{scrollX:C,scrollY:R}=j[k];if(k===jt){if(N)continue;scrollTo({top:R,left:C,behavior:f}),y=!0}else{const _=Br(k);_&&(_.scrollLeft=C,_.scrollTop=R)}}if(!y&&!x){const k={top:0,left:0,behavior:f};if(scrollTo(k),l){m??=Hs(l);for(const C of m)C.scrollTo(k)}}}!y&&x&&b&&document.getElementById(x)?.scrollIntoView(b)}finally{pn=!1}}))}const gl="Error preloading route! ☝️";var ga=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=t=>{this.originalIndex=t.originalIndex;const n=this.options,r=!n?.path&&!n?.id;if(this.parentRoute=this.options.getParentRoute?.(),r)this._path=lt;else if(!this.parentRoute){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a Route instance.");$e()}let s=r?lt:n?.path;s&&s!=="/"&&(s=ca(s));const o=n?.id||s;let i=r?lt:An([this.parentRoute.id==="__root__"?"":this.parentRoute.id,o]);s==="__root__"&&(s="/"),i!=="__root__"&&(i=An(["/",i]));const c=i==="__root__"?"/":An([this.parentRoute.fullPath,s]);this._path=s,this._id=i,this._fullPath=c,this._to=Ue(c)},this.addChildren=t=>this._addFileChildren(t),this._addFileChildren=t=>(Array.isArray(t)&&(this.children=t),typeof t=="object"&&t!==null&&(this.children=Object.values(t)),this),this._addFileTypes=()=>this,this.updateLoader=t=>(Object.assign(this.options,t),this),this.update=t=>(Object.assign(this.options,t),this),this.lazy=t=>(this.lazyFn=t,this),this.redirect=t=>Wc({from:this.fullPath,...t}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw new Error("Route cannot have both an 'id' and a 'path' option.")}},xl=class extends ga{constructor(e){super(e)}};function rs(e){const t=e.errorComponent??ss;return a.jsx(bl,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?S.createElement(t,{error:n,reset:r}):e.children})}var bl=class extends S.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e,t){const n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.error,reset:()=>{this.reset()}})}};function ss({error:e}){const[t,n]=S.useState(process.env.NODE_ENV!=="production");return a.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[a.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),a.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>n(r=>!r),children:t?"Hide Error":"Show Error"})]}),a.jsx("div",{style:{height:".25rem"}}),t?a.jsx("div",{children:a.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?a.jsx("code",{children:e.message}):null})}):null]})}function yl({children:e,fallback:t=null}){return xa()?a.jsx(P.Fragment,{children:e}):a.jsx(P.Fragment,{children:t})}function xa(){return P.useSyncExternalStore(vl,()=>!0,()=>!1)}function vl(){return()=>{}}var ba=S.createContext(null);function Ee(e){const t=S.useContext(ba);return process.env.NODE_ENV!=="production"&&(t||console.warn("Warning: useRouter must be used inside a <RouterProvider> component!")),t}var nr=S.createContext(void 0),wl=S.createContext(void 0),se=(e=>(e[e.None=0]="None",e[e.Mutable=1]="Mutable",e[e.Watching=2]="Watching",e[e.RecursedCheck=4]="RecursedCheck",e[e.Recursed=8]="Recursed",e[e.Dirty=16]="Dirty",e[e.Pending=32]="Pending",e))(se||{});function Sl({update:e,notify:t,unwatched:n}){return{link:r,unlink:s,propagate:o,checkDirty:i,shallowPropagate:c};function r(d,f,l){const h=f.depsTail;if(h!==void 0&&h.dep===d)return;const m=h!==void 0?h.nextDep:f.deps;if(m!==void 0&&m.dep===d){m.version=l,f.depsTail=m;return}const g=d.subsTail;if(g!==void 0&&g.version===l&&g.sub===f)return;const p=f.depsTail=d.subsTail={version:l,dep:d,sub:f,prevDep:h,nextDep:m,prevSub:g,nextSub:void 0};m!==void 0&&(m.prevDep=p),h!==void 0?h.nextDep=p:f.deps=p,g!==void 0?g.nextSub=p:d.subs=p}function s(d,f=d.sub){const l=d.dep,h=d.prevDep,m=d.nextDep,g=d.nextSub,p=d.prevSub;return m!==void 0?m.prevDep=h:f.depsTail=h,h!==void 0?h.nextDep=m:f.deps=m,g!==void 0?g.prevSub=p:l.subsTail=p,p!==void 0?p.nextSub=g:(l.subs=g)===void 0&&n(l),m}function o(d){let f=d.nextSub,l;e:do{const h=d.sub;let m=h.flags;if(m&60?m&12?m&4?!(m&48)&&u(d,h)?(h.flags=m|40,m&=1):m=0:h.flags=m&-9|32:m=0:h.flags=m|32,m&2&&t(h),m&1){const g=h.subs;if(g!==void 0){const p=(d=g).nextSub;p!==void 0&&(l={value:f,prev:l},f=p);continue}}if((d=f)!==void 0){f=d.nextSub;continue}for(;l!==void 0;)if(d=l.value,l=l.prev,d!==void 0){f=d.nextSub;continue e}break}while(!0)}function i(d,f){let l,h=0,m=!1;e:do{const g=d.dep,p=g.flags;if(f.flags&16)m=!0;else if((p&17)===17){if(e(g)){const x=g.subs;x.nextSub!==void 0&&c(x),m=!0}}else if((p&33)===33){(d.nextSub!==void 0||d.prevSub!==void 0)&&(l={value:d,prev:l}),d=g.deps,f=g,++h;continue}if(!m){const x=d.nextDep;if(x!==void 0){d=x;continue}}for(;h--;){const x=f.subs,b=x.nextSub!==void 0;if(b?(d=l.value,l=l.prev):d=x,m){if(e(f)){b&&c(x),f=d.sub;continue}m=!1}else f.flags&=-33;f=d.sub;const y=d.nextDep;if(y!==void 0){d=y;continue e}}return m}while(!0)}function c(d){do{const f=d.sub,l=f.flags;(l&48)===32&&(f.flags=l|16,(l&6)===2&&t(f))}while((d=d.nextSub)!==void 0)}function u(d,f){let l=f.depsTail;for(;l!==void 0;){if(l===d)return!0;l=l.prevDep}return!1}}function Rl(e,t,n){const r=typeof e=="object",s=r?e:void 0;return{next:(r?e.next:e)?.bind(s),error:(r?e.error:t)?.bind(s),complete:(r?e.complete:n)?.bind(s)}}const zr=[];let Ln=0;const{link:qs,unlink:Nl,propagate:Cl,checkDirty:ya,shallowPropagate:Gs}=Sl({update(e){return e._update()},notify(e){zr[Wr++]=e,e.flags&=~se.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=se.Mutable|se.Dirty,Hn(e))}});let gn=0,Wr=0,Ie,Vr=0;function va(e){try{++Vr,e()}finally{--Vr||wa()}}function Hn(e){const t=e.depsTail;let n=t!==void 0?t.nextDep:e.deps;for(;n!==void 0;)n=Nl(n,e)}function wa(){if(!(Vr>0)){for(;gn<Wr;){const e=zr[gn];zr[gn++]=void 0,e.notify()}gn=0,Wr=0}}function Ks(e,t){const n=typeof e=="function",r=e,s={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?se.None:se.Mutable,get(){return Ie!==void 0&&qs(s,Ie,Ln),s._snapshot},subscribe(o){const i=Rl(o),c={current:!1},u=jl(()=>{s.get(),c.current?i.next?.(s._snapshot):c.current=!0});return{unsubscribe:()=>{u.stop()}}},_update(o){const i=Ie,c=t?.compare??Object.is;if(n)Ie=s,++Ln,s.depsTail=void 0;else if(o===void 0)return!1;n&&(s.flags=se.Mutable|se.RecursedCheck);try{const u=s._snapshot,d=typeof o=="function"?o(u):o===void 0&&n?r(u):o;return u===void 0||!c(u,d)?(s._snapshot=d,!0):!1}finally{Ie=i,n&&(s.flags&=~se.RecursedCheck),Hn(s)}}};return n?(s.flags=se.Mutable|se.Dirty,s.get=function(){const o=s.flags;if(o&se.Dirty||o&se.Pending&&ya(s.deps,s)){if(s._update()){const i=s.subs;i!==void 0&&Gs(i)}}else o&se.Pending&&(s.flags=o&~se.Pending);return Ie!==void 0&&qs(s,Ie,Ln),s._snapshot}):s.set=function(o){if(s._update(o)){const i=s.subs;i!==void 0&&(Cl(i),Gs(i),wa())}},s}function jl(e){const t=()=>{const r=Ie;Ie=n,++Ln,n.depsTail=void 0,n.flags=se.Watching|se.RecursedCheck;try{return e()}finally{Ie=r,n.flags&=~se.RecursedCheck,Hn(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:se.Watching|se.RecursedCheck,notify(){const r=this.flags;r&se.Dirty||r&se.Pending&&ya(this.deps,this)?t():this.flags=se.Watching},stop(){this.flags=se.None,this.depsTail=void 0,Hn(this)}};return t(),n}var xn={exports:{}},br={},bn={exports:{}},yr={};var Ys;function El(){if(Ys)return yr;Ys=1;var e=P;function t(l,h){return l===h&&(l!==0||1/l===1/h)||l!==l&&h!==h}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,o=e.useLayoutEffect,i=e.useDebugValue;function c(l,h){var m=h(),g=r({inst:{value:m,getSnapshot:h}}),p=g[0].inst,x=g[1];return o(function(){p.value=m,p.getSnapshot=h,u(p)&&x({inst:p})},[l,m,h]),s(function(){return u(p)&&x({inst:p}),l(function(){u(p)&&x({inst:p})})},[l]),i(m),m}function u(l){var h=l.getSnapshot;l=l.value;try{var m=h();return!n(l,m)}catch{return!0}}function d(l,h){return h()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:c;return yr.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,yr}var vr={};var Js;function kl(){return Js||(Js=1,process.env.NODE_ENV!=="production"&&(function(){function e(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}function t(m,g){f||s.startTransition===void 0||(f=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var p=g();if(!l){var x=g();o(p,x)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),l=!0)}x=i({inst:{value:p,getSnapshot:g}});var b=x[0].inst,y=x[1];return u(function(){b.value=p,b.getSnapshot=g,n(b)&&y({inst:b})},[m,p,g]),c(function(){return n(b)&&y({inst:b}),m(function(){n(b)&&y({inst:b})})},[m]),d(p),p}function n(m){var g=m.getSnapshot;m=m.value;try{var p=g();return!o(m,p)}catch{return!0}}function r(m,g){return g()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=P,o=typeof Object.is=="function"?Object.is:e,i=s.useState,c=s.useEffect,u=s.useLayoutEffect,d=s.useDebugValue,f=!1,l=!1,h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;vr.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:h,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),vr}var Xs;function Sa(){return Xs||(Xs=1,process.env.NODE_ENV==="production"?bn.exports=El():bn.exports=kl()),bn.exports}var Zs;function _l(){if(Zs)return br;Zs=1;var e=P,t=Sa();function n(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var r=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,o=e.useRef,i=e.useEffect,c=e.useMemo,u=e.useDebugValue;return br.useSyncExternalStoreWithSelector=function(d,f,l,h,m){var g=o(null);if(g.current===null){var p={hasValue:!1,value:null};g.current=p}else p=g.current;g=c(function(){function b(k){if(!y){if(y=!0,v=k,k=h(k),m!==void 0&&p.hasValue){var C=p.value;if(m(C,k))return N=C}return N=k}if(C=N,r(v,k))return C;var R=h(k);return m!==void 0&&m(C,R)?(v=k,C):(v=k,N=R)}var y=!1,v,N,j=l===void 0?null:l;return[function(){return b(f())},j===null?void 0:function(){return b(j())}]},[f,l,h,m]);var x=s(d,g[0],g[1]);return i(function(){p.hasValue=!0,p.value=x},[x]),u(x),x},br}var wr={};var Qs;function Pl(){return Qs||(Qs=1,process.env.NODE_ENV!=="production"&&(function(){function e(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=P,n=Sa(),r=typeof Object.is=="function"?Object.is:e,s=n.useSyncExternalStore,o=t.useRef,i=t.useEffect,c=t.useMemo,u=t.useDebugValue;wr.useSyncExternalStoreWithSelector=function(d,f,l,h,m){var g=o(null);if(g.current===null){var p={hasValue:!1,value:null};g.current=p}else p=g.current;g=c(function(){function b(k){if(!y){if(y=!0,v=k,k=h(k),m!==void 0&&p.hasValue){var C=p.value;if(m(C,k))return N=C}return N=k}if(C=N,r(v,k))return C;var R=h(k);return m!==void 0&&m(C,R)?(v=k,C):(v=k,N=R)}var y=!1,v,N,j=l===void 0?null:l;return[function(){return b(f())},j===null?void 0:function(){return b(j())}]},[f,l,h,m]);var x=s(d,g[0],g[1]);return i(function(){p.hasValue=!0,p.value=x},[x]),u(x),x},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),wr}var eo;function Al(){return eo||(eo=1,process.env.NODE_ENV==="production"?xn.exports=_l():xn.exports=Pl()),xn.exports}var Ol=Al();function Tl(e,t){return e===t}function Ne(e,t,n=Tl){const r=P.useCallback(i=>{if(!e)return()=>{};const{unsubscribe:c}=e.subscribe(i);return c},[e]),s=P.useCallback(()=>e?.get(),[e]);return Ol.useSyncExternalStoreWithSelector(r,s,s,t,n)}var Sr={get(){},subscribe(){return{unsubscribe(){}}}};function Ll(e,t){const n=S.useRef();return r=>{const s=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=st(n.current,s):s}}function gt(e){const t=Ee(),n=S.useContext(e.from?wl:nr),r=e.from?t.stores.getRouteMatchStore(e.from):t.stores.matchStores.get(n),s=Ll(e,t),o=Ne(r??Sr,i=>i?s(i):Sr);if(o!==Sr)return o;if(e.shouldThrow??!0){if(process.env.NODE_ENV!=="production")throw new Error(`Invariant failed: Could not find ${e.from?`an active match from "${e.from}"`:"a nearest match!"}`);$e()}}function Ra(e){return gt({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Na(e){const{select:t,...n}=e;return gt({...n,select:r=>t?t(r.loaderDeps):r.loaderDeps})}function Ca(e){return gt({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function ja(e){return gt({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Ea(e){const t=Ee();return S.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function ka(e){return gt({...e,select:t=>e.select?e.select(t.context):t.context})}function Il(e,t){const n=Ee(),r=gc(t),{activeProps:s,inactiveProps:o,activeOptions:i,to:c,preload:u,preloadDelay:d,preloadIntentProximity:f,hashScrollIntoView:l,replace:h,startTransition:m,resetScroll:g,viewTransition:p,children:x,target:b,disabled:y,style:v,className:N,onClick:j,onBlur:k,onFocus:C,onMouseEnter:R,onMouseLeave:_,onTouchStart:L,ignoreBlocker:A,params:D,search:O,hash:$,state:J,mask:Y,reloadDocument:Q,unsafeRelative:he,from:me,_fromLocation:I,...E}=e,B=xa(),q=S.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),K=Ne(n.stores.location,re=>re,(re,ve)=>re.href===ve.href),H=S.useMemo(()=>{const re={_fromLocation:K,...q};return n.buildLocation(re)},[n,K,q]),z=H.maskedLocation?H.maskedLocation.publicHref:H.publicHref,U=H.maskedLocation?H.maskedLocation.external:H.external,Z=S.useMemo(()=>Bl(z,U,n.history,y),[y,U,z,n.history]),V=S.useMemo(()=>{if(Z?.external){if(Bn(Z.href,n.protocolAllowlist)){process.env.NODE_ENV!=="production"&&console.warn(`Blocked Link with dangerous protocol: ${Z.href}`);return}return Z.href}if(!zl(c)&&!(typeof c!="string"||c.indexOf(":")===-1))try{if(new URL(c),Bn(c,n.protocolAllowlist)){process.env.NODE_ENV!=="production"&&console.warn(`Blocked Link with dangerous protocol: ${c}`);return}return c}catch{}},[c,Z,n.protocolAllowlist]),ie=S.useMemo(()=>{if(V)return!1;if(i?.exact){if(!Lc(K.pathname,H.pathname,n.basepath))return!1}else{const re=zn(K.pathname,n.basepath),ve=zn(H.pathname,n.basepath);if(!(re.startsWith(ve)&&(re.length===ve.length||re[ve.length]==="/")))return!1}return(i?.includeSearch??!0)&&!ct(K.search,H.search,{partial:!i?.exact,ignoreUndefined:!i?.explicitUndefined})?!1:i?.includeHash?B&&K.hash===H.hash:!0},[i?.exact,i?.explicitUndefined,i?.includeHash,i?.includeSearch,K,V,B,H.hash,H.pathname,H.search,n.basepath]),le=ie?rt(s,{})??Ml:Rr,te=ie?Rr:rt(o,{})??Rr,je=[N,le.className,te.className].filter(Boolean).join(" "),Ce=(v||le.style||te.style)&&{...v,...le.style,...te.style},[ke,W]=S.useState(!1),pe=S.useRef(!1),ye=e.reloadDocument||V?!1:u??n.options.defaultPreload,_e=d??n.options.defaultPreloadDelay??0,Te=S.useCallback(()=>{n.preloadRoute({...q,_builtLocation:H}).catch(re=>{console.warn(re),console.warn(gl)})},[n,q,H]);pc(r,S.useCallback(re=>{re?.isIntersecting&&Te()},[Te]),$l,{disabled:!!y||ye!=="viewport"}),S.useEffect(()=>{pe.current||!y&&ye==="render"&&(Te(),pe.current=!0)},[y,Te,ye]);const ur=re=>{const ve=re.currentTarget.getAttribute("target"),Qe=b!==void 0?b:ve;if(!y&&!Wl(re)&&!re.defaultPrevented&&(!Qe||Qe==="_self")&&re.button===0){re.preventDefault(),Zo.flushSync(()=>{W(!0)});const dc=n.subscribe("onResolved",()=>{dc(),W(!1)});n.navigate({...q,replace:h,resetScroll:g,hashScrollIntoView:l,startTransition:m,viewTransition:p,ignoreBlocker:A})}};if(V)return{...E,ref:r,href:V,...x&&{children:x},...b&&{target:b},...y&&{disabled:y},...v&&{style:v},...N&&{className:N},...j&&{onClick:j},...k&&{onBlur:k},...C&&{onFocus:C},...R&&{onMouseEnter:R},..._&&{onMouseLeave:_},...L&&{onTouchStart:L}};const We=re=>{if(y||ye!=="intent")return;if(!_e){Te();return}const ve=re.currentTarget;if(Ht.has(ve))return;const Qe=setTimeout(()=>{Ht.delete(ve),Te()},_e);Ht.set(ve,Qe)},uc=re=>{y||ye!=="intent"||Te()},vs=re=>{if(y||!ye||!_e)return;const ve=re.currentTarget,Qe=Ht.get(ve);Qe&&(clearTimeout(Qe),Ht.delete(ve))};return{...E,...le,...te,href:Z?.href,ref:r,onClick:yt([j,ur]),onBlur:yt([k,vs]),onFocus:yt([C,We]),onMouseEnter:yt([R,We]),onMouseLeave:yt([_,vs]),onTouchStart:yt([L,uc]),disabled:!!y,target:b,...Ce&&{style:Ce},...je&&{className:je},...y&&Dl,...ie&&Fl,...B&&ke&&Ul}}var Rr={},Ml={className:"active"},Dl={role:"link","aria-disabled":!0},Fl={"data-status":"active","aria-current":"page"},Ul={"data-transitioning":"transitioning"},Ht=new WeakMap,$l={rootMargin:"100px"},yt=e=>t=>{for(const n of e)if(n){if(t.defaultPrevented)return;n(t)}};function Bl(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||"/",external:!1}}function zl(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var qn=S.forwardRef((e,t)=>{const{_asChild:n,...r}=e,{type:s,...o}=Il(r,t),i=typeof r.children=="function"?r.children({isActive:o["data-status"]==="active"}):r.children;if(!n){const{disabled:c,...u}=o;return S.createElement("a",u,i)}return S.createElement(n,o,i)});function Wl(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var Vl=class extends ga{constructor(e){super(e),this.useMatch=t=>gt({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>ka({...t,from:this.id}),this.useSearch=t=>ja({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>Ca({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>Na({...t,from:this.id}),this.useLoaderData=t=>Ra({...t,from:this.id}),this.useNavigate=()=>Ea({from:this.fullPath}),this.Link=P.forwardRef((t,n)=>a.jsx(qn,{ref:n,from:this.fullPath,...t}))}};function an(e){return new Vl(e)}var Hl=class extends xl{constructor(e){super(e),this.useMatch=t=>gt({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>ka({...t,from:this.id}),this.useSearch=t=>ja({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>Ca({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>Na({...t,from:this.id}),this.useLoaderData=t=>Ra({...t,from:this.id}),this.useNavigate=()=>Ea({from:this.fullPath}),this.Link=P.forwardRef((t,n)=>a.jsx(qn,{ref:n,from:this.fullPath,...t}))}};function ql(e){return new Hl(e)}function Gl(e){const t=Ee(),n=`not-found-${Ne(t.stores.location,r=>r.pathname)}-${Ne(t.stores.status,r=>r)}`;return a.jsx(rs,{getResetKey:()=>n,onCatch:(r,s)=>{if(xe(r))e.onCatch?.(r,s);else throw r},errorComponent:({error:r})=>{if(xe(r))return e.fallback?.(r);throw r},children:e.children})}function Kl(){return a.jsx("p",{children:"Not Found"})}function Et(e){return a.jsx(a.Fragment,{children:e.children})}function _a(e,t,n){return t.options.notFoundComponent?a.jsx(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?a.jsx(e.options.defaultNotFoundComponent,{...n}):(process.env.NODE_ENV!=="production"&&(t.options.notFoundComponent||console.warn(`Warning: A notFoundError was encountered on the route with ID "${t.id}", but a notFoundComponent option was not configured, nor was a router level defaultNotFoundComponent configured. Consider configuring at least one of these to avoid TanStack Router's overly generic defaultNotFoundComponent (<p>Not Found</p>)`)),a.jsx(Kl,{}))}function Yl(e){return null}function Jl(){return Yl(Ee()),null}var Xl=(e,t)=>e.routeId===t.routeId&&e._displayPending===t._displayPending,Zl=(e,t)=>e[0]===t[0]&&e[1]===t[1],Pa=S.memo(function({matchId:t}){const n=Ee(),r=n.stores.matchStores.get(t);if(!r){if(process.env.NODE_ENV!=="production")throw new Error(`Invariant failed: Could not find match for matchId "${t}". Please file an issue!`);$e()}const s=Ne(n.stores.loadedAt,i=>i),o=Ne(r,i=>i,Xl);return a.jsx(Ql,{router:n,matchId:t,resetKey:s,matchState:S.useMemo(()=>{const i=o.routeId,c=n.routesById[i].parentRoute?.id;return{routeId:i,ssr:o.ssr,_displayPending:o._displayPending,parentRouteId:c}},[o._displayPending,o.routeId,o.ssr,n.routesById])})});function Ql({router:e,matchId:t,resetKey:n,matchState:r}){const s=e.routesById[r.routeId],o=s.options.pendingComponent??e.options.defaultPendingComponent,i=o?a.jsx(o,{}):null,c=s.options.errorComponent??e.options.defaultErrorComponent,u=s.options.onCatch??e.options.defaultOnCatch,d=s.isRoot?s.options.notFoundComponent??e.options.notFoundRoute?.options.component:s.options.notFoundComponent,f=r.ssr===!1||r.ssr==="data-only",l=(!s.isRoot||s.options.wrapInSuspense||f)&&(s.options.wrapInSuspense??o??(s.options.errorComponent?.preload||f))?S.Suspense:Et,h=c?rs:Et,m=d?Gl:Et;return a.jsxs(s.isRoot?s.options.shellComponent??Et:Et,{children:[a.jsx(nr.Provider,{value:t,children:a.jsx(l,{fallback:i,children:a.jsx(h,{getResetKey:()=>n,errorComponent:c||ss,onCatch:(g,p)=>{if(xe(g))throw g.routeId??=r.routeId,g;process.env.NODE_ENV!=="production"&&console.warn(`Warning: Error in route match: ${t}`),u?.(g,p)},children:a.jsx(m,{fallback:g=>{if(g.routeId??=r.routeId,!d||g.routeId&&g.routeId!==r.routeId||!g.routeId&&!s.isRoot)throw g;return S.createElement(d,g)},children:f||r._displayPending?a.jsx(yl,{fallback:i,children:a.jsx(to,{matchId:t})}):a.jsx(to,{matchId:t})})})})}),r.parentRouteId===lt?a.jsxs(a.Fragment,{children:[a.jsx(eu,{}),e.options.scrollRestoration&&ta?a.jsx(Jl,{}):null]}):null]})}function eu(){const e=Ee(),t=S.useRef();return Zt(()=>{const n=e.stores.resolvedLocation.get(),r=t.current;n&&(!r||r.href!==n.href)&&e.emit({type:"onRendered",...kt(e.stores.location.get(),r??n)}),t.current=n},[Ne(e.stores.resolvedLocation,n=>n?.state.__TSR_key),e]),null}var to=S.memo(function({matchId:t}){const n=Ee(),r=(f,l)=>n.getMatch(f.id)?._nonReactive[l]??f._nonReactive[l],s=n.stores.matchStores.get(t);if(!s){if(process.env.NODE_ENV!=="production")throw new Error(`Invariant failed: Could not find match for matchId "${t}". Please file an issue!`);$e()}const o=Ne(s,f=>f),i=o.routeId,c=n.routesById[i],u=S.useMemo(()=>{const f=(n.routesById[i].options.remountDeps??n.options.defaultRemountDeps)?.({routeId:i,loaderDeps:o.loaderDeps,params:o._strictParams,search:o._strictSearch});return f?JSON.stringify(f):void 0},[i,o.loaderDeps,o._strictParams,o._strictSearch,n.options.defaultRemountDeps,n.routesById]),d=S.useMemo(()=>{const f=c.options.component??n.options.defaultComponent;return f?a.jsx(f,{},u):a.jsx(Aa,{})},[u,c.options.component,n.options.defaultComponent]);if(o._displayPending)throw r(o,"displayPendingPromise");if(o._forcePending)throw r(o,"minPendingPromise");if(o.status==="pending"){const f=c.options.pendingMinMs??n.options.defaultPendingMinMs;if(f){const l=n.getMatch(o.id);if(l&&!l._nonReactive.minPendingPromise){const h=Pt();l._nonReactive.minPendingPromise=h,setTimeout(()=>{h.resolve(),l._nonReactive.minPendingPromise=void 0},f)}}throw r(o,"loadPromise")}if(o.status==="notFound"){if(!xe(o.error)){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Expected a notFound error");$e()}return _a(n,c,o.error)}if(o.status==="redirected"){if(!we(o.error)){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Expected a redirect error");$e()}throw r(o,"loadPromise")}if(o.status==="error")throw o.error;return d}),Aa=S.memo(function(){const t=Ee(),n=S.useContext(nr);let r,s=!1,o;{const d=n?t.stores.matchStores.get(n):void 0;[r,s]=Ne(d,f=>[f?.routeId,f?.globalNotFound??!1],Zl),o=Ne(t.stores.matchesId,f=>f[f.findIndex(l=>l===n)+1])}const i=r?t.routesById[r]:void 0,c=t.options.defaultPendingComponent?a.jsx(t.options.defaultPendingComponent,{}):null;if(s){if(!i){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Could not resolve route for Outlet render");$e()}return _a(t,i,void 0)}if(!o)return null;const u=a.jsx(Pa,{matchId:o});return r===lt?a.jsx(S.Suspense,{fallback:c,children:u}):u});function tu(){const e=Ee(),t=S.useRef({router:e,mounted:!1}),[n,r]=S.useState(!1),s=Ne(e.stores.isLoading,l=>l),o=Ne(e.stores.hasPending,l=>l),i=dr(s),c=s||n||o,u=dr(c),d=s||o,f=dr(d);return e.startTransition=l=>{r(!0),S.startTransition(()=>{l(),r(!1)})},S.useEffect(()=>{const l=e.history.subscribe(e.load),h=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Ue(e.latestLocation.publicHref)!==Ue(h.publicHref)&&e.commitLocation({...h,replace:!0}),()=>{l()}},[e,e.history]),Zt(()=>{if(typeof window<"u"&&e.ssr||t.current.router===e&&t.current.mounted)return;t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(h){console.error(h)}})()},[e]),Zt(()=>{i&&!s&&e.emit({type:"onLoad",...kt(e.stores.location.get(),e.stores.resolvedLocation.get())})},[i,e,s]),Zt(()=>{f&&!d&&e.emit({type:"onBeforeRouteMount",...kt(e.stores.location.get(),e.stores.resolvedLocation.get())})},[d,f,e]),Zt(()=>{if(u&&!c){const l=kt(e.stores.location.get(),e.stores.resolvedLocation.get());e.emit({type:"onResolved",...l}),va(()=>{e.stores.status.set("idle"),e.stores.resolvedLocation.set(e.stores.location.get())})}},[c,u,e]),null}function nu(){const e=Ee(),t=e.routesById[lt].options.pendingComponent??e.options.defaultPendingComponent,n=t?a.jsx(t,{}):null,r=a.jsxs(typeof document<"u"&&e.ssr?Et:S.Suspense,{fallback:n,children:[a.jsx(tu,{}),a.jsx(ru,{})]});return e.options.InnerWrap?a.jsx(e.options.InnerWrap,{children:r}):r}function ru(){const e=Ee(),t=Ne(e.stores.firstId,s=>s),n=Ne(e.stores.loadedAt,s=>s),r=t?a.jsx(Pa,{matchId:t}):null;return a.jsx(nr.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:a.jsx(rs,{getResetKey:()=>n,errorComponent:ss,onCatch:process.env.NODE_ENV!=="production"?s=>{console.warn("Warning: The following error wasn't caught by any route! At the very least, consider setting an 'errorComponent' in your RootRoute!"),console.warn(`Warning: ${s.message||s.toString()}`)}:void 0,children:r})})}var su=e=>({createMutableStore:Ks,createReadonlyStore:Ks,batch:va}),Oa=e=>new ou(e),ou=class extends nl{constructor(e){super(e,su)}};function au({router:e,children:t,...n}){ra(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});const r=a.jsx(ba.Provider,{value:e,children:t});return e.options.Wrap?a.jsx(e.options.Wrap,{children:r}):r}function iu({router:e,...t}){return a.jsx(au,{router:e,...t,children:a.jsx(nu,{})})}function Ta(e,t){return function(){return e.apply(t,arguments)}}const{toString:cu}=Object.prototype,{getPrototypeOf:At}=Object,{iterator:cn,toStringTag:La}=Symbol,Gn=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),rn=(e,t)=>{let n=e;const r=[];for(;n!=null&&n!==Object.prototype;){if(r.indexOf(n)!==-1)return!1;if(r.push(n),Gn(n,t))return!0;n=At(n)}return!1},lu=(e,t)=>e!=null&&rn(e,t)?e[t]:void 0,os=(e=>t=>{const n=cu.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Ae=e=>(e=e.toLowerCase(),t=>os(t)===e),rr=e=>t=>typeof t===e,{isArray:mt}=Array,Ot=rr("undefined");function Mt(e){return e!==null&&!Ot(e)&&e.constructor!==null&&!Ot(e.constructor)&&Se(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Ia=Ae("ArrayBuffer");function uu(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Ia(e.buffer),t}const du=rr("string"),Se=rr("function"),Ma=rr("number"),Dt=e=>e!==null&&typeof e=="object",fu=e=>e===!0||e===!1,In=e=>{if(!Dt(e))return!1;const t=At(e);return(t===null||t===Object.prototype||At(t)===null)&&!rn(e,La)&&!rn(e,cn)},hu=e=>{if(!Dt(e)||Mt(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},mu=Ae("Date"),pu=Ae("File"),gu=e=>!!(e&&typeof e.uri<"u"),xu=e=>e&&typeof e.getParts<"u",bu=Ae("Blob"),yu=Ae("FileList"),vu=e=>Dt(e)&&Se(e.pipe);function wu(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const no=wu(),ro=typeof no.FormData<"u"?no.FormData:void 0,Su=e=>{if(!e)return!1;if(ro&&e instanceof ro)return!0;const t=At(e);if(!t||t===Object.prototype||!Se(e.append))return!1;const n=os(e);return n==="formdata"||n==="object"&&Se(e.toString)&&e.toString()==="[object FormData]"},Ru=Ae("URLSearchParams"),[Nu,Cu,ju,Eu]=["ReadableStream","Request","Response","Headers"].map(Ae),ku=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ln(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),mt(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(Mt(e))return;const o=n?Object.getOwnPropertyNames(e):Object.keys(e),i=o.length;let c;for(r=0;r<i;r++)c=o[r],t.call(null,e[c],c,e)}}function Da(e,t){if(Mt(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const at=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Fa=e=>!Ot(e)&&e!==at;function Hr(...e){const{caseless:t,skipUndefined:n}=Fa(this)&&this||{},r={},s=(o,i)=>{if(i==="__proto__"||i==="constructor"||i==="prototype")return;const c=t&&typeof i=="string"&&Da(r,i)||i,u=Gn(r,c)?r[c]:void 0;In(u)&&In(o)?r[c]=Hr(u,o):In(o)?r[c]=Hr({},o):mt(o)?r[c]=o.slice():(!n||!Ot(o))&&(r[c]=o)};for(let o=0,i=e.length;o<i;o++){const c=e[o];if(!c||Mt(c)||(ln(c,s),typeof c!="object"||mt(c)))continue;const u=Object.getOwnPropertySymbols(c);for(let d=0;d<u.length;d++){const f=u[d];$u.call(c,f)&&s(c[f],f)}}return r}const _u=(e,t,n,{allOwnKeys:r}={})=>(ln(t,(s,o)=>{n&&Se(s)?Object.defineProperty(e,o,{__proto__:null,value:Ta(s,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,o,{__proto__:null,value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),Pu=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Au=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},Ou=(e,t,n,r)=>{let s,o,i;const c={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],(!r||r(i,e,t))&&!c[i]&&(t[i]=e[i],c[i]=!0);e=n!==!1&&At(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Tu=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},Lu=e=>{if(!e)return null;if(mt(e))return e;let t=e.length;if(!Ma(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Iu=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&At(Uint8Array)),Mu=(e,t)=>{const r=(e&&e[cn]).call(e);let s;for(;(s=r.next())&&!s.done;){const o=s.value;t.call(e,o[0],o[1])}},Du=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Fu=Ae("HTMLFormElement"),Uu=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),{propertyIsEnumerable:$u}=Object.prototype,Bu=Ae("RegExp"),Ua=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};ln(n,(s,o)=>{let i;(i=t(s,o,e))!==!1&&(r[o]=i||s)}),Object.defineProperties(e,r)},zu=e=>{Ua(e,(t,n)=>{if(Se(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];if(Se(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Wu=(e,t)=>{const n={},r=s=>{s.forEach(o=>{n[o]=!0})};return mt(e)?r(e):r(String(e).split(t)),n},Vu=()=>{},Hu=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function qu(e){return!!(e&&Se(e.append)&&e[La]==="FormData"&&e[cn])}const Gu=e=>{const t=new WeakSet,n=r=>{if(Dt(r)){if(t.has(r))return;if(Mt(r))return r;if(!("toJSON"in r)){t.add(r);const s=mt(r)?[]:{};return ln(r,(o,i)=>{const c=n(o);!Ot(c)&&(s[i]=c)}),t.delete(r),s}}return r};return n(e)},Ku=Ae("AsyncFunction"),Yu=e=>e&&(Dt(e)||Se(e))&&Se(e.then)&&Se(e.catch),$a=((e,t)=>e?setImmediate:t?((n,r)=>(at.addEventListener("message",({source:s,data:o})=>{s===at&&o===n&&r.length&&r.shift()()},!1),s=>{r.push(s),at.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Se(at.postMessage)),Ju=typeof queueMicrotask<"u"?queueMicrotask.bind(at):typeof process<"u"&&process.nextTick||$a,Ba=e=>e!=null&&Se(e[cn]),Xu=e=>e!=null&&rn(e,cn)&&Ba(e),w={isArray:mt,isArrayBuffer:Ia,isBuffer:Mt,isFormData:Su,isArrayBufferView:uu,isString:du,isNumber:Ma,isBoolean:fu,isObject:Dt,isPlainObject:In,isEmptyObject:hu,isReadableStream:Nu,isRequest:Cu,isResponse:ju,isHeaders:Eu,isUndefined:Ot,isDate:mu,isFile:pu,isReactNativeBlob:gu,isReactNative:xu,isBlob:bu,isRegExp:Bu,isFunction:Se,isStream:vu,isURLSearchParams:Ru,isTypedArray:Iu,isFileList:yu,forEach:ln,merge:Hr,extend:_u,trim:ku,stripBOM:Pu,inherits:Au,toFlatObject:Ou,kindOf:os,kindOfTest:Ae,endsWith:Tu,toArray:Lu,forEachEntry:Mu,matchAll:Du,isHTMLForm:Fu,hasOwnProperty:Gn,hasOwnProp:Gn,hasOwnInPrototypeChain:rn,getSafeProp:lu,reduceDescriptors:Ua,freezeMethods:zu,toObjectSet:Wu,toCamelCase:Uu,noop:Vu,toFiniteNumber:Hu,findKey:Da,global:at,isContextDefined:Fa,isSpecCompliantForm:qu,toJSONObject:Gu,isAsyncFn:Ku,isThenable:Yu,setImmediate:$a,asap:Ju,isIterable:Ba,isSafeIterable:Xu},Zu=w.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Qu=e=>{const t={};let n,r,s;return e&&e.split(`
7
+ `).forEach(function(i){s=i.indexOf(":"),n=i.substring(0,s).trim().toLowerCase(),r=i.substring(s+1).trim(),!(!n||t[n]&&Zu[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t};function ed(e){let t=0,n=e.length;for(;t<n;){const r=e.charCodeAt(t);if(r!==9&&r!==32)break;t+=1}for(;n>t;){const r=e.charCodeAt(n-1);if(r!==9&&r!==32)break;n-=1}return t===0&&n===e.length?e:e.slice(t,n)}const td=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),nd=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function as(e,t){return w.isArray(e)?e.map(n=>as(n,t)):ed(String(e).replace(t,""))}const rd=e=>as(e,td),sd=e=>as(e,nd);function za(e){const t=Object.create(null);return w.forEach(e.toJSON(),(n,r)=>{t[r]=sd(n)}),t}const so=Symbol("internals");function qt(e){return e&&String(e).trim().toLowerCase()}function Mn(e){return e===!1||e==null?e:w.isArray(e)?e.map(Mn):rd(String(e))}function od(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const ad=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Nr(e,t,n,r,s){if(w.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!w.isString(t)){if(w.isString(r))return t.indexOf(r)!==-1;if(w.isRegExp(r))return r.test(t)}}function id(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function cd(e,t){const n=w.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{__proto__:null,value:function(s,o,i){return this[r].call(this,t,s,o,i)},configurable:!0})})}let be=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function o(c,u,d){const f=qt(u);if(!f)return;const l=w.findKey(s,f);(!l||s[l]===void 0||d===!0||d===void 0&&s[l]!==!1)&&(s[l||u]=Mn(c))}const i=(c,u)=>w.forEach(c,(d,f)=>o(d,f,u));if(w.isPlainObject(t)||t instanceof this.constructor)i(t,n);else if(w.isString(t)&&(t=t.trim())&&!ad(t))i(Qu(t),n);else if(w.isObject(t)&&w.isSafeIterable(t)){let c=Object.create(null),u,d;for(const f of t){if(!w.isArray(f))throw new TypeError("Object iterator must return a key-value pair");d=f[0],w.hasOwnProp(c,d)?(u=c[d],c[d]=w.isArray(u)?[...u,f[1]]:[u,f[1]]):c[d]=f[1]}i(c,n)}else t!=null&&o(n,t,r);return this}get(t,n){if(t=qt(t),t){const r=w.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return od(s);if(w.isFunction(n))return n.call(this,s,r);if(w.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=qt(t),t){const r=w.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||Nr(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function o(i){if(i=qt(i),i){const c=w.findKey(r,i);c&&(!n||Nr(r,r[c],c,n))&&(delete r[c],s=!0)}}return w.isArray(t)?t.forEach(o):o(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const o=n[r];(!t||Nr(this,this[o],o,t,!0))&&(delete this[o],s=!0)}return s}normalize(t){const n=this,r={};return w.forEach(this,(s,o)=>{const i=w.findKey(r,o);if(i){n[i]=Mn(s),delete n[o];return}const c=t?id(o):String(o).trim();c!==o&&delete n[o],n[c]=Mn(s),r[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return w.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&w.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
8
+ `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[so]=this[so]={accessors:{}}).accessors,s=this.prototype;function o(i){const c=qt(i);r[c]||(cd(s,i),r[c]=!0)}return w.isArray(t)?t.forEach(o):o(t),this}};be.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);w.reduceDescriptors(be.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});w.freezeMethods(be);const ld="[REDACTED ****]";function ud(e){if(w.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(w.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function dd(e,t){const n=new Set(t.map(o=>String(o).toLowerCase())),r=[],s=o=>{if(o===null||typeof o!="object"||w.isBuffer(o))return o;if(r.indexOf(o)!==-1)return;o instanceof be&&(o=o.toJSON()),r.push(o);let i;if(w.isArray(o))i=[],o.forEach((c,u)=>{const d=s(c);w.isUndefined(d)||(i[u]=d)});else{if(!w.isPlainObject(o)&&ud(o))return r.pop(),o;i=Object.create(null);for(const[c,u]of Object.entries(o)){const d=n.has(c.toLowerCase())?ld:s(u);w.isUndefined(d)||(i[c]=d)}}return r.pop(),i};return s(e)}let T=class Wa extends Error{static from(t,n,r,s,o,i){const c=new Wa(t.message,n||t.code,r,s,o);return Object.defineProperty(c,"cause",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),c.name=t.name,t.status!=null&&c.status==null&&(c.status=t.status),i&&Object.assign(c,i),c}constructor(t,n,r,s,o){super(t),Object.defineProperty(this,"message",{__proto__:null,value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),r&&(this.config=r),s&&(this.request=s),o&&(this.response=o,this.status=o.status)}toJSON(){const t=this.config,n=t&&w.hasOwnProp(t,"redact")?t.redact:void 0,r=w.isArray(n)&&n.length>0?dd(t,n):w.toJSONObject(t);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:r,code:this.code,status:this.status}}};T.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";T.ERR_BAD_OPTION="ERR_BAD_OPTION";T.ECONNABORTED="ECONNABORTED";T.ETIMEDOUT="ETIMEDOUT";T.ECONNREFUSED="ECONNREFUSED";T.ERR_NETWORK="ERR_NETWORK";T.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";T.ERR_DEPRECATED="ERR_DEPRECATED";T.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";T.ERR_BAD_REQUEST="ERR_BAD_REQUEST";T.ERR_CANCELED="ERR_CANCELED";T.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";T.ERR_INVALID_URL="ERR_INVALID_URL";T.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const fd=null,Va=100;function qr(e){return w.isPlainObject(e)||w.isArray(e)}function Ha(e){return w.endsWith(e,"[]")?e.slice(0,-2):e}function Cr(e,t,n){return e?e.concat(t).map(function(s,o){return s=Ha(s),!n&&o?"["+s+"]":s}).join(n?".":""):t}function hd(e){return w.isArray(e)&&!e.some(qr)}const md=w.toFlatObject(w,{},null,function(t){return/^is[A-Z]/.test(t)});function sr(e,t,n){if(!w.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=w.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,v){return!w.isUndefined(v[y])});const r=n.metaTokens,s=n.visitor||g,o=n.dots,i=n.indexes,c=n.Blob||typeof Blob<"u"&&Blob,u=n.maxDepth===void 0?Va:n.maxDepth,d=c&&w.isSpecCompliantForm(t),f=[];if(!w.isFunction(s))throw new TypeError("visitor must be a function");function l(b){if(b===null)return"";if(w.isDate(b))return b.toISOString();if(w.isBoolean(b))return b.toString();if(!d&&w.isBlob(b))throw new T("Blob is not supported. Use a Buffer instead.");if(w.isArrayBuffer(b)||w.isTypedArray(b)){if(d&&typeof c=="function")return new c([b]);if(typeof Buffer<"u")return Buffer.from(b);throw new T("Blob is not supported. Use a Buffer instead.",T.ERR_NOT_SUPPORT)}return b}function h(b){if(b>u)throw new T("Object is too deeply nested ("+b+" levels). Max depth: "+u,T.ERR_FORM_DATA_DEPTH_EXCEEDED)}function m(b,y){if(u===1/0)return JSON.stringify(b);const v=[];return JSON.stringify(b,function(j,k){if(!w.isObject(k))return k;for(;v.length&&v[v.length-1]!==this;)v.pop();return v.push(k),h(y+v.length-1),k})}function g(b,y,v){let N=b;if(w.isReactNative(t)&&w.isReactNativeBlob(b))return t.append(Cr(v,y,o),l(b)),!1;if(b&&!v&&typeof b=="object"){if(w.endsWith(y,"{}"))y=r?y:y.slice(0,-2),b=m(b,1);else if(w.isArray(b)&&hd(b)||(w.isFileList(b)||w.endsWith(y,"[]"))&&(N=w.toArray(b)))return y=Ha(y),N.forEach(function(k,C){!(w.isUndefined(k)||k===null)&&t.append(i===!0?Cr([y],C,o):i===null?y:y+"[]",l(k))}),!1}return qr(b)?!0:(t.append(Cr(v,y,o),l(b)),!1)}const p=Object.assign(md,{defaultVisitor:g,convertValue:l,isVisitable:qr});function x(b,y,v=0){if(!w.isUndefined(b)){if(h(v),f.indexOf(b)!==-1)throw new Error("Circular reference detected in "+y.join("."));f.push(b),w.forEach(b,function(j,k){(!(w.isUndefined(j)||j===null)&&s.call(t,j,w.isString(k)?k.trim():k,y,p))===!0&&x(j,y?y.concat(k):[k],v+1)}),f.pop()}}if(!w.isObject(e))throw new TypeError("data must be an object");return x(e),t}function oo(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(r){return t[r]})}function is(e,t){this._pairs=[],e&&sr(e,this,t)}const qa=is.prototype;qa.append=function(t,n){this._pairs.push([t,n])};qa.toString=function(t){const n=t?r=>t.call(this,r,oo):oo;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function pd(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ga(e,t,n){if(!t)return e;e=e||"";const r=w.isFunction(n)?{serialize:n}:n,s=w.getSafeProp(r,"encode")||pd,o=w.getSafeProp(r,"serialize");let i;if(o?i=o(t,r):i=w.isURLSearchParams(t)?t.toString():new is(t,r).toString(s),i){const c=e.indexOf("#");c!==-1&&(e=e.slice(0,c)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class ao{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){w.forEach(this.handlers,function(r){r!==null&&t(r)})}}const cs={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},gd=typeof URLSearchParams<"u"?URLSearchParams:is,xd=typeof FormData<"u"?FormData:null,bd=typeof Blob<"u"?Blob:null,yd={isBrowser:!0,classes:{URLSearchParams:gd,FormData:xd,Blob:bd},protocols:["http","https","file","blob","url","data"]},ls=typeof window<"u"&&typeof document<"u",Gr=typeof navigator=="object"&&navigator||void 0,vd=ls&&(!Gr||["ReactNative","NativeScript","NS"].indexOf(Gr.product)<0),wd=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Sd=ls&&window.location.href||"http://localhost",Rd=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:ls,hasStandardBrowserEnv:vd,hasStandardBrowserWebWorkerEnv:wd,navigator:Gr,origin:Sd},Symbol.toStringTag,{value:"Module"})),fe={...Rd,...yd};function Nd(e,t){return sr(e,new fe.classes.URLSearchParams,{visitor:function(n,r,s,o){return fe.isNode&&w.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}const io=Va;function Ka(e){if(e>io)throw new T("FormData field is too deeply nested ("+e+" levels). Max depth: "+io,T.ERR_FORM_DATA_DEPTH_EXCEEDED)}function Cd(e){const t=[],n=/\w+|\[(\w*)]/g;let r;for(;(r=n.exec(e))!==null;)Ka(t.length),t.push(r[0]==="[]"?"":r[1]||r[0]);return t}function jd(e){const t={},n=Object.keys(e);let r;const s=n.length;let o;for(r=0;r<s;r++)o=n[r],t[o]=e[o];return t}function Ya(e){function t(n,r,s,o){Ka(o);let i=n[o++];if(i==="__proto__")return!0;const c=Number.isFinite(+i),u=o>=n.length;return i=!i&&w.isArray(s)?s.length:i,u?(w.hasOwnProp(s,i)?s[i]=w.isArray(s[i])?s[i].concat(r):[s[i],r]:s[i]=r,!c):((!w.hasOwnProp(s,i)||!w.isObject(s[i]))&&(s[i]=[]),t(n,r,s[i],o)&&w.isArray(s[i])&&(s[i]=jd(s[i])),!c)}if(w.isFormData(e)&&w.isFunction(e.entries)){const n={};return w.forEachEntry(e,(r,s)=>{t(Cd(r),s,n,0)}),n}return null}const vt=(e,t)=>e!=null&&w.hasOwnProp(e,t)?e[t]:void 0;function Ed(e,t,n){if(w.isString(e))try{return(t||JSON.parse)(e),w.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const un={transitional:cs,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,o=w.isObject(t);if(o&&w.isHTMLForm(t)&&(t=new FormData(t)),w.isFormData(t))return s?JSON.stringify(Ya(t)):t;if(w.isArrayBuffer(t)||w.isBuffer(t)||w.isStream(t)||w.isFile(t)||w.isBlob(t)||w.isReadableStream(t))return t;if(w.isArrayBufferView(t))return t.buffer;if(w.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(o){const u=vt(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return Nd(t,u).toString();if((c=w.isFileList(t))||r.indexOf("multipart/form-data")>-1){const d=vt(this,"env"),f=d&&d.FormData;return sr(c?{"files[]":t}:t,f&&new f,u)}}return o||s?(n.setContentType("application/json",!1),Ed(t)):t}],transformResponse:[function(t){const n=vt(this,"transitional")||un.transitional,r=n&&n.forcedJSONParsing,s=vt(this,"responseType"),o=s==="json";if(w.isResponse(t)||w.isReadableStream(t))return t;if(t&&w.isString(t)&&(r&&!s||o)){const c=!(n&&n.silentJSONParsing)&&o;try{return JSON.parse(t,vt(this,"parseReviver"))}catch(u){if(c)throw u.name==="SyntaxError"?T.from(u,T.ERR_BAD_RESPONSE,this,null,vt(this,"response")):u}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:fe.classes.FormData,Blob:fe.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};w.forEach(["delete","get","head","post","put","patch","query"],e=>{un.headers[e]={}});function jr(e,t){const n=this||un,r=t||n,s=be.from(r.headers);let o=r.data;return w.forEach(e,function(c){o=c.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function Ja(e){return!!(e&&e.__CANCEL__)}let dn=class extends T{constructor(t,n,r){super(t??"canceled",T.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function Xa(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new T("Request failed with status code "+n.status,n.status>=400&&n.status<500?T.ERR_BAD_REQUEST:T.ERR_BAD_RESPONSE,n.config,n.request,n))}function kd(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function _d(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,o=0,i;return t=t!==void 0?t:1e3,function(u){const d=Date.now(),f=r[o];i||(i=d),n[s]=u,r[s]=d;let l=o,h=0;for(;l!==s;)h+=n[l++],l=l%e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),d-i<t)return;const m=f&&d-f;return m?Math.round(h*1e3/m):void 0}}function Pd(e,t){let n=0,r=1e3/t,s,o;const i=(d,f=Date.now())=>{n=f,s=null,o&&(clearTimeout(o),o=null),e(...d)};return[(...d)=>{const f=Date.now(),l=f-n;l>=r?i(d,f):(s=d,o||(o=setTimeout(()=>{o=null,i(s)},r-l)))},()=>s&&i(s)]}const Kn=(e,t,n=3)=>{let r=0;const s=_d(50,250);return Pd(o=>{if(!o||typeof o.loaded!="number")return;const i=o.loaded,c=o.lengthComputable?o.total:void 0,u=c!=null?Math.min(i,c):i,d=Math.max(0,u-r),f=s(d);r=Math.max(r,u);const l={loaded:u,total:c,progress:c?u/c:void 0,bytes:d,rate:f||void 0,estimated:f&&c?(c-u)/f:void 0,event:o,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(l)},n)},co=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},lo=e=>(...t)=>w.asap(()=>e(...t)),Ad=fe.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,fe.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(fe.origin),fe.navigator&&/(msie|trident)/i.test(fe.navigator.userAgent)):()=>!0,Od=fe.hasStandardBrowserEnv?{write(e,t,n,r,s,o,i){if(typeof document>"u")return;const c=[`${e}=${encodeURIComponent(t)}`];w.isNumber(n)&&c.push(`expires=${new Date(n).toUTCString()}`),w.isString(r)&&c.push(`path=${r}`),w.isString(s)&&c.push(`domain=${s}`),o===!0&&c.push("secure"),w.isString(i)&&c.push(`SameSite=${i}`),document.cookie=c.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.split(";");for(let n=0;n<t.length;n++){const r=t[n].replace(/^\s+/,""),s=r.indexOf("=");if(s!==-1&&r.slice(0,s)===e)try{return decodeURIComponent(r.slice(s+1))}catch{return r.slice(s+1)}}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Td(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Ld(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const Id=/^https?:(?!\/\/)/i,Md=/[\t\n\r]/g;function Dd(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function Fd(e){return Dd(e).replace(Md,"")}function uo(e,t){if(typeof e=="string"&&Id.test(Fd(e)))throw new T('Invalid URL: missing "//" after protocol',T.ERR_INVALID_URL,t)}function Za(e,t,n,r){uo(t,r);let s=!Td(t);return e&&(s||n===!1)?(uo(e,r),Ld(e,t)):t}const fo=e=>e instanceof be?{...e}:e;function pt(e,t){e=e||{},t=t||{};const n=Object.create(null);Object.defineProperty(n,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function r(f,l,h,m){return w.isPlainObject(f)&&w.isPlainObject(l)?w.merge.call({caseless:m},f,l):w.isPlainObject(l)?w.merge({},l):w.isArray(l)?l.slice():l}function s(f,l,h,m){if(w.isUndefined(l)){if(!w.isUndefined(f))return r(void 0,f,h,m)}else return r(f,l,h,m)}function o(f,l){if(!w.isUndefined(l))return r(void 0,l)}function i(f,l){if(w.isUndefined(l)){if(!w.isUndefined(f))return r(void 0,f)}else return r(void 0,l)}function c(f){const l=w.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!w.isUndefined(l))if(w.isPlainObject(l)){if(w.hasOwnProp(l,f))return l[f]}else return;const h=w.hasOwnProp(e,"transitional")?e.transitional:void 0;if(w.isPlainObject(h)&&w.hasOwnProp(h,f))return h[f]}function u(f,l,h){if(w.hasOwnProp(t,h))return r(f,l);if(w.hasOwnProp(e,h))return r(void 0,f)}const d={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,allowedSocketPaths:i,responseEncoding:i,validateStatus:u,headers:(f,l,h)=>s(fo(f),fo(l),h,!0)};return w.forEach(Object.keys({...e,...t}),function(l){if(l==="__proto__"||l==="constructor"||l==="prototype")return;const h=w.hasOwnProp(d,l)?d[l]:s,m=w.hasOwnProp(e,l)?e[l]:void 0,g=w.hasOwnProp(t,l)?t[l]:void 0,p=h(m,g,l);w.isUndefined(p)&&h!==u||(n[l]=p)}),w.hasOwnProp(t,"validateStatus")&&w.isUndefined(t.validateStatus)&&c("validateStatusUndefinedResolves")===!1&&(w.hasOwnProp(e,"validateStatus")?n.validateStatus=r(void 0,e.validateStatus):delete n.validateStatus),n}const Ud=["content-type","content-length"];function $d(e,t,n){if(n!=="content-only"){e.set(t);return}Object.entries(t||{}).forEach(([r,s])=>{Ud.includes(r.toLowerCase())&&e.set(r,s)})}const Bd=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16)));function Qa(e){const t=pt({},e),n=h=>w.hasOwnProp(t,h)?t[h]:void 0,r=n("data");let s=n("withXSRFToken");const o=n("xsrfHeaderName"),i=n("xsrfCookieName");let c=n("headers");const u=n("auth"),d=n("baseURL"),f=n("allowAbsoluteUrls"),l=n("url");if(t.headers=c=be.from(c),t.url=Ga(Za(d,l,f,t),n("params"),n("paramsSerializer")),u){const h=w.getSafeProp(u,"username")||"",m=w.getSafeProp(u,"password")||"";try{c.set("Authorization","Basic "+btoa(h+":"+(m?Bd(m):"")))}catch(g){throw T.from(g,T.ERR_BAD_OPTION_VALUE,e)}}if(w.isFormData(r)&&(fe.hasStandardBrowserEnv||fe.hasStandardBrowserWebWorkerEnv||w.isReactNative(r)?c.setContentType(void 0):w.isFunction(r.getHeaders)&&$d(c,r.getHeaders(),n("formDataHeaderPolicy"))),fe.hasStandardBrowserEnv&&(w.isFunction(s)&&(s=s(t)),s===!0||s==null&&Ad(t.url))){const m=o&&i&&Od.read(i);m&&c.set(o,m)}return t}const zd=typeof XMLHttpRequest<"u",Wd=zd&&function(e){return new Promise(function(n,r){const s=Qa(e);let o=s.data;const i=be.from(s.headers).normalize();let{responseType:c,onUploadProgress:u,onDownloadProgress:d}=s,f,l,h,m,g;function p(){m&&m(),g&&g(),s.cancelToken&&s.cancelToken.unsubscribe(f),s.signal&&s.signal.removeEventListener("abort",f)}let x=new XMLHttpRequest;x.open(s.method.toUpperCase(),s.url,!0),x.timeout=s.timeout;function b(){if(!x)return;const v=be.from("getAllResponseHeaders"in x&&x.getAllResponseHeaders()),j={data:!c||c==="text"||c==="json"?x.responseText:x.response,status:x.status,statusText:x.statusText,headers:v,config:e,request:x};Xa(function(C){n(C),p()},function(C){r(C),p()},j),x=null}"onloadend"in x?x.onloadend=b:x.onreadystatechange=function(){!x||x.readyState!==4||x.status===0&&!(x.responseURL&&x.responseURL.startsWith("file:"))||setTimeout(b)},x.onabort=function(){x&&(r(new T("Request aborted",T.ECONNABORTED,e,x)),p(),x=null)},x.onerror=function(N){const j=N&&N.message?N.message:"Network Error",k=new T(j,T.ERR_NETWORK,e,x);k.event=N||null,r(k),p(),x=null},x.ontimeout=function(){let N=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const j=s.transitional||cs;s.timeoutErrorMessage&&(N=s.timeoutErrorMessage),r(new T(N,j.clarifyTimeoutError?T.ETIMEDOUT:T.ECONNABORTED,e,x)),p(),x=null},o===void 0&&i.setContentType(null),"setRequestHeader"in x&&w.forEach(za(i),function(N,j){x.setRequestHeader(j,N)}),w.isUndefined(s.withCredentials)||(x.withCredentials=!!s.withCredentials),c&&c!=="json"&&(x.responseType=s.responseType),d&&([h,g]=Kn(d,!0),x.addEventListener("progress",h)),u&&x.upload&&([l,m]=Kn(u),x.upload.addEventListener("progress",l),x.upload.addEventListener("loadend",m)),(s.cancelToken||s.signal)&&(f=v=>{x&&(r(!v||v.type?new dn(null,e,x):v),x.abort(),p(),x=null)},s.cancelToken&&s.cancelToken.subscribe(f),s.signal&&(s.signal.aborted?f():s.signal.addEventListener("abort",f)));const y=kd(s.url);if(y&&!fe.protocols.includes(y)){r(new T("Unsupported protocol "+y+":",T.ERR_BAD_REQUEST,e)),p();return}x.send(o||null)})},Vd=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const n=new AbortController;let r=!1;const s=function(u){if(!r){r=!0,i();const d=u instanceof Error?u:this.reason;n.abort(d instanceof T?d:new dn(d instanceof Error?d.message:d))}};let o=t&&setTimeout(()=>{o=null,s(new T(`timeout of ${t}ms exceeded`,T.ETIMEDOUT))},t);const i=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(s):u.removeEventListener("abort",s)}),e=null)};e.forEach(u=>u.addEventListener("abort",s,{once:!0}));const{signal:c}=n;return c.unsubscribe=()=>w.asap(i),c},Hd=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,s;for(;r<n;)s=r+t,yield e.slice(r,s),r=s},qd=async function*(e,t){for await(const n of Gd(e))yield*Hd(n,t)},Gd=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},ho=(e,t,n,r)=>{const s=qd(e,t);let o=0,i,c=u=>{i||(i=!0,r&&r(u))};return new ReadableStream({async pull(u){try{const{done:d,value:f}=await s.next();if(d){c(),u.close();return}let l=f.byteLength;if(n){let h=o+=l;n(h)}u.enqueue(new Uint8Array(f))}catch(d){throw c(d),d}},cancel(u){return c(u),s.return()}},{highWaterMark:2})},Yn=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,Kd=(e,t,n)=>t+2<n&&Yn(e.charCodeAt(t+1))&&Yn(e.charCodeAt(t+2));function Yd(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const n=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(n)){let i=r.length;const c=r.length;for(let m=0;m<c;m++)if(r.charCodeAt(m)===37&&m+2<c){const g=r.charCodeAt(m+1),p=r.charCodeAt(m+2);Yn(g)&&Yn(p)&&(i-=2,m+=2)}let u=0,d=c-1;const f=m=>m>=2&&r.charCodeAt(m-2)===37&&r.charCodeAt(m-1)===51&&(r.charCodeAt(m)===68||r.charCodeAt(m)===100);d>=0&&(r.charCodeAt(d)===61?(u++,d--):f(d)&&(u++,d-=3)),u===1&&d>=0&&(r.charCodeAt(d)===61||f(d))&&u++;const h=Math.floor(i/4)*3-(u||0);return h>0?h:0}let o=0;for(let i=0,c=r.length;i<c;i++){const u=r.charCodeAt(i);if(u===37&&Kd(r,i,c))o+=1,i+=2;else if(u<128)o+=1;else if(u<2048)o+=2;else if(u>=55296&&u<=56319&&i+1<c){const d=r.charCodeAt(i+1);d>=56320&&d<=57343?(o+=4,i++):o+=3}else o+=3}return o}const us="1.18.1",mo=64*1024,{isFunction:yn}=w,Jd=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16))),po=e=>{if(!w.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},go=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Xd=e=>{const t=e.indexOf("://");let n=e;return t!==-1&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")},Zd=e=>{const t=w.global!==void 0&&w.global!==null?w.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=w.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:s,Request:o,Response:i}=e,c=s?yn(s):typeof fetch=="function",u=yn(o),d=yn(i);if(!c)return!1;const f=c&&yn(n),l=c&&(typeof r=="function"?(b=>y=>b.encode(y))(new r):async b=>new Uint8Array(await new o(b).arrayBuffer())),h=u&&f&&go(()=>{let b=!1;const y=new o(fe.origin,{body:new n,method:"POST",get duplex(){return b=!0,"half"}}),v=y.headers.has("Content-Type");return y.body!=null&&y.body.cancel(),b&&!v}),m=d&&f&&go(()=>w.isReadableStream(new i("").body)),g={stream:m&&(b=>b.body)};c&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!g[b]&&(g[b]=(y,v)=>{let N=y&&y[b];if(N)return N.call(y);throw new T(`Response type '${b}' is not supported`,T.ERR_NOT_SUPPORT,v)})});const p=async b=>{if(b==null)return 0;if(w.isBlob(b))return b.size;if(w.isSpecCompliantForm(b))return(await new o(fe.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(w.isArrayBufferView(b)||w.isArrayBuffer(b))return b.byteLength;if(w.isURLSearchParams(b)&&(b=b+""),w.isString(b))return(await l(b)).byteLength},x=async(b,y)=>{const v=w.toFiniteNumber(b.getContentLength());return v??p(y)};return async b=>{let{url:y,method:v,data:N,signal:j,cancelToken:k,timeout:C,onDownloadProgress:R,onUploadProgress:_,responseType:L,headers:A,withCredentials:D="same-origin",fetchOptions:O,maxContentLength:$,maxBodyLength:J}=Qa(b);const Y=w.isNumber($)&&$>-1,Q=w.isNumber(J)&&J>-1,he=z=>w.hasOwnProp(b,z)?b[z]:void 0;let me=s||fetch;L=L?(L+"").toLowerCase():"text";let I=Vd([j,k&&k.toAbortSignal()],C),E=null;const B=I&&I.unsubscribe&&(()=>{I.unsubscribe()});let q,K=null;const H=()=>new T("Request body larger than maxBodyLength limit",T.ERR_BAD_REQUEST,b,E);try{let z;const U=he("auth");if(U){const W=w.getSafeProp(U,"username")||"",pe=w.getSafeProp(U,"password")||"";z={username:W,password:pe}}if(Xd(y)){const W=new URL(y,fe.origin);if(!z&&(W.username||W.password)){const pe=po(W.username),ye=po(W.password);z={username:pe,password:ye}}(W.username||W.password)&&(W.username="",W.password="",y=W.href)}if(z&&(A.delete("authorization"),A.set("Authorization","Basic "+btoa(Jd((z.username||"")+":"+(z.password||""))))),Y&&typeof y=="string"&&y.startsWith("data:")&&Yd(y)>$)throw new T("maxContentLength size of "+$+" exceeded",T.ERR_BAD_RESPONSE,b,E);if(Q&&v!=="get"&&v!=="head"){const W=await p(N);if(typeof W=="number"&&isFinite(W)&&(q=W,W>J))throw H()}const Z=Q&&(w.isReadableStream(N)||w.isStream(N)),V=(W,pe,ye)=>ho(W,mo,_e=>{if(Q&&_e>J)throw K=H();pe&&pe(_e)},ye);if(h&&v!=="get"&&v!=="head"&&(_||Z)){if(q=q??await x(A,N),q!==0||Z){let W=new o(y,{method:"POST",body:N,duplex:"half"}),pe;if(w.isFormData(N)&&(pe=W.headers.get("content-type"))&&A.setContentType(pe),W.body){const[ye,_e]=_&&co(q,Kn(lo(_)))||[];N=V(W.body,ye,_e)}}}else if(Z&&!u&&f&&v!=="get"&&v!=="head")N=V(N);else if(Z&&u&&!h&&v!=="get"&&v!=="head")throw new T("Stream request bodies are not supported by the current fetch implementation",T.ERR_NOT_SUPPORT,b,E);w.isString(D)||(D=D?"include":"omit");const ie=u&&"credentials"in o.prototype;if(w.isFormData(N)){const W=A.getContentType();W&&/^multipart\/form-data/i.test(W)&&!/boundary=/i.test(W)&&A.delete("content-type")}A.set("User-Agent","axios/"+us,!1);const le={...O,signal:I,method:v.toUpperCase(),headers:za(A.normalize()),body:N,duplex:"half",credentials:ie?D:void 0};E=u&&new o(y,le);let te=await(u?me(E,O):me(y,le));const je=be.from(te.headers);if(Y){const W=w.toFiniteNumber(je.getContentLength());if(W!=null&&W>$)throw new T("maxContentLength size of "+$+" exceeded",T.ERR_BAD_RESPONSE,b,E)}const Ce=m&&(L==="stream"||L==="response");if(m&&te.body&&(R||Y||Ce&&B)){const W={};["status","statusText","headers"].forEach(We=>{W[We]=te[We]});const pe=w.toFiniteNumber(je.getContentLength()),[ye,_e]=R&&co(pe,Kn(lo(R),!0))||[];let Te=0;const ur=We=>{if(Y&&(Te=We,Te>$))throw new T("maxContentLength size of "+$+" exceeded",T.ERR_BAD_RESPONSE,b,E);ye&&ye(We)};te=new i(ho(te.body,mo,ur,()=>{_e&&_e(),B&&B()}),W)}L=L||"text";let ke=await g[w.findKey(g,L)||"text"](te,b);if(Y&&!m&&!Ce){let W;if(ke!=null&&(typeof ke.byteLength=="number"?W=ke.byteLength:typeof ke.size=="number"?W=ke.size:typeof ke=="string"&&(W=typeof r=="function"?new r().encode(ke).byteLength:ke.length)),typeof W=="number"&&W>$)throw new T("maxContentLength size of "+$+" exceeded",T.ERR_BAD_RESPONSE,b,E)}return!Ce&&B&&B(),await new Promise((W,pe)=>{Xa(W,pe,{data:ke,headers:be.from(te.headers),status:te.status,statusText:te.statusText,config:b,request:E})})}catch(z){if(B&&B(),I&&I.aborted&&I.reason instanceof T){const U=I.reason;throw U.config=b,E&&(U.request=E),z!==U&&Object.defineProperty(U,"cause",{__proto__:null,value:z,writable:!0,enumerable:!1,configurable:!0}),U}if(K)throw E&&!K.request&&(K.request=E),K;if(z instanceof T)throw E&&!z.request&&(z.request=E),z;if(z&&z.name==="TypeError"&&/Load failed|fetch/i.test(z.message)){const U=new T("Network Error",T.ERR_NETWORK,b,E,z&&z.response);throw Object.defineProperty(U,"cause",{__proto__:null,value:z.cause||z,writable:!0,enumerable:!1,configurable:!0}),U}throw T.from(z,z&&z.code,b,E,z&&z.response)}}},Qd=new Map,ei=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,o=[r,s,n];let i=o.length,c=i,u,d,f=Qd;for(;c--;)u=o[c],d=f.get(u),d===void 0&&f.set(u,d=c?new Map:Zd(t)),f=d;return d};ei();const ds={http:fd,xhr:Wd,fetch:{get:ei}};w.forEach(ds,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const xo=e=>`- ${e}`,ef=e=>w.isFunction(e)||e===null||e===!1;function tf(e,t){e=w.isArray(e)?e:[e];const{length:n}=e;let r,s;const o={};for(let i=0;i<n;i++){r=e[i];let c;if(s=r,!ef(r)&&(s=ds[(c=String(r)).toLowerCase()],s===void 0))throw new T(`Unknown adapter '${c}'`);if(s&&(w.isFunction(s)||(s=s.get(t))))break;o[c||"#"+i]=s}if(!s){const i=Object.entries(o).map(([u,d])=>`adapter ${u} `+(d===!1?"is not supported by the environment":"is not available in the build"));let c=n?i.length>1?`since :
9
9
  `+i.map(xo).join(`
10
- `):" "+xo(i[0]):"as no adapter specified";throw new T("There is no suitable adapter to dispatch the request "+c,T.ERR_NOT_SUPPORT)}return s}const ti={getAdapter:tf,adapters:ds};function Er(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new dn(null,e)}function bo(e){return Er(e),e.headers=be.from(e.headers),e.data=jr.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),ti.getAdapter(e.adapter||un.adapter,e)(e).then(function(r){Er(e),e.response=r;try{r.data=jr.call(e,e.transformResponse,r)}finally{delete e.response}return r.headers=be.from(r.headers),r},function(r){if(!Ja(r)&&(Er(e),r&&r.response)){e.response=r.response;try{r.response.data=jr.call(e,e.transformResponse,r.response)}finally{delete e.response}r.response.headers=be.from(r.response.headers)}return Promise.reject(r)})}const or={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{or[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const yo={};or.transitional=function(t,n,r){function s(o,i){return"[Axios v"+us+"] Transitional option '"+o+"'"+i+(r?". "+r:"")}return(o,i,c)=>{if(t===!1)throw new T(s(i," has been removed"+(n?" in "+n:"")),T.ERR_DEPRECATED);return n&&!yo[i]&&(yo[i]=!0,console.warn(s(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,i,c):!0}};or.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function nf(e,t,n){if(typeof e!="object"||e===null)throw new T("options must be an object",T.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const o=r[s],i=Object.prototype.hasOwnProperty.call(t,o)?t[o]:void 0;if(i){const c=e[o],u=c===void 0||i(c,o,e);if(u!==!0)throw new T("option "+o+" must be "+u,T.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new T("Unknown option "+o,T.ERR_BAD_OPTION)}}const Dn={assertOptions:nf,validators:or},ge=Dn.validators;let ft=class{constructor(t){this.defaults=t||{},this.interceptors={request:new ao,response:new ao}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const o=(()=>{if(!s.stack)return"";const i=s.stack.indexOf(`
10
+ `):" "+xo(i[0]):"as no adapter specified";throw new T("There is no suitable adapter to dispatch the request "+c,T.ERR_NOT_SUPPORT)}return s}const ti={getAdapter:tf,adapters:ds};function Er(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new dn(null,e)}function bo(e){return Er(e),e.headers=be.from(e.headers),e.data=jr.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),ti.getAdapter(e.adapter||un.adapter,e)(e).then(function(r){Er(e),e.response=r;try{r.data=jr.call(e,e.transformResponse,r)}finally{delete e.response}return r.headers=be.from(r.headers),r},function(r){if(!Ja(r)&&(Er(e),r&&r.response)){e.response=r.response;try{r.response.data=jr.call(e,e.transformResponse,r.response)}finally{delete e.response}r.response.headers=be.from(r.response.headers)}return Promise.reject(r)})}const or={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{or[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const yo={};or.transitional=function(t,n,r){function s(o,i){return"[Axios v"+us+"] Transitional option '"+o+"'"+i+(r?". "+r:"")}return(o,i,c)=>{if(t===!1)throw new T(s(i," has been removed"+(n?" in "+n:"")),T.ERR_DEPRECATED);return n&&!yo[i]&&(yo[i]=!0,console.warn(s(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,i,c):!0}};or.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function nf(e,t,n){if(typeof e!="object"||e===null)throw new T("options must be an object",T.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const o=r[s],i=Object.prototype.hasOwnProperty.call(t,o)?t[o]:void 0;if(i){const c=e[o],u=c===void 0||i(c,o,e);if(u!==!0)throw new T("option "+o+" must be "+u,T.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new T("Unknown option "+o,T.ERR_BAD_OPTION)}}const Dn={assertOptions:nf,validators:or},ge=Dn.validators;let dt=class{constructor(t){this.defaults=t||{},this.interceptors={request:new ao,response:new ao}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const o=(()=>{if(!s.stack)return"";const i=s.stack.indexOf(`
11
11
  `);return i===-1?"":s.stack.slice(i+1)})();try{if(!r.stack)r.stack=o;else if(o){const i=o.indexOf(`
12
12
  `),c=i===-1?-1:o.indexOf(`
13
13
  `,i+1),u=c===-1?"":o.slice(c+1);String(r.stack).endsWith(u)||(r.stack+=`
14
- `+o)}}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=gt(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&Dn.assertOptions(r,{silentJSONParsing:ge.transitional(ge.boolean),forcedJSONParsing:ge.transitional(ge.boolean),clarifyTimeoutError:ge.transitional(ge.boolean),legacyInterceptorReqResOrdering:ge.transitional(ge.boolean),advertiseZstdAcceptEncoding:ge.transitional(ge.boolean),validateStatusUndefinedResolves:ge.transitional(ge.boolean)},!1),s!=null&&(w.isFunction(s)?n.paramsSerializer={serialize:s}:Dn.assertOptions(s,{encode:ge.function,serialize:ge.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Dn.assertOptions(n,{baseUrl:ge.spelling("baseURL"),withXsrfToken:ge.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&w.merge(o.common,o[n.method]);o&&w.forEach(["delete","get","head","post","put","patch","query","common"],g=>{delete o[g]}),n.headers=be.concat(i,o);const c=[];let u=!0;this.interceptors.request.forEach(function(p){if(typeof p.runWhen=="function"&&p.runWhen(n)===!1)return;u=u&&p.synchronous;const x=n.transitional||cs;x&&x.legacyInterceptorReqResOrdering?c.unshift(p.fulfilled,p.rejected):c.push(p.fulfilled,p.rejected)});const d=[];this.interceptors.response.forEach(function(p){d.push(p.fulfilled,p.rejected)});let f,l=0,h;if(!u){const g=[bo.bind(this),void 0];for(g.unshift(...c),g.push(...d),h=g.length,f=Promise.resolve(n);l<h;)f=f.then(g[l++],g[l++]);return f}h=c.length;let m=n;for(;l<h;){const g=c[l++],p=c[l++];try{m=g(m)}catch(x){p.call(this,x);break}}try{f=bo.call(this,m)}catch(g){return Promise.reject(g)}for(l=0,h=d.length;l<h;)f=f.then(d[l++],d[l++]);return f}getUri(t){t=gt(this.defaults,t);const n=Za(t.baseURL,t.url,t.allowAbsoluteUrls,t);return Ga(n,t.params,t.paramsSerializer)}};w.forEach(["delete","get","head","options"],function(t){ft.prototype[t]=function(n,r){return this.request(gt(r||{},{method:t,url:n,data:r&&w.hasOwnProp(r,"data")?r.data:void 0}))}});w.forEach(["post","put","patch","query"],function(t){function n(r){return function(o,i,c){return this.request(gt(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}ft.prototype[t]=n(),t!=="query"&&(ft.prototype[t+"Form"]=n(!0))});let rf=class ni{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const r=this;this.promise.then(s=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](s);r._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(c=>{r.subscribe(c),o=c}).then(s);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,c){r.reason||(r.reason=new dn(o,i,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new ni(function(s){t=s}),cancel:t}}};function sf(e){return function(n){return e.apply(null,n)}}function of(e){return w.isObject(e)&&e.isAxiosError===!0}const Kr={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Kr).forEach(([e,t])=>{Kr[t]=e});function ri(e){const t=new ft(e),n=Ta(ft.prototype.request,t);return w.extend(n,ft.prototype,t,{allOwnKeys:!0}),w.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return ri(gt(e,s))},n}const ae=ri(un);ae.Axios=ft;ae.CanceledError=dn;ae.CancelToken=rf;ae.isCancel=Ja;ae.VERSION=us;ae.toFormData=sr;ae.AxiosError=T;ae.Cancel=ae.CanceledError;ae.all=function(t){return Promise.all(t)};ae.spread=sf;ae.isAxiosError=of;ae.mergeConfig=gt;ae.AxiosHeaders=be;ae.formToJSON=e=>Ya(w.isHTMLForm(e)?new FormData(e):e);ae.getAdapter=ti.getAdapter;ae.HttpStatusCode=Kr;ae.default=ae;const{Axios:Ng,AxiosError:Cg,CanceledError:jg,isCancel:Eg,CancelToken:kg,VERSION:_g,all:Pg,Cancel:Ag,isAxiosError:Og,spread:Tg,toFormData:Lg,AxiosHeaders:Ig,HttpStatusCode:Mg,formToJSON:Dg,getAdapter:Fg,mergeConfig:Ug,create:$g}=ae,ne=ae.create({baseURL:"/api/v1/cost"});function si(e,t){ne.defaults.baseURL=`${e.replace(/\/$/,"")}/cost`,t?ne.defaults.headers.common.Authorization=`Bearer ${t}`:delete ne.defaults.headers.common.Authorization}function af(e){e.interceptors.request.use(t=>{if(typeof window<"u"){const n=window.localStorage.getItem("access_token");n?(t.headers=t.headers||{},t.headers.Authorization=`Bearer ${n}`):t.headers&&delete t.headers.Authorization}return t})}const cf=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),lf=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),vo=e=>{const t=lf(e);return t.charAt(0).toUpperCase()+t.slice(1)},oi=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),uf=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var df={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const ff=P.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:o,iconNode:i,...c},u)=>P.createElement("svg",{ref:u,...df,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:oi("lucide",s),...!o&&!uf(c)&&{"aria-hidden":"true"},...c},[...i.map(([d,f])=>P.createElement(d,f)),...Array.isArray(o)?o:[o]]));const ee=(e,t)=>{const n=P.forwardRef(({className:r,...s},o)=>P.createElement(ff,{ref:o,iconNode:t,className:oi(`lucide-${cf(vo(e))}`,`lucide-${e}`,r),...s}));return n.displayName=vo(e),n};const hf=[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],ai=ee("building-2",hf);const mf=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],ii=ee("calendar-clock",mf);const pf=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],gf=ee("chart-column",pf);const xf=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],bf=ee("chevron-down",xf);const yf=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],vf=ee("chevron-left",yf);const wf=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Sf=ee("chevron-right",wf);const Rf=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],ze=ee("circle-alert",Rf);const Nf=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Cf=ee("circle-check",Nf);const jf=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],Jn=ee("cloud",jf);const Ef=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],ci=ee("database",Ef);const kf=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],li=ee("dollar-sign",kf);const _f=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],fs=ee("download",_f);const Pf=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],ui=ee("external-link",Pf);const Af=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Of=ee("eye",Af);const Tf=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]],Lf=ee("file-down",Tf);const If=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],di=ee("file-text",If);const Mf=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],Df=ee("list",Mf);const Ff=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ct=ee("loader-circle",Ff);const Uf=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],$f=ee("map-pin",Uf);const Bf=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],zf=ee("plus",Bf);const Wf=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Lt=ee("refresh-cw",Wf);const Vf=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],hs=ee("search",Vf);const Hf=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],fi=ee("server",Hf);const qf=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],hi=ee("settings-2",qf);const Gf=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],wo=ee("sparkles",Gf);const Kf=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],mi=ee("trash-2",Kf);const Yf=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],Jf=ee("trending-down",Yf);const Xf=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],pi=ee("trending-up",Xf);const Zf=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ht=ee("x",Zf);function gi(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=gi(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Qf(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=gi(e))&&(r&&(r+=" "),r+=t);return r}const eh=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},th=(e,t)=>({classGroupId:e,validator:t}),xi=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Xn="-",So=[],nh="arbitrary..",rh=e=>{const t=oh(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return sh(i);const c=i.split(Xn),u=c[0]===""&&c.length>1?1:0;return bi(c,u,t)},getConflictingClassGroupIds:(i,c)=>{if(c){const u=r[i],d=n[i];return u?d?eh(d,u):u:d||So}return n[i]||So}}},bi=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],o=n.nextPart.get(s);if(o){const d=bi(e,t+1,o);if(d)return d}const i=n.validators;if(i===null)return;const c=t===0?e.join(Xn):e.slice(t).join(Xn),u=i.length;for(let d=0;d<u;d++){const f=i[d];if(f.validator(c))return f.classGroupId}},sh=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?nh+r:void 0})(),oh=e=>{const{theme:t,classGroups:n}=e;return ah(n,t)},ah=(e,t)=>{const n=xi();for(const r in e){const s=e[r];ms(s,n,r,t)}return n},ms=(e,t,n,r)=>{const s=e.length;for(let o=0;o<s;o++){const i=e[o];ih(i,t,n,r)}},ih=(e,t,n,r)=>{if(typeof e=="string"){ch(e,t,n);return}if(typeof e=="function"){lh(e,t,n,r);return}uh(e,t,n,r)},ch=(e,t,n)=>{const r=e===""?t:yi(t,e);r.classGroupId=n},lh=(e,t,n,r)=>{if(dh(e)){ms(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(th(n,e))},uh=(e,t,n,r)=>{const s=Object.entries(e),o=s.length;for(let i=0;i<o;i++){const[c,u]=s[i];ms(u,yi(t,c),n,r)}},yi=(e,t)=>{let n=e;const r=t.split(Xn),s=r.length;for(let o=0;o<s;o++){const i=r[o];let c=n.nextPart.get(i);c||(c=xi(),n.nextPart.set(i,c)),n=c}return n},dh=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,fh=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const s=(o,i)=>{n[o]=i,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(o){let i=n[o];if(i!==void 0)return i;if((i=r[o])!==void 0)return s(o,i),i},set(o,i){o in n?n[o]=i:s(o,i)}}},Yr="!",Ro=":",hh=[],No=(e,t,n,r,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),mh=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=s=>{const o=[];let i=0,c=0,u=0,d;const f=s.length;for(let p=0;p<f;p++){const x=s[p];if(i===0&&c===0){if(x===Ro){o.push(s.slice(u,p)),u=p+1;continue}if(x==="/"){d=p;continue}}x==="["?i++:x==="]"?i--:x==="("?c++:x===")"&&c--}const l=o.length===0?s:s.slice(u);let h=l,m=!1;l.endsWith(Yr)?(h=l.slice(0,-1),m=!0):l.startsWith(Yr)&&(h=l.slice(1),m=!0);const g=d&&d>u?d-u:void 0;return No(o,m,h,g)};if(t){const s=t+Ro,o=r;r=i=>i.startsWith(s)?o(i.slice(s.length)):No(hh,!1,i,void 0,!0)}if(n){const s=r;r=o=>n({className:o,parseClassName:s})}return r},ph=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let o=0;o<n.length;o++){const i=n[o],c=i[0]==="[",u=t.has(i);c||u?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(i)):s.push(i)}return s.length>0&&(s.sort(),r.push(...s)),r}},gh=e=>({cache:fh(e.cacheSize),parseClassName:mh(e),sortModifiers:ph(e),postfixLookupClassGroupIds:xh(e),...rh(e)}),xh=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let r=0;r<n.length;r++)t[n[r]]=!0;return t},bh=/\s+/,yh=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:o,postfixLookupClassGroupIds:i}=t,c=[],u=e.trim().split(bh);let d="";for(let f=u.length-1;f>=0;f-=1){const l=u[f],{isExternal:h,modifiers:m,hasImportantModifier:g,baseClassName:p,maybePostfixModifierPosition:x}=n(l);if(h){d=l+(d.length>0?" "+d:d);continue}let b=!!x,y;if(b){const C=p.substring(0,x);y=r(C);const R=y&&i[y]?r(p):void 0;R&&R!==y&&(y=R,b=!1)}else y=r(p);if(!y){if(!b){d=l+(d.length>0?" "+d:d);continue}if(y=r(p),!y){d=l+(d.length>0?" "+d:d);continue}b=!1}const v=m.length===0?"":m.length===1?m[0]:o(m).join(":"),N=g?v+Yr:v,j=N+y;if(c.indexOf(j)>-1)continue;c.push(j);const k=s(y,b);for(let C=0;C<k.length;++C){const R=k[C];c.push(N+R)}d=l+(d.length>0?" "+d:d)}return d},vh=(...e)=>{let t=0,n,r,s="";for(;t<e.length;)(n=e[t++])&&(r=vi(n))&&(s&&(s+=" "),s+=r);return s},vi=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=vi(e[r]))&&(n&&(n+=" "),n+=t);return n},wh=(e,...t)=>{let n,r,s,o;const i=u=>{const d=t.reduce((f,l)=>l(f),e());return n=gh(d),r=n.cache.get,s=n.cache.set,o=c,c(u)},c=u=>{const d=r(u);if(d)return d;const f=yh(u,n);return s(u,f),f};return o=i,(...u)=>o(vh(...u))},Sh=[],ce=e=>{const t=n=>n[e]||Sh;return t.isThemeGetter=!0,t},wi=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Si=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Rh=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Nh=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ch=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,jh=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Eh=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,kh=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,He=e=>Rh.test(e),G=e=>!!e&&!Number.isNaN(Number(e)),Le=e=>!!e&&Number.isInteger(Number(e)),kr=e=>e.endsWith("%")&&G(e.slice(0,-1)),Fe=e=>Nh.test(e),Ri=()=>!0,_h=e=>Ch.test(e)&&!jh.test(e),ps=()=>!1,Ph=e=>Eh.test(e),Ah=e=>kh.test(e),Oh=e=>!M(e)&&!F(e),Th=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),Lh=e=>Qe(e,ji,ps),M=e=>wi.test(e),nt=e=>Qe(e,Ei,_h),Co=e=>Qe(e,zh,G),Ih=e=>Qe(e,_i,Ri),Mh=e=>Qe(e,ki,ps),jo=e=>Qe(e,Ni,ps),Dh=e=>Qe(e,Ci,Ah),vn=e=>Qe(e,Pi,Ph),F=e=>Si.test(e),Kt=e=>bt(e,Ei),Fh=e=>bt(e,ki),Eo=e=>bt(e,Ni),Uh=e=>bt(e,ji),$h=e=>bt(e,Ci),wn=e=>bt(e,Pi,!0),Bh=e=>bt(e,_i,!0),Qe=(e,t,n)=>{const r=wi.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},bt=(e,t,n=!1)=>{const r=Si.exec(e);return r?r[1]?t(r[1]):n:!1},Ni=e=>e==="position"||e==="percentage",Ci=e=>e==="image"||e==="url",ji=e=>e==="length"||e==="size"||e==="bg-size",Ei=e=>e==="length",zh=e=>e==="number",ki=e=>e==="family-name",_i=e=>e==="number"||e==="weight",Pi=e=>e==="shadow",Wh=()=>{const e=ce("color"),t=ce("font"),n=ce("text"),r=ce("font-weight"),s=ce("tracking"),o=ce("leading"),i=ce("breakpoint"),c=ce("container"),u=ce("spacing"),d=ce("radius"),f=ce("shadow"),l=ce("inset-shadow"),h=ce("text-shadow"),m=ce("drop-shadow"),g=ce("blur"),p=ce("perspective"),x=ce("aspect"),b=ce("ease"),y=ce("animate"),v=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],j=()=>[...N(),F,M],k=()=>["auto","hidden","clip","visible","scroll"],C=()=>["auto","contain","none"],R=()=>[F,M,u],_=()=>[He,"full","auto",...R()],L=()=>[Le,"none","subgrid",F,M],A=()=>["auto",{span:["full",Le,F,M]},Le,F,M],D=()=>[Le,"auto",F,M],O=()=>["auto","min","max","fr",F,M],$=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],J=()=>["start","end","center","stretch","center-safe","end-safe"],Y=()=>["auto",...R()],Q=()=>[He,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],he=()=>[He,"screen","full","dvw","lvw","svw","min","max","fit",...R()],me=()=>[He,"screen","full","lh","dvh","lvh","svh","min","max","fit",...R()],I=()=>[e,F,M],E=()=>[...N(),Eo,jo,{position:[F,M]}],B=()=>["no-repeat",{repeat:["","x","y","space","round"]}],q=()=>["auto","cover","contain",Uh,Lh,{size:[F,M]}],K=()=>[kr,Kt,nt],H=()=>["","none","full",d,F,M],z=()=>["",G,Kt,nt],U=()=>["solid","dashed","dotted","double"],Z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],V=()=>[G,kr,Eo,jo],ie=()=>["","none",g,F,M],le=()=>["none",G,F,M],te=()=>["none",G,F,M],je=()=>[G,F,M],Ce=()=>[He,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Fe],breakpoint:[Fe],color:[Ri],container:[Fe],"drop-shadow":[Fe],ease:["in","out","in-out"],font:[Oh],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Fe],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Fe],shadow:[Fe],spacing:["px",G],text:[Fe],"text-shadow":[Fe],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",He,M,F,x]}],container:["container"],"container-type":[{"@container":["","normal","size",F,M]}],"container-named":[Th],columns:[{columns:[G,M,F,c]}],"break-after":[{"break-after":v()}],"break-before":[{"break-before":v()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:j()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:_()}],"inset-x":[{"inset-x":_()}],"inset-y":[{"inset-y":_()}],start:[{"inset-s":_(),start:_()}],end:[{"inset-e":_(),end:_()}],"inset-bs":[{"inset-bs":_()}],"inset-be":[{"inset-be":_()}],top:[{top:_()}],right:[{right:_()}],bottom:[{bottom:_()}],left:[{left:_()}],visibility:["visible","invisible","collapse"],z:[{z:[Le,"auto",F,M]}],basis:[{basis:[He,"full","auto",c,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[G,He,"auto","initial","none",M]}],grow:[{grow:["",G,F,M]}],shrink:[{shrink:["",G,F,M]}],order:[{order:[Le,"first","last","none",F,M]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:A()}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:A()}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":O()}],"auto-rows":[{"auto-rows":O()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...$(),"normal"]}],"justify-items":[{"justify-items":[...J(),"normal"]}],"justify-self":[{"justify-self":["auto",...J()]}],"align-content":[{content:["normal",...$()]}],"align-items":[{items:[...J(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...J(),{baseline:["","last"]}]}],"place-content":[{"place-content":$()}],"place-items":[{"place-items":[...J(),"baseline"]}],"place-self":[{"place-self":["auto",...J()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pbs:[{pbs:R()}],pbe:[{pbe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],m:[{m:Y()}],mx:[{mx:Y()}],my:[{my:Y()}],ms:[{ms:Y()}],me:[{me:Y()}],mbs:[{mbs:Y()}],mbe:[{mbe:Y()}],mt:[{mt:Y()}],mr:[{mr:Y()}],mb:[{mb:Y()}],ml:[{ml:Y()}],"space-x":[{"space-x":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:Q()}],"inline-size":[{inline:["auto",...he()]}],"min-inline-size":[{"min-inline":["auto",...he()]}],"max-inline-size":[{"max-inline":["none",...he()]}],"block-size":[{block:["auto",...me()]}],"min-block-size":[{"min-block":["auto",...me()]}],"max-block-size":[{"max-block":["none",...me()]}],w:[{w:[c,"screen",...Q()]}],"min-w":[{"min-w":[c,"screen","none",...Q()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[i]},...Q()]}],h:[{h:["screen","lh",...Q()]}],"min-h":[{"min-h":["screen","lh","none",...Q()]}],"max-h":[{"max-h":["screen","lh",...Q()]}],"font-size":[{text:["base",n,Kt,nt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Bh,Ih]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",kr,M]}],"font-family":[{font:[Fh,Mh,t]}],"font-features":[{"font-features":[M]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,F,M]}],"line-clamp":[{"line-clamp":[G,"none",F,Co]}],leading:[{leading:[o,...R()]}],"list-image":[{"list-image":["none",F,M]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",F,M]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...U(),"wavy"]}],"text-decoration-thickness":[{decoration:[G,"from-font","auto",F,nt]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[G,"auto",F,M]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"tab-size":[{tab:[Le,F,M]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",F,M]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",F,M]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:E()}],"bg-repeat":[{bg:B()}],"bg-size":[{bg:q()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Le,F,M],radial:["",F,M],conic:[Le,F,M]},$h,Dh]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:K()}],"gradient-via-pos":[{via:K()}],"gradient-to-pos":[{to:K()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:H()}],"rounded-s":[{"rounded-s":H()}],"rounded-e":[{"rounded-e":H()}],"rounded-t":[{"rounded-t":H()}],"rounded-r":[{"rounded-r":H()}],"rounded-b":[{"rounded-b":H()}],"rounded-l":[{"rounded-l":H()}],"rounded-ss":[{"rounded-ss":H()}],"rounded-se":[{"rounded-se":H()}],"rounded-ee":[{"rounded-ee":H()}],"rounded-es":[{"rounded-es":H()}],"rounded-tl":[{"rounded-tl":H()}],"rounded-tr":[{"rounded-tr":H()}],"rounded-br":[{"rounded-br":H()}],"rounded-bl":[{"rounded-bl":H()}],"border-w":[{border:z()}],"border-w-x":[{"border-x":z()}],"border-w-y":[{"border-y":z()}],"border-w-s":[{"border-s":z()}],"border-w-e":[{"border-e":z()}],"border-w-bs":[{"border-bs":z()}],"border-w-be":[{"border-be":z()}],"border-w-t":[{"border-t":z()}],"border-w-r":[{"border-r":z()}],"border-w-b":[{"border-b":z()}],"border-w-l":[{"border-l":z()}],"divide-x":[{"divide-x":z()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":z()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...U(),"hidden","none"]}],"divide-style":[{divide:[...U(),"hidden","none"]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...U(),"none","hidden"]}],"outline-offset":[{"outline-offset":[G,F,M]}],"outline-w":[{outline:["",G,Kt,nt]}],"outline-color":[{outline:I()}],shadow:[{shadow:["","none",f,wn,vn]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":["none",l,wn,vn]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[G,nt]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":z()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":["none",h,wn,vn]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[G,F,M]}],"mix-blend":[{"mix-blend":[...Z(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Z()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[G]}],"mask-image-linear-from-pos":[{"mask-linear-from":V()}],"mask-image-linear-to-pos":[{"mask-linear-to":V()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":V()}],"mask-image-t-to-pos":[{"mask-t-to":V()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":V()}],"mask-image-r-to-pos":[{"mask-r-to":V()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":V()}],"mask-image-b-to-pos":[{"mask-b-to":V()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":V()}],"mask-image-l-to-pos":[{"mask-l-to":V()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":V()}],"mask-image-x-to-pos":[{"mask-x-to":V()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":V()}],"mask-image-y-to-pos":[{"mask-y-to":V()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[F,M]}],"mask-image-radial-from-pos":[{"mask-radial-from":V()}],"mask-image-radial-to-pos":[{"mask-radial-to":V()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":N()}],"mask-image-conic-pos":[{"mask-conic":[G]}],"mask-image-conic-from-pos":[{"mask-conic-from":V()}],"mask-image-conic-to-pos":[{"mask-conic-to":V()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:E()}],"mask-repeat":[{mask:B()}],"mask-size":[{mask:q()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",F,M]}],filter:[{filter:["","none",F,M]}],blur:[{blur:ie()}],brightness:[{brightness:[G,F,M]}],contrast:[{contrast:[G,F,M]}],"drop-shadow":[{"drop-shadow":["","none",m,wn,vn]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:["",G,F,M]}],"hue-rotate":[{"hue-rotate":[G,F,M]}],invert:[{invert:["",G,F,M]}],saturate:[{saturate:[G,F,M]}],sepia:[{sepia:["",G,F,M]}],"backdrop-filter":[{"backdrop-filter":["","none",F,M]}],"backdrop-blur":[{"backdrop-blur":ie()}],"backdrop-brightness":[{"backdrop-brightness":[G,F,M]}],"backdrop-contrast":[{"backdrop-contrast":[G,F,M]}],"backdrop-grayscale":[{"backdrop-grayscale":["",G,F,M]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[G,F,M]}],"backdrop-invert":[{"backdrop-invert":["",G,F,M]}],"backdrop-opacity":[{"backdrop-opacity":[G,F,M]}],"backdrop-saturate":[{"backdrop-saturate":[G,F,M]}],"backdrop-sepia":[{"backdrop-sepia":["",G,F,M]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",F,M]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[G,"initial",F,M]}],ease:[{ease:["linear","initial",b,F,M]}],delay:[{delay:[G,F,M]}],animate:[{animate:["none",y,F,M]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[p,F,M]}],"perspective-origin":[{"perspective-origin":j()}],rotate:[{rotate:le()}],"rotate-x":[{"rotate-x":le()}],"rotate-y":[{"rotate-y":le()}],"rotate-z":[{"rotate-z":le()}],scale:[{scale:te()}],"scale-x":[{"scale-x":te()}],"scale-y":[{"scale-y":te()}],"scale-z":[{"scale-z":te()}],"scale-3d":["scale-3d"],skew:[{skew:je()}],"skew-x":[{"skew-x":je()}],"skew-y":[{"skew-y":je()}],transform:[{transform:[F,M,"","none","gpu","cpu"]}],"transform-origin":[{origin:j()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ce()}],"translate-x":[{"translate-x":Ce()}],"translate-y":[{"translate-y":Ce()}],"translate-z":[{"translate-z":Ce()}],"translate-none":["translate-none"],zoom:[{zoom:[Le,F,M]}],accent:[{accent:I()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",F,M]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":I()}],"scrollbar-track-color":[{"scrollbar-track":I()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mbs":[{"scroll-mbs":R()}],"scroll-mbe":[{"scroll-mbe":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pbs":[{"scroll-pbs":R()}],"scroll-pbe":[{"scroll-pbe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",F,M]}],fill:[{fill:["none",...I()]}],"stroke-w":[{stroke:[G,Kt,nt,Co]}],stroke:[{stroke:["none",...I()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Vh=wh(Wh);function Ut(...e){return Vh(Qf(e))}function X(e,t="USD"){return new Intl.NumberFormat("en-US",{style:"currency",currency:t,minimumFractionDigits:2}).format(e)}const ue=S.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:Ut("rounded-xl border bg-card text-card-foreground shadow",e),...t}));ue.displayName="Card";const Re=S.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:Ut("flex flex-col space-y-1.5 p-6",e),...t}));Re.displayName="CardHeader";const Pe=S.forwardRef(({className:e,...t},n)=>a.jsx("h3",{ref:n,className:Ut("font-semibold leading-none tracking-tight",e),...t}));Pe.displayName="CardTitle";const Hh=S.forwardRef(({className:e,...t},n)=>a.jsx("p",{ref:n,className:Ut("text-sm text-muted-foreground",e),...t}));Hh.displayName="CardDescription";const de=S.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:Ut("p-6 pt-0",e),...t}));de.displayName="CardContent";const qh=S.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:Ut("flex items-center p-6 pt-0",e),...t}));qh.displayName="CardFooter";function Zn({status:e,error:t}){const n=e?.action==="connect_source"||e?.state==="not_configured",r=e?.message||t||"CUR status could not be loaded. Verify the cost source, discovery job, and Athena configuration.";return a.jsx("section",{className:"rounded-md border bg-card p-6","aria-live":"polite",children:a.jsxs("div",{className:"flex items-start gap-3",children:[e?.state==="unavailable"||t?a.jsx(ze,{className:"mt-0.5 h-5 w-5 shrink-0 text-destructive"}):a.jsx(ci,{className:"mt-0.5 h-5 w-5 shrink-0 text-primary"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h2",{className:"font-semibold",children:n?"Enable AWS Cost and Usage Reports":"CUR data is not ready"}),a.jsx("p",{className:"mt-1 max-w-3xl text-sm text-muted-foreground",children:r}),a.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[a.jsxs(qn,{to:n?"/sources":"/cur-discovery",className:"inline-flex items-center gap-2 rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground",children:[a.jsx(ui,{className:"h-4 w-4"}),n?"Connect AWS source":"Review CUR discovery"]}),!n&&a.jsx(qn,{to:"/sources",className:"rounded-md border px-3 py-2 text-sm font-medium hover:bg-muted",children:"Cost sources"})]})]})]})})}const oe={getOverview:e=>ne.get("/overview",{params:e}).then(t=>t.data),getAccounts:e=>ne.get("/accounts",{params:e}).then(t=>t.data),getReports:e=>ne.get("/reports",{params:e}).then(t=>t.data),getFilterOptions:e=>ne.get("/filter-options",{params:{start:e?.start,end:e?.end,tagKey:e?.filterTagKey,managementAccountId:e?.managementAccountId}}).then(t=>t.data),getTags:e=>ne.get("/tags",{params:e}).then(t=>t.data),getDataStatus:e=>ne.get("/data-status",{params:e}).then(t=>t.data),getAnalysisStatus:e=>ne.get("/analysis/status",{params:e}).then(t=>t.data),getLatestAnalysis:e=>ne.get("/analysis/latest",{params:e}).then(t=>t.data.analysis),getAnalysisSchedule:e=>ne.get("/analysis/schedule",{params:e}).then(t=>t.data),updateAnalysisSchedule:(e,t)=>ne.put("/analysis/schedule",e,{params:t}).then(n=>n.data),getAnalysisReports:e=>ne.get("/analysis/reports",{params:e}).then(t=>t.data.reports),removeAnalysisReport:e=>ne.delete(`/analysis/reports/${e}`).then(t=>t.data),downloadAnalysisHtml:e=>ne.get(`/analysis/reports/${e}/html`,{responseType:"blob"}).then(t=>t.data),downloadAnalysisPdf:e=>ne.get(`/analysis/reports/${e}/pdf`,{responseType:"blob"}).then(t=>t.data),getSources:()=>ne.get("/sources").then(e=>e.data),createSource:e=>ne.post("/sources",e).then(t=>t.data),getSourceStatus:e=>ne.get(`/sources/${e}/status`).then(t=>t.data),verifySource:e=>ne.post(`/sources/${e}/verify`).then(t=>t.data),removeSource:e=>ne.delete(`/sources/${e}`).then(t=>t.data),downloadSourceTemplate:e=>ne.get(`/sources/${e}/template`,{responseType:"blob"}).then(t=>t.data),getCurDiscovery:e=>ne.get("/cur-discovery",{params:e}).then(t=>t.data)},Ai=P.createContext("user"),Gh=Ai.Provider,Kh=()=>P.useContext(Ai),Oi=P.createContext(null);function Yh({tenantId:e="default",children:t}){const n=`meyi-cost:selected-management-account:${e||"default"}`,[r,s]=P.useState([]),[o,i]=P.useState(""),[c,u]=P.useState(!0),d=P.useCallback(async()=>{u(!0);try{const m=((await oe.getSources()).sources||[]).filter(g=>!!g.managementAccountId);s(m),i(g=>{const x=window.localStorage.getItem(n)||""||g,b=m.find(v=>v.status==="CONNECTED")||m[0],y=m.some(v=>v.managementAccountId===x)?x:b?.managementAccountId||"";return y?window.localStorage.setItem(n,y):window.localStorage.removeItem(n),y})}catch{s([]),i("")}finally{u(!1)}},[n]);P.useEffect(()=>{d()},[d]);const f=P.useCallback(h=>{/^\d{12}$/.test(h)&&(window.localStorage.setItem(n,h),i(h))},[n]),l=P.useMemo(()=>({sources:r,managementAccountId:o,loading:c,selectManagementAccount:f,refreshSources:d}),[r,o,c,f,d]);return a.jsx(Oi.Provider,{value:l,children:t})}function $t(){const e=P.useContext(Oi);if(!e)throw new Error("useCostAccount must be used inside CostAccountProvider");return e}function ar(){const{sources:e,managementAccountId:t,loading:n,selectManagementAccount:r}=$t();return e.length<=1?null:a.jsxs("label",{className:"flex items-center gap-2",children:[a.jsx(ai,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("span",{className:"sr-only",children:"Management account"}),a.jsx("select",{"aria-label":"Management account",value:t,onChange:s=>r(s.target.value),disabled:n,className:"max-w-72 rounded-md border bg-background px-3 py-2 text-sm shadow-sm disabled:opacity-50",children:e.map(s=>a.jsxs("option",{value:s.managementAccountId||"",children:["Management account ",s.managementAccountId]},s.connectionId))})]})}function Jh({points:e,currency:t="USD"}){const[n,r]=P.useState(null);if(!e.length)return a.jsx("p",{className:"py-20 text-center text-sm text-muted-foreground",children:"No trend data for this period."});const s=900,o=260,i=70,c=24,u=22,d=48,f=s-i-c,l=o-u-d,h=Math.max(...e.map(x=>x.value),1),m=e.map((x,b)=>({...x,x:i+(e.length===1?f/2:b*f/(e.length-1)),y:u+l-x.value/h*l})),g=n==null?null:m[n],p=x=>{const b=x.currentTarget.getBoundingClientRect(),y=(x.clientX-b.left)/b.width*s;let v=0;for(let N=1;N<m.length;N+=1)Math.abs(m[N].x-y)<Math.abs(m[v].x-y)&&(v=N);r(v)};return a.jsxs("div",{className:"relative w-full",children:[a.jsxs("svg",{viewBox:`0 0 ${s} ${o}`,className:"h-72 w-full",onMouseMove:p,onMouseLeave:()=>r(null),role:"img","aria-label":"Cost trend line chart",children:[[0,.25,.5,.75,1].map(x=>{const b=u+l*x;return a.jsxs("g",{children:[a.jsx("line",{x1:i,y1:b,x2:s-c,y2:b,stroke:"#d8e0e7",strokeDasharray:"4 4"}),a.jsx("text",{x:i-10,y:b+4,textAnchor:"end",fill:"currentColor",className:"text-[10px] text-muted-foreground",children:X(h*(1-x),t)})]},x)}),a.jsx("line",{x1:i,y1:u+l,x2:s-c,y2:u+l,stroke:"#aebbc5"}),a.jsx("polyline",{points:m.map(x=>`${x.x},${x.y}`).join(" "),fill:"none",stroke:"#1f5f85",strokeWidth:"4",strokeLinejoin:"round",strokeLinecap:"round"}),g&&a.jsx("line",{x1:g.x,y1:u,x2:g.x,y2:u+l,stroke:"#1f5f85",strokeDasharray:"3 4",opacity:"0.45"}),m.map((x,b)=>a.jsxs("g",{children:[a.jsx("circle",{cx:x.x,cy:x.y,r:n===b?7:5,fill:"#1f5f85",stroke:"white",strokeWidth:"2"}),a.jsx("text",{x:x.x,y:o-17,textAnchor:"middle",fill:"currentColor",className:"text-[11px] text-muted-foreground",children:x.label})]},x.key))]}),g&&a.jsxs("div",{className:"pointer-events-none absolute z-20 min-w-44 rounded-lg border bg-popover p-3 text-popover-foreground shadow-xl",style:{left:`${g.x/s*100}%`,top:`${Math.max(g.y/o*100-4,2)}%`,transform:g.x>s*.75?"translate(-100%, -100%)":"translate(-50%, -100%)"},children:[a.jsx("p",{className:"text-xs font-semibold",children:g.label}),a.jsx("p",{className:"mt-1 text-sm font-bold text-primary",children:X(g.value,t)}),g.details?.slice(0,5).map(x=>a.jsxs("div",{className:"mt-1 flex justify-between gap-4 text-xs",children:[a.jsx("span",{className:"max-w-40 truncate text-muted-foreground",children:x.label}),a.jsx("span",{children:X(x.value,t)})]},x.label))]})]})}const ko=e=>e.length>16?`${e.slice(0,14)}...`:e,Xh=(e,t)=>new Intl.NumberFormat("en-US",{style:"currency",currency:t||"USD",notation:"compact",maximumFractionDigits:1}).format(e);function Zh({title:e,items:t,currency:n}){const o={top:38,right:18,bottom:72,left:76},i=720-o.left-o.right,c=320-o.top-o.bottom,u=Math.max(...t.map(l=>l.amount),1),d=i/t.length,f=Math.min(56,d*.58);return a.jsxs("svg",{viewBox:"0 0 720 320",className:"h-80 w-full",role:"img","aria-label":`${e} cost bar chart`,children:[[0,.25,.5,.75,1].map(l=>{const h=o.top+c-l*c;return a.jsxs("g",{children:[a.jsx("line",{x1:o.left,y1:h,x2:720-o.right,y2:h,stroke:"currentColor",opacity:l===0?.3:.12,vectorEffect:"non-scaling-stroke"}),a.jsx("text",{x:o.left-12,y:h+4,textAnchor:"end",fill:"currentColor",opacity:"0.7",fontSize:"11",children:Xh(u*l,n)})]},l)}),a.jsx("line",{x1:o.left,y1:o.top,x2:o.left,y2:o.top+c,stroke:"currentColor",opacity:"0.3",vectorEffect:"non-scaling-stroke"}),t.map((l,h)=>{const m=o.left+d*h+d/2,g=Math.max(l.amount/u*c,3),p=o.top+c-g;return a.jsxs("g",{tabIndex:0,"aria-label":`${l.label}: ${X(l.amount,n)}`,className:"outline-none focus-visible:opacity-75",children:[a.jsxs("title",{children:[l.label,": ",X(l.amount,n)]}),a.jsx("rect",{x:m-f/2,y:p,width:f,height:g,rx:"4",className:"fill-primary opacity-80 transition-opacity hover:opacity-100"}),a.jsx("text",{x:m,y:Math.max(p-8,16),textAnchor:"middle",fill:"currentColor",fontSize:"11",fontWeight:"600",children:X(l.amount,n)}),a.jsx("text",{x:m,y:278,textAnchor:"middle",fill:"currentColor",opacity:"0.72",fontSize:"11",children:ko(l.label)}),l.accountId&&a.jsx("text",{x:m,y:295,textAnchor:"middle",fill:"currentColor",opacity:"0.55",fontSize:"9",children:ko(l.accountId)})]},l.key||l.label)}),a.jsxs("text",{x:"18",y:o.top+c/2,transform:`rotate(-90 18 ${o.top+c/2})`,textAnchor:"middle",fill:"currentColor",opacity:"0.65",fontSize:"11",children:["Cost (",n,")"]})]})}const Ti="min-h-32 transition-all duration-200 ease-out hover:-translate-y-1 hover:scale-[1.01] hover:border-primary/30 hover:shadow-lg";function _r({title:e,icon:t,items:n,currency:r}){const[s,o]=P.useState("chart"),i=n.slice(0,6),c=Math.max(...i.map(u=>u.amount),1);return a.jsxs(ue,{className:"min-w-0",children:[a.jsxs(Re,{className:"flex flex-row items-center justify-between gap-3 pb-3",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("span",{className:"text-primary",children:t}),a.jsx(Pe,{className:"truncate text-sm",children:e})]}),a.jsxs("div",{className:"flex rounded-md border p-0.5","aria-label":`${e} view`,children:[a.jsx("button",{type:"button",onClick:()=>o("chart"),"aria-label":`Show ${e} as bar chart`,"aria-pressed":s==="chart",title:"Bar chart",className:`rounded p-1.5 ${s==="chart"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"}`,children:a.jsx(gf,{className:"h-4 w-4"})}),a.jsx("button",{type:"button",onClick:()=>o("list"),"aria-label":`Show ${e} as list`,"aria-pressed":s==="list",title:"List",className:`rounded p-1.5 ${s==="list"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"}`,children:a.jsx(Df,{className:"h-4 w-4"})})]})]}),a.jsx(de,{children:i.length?s==="chart"?a.jsx(Zh,{title:e,items:i,currency:r}):a.jsx("div",{className:"space-y-3",children:i.map(u=>a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3 text-sm",children:[a.jsxs("span",{className:"truncate text-muted-foreground",title:u.label,children:[u.label,u.accountId?a.jsxs("span",{className:"ml-1 text-xs",children:["(",u.accountId,")"]}):null]}),a.jsx("span",{className:"shrink-0 font-medium",children:X(u.amount,r)})]}),a.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:a.jsx("div",{className:"h-full rounded-full bg-primary/75",style:{width:`${u.amount/c*100}%`}})})]},u.key||u.label))}):a.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No cost data for this period."})})]})}function Qh(){return a.jsxs("div",{"aria-live":"polite","aria-busy":"true",className:"contents",children:[a.jsx("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(min(100%,240px),1fr))] gap-4",children:Array.from({length:4},(e,t)=>a.jsxs(ue,{className:Ti,children:[a.jsx(Re,{className:"pb-2",children:a.jsx("div",{className:"h-3 w-24 animate-pulse rounded bg-muted"})}),a.jsxs(de,{children:[a.jsx("div",{className:"h-6 w-3/4 animate-pulse rounded bg-muted"}),a.jsx("div",{className:"mt-3 h-3 w-1/2 animate-pulse rounded bg-muted/80"})]})]},t))}),a.jsxs(ue,{children:[a.jsx(Re,{children:a.jsx("div",{className:"h-4 w-36 animate-pulse rounded bg-muted"})}),a.jsx(de,{children:a.jsx("div",{className:"h-72 animate-pulse rounded-lg bg-muted/70"})})]}),a.jsx("div",{className:"grid gap-4 lg:grid-cols-2",children:Array.from({length:3},(e,t)=>a.jsxs(ue,{children:[a.jsx(Re,{children:a.jsx("div",{className:"h-4 w-32 animate-pulse rounded bg-muted"})}),a.jsx(de,{className:"space-y-4",children:Array.from({length:5},(n,r)=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between",children:[a.jsx("div",{className:"h-3 w-2/5 animate-pulse rounded bg-muted"}),a.jsx("div",{className:"h-3 w-20 animate-pulse rounded bg-muted"})]}),a.jsx("div",{className:"mt-2 h-1.5 animate-pulse rounded bg-muted/80"})]},r))})]},t))})]})}function em({data:e,period:t,selectedMonth:n}){const r=e.topServices[0],s=e.topAccounts[0],o=new Date,[i,c]=n.split("-").map(Number),u=t==="monthly"?new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric"}).format(new Date(i,c-1,1)):String(o.getFullYear()),d=[{label:"Total cost",value:a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"block",children:X(e.totalCost,e.currency)}),a.jsxs("span",{className:"mt-1 block text-sm font-medium text-muted-foreground",children:["Accounts: ",e.activeAccounts]})]}),helper:u,icon:a.jsx(li,{})},{label:"Active resources",value:e.activeResources==null?a.jsx("span",{className:"text-sm",title:e.activeResourcesMessage,children:"CUR access required"}):Number(e.activeResources).toLocaleString(),helper:`${u} across all accounts`,icon:a.jsx(Jn,{})},{label:"Highest cost service",value:r?a.jsx("span",{className:"whitespace-pre-line text-sm",children:`Service - ${r.label}
14
+ `+o)}}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=pt(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&Dn.assertOptions(r,{silentJSONParsing:ge.transitional(ge.boolean),forcedJSONParsing:ge.transitional(ge.boolean),clarifyTimeoutError:ge.transitional(ge.boolean),legacyInterceptorReqResOrdering:ge.transitional(ge.boolean),advertiseZstdAcceptEncoding:ge.transitional(ge.boolean),validateStatusUndefinedResolves:ge.transitional(ge.boolean)},!1),s!=null&&(w.isFunction(s)?n.paramsSerializer={serialize:s}:Dn.assertOptions(s,{encode:ge.function,serialize:ge.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Dn.assertOptions(n,{baseUrl:ge.spelling("baseURL"),withXsrfToken:ge.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&w.merge(o.common,o[n.method]);o&&w.forEach(["delete","get","head","post","put","patch","query","common"],g=>{delete o[g]}),n.headers=be.concat(i,o);const c=[];let u=!0;this.interceptors.request.forEach(function(p){if(typeof p.runWhen=="function"&&p.runWhen(n)===!1)return;u=u&&p.synchronous;const x=n.transitional||cs;x&&x.legacyInterceptorReqResOrdering?c.unshift(p.fulfilled,p.rejected):c.push(p.fulfilled,p.rejected)});const d=[];this.interceptors.response.forEach(function(p){d.push(p.fulfilled,p.rejected)});let f,l=0,h;if(!u){const g=[bo.bind(this),void 0];for(g.unshift(...c),g.push(...d),h=g.length,f=Promise.resolve(n);l<h;)f=f.then(g[l++],g[l++]);return f}h=c.length;let m=n;for(;l<h;){const g=c[l++],p=c[l++];try{m=g(m)}catch(x){p.call(this,x);break}}try{f=bo.call(this,m)}catch(g){return Promise.reject(g)}for(l=0,h=d.length;l<h;)f=f.then(d[l++],d[l++]);return f}getUri(t){t=pt(this.defaults,t);const n=Za(t.baseURL,t.url,t.allowAbsoluteUrls,t);return Ga(n,t.params,t.paramsSerializer)}};w.forEach(["delete","get","head","options"],function(t){dt.prototype[t]=function(n,r){return this.request(pt(r||{},{method:t,url:n,data:r&&w.hasOwnProp(r,"data")?r.data:void 0}))}});w.forEach(["post","put","patch","query"],function(t){function n(r){return function(o,i,c){return this.request(pt(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}dt.prototype[t]=n(),t!=="query"&&(dt.prototype[t+"Form"]=n(!0))});let rf=class ni{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(o){n=o});const r=this;this.promise.then(s=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](s);r._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(c=>{r.subscribe(c),o=c}).then(s);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,c){r.reason||(r.reason=new dn(o,i,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new ni(function(s){t=s}),cancel:t}}};function sf(e){return function(n){return e.apply(null,n)}}function of(e){return w.isObject(e)&&e.isAxiosError===!0}const Kr={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Kr).forEach(([e,t])=>{Kr[t]=e});function ri(e){const t=new dt(e),n=Ta(dt.prototype.request,t);return w.extend(n,dt.prototype,t,{allOwnKeys:!0}),w.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return ri(pt(e,s))},n}const ae=ri(un);ae.Axios=dt;ae.CanceledError=dn;ae.CancelToken=rf;ae.isCancel=Ja;ae.VERSION=us;ae.toFormData=sr;ae.AxiosError=T;ae.Cancel=ae.CanceledError;ae.all=function(t){return Promise.all(t)};ae.spread=sf;ae.isAxiosError=of;ae.mergeConfig=pt;ae.AxiosHeaders=be;ae.formToJSON=e=>Ya(w.isHTMLForm(e)?new FormData(e):e);ae.getAdapter=ti.getAdapter;ae.HttpStatusCode=Kr;ae.default=ae;const{Axios:Ng,AxiosError:Cg,CanceledError:jg,isCancel:Eg,CancelToken:kg,VERSION:_g,all:Pg,Cancel:Ag,isAxiosError:Og,spread:Tg,toFormData:Lg,AxiosHeaders:Ig,HttpStatusCode:Mg,formToJSON:Dg,getAdapter:Fg,mergeConfig:Ug,create:$g}=ae,ne=ae.create({baseURL:"/api/v1/cost"});function si(e,t){ne.defaults.baseURL=`${e.replace(/\/$/,"")}/cost`,t?ne.defaults.headers.common.Authorization=`Bearer ${t}`:delete ne.defaults.headers.common.Authorization}function af(e){e.interceptors.request.use(t=>{if(typeof window<"u"){const n=window.localStorage.getItem("access_token");n?(t.headers=t.headers||{},t.headers.Authorization=`Bearer ${n}`):t.headers&&delete t.headers.Authorization}return t})}const cf=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),lf=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),vo=e=>{const t=lf(e);return t.charAt(0).toUpperCase()+t.slice(1)},oi=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),uf=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var df={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const ff=P.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:o,iconNode:i,...c},u)=>P.createElement("svg",{ref:u,...df,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:oi("lucide",s),...!o&&!uf(c)&&{"aria-hidden":"true"},...c},[...i.map(([d,f])=>P.createElement(d,f)),...Array.isArray(o)?o:[o]]));const ee=(e,t)=>{const n=P.forwardRef(({className:r,...s},o)=>P.createElement(ff,{ref:o,iconNode:t,className:oi(`lucide-${cf(vo(e))}`,`lucide-${e}`,r),...s}));return n.displayName=vo(e),n};const hf=[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],ai=ee("building-2",hf);const mf=[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]],ii=ee("calendar-clock",mf);const pf=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],gf=ee("chart-column",pf);const xf=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],bf=ee("chevron-down",xf);const yf=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],vf=ee("chevron-left",yf);const wf=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Sf=ee("chevron-right",wf);const Rf=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Be=ee("circle-alert",Rf);const Nf=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Cf=ee("circle-check",Nf);const jf=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],Jn=ee("cloud",jf);const Ef=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],ci=ee("database",Ef);const kf=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],li=ee("dollar-sign",kf);const _f=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],fs=ee("download",_f);const Pf=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],ui=ee("external-link",Pf);const Af=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Of=ee("eye",Af);const Tf=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]],Lf=ee("file-down",Tf);const If=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],di=ee("file-text",If);const Mf=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],Df=ee("list",Mf);const Ff=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],it=ee("loader-circle",Ff);const Uf=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],$f=ee("map-pin",Uf);const Bf=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],zf=ee("plus",Bf);const Wf=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Tt=ee("refresh-cw",Wf);const Vf=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],hs=ee("search",Vf);const Hf=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],fi=ee("server",Hf);const qf=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],hi=ee("settings-2",qf);const Gf=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],wo=ee("sparkles",Gf);const Kf=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],mi=ee("trash-2",Kf);const Yf=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],Jf=ee("trending-down",Yf);const Xf=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],pi=ee("trending-up",Xf);const Zf=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ft=ee("x",Zf);function gi(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=gi(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Qf(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=gi(e))&&(r&&(r+=" "),r+=t);return r}const eh=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},th=(e,t)=>({classGroupId:e,validator:t}),xi=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Xn="-",So=[],nh="arbitrary..",rh=e=>{const t=oh(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return sh(i);const c=i.split(Xn),u=c[0]===""&&c.length>1?1:0;return bi(c,u,t)},getConflictingClassGroupIds:(i,c)=>{if(c){const u=r[i],d=n[i];return u?d?eh(d,u):u:d||So}return n[i]||So}}},bi=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],o=n.nextPart.get(s);if(o){const d=bi(e,t+1,o);if(d)return d}const i=n.validators;if(i===null)return;const c=t===0?e.join(Xn):e.slice(t).join(Xn),u=i.length;for(let d=0;d<u;d++){const f=i[d];if(f.validator(c))return f.classGroupId}},sh=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?nh+r:void 0})(),oh=e=>{const{theme:t,classGroups:n}=e;return ah(n,t)},ah=(e,t)=>{const n=xi();for(const r in e){const s=e[r];ms(s,n,r,t)}return n},ms=(e,t,n,r)=>{const s=e.length;for(let o=0;o<s;o++){const i=e[o];ih(i,t,n,r)}},ih=(e,t,n,r)=>{if(typeof e=="string"){ch(e,t,n);return}if(typeof e=="function"){lh(e,t,n,r);return}uh(e,t,n,r)},ch=(e,t,n)=>{const r=e===""?t:yi(t,e);r.classGroupId=n},lh=(e,t,n,r)=>{if(dh(e)){ms(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(th(n,e))},uh=(e,t,n,r)=>{const s=Object.entries(e),o=s.length;for(let i=0;i<o;i++){const[c,u]=s[i];ms(u,yi(t,c),n,r)}},yi=(e,t)=>{let n=e;const r=t.split(Xn),s=r.length;for(let o=0;o<s;o++){const i=r[o];let c=n.nextPart.get(i);c||(c=xi(),n.nextPart.set(i,c)),n=c}return n},dh=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,fh=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const s=(o,i)=>{n[o]=i,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(o){let i=n[o];if(i!==void 0)return i;if((i=r[o])!==void 0)return s(o,i),i},set(o,i){o in n?n[o]=i:s(o,i)}}},Yr="!",Ro=":",hh=[],No=(e,t,n,r,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),mh=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=s=>{const o=[];let i=0,c=0,u=0,d;const f=s.length;for(let p=0;p<f;p++){const x=s[p];if(i===0&&c===0){if(x===Ro){o.push(s.slice(u,p)),u=p+1;continue}if(x==="/"){d=p;continue}}x==="["?i++:x==="]"?i--:x==="("?c++:x===")"&&c--}const l=o.length===0?s:s.slice(u);let h=l,m=!1;l.endsWith(Yr)?(h=l.slice(0,-1),m=!0):l.startsWith(Yr)&&(h=l.slice(1),m=!0);const g=d&&d>u?d-u:void 0;return No(o,m,h,g)};if(t){const s=t+Ro,o=r;r=i=>i.startsWith(s)?o(i.slice(s.length)):No(hh,!1,i,void 0,!0)}if(n){const s=r;r=o=>n({className:o,parseClassName:s})}return r},ph=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let o=0;o<n.length;o++){const i=n[o],c=i[0]==="[",u=t.has(i);c||u?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(i)):s.push(i)}return s.length>0&&(s.sort(),r.push(...s)),r}},gh=e=>({cache:fh(e.cacheSize),parseClassName:mh(e),sortModifiers:ph(e),postfixLookupClassGroupIds:xh(e),...rh(e)}),xh=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let r=0;r<n.length;r++)t[n[r]]=!0;return t},bh=/\s+/,yh=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:o,postfixLookupClassGroupIds:i}=t,c=[],u=e.trim().split(bh);let d="";for(let f=u.length-1;f>=0;f-=1){const l=u[f],{isExternal:h,modifiers:m,hasImportantModifier:g,baseClassName:p,maybePostfixModifierPosition:x}=n(l);if(h){d=l+(d.length>0?" "+d:d);continue}let b=!!x,y;if(b){const C=p.substring(0,x);y=r(C);const R=y&&i[y]?r(p):void 0;R&&R!==y&&(y=R,b=!1)}else y=r(p);if(!y){if(!b){d=l+(d.length>0?" "+d:d);continue}if(y=r(p),!y){d=l+(d.length>0?" "+d:d);continue}b=!1}const v=m.length===0?"":m.length===1?m[0]:o(m).join(":"),N=g?v+Yr:v,j=N+y;if(c.indexOf(j)>-1)continue;c.push(j);const k=s(y,b);for(let C=0;C<k.length;++C){const R=k[C];c.push(N+R)}d=l+(d.length>0?" "+d:d)}return d},vh=(...e)=>{let t=0,n,r,s="";for(;t<e.length;)(n=e[t++])&&(r=vi(n))&&(s&&(s+=" "),s+=r);return s},vi=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=vi(e[r]))&&(n&&(n+=" "),n+=t);return n},wh=(e,...t)=>{let n,r,s,o;const i=u=>{const d=t.reduce((f,l)=>l(f),e());return n=gh(d),r=n.cache.get,s=n.cache.set,o=c,c(u)},c=u=>{const d=r(u);if(d)return d;const f=yh(u,n);return s(u,f),f};return o=i,(...u)=>o(vh(...u))},Sh=[],ce=e=>{const t=n=>n[e]||Sh;return t.isThemeGetter=!0,t},wi=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Si=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Rh=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Nh=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ch=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,jh=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Eh=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,kh=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ve=e=>Rh.test(e),G=e=>!!e&&!Number.isNaN(Number(e)),Le=e=>!!e&&Number.isInteger(Number(e)),kr=e=>e.endsWith("%")&&G(e.slice(0,-1)),Fe=e=>Nh.test(e),Ri=()=>!0,_h=e=>Ch.test(e)&&!jh.test(e),ps=()=>!1,Ph=e=>Eh.test(e),Ah=e=>kh.test(e),Oh=e=>!M(e)&&!F(e),Th=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),Lh=e=>Ze(e,ji,ps),M=e=>wi.test(e),tt=e=>Ze(e,Ei,_h),Co=e=>Ze(e,zh,G),Ih=e=>Ze(e,_i,Ri),Mh=e=>Ze(e,ki,ps),jo=e=>Ze(e,Ni,ps),Dh=e=>Ze(e,Ci,Ah),vn=e=>Ze(e,Pi,Ph),F=e=>Si.test(e),Gt=e=>xt(e,Ei),Fh=e=>xt(e,ki),Eo=e=>xt(e,Ni),Uh=e=>xt(e,ji),$h=e=>xt(e,Ci),wn=e=>xt(e,Pi,!0),Bh=e=>xt(e,_i,!0),Ze=(e,t,n)=>{const r=wi.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},xt=(e,t,n=!1)=>{const r=Si.exec(e);return r?r[1]?t(r[1]):n:!1},Ni=e=>e==="position"||e==="percentage",Ci=e=>e==="image"||e==="url",ji=e=>e==="length"||e==="size"||e==="bg-size",Ei=e=>e==="length",zh=e=>e==="number",ki=e=>e==="family-name",_i=e=>e==="number"||e==="weight",Pi=e=>e==="shadow",Wh=()=>{const e=ce("color"),t=ce("font"),n=ce("text"),r=ce("font-weight"),s=ce("tracking"),o=ce("leading"),i=ce("breakpoint"),c=ce("container"),u=ce("spacing"),d=ce("radius"),f=ce("shadow"),l=ce("inset-shadow"),h=ce("text-shadow"),m=ce("drop-shadow"),g=ce("blur"),p=ce("perspective"),x=ce("aspect"),b=ce("ease"),y=ce("animate"),v=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],j=()=>[...N(),F,M],k=()=>["auto","hidden","clip","visible","scroll"],C=()=>["auto","contain","none"],R=()=>[F,M,u],_=()=>[Ve,"full","auto",...R()],L=()=>[Le,"none","subgrid",F,M],A=()=>["auto",{span:["full",Le,F,M]},Le,F,M],D=()=>[Le,"auto",F,M],O=()=>["auto","min","max","fr",F,M],$=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],J=()=>["start","end","center","stretch","center-safe","end-safe"],Y=()=>["auto",...R()],Q=()=>[Ve,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],he=()=>[Ve,"screen","full","dvw","lvw","svw","min","max","fit",...R()],me=()=>[Ve,"screen","full","lh","dvh","lvh","svh","min","max","fit",...R()],I=()=>[e,F,M],E=()=>[...N(),Eo,jo,{position:[F,M]}],B=()=>["no-repeat",{repeat:["","x","y","space","round"]}],q=()=>["auto","cover","contain",Uh,Lh,{size:[F,M]}],K=()=>[kr,Gt,tt],H=()=>["","none","full",d,F,M],z=()=>["",G,Gt,tt],U=()=>["solid","dashed","dotted","double"],Z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],V=()=>[G,kr,Eo,jo],ie=()=>["","none",g,F,M],le=()=>["none",G,F,M],te=()=>["none",G,F,M],je=()=>[G,F,M],Ce=()=>[Ve,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Fe],breakpoint:[Fe],color:[Ri],container:[Fe],"drop-shadow":[Fe],ease:["in","out","in-out"],font:[Oh],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Fe],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Fe],shadow:[Fe],spacing:["px",G],text:[Fe],"text-shadow":[Fe],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Ve,M,F,x]}],container:["container"],"container-type":[{"@container":["","normal","size",F,M]}],"container-named":[Th],columns:[{columns:[G,M,F,c]}],"break-after":[{"break-after":v()}],"break-before":[{"break-before":v()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:j()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:_()}],"inset-x":[{"inset-x":_()}],"inset-y":[{"inset-y":_()}],start:[{"inset-s":_(),start:_()}],end:[{"inset-e":_(),end:_()}],"inset-bs":[{"inset-bs":_()}],"inset-be":[{"inset-be":_()}],top:[{top:_()}],right:[{right:_()}],bottom:[{bottom:_()}],left:[{left:_()}],visibility:["visible","invisible","collapse"],z:[{z:[Le,"auto",F,M]}],basis:[{basis:[Ve,"full","auto",c,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[G,Ve,"auto","initial","none",M]}],grow:[{grow:["",G,F,M]}],shrink:[{shrink:["",G,F,M]}],order:[{order:[Le,"first","last","none",F,M]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:A()}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:A()}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":O()}],"auto-rows":[{"auto-rows":O()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...$(),"normal"]}],"justify-items":[{"justify-items":[...J(),"normal"]}],"justify-self":[{"justify-self":["auto",...J()]}],"align-content":[{content:["normal",...$()]}],"align-items":[{items:[...J(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...J(),{baseline:["","last"]}]}],"place-content":[{"place-content":$()}],"place-items":[{"place-items":[...J(),"baseline"]}],"place-self":[{"place-self":["auto",...J()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pbs:[{pbs:R()}],pbe:[{pbe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],m:[{m:Y()}],mx:[{mx:Y()}],my:[{my:Y()}],ms:[{ms:Y()}],me:[{me:Y()}],mbs:[{mbs:Y()}],mbe:[{mbe:Y()}],mt:[{mt:Y()}],mr:[{mr:Y()}],mb:[{mb:Y()}],ml:[{ml:Y()}],"space-x":[{"space-x":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:Q()}],"inline-size":[{inline:["auto",...he()]}],"min-inline-size":[{"min-inline":["auto",...he()]}],"max-inline-size":[{"max-inline":["none",...he()]}],"block-size":[{block:["auto",...me()]}],"min-block-size":[{"min-block":["auto",...me()]}],"max-block-size":[{"max-block":["none",...me()]}],w:[{w:[c,"screen",...Q()]}],"min-w":[{"min-w":[c,"screen","none",...Q()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[i]},...Q()]}],h:[{h:["screen","lh",...Q()]}],"min-h":[{"min-h":["screen","lh","none",...Q()]}],"max-h":[{"max-h":["screen","lh",...Q()]}],"font-size":[{text:["base",n,Gt,tt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Bh,Ih]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",kr,M]}],"font-family":[{font:[Fh,Mh,t]}],"font-features":[{"font-features":[M]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,F,M]}],"line-clamp":[{"line-clamp":[G,"none",F,Co]}],leading:[{leading:[o,...R()]}],"list-image":[{"list-image":["none",F,M]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",F,M]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...U(),"wavy"]}],"text-decoration-thickness":[{decoration:[G,"from-font","auto",F,tt]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[G,"auto",F,M]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"tab-size":[{tab:[Le,F,M]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",F,M]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",F,M]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:E()}],"bg-repeat":[{bg:B()}],"bg-size":[{bg:q()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Le,F,M],radial:["",F,M],conic:[Le,F,M]},$h,Dh]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:K()}],"gradient-via-pos":[{via:K()}],"gradient-to-pos":[{to:K()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:H()}],"rounded-s":[{"rounded-s":H()}],"rounded-e":[{"rounded-e":H()}],"rounded-t":[{"rounded-t":H()}],"rounded-r":[{"rounded-r":H()}],"rounded-b":[{"rounded-b":H()}],"rounded-l":[{"rounded-l":H()}],"rounded-ss":[{"rounded-ss":H()}],"rounded-se":[{"rounded-se":H()}],"rounded-ee":[{"rounded-ee":H()}],"rounded-es":[{"rounded-es":H()}],"rounded-tl":[{"rounded-tl":H()}],"rounded-tr":[{"rounded-tr":H()}],"rounded-br":[{"rounded-br":H()}],"rounded-bl":[{"rounded-bl":H()}],"border-w":[{border:z()}],"border-w-x":[{"border-x":z()}],"border-w-y":[{"border-y":z()}],"border-w-s":[{"border-s":z()}],"border-w-e":[{"border-e":z()}],"border-w-bs":[{"border-bs":z()}],"border-w-be":[{"border-be":z()}],"border-w-t":[{"border-t":z()}],"border-w-r":[{"border-r":z()}],"border-w-b":[{"border-b":z()}],"border-w-l":[{"border-l":z()}],"divide-x":[{"divide-x":z()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":z()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...U(),"hidden","none"]}],"divide-style":[{divide:[...U(),"hidden","none"]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...U(),"none","hidden"]}],"outline-offset":[{"outline-offset":[G,F,M]}],"outline-w":[{outline:["",G,Gt,tt]}],"outline-color":[{outline:I()}],shadow:[{shadow:["","none",f,wn,vn]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":["none",l,wn,vn]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[G,tt]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":z()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":["none",h,wn,vn]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[G,F,M]}],"mix-blend":[{"mix-blend":[...Z(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Z()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[G]}],"mask-image-linear-from-pos":[{"mask-linear-from":V()}],"mask-image-linear-to-pos":[{"mask-linear-to":V()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":V()}],"mask-image-t-to-pos":[{"mask-t-to":V()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":V()}],"mask-image-r-to-pos":[{"mask-r-to":V()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":V()}],"mask-image-b-to-pos":[{"mask-b-to":V()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":V()}],"mask-image-l-to-pos":[{"mask-l-to":V()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":V()}],"mask-image-x-to-pos":[{"mask-x-to":V()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":V()}],"mask-image-y-to-pos":[{"mask-y-to":V()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[F,M]}],"mask-image-radial-from-pos":[{"mask-radial-from":V()}],"mask-image-radial-to-pos":[{"mask-radial-to":V()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":N()}],"mask-image-conic-pos":[{"mask-conic":[G]}],"mask-image-conic-from-pos":[{"mask-conic-from":V()}],"mask-image-conic-to-pos":[{"mask-conic-to":V()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:E()}],"mask-repeat":[{mask:B()}],"mask-size":[{mask:q()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",F,M]}],filter:[{filter:["","none",F,M]}],blur:[{blur:ie()}],brightness:[{brightness:[G,F,M]}],contrast:[{contrast:[G,F,M]}],"drop-shadow":[{"drop-shadow":["","none",m,wn,vn]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:["",G,F,M]}],"hue-rotate":[{"hue-rotate":[G,F,M]}],invert:[{invert:["",G,F,M]}],saturate:[{saturate:[G,F,M]}],sepia:[{sepia:["",G,F,M]}],"backdrop-filter":[{"backdrop-filter":["","none",F,M]}],"backdrop-blur":[{"backdrop-blur":ie()}],"backdrop-brightness":[{"backdrop-brightness":[G,F,M]}],"backdrop-contrast":[{"backdrop-contrast":[G,F,M]}],"backdrop-grayscale":[{"backdrop-grayscale":["",G,F,M]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[G,F,M]}],"backdrop-invert":[{"backdrop-invert":["",G,F,M]}],"backdrop-opacity":[{"backdrop-opacity":[G,F,M]}],"backdrop-saturate":[{"backdrop-saturate":[G,F,M]}],"backdrop-sepia":[{"backdrop-sepia":["",G,F,M]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",F,M]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[G,"initial",F,M]}],ease:[{ease:["linear","initial",b,F,M]}],delay:[{delay:[G,F,M]}],animate:[{animate:["none",y,F,M]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[p,F,M]}],"perspective-origin":[{"perspective-origin":j()}],rotate:[{rotate:le()}],"rotate-x":[{"rotate-x":le()}],"rotate-y":[{"rotate-y":le()}],"rotate-z":[{"rotate-z":le()}],scale:[{scale:te()}],"scale-x":[{"scale-x":te()}],"scale-y":[{"scale-y":te()}],"scale-z":[{"scale-z":te()}],"scale-3d":["scale-3d"],skew:[{skew:je()}],"skew-x":[{"skew-x":je()}],"skew-y":[{"skew-y":je()}],transform:[{transform:[F,M,"","none","gpu","cpu"]}],"transform-origin":[{origin:j()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ce()}],"translate-x":[{"translate-x":Ce()}],"translate-y":[{"translate-y":Ce()}],"translate-z":[{"translate-z":Ce()}],"translate-none":["translate-none"],zoom:[{zoom:[Le,F,M]}],accent:[{accent:I()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",F,M]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":I()}],"scrollbar-track-color":[{"scrollbar-track":I()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mbs":[{"scroll-mbs":R()}],"scroll-mbe":[{"scroll-mbe":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pbs":[{"scroll-pbs":R()}],"scroll-pbe":[{"scroll-pbe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",F,M]}],fill:[{fill:["none",...I()]}],"stroke-w":[{stroke:[G,Gt,tt,Co]}],stroke:[{stroke:["none",...I()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Vh=wh(Wh);function Ft(...e){return Vh(Qf(e))}function X(e,t="USD"){return new Intl.NumberFormat("en-US",{style:"currency",currency:t,minimumFractionDigits:2}).format(e)}const ue=S.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:Ft("rounded-xl border bg-card text-card-foreground shadow",e),...t}));ue.displayName="Card";const Re=S.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:Ft("flex flex-col space-y-1.5 p-6",e),...t}));Re.displayName="CardHeader";const Pe=S.forwardRef(({className:e,...t},n)=>a.jsx("h3",{ref:n,className:Ft("font-semibold leading-none tracking-tight",e),...t}));Pe.displayName="CardTitle";const Hh=S.forwardRef(({className:e,...t},n)=>a.jsx("p",{ref:n,className:Ft("text-sm text-muted-foreground",e),...t}));Hh.displayName="CardDescription";const de=S.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:Ft("p-6 pt-0",e),...t}));de.displayName="CardContent";const qh=S.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:Ft("flex items-center p-6 pt-0",e),...t}));qh.displayName="CardFooter";function Zn({status:e,error:t}){const n=e?.action==="connect_source"||e?.state==="not_configured",r=e?.message||t||"CUR status could not be loaded. Verify the cost source, discovery job, and Athena configuration.";return a.jsx("section",{className:"rounded-md border bg-card p-6","aria-live":"polite",children:a.jsxs("div",{className:"flex items-start gap-3",children:[e?.state==="unavailable"||t?a.jsx(Be,{className:"mt-0.5 h-5 w-5 shrink-0 text-destructive"}):a.jsx(ci,{className:"mt-0.5 h-5 w-5 shrink-0 text-primary"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h2",{className:"font-semibold",children:n?"Enable AWS Cost and Usage Reports":"CUR data is not ready"}),a.jsx("p",{className:"mt-1 max-w-3xl text-sm text-muted-foreground",children:r}),a.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[a.jsxs(qn,{to:n?"/sources":"/cur-discovery",className:"inline-flex items-center gap-2 rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground",children:[a.jsx(ui,{className:"h-4 w-4"}),n?"Connect AWS source":"Review CUR discovery"]}),!n&&a.jsx(qn,{to:"/sources",className:"rounded-md border px-3 py-2 text-sm font-medium hover:bg-muted",children:"Cost sources"})]})]})]})})}const oe={getOverview:e=>ne.get("/overview",{params:e}).then(t=>t.data),getAccounts:e=>ne.get("/accounts",{params:e}).then(t=>t.data),getReports:e=>ne.get("/reports",{params:e}).then(t=>t.data),getFilterOptions:e=>ne.get("/filter-options",{params:{start:e?.start,end:e?.end,tagKey:e?.filterTagKey,managementAccountId:e?.managementAccountId}}).then(t=>t.data),getTags:e=>ne.get("/tags",{params:e}).then(t=>t.data),getDataStatus:e=>ne.get("/data-status",{params:e}).then(t=>t.data),getAnalysisStatus:e=>ne.get("/analysis/status",{params:e}).then(t=>t.data),getLatestAnalysis:e=>ne.get("/analysis/latest",{params:e}).then(t=>t.data.analysis),getAnalysisSchedule:e=>ne.get("/analysis/schedule",{params:e}).then(t=>t.data),updateAnalysisSchedule:(e,t)=>ne.put("/analysis/schedule",e,{params:t}).then(n=>n.data),getAnalysisReports:e=>ne.get("/analysis/reports",{params:e}).then(t=>t.data.reports),removeAnalysisReport:e=>ne.delete(`/analysis/reports/${e}`).then(t=>t.data),downloadAnalysisHtml:e=>ne.get(`/analysis/reports/${e}/html`,{responseType:"blob"}).then(t=>t.data),downloadAnalysisPdf:e=>ne.get(`/analysis/reports/${e}/pdf`,{responseType:"blob"}).then(t=>t.data),getSources:()=>ne.get("/sources").then(e=>e.data),createSource:e=>ne.post("/sources",e).then(t=>t.data),getSourceStatus:e=>ne.get(`/sources/${e}/status`).then(t=>t.data),verifySource:e=>ne.post(`/sources/${e}/verify`).then(t=>t.data),removeSource:e=>ne.delete(`/sources/${e}`).then(t=>t.data),downloadSourceTemplate:e=>ne.get(`/sources/${e}/template`,{responseType:"blob"}).then(t=>t.data),getCurDiscovery:e=>ne.get("/cur-discovery",{params:e}).then(t=>t.data)},Ai=P.createContext("user"),Gh=Ai.Provider,Kh=()=>P.useContext(Ai),Oi=P.createContext(null);function Yh({tenantId:e="default",children:t}){const n=`meyi-cost:selected-management-account:${e||"default"}`,[r,s]=P.useState([]),[o,i]=P.useState(""),[c,u]=P.useState(!0),d=P.useCallback(async()=>{u(!0);try{const m=((await oe.getSources()).sources||[]).filter(g=>!!g.managementAccountId);s(m),i(g=>{const x=window.localStorage.getItem(n)||""||g,b=m.find(v=>v.status==="CONNECTED")||m[0],y=m.some(v=>v.managementAccountId===x)?x:b?.managementAccountId||"";return y?window.localStorage.setItem(n,y):window.localStorage.removeItem(n),y})}catch{s([]),i("")}finally{u(!1)}},[n]);P.useEffect(()=>{d()},[d]);const f=P.useCallback(h=>{/^\d{12}$/.test(h)&&(window.localStorage.setItem(n,h),i(h))},[n]),l=P.useMemo(()=>({sources:r,managementAccountId:o,loading:c,selectManagementAccount:f,refreshSources:d}),[r,o,c,f,d]);return a.jsx(Oi.Provider,{value:l,children:t})}function Ut(){const e=P.useContext(Oi);if(!e)throw new Error("useCostAccount must be used inside CostAccountProvider");return e}function ar(){const{sources:e,managementAccountId:t,loading:n,selectManagementAccount:r}=Ut();return e.length<=1?null:a.jsxs("label",{className:"flex items-center gap-2",children:[a.jsx(ai,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("span",{className:"sr-only",children:"Management account"}),a.jsx("select",{"aria-label":"Management account",value:t,onChange:s=>r(s.target.value),disabled:n,className:"max-w-72 rounded-md border bg-background px-3 py-2 text-sm shadow-sm disabled:opacity-50",children:e.map(s=>a.jsxs("option",{value:s.managementAccountId||"",children:["Management account ",s.managementAccountId]},s.connectionId))})]})}function Jh({points:e,currency:t="USD"}){const[n,r]=P.useState(null);if(!e.length)return a.jsx("p",{className:"py-20 text-center text-sm text-muted-foreground",children:"No trend data for this period."});const s=900,o=260,i=70,c=24,u=22,d=48,f=s-i-c,l=o-u-d,h=Math.max(...e.map(x=>x.value),1),m=e.map((x,b)=>({...x,x:i+(e.length===1?f/2:b*f/(e.length-1)),y:u+l-x.value/h*l})),g=n==null?null:m[n],p=x=>{const b=x.currentTarget.getBoundingClientRect(),y=(x.clientX-b.left)/b.width*s;let v=0;for(let N=1;N<m.length;N+=1)Math.abs(m[N].x-y)<Math.abs(m[v].x-y)&&(v=N);r(v)};return a.jsxs("div",{className:"relative w-full",children:[a.jsxs("svg",{viewBox:`0 0 ${s} ${o}`,className:"h-72 w-full",onMouseMove:p,onMouseLeave:()=>r(null),role:"img","aria-label":"Cost trend line chart",children:[[0,.25,.5,.75,1].map(x=>{const b=u+l*x;return a.jsxs("g",{children:[a.jsx("line",{x1:i,y1:b,x2:s-c,y2:b,stroke:"#d8e0e7",strokeDasharray:"4 4"}),a.jsx("text",{x:i-10,y:b+4,textAnchor:"end",fill:"currentColor",className:"text-[10px] text-muted-foreground",children:X(h*(1-x),t)})]},x)}),a.jsx("line",{x1:i,y1:u+l,x2:s-c,y2:u+l,stroke:"#aebbc5"}),a.jsx("polyline",{points:m.map(x=>`${x.x},${x.y}`).join(" "),fill:"none",stroke:"#1f5f85",strokeWidth:"4",strokeLinejoin:"round",strokeLinecap:"round"}),g&&a.jsx("line",{x1:g.x,y1:u,x2:g.x,y2:u+l,stroke:"#1f5f85",strokeDasharray:"3 4",opacity:"0.45"}),m.map((x,b)=>a.jsxs("g",{children:[a.jsx("circle",{cx:x.x,cy:x.y,r:n===b?7:5,fill:"#1f5f85",stroke:"white",strokeWidth:"2"}),a.jsx("text",{x:x.x,y:o-17,textAnchor:"middle",fill:"currentColor",className:"text-[11px] text-muted-foreground",children:x.label})]},x.key))]}),g&&a.jsxs("div",{className:"pointer-events-none absolute z-20 min-w-44 rounded-lg border bg-popover p-3 text-popover-foreground shadow-xl",style:{left:`${g.x/s*100}%`,top:`${Math.max(g.y/o*100-4,2)}%`,transform:g.x>s*.75?"translate(-100%, -100%)":"translate(-50%, -100%)"},children:[a.jsx("p",{className:"text-xs font-semibold",children:g.label}),a.jsx("p",{className:"mt-1 text-sm font-bold text-primary",children:X(g.value,t)}),g.details?.slice(0,5).map(x=>a.jsxs("div",{className:"mt-1 flex justify-between gap-4 text-xs",children:[a.jsx("span",{className:"max-w-40 truncate text-muted-foreground",children:x.label}),a.jsx("span",{children:X(x.value,t)})]},x.label))]})]})}const ko=e=>e.length>16?`${e.slice(0,14)}...`:e,Xh=(e,t)=>new Intl.NumberFormat("en-US",{style:"currency",currency:t||"USD",notation:"compact",maximumFractionDigits:1}).format(e);function Zh({title:e,items:t,currency:n}){const o={top:38,right:18,bottom:72,left:76},i=720-o.left-o.right,c=320-o.top-o.bottom,u=Math.max(...t.map(l=>l.amount),1),d=i/t.length,f=Math.min(56,d*.58);return a.jsxs("svg",{viewBox:"0 0 720 320",className:"h-80 w-full",role:"img","aria-label":`${e} cost bar chart`,children:[[0,.25,.5,.75,1].map(l=>{const h=o.top+c-l*c;return a.jsxs("g",{children:[a.jsx("line",{x1:o.left,y1:h,x2:720-o.right,y2:h,stroke:"currentColor",opacity:l===0?.3:.12,vectorEffect:"non-scaling-stroke"}),a.jsx("text",{x:o.left-12,y:h+4,textAnchor:"end",fill:"currentColor",opacity:"0.7",fontSize:"11",children:Xh(u*l,n)})]},l)}),a.jsx("line",{x1:o.left,y1:o.top,x2:o.left,y2:o.top+c,stroke:"currentColor",opacity:"0.3",vectorEffect:"non-scaling-stroke"}),t.map((l,h)=>{const m=o.left+d*h+d/2,g=Math.max(l.amount/u*c,3),p=o.top+c-g;return a.jsxs("g",{tabIndex:0,"aria-label":`${l.label}: ${X(l.amount,n)}`,className:"outline-none focus-visible:opacity-75",children:[a.jsxs("title",{children:[l.label,": ",X(l.amount,n)]}),a.jsx("rect",{x:m-f/2,y:p,width:f,height:g,rx:"4",className:"fill-primary opacity-80 transition-opacity hover:opacity-100"}),a.jsx("text",{x:m,y:Math.max(p-8,16),textAnchor:"middle",fill:"currentColor",fontSize:"11",fontWeight:"600",children:X(l.amount,n)}),a.jsx("text",{x:m,y:278,textAnchor:"middle",fill:"currentColor",opacity:"0.72",fontSize:"11",children:ko(l.label)}),l.accountId&&a.jsx("text",{x:m,y:295,textAnchor:"middle",fill:"currentColor",opacity:"0.55",fontSize:"9",children:ko(l.accountId)})]},l.key||l.label)}),a.jsxs("text",{x:"18",y:o.top+c/2,transform:`rotate(-90 18 ${o.top+c/2})`,textAnchor:"middle",fill:"currentColor",opacity:"0.65",fontSize:"11",children:["Cost (",n,")"]})]})}const Ti="min-h-32 transition-all duration-200 ease-out hover:-translate-y-1 hover:scale-[1.01] hover:border-primary/30 hover:shadow-lg";function _r({title:e,icon:t,items:n,currency:r}){const[s,o]=P.useState("chart"),i=n.slice(0,6),c=Math.max(...i.map(u=>u.amount),1);return a.jsxs(ue,{className:"min-w-0",children:[a.jsxs(Re,{className:"flex flex-row items-center justify-between gap-3 pb-3",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("span",{className:"text-primary",children:t}),a.jsx(Pe,{className:"truncate text-sm",children:e})]}),a.jsxs("div",{className:"flex rounded-md border p-0.5","aria-label":`${e} view`,children:[a.jsx("button",{type:"button",onClick:()=>o("chart"),"aria-label":`Show ${e} as bar chart`,"aria-pressed":s==="chart",title:"Bar chart",className:`rounded p-1.5 ${s==="chart"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"}`,children:a.jsx(gf,{className:"h-4 w-4"})}),a.jsx("button",{type:"button",onClick:()=>o("list"),"aria-label":`Show ${e} as list`,"aria-pressed":s==="list",title:"List",className:`rounded p-1.5 ${s==="list"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"}`,children:a.jsx(Df,{className:"h-4 w-4"})})]})]}),a.jsx(de,{children:i.length?s==="chart"?a.jsx(Zh,{title:e,items:i,currency:r}):a.jsx("div",{className:"space-y-3",children:i.map(u=>a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3 text-sm",children:[a.jsxs("span",{className:"truncate text-muted-foreground",title:u.label,children:[u.label,u.accountId?a.jsxs("span",{className:"ml-1 text-xs",children:["(",u.accountId,")"]}):null]}),a.jsx("span",{className:"shrink-0 font-medium",children:X(u.amount,r)})]}),a.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:a.jsx("div",{className:"h-full rounded-full bg-primary/75",style:{width:`${u.amount/c*100}%`}})})]},u.key||u.label))}):a.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No cost data for this period."})})]})}function Qh(){return a.jsxs("div",{"aria-live":"polite","aria-busy":"true",className:"contents",children:[a.jsx("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(min(100%,240px),1fr))] gap-4",children:Array.from({length:4},(e,t)=>a.jsxs(ue,{className:Ti,children:[a.jsx(Re,{className:"pb-2",children:a.jsx("div",{className:"h-3 w-24 animate-pulse rounded bg-muted"})}),a.jsxs(de,{children:[a.jsx("div",{className:"h-6 w-3/4 animate-pulse rounded bg-muted"}),a.jsx("div",{className:"mt-3 h-3 w-1/2 animate-pulse rounded bg-muted/80"})]})]},t))}),a.jsxs(ue,{children:[a.jsx(Re,{children:a.jsx("div",{className:"h-4 w-36 animate-pulse rounded bg-muted"})}),a.jsx(de,{children:a.jsx("div",{className:"h-72 animate-pulse rounded-lg bg-muted/70"})})]}),a.jsx("div",{className:"grid gap-4 lg:grid-cols-2",children:Array.from({length:3},(e,t)=>a.jsxs(ue,{children:[a.jsx(Re,{children:a.jsx("div",{className:"h-4 w-32 animate-pulse rounded bg-muted"})}),a.jsx(de,{className:"space-y-4",children:Array.from({length:5},(n,r)=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between",children:[a.jsx("div",{className:"h-3 w-2/5 animate-pulse rounded bg-muted"}),a.jsx("div",{className:"h-3 w-20 animate-pulse rounded bg-muted"})]}),a.jsx("div",{className:"mt-2 h-1.5 animate-pulse rounded bg-muted/80"})]},r))})]},t))})]})}function em({data:e,period:t,selectedMonth:n}){const r=e.topServices[0],s=e.topAccounts[0],o=new Date,[i,c]=n.split("-").map(Number),u=t==="monthly"?new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric"}).format(new Date(i,c-1,1)):String(o.getFullYear()),d=[{label:"Total cost",value:a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"block",children:X(e.totalCost,e.currency)}),a.jsxs("span",{className:"mt-1 block text-sm font-medium text-muted-foreground",children:["Accounts: ",e.activeAccounts]})]}),helper:u,icon:a.jsx(li,{})},{label:"Active resources",value:e.activeResources==null?a.jsx("span",{className:"text-sm",title:e.activeResourcesMessage,children:"CUR access required"}):Number(e.activeResources).toLocaleString(),helper:`${u} across all accounts`,icon:a.jsx(Jn,{})},{label:"Highest cost service",value:r?a.jsx("span",{className:"whitespace-pre-line text-sm",children:`Service - ${r.label}
15
15
  Cost - ${X(r.amount,e.currency)}`}):"-",helper:u,icon:a.jsx(fi,{})},{label:"Highest cost account",value:s?a.jsx("span",{className:"whitespace-pre-line text-sm",children:`Account Name - ${s.label}
16
16
  Account Id - ${s.accountId||s.key||"Unknown"}
17
- Cost - ${X(s.amount,e.currency)}`}):"-",helper:u,icon:a.jsx(Jn,{})}];return a.jsx("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(min(100%,240px),1fr))] gap-4",children:d.map(f=>a.jsxs(ue,{className:Ti,children:[a.jsxs(Re,{className:"flex flex-row items-center justify-between pb-2",children:[a.jsx(Pe,{className:"text-xs font-medium text-muted-foreground",children:f.label}),a.jsx("span",{className:"text-muted-foreground [&>svg]:h-4 [&>svg]:w-4",children:f.icon})]}),a.jsxs(de,{children:[a.jsx("div",{className:"break-words text-base font-semibold leading-snug xl:text-lg",children:f.value}),a.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:f.helper})]})]},f.label))})}function tm(){const e=new Date,t=`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}`,[n,r]=P.useState(null),[s,o]=P.useState(!0),[i,c]=P.useState(null),[u,d]=P.useState(null),[f,l]=P.useState("monthly"),[h,m]=P.useState(t),{managementAccountId:g,loading:p}=$t(),x=P.useRef(0),b=Array.from({length:e.getMonth()+1},(j,k)=>({value:`${e.getFullYear()}-${String(k+1).padStart(2,"0")}`,label:new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric"}).format(new Date(e.getFullYear(),k,1))})),y=async(j=f,k=h,C=g)=>{const R=++x.current;o(!0),r(null),c(null);try{let _;if(j==="yearly")_={period:j,start:`${e.getFullYear()}-01-01`};else{const[O,$]=k.split("-").map(Number),J=k===t?e.getDate():new Date(O,$,0).getDate();_={period:j,start:`${k}-01`,end:`${k}-${String(J).padStart(2,"0")}`}}const L=C?{managementAccountId:C}:void 0,A=await oe.getDataStatus(L);if(R===x.current&&d(A),!A.ready)return;const D=await oe.getOverview({..._,...L});R===x.current&&r(D)}catch(_){R===x.current&&c(_?.response?.data?.error||_.message||"Failed to load AWS costs")}finally{R===x.current&&o(!1)}};return P.useEffect(()=>{p||y(f,h,g)},[f,h,g,p]),{data:n,dataStatus:u,loading:s||p,error:i,period:f,selectedMonth:h,monthOptions:b,changePeriod:j=>{j!==f&&(o(!0),r(null),l(j))},changeMonth:j=>{j===h||!b.some(k=>k.value===j)||(o(!0),r(null),m(j))},refresh:()=>y(f,h,g)}}function nm(){const{data:e,dataStatus:t,loading:n,error:r,period:s,selectedMonth:o,monthOptions:i,changePeriod:c,changeMonth:u,refresh:d}=tm();return a.jsxs("div",{className:"flex w-full flex-col gap-6 p-2 md:p-6",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold",children:[a.jsx(li,{className:"h-6 w-6 text-primary"}),"Cloud Cost Management"]}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Costs for the selected AWS management account and its member accounts"})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(ar,{}),s==="monthly"&&a.jsx("select",{"aria-label":"Cost month",value:o,onChange:f=>u(f.target.value),disabled:n,className:"rounded-lg border bg-background px-3 py-2 text-sm shadow-sm disabled:opacity-50",children:i.map(f=>a.jsx("option",{value:f.value,children:f.label},f.value))}),a.jsx("div",{className:"flex rounded-lg border p-1",children:["monthly","yearly"].map(f=>a.jsx("button",{onClick:()=>c(f),className:`rounded-md px-3 py-1.5 text-sm capitalize transition-colors ${s===f?"bg-primary text-primary-foreground":"hover:bg-muted"}`,children:f},f))}),a.jsx("button",{onClick:()=>{d()},disabled:n,className:"rounded-lg border p-2 hover:bg-muted",children:a.jsx(Lt,{className:`h-4 w-4 ${n?"animate-spin":""}`})})]})]}),r&&e&&a.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:[a.jsx(ze,{className:"h-4 w-4"}),r]}),n?a.jsx(Qh,{}):t&&!t.ready?a.jsx(Zn,{status:t}):r&&!e?a.jsx(Zn,{status:t,error:r}):e?a.jsxs(a.Fragment,{children:[e.dataSource&&a.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground",children:[a.jsx("span",{children:"Source: AWS CUR via SaaS Athena - gross positive unblended charges"}),a.jsxs("span",{children:["CUR: Ready",t?.lastDataAt?`, updated ${new Date(t.lastDataAt).toLocaleString()}`:""]})]}),a.jsx(em,{data:e,period:s,selectedMonth:o}),e.message&&!/historical data beyond 14 months/i.test(e.message)&&a.jsx(ue,{children:a.jsx(de,{className:"py-8 text-center text-sm text-muted-foreground",children:e.message})}),a.jsxs(ue,{children:[a.jsxs(Re,{className:"flex flex-row items-center gap-2",children:[a.jsx(pi,{className:"h-4 w-4 text-primary"}),a.jsxs(Pe,{className:"text-sm",children:["Cost Trend - ",s==="monthly"?"Monthly":"Yearly"]})]}),a.jsx(de,{children:a.jsx(Jh,{points:e.trends.map(f=>({key:f.month,label:s==="yearly"?f.month.slice(0,4):new Date(`${f.month}T00:00:00Z`).toLocaleDateString(void 0,{month:"short",year:"2-digit"}),value:f.amount})),currency:e.currency})})]}),a.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[a.jsx(_r,{title:"Top services",icon:a.jsx(fi,{className:"h-4 w-4"}),items:e.topServices,currency:e.currency}),a.jsx(_r,{title:"AWS accounts",icon:a.jsx(ai,{className:"h-4 w-4"}),items:e.topAccounts,currency:e.currency}),a.jsx(_r,{title:"Regional distribution",icon:a.jsx($f,{className:"h-4 w-4"}),items:e.topRegions,currency:e.currency})]})]}):null]})}const Sn=["#6264e9","#eb67ad","#31c39a","#f29a05","#579bea","#9078ed","#f7842c","#24b9ad","#8ac926","#ffca3a","#6a4c93","#1982c4"];function _o(e,t){const n=new Date(e.length===10?`${e}T00:00:00Z`:e);return Number.isFinite(n.getTime())?n.toLocaleDateString(void 0,t?{month:"short",day:"numeric"}:{month:"short",year:"numeric"}):e}function rm({timeline:e,currency:t="USD",daily:n=!1}){const[r,s]=P.useState(null),[o,i]=P.useState(null),c=P.useMemo(()=>{const g=new Map;for(const p of e)for(const x of p.groups)g.set(x.label,(g.get(x.label)||0)+x.amount);return[...g.entries()].sort((p,x)=>x[1]-p[1]).map(([p],x)=>({label:p,color:Sn[x%Sn.length]}))},[e]),u=new Map(c.map(g=>[g.label,g.color])),d=Math.max(...e.map(g=>g.total),1),f=r??o,l=f==null?null:e[f],h=n?52:80,m=Math.max(520,e.length*h);return e.length?a.jsxs("div",{className:"grid min-w-0 gap-4 lg:grid-cols-[minmax(0,1fr)_288px]",onMouseLeave:()=>s(null),children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"grid min-h-80 min-w-0 grid-cols-[72px_minmax(0,1fr)] gap-3",children:[a.jsx("div",{className:"flex h-64 flex-col justify-between pb-1 text-right text-[11px] text-muted-foreground",children:[1,.75,.5,.25,0].map(g=>a.jsx("span",{children:X(d*g,t)},g))}),a.jsx("div",{className:"min-w-0 overflow-x-auto pb-2",children:a.jsxs("div",{style:{width:m},children:[a.jsxs("div",{className:"relative flex h-64 items-end border-b px-4",children:[[0,25,50,75].map(g=>a.jsx("span",{className:"pointer-events-none absolute left-0 right-0 border-t border-dashed border-slate-200",style:{top:`${g}%`}},g)),e.map((g,p)=>a.jsx("button",{type:"button",onMouseEnter:()=>s(p),onMouseLeave:()=>s(null),onPointerDown:x=>x.preventDefault(),onFocus:()=>i(p),onBlur:()=>i(null),className:"group z-10 flex h-full shrink-0 items-end justify-center px-2 outline-none focus-visible:ring-2 focus-visible:ring-primary",style:{width:h},children:a.jsx("span",{className:"flex w-full max-w-16 flex-col-reverse overflow-hidden rounded-t-sm shadow-sm transition group-hover:brightness-95",style:{height:`${Math.max(g.total/d*100,1)}%`},children:g.groups.map(x=>a.jsx("span",{style:{backgroundColor:u.get(x.label)||Sn[0],height:`${g.total?x.amount/g.total*100:0}%`}},x.key||x.label))})},`${g.start}-${p}`))]}),a.jsx("div",{className:"flex px-4 pt-2",children:e.map((g,p)=>a.jsx("span",{className:"shrink-0 whitespace-nowrap text-center text-[11px] text-muted-foreground",style:{width:h},children:_o(g.start,n)},`${g.start}-label-${p}`))})]})})]}),a.jsxs("div",{className:"mt-5 flex min-w-0 flex-wrap gap-x-4 gap-y-2",children:[c.slice(0,8).map(g=>a.jsxs("span",{className:"flex max-w-full min-w-0 items-center gap-1.5 text-xs",children:[a.jsx("span",{className:"h-2.5 w-2.5 shrink-0 rounded-full",style:{backgroundColor:g.color}}),a.jsx("span",{className:"min-w-0 truncate",title:g.label,children:g.label})]},g.label)),c.length>8&&a.jsxs("span",{className:"text-xs text-muted-foreground",children:["+",c.length-8," more"]})]})]}),a.jsx("aside",{"aria-live":"polite",className:"min-h-44",children:l?a.jsxs("div",{role:"tooltip",className:"rounded-2xl border bg-popover p-4 text-popover-foreground shadow-lg",children:[a.jsx("p",{className:"font-semibold",children:_o(l.start,n)}),a.jsxs("div",{className:"mt-3 space-y-2",children:[[...l.groups].sort((g,p)=>p.amount-g.amount).slice(0,5).map(g=>a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx("span",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:u.get(g.label)||Sn[0]}}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:g.label}),a.jsx("strong",{children:X(g.amount,t)})]},g.key||g.label)),l.groups.length>5&&a.jsxs("p",{className:"text-xs italic text-muted-foreground",children:["+ ",l.groups.length-5," others"]})]}),a.jsxs("div",{className:"mt-3 flex justify-between border-t pt-3 text-sm",children:[a.jsx("strong",{children:"Total"}),a.jsx("strong",{className:"text-primary",children:X(l.total,t)})]})]}):a.jsx("div",{className:"flex min-h-44 items-center justify-center rounded-2xl border border-dashed p-4 text-center text-xs text-muted-foreground",children:"Hover over a bar to view its cost details."})})]}):a.jsx("p",{className:"py-24 text-center text-sm text-muted-foreground",children:"No trend data for this period."})}function sm({rows:e,currency:t}){const n=e.slice(0,8),r=Math.max(1,...n.flatMap(s=>[s.current?.amount||0,s.previous?.amount||0]));return a.jsxs(ue,{className:"bg-primary/5",children:[a.jsx(Re,{children:a.jsx(Pe,{className:"text-sm",children:"Comparison Overview"})}),a.jsx(de,{children:a.jsxs("div",{className:"rounded-xl border bg-card p-5",children:[a.jsx("div",{className:"flex h-72 items-end gap-4 border-b border-l px-4 pt-4",children:n.map(s=>a.jsxs("div",{className:"flex min-w-0 flex-1 flex-col items-center",children:[a.jsxs("div",{className:"flex h-56 w-full items-end justify-center gap-1",children:[a.jsx("div",{title:`Current: ${X(s.current?.amount||0,t)}`,className:"w-1/3 max-w-10 rounded-t bg-indigo-500",style:{height:`${Math.max((s.current?.amount||0)/r*100,s.current?.amount?1:0)}%`}}),a.jsx("div",{title:`Previous: ${X(s.previous?.amount||0,t)}`,className:"w-1/3 max-w-10 rounded-t bg-pink-400",style:{height:`${Math.max((s.previous?.amount||0)/r*100,s.previous?.amount?1:0)}%`}})]}),a.jsx("span",{title:s.label,className:"mt-2 w-full truncate text-center text-[10px] text-muted-foreground",children:s.label})]},s.key))}),a.jsxs("div",{className:"mt-4 flex gap-5 text-xs",children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("i",{className:"h-2.5 w-2.5 rounded-full bg-indigo-500"}),"Current Period"]}),a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("i",{className:"h-2.5 w-2.5 rounded-full bg-pink-400"}),"Previous Period"]})]})]})})]})}function Me({label:e,value:t,helper:n,accent:r=!1,trend:s}){return a.jsxs("div",{className:"rounded-xl border bg-card p-5 shadow-sm",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[s!=null&&(s<0?a.jsx(Jf,{className:"h-4 w-4 text-red-500"}):a.jsx(pi,{className:"h-4 w-4 text-emerald-500"})),a.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:e})]}),a.jsx("p",{className:`mt-2 text-2xl font-bold ${r?"text-primary":s!=null&&s<0?"text-red-500":""}`,children:t}),n&&a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:n})]})}function Rn({label:e,options:t,selected:n,onChange:r}){const s=n.length?`${n.length} selected`:e;return a.jsxs("details",{className:"group relative",children:[a.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between rounded-lg border bg-background px-3 py-3 text-sm text-primary",children:[a.jsx("span",{children:s}),a.jsx(bf,{className:"h-4 w-4 transition-transform group-open:rotate-180"})]}),a.jsx("div",{className:"absolute z-30 mt-1 max-h-64 w-full overflow-auto rounded-lg border bg-popover p-2 shadow-xl",children:t.length?t.map(o=>a.jsxs("label",{className:"flex cursor-pointer items-start gap-2 rounded px-2 py-2 text-xs hover:bg-muted",children:[a.jsx("input",{type:"checkbox",checked:n.includes(o.value),onChange:i=>r(i.target.checked?[...n,o.value]:n.filter(c=>c!==o.value))}),a.jsx("span",{className:"min-w-0 break-words",children:o.label})]},o.value)):a.jsx("p",{className:"p-2 text-xs text-muted-foreground",children:"No values available."})})]})}function om(){return a.jsxs("div",{"aria-live":"polite","aria-busy":"true",className:"space-y-5",children:[a.jsxs("section",{className:"rounded-xl bg-primary/5 p-5",children:[a.jsxs("div",{className:"flex items-center gap-3 text-sm font-medium text-primary",children:[a.jsx(ct,{className:"h-5 w-5 animate-spin"}),"Loading live AWS cost report..."]}),a.jsx("div",{className:"mt-5 grid gap-3 sm:grid-cols-3",children:[1,2,3].map(e=>a.jsx("div",{className:"h-28 animate-pulse rounded-xl border bg-card/70"},e))})]}),a.jsx("div",{className:"h-80 animate-pulse rounded-xl border bg-muted/40"}),a.jsx("div",{className:"h-64 animate-pulse rounded-xl border bg-muted/40"})]})}const Xe=10,Jr=new Date,Li=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,am=Li(new Date(Jr.getFullYear(),Jr.getMonth()-2,1)),im=Li(Jr),Yt={services:[],regions:[],accountIds:[],tagKey:"",tagValues:[]},mt={service:{tab:"Services",title:"Service Cost Summary",pdfTitle:"Service Cost Report",top:"Top service cost",count:"Service count",item:"Service",empty:"No service cost data found."},account:{tab:"Accounts",title:"Account Cost Summary",pdfTitle:"Account Cost Report",top:"Top account cost",count:"Account count",item:"Linked account",empty:"No linked account cost data found."},region:{tab:"Regions",title:"Regional Cost Summary",pdfTitle:"Region Cost Report",top:"Top region cost",count:"Region count",item:"Region",empty:"No regional cost data found."},resource:{tab:"Resources",title:"Resource Cost Summary",pdfTitle:"Resource Cost Report",top:"Top resource cost",count:"Resource count",item:"Resource",empty:"Resource-level cost data requires resource IDs in the CUR export."},tag:{tab:"Tags",title:"Tag Cost Summary",pdfTitle:"Tag Cost Report",top:"Top tag value cost",count:"Tag value count",item:"Tag value",empty:"No cost allocation tag data found."}};function Po(e){return e?new Intl.DateTimeFormat("en-US",{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"longOffset"}).format(new Date(e)).replace("GMT","UTC"):"Not updated yet"}function Ao(e,t){const n=new Date(`${e}T00:00:00Z`);if(t==="monthly"){const s=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),1)),o=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()+1,0)),i=new Date(s);i.setUTCDate(i.getUTCDate()-1);const c=new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),1));return{currentStart:s.toISOString().slice(0,10),currentEnd:o.toISOString().slice(0,10),previousStart:c.toISOString().slice(0,10),previousEnd:i.toISOString().slice(0,10)}}const r=new Date(n);return r.setUTCDate(r.getUTCDate()-1),{currentStart:e,currentEnd:e,previousStart:r.toISOString().slice(0,10),previousEnd:r.toISOString().slice(0,10)}}function It(e,t,n){const r=new Date(`${e}T00:00:00Z`),s=new Date(`${t}T00:00:00Z`);if(n==="monthly"&&r.getUTCFullYear()===s.getUTCFullYear()&&r.getUTCMonth()===s.getUTCMonth())return new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric",timeZone:"UTC"}).format(r);const o=new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"});return`${o.format(r)} – ${o.format(s)}`}function cm(e){const t=new Map;return e.current.summary.forEach(n=>t.set(n.key||n.label,{current:n})),e.previous.summary.forEach(n=>{const r=n.key||n.label;t.set(r,{...t.get(r),previous:n})}),[...t.entries()].map(([n,r])=>{const s=r.current?.amount||0,o=r.previous?.amount||0,i=s-o;return{key:n,label:r.current?.label||r.previous?.label||n,...r,difference:i,change:o?i/Math.abs(o)*100:0}}).sort((n,r)=>Math.max(r.current?.amount||0,r.previous?.amount||0)-Math.max(n.current?.amount||0,n.previous?.amount||0))}function rt(e){return e?.length?e.map(t=>`${t.label}
17
+ Cost - ${X(s.amount,e.currency)}`}):"-",helper:u,icon:a.jsx(Jn,{})}];return a.jsx("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(min(100%,240px),1fr))] gap-4",children:d.map(f=>a.jsxs(ue,{className:Ti,children:[a.jsxs(Re,{className:"flex flex-row items-center justify-between pb-2",children:[a.jsx(Pe,{className:"text-xs font-medium text-muted-foreground",children:f.label}),a.jsx("span",{className:"text-muted-foreground [&>svg]:h-4 [&>svg]:w-4",children:f.icon})]}),a.jsxs(de,{children:[a.jsx("div",{className:"break-words text-base font-semibold leading-snug xl:text-lg",children:f.value}),a.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:f.helper})]})]},f.label))})}function tm(){const e=new Date,t=`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}`,[n,r]=P.useState(null),[s,o]=P.useState(!0),[i,c]=P.useState(null),[u,d]=P.useState(null),[f,l]=P.useState("monthly"),[h,m]=P.useState(t),{managementAccountId:g,loading:p}=Ut(),x=P.useRef(0),b=Array.from({length:e.getMonth()+1},(j,k)=>({value:`${e.getFullYear()}-${String(k+1).padStart(2,"0")}`,label:new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric"}).format(new Date(e.getFullYear(),k,1))})),y=async(j=f,k=h,C=g)=>{const R=++x.current;o(!0),r(null),c(null);try{let _;if(j==="yearly")_={period:j,start:`${e.getFullYear()}-01-01`};else{const[O,$]=k.split("-").map(Number),J=k===t?e.getDate():new Date(O,$,0).getDate();_={period:j,start:`${k}-01`,end:`${k}-${String(J).padStart(2,"0")}`}}const L=C?{managementAccountId:C}:void 0,A=await oe.getDataStatus(L);if(R===x.current&&d(A),!A.ready)return;const D=await oe.getOverview({..._,...L});R===x.current&&r(D)}catch(_){R===x.current&&c(_?.response?.data?.error||_.message||"Failed to load AWS costs")}finally{R===x.current&&o(!1)}};return P.useEffect(()=>{p||y(f,h,g)},[f,h,g,p]),{data:n,dataStatus:u,loading:s||p,error:i,period:f,selectedMonth:h,monthOptions:b,changePeriod:j=>{j!==f&&(o(!0),r(null),l(j))},changeMonth:j=>{j===h||!b.some(k=>k.value===j)||(o(!0),r(null),m(j))},refresh:()=>y(f,h,g)}}function nm(){const{data:e,dataStatus:t,loading:n,error:r,period:s,selectedMonth:o,monthOptions:i,changePeriod:c,changeMonth:u,refresh:d}=tm();return a.jsxs("div",{className:"flex w-full flex-col gap-6 p-2 md:p-6",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold",children:[a.jsx(li,{className:"h-6 w-6 text-primary"}),"Cloud Cost Management"]}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Costs for the selected AWS management account and its member accounts"})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(ar,{}),s==="monthly"&&a.jsx("select",{"aria-label":"Cost month",value:o,onChange:f=>u(f.target.value),disabled:n,className:"rounded-lg border bg-background px-3 py-2 text-sm shadow-sm disabled:opacity-50",children:i.map(f=>a.jsx("option",{value:f.value,children:f.label},f.value))}),a.jsx("div",{className:"flex rounded-lg border p-1",children:["monthly","yearly"].map(f=>a.jsx("button",{onClick:()=>c(f),className:`rounded-md px-3 py-1.5 text-sm capitalize transition-colors ${s===f?"bg-primary text-primary-foreground":"hover:bg-muted"}`,children:f},f))}),a.jsx("button",{onClick:()=>{d()},disabled:n,className:"rounded-lg border p-2 hover:bg-muted",children:a.jsx(Tt,{className:`h-4 w-4 ${n?"animate-spin":""}`})})]})]}),r&&e&&a.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:[a.jsx(Be,{className:"h-4 w-4"}),r]}),n?a.jsx(Qh,{}):t&&!t.ready?a.jsx(Zn,{status:t}):r&&!e?a.jsx(Zn,{status:t,error:r}):e?a.jsxs(a.Fragment,{children:[e.dataSource&&a.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground",children:[a.jsx("span",{children:"Source: AWS CUR via SaaS Athena - gross positive unblended charges"}),a.jsxs("span",{children:["CUR: Ready",t?.lastDataAt?`, updated ${new Date(t.lastDataAt).toLocaleString()}`:""]})]}),a.jsx(em,{data:e,period:s,selectedMonth:o}),e.message&&!/historical data beyond 14 months/i.test(e.message)&&a.jsx(ue,{children:a.jsx(de,{className:"py-8 text-center text-sm text-muted-foreground",children:e.message})}),a.jsxs(ue,{children:[a.jsxs(Re,{className:"flex flex-row items-center gap-2",children:[a.jsx(pi,{className:"h-4 w-4 text-primary"}),a.jsxs(Pe,{className:"text-sm",children:["Cost Trend - ",s==="monthly"?"Monthly":"Yearly"]})]}),a.jsx(de,{children:a.jsx(Jh,{points:e.trends.map(f=>({key:f.month,label:s==="yearly"?f.month.slice(0,4):new Date(`${f.month}T00:00:00Z`).toLocaleDateString(void 0,{month:"short",year:"2-digit"}),value:f.amount})),currency:e.currency})})]}),a.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[a.jsx(_r,{title:"Top services",icon:a.jsx(fi,{className:"h-4 w-4"}),items:e.topServices,currency:e.currency}),a.jsx(_r,{title:"AWS accounts",icon:a.jsx(ai,{className:"h-4 w-4"}),items:e.topAccounts,currency:e.currency}),a.jsx(_r,{title:"Regional distribution",icon:a.jsx($f,{className:"h-4 w-4"}),items:e.topRegions,currency:e.currency})]})]}):null]})}const Sn=["#6264e9","#eb67ad","#31c39a","#f29a05","#579bea","#9078ed","#f7842c","#24b9ad","#8ac926","#ffca3a","#6a4c93","#1982c4"];function _o(e,t){const n=new Date(e.length===10?`${e}T00:00:00Z`:e);return Number.isFinite(n.getTime())?n.toLocaleDateString(void 0,t?{month:"short",day:"numeric"}:{month:"short",year:"numeric"}):e}function rm({timeline:e,currency:t="USD",daily:n=!1}){const[r,s]=P.useState(null),[o,i]=P.useState(null),c=P.useMemo(()=>{const g=new Map;for(const p of e)for(const x of p.groups)g.set(x.label,(g.get(x.label)||0)+x.amount);return[...g.entries()].sort((p,x)=>x[1]-p[1]).map(([p],x)=>({label:p,color:Sn[x%Sn.length]}))},[e]),u=new Map(c.map(g=>[g.label,g.color])),d=Math.max(...e.map(g=>g.total),1),f=r??o,l=f==null?null:e[f],h=n?52:80,m=Math.max(520,e.length*h);return e.length?a.jsxs("div",{className:"grid min-w-0 gap-4 lg:grid-cols-[minmax(0,1fr)_288px]",onMouseLeave:()=>s(null),children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"grid min-h-80 min-w-0 grid-cols-[72px_minmax(0,1fr)] gap-3",children:[a.jsx("div",{className:"flex h-64 flex-col justify-between pb-1 text-right text-[11px] text-muted-foreground",children:[1,.75,.5,.25,0].map(g=>a.jsx("span",{children:X(d*g,t)},g))}),a.jsx("div",{className:"min-w-0 overflow-x-auto pb-2",children:a.jsxs("div",{style:{width:m},children:[a.jsxs("div",{className:"relative flex h-64 items-end border-b px-4",children:[[0,25,50,75].map(g=>a.jsx("span",{className:"pointer-events-none absolute left-0 right-0 border-t border-dashed border-slate-200",style:{top:`${g}%`}},g)),e.map((g,p)=>a.jsx("button",{type:"button",onMouseEnter:()=>s(p),onMouseLeave:()=>s(null),onPointerDown:x=>x.preventDefault(),onFocus:()=>i(p),onBlur:()=>i(null),className:"group z-10 flex h-full shrink-0 items-end justify-center px-2 outline-none focus-visible:ring-2 focus-visible:ring-primary",style:{width:h},children:a.jsx("span",{className:"flex w-full max-w-16 flex-col-reverse overflow-hidden rounded-t-sm shadow-sm transition group-hover:brightness-95",style:{height:`${Math.max(g.total/d*100,1)}%`},children:g.groups.map(x=>a.jsx("span",{style:{backgroundColor:u.get(x.label)||Sn[0],height:`${g.total?x.amount/g.total*100:0}%`}},x.key||x.label))})},`${g.start}-${p}`))]}),a.jsx("div",{className:"flex px-4 pt-2",children:e.map((g,p)=>a.jsx("span",{className:"shrink-0 whitespace-nowrap text-center text-[11px] text-muted-foreground",style:{width:h},children:_o(g.start,n)},`${g.start}-label-${p}`))})]})})]}),a.jsxs("div",{className:"mt-5 flex min-w-0 flex-wrap gap-x-4 gap-y-2",children:[c.slice(0,8).map(g=>a.jsxs("span",{className:"flex max-w-full min-w-0 items-center gap-1.5 text-xs",children:[a.jsx("span",{className:"h-2.5 w-2.5 shrink-0 rounded-full",style:{backgroundColor:g.color}}),a.jsx("span",{className:"min-w-0 truncate",title:g.label,children:g.label})]},g.label)),c.length>8&&a.jsxs("span",{className:"text-xs text-muted-foreground",children:["+",c.length-8," more"]})]})]}),a.jsx("aside",{"aria-live":"polite",className:"min-h-44",children:l?a.jsxs("div",{role:"tooltip",className:"rounded-2xl border bg-popover p-4 text-popover-foreground shadow-lg",children:[a.jsx("p",{className:"font-semibold",children:_o(l.start,n)}),a.jsxs("div",{className:"mt-3 space-y-2",children:[[...l.groups].sort((g,p)=>p.amount-g.amount).slice(0,5).map(g=>a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx("span",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:u.get(g.label)||Sn[0]}}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:g.label}),a.jsx("strong",{children:X(g.amount,t)})]},g.key||g.label)),l.groups.length>5&&a.jsxs("p",{className:"text-xs italic text-muted-foreground",children:["+ ",l.groups.length-5," others"]})]}),a.jsxs("div",{className:"mt-3 flex justify-between border-t pt-3 text-sm",children:[a.jsx("strong",{children:"Total"}),a.jsx("strong",{className:"text-primary",children:X(l.total,t)})]})]}):a.jsx("div",{className:"flex min-h-44 items-center justify-center rounded-2xl border border-dashed p-4 text-center text-xs text-muted-foreground",children:"Hover over a bar to view its cost details."})})]}):a.jsx("p",{className:"py-24 text-center text-sm text-muted-foreground",children:"No trend data for this period."})}function sm({rows:e,currency:t}){const n=e.slice(0,8),r=Math.max(1,...n.flatMap(s=>[s.current?.amount||0,s.previous?.amount||0]));return a.jsxs(ue,{className:"bg-primary/5",children:[a.jsx(Re,{children:a.jsx(Pe,{className:"text-sm",children:"Comparison Overview"})}),a.jsx(de,{children:a.jsxs("div",{className:"rounded-xl border bg-card p-5",children:[a.jsx("div",{className:"flex h-72 items-end gap-4 border-b border-l px-4 pt-4",children:n.map(s=>a.jsxs("div",{className:"flex min-w-0 flex-1 flex-col items-center",children:[a.jsxs("div",{className:"flex h-56 w-full items-end justify-center gap-1",children:[a.jsx("div",{title:`Current: ${X(s.current?.amount||0,t)}`,className:"w-1/3 max-w-10 rounded-t bg-indigo-500",style:{height:`${Math.max((s.current?.amount||0)/r*100,s.current?.amount?1:0)}%`}}),a.jsx("div",{title:`Previous: ${X(s.previous?.amount||0,t)}`,className:"w-1/3 max-w-10 rounded-t bg-pink-400",style:{height:`${Math.max((s.previous?.amount||0)/r*100,s.previous?.amount?1:0)}%`}})]}),a.jsx("span",{title:s.label,className:"mt-2 w-full truncate text-center text-[10px] text-muted-foreground",children:s.label})]},s.key))}),a.jsxs("div",{className:"mt-4 flex gap-5 text-xs",children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("i",{className:"h-2.5 w-2.5 rounded-full bg-indigo-500"}),"Current Period"]}),a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("i",{className:"h-2.5 w-2.5 rounded-full bg-pink-400"}),"Previous Period"]})]})]})})]})}function Me({label:e,value:t,helper:n,accent:r=!1,trend:s}){return a.jsxs("div",{className:"rounded-xl border bg-card p-5 shadow-sm",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[s!=null&&(s<0?a.jsx(Jf,{className:"h-4 w-4 text-red-500"}):a.jsx(pi,{className:"h-4 w-4 text-emerald-500"})),a.jsx("p",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:e})]}),a.jsx("p",{className:`mt-2 text-2xl font-bold ${r?"text-primary":s!=null&&s<0?"text-red-500":""}`,children:t}),n&&a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:n})]})}function Rn({label:e,options:t,selected:n,onChange:r}){const s=n.length?`${n.length} selected`:e;return a.jsxs("details",{className:"group relative",children:[a.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between rounded-lg border bg-background px-3 py-3 text-sm text-primary",children:[a.jsx("span",{children:s}),a.jsx(bf,{className:"h-4 w-4 transition-transform group-open:rotate-180"})]}),a.jsx("div",{className:"absolute z-30 mt-1 max-h-64 w-full overflow-auto rounded-lg border bg-popover p-2 shadow-xl",children:t.length?t.map(o=>a.jsxs("label",{className:"flex cursor-pointer items-start gap-2 rounded px-2 py-2 text-xs hover:bg-muted",children:[a.jsx("input",{type:"checkbox",checked:n.includes(o.value),onChange:i=>r(i.target.checked?[...n,o.value]:n.filter(c=>c!==o.value))}),a.jsx("span",{className:"min-w-0 break-words",children:o.label})]},o.value)):a.jsx("p",{className:"p-2 text-xs text-muted-foreground",children:"No values available."})})]})}function om(){return a.jsxs("div",{"aria-live":"polite","aria-busy":"true",className:"space-y-5",children:[a.jsxs("section",{className:"rounded-xl bg-primary/5 p-5",children:[a.jsxs("div",{className:"flex items-center gap-3 text-sm font-medium text-primary",children:[a.jsx(it,{className:"h-5 w-5 animate-spin"}),"Loading live AWS cost report..."]}),a.jsx("div",{className:"mt-5 grid gap-3 sm:grid-cols-3",children:[1,2,3].map(e=>a.jsx("div",{className:"h-28 animate-pulse rounded-xl border bg-card/70"},e))})]}),a.jsx("div",{className:"h-80 animate-pulse rounded-xl border bg-muted/40"}),a.jsx("div",{className:"h-64 animate-pulse rounded-xl border bg-muted/40"})]})}const Je=10,Jr=new Date,Li=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,am=Li(new Date(Jr.getFullYear(),Jr.getMonth()-2,1)),im=Li(Jr),Kt={services:[],regions:[],accountIds:[],tagKey:"",tagValues:[]},ht={service:{tab:"Services",title:"Service Cost Summary",pdfTitle:"Service Cost Report",top:"Top service cost",count:"Service count",item:"Service",empty:"No service cost data found."},account:{tab:"Accounts",title:"Account Cost Summary",pdfTitle:"Account Cost Report",top:"Top account cost",count:"Account count",item:"Linked account",empty:"No linked account cost data found."},region:{tab:"Regions",title:"Regional Cost Summary",pdfTitle:"Region Cost Report",top:"Top region cost",count:"Region count",item:"Region",empty:"No regional cost data found."},resource:{tab:"Resources",title:"Resource Cost Summary",pdfTitle:"Resource Cost Report",top:"Top resource cost",count:"Resource count",item:"Resource",empty:"Resource-level cost data requires resource IDs in the CUR export."},tag:{tab:"Tags",title:"Tag Cost Summary",pdfTitle:"Tag Cost Report",top:"Top tag value cost",count:"Tag value count",item:"Tag value",empty:"No cost allocation tag data found."}};function Po(e){return e?new Intl.DateTimeFormat("en-US",{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"longOffset"}).format(new Date(e)).replace("GMT","UTC"):"Not updated yet"}function Ao(e,t){const n=new Date(`${e}T00:00:00Z`);if(t==="monthly"){const s=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),1)),o=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()+1,0)),i=new Date(s);i.setUTCDate(i.getUTCDate()-1);const c=new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),1));return{currentStart:s.toISOString().slice(0,10),currentEnd:o.toISOString().slice(0,10),previousStart:c.toISOString().slice(0,10),previousEnd:i.toISOString().slice(0,10)}}const r=new Date(n);return r.setUTCDate(r.getUTCDate()-1),{currentStart:e,currentEnd:e,previousStart:r.toISOString().slice(0,10),previousEnd:r.toISOString().slice(0,10)}}function Lt(e,t,n){const r=new Date(`${e}T00:00:00Z`),s=new Date(`${t}T00:00:00Z`);if(n==="monthly"&&r.getUTCFullYear()===s.getUTCFullYear()&&r.getUTCMonth()===s.getUTCMonth())return new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric",timeZone:"UTC"}).format(r);const o=new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"});return`${o.format(r)} – ${o.format(s)}`}function cm(e){const t=new Map;return e.current.summary.forEach(n=>t.set(n.key||n.label,{current:n})),e.previous.summary.forEach(n=>{const r=n.key||n.label;t.set(r,{...t.get(r),previous:n})}),[...t.entries()].map(([n,r])=>{const s=r.current?.amount||0,o=r.previous?.amount||0,i=s-o;return{key:n,label:r.current?.label||r.previous?.label||n,...r,difference:i,change:o?i/Math.abs(o)*100:0}}).sort((n,r)=>Math.max(r.current?.amount||0,r.previous?.amount||0)-Math.max(n.current?.amount||0,n.previous?.amount||0))}function nt(e){return e?.length?e.map(t=>`${t.label}
18
18
  ${X(t.amount,"USD")}`).join(`
19
- `):"—"}function Oo({values:e}){const[t,n]=P.useState(!1);return a.jsxs("div",{className:"relative",children:[a.jsxs("button",{type:"button",onClick:()=>n(r=>!r),className:"inline-flex items-center gap-2 text-primary",children:[a.jsx("span",{className:"rounded-full bg-primary/10 px-2 py-1 text-xs font-semibold",children:e.length}),a.jsx("span",{children:"›"})]}),t&&a.jsxs("div",{className:"absolute right-0 top-8 z-20 w-72 rounded-lg border bg-popover p-3 shadow-xl",children:[a.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[a.jsx("strong",{className:"text-xs",children:"Cost distribution"}),a.jsx("button",{onClick:()=>n(!1),children:a.jsx(ht,{className:"h-3.5 w-3.5"})})]}),e.length?e.map(r=>a.jsxs("div",{className:"flex justify-between gap-3 border-t py-2 text-xs",children:[a.jsx("span",{className:"min-w-0 truncate",title:r.label,children:r.label}),a.jsx("strong",{children:X(r.amount,"USD")})]},r.key)):a.jsx("p",{className:"text-xs text-muted-foreground",children:"No related values."})]})]})}function Ii({page:e,pages:t,total:n,onChange:r}){const s=n?(e-1)*Xe+1:0,o=Math.min(e*Xe,n);return a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-t px-4 py-4 text-xs text-muted-foreground",children:[a.jsxs("span",{children:["Showing ",s,"–",o," of ",n]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{"aria-label":"Previous page",disabled:e<=1,onClick:()=>r(e-1),className:"rounded-md border p-1.5 disabled:opacity-40",children:a.jsx(vf,{className:"h-4 w-4"})}),a.jsxs("span",{children:["Page ",e," of ",t]}),a.jsx("button",{"aria-label":"Next page",disabled:e>=t,onClick:()=>r(e+1),className:"rounded-md border p-1.5 disabled:opacity-40",children:a.jsx(Sf,{className:"h-4 w-4"})})]})]})}function lm({groupBy:e,report:t}){const[n,r]=P.useState(""),[s,o]=P.useState(1),[i,c]=P.useState(null),[u,d]=P.useState({percentage:!0,accounts:!0,regions:!0}),f=mt[e],l=P.useMemo(()=>{const p=n.trim().toLowerCase();return p?t.summary.filter(x=>`${x.label} ${x.accountId||""}`.toLowerCase().includes(p)):t.summary},[t,n]),h=Math.max(1,Math.ceil(l.length/Xe)),m=l.slice((s-1)*Xe,s*Xe),g=3+Number(u.percentage)+Number(u.accounts)+Number(u.regions);return P.useEffect(()=>{o(1)},[t,n,e]),a.jsxs(ue,{children:[a.jsxs(Re,{className:"flex flex-row flex-wrap items-center justify-between gap-3",children:[a.jsx(Pe,{className:"text-sm text-primary",children:"Cost and usage breakdown"}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsxs("label",{className:"flex items-center gap-2 rounded-full border bg-background px-4 py-2 text-sm",children:[a.jsx(hs,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("input",{"aria-label":"Search breakdown",value:n,onChange:p=>r(p.target.value),placeholder:"Search...",className:"w-48 bg-transparent outline-none"})]}),a.jsxs("details",{className:"relative",children:[a.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-2 rounded-md border px-3 py-2 text-sm text-primary",children:[a.jsx(hi,{className:"h-4 w-4"}),"Column visibility"]}),a.jsx("div",{className:"absolute right-0 z-20 mt-1 w-48 rounded-md border bg-popover p-3 shadow-xl",children:Object.entries(u).map(([p,x])=>a.jsxs("label",{className:"flex gap-2 py-1 text-xs capitalize",children:[a.jsx("input",{type:"checkbox",checked:x,onChange:b=>d(y=>({...y,[p]:b.target.checked}))}),p]},p))})]})]})]}),a.jsx(de,{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b bg-primary/5 text-left text-xs uppercase text-primary",children:[a.jsx("th",{className:"px-4 py-4",children:f.item}),a.jsx("th",{className:"px-4",children:"Cost"}),u.percentage&&a.jsx("th",{className:"px-4",children:"Percentage"}),u.accounts&&a.jsx("th",{className:"px-4",children:"Accounts"}),u.regions&&a.jsx("th",{className:"px-4",children:"Regions"}),a.jsx("th",{className:"px-4 text-center",children:"Actions"})]})}),a.jsx("tbody",{children:m.length?m.map(p=>a.jsxs("tr",{className:"border-b last:border-0",children:[a.jsxs("td",{className:"max-w-72 px-4 py-4 font-medium",children:[a.jsx("div",{className:"truncate",title:p.label,children:p.label}),e==="account"&&a.jsx("div",{className:"font-mono text-xs text-muted-foreground",children:p.accountId||p.key})]}),a.jsx("td",{className:"px-4 font-semibold",children:X(p.amount,t.currency)}),u.percentage&&a.jsxs("td",{className:"px-4",children:[a.jsx("span",{className:"mr-2 inline-block h-1.5 w-12 overflow-hidden rounded-full bg-primary/15 align-middle",children:a.jsx("span",{className:"block h-full bg-primary",style:{width:`${Math.min(p.percentage||0,100)}%`}})}),a.jsxs("strong",{className:"text-primary",children:[p.percentage?.toFixed(2),"%"]})]}),u.accounts&&a.jsx("td",{className:"px-4",children:a.jsx(Oo,{values:p.accounts||[]})}),u.regions&&a.jsx("td",{className:"px-4",children:a.jsx(Oo,{values:p.regions||[]})}),a.jsx("td",{className:"px-4 text-center",children:a.jsx("button",{type:"button",onClick:()=>c(p),title:"View cost details",className:"text-primary hover:opacity-70",children:a.jsx(Of,{className:"h-4 w-4"})})})]},p.key||p.label)):a.jsx("tr",{children:a.jsx("td",{colSpan:g,className:"py-12 text-center text-muted-foreground",children:f.empty})})})]})}),a.jsx(Ii,{page:s,pages:h,total:l.length,onChange:o}),i&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",onClick:()=>c(null),children:a.jsxs("div",{className:"max-h-[80vh] w-full max-w-2xl overflow-auto rounded-xl bg-card p-6 shadow-2xl",onClick:p=>p.stopPropagation(),children:[a.jsxs("div",{className:"flex justify-between",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-xs uppercase text-muted-foreground",children:f.item}),a.jsx("h3",{className:"mt-1 text-lg font-semibold",children:i.label})]}),a.jsx("button",{onClick:()=>c(null),children:a.jsx(ht,{})})]}),a.jsxs("div",{className:"mt-5 grid gap-3 sm:grid-cols-3",children:[a.jsx(Me,{label:"Cost",value:X(i.amount,t.currency)}),a.jsx(Me,{label:"Accounts",value:String(i.accounts?.length||0)}),a.jsx(Me,{label:"Regions",value:String(i.regions?.length||0)})]}),a.jsxs("div",{className:"mt-5 grid gap-5 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"mb-2 text-sm font-semibold",children:"Accounts"}),(i.accounts||[]).map(p=>a.jsxs("div",{className:"flex justify-between border-t py-2 text-xs",children:[a.jsx("span",{children:p.label}),a.jsx("strong",{children:X(p.amount,t.currency)})]},p.key))]}),a.jsxs("div",{children:[a.jsx("h4",{className:"mb-2 text-sm font-semibold",children:"Regions"}),(i.regions||[]).map(p=>a.jsxs("div",{className:"flex justify-between border-t py-2 text-xs",children:[a.jsx("span",{children:p.label}),a.jsx("strong",{children:X(p.amount,t.currency)})]},p.key))]})]})]})})]})}function um({rows:e,groupBy:t,comparison:n,granularity:r}){const[s,o]=P.useState(""),[i,c]=P.useState(1),u=P.useMemo(()=>{const m=s.trim().toLowerCase();return m?e.filter(g=>g.label.toLowerCase().includes(m)):e},[e,s]),d=Math.max(1,Math.ceil(u.length/Xe)),f=u.slice((i-1)*Xe,i*Xe),l=It(n.currentStart,n.currentEnd,r),h=It(n.previousStart,n.previousEnd,r);return P.useEffect(()=>{c(1)},[s,t,n]),a.jsxs(ue,{children:[a.jsxs(Re,{className:"flex flex-row flex-wrap items-center justify-between gap-3",children:[a.jsx(Pe,{className:"text-sm text-primary",children:"Comparison Details"}),a.jsxs("label",{className:"flex items-center gap-2 rounded-full border bg-background px-4 py-2 text-sm",children:[a.jsx(hs,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("input",{"aria-label":"Search comparison",value:s,onChange:m=>o(m.target.value),placeholder:"Search...",className:"w-48 bg-transparent outline-none"})]})]}),a.jsx(de,{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b bg-primary/5 text-left text-xs uppercase text-primary",children:[a.jsxs("th",{className:"px-4 py-4",children:[mt[t].item," name"]}),a.jsxs("th",{className:"px-4",children:[l,a.jsx("small",{className:"block font-normal",children:"Cost"})]}),a.jsxs("th",{className:"px-4",children:[h,a.jsx("small",{className:"block font-normal",children:"Cost"})]}),a.jsx("th",{className:"px-4",children:"Difference"}),a.jsx("th",{className:"px-4",children:"Change %"})]})}),a.jsx("tbody",{children:f.length?f.map(m=>a.jsxs("tr",{className:"border-b",children:[a.jsx("td",{className:"max-w-80 px-4 py-4 font-medium",children:a.jsx("div",{className:"truncate",title:m.label,children:m.label})}),a.jsx("td",{className:"px-4",children:X(m.current?.amount||0,n.current.currency)}),a.jsx("td",{className:"px-4",children:X(m.previous?.amount||0,n.previous.currency)}),a.jsxs("td",{className:`px-4 font-medium ${m.difference<0?"text-red-500":"text-emerald-600"}`,children:[m.difference>=0?"+":"",X(m.difference,n.current.currency)]}),a.jsxs("td",{className:`px-4 font-medium ${m.change<0?"text-red-500":m.change>0?"text-emerald-600":"text-muted-foreground"}`,children:[m.change>0?"+":"",m.change.toFixed(1),"%"]})]},m.key)):a.jsx("tr",{children:a.jsx("td",{colSpan:5,className:"py-12 text-center text-muted-foreground",children:"No comparison data found."})})})]})}),a.jsx(Ii,{page:i,pages:d,total:u.length,onChange:c})]})}function dm(e){const{mode:t,groupBy:n,start:r,end:s,granularity:o,reportTagKey:i,options:c,filters:u,loading:d,filtersLoading:f,comparisonPeriods:l}=e;return a.jsxs("aside",{className:"space-y-4",children:[a.jsxs(ue,{className:"bg-primary/5",children:[a.jsx(Re,{children:a.jsx(Pe,{className:"text-sm uppercase text-primary",children:"Report parameters"})}),a.jsxs(de,{className:"space-y-4",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>e.onModeChange("standard"),className:`rounded-md px-4 py-2 text-xs font-semibold ${t==="standard"?"bg-primary text-primary-foreground":"border text-primary"}`,children:"Standard"}),a.jsx("button",{onClick:()=>e.onModeChange("compare"),className:`rounded-md px-4 py-2 text-xs font-semibold ${t==="compare"?"bg-primary text-primary-foreground":"border text-primary"}`,children:"Compare"})]}),t==="standard"&&a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"block text-xs text-muted-foreground",children:["Start date",a.jsx("input",{type:"date",value:r,onChange:h=>e.onStartChange(h.target.value),className:"mt-1 w-full rounded-md border bg-background p-2 text-sm text-foreground"})]}),a.jsxs("label",{className:"block text-xs text-muted-foreground",children:["End date",a.jsx("input",{type:"date",value:s,onChange:h=>e.onEndChange(h.target.value),className:"mt-1 w-full rounded-md border bg-background p-2 text-sm text-foreground"})]})]}),a.jsxs("label",{className:"block text-xs text-muted-foreground",children:["Granularity",a.jsxs("select",{value:o,onChange:h=>e.onGranularityChange(h.target.value),className:"mt-1 w-full rounded-md border bg-background p-2 text-sm text-foreground",children:[a.jsx("option",{value:"monthly",children:"Monthly"}),a.jsx("option",{value:"daily",children:"Daily"})]})]}),t==="compare"&&a.jsxs("p",{className:"rounded-md bg-background p-2 text-xs text-muted-foreground",children:["Current: ",l.currentStart," to ",l.currentEnd,a.jsx("br",{}),"Previous: ",l.previousStart," to ",l.previousEnd]}),n==="tag"&&a.jsxs("label",{className:"block text-xs text-muted-foreground",children:["Group by tag key",a.jsxs("select",{value:c.tagKeys.includes(i)?i:"",onChange:h=>e.onReportTagKeyChange(h.target.value),disabled:!c.tagKeys.length,className:"mt-1 w-full rounded-md border bg-background p-2 text-sm text-foreground disabled:opacity-60",children:[a.jsx("option",{value:"",children:f?"Loading tag keys...":"Select a tag key"}),c.tagKeys.map(h=>a.jsx("option",{children:h},h))]}),!f&&!c.tagKeys.length&&a.jsx("span",{className:"mt-2 block text-xs text-muted-foreground",children:"No activated AWS cost allocation tags are present in this CUR data."})]}),a.jsxs("button",{onClick:e.onRun,disabled:d||n==="tag"&&!c.tagKeys.length,className:"flex w-full items-center justify-center gap-2 rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground disabled:opacity-50",children:[a.jsx(Lt,{className:`h-4 w-4 ${d?"animate-spin":""}`}),"Run report"]})]})]}),a.jsxs(ue,{className:"bg-primary/5",children:[a.jsx(Re,{children:a.jsx(Pe,{className:"text-sm uppercase text-primary",children:"Filter by"})}),a.jsxs(de,{className:"space-y-3",children:[a.jsx(Rn,{label:"Services",options:c.services,selected:u.services,onChange:h=>e.onFiltersChange(m=>({...m,services:h}))}),a.jsx(Rn,{label:"Region",options:c.regions,selected:u.regions,onChange:h=>e.onFiltersChange(m=>({...m,regions:h}))}),a.jsx(Rn,{label:"Linked Account",options:c.accounts,selected:u.accountIds,onChange:h=>e.onFiltersChange(m=>({...m,accountIds:h}))}),a.jsxs("select",{value:u.tagKey,onChange:h=>{const m=h.target.value;e.onFiltersChange(g=>({...g,tagKey:m,tagValues:[]})),m&&e.onLoadTagValues(m)},className:"w-full rounded-lg border bg-background px-3 py-3 text-sm text-primary",children:[a.jsx("option",{value:"",children:"Tag key"}),c.tagKeys.map(h=>a.jsx("option",{children:h},h))]}),u.tagKey&&a.jsx(Rn,{label:"Tag values",options:c.tagValues.map(h=>({value:h,label:h})),selected:u.tagValues,onChange:h=>e.onFiltersChange(m=>({...m,tagValues:h}))}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-2",children:[a.jsx("button",{onClick:e.onApply,disabled:f||d,className:"rounded-md bg-primary px-3 py-2 text-sm font-semibold text-primary-foreground disabled:opacity-50",children:"Apply Filters"}),a.jsx("button",{onClick:e.onReset,disabled:d,className:"rounded-md border bg-background px-3 py-2 text-sm text-primary disabled:opacity-50",children:"Reset"})]})]})]})]})}function fm(){const{managementAccountId:e,loading:t}=$t(),[n,r]=P.useState("service"),[s,o]=P.useState("standard"),[i,c]=P.useState(am),[u,d]=P.useState(im),[f,l]=P.useState("monthly"),[h,m]=P.useState("Name"),[g,p]=P.useState({services:[],regions:[],accounts:[],tagKeys:[],tagValues:[]}),[x,b]=P.useState(Yt),[y,v]=P.useState(Yt),[N,j]=P.useState(null),[k,C]=P.useState(null),[R,_]=P.useState(!0),[L,A]=P.useState(!1),[D,O]=P.useState(null),[$,J]=P.useState(null),Y=P.useRef(0),Q=P.useMemo(()=>k?cm(k):[],[k]),he=Ao(u,f),me=(U,Z,V,ie)=>({start:Z,end:V,groupBy:ie,granularity:f,tagKey:h,services:U.services.join(","),regions:U.regions.join(","),accountIds:U.accountIds.join(","),filterTagKey:U.tagKey||void 0,tagValues:U.tagValues.join(","),managementAccountId:e}),I=async(U="")=>{A(!0);try{const Z=await oe.getDataStatus({managementAccountId:e});if(J(Z),!Z.ready)return;const V=await oe.getFilterOptions({start:i,end:u,filterTagKey:U||void 0,managementAccountId:e});p(ie=>U?{...ie,tagValues:V.tagValues}:V),!U&&V.tagKeys.length&&!V.tagKeys.includes(h)&&m(V.tagKeys[0])}catch(Z){O(Z?.response?.data?.error||Z.message||"Failed to load filter values")}finally{A(!1)}},E=async(U=y,Z=s,V=n)=>{const ie=++Y.current;_(!0),O(null),j(null),C(null);try{const le=await oe.getDataStatus({managementAccountId:e});if(ie===Y.current&&J(le),!le.ready)return;if(Z==="compare"){const te=Ao(u,f),[je,Ce]=await Promise.all([oe.getReports(me(U,te.currentStart,te.currentEnd,V)),oe.getReports(me(U,te.previousStart,te.previousEnd,V))]);ie===Y.current&&(j(je),C({current:je,previous:Ce,...te}))}else{const te=await oe.getReports(me(U,i,u,V));ie===Y.current&&j(te)}}catch(le){ie===Y.current&&O(le?.response?.data?.error||le.message||"Failed to generate cost report")}finally{ie===Y.current&&_(!1)}};return P.useEffect(()=>{t||(J(null),p({services:[],regions:[],accounts:[],tagKeys:[],tagValues:[]}),E(y,s,n),I())},[e,t]),{groupBy:n,mode:s,start:i,end:u,granularity:f,reportTagKey:h,options:g,draftFilters:x,report:N,comparison:k,loading:R||t,filtersLoading:L,error:D,dataStatus:$,comparedRows:Q,selectedComparisonPeriods:he,setStart:c,setEnd:d,setGranularity:l,setReportTagKey:m,setDraftFilters:b,changeGroup:U=>{U!==n&&(_(!0),j(null),C(null),r(U),E(y,s,U))},changeMode:U=>{U!==s&&(_(!0),j(null),C(null),o(U),E(y,U,n))},applyFilters:()=>{const U={...x,services:[...x.services],regions:[...x.regions],accountIds:[...x.accountIds],tagValues:[...x.tagValues]};v(U),E(U)},resetFilters:()=>{b(Yt),v(Yt),E(Yt)},runReport:()=>{I(),E()},loadOptions:I}}function hm(e){const{report:t,comparison:n,rows:r,groupBy:s,mode:o,start:i,end:c}=e,u=mt[s];let d,f;o==="compare"&&n?(d=[[u.item,"Current Cost","Previous Cost","Difference","Change %"].join(","),...r.map(h=>[`"${h.label.replace(/"/g,'""')}"`,h.current?.amount||0,h.previous?.amount||0,h.difference,h.change.toFixed(2)].join(","))].join(`
19
+ `):"—"}function Oo({values:e}){const[t,n]=P.useState(!1);return a.jsxs("div",{className:"relative",children:[a.jsxs("button",{type:"button",onClick:()=>n(r=>!r),className:"inline-flex items-center gap-2 text-primary",children:[a.jsx("span",{className:"rounded-full bg-primary/10 px-2 py-1 text-xs font-semibold",children:e.length}),a.jsx("span",{children:"›"})]}),t&&a.jsxs("div",{className:"absolute right-0 top-8 z-20 w-72 rounded-lg border bg-popover p-3 shadow-xl",children:[a.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[a.jsx("strong",{className:"text-xs",children:"Cost distribution"}),a.jsx("button",{onClick:()=>n(!1),children:a.jsx(ft,{className:"h-3.5 w-3.5"})})]}),e.length?e.map(r=>a.jsxs("div",{className:"flex justify-between gap-3 border-t py-2 text-xs",children:[a.jsx("span",{className:"min-w-0 truncate",title:r.label,children:r.label}),a.jsx("strong",{children:X(r.amount,"USD")})]},r.key)):a.jsx("p",{className:"text-xs text-muted-foreground",children:"No related values."})]})]})}function Ii({page:e,pages:t,total:n,onChange:r}){const s=n?(e-1)*Je+1:0,o=Math.min(e*Je,n);return a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-t px-4 py-4 text-xs text-muted-foreground",children:[a.jsxs("span",{children:["Showing ",s,"–",o," of ",n]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{"aria-label":"Previous page",disabled:e<=1,onClick:()=>r(e-1),className:"rounded-md border p-1.5 disabled:opacity-40",children:a.jsx(vf,{className:"h-4 w-4"})}),a.jsxs("span",{children:["Page ",e," of ",t]}),a.jsx("button",{"aria-label":"Next page",disabled:e>=t,onClick:()=>r(e+1),className:"rounded-md border p-1.5 disabled:opacity-40",children:a.jsx(Sf,{className:"h-4 w-4"})})]})]})}function lm({groupBy:e,report:t}){const[n,r]=P.useState(""),[s,o]=P.useState(1),[i,c]=P.useState(null),[u,d]=P.useState({percentage:!0,accounts:!0,regions:!0}),f=ht[e],l=P.useMemo(()=>{const p=n.trim().toLowerCase();return p?t.summary.filter(x=>`${x.label} ${x.accountId||""}`.toLowerCase().includes(p)):t.summary},[t,n]),h=Math.max(1,Math.ceil(l.length/Je)),m=l.slice((s-1)*Je,s*Je),g=3+Number(u.percentage)+Number(u.accounts)+Number(u.regions);return P.useEffect(()=>{o(1)},[t,n,e]),a.jsxs(ue,{children:[a.jsxs(Re,{className:"flex flex-row flex-wrap items-center justify-between gap-3",children:[a.jsx(Pe,{className:"text-sm text-primary",children:"Cost and usage breakdown"}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsxs("label",{className:"flex items-center gap-2 rounded-full border bg-background px-4 py-2 text-sm",children:[a.jsx(hs,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("input",{"aria-label":"Search breakdown",value:n,onChange:p=>r(p.target.value),placeholder:"Search...",className:"w-48 bg-transparent outline-none"})]}),a.jsxs("details",{className:"relative",children:[a.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-2 rounded-md border px-3 py-2 text-sm text-primary",children:[a.jsx(hi,{className:"h-4 w-4"}),"Column visibility"]}),a.jsx("div",{className:"absolute right-0 z-20 mt-1 w-48 rounded-md border bg-popover p-3 shadow-xl",children:Object.entries(u).map(([p,x])=>a.jsxs("label",{className:"flex gap-2 py-1 text-xs capitalize",children:[a.jsx("input",{type:"checkbox",checked:x,onChange:b=>d(y=>({...y,[p]:b.target.checked}))}),p]},p))})]})]})]}),a.jsx(de,{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b bg-primary/5 text-left text-xs uppercase text-primary",children:[a.jsx("th",{className:"px-4 py-4",children:f.item}),a.jsx("th",{className:"px-4",children:"Cost"}),u.percentage&&a.jsx("th",{className:"px-4",children:"Percentage"}),u.accounts&&a.jsx("th",{className:"px-4",children:"Accounts"}),u.regions&&a.jsx("th",{className:"px-4",children:"Regions"}),a.jsx("th",{className:"px-4 text-center",children:"Actions"})]})}),a.jsx("tbody",{children:m.length?m.map(p=>a.jsxs("tr",{className:"border-b last:border-0",children:[a.jsxs("td",{className:"max-w-72 px-4 py-4 font-medium",children:[a.jsx("div",{className:"truncate",title:p.label,children:p.label}),e==="account"&&a.jsx("div",{className:"font-mono text-xs text-muted-foreground",children:p.accountId||p.key})]}),a.jsx("td",{className:"px-4 font-semibold",children:X(p.amount,t.currency)}),u.percentage&&a.jsxs("td",{className:"px-4",children:[a.jsx("span",{className:"mr-2 inline-block h-1.5 w-12 overflow-hidden rounded-full bg-primary/15 align-middle",children:a.jsx("span",{className:"block h-full bg-primary",style:{width:`${Math.min(p.percentage||0,100)}%`}})}),a.jsxs("strong",{className:"text-primary",children:[p.percentage?.toFixed(2),"%"]})]}),u.accounts&&a.jsx("td",{className:"px-4",children:a.jsx(Oo,{values:p.accounts||[]})}),u.regions&&a.jsx("td",{className:"px-4",children:a.jsx(Oo,{values:p.regions||[]})}),a.jsx("td",{className:"px-4 text-center",children:a.jsx("button",{type:"button",onClick:()=>c(p),title:"View cost details",className:"text-primary hover:opacity-70",children:a.jsx(Of,{className:"h-4 w-4"})})})]},p.key||p.label)):a.jsx("tr",{children:a.jsx("td",{colSpan:g,className:"py-12 text-center text-muted-foreground",children:f.empty})})})]})}),a.jsx(Ii,{page:s,pages:h,total:l.length,onChange:o}),i&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",onClick:()=>c(null),children:a.jsxs("div",{className:"max-h-[80vh] w-full max-w-2xl overflow-auto rounded-xl bg-card p-6 shadow-2xl",onClick:p=>p.stopPropagation(),children:[a.jsxs("div",{className:"flex justify-between",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-xs uppercase text-muted-foreground",children:f.item}),a.jsx("h3",{className:"mt-1 text-lg font-semibold",children:i.label})]}),a.jsx("button",{onClick:()=>c(null),children:a.jsx(ft,{})})]}),a.jsxs("div",{className:"mt-5 grid gap-3 sm:grid-cols-3",children:[a.jsx(Me,{label:"Cost",value:X(i.amount,t.currency)}),a.jsx(Me,{label:"Accounts",value:String(i.accounts?.length||0)}),a.jsx(Me,{label:"Regions",value:String(i.regions?.length||0)})]}),a.jsxs("div",{className:"mt-5 grid gap-5 sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"mb-2 text-sm font-semibold",children:"Accounts"}),(i.accounts||[]).map(p=>a.jsxs("div",{className:"flex justify-between border-t py-2 text-xs",children:[a.jsx("span",{children:p.label}),a.jsx("strong",{children:X(p.amount,t.currency)})]},p.key))]}),a.jsxs("div",{children:[a.jsx("h4",{className:"mb-2 text-sm font-semibold",children:"Regions"}),(i.regions||[]).map(p=>a.jsxs("div",{className:"flex justify-between border-t py-2 text-xs",children:[a.jsx("span",{children:p.label}),a.jsx("strong",{children:X(p.amount,t.currency)})]},p.key))]})]})]})})]})}function um({rows:e,groupBy:t,comparison:n,granularity:r}){const[s,o]=P.useState(""),[i,c]=P.useState(1),u=P.useMemo(()=>{const m=s.trim().toLowerCase();return m?e.filter(g=>g.label.toLowerCase().includes(m)):e},[e,s]),d=Math.max(1,Math.ceil(u.length/Je)),f=u.slice((i-1)*Je,i*Je),l=Lt(n.currentStart,n.currentEnd,r),h=Lt(n.previousStart,n.previousEnd,r);return P.useEffect(()=>{c(1)},[s,t,n]),a.jsxs(ue,{children:[a.jsxs(Re,{className:"flex flex-row flex-wrap items-center justify-between gap-3",children:[a.jsx(Pe,{className:"text-sm text-primary",children:"Comparison Details"}),a.jsxs("label",{className:"flex items-center gap-2 rounded-full border bg-background px-4 py-2 text-sm",children:[a.jsx(hs,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("input",{"aria-label":"Search comparison",value:s,onChange:m=>o(m.target.value),placeholder:"Search...",className:"w-48 bg-transparent outline-none"})]})]}),a.jsx(de,{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b bg-primary/5 text-left text-xs uppercase text-primary",children:[a.jsxs("th",{className:"px-4 py-4",children:[ht[t].item," name"]}),a.jsxs("th",{className:"px-4",children:[l,a.jsx("small",{className:"block font-normal",children:"Cost"})]}),a.jsxs("th",{className:"px-4",children:[h,a.jsx("small",{className:"block font-normal",children:"Cost"})]}),a.jsx("th",{className:"px-4",children:"Difference"}),a.jsx("th",{className:"px-4",children:"Change %"})]})}),a.jsx("tbody",{children:f.length?f.map(m=>a.jsxs("tr",{className:"border-b",children:[a.jsx("td",{className:"max-w-80 px-4 py-4 font-medium",children:a.jsx("div",{className:"truncate",title:m.label,children:m.label})}),a.jsx("td",{className:"px-4",children:X(m.current?.amount||0,n.current.currency)}),a.jsx("td",{className:"px-4",children:X(m.previous?.amount||0,n.previous.currency)}),a.jsxs("td",{className:`px-4 font-medium ${m.difference<0?"text-red-500":"text-emerald-600"}`,children:[m.difference>=0?"+":"",X(m.difference,n.current.currency)]}),a.jsxs("td",{className:`px-4 font-medium ${m.change<0?"text-red-500":m.change>0?"text-emerald-600":"text-muted-foreground"}`,children:[m.change>0?"+":"",m.change.toFixed(1),"%"]})]},m.key)):a.jsx("tr",{children:a.jsx("td",{colSpan:5,className:"py-12 text-center text-muted-foreground",children:"No comparison data found."})})})]})}),a.jsx(Ii,{page:i,pages:d,total:u.length,onChange:c})]})}function dm(e){const{mode:t,groupBy:n,start:r,end:s,granularity:o,reportTagKey:i,options:c,filters:u,loading:d,filtersLoading:f,comparisonPeriods:l}=e;return a.jsxs("aside",{className:"space-y-4",children:[a.jsxs(ue,{className:"bg-primary/5",children:[a.jsx(Re,{children:a.jsx(Pe,{className:"text-sm uppercase text-primary",children:"Report parameters"})}),a.jsxs(de,{className:"space-y-4",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>e.onModeChange("standard"),className:`rounded-md px-4 py-2 text-xs font-semibold ${t==="standard"?"bg-primary text-primary-foreground":"border text-primary"}`,children:"Standard"}),a.jsx("button",{onClick:()=>e.onModeChange("compare"),className:`rounded-md px-4 py-2 text-xs font-semibold ${t==="compare"?"bg-primary text-primary-foreground":"border text-primary"}`,children:"Compare"})]}),t==="standard"&&a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"block text-xs text-muted-foreground",children:["Start date",a.jsx("input",{type:"date",value:r,onChange:h=>e.onStartChange(h.target.value),className:"mt-1 w-full rounded-md border bg-background p-2 text-sm text-foreground"})]}),a.jsxs("label",{className:"block text-xs text-muted-foreground",children:["End date",a.jsx("input",{type:"date",value:s,onChange:h=>e.onEndChange(h.target.value),className:"mt-1 w-full rounded-md border bg-background p-2 text-sm text-foreground"})]})]}),a.jsxs("label",{className:"block text-xs text-muted-foreground",children:["Granularity",a.jsxs("select",{value:o,onChange:h=>e.onGranularityChange(h.target.value),className:"mt-1 w-full rounded-md border bg-background p-2 text-sm text-foreground",children:[a.jsx("option",{value:"monthly",children:"Monthly"}),a.jsx("option",{value:"daily",children:"Daily"})]})]}),t==="compare"&&a.jsxs("p",{className:"rounded-md bg-background p-2 text-xs text-muted-foreground",children:["Current: ",l.currentStart," to ",l.currentEnd,a.jsx("br",{}),"Previous: ",l.previousStart," to ",l.previousEnd]}),n==="tag"&&a.jsxs("label",{className:"block text-xs text-muted-foreground",children:["Group by tag key",a.jsxs("select",{value:c.tagKeys.includes(i)?i:"",onChange:h=>e.onReportTagKeyChange(h.target.value),disabled:!c.tagKeys.length,className:"mt-1 w-full rounded-md border bg-background p-2 text-sm text-foreground disabled:opacity-60",children:[a.jsx("option",{value:"",children:f?"Loading tag keys...":"Select a tag key"}),c.tagKeys.map(h=>a.jsx("option",{children:h},h))]}),!f&&!c.tagKeys.length&&a.jsx("span",{className:"mt-2 block text-xs text-muted-foreground",children:"No activated AWS cost allocation tags are present in this CUR data."})]}),a.jsxs("button",{onClick:e.onRun,disabled:d||n==="tag"&&!c.tagKeys.length,className:"flex w-full items-center justify-center gap-2 rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground disabled:opacity-50",children:[a.jsx(Tt,{className:`h-4 w-4 ${d?"animate-spin":""}`}),"Run report"]})]})]}),a.jsxs(ue,{className:"bg-primary/5",children:[a.jsx(Re,{children:a.jsx(Pe,{className:"text-sm uppercase text-primary",children:"Filter by"})}),a.jsxs(de,{className:"space-y-3",children:[a.jsx(Rn,{label:"Services",options:c.services,selected:u.services,onChange:h=>e.onFiltersChange(m=>({...m,services:h}))}),a.jsx(Rn,{label:"Region",options:c.regions,selected:u.regions,onChange:h=>e.onFiltersChange(m=>({...m,regions:h}))}),a.jsx(Rn,{label:"Linked Account",options:c.accounts,selected:u.accountIds,onChange:h=>e.onFiltersChange(m=>({...m,accountIds:h}))}),a.jsxs("select",{value:u.tagKey,onChange:h=>{const m=h.target.value;e.onFiltersChange(g=>({...g,tagKey:m,tagValues:[]})),m&&e.onLoadTagValues(m)},className:"w-full rounded-lg border bg-background px-3 py-3 text-sm text-primary",children:[a.jsx("option",{value:"",children:"Tag key"}),c.tagKeys.map(h=>a.jsx("option",{children:h},h))]}),u.tagKey&&a.jsx(Rn,{label:"Tag values",options:c.tagValues.map(h=>({value:h,label:h})),selected:u.tagValues,onChange:h=>e.onFiltersChange(m=>({...m,tagValues:h}))}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-2",children:[a.jsx("button",{onClick:e.onApply,disabled:f||d,className:"rounded-md bg-primary px-3 py-2 text-sm font-semibold text-primary-foreground disabled:opacity-50",children:"Apply Filters"}),a.jsx("button",{onClick:e.onReset,disabled:d,className:"rounded-md border bg-background px-3 py-2 text-sm text-primary disabled:opacity-50",children:"Reset"})]})]})]})]})}function fm(){const{managementAccountId:e,loading:t}=Ut(),[n,r]=P.useState("service"),[s,o]=P.useState("standard"),[i,c]=P.useState(am),[u,d]=P.useState(im),[f,l]=P.useState("monthly"),[h,m]=P.useState("Name"),[g,p]=P.useState({services:[],regions:[],accounts:[],tagKeys:[],tagValues:[]}),[x,b]=P.useState(Kt),[y,v]=P.useState(Kt),[N,j]=P.useState(null),[k,C]=P.useState(null),[R,_]=P.useState(!0),[L,A]=P.useState(!1),[D,O]=P.useState(null),[$,J]=P.useState(null),Y=P.useRef(0),Q=P.useMemo(()=>k?cm(k):[],[k]),he=Ao(u,f),me=(U,Z,V,ie)=>({start:Z,end:V,groupBy:ie,granularity:f,tagKey:h,services:U.services.join(","),regions:U.regions.join(","),accountIds:U.accountIds.join(","),filterTagKey:U.tagKey||void 0,tagValues:U.tagValues.join(","),managementAccountId:e}),I=async(U="")=>{A(!0);try{const Z=await oe.getDataStatus({managementAccountId:e});if(J(Z),!Z.ready)return;const V=await oe.getFilterOptions({start:i,end:u,filterTagKey:U||void 0,managementAccountId:e});p(ie=>U?{...ie,tagValues:V.tagValues}:V),!U&&V.tagKeys.length&&!V.tagKeys.includes(h)&&m(V.tagKeys[0])}catch(Z){O(Z?.response?.data?.error||Z.message||"Failed to load filter values")}finally{A(!1)}},E=async(U=y,Z=s,V=n)=>{const ie=++Y.current;_(!0),O(null),j(null),C(null);try{const le=await oe.getDataStatus({managementAccountId:e});if(ie===Y.current&&J(le),!le.ready)return;if(Z==="compare"){const te=Ao(u,f),[je,Ce]=await Promise.all([oe.getReports(me(U,te.currentStart,te.currentEnd,V)),oe.getReports(me(U,te.previousStart,te.previousEnd,V))]);ie===Y.current&&(j(je),C({current:je,previous:Ce,...te}))}else{const te=await oe.getReports(me(U,i,u,V));ie===Y.current&&j(te)}}catch(le){ie===Y.current&&O(le?.response?.data?.error||le.message||"Failed to generate cost report")}finally{ie===Y.current&&_(!1)}};return P.useEffect(()=>{t||(J(null),p({services:[],regions:[],accounts:[],tagKeys:[],tagValues:[]}),E(y,s,n),I())},[e,t]),{groupBy:n,mode:s,start:i,end:u,granularity:f,reportTagKey:h,options:g,draftFilters:x,report:N,comparison:k,loading:R||t,filtersLoading:L,error:D,dataStatus:$,comparedRows:Q,selectedComparisonPeriods:he,setStart:c,setEnd:d,setGranularity:l,setReportTagKey:m,setDraftFilters:b,changeGroup:U=>{U!==n&&(_(!0),j(null),C(null),r(U),E(y,s,U))},changeMode:U=>{U!==s&&(_(!0),j(null),C(null),o(U),E(y,U,n))},applyFilters:()=>{const U={...x,services:[...x.services],regions:[...x.regions],accountIds:[...x.accountIds],tagValues:[...x.tagValues]};v(U),E(U)},resetFilters:()=>{b(Kt),v(Kt),E(Kt)},runReport:()=>{I(),E()},loadOptions:I}}function hm(e){const{report:t,comparison:n,rows:r,groupBy:s,mode:o,start:i,end:c}=e,u=ht[s];let d,f;o==="compare"&&n?(d=[[u.item,"Current Cost","Previous Cost","Difference","Change %"].join(","),...r.map(h=>[`"${h.label.replace(/"/g,'""')}"`,h.current?.amount||0,h.previous?.amount||0,h.difference,h.change.toFixed(2)].join(","))].join(`
20
20
  `),f=`comparison-report-${s}-${Date.now()}.csv`):(d=[[u.item,"Cost","Percentage","Accounts","Regions"].join(","),...t.summary.map(h=>[`"${h.label.replace(/"/g,'""')}"`,h.amount,h.percentage||0,h.accounts?.length||0,h.regions?.length||0].join(","))].join(`
21
- `),f=`${s}-summary-report-${Date.now()}.csv`);const l=document.createElement("a");l.href=URL.createObjectURL(new Blob([d],{type:"text/csv"})),l.download=f,l.click(),URL.revokeObjectURL(l.href)}async function mm(e){const{report:t,comparison:n,rows:r,groupBy:s,mode:o,start:i,end:c,granularity:u}=e,d=mt[s],[{jsPDF:f},{default:l}]=await Promise.all([Promise.resolve().then(()=>require("./jspdf.es.min-C10id8ME.cjs")).then(p=>p.jspdf_es_min),Promise.resolve().then(()=>require("./jspdf.plugin.autotable-CvTok6mL.cjs"))]),h=new f({orientation:"landscape",unit:"pt",format:"a4"}),m=(p,x,b)=>{h.setFontSize(7),h.setTextColor(100),h.text(`Report generated · All costs in ${t.currency} · ${x} to ${b}`,40,h.internal.pageSize.height-18),h.text(`Page ${p.pageNumber}`,h.internal.pageSize.width-70,h.internal.pageSize.height-18)};if(o==="compare"&&n){h.setFontSize(18),h.setTextColor(25),h.text("Comparison Report",40,42),h.setFontSize(9),h.setTextColor(98,86,230),h.text("TOTAL COST",40,66),h.setTextColor(40),h.text(`Previous Cost: ${n.previous.totalCost}`,40,82),h.text(`Current Cost: ${n.current.totalCost}`,220,82),h.text(`Granularity: ${u}`,400,82),l(h,{startY:100,head:[[`${d.item} Name`,"Current Cost","Previous Cost","Current Period","Previous Period","Change %","Current Accounts","Previous Accounts","Current Regions","Previous Regions"]],body:r.map(p=>[p.label,p.current?.amount?.toFixed(2)||"0.00",p.previous?.amount?.toFixed(2)||"0.00",It(n.currentStart,n.currentEnd,u),It(n.previousStart,n.previousEnd,u),`${p.change.toFixed(4)}%`,rt(p.current?.accounts),rt(p.previous?.accounts),rt(p.current?.regions),rt(p.previous?.regions)]),styles:{fontSize:6,cellPadding:3,overflow:"linebreak"},headStyles:{fillColor:[242,237,255],textColor:[82,35,190]},didDrawPage:p=>m(p,n.previousStart,n.currentEnd),margin:{bottom:32}}),h.save(`comparison-report-${s}-${Date.now()}.pdf`);return}h.setFontSize(18),h.setTextColor(25),h.text(d.pdfTitle,40,42),h.setFontSize(9),h.setTextColor(98,86,230),h.text("REPORT METADATA",40,66),h.setTextColor(40),h.text(`Tenant ID: ${t.tenantId||"Current tenant"}`,40,82),h.text(`Date Range: ${i} to ${c}`,40,97),h.text(`Accrued Total Cost: ${X(t.totalCost,t.currency)}`,40,112),h.setTextColor(98,86,230),h.text("COST SUMMARY BREAKDOWN",40,136);const g=s==="account";l(h,{startY:146,head:[g?["Account ID","Account Name","Total Cost","Percentage","Regions"]:[`${d.item} Name`,"Total Cost","Percentage","Accounts","Regions"]],body:t.summary.map(p=>g?[p.accountId||p.key||"—",p.label,X(p.amount,t.currency),`${(p.percentage||0).toFixed(2)}%`,rt(p.regions)]:[p.label,X(p.amount,t.currency),`${(p.percentage||0).toFixed(2)}%`,rt(p.accounts),rt(p.regions)]),styles:{fontSize:7,cellPadding:4,overflow:"linebreak"},headStyles:{fillColor:[242,237,255],textColor:[82,35,190]},didDrawPage:p=>m(p,i,c),margin:{bottom:32}}),h.save(`${s}-summary-report-${Date.now()}.pdf`)}function pm(){const e=fm(),{groupBy:t,mode:n,report:r,comparison:s,comparedRows:o,loading:i,error:c,dataStatus:u,granularity:d,start:f,end:l}=e,h=mt[t],m=r?.summary[0],g=s?s.current.totalCost-s.previous.totalCost:0,p=s?.previous.totalCost?g/Math.abs(s.previous.totalCost)*100:0,x=r?{report:r,comparison:s,rows:o,groupBy:t,mode:n,start:f,end:l,granularity:d}:null,b=a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{onClick:()=>x&&void mm(x),disabled:!x||i,className:"flex items-center gap-2 rounded-md border bg-card px-3 py-1.5 text-sm disabled:opacity-50",children:[a.jsx(Lf,{className:"h-4 w-4"}),"PDF"]}),a.jsxs("button",{onClick:()=>x&&hm(x),disabled:!x||i,className:"flex items-center gap-2 rounded-md border bg-card px-3 py-1.5 text-sm disabled:opacity-50",children:[a.jsx(fs,{className:"h-4 w-4"}),"CSV"]})]});return a.jsxs("div",{className:"flex w-full flex-col gap-5 p-2 md:p-6",children:[a.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold",children:[a.jsx(di,{className:"h-6 w-6 text-primary"}),"Cost reports"]}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Analyse live AWS cost by service, linked account, region, resource, or cost allocation tag"})]}),a.jsx(ar,{})]}),!i&&(u&&!u.ready||c&&!u)?a.jsx(Zn,{status:u,error:c}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"flex gap-1 overflow-x-auto border-b",children:Object.keys(mt).map(y=>a.jsx("button",{onClick:()=>e.changeGroup(y),className:`border-b-2 px-4 py-3 text-sm font-medium ${t===y?"border-primary text-primary":"border-transparent text-muted-foreground"}`,children:mt[y].tab},y))}),a.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1fr)_320px]",children:[a.jsxs("div",{className:"space-y-5",children:[c&&a.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:[a.jsx(ze,{className:"h-4 w-4"}),c]}),i?a.jsx(om,{}):n==="compare"&&s?a.jsxs(a.Fragment,{children:[a.jsxs("section",{className:"rounded-xl bg-primary/5 p-4",children:[a.jsxs("div",{className:"mb-4 flex flex-wrap items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold",children:"Comparison Cost Summary"}),a.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Updated On: ",Po(s.current.updatedAt)]})]}),b]}),a.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[a.jsx(Me,{label:"Period accrued total",value:`${X(s.current.totalCost,s.current.currency)} vs ${X(s.previous.totalCost,s.previous.currency)}`,helper:`${p>=0?"+":""}${p.toFixed(1)}% from previous period`,trend:p}),a.jsx(Me,{label:It(s.currentStart,s.currentEnd,d),value:X(s.current.totalCost,s.current.currency),helper:"Current period spending"}),a.jsx(Me,{label:It(s.previousStart,s.previousEnd,d),value:X(s.previous.totalCost,s.previous.currency),helper:"Previous period spending"}),a.jsx(Me,{label:d==="monthly"?"Monthly change":"Period change",value:`${g>=0?"+":""}${X(g,s.current.currency)}`,helper:`${p>=0?"+":""}${p.toFixed(1)}% from previous period`,trend:g})]})]}),a.jsx(sm,{rows:o,currency:s.current.currency}),a.jsx(um,{rows:o,groupBy:t,comparison:s,granularity:d})]}):r?a.jsxs(a.Fragment,{children:[r.message&&a.jsxs("div",{className:"flex items-center gap-2 rounded-lg border bg-muted/50 p-3 text-sm text-muted-foreground",children:[a.jsx(ze,{className:"h-4 w-4"}),r.message]}),a.jsxs("section",{className:"rounded-xl bg-primary/5 p-4",children:[a.jsxs("div",{className:"mb-4 flex flex-wrap items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold",children:h.title}),a.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Updated On: ",Po(r.updatedAt)]})]}),b]}),a.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[a.jsx(Me,{label:"Accrued cost",value:X(r.totalCost,r.currency)}),a.jsx(Me,{label:h.top,value:m?X(m.amount,r.currency):"-",accent:!0}),a.jsx(Me,{label:h.count,value:String(r.count||0),accent:!0})]})]}),a.jsxs(ue,{children:[a.jsx(Re,{children:a.jsx(Pe,{className:"text-sm",children:"Cost Trend"})}),a.jsx(de,{children:a.jsx(rm,{timeline:r.timeline||[],currency:r.currency||"USD",daily:d==="daily"})})]}),a.jsx(lm,{groupBy:t,report:r})]}):null]}),a.jsx(dm,{mode:n,groupBy:t,start:f,end:l,granularity:d,reportTagKey:e.reportTagKey,options:e.options,filters:e.draftFilters,loading:i,filtersLoading:e.filtersLoading,comparisonPeriods:e.selectedComparisonPeriods,onModeChange:e.changeMode,onStartChange:e.setStart,onEndChange:e.setEnd,onGranularityChange:e.setGranularity,onReportTagKeyChange:e.setReportTagKey,onFiltersChange:e.setDraftFilters,onLoadTagValues:y=>{e.loadOptions(y)},onRun:e.runReport,onApply:e.applyFilters,onReset:e.resetFilters})]})]})]})}const To={READY:"bg-emerald-500/10 text-emerald-600 border-emerald-500/30",RUNNING:"bg-blue-500/10 text-blue-600 border-blue-500/30",WAITING_FOR_DATA:"bg-amber-500/10 text-amber-600 border-amber-500/30",WAITING_FOR_TABLE:"bg-amber-500/10 text-amber-600 border-amber-500/30",FAILED:"bg-destructive/10 text-destructive border-destructive/30",PENDING:"bg-muted text-muted-foreground border-border"},gm={INFO:"text-muted-foreground",WARN:"text-amber-600",ERROR:"text-destructive"},Nn=e=>e?new Date(e).toLocaleString():"—";function xm({status:e}){return a.jsx("span",{className:`rounded-full border px-2 py-0.5 text-xs font-medium ${To[e]||To.PENDING}`,children:e.replace(/_/g," ")})}function Ue({label:e,value:t,mono:n}){return a.jsxs("div",{className:"flex flex-col gap-0.5",children:[a.jsx("span",{className:"text-xs text-muted-foreground",children:e}),a.jsx("span",{className:`break-all text-sm ${n?"font-mono text-xs":""}`,children:t||"—"})]})}function bm(){const{managementAccountId:e,loading:t}=$t(),[n,r]=P.useState([]),[s,o]=P.useState([]),[i,c]=P.useState(!0),[u,d]=P.useState(null),f=P.useCallback(async()=>{c(!0),d(null);try{const l=await ne.get("/cur-discovery",{params:{logLimit:100,managementAccountId:e}});r(l.data?.jobs||[]),o(l.data?.logs||[])}catch(l){d(l?.response?.data?.error||l?.message||"Unable to load CUR discovery status")}finally{c(!1)}},[e]);return P.useEffect(()=>{t||f()},[f,t]),a.jsxs("div",{className:"flex w-full flex-col gap-6 p-2 md:p-6",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold",children:[a.jsx(hs,{className:"h-6 w-6 text-primary"}),"CUR Discovery"]}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Progress of the scheduled job that locates this tenant’s Cost and Usage Report table. Cost data becomes available after it reports Ready."})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(ar,{}),a.jsx("button",{onClick:()=>{f()},disabled:i||t,className:"rounded-lg border p-2 hover:bg-muted disabled:opacity-50","aria-label":"Refresh",children:a.jsx(Lt,{className:`h-4 w-4 ${i||t?"animate-spin":""}`})})]})]}),u&&a.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:[a.jsx(ze,{className:"h-4 w-4"}),u]}),!i&&!u&&!n.length&&a.jsx(ue,{children:a.jsx(de,{className:"py-10 text-center text-sm text-muted-foreground",children:"No discovery job exists for this tenant yet. One is created automatically once the AWS connection is verified and the Cost plugin is entitled."})}),n.map(l=>a.jsxs(ue,{children:[a.jsxs(Re,{className:"flex flex-row flex-wrap items-center gap-3",children:[a.jsx(ci,{className:"h-4 w-4 text-primary"}),a.jsxs(Pe,{className:"text-sm",children:["Management account ",l.managementAccountId]}),a.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:["connection ",l.connectionId]}),a.jsx(xm,{status:l.status}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:["attempt ",l.attemptCount]}),a.jsxs("span",{className:"ms-auto text-xs text-muted-foreground",children:["next check ",Nn(l.nextRunAt)]})]}),a.jsxs(de,{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[a.jsx(Ue,{label:"Source",value:l.curS3Uri||`s3://${l.bucket}/${l.prefix}`,mono:!0}),a.jsx(Ue,{label:"Tenant partition",value:l.tenantPartition,mono:!0}),a.jsx(Ue,{label:"Region",value:l.region}),a.jsx(Ue,{label:"Glue database",value:l.database,mono:!0}),a.jsx(Ue,{label:"Discovered table",value:l.table,mono:!0}),a.jsx(Ue,{label:"Table location",value:l.tableLocation,mono:!0}),a.jsx(Ue,{label:"Sample object",value:l.sampleObjectKey,mono:!0}),a.jsx(Ue,{label:"Last data",value:Nn(l.lastDataAt)}),a.jsx(Ue,{label:"Last checked",value:Nn(l.lastFinishedAt||l.lastStartedAt)}),l.lastError&&a.jsx("div",{className:"md:col-span-2 lg:col-span-3 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:l.lastError})]})]},l.id)),n.length>0&&a.jsxs("section",{children:[a.jsx("h2",{className:"mb-3 text-sm font-semibold",children:"Recent activity"}),a.jsx("div",{className:"space-y-2",children:n.map(l=>{const h=s.filter(m=>m.jobId===l.id);return a.jsxs("details",{open:!0,className:"rounded-md border bg-card",children:[a.jsxs("summary",{className:"cursor-pointer px-4 py-3 text-sm font-medium",children:["Management account ",a.jsx("span",{className:"font-mono",children:l.managementAccountId})]}),a.jsx("div",{className:"border-t px-4 py-2",children:h.length?a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b text-left text-xs uppercase text-muted-foreground",children:[a.jsx("th",{className:"py-2 pe-4 font-medium",children:"Time"}),a.jsx("th",{className:"py-2 pe-4 font-medium",children:"Level"}),a.jsx("th",{className:"py-2 pe-4 font-medium",children:"Event"}),a.jsx("th",{className:"py-2 font-medium",children:"Message"})]})}),a.jsx("tbody",{children:h.map(m=>a.jsxs("tr",{className:"border-b last:border-0 align-top",children:[a.jsx("td",{className:"whitespace-nowrap py-2 pe-4 text-xs text-muted-foreground",children:Nn(m.createdAt)}),a.jsx("td",{className:`py-2 pe-4 text-xs font-medium ${gm[m.level]||""}`,children:m.level}),a.jsx("td",{className:"whitespace-nowrap py-2 pe-4 font-mono text-xs",children:m.event}),a.jsx("td",{className:"py-2",children:m.message})]},m.id))})]})}):a.jsx("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"No log entries recorded yet."})})]},l.id)})})]})]})}const ym=e=>e.launchUrl||`https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create?stackName=${encodeURIComponent(e.stackName||`MeyiConnect-${e.connectionId}-Management`)}`,vm=e=>e==="CONNECTED"?"border-emerald-500/30 bg-emerald-500/10 text-emerald-600":e==="FAILED"?"border-destructive/30 bg-destructive/10 text-destructive":"border-amber-500/30 bg-amber-500/10 text-amber-700",Jt=e=>{const t=e?.response?.data?.error||e?.response?.data?.message||e?.message||"Request failed",n=e?.response?.data?.details;return n?`${t} ${n}`:t};function wm(){const{selectManagementAccount:e,refreshSources:t}=$t(),[n,r]=P.useState([]),[s,o]=P.useState(!1),[i,c]=P.useState(!0),[u,d]=P.useState(!1),[f,l]=P.useState(null),[h,m]=P.useState(null),[g,p]=P.useState(""),[x,b]=P.useState(!1),[y,v]=P.useState(null),[N,j]=P.useState(null),[k,C]=P.useState(null),R=P.useCallback(async()=>{c(!0),C(null);try{const O=await oe.getSources();r(O.sources||[]),o(O.allowMultipleSources===!0)}catch(O){C(Jt(O))}finally{c(!1)}},[]);P.useEffect(()=>{R()},[R]);const _=async O=>{if(O.preventDefault(),!/^\d{12}$/.test(g)){C("AWS account ID must contain exactly 12 digits");return}j("create"),C(null);try{const $=await oe.createSource({managementAccountId:g,regionMode:x?"ALL":"SINGLE"});$.managementAccountId&&e($.managementAccountId),await t(),v($.connectionId),d(!1),p(""),b(!1),await R()}catch($){C(Jt($))}finally{j(null)}},L=async O=>{j(`download-${O}`),C(null);try{const $=await oe.downloadSourceTemplate(O),J=URL.createObjectURL($),Y=document.createElement("a");Y.href=J,Y.download=`meyi-connect-cost-${O}.yaml`,Y.click(),URL.revokeObjectURL(J),v(O)}catch($){C(Jt($))}finally{j(null)}},A=async O=>{j(`verify-${O}`),C(null);try{const $=await oe.verifySource(O);$.status==="FAILED"&&C($.message||"AWS connection verification failed"),await R()}catch($){C(Jt($))}finally{j(null)}},D=async()=>{if(f){j(`remove-${f.connectionId}`),C(null);try{const O=await oe.removeSource(f.connectionId);l(null),m(O.awsCleanup??null),await R(),await t()}catch(O){C(Jt(O))}finally{j(null)}}};return a.jsxs("div",{className:"flex w-full flex-col gap-6 p-2 md:p-6",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold",children:[a.jsx(Jn,{className:"h-6 w-6 text-primary"}),"Cost Sources"]}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"AWS accounts connected to this tenant for Cost and Usage Report data."})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{type:"button",onClick:()=>{R()},disabled:i,className:"rounded-md border p-2 hover:bg-muted disabled:opacity-50","aria-label":"Refresh sources",title:"Refresh sources",children:a.jsx(Lt,{className:`h-4 w-4 ${i?"animate-spin":""}`})}),(s||n.length===0)&&a.jsxs("button",{type:"button",onClick:()=>{C(null),d(!0)},className:"flex items-center gap-2 rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground hover:opacity-90",children:[a.jsx(zf,{className:"h-4 w-4"}),"Add AWS account"]})]})]}),k&&a.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:[a.jsx(ze,{className:"mt-0.5 h-4 w-4 shrink-0"}),k]}),!i&&n.length===0&&a.jsxs("div",{className:"rounded-md border border-dashed py-14 text-center",children:[a.jsx(Jn,{className:"mx-auto mb-3 h-8 w-8 text-muted-foreground"}),a.jsx("p",{className:"font-medium",children:"No AWS Cost source"}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Add an AWS account to begin collecting tenant cost data."})]}),n.length>0&&a.jsx("div",{className:"overflow-x-auto rounded-md border",children:a.jsxs("table",{className:"w-full min-w-[780px] text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b bg-muted/50 text-left text-xs uppercase text-muted-foreground",children:[a.jsx("th",{className:"px-4 py-3 font-medium",children:"AWS account"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Connection"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Scope"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Status"}),a.jsx("th",{className:"px-4 py-3 text-right font-medium",children:"Actions"})]})}),a.jsx("tbody",{children:n.map(O=>a.jsxs("tr",{className:`border-b last:border-0 ${y===O.connectionId?"bg-muted/30":""}`,children:[a.jsx("td",{className:"px-4 py-3 font-mono",children:O.managementAccountId||"Pending"}),a.jsx("td",{className:"px-4 py-3 font-mono text-xs",children:O.connectionId}),a.jsxs("td",{className:"px-4 py-3",children:[O.accountScope," / ",O.regionMode]}),a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("span",{className:`rounded-full border px-2 py-1 text-xs font-medium ${vm(O.status)}`,children:O.status.replace(/_/g," ")}),O.stackSetStatus&&a.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:O.stackSetStatus.replace(/_/g," ")}),O.status==="FAILED"&&O.failureReason&&a.jsx("div",{className:"mt-1 max-w-md text-xs text-destructive",children:O.failureReason})]}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{type:"button",onClick:()=>{L(O.connectionId)},disabled:!!N,className:"rounded-md border p-2 hover:bg-muted disabled:opacity-50",title:"Download CloudFormation template","aria-label":"Download CloudFormation template",children:N===`download-${O.connectionId}`?a.jsx(ct,{className:"h-4 w-4 animate-spin"}):a.jsx(fs,{className:"h-4 w-4"})}),a.jsx("a",{href:ym(O),target:"_blank",rel:"noreferrer",className:"rounded-md border p-2 hover:bg-muted",title:`Open AWS CloudFormation as ${O.stackName||`MeyiConnect-${O.connectionId}-Management`}`,"aria-label":"Open AWS CloudFormation",children:a.jsx(ui,{className:"h-4 w-4"})}),a.jsxs("button",{type:"button",onClick:()=>{A(O.connectionId)},disabled:!!N||O.status==="CONNECTED",className:"flex items-center gap-2 rounded-md border px-3 py-2 font-medium hover:bg-muted disabled:opacity-50",children:[N===`verify-${O.connectionId}`?a.jsx(ct,{className:"h-4 w-4 animate-spin"}):O.status==="CONNECTED"?a.jsx(Cf,{className:"h-4 w-4 text-emerald-600"}):a.jsx(Lt,{className:"h-4 w-4"}),O.status==="CONNECTED"?"Connected":"Verify"]}),a.jsx("button",{type:"button",onClick:()=>l(O),disabled:!!N,className:"rounded-md border p-2 text-destructive hover:bg-destructive/10 disabled:opacity-50",title:"Remove Cost source","aria-label":"Remove Cost source",children:a.jsx(mi,{className:"h-4 w-4"})})]})})]},O.connectionId))})]})}),u&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",role:"dialog","aria-modal":"true","aria-labelledby":"add-source-title",children:a.jsxs("form",{onSubmit:O=>{_(O)},className:"w-full max-w-md rounded-md border bg-background p-5 shadow-xl",children:[a.jsxs("div",{className:"flex items-center justify-between gap-4",children:[a.jsx("h2",{id:"add-source-title",className:"text-lg font-semibold",children:"Add AWS account"}),a.jsx("button",{type:"button",onClick:()=>d(!1),className:"rounded-md p-1 hover:bg-muted","aria-label":"Close",children:a.jsx(ht,{className:"h-4 w-4"})})]}),a.jsx("label",{className:"mt-5 block text-sm font-medium",htmlFor:"aws-account-id",children:"AWS account ID"}),a.jsx("input",{id:"aws-account-id",value:g,onChange:O=>p(O.target.value.replace(/\D/g,"").slice(0,12)),inputMode:"numeric",autoComplete:"off",placeholder:"123456789012",className:"mt-2 h-10 w-full rounded-md border bg-background px-3 font-mono outline-none focus:ring-2 focus:ring-ring"}),a.jsxs("label",{className:"mt-4 flex items-start gap-3 rounded-md border p-3",children:[a.jsx("input",{type:"checkbox",checked:x,onChange:O=>b(O.target.checked),className:"mt-1 h-4 w-4"}),a.jsxs("span",{children:[a.jsx("span",{className:"block text-sm font-medium",children:"All enabled AWS regions"}),a.jsx("span",{className:"block text-xs text-muted-foreground",children:"Use organization-wide StackSet deployment across enabled regions."})]})]}),a.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[a.jsx("button",{type:"button",onClick:()=>d(!1),className:"rounded-md border px-4 py-2 text-sm font-medium hover:bg-muted",children:"Cancel"}),a.jsxs("button",{type:"submit",disabled:N==="create"||g.length!==12,className:"flex items-center gap-2 rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground disabled:opacity-50",children:[N==="create"&&a.jsx(ct,{className:"h-4 w-4 animate-spin"}),"Create source"]})]})]})}),f&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",role:"dialog","aria-modal":"true","aria-labelledby":"remove-source-title",children:a.jsxs("div",{className:"w-full max-w-md rounded-md border bg-background p-5 shadow-xl",children:[a.jsxs("div",{className:"flex items-center justify-between gap-4",children:[a.jsx("h2",{id:"remove-source-title",className:"text-lg font-semibold",children:"Remove Cost source"}),a.jsx("button",{type:"button",onClick:()=>l(null),disabled:!!N,className:"rounded-md p-1 hover:bg-muted","aria-label":"Close",children:a.jsx(ht,{className:"h-4 w-4"})})]}),a.jsxs("p",{className:"mt-4 text-sm",children:["Remove AWS account ",a.jsx("span",{className:"font-mono font-medium",children:f.managementAccountId})," from this tenant?"]}),a.jsx("p",{className:"mt-3 text-xs text-muted-foreground",children:"Meyi Connect has no permission to change your AWS account, so the CloudFormation stacks stay until you delete them. You will see their names after removal. CUR data already delivered to Meyi Connect is retained."}),a.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[a.jsx("button",{type:"button",onClick:()=>l(null),disabled:!!N,className:"rounded-md border px-4 py-2 text-sm font-medium hover:bg-muted",children:"Cancel"}),a.jsxs("button",{type:"button",onClick:()=>{D()},disabled:!!N,className:"flex items-center gap-2 rounded-md bg-destructive px-4 py-2 text-sm font-medium text-destructive-foreground disabled:opacity-50",children:[N===`remove-${f.connectionId}`&&a.jsx(ct,{className:"h-4 w-4 animate-spin"}),"Remove"]})]})]})}),h&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",role:"dialog","aria-modal":"true","aria-labelledby":"cleanup-title",children:a.jsxs("div",{className:"w-full max-w-md rounded-md border bg-background p-5 shadow-xl",children:[a.jsxs("div",{className:"flex items-center justify-between gap-4",children:[a.jsx("h2",{id:"cleanup-title",className:"text-lg font-semibold",children:"Delete the AWS resources"}),a.jsx("button",{type:"button",onClick:()=>m(null),className:"rounded-md p-1 hover:bg-muted","aria-label":"Close",children:a.jsx(ht,{className:"h-4 w-4"})})]}),a.jsxs("p",{className:"mt-4 text-sm",children:["The source is removed. In your AWS management account, CloudFormation console, region ",a.jsx("span",{className:"font-mono",children:h.region}),":"]}),a.jsxs("ol",{className:"mt-3 list-decimal space-y-2 pl-5 text-sm",children:[h.membersStackName?a.jsxs("li",{children:["Stacks: delete ",a.jsx("span",{className:"font-mono",children:h.membersStackName}),". This removes the member StackSet and its stack instances."]}):h.stackSetName&&a.jsxs("li",{children:["StackSets: open ",a.jsx("span",{className:"font-mono",children:h.stackSetName}),", delete its stack instances, then delete the StackSet."]}),a.jsxs("li",{children:["Stacks: delete ",a.jsx("span",{className:"font-mono",children:h.managementStackName}),"."]})]}),a.jsx("div",{className:"mt-5 flex justify-end",children:a.jsx("button",{type:"button",onClick:()=>m(null),className:"rounded-md border px-4 py-2 text-sm font-medium hover:bg-muted",children:"Done"})})]})})]})}const Sm=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Rm=[10,20,50],Nm=["UTC","Asia/Kolkata","America/New_York","America/Los_Angeles","Europe/London","Europe/Berlin","Asia/Singapore","Asia/Tokyo","Australia/Sydney"];function Cm({open:e,schedule:t,saving:n,onClose:r,onSave:s}){const[o,i]=P.useState(t);if(P.useEffect(()=>i(t),[t,e]),!e)return null;const c=u=>i(d=>({...d,frequency:u}));return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/55 p-4",role:"presentation",onMouseDown:u=>{u.target===u.currentTarget&&r()},children:a.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"cost-ai-schedule-title",className:"w-full max-w-lg overflow-hidden rounded-lg border bg-background shadow-xl",children:[a.jsxs("div",{className:"flex items-start justify-between border-b px-5 py-4",children:[a.jsxs("div",{children:[a.jsxs("h2",{id:"cost-ai-schedule-title",className:"flex items-center gap-2 text-base font-semibold",children:[a.jsx(ii,{className:"h-4 w-4 text-primary"}),"AI report schedule"]}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Reports run automatically against completed AWS CUR periods."})]}),a.jsx("button",{type:"button",onClick:r,className:"rounded-md p-1.5 hover:bg-muted","aria-label":"Close",children:a.jsx(ht,{className:"h-4 w-4"})})]}),a.jsxs("form",{className:"space-y-5 p-5",onSubmit:u=>{u.preventDefault(),s({enabled:o.enabled,frequency:o.frequency,time:o.time,timezone:o.timezone,dayOfWeek:o.dayOfWeek,dayOfMonth:o.dayOfMonth,ticketLimit:o.ticketLimit??10}).then(r)},children:[a.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-lg border p-3",children:[a.jsxs("span",{children:[a.jsx("span",{className:"block text-sm font-medium",children:"Scheduled reports"}),a.jsx("span",{className:"block text-xs text-muted-foreground",children:"Generate reports without a manual action"})]}),a.jsx("input",{type:"checkbox",checked:o.enabled,onChange:u=>i(d=>({...d,enabled:u.target.checked})),className:"h-4 w-4 accent-primary"})]}),a.jsxs("fieldset",{disabled:!o.enabled||n,className:"space-y-5 disabled:opacity-60",children:[a.jsxs("div",{children:[a.jsx("span",{className:"mb-2 block text-sm font-medium",children:"Frequency"}),a.jsx("div",{className:"grid grid-cols-3 rounded-lg border p-1",children:["daily","weekly","monthly"].map(u=>a.jsx("button",{type:"button",onClick:()=>c(u),className:`rounded-md px-3 py-2 text-sm capitalize ${o.frequency===u?"bg-primary text-primary-foreground":"hover:bg-muted"}`,children:u},u))})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("label",{className:"text-sm font-medium",children:["Run time",a.jsx("input",{type:"time",required:!0,value:o.time,onChange:u=>i(d=>({...d,time:u.target.value})),className:"mt-2 block h-10 w-full rounded-lg border bg-background px-3 font-normal"})]}),a.jsxs("label",{className:"text-sm font-medium",children:["Timezone",a.jsx("select",{value:o.timezone,onChange:u=>i(d=>({...d,timezone:u.target.value})),className:"mt-2 block h-10 w-full rounded-lg border bg-background px-3 font-normal",children:[...new Set([o.timezone,...Nm])].map(u=>a.jsx("option",{children:u},u))})]})]}),o.frequency==="weekly"&&a.jsxs("label",{className:"block text-sm font-medium",children:["Day of week",a.jsx("select",{value:o.dayOfWeek??1,onChange:u=>i(d=>({...d,dayOfWeek:Number(u.target.value)})),className:"mt-2 block h-10 w-full rounded-lg border bg-background px-3 font-normal",children:Sm.map((u,d)=>a.jsx("option",{value:d,children:u},u))})]}),o.frequency==="monthly"&&a.jsxs("label",{className:"block text-sm font-medium",children:["Day of month",a.jsx("input",{type:"number",min:1,max:28,value:o.dayOfMonth??1,onChange:u=>i(d=>({...d,dayOfMonth:Number(u.target.value)})),className:"mt-2 block h-10 w-full rounded-lg border bg-background px-3 font-normal"})]}),a.jsxs("div",{role:"radiogroup","aria-labelledby":"cost-ai-ticket-limit-label",children:[a.jsx("span",{id:"cost-ai-ticket-limit-label",className:"mb-2 block text-sm font-medium",children:"Tasks per report"}),a.jsx("div",{className:"grid grid-cols-3 rounded-lg border p-1",children:Rm.map(u=>a.jsxs("button",{type:"button",role:"radio","aria-checked":(o.ticketLimit??10)===u,onClick:()=>i(d=>({...d,ticketLimit:u})),className:`rounded-md px-3 py-2 text-sm ${(o.ticketLimit??10)===u?"bg-primary text-primary-foreground":"hover:bg-muted"}`,children:["Top ",u]},u))}),a.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"Each report creates at most this many tasks, highest priority and savings first."})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Daily reports cover the previous day, weekly reports the previous seven complete days, and monthly reports the previous calendar month."})]}),a.jsxs("div",{className:"flex justify-end gap-2 border-t pt-4",children:[a.jsx("button",{type:"button",onClick:r,className:"rounded-lg border px-4 py-2 text-sm font-medium hover:bg-muted",children:"Cancel"}),a.jsx("button",{type:"submit",disabled:n,className:"rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground disabled:opacity-50",children:n?"Saving":"Save schedule"})]})]})]})})}function Ze(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e?.(s),n===!1||!s||!s.defaultPrevented)return t?.(s)}}function Lo(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function jm(...e){return t=>{let n=!1;const r=e.map(s=>{const o=Lo(s,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let s=0;s<r.length;s++){const o=r[s];typeof o=="function"?o():Lo(e[s],null)}}}}function yt(...e){return S.useCallback(jm(...e),e)}function Em(e,t=[]){let n=[];function r(o,i){const c=S.createContext(i);c.displayName=o+"Context";const u=n.length;n=[...n,i];const d=l=>{const{scope:h,children:m,...g}=l,p=h?.[e]?.[u]||c,x=S.useMemo(()=>g,Object.values(g));return a.jsx(p.Provider,{value:x,children:m})};d.displayName=o+"Provider";function f(l,h,m={}){const{optional:g=!1}=m,p=h?.[e]?.[u]||c,x=S.useContext(p);if(x)return x;if(i!==void 0)return i;if(!g)throw new Error(`\`${l}\` must be used within \`${o}\``)}return[d,f]}const s=()=>{const o=n.map(i=>S.createContext(i));return function(c){const u=c?.[e]||o;return S.useMemo(()=>({[`__scope${e}`]:{...c,[e]:u}}),[c,u])}};return s.scopeName=e,[r,km(s,...t)]}function km(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const i=r.reduce((c,{useScope:u,scopeName:d})=>{const l=u(o)[`__scope${d}`];return{...c,...l}},{});return S.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var sn=globalThis?.document?S.useLayoutEffect:()=>{},_m=S[" useId ".trim().toString()]||(()=>{}),Pm=0;function Pr(e){const[t,n]=S.useState(_m());return sn(()=>{n(r=>r??String(Pm++))},[e]),e||(t?`radix-${t}`:"")}var Am=S[" useInsertionEffect ".trim().toString()]||sn;function Om({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,o,i]=Tm({defaultProp:t,onChange:n}),c=e!==void 0,u=c?e:s;{const f=S.useRef(e!==void 0);S.useEffect(()=>{const l=f.current;l!==c&&console.warn(`${r} is changing from ${l?"controlled":"uncontrolled"} to ${c?"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.`),f.current=c},[c,r])}const d=S.useCallback(f=>{if(c){const l=Lm(f)?f(e):f;l!==e&&i.current?.(l)}else o(f)},[c,e,o,i]);return[u,d]}function Tm({defaultProp:e,onChange:t}){const[n,r]=S.useState(e),s=S.useRef(n),o=S.useRef(t);return Am(()=>{o.current=t},[t]),S.useEffect(()=>{s.current!==n&&(o.current?.(n),s.current=n)},[n,s]),[n,r,o]}function Lm(e){return typeof e=="function"}function Mi(e){const t=S.forwardRef((n,r)=>{let{children:s,...o}=n,i=null,c=!1;const u=[];Io(s)&&typeof Cn=="function"&&(s=Cn(s._payload)),S.Children.forEach(s,h=>{if(Um(h)){c=!0;const m=h;let g="child"in m.props?m.props.child:m.props.children;Io(g)&&typeof Cn=="function"&&(g=Cn(g._payload)),i=Mm(m,g),u.push(i?.props?.children)}else u.push(h)}),i?i=S.cloneElement(i,void 0,u):!c&&S.Children.count(s)===1&&S.isValidElement(s)&&(i=s);const d=i?Fm(i):void 0,f=yt(r,d);if(!i){if(s||s===0)throw new Error(c?Wm(e):zm(e));return s}const l=Dm(o,i.props??{});return i.type!==S.Fragment&&(l.ref=r?f:d),S.cloneElement(i,l)});return t.displayName=`${e}.Slot`,t}var Im=Symbol.for("radix.slottable"),Mm=(e,t)=>{if("child"in e.props){const n=e.props.child;return S.isValidElement(n)?S.cloneElement(n,void 0,e.props.children(n.props.children)):null}return S.isValidElement(t)?t:null};function Dm(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...c)=>{const u=o(...c);return s(...c),u}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function Fm(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Um(e){return S.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Im}var $m=Symbol.for("react.lazy");function Io(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===$m&&"_payload"in e&&Bm(e._payload)}function Bm(e){return typeof e=="object"&&e!==null&&"then"in e}var zm=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,Wm=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,Cn=S[" use ".trim().toString()],Vm=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],We=Vm.reduce((e,t)=>{const n=Mi(`Primitive.${t}`),r=S.forwardRef((s,o)=>{const{asChild:i,...c}=s,u=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(u,{...c,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Hm(e,t){e&&ea.flushSync(()=>e.dispatchEvent(t))}function on(e){const t=S.useRef(e);return S.useEffect(()=>{t.current=e}),S.useMemo(()=>((...n)=>t.current?.(...n)),[])}var qm="DismissableLayer",Xr="dismissableLayer.update",Gm="dismissableLayer.pointerDownOutside",Km="dismissableLayer.focusOutside",Mo,gs=S.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Di=S.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:c,onDismiss:u,...d}=e,f=S.useContext(gs),[l,h]=S.useState(null),m=l?.ownerDocument??globalThis?.document,[,g]=S.useState({}),p=yt(t,h),x=Array.from(f.layers),[b]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),y=b?x.indexOf(b):-1,v=l?x.indexOf(l):-1,N=f.layersWithOutsidePointerEventsDisabled.size>0,j=v>=y,k=S.useRef(!1),C=Qm(A=>{o?.(A),c?.(A),A.defaultPrevented||u?.()},{ownerDocument:m,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:k,dismissableSurfaces:f.dismissableSurfaces,shouldHandlePointerDownOutside:S.useCallback(A=>{if(!(A instanceof Node))return!1;const D=[...f.branches].some(O=>O.contains(A));return j&&!D},[f.branches,j])}),R=ep(A=>{if(r&&k.current)return;const D=A.target;[...f.branches].some($=>$.contains(D))||(i?.(A),c?.(A),A.defaultPrevented||u?.())},m),_=l?v===x.length-1:!1,L=on(A=>{A.key==="Escape"&&(s?.(A),!A.defaultPrevented&&u&&(A.preventDefault(),u()))});return S.useEffect(()=>{if(_)return m.addEventListener("keydown",L,{capture:!0}),()=>m.removeEventListener("keydown",L,{capture:!0})},[m,_,L]),S.useEffect(()=>{if(l)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(Mo=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(l)),f.layers.add(l),Do(),()=>{n&&(f.layersWithOutsidePointerEventsDisabled.delete(l),f.layersWithOutsidePointerEventsDisabled.size===0&&(m.body.style.pointerEvents=Mo))}},[l,m,n,f]),S.useEffect(()=>()=>{l&&(f.layers.delete(l),f.layersWithOutsidePointerEventsDisabled.delete(l),Do())},[l,f]),S.useEffect(()=>{const A=()=>g({});return document.addEventListener(Xr,A),()=>document.removeEventListener(Xr,A)},[]),a.jsx(We.div,{...d,ref:p,style:{pointerEvents:N?j?"auto":"none":void 0,...e.style},onFocusCapture:Ze(e.onFocusCapture,R.onFocusCapture),onBlurCapture:Ze(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:Ze(e.onPointerDownCapture,C.onPointerDownCapture)})});Di.displayName=qm;var Ym="DismissableLayerBranch",Jm=S.forwardRef((e,t)=>{const n=S.useContext(gs),r=S.useRef(null),s=yt(t,r);return S.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),a.jsx(We.div,{...e,ref:s})});Jm.displayName=Ym;function Xm(){const e=S.useContext(gs),[t,n]=S.useState(null);return S.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}var Zm=()=>!0;function Qm(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:o,shouldHandlePointerDownOutside:i=Zm}=t,c=on(e),u=S.useRef(!1),d=S.useRef(!1),f=S.useRef(new Map),l=S.useRef(()=>{});return S.useEffect(()=>{function h(){d.current=!1,s.current=!1,f.current.clear()}function m(){return Array.from(f.current.values()).some(Boolean)}function g(v){if(!d.current)return;const N=v.target;N instanceof Node&&[...o].some(k=>k.contains(N))||f.current.set(v.type,!0),v.type==="click"&&window.setTimeout(()=>{d.current&&l.current()},0)}function p(v){d.current&&f.current.set(v.type,!1)}const x=v=>{if(v.target&&!u.current){let N=function(){n.removeEventListener("click",l.current);const k=m();h(),k||Fi(Gm,c,j,{discrete:!0})};if(!i(v.target)){n.removeEventListener("click",l.current),h(),u.current=!1;return}const j={originalEvent:v};d.current=!0,s.current=r&&v.button===0,f.current.clear(),!r||v.button!==0?N():(n.removeEventListener("click",l.current),l.current=N,n.addEventListener("click",l.current,{once:!0}))}else n.removeEventListener("click",l.current),h();u.current=!1},b=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const v of b)n.addEventListener(v,g,!0),n.addEventListener(v,p);const y=window.setTimeout(()=>{n.addEventListener("pointerdown",x)},0);return()=>{window.clearTimeout(y),n.removeEventListener("pointerdown",x),n.removeEventListener("click",l.current);for(const v of b)n.removeEventListener(v,g,!0),n.removeEventListener(v,p)}},[n,c,r,s,o,i]),{onPointerDownCapture:()=>u.current=!0}}function ep(e,t=globalThis?.document){const n=on(e),r=S.useRef(!1);return S.useEffect(()=>{const s=o=>{o.target&&!r.current&&Fi(Km,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Do(){const e=new CustomEvent(Xr);document.dispatchEvent(e)}function Fi(e,t,n,{discrete:r}){const s=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?Hm(s,o):s.dispatchEvent(o)}var Ar="focusScope.autoFocusOnMount",Or="focusScope.autoFocusOnUnmount",Fo={bubbles:!1,cancelable:!0},tp="FocusScope",Ui=S.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...i}=e,[c,u]=S.useState(null),d=on(s),f=on(o),l=S.useRef(null),h=yt(t,u),m=S.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;S.useEffect(()=>{if(r){let p=function(v){if(m.paused||!c)return;const N=v.target;c.contains(N)?l.current=N:qe(l.current,{select:!0})},x=function(v){if(m.paused||!c)return;const N=v.relatedTarget;N!==null&&(c.contains(N)||qe(l.current,{select:!0}))},b=function(v){if(document.activeElement===document.body)for(const j of v)j.removedNodes.length>0&&qe(c)};document.addEventListener("focusin",p),document.addEventListener("focusout",x);const y=new MutationObserver(b);return c&&y.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",x),y.disconnect()}}},[r,c,m.paused]),S.useEffect(()=>{if(c){$o.add(m);const p=document.activeElement;if(!c.contains(p)){const b=new CustomEvent(Ar,Fo);c.addEventListener(Ar,d),c.dispatchEvent(b),b.defaultPrevented||(np(ip($i(c)),{select:!0}),document.activeElement===p&&qe(c))}return()=>{c.removeEventListener(Ar,d),setTimeout(()=>{const b=new CustomEvent(Or,Fo);c.addEventListener(Or,f),c.dispatchEvent(b),b.defaultPrevented||qe(p??document.body,{select:!0}),c.removeEventListener(Or,f),$o.remove(m)},0)}}},[c,d,f,m]);const g=S.useCallback(p=>{if(!n&&!r||m.paused)return;const x=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,b=document.activeElement;if(x&&b){const y=p.currentTarget,[v,N]=rp(y);v&&N?!p.shiftKey&&b===N?(p.preventDefault(),n&&qe(v,{select:!0})):p.shiftKey&&b===v&&(p.preventDefault(),n&&qe(N,{select:!0})):b===y&&p.preventDefault()}},[n,r,m.paused]);return a.jsx(We.div,{tabIndex:-1,...i,ref:h,onKeyDown:g})});Ui.displayName=tp;function np(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(qe(r,{select:t}),document.activeElement!==n)return}function rp(e){const t=$i(e),n=Uo(t,e),r=Uo(t.reverse(),e);return[n,r]}function $i(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Uo(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):sp(r,{upTo:t})))return r}function sp(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 op(e){return e instanceof HTMLInputElement&&"select"in e}function qe(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&op(e)&&t&&e.select()}}var $o=ap();function ap(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Bo(e,t),e.unshift(t)},remove(t){e=Bo(e,t),e[0]?.resume()}}}function Bo(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function ip(e){return e.filter(t=>t.tagName!=="A")}var cp="Portal",Bi=S.forwardRef((e,t)=>{const{container:n,...r}=e,[s,o]=S.useState(!1);sn(()=>o(!0),[]);const i=n||s&&globalThis?.document?.body;return i?ea.createPortal(a.jsx(We.div,{...r,ref:t}),i):null});Bi.displayName=cp;function lp(e,t){return S.useReducer((n,r)=>t[n][r]??n,e)}var ir=e=>{const{present:t,children:n}=e,r=up(t),s=typeof n=="function"?n({present:r.isPresent}):S.Children.only(n),o=dp(r.ref,fp(s));return typeof n=="function"||r.isPresent?S.cloneElement(s,{ref:o}):null};ir.displayName="Presence";function up(e){const[t,n]=S.useState(),r=S.useRef(null),s=S.useRef(e),o=S.useRef("none"),i=S.useRef(void 0),c=e?"mounted":"unmounted",[u,d]=lp(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return S.useEffect(()=>{u==="mounted"?(o.current=i.current??Xt(r.current),i.current=void 0):o.current="none"},[u]),sn(()=>{const f=r.current,l=s.current;if(l!==e){const m=o.current,g=Xt(f);e?(i.current=g,d("MOUNT")):g==="none"||f?.display==="none"?d("UNMOUNT"):d(l&&m!==g?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,d]),sn(()=>{if(t){let f;const l=t.ownerDocument.defaultView??window,h=g=>{const x=Xt(r.current).includes(CSS.escape(g.animationName));if(g.target===t&&x&&(d("ANIMATION_END"),!s.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",f=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},m=g=>{g.target===t&&(o.current=Xt(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{l.clearTimeout(f),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:S.useCallback(f=>{if(f){const l=getComputedStyle(f);r.current=l,i.current=Xt(l)}else r.current=null;n(f)},[])}}function zo(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function dp(...e){const t=S.useRef(e);return t.current=e,S.useCallback(n=>{const r=t.current;let s=!1;const o=r.map(i=>{const c=zo(i,n);return!s&&typeof c=="function"&&(s=!0),c});if(s)return()=>{for(let i=0;i<o.length;i++){const c=o[i];typeof c=="function"?c():zo(r[i],null)}}},[])}function Xt(e){return e?.animationName||"none"}function fp(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var jn=0,St=null;function hp(){S.useEffect(()=>{St||(St={start:Wo(),end:Wo()});const{start:e,end:t}=St;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),jn++,()=>{jn===1&&(St?.start.remove(),St?.end.remove(),St=null),jn=Math.max(0,jn-1)}},[])}function Wo(){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 De=function(){return De=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},De.apply(this,arguments)};function zi(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function mp(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,o;r<s;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var Fn="right-scroll-bar-position",Un="width-before-scroll-bar",pp="with-scroll-bars-hidden",gp="--removed-body-scroll-bar-size";function Tr(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function xp(e,t){var n=P.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var bp=typeof window<"u"?S.useLayoutEffect:S.useEffect,Vo=new WeakMap;function yp(e,t){var n=xp(null,function(r){return e.forEach(function(s){return Tr(s,r)})});return bp(function(){var r=Vo.get(n);if(r){var s=new Set(r),o=new Set(e),i=n.current;s.forEach(function(c){o.has(c)||Tr(c,null)}),o.forEach(function(c){s.has(c)||Tr(c,i)})}Vo.set(n,e)},[e]),n}function vp(e){return e}function wp(e,t){t===void 0&&(t=vp);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var i=t(o,r);return n.push(i),function(){n=n.filter(function(c){return c!==i})}},assignSyncMedium:function(o){for(r=!0;n.length;){var i=n;n=[],i.forEach(o)}n={push:function(c){return o(c)},filter:function(){return n}}},assignMedium:function(o){r=!0;var i=[];if(n.length){var c=n;n=[],c.forEach(o),i=n}var u=function(){var f=i;i=[],f.forEach(o)},d=function(){return Promise.resolve().then(u)};d(),n={push:function(f){i.push(f),d()},filter:function(f){return i=i.filter(f),n}}}};return s}function Sp(e){e===void 0&&(e={});var t=wp(null);return t.options=De({async:!0,ssr:!1},e),t}var Wi=function(e){var t=e.sideCar,n=zi(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return S.createElement(r,De({},n))};Wi.isSideCarExport=!0;function Rp(e,t){return e.useMedium(t),Wi}var Vi=Sp(),Lr=function(){},cr=S.forwardRef(function(e,t){var n=S.useRef(null),r=S.useState({onScrollCapture:Lr,onWheelCapture:Lr,onTouchMoveCapture:Lr}),s=r[0],o=r[1],i=e.forwardProps,c=e.children,u=e.className,d=e.removeScrollBar,f=e.enabled,l=e.shards,h=e.sideCar,m=e.noRelative,g=e.noIsolation,p=e.inert,x=e.allowPinchZoom,b=e.as,y=b===void 0?"div":b,v=e.gapMode,N=zi(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),j=h,k=yp([n,t]),C=De(De({},N),s);return S.createElement(S.Fragment,null,f&&S.createElement(j,{sideCar:Vi,removeScrollBar:d,shards:l,noRelative:m,noIsolation:g,inert:p,setCallbacks:o,allowPinchZoom:!!x,lockRef:n,gapMode:v}),i?S.cloneElement(S.Children.only(c),De(De({},C),{ref:k})):S.createElement(y,De({},C,{className:u,ref:k}),c))});cr.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};cr.classNames={fullWidth:Un,zeroRight:Fn};var Np=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Cp(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Np();return t&&e.setAttribute("nonce",t),e}function jp(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Ep(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var kp=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Cp())&&(jp(t,n),Ep(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},_p=function(){var e=kp();return function(t,n){S.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Hi=function(){var e=_p(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},Pp={left:0,top:0,right:0,gap:0},Ir=function(e){return parseInt(e||"",10)||0},Ap=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[Ir(n),Ir(r),Ir(s)]},Op=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Pp;var t=Ap(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Tp=Hi(),Pt="data-scroll-locked",Lp=function(e,t,n,r){var s=e.left,o=e.top,i=e.right,c=e.gap;return n===void 0&&(n="margin"),`
21
+ `),f=`${s}-summary-report-${Date.now()}.csv`);const l=document.createElement("a");l.href=URL.createObjectURL(new Blob([d],{type:"text/csv"})),l.download=f,l.click(),URL.revokeObjectURL(l.href)}async function mm(e){const{report:t,comparison:n,rows:r,groupBy:s,mode:o,start:i,end:c,granularity:u}=e,d=ht[s],[{jsPDF:f},{default:l}]=await Promise.all([Promise.resolve().then(()=>require("./jspdf.es.min-C10id8ME.cjs")).then(p=>p.jspdf_es_min),Promise.resolve().then(()=>require("./jspdf.plugin.autotable-CvTok6mL.cjs"))]),h=new f({orientation:"landscape",unit:"pt",format:"a4"}),m=(p,x,b)=>{h.setFontSize(7),h.setTextColor(100),h.text(`Report generated · All costs in ${t.currency} · ${x} to ${b}`,40,h.internal.pageSize.height-18),h.text(`Page ${p.pageNumber}`,h.internal.pageSize.width-70,h.internal.pageSize.height-18)};if(o==="compare"&&n){h.setFontSize(18),h.setTextColor(25),h.text("Comparison Report",40,42),h.setFontSize(9),h.setTextColor(98,86,230),h.text("TOTAL COST",40,66),h.setTextColor(40),h.text(`Previous Cost: ${n.previous.totalCost}`,40,82),h.text(`Current Cost: ${n.current.totalCost}`,220,82),h.text(`Granularity: ${u}`,400,82),l(h,{startY:100,head:[[`${d.item} Name`,"Current Cost","Previous Cost","Current Period","Previous Period","Change %","Current Accounts","Previous Accounts","Current Regions","Previous Regions"]],body:r.map(p=>[p.label,p.current?.amount?.toFixed(2)||"0.00",p.previous?.amount?.toFixed(2)||"0.00",Lt(n.currentStart,n.currentEnd,u),Lt(n.previousStart,n.previousEnd,u),`${p.change.toFixed(4)}%`,nt(p.current?.accounts),nt(p.previous?.accounts),nt(p.current?.regions),nt(p.previous?.regions)]),styles:{fontSize:6,cellPadding:3,overflow:"linebreak"},headStyles:{fillColor:[242,237,255],textColor:[82,35,190]},didDrawPage:p=>m(p,n.previousStart,n.currentEnd),margin:{bottom:32}}),h.save(`comparison-report-${s}-${Date.now()}.pdf`);return}h.setFontSize(18),h.setTextColor(25),h.text(d.pdfTitle,40,42),h.setFontSize(9),h.setTextColor(98,86,230),h.text("REPORT METADATA",40,66),h.setTextColor(40),h.text(`Tenant ID: ${t.tenantId||"Current tenant"}`,40,82),h.text(`Date Range: ${i} to ${c}`,40,97),h.text(`Accrued Total Cost: ${X(t.totalCost,t.currency)}`,40,112),h.setTextColor(98,86,230),h.text("COST SUMMARY BREAKDOWN",40,136);const g=s==="account";l(h,{startY:146,head:[g?["Account ID","Account Name","Total Cost","Percentage","Regions"]:[`${d.item} Name`,"Total Cost","Percentage","Accounts","Regions"]],body:t.summary.map(p=>g?[p.accountId||p.key||"—",p.label,X(p.amount,t.currency),`${(p.percentage||0).toFixed(2)}%`,nt(p.regions)]:[p.label,X(p.amount,t.currency),`${(p.percentage||0).toFixed(2)}%`,nt(p.accounts),nt(p.regions)]),styles:{fontSize:7,cellPadding:4,overflow:"linebreak"},headStyles:{fillColor:[242,237,255],textColor:[82,35,190]},didDrawPage:p=>m(p,i,c),margin:{bottom:32}}),h.save(`${s}-summary-report-${Date.now()}.pdf`)}function pm(){const e=fm(),{groupBy:t,mode:n,report:r,comparison:s,comparedRows:o,loading:i,error:c,dataStatus:u,granularity:d,start:f,end:l}=e,h=ht[t],m=r?.summary[0],g=s?s.current.totalCost-s.previous.totalCost:0,p=s?.previous.totalCost?g/Math.abs(s.previous.totalCost)*100:0,x=r?{report:r,comparison:s,rows:o,groupBy:t,mode:n,start:f,end:l,granularity:d}:null,b=a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{onClick:()=>x&&void mm(x),disabled:!x||i,className:"flex items-center gap-2 rounded-md border bg-card px-3 py-1.5 text-sm disabled:opacity-50",children:[a.jsx(Lf,{className:"h-4 w-4"}),"PDF"]}),a.jsxs("button",{onClick:()=>x&&hm(x),disabled:!x||i,className:"flex items-center gap-2 rounded-md border bg-card px-3 py-1.5 text-sm disabled:opacity-50",children:[a.jsx(fs,{className:"h-4 w-4"}),"CSV"]})]});return a.jsxs("div",{className:"flex w-full flex-col gap-5 p-2 md:p-6",children:[a.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold",children:[a.jsx(di,{className:"h-6 w-6 text-primary"}),"Cost reports"]}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Analyse live AWS cost by service, linked account, region, resource, or cost allocation tag"})]}),a.jsx(ar,{})]}),!i&&(u&&!u.ready||c&&!u)?a.jsx(Zn,{status:u,error:c}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"flex gap-1 overflow-x-auto border-b",children:Object.keys(ht).map(y=>a.jsx("button",{onClick:()=>e.changeGroup(y),className:`border-b-2 px-4 py-3 text-sm font-medium ${t===y?"border-primary text-primary":"border-transparent text-muted-foreground"}`,children:ht[y].tab},y))}),a.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1fr)_320px]",children:[a.jsxs("div",{className:"space-y-5",children:[c&&a.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:[a.jsx(Be,{className:"h-4 w-4"}),c]}),i?a.jsx(om,{}):n==="compare"&&s?a.jsxs(a.Fragment,{children:[a.jsxs("section",{className:"rounded-xl bg-primary/5 p-4",children:[a.jsxs("div",{className:"mb-4 flex flex-wrap items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold",children:"Comparison Cost Summary"}),a.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Updated On: ",Po(s.current.updatedAt)]})]}),b]}),a.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[a.jsx(Me,{label:"Period accrued total",value:`${X(s.current.totalCost,s.current.currency)} vs ${X(s.previous.totalCost,s.previous.currency)}`,helper:`${p>=0?"+":""}${p.toFixed(1)}% from previous period`,trend:p}),a.jsx(Me,{label:Lt(s.currentStart,s.currentEnd,d),value:X(s.current.totalCost,s.current.currency),helper:"Current period spending"}),a.jsx(Me,{label:Lt(s.previousStart,s.previousEnd,d),value:X(s.previous.totalCost,s.previous.currency),helper:"Previous period spending"}),a.jsx(Me,{label:d==="monthly"?"Monthly change":"Period change",value:`${g>=0?"+":""}${X(g,s.current.currency)}`,helper:`${p>=0?"+":""}${p.toFixed(1)}% from previous period`,trend:g})]})]}),a.jsx(sm,{rows:o,currency:s.current.currency}),a.jsx(um,{rows:o,groupBy:t,comparison:s,granularity:d})]}):r?a.jsxs(a.Fragment,{children:[r.message&&a.jsxs("div",{className:"flex items-center gap-2 rounded-lg border bg-muted/50 p-3 text-sm text-muted-foreground",children:[a.jsx(Be,{className:"h-4 w-4"}),r.message]}),a.jsxs("section",{className:"rounded-xl bg-primary/5 p-4",children:[a.jsxs("div",{className:"mb-4 flex flex-wrap items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold",children:h.title}),a.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Updated On: ",Po(r.updatedAt)]})]}),b]}),a.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[a.jsx(Me,{label:"Accrued cost",value:X(r.totalCost,r.currency)}),a.jsx(Me,{label:h.top,value:m?X(m.amount,r.currency):"-",accent:!0}),a.jsx(Me,{label:h.count,value:String(r.count||0),accent:!0})]})]}),a.jsxs(ue,{children:[a.jsx(Re,{children:a.jsx(Pe,{className:"text-sm",children:"Cost Trend"})}),a.jsx(de,{children:a.jsx(rm,{timeline:r.timeline||[],currency:r.currency||"USD",daily:d==="daily"})})]}),a.jsx(lm,{groupBy:t,report:r})]}):null]}),a.jsx(dm,{mode:n,groupBy:t,start:f,end:l,granularity:d,reportTagKey:e.reportTagKey,options:e.options,filters:e.draftFilters,loading:i,filtersLoading:e.filtersLoading,comparisonPeriods:e.selectedComparisonPeriods,onModeChange:e.changeMode,onStartChange:e.setStart,onEndChange:e.setEnd,onGranularityChange:e.setGranularity,onReportTagKeyChange:e.setReportTagKey,onFiltersChange:e.setDraftFilters,onLoadTagValues:y=>{e.loadOptions(y)},onRun:e.runReport,onApply:e.applyFilters,onReset:e.resetFilters})]})]})]})}const To={READY:"bg-emerald-500/10 text-emerald-600 border-emerald-500/30",RUNNING:"bg-blue-500/10 text-blue-600 border-blue-500/30",WAITING_FOR_DATA:"bg-amber-500/10 text-amber-600 border-amber-500/30",WAITING_FOR_TABLE:"bg-amber-500/10 text-amber-600 border-amber-500/30",FAILED:"bg-destructive/10 text-destructive border-destructive/30",PENDING:"bg-muted text-muted-foreground border-border"},gm={INFO:"text-muted-foreground",WARN:"text-amber-600",ERROR:"text-destructive"},Nn=e=>e?new Date(e).toLocaleString():"—";function xm({status:e}){return a.jsx("span",{className:`rounded-full border px-2 py-0.5 text-xs font-medium ${To[e]||To.PENDING}`,children:e.replace(/_/g," ")})}function Yt({label:e,value:t,mono:n}){return a.jsxs("div",{className:"flex flex-col gap-0.5",children:[a.jsx("span",{className:"text-xs text-muted-foreground",children:e}),a.jsx("span",{className:`break-all text-sm ${n?"font-mono text-xs":""}`,children:t||"—"})]})}function bm(){const{managementAccountId:e,loading:t}=Ut(),[n,r]=P.useState([]),[s,o]=P.useState([]),[i,c]=P.useState(!0),[u,d]=P.useState(null),f=P.useCallback(async()=>{c(!0),d(null);try{const l=await ne.get("/cur-discovery",{params:{logLimit:100,managementAccountId:e}});r(l.data?.jobs||[]),o(l.data?.logs||[])}catch(l){d(l?.response?.data?.error||l?.message||"Unable to load CUR discovery status")}finally{c(!1)}},[e]);return P.useEffect(()=>{t||f()},[f,t]),a.jsxs("div",{className:"flex w-full flex-col gap-6 p-2 md:p-6",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold",children:[a.jsx(hs,{className:"h-6 w-6 text-primary"}),"CUR Discovery"]}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Progress of the scheduled job that locates this tenant’s Cost and Usage Report table. Cost data becomes available after it reports Ready."})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(ar,{}),a.jsx("button",{onClick:()=>{f()},disabled:i||t,className:"rounded-lg border p-2 hover:bg-muted disabled:opacity-50","aria-label":"Refresh",children:a.jsx(Tt,{className:`h-4 w-4 ${i||t?"animate-spin":""}`})})]})]}),u&&a.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:[a.jsx(Be,{className:"h-4 w-4"}),u]}),!i&&!u&&!n.length&&a.jsx(ue,{children:a.jsx(de,{className:"py-10 text-center text-sm text-muted-foreground",children:"No discovery job exists for this tenant yet. One is created automatically once the AWS connection is verified and the Cost plugin is entitled."})}),n.map(l=>a.jsxs(ue,{children:[a.jsxs(Re,{className:"flex flex-row flex-wrap items-center gap-3",children:[a.jsx(ci,{className:"h-4 w-4 text-primary"}),a.jsxs(Pe,{className:"text-sm",children:["Management account ",l.managementAccountId]}),a.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:["connection ",l.connectionId]}),a.jsx(xm,{status:l.status}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:["attempt ",l.attemptCount]}),a.jsxs("span",{className:"ms-auto text-xs text-muted-foreground",children:["next check ",Nn(l.nextRunAt)]})]}),a.jsxs(de,{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[a.jsx(Yt,{label:"Region",value:l.region}),a.jsx(Yt,{label:"Glue database",value:l.database,mono:!0}),a.jsx(Yt,{label:"Discovered table",value:l.table,mono:!0}),a.jsx(Yt,{label:"Last data",value:Nn(l.lastDataAt)}),a.jsx(Yt,{label:"Last checked",value:Nn(l.lastFinishedAt||l.lastStartedAt)}),l.lastError&&a.jsx("div",{className:"md:col-span-2 lg:col-span-3 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:l.lastError})]})]},l.id)),n.length>0&&a.jsxs("section",{children:[a.jsx("h2",{className:"mb-3 text-sm font-semibold",children:"Recent activity"}),a.jsx("div",{className:"space-y-2",children:n.map(l=>{const h=s.filter(m=>m.jobId===l.id);return a.jsxs("details",{open:!0,className:"rounded-md border bg-card",children:[a.jsxs("summary",{className:"cursor-pointer px-4 py-3 text-sm font-medium",children:["Management account ",a.jsx("span",{className:"font-mono",children:l.managementAccountId})]}),a.jsx("div",{className:"border-t px-4 py-2",children:h.length?a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b text-left text-xs uppercase text-muted-foreground",children:[a.jsx("th",{className:"py-2 pe-4 font-medium",children:"Time"}),a.jsx("th",{className:"py-2 pe-4 font-medium",children:"Level"}),a.jsx("th",{className:"py-2 pe-4 font-medium",children:"Event"}),a.jsx("th",{className:"py-2 font-medium",children:"Message"})]})}),a.jsx("tbody",{children:h.map(m=>a.jsxs("tr",{className:"border-b last:border-0 align-top",children:[a.jsx("td",{className:"whitespace-nowrap py-2 pe-4 text-xs text-muted-foreground",children:Nn(m.createdAt)}),a.jsx("td",{className:`py-2 pe-4 text-xs font-medium ${gm[m.level]||""}`,children:m.level}),a.jsx("td",{className:"whitespace-nowrap py-2 pe-4 font-mono text-xs",children:m.event}),a.jsx("td",{className:"py-2",children:m.message})]},m.id))})]})}):a.jsx("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"No log entries recorded yet."})})]},l.id)})})]})]})}const ym=e=>e.launchUrl||`https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create?stackName=${encodeURIComponent(e.stackName||`MeyiConnect-${e.connectionId}-Management`)}`,vm=e=>e==="CONNECTED"?"border-emerald-500/30 bg-emerald-500/10 text-emerald-600":e==="FAILED"?"border-destructive/30 bg-destructive/10 text-destructive":"border-amber-500/30 bg-amber-500/10 text-amber-700",Jt=e=>{const t=e?.response?.data?.error||e?.response?.data?.message||e?.message||"Request failed",n=e?.response?.data?.details;return n?`${t} ${n}`:t};function wm(){const{selectManagementAccount:e,refreshSources:t}=Ut(),[n,r]=P.useState([]),[s,o]=P.useState(!1),[i,c]=P.useState(!0),[u,d]=P.useState(!1),[f,l]=P.useState(null),[h,m]=P.useState(null),[g,p]=P.useState(""),[x,b]=P.useState(!1),[y,v]=P.useState(null),[N,j]=P.useState(null),[k,C]=P.useState(null),R=P.useCallback(async()=>{c(!0),C(null);try{const O=await oe.getSources();r(O.sources||[]),o(O.allowMultipleSources===!0)}catch(O){C(Jt(O))}finally{c(!1)}},[]);P.useEffect(()=>{R()},[R]);const _=async O=>{if(O.preventDefault(),!/^\d{12}$/.test(g)){C("AWS account ID must contain exactly 12 digits");return}j("create"),C(null);try{const $=await oe.createSource({managementAccountId:g,regionMode:x?"ALL":"SINGLE"});$.managementAccountId&&e($.managementAccountId),await t(),v($.connectionId),d(!1),p(""),b(!1),await R()}catch($){C(Jt($))}finally{j(null)}},L=async O=>{j(`download-${O}`),C(null);try{const $=await oe.downloadSourceTemplate(O),J=URL.createObjectURL($),Y=document.createElement("a");Y.href=J,Y.download=`meyi-connect-cost-${O}.yaml`,Y.click(),URL.revokeObjectURL(J),v(O)}catch($){C(Jt($))}finally{j(null)}},A=async O=>{j(`verify-${O}`),C(null);try{const $=await oe.verifySource(O);$.status==="FAILED"&&C($.message||"AWS connection verification failed"),await R()}catch($){C(Jt($))}finally{j(null)}},D=async()=>{if(f){j(`remove-${f.connectionId}`),C(null);try{const O=await oe.removeSource(f.connectionId);l(null),m(O.awsCleanup??null),await R(),await t()}catch(O){C(Jt(O))}finally{j(null)}}};return a.jsxs("div",{className:"flex w-full flex-col gap-6 p-2 md:p-6",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold",children:[a.jsx(Jn,{className:"h-6 w-6 text-primary"}),"Cost Sources"]}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"AWS accounts connected to this tenant for Cost and Usage Report data."})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{type:"button",onClick:()=>{R()},disabled:i,className:"rounded-md border p-2 hover:bg-muted disabled:opacity-50","aria-label":"Refresh sources",title:"Refresh sources",children:a.jsx(Tt,{className:`h-4 w-4 ${i?"animate-spin":""}`})}),(s||n.length===0)&&a.jsxs("button",{type:"button",onClick:()=>{C(null),d(!0)},className:"flex items-center gap-2 rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground hover:opacity-90",children:[a.jsx(zf,{className:"h-4 w-4"}),"Add AWS account"]})]})]}),k&&a.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive",children:[a.jsx(Be,{className:"mt-0.5 h-4 w-4 shrink-0"}),k]}),!i&&n.length===0&&a.jsxs("div",{className:"rounded-md border border-dashed py-14 text-center",children:[a.jsx(Jn,{className:"mx-auto mb-3 h-8 w-8 text-muted-foreground"}),a.jsx("p",{className:"font-medium",children:"No AWS Cost source"}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Add an AWS account to begin collecting tenant cost data."})]}),n.length>0&&a.jsx("div",{className:"overflow-x-auto rounded-md border",children:a.jsxs("table",{className:"w-full min-w-[780px] text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b bg-muted/50 text-left text-xs uppercase text-muted-foreground",children:[a.jsx("th",{className:"px-4 py-3 font-medium",children:"AWS account"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Connection"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Scope"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Status"}),a.jsx("th",{className:"px-4 py-3 text-right font-medium",children:"Actions"})]})}),a.jsx("tbody",{children:n.map(O=>a.jsxs("tr",{className:`border-b last:border-0 ${y===O.connectionId?"bg-muted/30":""}`,children:[a.jsx("td",{className:"px-4 py-3 font-mono",children:O.managementAccountId||"Pending"}),a.jsx("td",{className:"px-4 py-3 font-mono text-xs",children:O.connectionId}),a.jsxs("td",{className:"px-4 py-3",children:[O.accountScope," / ",O.regionMode]}),a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("span",{className:`rounded-full border px-2 py-1 text-xs font-medium ${vm(O.status)}`,children:O.status.replace(/_/g," ")}),O.stackSetStatus&&a.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:O.stackSetStatus.replace(/_/g," ")}),O.status==="FAILED"&&O.failureReason&&a.jsx("div",{className:"mt-1 max-w-md text-xs text-destructive",children:O.failureReason})]}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx("button",{type:"button",onClick:()=>{L(O.connectionId)},disabled:!!N,className:"rounded-md border p-2 hover:bg-muted disabled:opacity-50",title:"Download CloudFormation template","aria-label":"Download CloudFormation template",children:N===`download-${O.connectionId}`?a.jsx(it,{className:"h-4 w-4 animate-spin"}):a.jsx(fs,{className:"h-4 w-4"})}),a.jsx("a",{href:ym(O),target:"_blank",rel:"noreferrer",className:"rounded-md border p-2 hover:bg-muted",title:`Open AWS CloudFormation as ${O.stackName||`MeyiConnect-${O.connectionId}-Management`}`,"aria-label":"Open AWS CloudFormation",children:a.jsx(ui,{className:"h-4 w-4"})}),a.jsxs("button",{type:"button",onClick:()=>{A(O.connectionId)},disabled:!!N||O.status==="CONNECTED",className:"flex items-center gap-2 rounded-md border px-3 py-2 font-medium hover:bg-muted disabled:opacity-50",children:[N===`verify-${O.connectionId}`?a.jsx(it,{className:"h-4 w-4 animate-spin"}):O.status==="CONNECTED"?a.jsx(Cf,{className:"h-4 w-4 text-emerald-600"}):a.jsx(Tt,{className:"h-4 w-4"}),O.status==="CONNECTED"?"Connected":"Verify"]}),a.jsx("button",{type:"button",onClick:()=>l(O),disabled:!!N,className:"rounded-md border p-2 text-destructive hover:bg-destructive/10 disabled:opacity-50",title:"Remove Cost source","aria-label":"Remove Cost source",children:a.jsx(mi,{className:"h-4 w-4"})})]})})]},O.connectionId))})]})}),u&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",role:"dialog","aria-modal":"true","aria-labelledby":"add-source-title",children:a.jsxs("form",{onSubmit:O=>{_(O)},className:"w-full max-w-md rounded-md border bg-background p-5 shadow-xl",children:[a.jsxs("div",{className:"flex items-center justify-between gap-4",children:[a.jsx("h2",{id:"add-source-title",className:"text-lg font-semibold",children:"Add AWS account"}),a.jsx("button",{type:"button",onClick:()=>d(!1),className:"rounded-md p-1 hover:bg-muted","aria-label":"Close",children:a.jsx(ft,{className:"h-4 w-4"})})]}),a.jsx("label",{className:"mt-5 block text-sm font-medium",htmlFor:"aws-account-id",children:"AWS account ID"}),a.jsx("input",{id:"aws-account-id",value:g,onChange:O=>p(O.target.value.replace(/\D/g,"").slice(0,12)),inputMode:"numeric",autoComplete:"off",placeholder:"123456789012",className:"mt-2 h-10 w-full rounded-md border bg-background px-3 font-mono outline-none focus:ring-2 focus:ring-ring"}),a.jsxs("label",{className:"mt-4 flex items-start gap-3 rounded-md border p-3",children:[a.jsx("input",{type:"checkbox",checked:x,onChange:O=>b(O.target.checked),className:"mt-1 h-4 w-4"}),a.jsxs("span",{children:[a.jsx("span",{className:"block text-sm font-medium",children:"All enabled AWS regions"}),a.jsx("span",{className:"block text-xs text-muted-foreground",children:"Use organization-wide StackSet deployment across enabled regions."})]})]}),a.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[a.jsx("button",{type:"button",onClick:()=>d(!1),className:"rounded-md border px-4 py-2 text-sm font-medium hover:bg-muted",children:"Cancel"}),a.jsxs("button",{type:"submit",disabled:N==="create"||g.length!==12,className:"flex items-center gap-2 rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground disabled:opacity-50",children:[N==="create"&&a.jsx(it,{className:"h-4 w-4 animate-spin"}),"Create source"]})]})]})}),f&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",role:"dialog","aria-modal":"true","aria-labelledby":"remove-source-title",children:a.jsxs("div",{className:"w-full max-w-md rounded-md border bg-background p-5 shadow-xl",children:[a.jsxs("div",{className:"flex items-center justify-between gap-4",children:[a.jsx("h2",{id:"remove-source-title",className:"text-lg font-semibold",children:"Remove Cost source"}),a.jsx("button",{type:"button",onClick:()=>l(null),disabled:!!N,className:"rounded-md p-1 hover:bg-muted","aria-label":"Close",children:a.jsx(ft,{className:"h-4 w-4"})})]}),a.jsxs("p",{className:"mt-4 text-sm",children:["Remove AWS account ",a.jsx("span",{className:"font-mono font-medium",children:f.managementAccountId})," from this tenant?"]}),a.jsx("p",{className:"mt-3 text-xs text-muted-foreground",children:"Meyi Connect has no permission to change your AWS account, so the CloudFormation stacks stay until you delete them. You will see their names after removal. CUR data already delivered to Meyi Connect is retained."}),a.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[a.jsx("button",{type:"button",onClick:()=>l(null),disabled:!!N,className:"rounded-md border px-4 py-2 text-sm font-medium hover:bg-muted",children:"Cancel"}),a.jsxs("button",{type:"button",onClick:()=>{D()},disabled:!!N,className:"flex items-center gap-2 rounded-md bg-destructive px-4 py-2 text-sm font-medium text-destructive-foreground disabled:opacity-50",children:[N===`remove-${f.connectionId}`&&a.jsx(it,{className:"h-4 w-4 animate-spin"}),"Remove"]})]})]})}),h&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",role:"dialog","aria-modal":"true","aria-labelledby":"cleanup-title",children:a.jsxs("div",{className:"w-full max-w-md rounded-md border bg-background p-5 shadow-xl",children:[a.jsxs("div",{className:"flex items-center justify-between gap-4",children:[a.jsx("h2",{id:"cleanup-title",className:"text-lg font-semibold",children:"Delete the AWS resources"}),a.jsx("button",{type:"button",onClick:()=>m(null),className:"rounded-md p-1 hover:bg-muted","aria-label":"Close",children:a.jsx(ft,{className:"h-4 w-4"})})]}),a.jsxs("p",{className:"mt-4 text-sm",children:["The source is removed. In your AWS management account, CloudFormation console, region ",a.jsx("span",{className:"font-mono",children:h.region}),":"]}),a.jsxs("ol",{className:"mt-3 list-decimal space-y-2 pl-5 text-sm",children:[h.membersStackName?a.jsxs("li",{children:["Stacks: delete ",a.jsx("span",{className:"font-mono",children:h.membersStackName}),". This removes the member StackSet and its stack instances."]}):h.stackSetName&&a.jsxs("li",{children:["StackSets: open ",a.jsx("span",{className:"font-mono",children:h.stackSetName}),", delete its stack instances, then delete the StackSet."]}),a.jsxs("li",{children:["Stacks: delete ",a.jsx("span",{className:"font-mono",children:h.managementStackName}),"."]})]}),a.jsx("div",{className:"mt-5 flex justify-end",children:a.jsx("button",{type:"button",onClick:()=>m(null),className:"rounded-md border px-4 py-2 text-sm font-medium hover:bg-muted",children:"Done"})})]})})]})}const Sm=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Rm=[10,20,50],Nm=["UTC","Asia/Kolkata","America/New_York","America/Los_Angeles","Europe/London","Europe/Berlin","Asia/Singapore","Asia/Tokyo","Australia/Sydney"];function Cm({open:e,schedule:t,saving:n,onClose:r,onSave:s}){const[o,i]=P.useState(t);if(P.useEffect(()=>i(t),[t,e]),!e)return null;const c=u=>i(d=>({...d,frequency:u}));return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/55 p-4",role:"presentation",onMouseDown:u=>{u.target===u.currentTarget&&r()},children:a.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"cost-ai-schedule-title",className:"w-full max-w-lg overflow-hidden rounded-lg border bg-background shadow-xl",children:[a.jsxs("div",{className:"flex items-start justify-between border-b px-5 py-4",children:[a.jsxs("div",{children:[a.jsxs("h2",{id:"cost-ai-schedule-title",className:"flex items-center gap-2 text-base font-semibold",children:[a.jsx(ii,{className:"h-4 w-4 text-primary"}),"AI report schedule"]}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Reports run automatically against completed AWS CUR periods."})]}),a.jsx("button",{type:"button",onClick:r,className:"rounded-md p-1.5 hover:bg-muted","aria-label":"Close",children:a.jsx(ft,{className:"h-4 w-4"})})]}),a.jsxs("form",{className:"space-y-5 p-5",onSubmit:u=>{u.preventDefault(),s({enabled:o.enabled,frequency:o.frequency,time:o.time,timezone:o.timezone,dayOfWeek:o.dayOfWeek,dayOfMonth:o.dayOfMonth,ticketLimit:o.ticketLimit??10}).then(r)},children:[a.jsxs("label",{className:"flex items-center justify-between gap-4 rounded-lg border p-3",children:[a.jsxs("span",{children:[a.jsx("span",{className:"block text-sm font-medium",children:"Scheduled reports"}),a.jsx("span",{className:"block text-xs text-muted-foreground",children:"Generate reports without a manual action"})]}),a.jsx("input",{type:"checkbox",checked:o.enabled,onChange:u=>i(d=>({...d,enabled:u.target.checked})),className:"h-4 w-4 accent-primary"})]}),a.jsxs("fieldset",{disabled:!o.enabled||n,className:"space-y-5 disabled:opacity-60",children:[a.jsxs("div",{children:[a.jsx("span",{className:"mb-2 block text-sm font-medium",children:"Frequency"}),a.jsx("div",{className:"grid grid-cols-3 rounded-lg border p-1",children:["daily","weekly","monthly"].map(u=>a.jsx("button",{type:"button",onClick:()=>c(u),className:`rounded-md px-3 py-2 text-sm capitalize ${o.frequency===u?"bg-primary text-primary-foreground":"hover:bg-muted"}`,children:u},u))})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("label",{className:"text-sm font-medium",children:["Run time",a.jsx("input",{type:"time",required:!0,value:o.time,onChange:u=>i(d=>({...d,time:u.target.value})),className:"mt-2 block h-10 w-full rounded-lg border bg-background px-3 font-normal"})]}),a.jsxs("label",{className:"text-sm font-medium",children:["Timezone",a.jsx("select",{value:o.timezone,onChange:u=>i(d=>({...d,timezone:u.target.value})),className:"mt-2 block h-10 w-full rounded-lg border bg-background px-3 font-normal",children:[...new Set([o.timezone,...Nm])].map(u=>a.jsx("option",{children:u},u))})]})]}),o.frequency==="weekly"&&a.jsxs("label",{className:"block text-sm font-medium",children:["Day of week",a.jsx("select",{value:o.dayOfWeek??1,onChange:u=>i(d=>({...d,dayOfWeek:Number(u.target.value)})),className:"mt-2 block h-10 w-full rounded-lg border bg-background px-3 font-normal",children:Sm.map((u,d)=>a.jsx("option",{value:d,children:u},u))})]}),o.frequency==="monthly"&&a.jsxs("label",{className:"block text-sm font-medium",children:["Day of month",a.jsx("input",{type:"number",min:1,max:28,value:o.dayOfMonth??1,onChange:u=>i(d=>({...d,dayOfMonth:Number(u.target.value)})),className:"mt-2 block h-10 w-full rounded-lg border bg-background px-3 font-normal"})]}),a.jsxs("div",{role:"radiogroup","aria-labelledby":"cost-ai-ticket-limit-label",children:[a.jsx("span",{id:"cost-ai-ticket-limit-label",className:"mb-2 block text-sm font-medium",children:"Tasks per report"}),a.jsx("div",{className:"grid grid-cols-3 rounded-lg border p-1",children:Rm.map(u=>a.jsxs("button",{type:"button",role:"radio","aria-checked":(o.ticketLimit??10)===u,onClick:()=>i(d=>({...d,ticketLimit:u})),className:`rounded-md px-3 py-2 text-sm ${(o.ticketLimit??10)===u?"bg-primary text-primary-foreground":"hover:bg-muted"}`,children:["Top ",u]},u))}),a.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"Each report creates at most this many tasks, highest priority and savings first."})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Daily reports cover the previous day, weekly reports the previous seven complete days, and monthly reports the previous calendar month."})]}),a.jsxs("div",{className:"flex justify-end gap-2 border-t pt-4",children:[a.jsx("button",{type:"button",onClick:r,className:"rounded-lg border px-4 py-2 text-sm font-medium hover:bg-muted",children:"Cancel"}),a.jsx("button",{type:"submit",disabled:n,className:"rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground disabled:opacity-50",children:n?"Saving":"Save schedule"})]})]})]})})}function Xe(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e?.(s),n===!1||!s||!s.defaultPrevented)return t?.(s)}}function Lo(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function jm(...e){return t=>{let n=!1;const r=e.map(s=>{const o=Lo(s,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let s=0;s<r.length;s++){const o=r[s];typeof o=="function"?o():Lo(e[s],null)}}}}function bt(...e){return S.useCallback(jm(...e),e)}function Em(e,t=[]){let n=[];function r(o,i){const c=S.createContext(i);c.displayName=o+"Context";const u=n.length;n=[...n,i];const d=l=>{const{scope:h,children:m,...g}=l,p=h?.[e]?.[u]||c,x=S.useMemo(()=>g,Object.values(g));return a.jsx(p.Provider,{value:x,children:m})};d.displayName=o+"Provider";function f(l,h,m={}){const{optional:g=!1}=m,p=h?.[e]?.[u]||c,x=S.useContext(p);if(x)return x;if(i!==void 0)return i;if(!g)throw new Error(`\`${l}\` must be used within \`${o}\``)}return[d,f]}const s=()=>{const o=n.map(i=>S.createContext(i));return function(c){const u=c?.[e]||o;return S.useMemo(()=>({[`__scope${e}`]:{...c,[e]:u}}),[c,u])}};return s.scopeName=e,[r,km(s,...t)]}function km(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const i=r.reduce((c,{useScope:u,scopeName:d})=>{const l=u(o)[`__scope${d}`];return{...c,...l}},{});return S.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var sn=globalThis?.document?S.useLayoutEffect:()=>{},_m=S[" useId ".trim().toString()]||(()=>{}),Pm=0;function Pr(e){const[t,n]=S.useState(_m());return sn(()=>{n(r=>r??String(Pm++))},[e]),e||(t?`radix-${t}`:"")}var Am=S[" useInsertionEffect ".trim().toString()]||sn;function Om({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,o,i]=Tm({defaultProp:t,onChange:n}),c=e!==void 0,u=c?e:s;{const f=S.useRef(e!==void 0);S.useEffect(()=>{const l=f.current;l!==c&&console.warn(`${r} is changing from ${l?"controlled":"uncontrolled"} to ${c?"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.`),f.current=c},[c,r])}const d=S.useCallback(f=>{if(c){const l=Lm(f)?f(e):f;l!==e&&i.current?.(l)}else o(f)},[c,e,o,i]);return[u,d]}function Tm({defaultProp:e,onChange:t}){const[n,r]=S.useState(e),s=S.useRef(n),o=S.useRef(t);return Am(()=>{o.current=t},[t]),S.useEffect(()=>{s.current!==n&&(o.current?.(n),s.current=n)},[n,s]),[n,r,o]}function Lm(e){return typeof e=="function"}function Mi(e){const t=S.forwardRef((n,r)=>{let{children:s,...o}=n,i=null,c=!1;const u=[];Io(s)&&typeof Cn=="function"&&(s=Cn(s._payload)),S.Children.forEach(s,h=>{if(Um(h)){c=!0;const m=h;let g="child"in m.props?m.props.child:m.props.children;Io(g)&&typeof Cn=="function"&&(g=Cn(g._payload)),i=Mm(m,g),u.push(i?.props?.children)}else u.push(h)}),i?i=S.cloneElement(i,void 0,u):!c&&S.Children.count(s)===1&&S.isValidElement(s)&&(i=s);const d=i?Fm(i):void 0,f=bt(r,d);if(!i){if(s||s===0)throw new Error(c?Wm(e):zm(e));return s}const l=Dm(o,i.props??{});return i.type!==S.Fragment&&(l.ref=r?f:d),S.cloneElement(i,l)});return t.displayName=`${e}.Slot`,t}var Im=Symbol.for("radix.slottable"),Mm=(e,t)=>{if("child"in e.props){const n=e.props.child;return S.isValidElement(n)?S.cloneElement(n,void 0,e.props.children(n.props.children)):null}return S.isValidElement(t)?t:null};function Dm(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...c)=>{const u=o(...c);return s(...c),u}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function Fm(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Um(e){return S.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Im}var $m=Symbol.for("react.lazy");function Io(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===$m&&"_payload"in e&&Bm(e._payload)}function Bm(e){return typeof e=="object"&&e!==null&&"then"in e}var zm=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,Wm=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,Cn=S[" use ".trim().toString()],Vm=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ze=Vm.reduce((e,t)=>{const n=Mi(`Primitive.${t}`),r=S.forwardRef((s,o)=>{const{asChild:i,...c}=s,u=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(u,{...c,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Hm(e,t){e&&ea.flushSync(()=>e.dispatchEvent(t))}function on(e){const t=S.useRef(e);return S.useEffect(()=>{t.current=e}),S.useMemo(()=>((...n)=>t.current?.(...n)),[])}var qm="DismissableLayer",Xr="dismissableLayer.update",Gm="dismissableLayer.pointerDownOutside",Km="dismissableLayer.focusOutside",Mo,gs=S.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Di=S.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:c,onDismiss:u,...d}=e,f=S.useContext(gs),[l,h]=S.useState(null),m=l?.ownerDocument??globalThis?.document,[,g]=S.useState({}),p=bt(t,h),x=Array.from(f.layers),[b]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),y=b?x.indexOf(b):-1,v=l?x.indexOf(l):-1,N=f.layersWithOutsidePointerEventsDisabled.size>0,j=v>=y,k=S.useRef(!1),C=Qm(A=>{o?.(A),c?.(A),A.defaultPrevented||u?.()},{ownerDocument:m,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:k,dismissableSurfaces:f.dismissableSurfaces,shouldHandlePointerDownOutside:S.useCallback(A=>{if(!(A instanceof Node))return!1;const D=[...f.branches].some(O=>O.contains(A));return j&&!D},[f.branches,j])}),R=ep(A=>{if(r&&k.current)return;const D=A.target;[...f.branches].some($=>$.contains(D))||(i?.(A),c?.(A),A.defaultPrevented||u?.())},m),_=l?v===x.length-1:!1,L=on(A=>{A.key==="Escape"&&(s?.(A),!A.defaultPrevented&&u&&(A.preventDefault(),u()))});return S.useEffect(()=>{if(_)return m.addEventListener("keydown",L,{capture:!0}),()=>m.removeEventListener("keydown",L,{capture:!0})},[m,_,L]),S.useEffect(()=>{if(l)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(Mo=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(l)),f.layers.add(l),Do(),()=>{n&&(f.layersWithOutsidePointerEventsDisabled.delete(l),f.layersWithOutsidePointerEventsDisabled.size===0&&(m.body.style.pointerEvents=Mo))}},[l,m,n,f]),S.useEffect(()=>()=>{l&&(f.layers.delete(l),f.layersWithOutsidePointerEventsDisabled.delete(l),Do())},[l,f]),S.useEffect(()=>{const A=()=>g({});return document.addEventListener(Xr,A),()=>document.removeEventListener(Xr,A)},[]),a.jsx(ze.div,{...d,ref:p,style:{pointerEvents:N?j?"auto":"none":void 0,...e.style},onFocusCapture:Xe(e.onFocusCapture,R.onFocusCapture),onBlurCapture:Xe(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:Xe(e.onPointerDownCapture,C.onPointerDownCapture)})});Di.displayName=qm;var Ym="DismissableLayerBranch",Jm=S.forwardRef((e,t)=>{const n=S.useContext(gs),r=S.useRef(null),s=bt(t,r);return S.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),a.jsx(ze.div,{...e,ref:s})});Jm.displayName=Ym;function Xm(){const e=S.useContext(gs),[t,n]=S.useState(null);return S.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}var Zm=()=>!0;function Qm(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:o,shouldHandlePointerDownOutside:i=Zm}=t,c=on(e),u=S.useRef(!1),d=S.useRef(!1),f=S.useRef(new Map),l=S.useRef(()=>{});return S.useEffect(()=>{function h(){d.current=!1,s.current=!1,f.current.clear()}function m(){return Array.from(f.current.values()).some(Boolean)}function g(v){if(!d.current)return;const N=v.target;N instanceof Node&&[...o].some(k=>k.contains(N))||f.current.set(v.type,!0),v.type==="click"&&window.setTimeout(()=>{d.current&&l.current()},0)}function p(v){d.current&&f.current.set(v.type,!1)}const x=v=>{if(v.target&&!u.current){let N=function(){n.removeEventListener("click",l.current);const k=m();h(),k||Fi(Gm,c,j,{discrete:!0})};if(!i(v.target)){n.removeEventListener("click",l.current),h(),u.current=!1;return}const j={originalEvent:v};d.current=!0,s.current=r&&v.button===0,f.current.clear(),!r||v.button!==0?N():(n.removeEventListener("click",l.current),l.current=N,n.addEventListener("click",l.current,{once:!0}))}else n.removeEventListener("click",l.current),h();u.current=!1},b=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const v of b)n.addEventListener(v,g,!0),n.addEventListener(v,p);const y=window.setTimeout(()=>{n.addEventListener("pointerdown",x)},0);return()=>{window.clearTimeout(y),n.removeEventListener("pointerdown",x),n.removeEventListener("click",l.current);for(const v of b)n.removeEventListener(v,g,!0),n.removeEventListener(v,p)}},[n,c,r,s,o,i]),{onPointerDownCapture:()=>u.current=!0}}function ep(e,t=globalThis?.document){const n=on(e),r=S.useRef(!1);return S.useEffect(()=>{const s=o=>{o.target&&!r.current&&Fi(Km,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Do(){const e=new CustomEvent(Xr);document.dispatchEvent(e)}function Fi(e,t,n,{discrete:r}){const s=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?Hm(s,o):s.dispatchEvent(o)}var Ar="focusScope.autoFocusOnMount",Or="focusScope.autoFocusOnUnmount",Fo={bubbles:!1,cancelable:!0},tp="FocusScope",Ui=S.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...i}=e,[c,u]=S.useState(null),d=on(s),f=on(o),l=S.useRef(null),h=bt(t,u),m=S.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;S.useEffect(()=>{if(r){let p=function(v){if(m.paused||!c)return;const N=v.target;c.contains(N)?l.current=N:He(l.current,{select:!0})},x=function(v){if(m.paused||!c)return;const N=v.relatedTarget;N!==null&&(c.contains(N)||He(l.current,{select:!0}))},b=function(v){if(document.activeElement===document.body)for(const j of v)j.removedNodes.length>0&&He(c)};document.addEventListener("focusin",p),document.addEventListener("focusout",x);const y=new MutationObserver(b);return c&&y.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",x),y.disconnect()}}},[r,c,m.paused]),S.useEffect(()=>{if(c){$o.add(m);const p=document.activeElement;if(!c.contains(p)){const b=new CustomEvent(Ar,Fo);c.addEventListener(Ar,d),c.dispatchEvent(b),b.defaultPrevented||(np(ip($i(c)),{select:!0}),document.activeElement===p&&He(c))}return()=>{c.removeEventListener(Ar,d),setTimeout(()=>{const b=new CustomEvent(Or,Fo);c.addEventListener(Or,f),c.dispatchEvent(b),b.defaultPrevented||He(p??document.body,{select:!0}),c.removeEventListener(Or,f),$o.remove(m)},0)}}},[c,d,f,m]);const g=S.useCallback(p=>{if(!n&&!r||m.paused)return;const x=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,b=document.activeElement;if(x&&b){const y=p.currentTarget,[v,N]=rp(y);v&&N?!p.shiftKey&&b===N?(p.preventDefault(),n&&He(v,{select:!0})):p.shiftKey&&b===v&&(p.preventDefault(),n&&He(N,{select:!0})):b===y&&p.preventDefault()}},[n,r,m.paused]);return a.jsx(ze.div,{tabIndex:-1,...i,ref:h,onKeyDown:g})});Ui.displayName=tp;function np(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(He(r,{select:t}),document.activeElement!==n)return}function rp(e){const t=$i(e),n=Uo(t,e),r=Uo(t.reverse(),e);return[n,r]}function $i(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Uo(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):sp(r,{upTo:t})))return r}function sp(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 op(e){return e instanceof HTMLInputElement&&"select"in e}function He(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&op(e)&&t&&e.select()}}var $o=ap();function ap(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Bo(e,t),e.unshift(t)},remove(t){e=Bo(e,t),e[0]?.resume()}}}function Bo(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function ip(e){return e.filter(t=>t.tagName!=="A")}var cp="Portal",Bi=S.forwardRef((e,t)=>{const{container:n,...r}=e,[s,o]=S.useState(!1);sn(()=>o(!0),[]);const i=n||s&&globalThis?.document?.body;return i?ea.createPortal(a.jsx(ze.div,{...r,ref:t}),i):null});Bi.displayName=cp;function lp(e,t){return S.useReducer((n,r)=>t[n][r]??n,e)}var ir=e=>{const{present:t,children:n}=e,r=up(t),s=typeof n=="function"?n({present:r.isPresent}):S.Children.only(n),o=dp(r.ref,fp(s));return typeof n=="function"||r.isPresent?S.cloneElement(s,{ref:o}):null};ir.displayName="Presence";function up(e){const[t,n]=S.useState(),r=S.useRef(null),s=S.useRef(e),o=S.useRef("none"),i=S.useRef(void 0),c=e?"mounted":"unmounted",[u,d]=lp(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return S.useEffect(()=>{u==="mounted"?(o.current=i.current??Xt(r.current),i.current=void 0):o.current="none"},[u]),sn(()=>{const f=r.current,l=s.current;if(l!==e){const m=o.current,g=Xt(f);e?(i.current=g,d("MOUNT")):g==="none"||f?.display==="none"?d("UNMOUNT"):d(l&&m!==g?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,d]),sn(()=>{if(t){let f;const l=t.ownerDocument.defaultView??window,h=g=>{const x=Xt(r.current).includes(CSS.escape(g.animationName));if(g.target===t&&x&&(d("ANIMATION_END"),!s.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",f=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},m=g=>{g.target===t&&(o.current=Xt(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{l.clearTimeout(f),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:S.useCallback(f=>{if(f){const l=getComputedStyle(f);r.current=l,i.current=Xt(l)}else r.current=null;n(f)},[])}}function zo(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function dp(...e){const t=S.useRef(e);return t.current=e,S.useCallback(n=>{const r=t.current;let s=!1;const o=r.map(i=>{const c=zo(i,n);return!s&&typeof c=="function"&&(s=!0),c});if(s)return()=>{for(let i=0;i<o.length;i++){const c=o[i];typeof c=="function"?c():zo(r[i],null)}}},[])}function Xt(e){return e?.animationName||"none"}function fp(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var jn=0,wt=null;function hp(){S.useEffect(()=>{wt||(wt={start:Wo(),end:Wo()});const{start:e,end:t}=wt;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),jn++,()=>{jn===1&&(wt?.start.remove(),wt?.end.remove(),wt=null),jn=Math.max(0,jn-1)}},[])}function Wo(){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 De=function(){return De=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},De.apply(this,arguments)};function zi(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]]);return n}function mp(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,o;r<s;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var Fn="right-scroll-bar-position",Un="width-before-scroll-bar",pp="with-scroll-bars-hidden",gp="--removed-body-scroll-bar-size";function Tr(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function xp(e,t){var n=P.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=t,n.facade}var bp=typeof window<"u"?S.useLayoutEffect:S.useEffect,Vo=new WeakMap;function yp(e,t){var n=xp(null,function(r){return e.forEach(function(s){return Tr(s,r)})});return bp(function(){var r=Vo.get(n);if(r){var s=new Set(r),o=new Set(e),i=n.current;s.forEach(function(c){o.has(c)||Tr(c,null)}),o.forEach(function(c){s.has(c)||Tr(c,i)})}Vo.set(n,e)},[e]),n}function vp(e){return e}function wp(e,t){t===void 0&&(t=vp);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var i=t(o,r);return n.push(i),function(){n=n.filter(function(c){return c!==i})}},assignSyncMedium:function(o){for(r=!0;n.length;){var i=n;n=[],i.forEach(o)}n={push:function(c){return o(c)},filter:function(){return n}}},assignMedium:function(o){r=!0;var i=[];if(n.length){var c=n;n=[],c.forEach(o),i=n}var u=function(){var f=i;i=[],f.forEach(o)},d=function(){return Promise.resolve().then(u)};d(),n={push:function(f){i.push(f),d()},filter:function(f){return i=i.filter(f),n}}}};return s}function Sp(e){e===void 0&&(e={});var t=wp(null);return t.options=De({async:!0,ssr:!1},e),t}var Wi=function(e){var t=e.sideCar,n=zi(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return S.createElement(r,De({},n))};Wi.isSideCarExport=!0;function Rp(e,t){return e.useMedium(t),Wi}var Vi=Sp(),Lr=function(){},cr=S.forwardRef(function(e,t){var n=S.useRef(null),r=S.useState({onScrollCapture:Lr,onWheelCapture:Lr,onTouchMoveCapture:Lr}),s=r[0],o=r[1],i=e.forwardProps,c=e.children,u=e.className,d=e.removeScrollBar,f=e.enabled,l=e.shards,h=e.sideCar,m=e.noRelative,g=e.noIsolation,p=e.inert,x=e.allowPinchZoom,b=e.as,y=b===void 0?"div":b,v=e.gapMode,N=zi(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),j=h,k=yp([n,t]),C=De(De({},N),s);return S.createElement(S.Fragment,null,f&&S.createElement(j,{sideCar:Vi,removeScrollBar:d,shards:l,noRelative:m,noIsolation:g,inert:p,setCallbacks:o,allowPinchZoom:!!x,lockRef:n,gapMode:v}),i?S.cloneElement(S.Children.only(c),De(De({},C),{ref:k})):S.createElement(y,De({},C,{className:u,ref:k}),c))});cr.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};cr.classNames={fullWidth:Un,zeroRight:Fn};var Np=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Cp(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Np();return t&&e.setAttribute("nonce",t),e}function jp(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Ep(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var kp=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Cp())&&(jp(t,n),Ep(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},_p=function(){var e=kp();return function(t,n){S.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Hi=function(){var e=_p(),t=function(n){var r=n.styles,s=n.dynamic;return e(r,s),null};return t},Pp={left:0,top:0,right:0,gap:0},Ir=function(e){return parseInt(e||"",10)||0},Ap=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[Ir(n),Ir(r),Ir(s)]},Op=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Pp;var t=Ap(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Tp=Hi(),_t="data-scroll-locked",Lp=function(e,t,n,r){var s=e.left,o=e.top,i=e.right,c=e.gap;return n===void 0&&(n="margin"),`
22
22
  .`.concat(pp,` {
23
23
  overflow: hidden `).concat(r,`;
24
24
  padding-right: `).concat(c,"px ").concat(r,`;
25
25
  }
26
- body[`).concat(Pt,`] {
26
+ body[`).concat(_t,`] {
27
27
  overflow: hidden `).concat(r,`;
28
28
  overscroll-behavior: contain;
29
29
  `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
@@ -52,10 +52,10 @@ ${X(t.amount,"USD")}`).join(`
52
52
  margin-right: 0 `).concat(r,`;
53
53
  }
54
54
 
55
- body[`).concat(Pt,`] {
55
+ body[`).concat(_t,`] {
56
56
  `).concat(gp,": ").concat(c,`px;
57
57
  }
58
- `)},Ho=function(){var e=parseInt(document.body.getAttribute(Pt)||"0",10);return isFinite(e)?e:0},Ip=function(){S.useEffect(function(){return document.body.setAttribute(Pt,(Ho()+1).toString()),function(){var e=Ho()-1;e<=0?document.body.removeAttribute(Pt):document.body.setAttribute(Pt,e.toString())}},[])},Mp=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;Ip();var o=S.useMemo(function(){return Op(s)},[s]);return S.createElement(Tp,{styles:Lp(o,!t,s,n?"":"!important")})},Zr=!1;if(typeof window<"u")try{var En=Object.defineProperty({},"passive",{get:function(){return Zr=!0,!0}});window.addEventListener("test",En,En),window.removeEventListener("test",En,En)}catch{Zr=!1}var Rt=Zr?{passive:!1}:!1,Dp=function(e){return e.tagName==="TEXTAREA"},qi=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Dp(e)&&n[t]==="visible")},Fp=function(e){return qi(e,"overflowY")},Up=function(e){return qi(e,"overflowX")},qo=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=Gi(e,r);if(s){var o=Ki(e,r),i=o[1],c=o[2];if(i>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},$p=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Bp=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Gi=function(e,t){return e==="v"?Fp(t):Up(t)},Ki=function(e,t){return e==="v"?$p(t):Bp(t)},zp=function(e,t){return e==="h"&&t==="rtl"?-1:1},Wp=function(e,t,n,r,s){var o=zp(e,window.getComputedStyle(t).direction),i=o*r,c=n.target,u=t.contains(c),d=!1,f=i>0,l=0,h=0;do{if(!c)break;var m=Ki(e,c),g=m[0],p=m[1],x=m[2],b=p-x-o*g;(g||b)&&Gi(e,c)&&(l+=b,h+=g);var y=c.parentNode;c=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!u&&c!==document.body||u&&(t.contains(c)||t===c));return(f&&Math.abs(l)<1||!f&&Math.abs(h)<1)&&(d=!0),d},kn=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Go=function(e){return[e.deltaX,e.deltaY]},Ko=function(e){return e&&"current"in e?e.current:e},Vp=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Hp=function(e){return`
58
+ `)},Ho=function(){var e=parseInt(document.body.getAttribute(_t)||"0",10);return isFinite(e)?e:0},Ip=function(){S.useEffect(function(){return document.body.setAttribute(_t,(Ho()+1).toString()),function(){var e=Ho()-1;e<=0?document.body.removeAttribute(_t):document.body.setAttribute(_t,e.toString())}},[])},Mp=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;Ip();var o=S.useMemo(function(){return Op(s)},[s]);return S.createElement(Tp,{styles:Lp(o,!t,s,n?"":"!important")})},Zr=!1;if(typeof window<"u")try{var En=Object.defineProperty({},"passive",{get:function(){return Zr=!0,!0}});window.addEventListener("test",En,En),window.removeEventListener("test",En,En)}catch{Zr=!1}var St=Zr?{passive:!1}:!1,Dp=function(e){return e.tagName==="TEXTAREA"},qi=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Dp(e)&&n[t]==="visible")},Fp=function(e){return qi(e,"overflowY")},Up=function(e){return qi(e,"overflowX")},qo=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=Gi(e,r);if(s){var o=Ki(e,r),i=o[1],c=o[2];if(i>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},$p=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Bp=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Gi=function(e,t){return e==="v"?Fp(t):Up(t)},Ki=function(e,t){return e==="v"?$p(t):Bp(t)},zp=function(e,t){return e==="h"&&t==="rtl"?-1:1},Wp=function(e,t,n,r,s){var o=zp(e,window.getComputedStyle(t).direction),i=o*r,c=n.target,u=t.contains(c),d=!1,f=i>0,l=0,h=0;do{if(!c)break;var m=Ki(e,c),g=m[0],p=m[1],x=m[2],b=p-x-o*g;(g||b)&&Gi(e,c)&&(l+=b,h+=g);var y=c.parentNode;c=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!u&&c!==document.body||u&&(t.contains(c)||t===c));return(f&&Math.abs(l)<1||!f&&Math.abs(h)<1)&&(d=!0),d},kn=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Go=function(e){return[e.deltaX,e.deltaY]},Ko=function(e){return e&&"current"in e?e.current:e},Vp=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Hp=function(e){return`
59
59
  .block-interactivity-`.concat(e,` {pointer-events: none;}
60
60
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
61
- `)},qp=0,Nt=[];function Gp(e){var t=S.useRef([]),n=S.useRef([0,0]),r=S.useRef(),s=S.useState(qp++)[0],o=S.useState(Hi)[0],i=S.useRef(e);S.useEffect(function(){i.current=e},[e]),S.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var p=mp([e.lockRef.current],(e.shards||[]).map(Ko),!0).filter(Boolean);return p.forEach(function(x){return x.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),p.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var c=S.useCallback(function(p,x){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!i.current.allowPinchZoom;var b=kn(p),y=n.current,v="deltaX"in p?p.deltaX:y[0]-b[0],N="deltaY"in p?p.deltaY:y[1]-b[1],j,k=p.target,C=Math.abs(v)>Math.abs(N)?"h":"v";if("touches"in p&&C==="h"&&k.type==="range")return!1;var R=window.getSelection(),_=R&&R.anchorNode,L=_?_===k||_.contains(k):!1;if(L)return!1;var A=qo(C,k);if(!A)return!0;if(A?j=C:(j=C==="v"?"h":"v",A=qo(C,k)),!A)return!1;if(!r.current&&"changedTouches"in p&&(v||N)&&(r.current=j),!j)return!0;var D=r.current||j;return Wp(D,x,p,D==="h"?v:N)},[]),u=S.useCallback(function(p){var x=p;if(!(!Nt.length||Nt[Nt.length-1]!==o)){var b="deltaY"in x?Go(x):kn(x),y=t.current.filter(function(j){return j.name===x.type&&(j.target===x.target||x.target===j.shadowParent)&&Vp(j.delta,b)})[0];if(y&&y.should){x.cancelable&&x.preventDefault();return}if(!y){var v=(i.current.shards||[]).map(Ko).filter(Boolean).filter(function(j){return j.contains(x.target)}),N=v.length>0?c(x,v[0]):!i.current.noIsolation;N&&x.cancelable&&x.preventDefault()}}},[]),d=S.useCallback(function(p,x,b,y){var v={name:p,delta:x,target:b,should:y,shadowParent:Kp(b)};t.current.push(v),setTimeout(function(){t.current=t.current.filter(function(N){return N!==v})},1)},[]),f=S.useCallback(function(p){n.current=kn(p),r.current=void 0},[]),l=S.useCallback(function(p){d(p.type,Go(p),p.target,c(p,e.lockRef.current))},[]),h=S.useCallback(function(p){d(p.type,kn(p),p.target,c(p,e.lockRef.current))},[]);S.useEffect(function(){return Nt.push(o),e.setCallbacks({onScrollCapture:l,onWheelCapture:l,onTouchMoveCapture:h}),document.addEventListener("wheel",u,Rt),document.addEventListener("touchmove",u,Rt),document.addEventListener("touchstart",f,Rt),function(){Nt=Nt.filter(function(p){return p!==o}),document.removeEventListener("wheel",u,Rt),document.removeEventListener("touchmove",u,Rt),document.removeEventListener("touchstart",f,Rt)}},[]);var m=e.removeScrollBar,g=e.inert;return S.createElement(S.Fragment,null,g?S.createElement(o,{styles:Hp(s)}):null,m?S.createElement(Mp,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Kp(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Yp=Rp(Vi,Gp);var Yi=S.forwardRef(function(e,t){return S.createElement(cr,De({},e,{ref:t,sideCar:Yp}))});Yi.classNames=cr.classNames;var Jp=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ct=new WeakMap,_n=new WeakMap,Pn={},Mr=0,Ji=function(e){return e&&(e.host||Ji(e.parentNode))},Xp=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Ji(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Zp=function(e,t,n,r){var s=Xp(t,Array.isArray(e)?e:[e]);Pn[n]||(Pn[n]=new WeakMap);var o=Pn[n],i=[],c=new Set,u=new Set(s),d=function(l){!l||c.has(l)||(c.add(l),d(l.parentNode))};s.forEach(d);var f=function(l){!l||u.has(l)||Array.prototype.forEach.call(l.children,function(h){if(c.has(h))f(h);else try{var m=h.getAttribute(r),g=m!==null&&m!=="false",p=(Ct.get(h)||0)+1,x=(o.get(h)||0)+1;Ct.set(h,p),o.set(h,x),i.push(h),p===1&&g&&_n.set(h,!0),x===1&&h.setAttribute(n,"true"),g||h.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",h,b)}})};return f(t),c.clear(),Mr++,function(){i.forEach(function(l){var h=Ct.get(l)-1,m=o.get(l)-1;Ct.set(l,h),o.set(l,m),h||(_n.has(l)||l.removeAttribute(r),_n.delete(l)),m||l.removeAttribute(n)}),Mr--,Mr||(Ct=new WeakMap,Ct=new WeakMap,_n=new WeakMap,Pn={})}},Qp=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=Jp(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),Zp(r,s,n,"aria-hidden")):function(){return null}},lr="Dialog",[Xi]=Em(lr),[eg,Oe]=Xi(lr),Zi=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:o,modal:i=!0}=e,c=S.useRef(null),u=S.useRef(null),[d,f]=Om({prop:r,defaultProp:s??!1,onChange:o,caller:lr});return a.jsx(eg,{scope:t,triggerRef:c,contentRef:u,contentId:Pr(),titleId:Pr(),descriptionId:Pr(),open:d,onOpenChange:f,onOpenToggle:S.useCallback(()=>f(l=>!l),[f]),modal:i,children:n})};Zi.displayName=lr;var Qi="DialogTrigger",tg=S.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Oe(Qi,n),o=yt(t,s.triggerRef);return a.jsx(We.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":bs(s.open),...r,ref:o,onClick:Ze(e.onClick,s.onOpenToggle)})});tg.displayName=Qi;var xs="DialogPortal",[ng,ec]=Xi(xs,{forceMount:void 0}),tc=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,o=Oe(xs,t);return a.jsx(ng,{scope:t,forceMount:n,children:S.Children.map(r,i=>a.jsx(ir,{present:n||o.open,children:a.jsx(Bi,{asChild:!0,container:s,children:i})}))})};tc.displayName=xs;var Qn="DialogOverlay",nc=S.forwardRef((e,t)=>{const n=ec(Qn,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,o=Oe(Qn,e.__scopeDialog);return o.modal?a.jsx(ir,{present:r||o.open,children:a.jsx(sg,{...s,ref:t})}):null});nc.displayName=Qn;var rg=Mi("DialogOverlay.RemoveScroll"),sg=S.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Oe(Qn,n),o=Xm(),i=yt(t,o);return a.jsx(Yi,{as:rg,allowPinchZoom:!0,shards:[s.contentRef],children:a.jsx(We.div,{"data-state":bs(s.open),...r,ref:i,style:{pointerEvents:"auto",...r.style}})})}),Mt="DialogContent",rc=S.forwardRef((e,t)=>{const n=ec(Mt,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,o=Oe(Mt,e.__scopeDialog);return a.jsx(ir,{present:r||o.open,children:o.modal?a.jsx(og,{...s,ref:t}):a.jsx(ag,{...s,ref:t})})});rc.displayName=Mt;var og=S.forwardRef((e,t)=>{const n=Oe(Mt,e.__scopeDialog),r=S.useRef(null),s=yt(t,n.contentRef,r);return S.useEffect(()=>{const o=r.current;if(o)return Qp(o)},[]),a.jsx(sc,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Ze(e.onCloseAutoFocus,o=>{o.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Ze(e.onPointerDownOutside,o=>{const i=o.detail.originalEvent,c=i.button===0&&i.ctrlKey===!0;(i.button===2||c)&&o.preventDefault()}),onFocusOutside:Ze(e.onFocusOutside,o=>o.preventDefault())})}),ag=S.forwardRef((e,t)=>{const n=Oe(Mt,e.__scopeDialog),r=S.useRef(!1),s=S.useRef(!1);return a.jsx(sc,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{e.onCloseAutoFocus?.(o),o.defaultPrevented||(r.current||n.triggerRef.current?.focus(),o.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:o=>{e.onInteractOutside?.(o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const i=o.target;n.triggerRef.current?.contains(i)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),sc=S.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:o,...i}=e,c=Oe(Mt,n);return hp(),a.jsx(a.Fragment,{children:a.jsx(Ui,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:o,children:a.jsx(Di,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":bs(c.open),...i,ref:t,deferPointerDownOutside:!0,onDismiss:()=>c.onOpenChange(!1)})})})}),oc="DialogTitle",ac=S.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Oe(oc,n);return a.jsx(We.h2,{id:s.titleId,...r,ref:t})});ac.displayName=oc;var ic="DialogDescription",cc=S.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Oe(ic,n);return a.jsx(We.p,{id:s.descriptionId,...r,ref:t})});cc.displayName=ic;var lc="DialogClose",Qr=S.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Oe(lc,n);return a.jsx(We.button,{type:"button",...r,ref:t,onClick:Ze(e.onClick,()=>s.onOpenChange(!1))})});Qr.displayName=lc;function bs(e){return e?"open":"closed"}const ig=e=>{const t=String(e||"").trim();return t==="1"?"The analyser exited with code 1 without recording the underlying error. Run the report again to capture the detailed failure reason.":t||"The analyser did not provide a failure reason."};function cg({report:e,onClose:t}){return a.jsx(Zi,{open:!!e,onOpenChange:n=>{n||t()},children:a.jsxs(tc,{children:[a.jsx(nc,{className:"fixed inset-0 z-50 bg-black/55"}),a.jsxs(rc,{className:"fixed left-1/2 top-1/2 z-50 max-h-[80vh] w-[calc(100%-2rem)] max-w-2xl -translate-x-1/2 -translate-y-1/2 overflow-y-auto rounded-md border bg-background p-5 shadow-xl",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[a.jsx(ze,{className:"mt-0.5 h-5 w-5 shrink-0 text-destructive"}),a.jsxs("div",{children:[a.jsx(ac,{className:"text-lg font-semibold",children:"AI cost analysis failed"}),a.jsx(cc,{className:"mt-1 text-sm text-muted-foreground",children:"Failure details for the scheduled report."})]})]}),a.jsx(Qr,{className:"rounded-md p-1 hover:bg-muted","aria-label":"Close failure details",children:a.jsx(ht,{className:"h-4 w-4"})})]}),e&&a.jsxs(a.Fragment,{children:[a.jsxs("dl",{className:"mt-5 grid gap-x-6 gap-y-3 border-y py-4 text-sm sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx("dt",{className:"text-xs text-muted-foreground",children:"Report period"}),a.jsxs("dd",{className:"mt-1 font-medium",children:[e.period.Start," to ",e.period.End]})]}),a.jsxs("div",{children:[a.jsx("dt",{className:"text-xs text-muted-foreground",children:"Attempt"}),a.jsx("dd",{className:"mt-1 font-medium",children:e.attempts})]}),a.jsxs("div",{children:[a.jsx("dt",{className:"text-xs text-muted-foreground",children:"AI provider"}),a.jsx("dd",{className:"mt-1 font-medium capitalize",children:e.provider||"Not resolved"})]}),a.jsxs("div",{children:[a.jsx("dt",{className:"text-xs text-muted-foreground",children:"Model"}),a.jsx("dd",{className:"mt-1 break-all font-medium",children:e.modelId||"Not resolved"})]})]}),a.jsxs("div",{className:"mt-4",children:[a.jsx("h3",{className:"text-sm font-semibold",children:"Failure reason"}),a.jsx("pre",{className:"mt-2 whitespace-pre-wrap break-words rounded-md border border-destructive/30 bg-destructive/5 p-4 font-mono text-xs leading-5 text-destructive",children:ig(e.error)})]})]}),a.jsx("div",{className:"mt-5 flex justify-end",children:a.jsx(Qr,{className:"rounded-md border px-4 py-2 text-sm font-medium hover:bg-muted",children:"Close"})})]})]})})}function lg(){const{managementAccountId:e,loading:t}=$t(),[n,r]=P.useState(null),[s,o]=P.useState(null),[i,c]=P.useState(null),[u,d]=P.useState([]),[f,l]=P.useState(!0),[h,m]=P.useState(!1),[g,p]=P.useState(null),[x,b]=P.useState(null),y=P.useRef(!0),v=P.useCallback(async(C=!1)=>{C||l(!0);try{const R=await oe.getDataStatus({managementAccountId:e});if(!y.current)return;if(o(R),!R.ready){r(null),c(null),d([]),b(null);return}const[_,L,A]=await Promise.all([oe.getAnalysisStatus({managementAccountId:e}),oe.getAnalysisSchedule({managementAccountId:e}),oe.getAnalysisReports({managementAccountId:e})]);if(!y.current)return;r(_),c(L),d(A),b(null)}catch(R){y.current&&b(R?.response?.data?.error||R?.message||"Unable to load scheduled AI reports")}finally{y.current&&!C&&l(!1)}},[e]);return P.useEffect(()=>(y.current=!0,t||v(),()=>{y.current=!1}),[v,t]),P.useEffect(()=>{if(!u.some(R=>R.status==="PENDING"||R.status==="RUNNING"))return;const C=window.setInterval(()=>{v(!0)},15e3);return()=>window.clearInterval(C)},[v,u]),{status:n,dataStatus:s,schedule:i,reports:u,loading:f||t,saving:h,removingId:g,error:x,load:v,saveSchedule:async C=>{m(!0),b(null);try{const R=await oe.updateAnalysisSchedule(C,{managementAccountId:e});y.current&&c(R)}catch(R){throw b(R?.response?.data?.error||R?.message||"Unable to save the AI report schedule"),R}finally{y.current&&m(!1)}},download:async C=>{try{const R=C.htmlReady?"html":"pdf",_=await(C.htmlReady?oe.downloadAnalysisHtml(C.id):oe.downloadAnalysisPdf(C.id)),L=URL.createObjectURL(_),A=document.createElement("a");A.href=L,A.download=`meyi-cost-analysis-${C.period.Start}.${R}`,A.click(),URL.revokeObjectURL(L)}catch(R){b(R?.response?.data?.error||R?.message||"Unable to download the report")}},remove:async C=>{if(window.confirm(`Remove the AI cost report for ${C.period.Start} through ${C.period.End}?`)){p(C.id),b(null);try{await oe.removeAnalysisReport(C.id),y.current&&d(R=>R.filter(_=>_.id!==C.id))}catch(R){y.current&&b(R?.response?.data?.error||R?.message||"Unable to remove the AI report")}finally{y.current&&p(null)}}}}}const Dr=e=>e?new Date(e).toLocaleString():"Not scheduled",ug=e=>new Date(`${e}T00:00:00Z`).toLocaleDateString(),dg=e=>{const t=new Date(`${e}T00:00:00Z`);return t.setUTCDate(t.getUTCDate()-1),t.toLocaleDateString()},Yo={COST_AI_DISABLED:["AI cost analysis is not enabled","An administrator must enable the Cost AI deployment setting before scheduled reports can run."],ANALYSER_NOT_CONFIGURED:["AI cost analysis is not fully configured","Cost AI is enabled, but the analyser task settings are incomplete. Redeploy the services stack; the backend log lists the missing settings."],AI_PROVIDER_REQUIRED:["Configure an AI provider","Configure and activate an AI provider in Meyi Connect before scheduled cost reports can run."]},Jo=e=>e.status!=="COMPLETED"||typeof e.ticketCount!="number"?null:typeof e.ticketLimit=="number"?`Created ${e.ticketCount} of top ${e.ticketLimit} tasks`:`Created ${e.ticketCount} ${e.ticketCount===1?"task":"tasks"}`,Xo={COMPLETED:"border-emerald-500/30 bg-emerald-500/10 text-emerald-700",RUNNING:"border-blue-500/30 bg-blue-500/10 text-blue-700",PENDING:"border-amber-500/30 bg-amber-500/10 text-amber-700",FAILED:"border-destructive/30 bg-destructive/10 text-destructive"};function fg(){const e=lg(),t=Kh(),[n,r]=P.useState(!1),[s,o]=P.useState(null),i=t.toLowerCase()==="admin";return a.jsxs("div",{className:"flex min-w-0 max-w-full flex-col gap-6 overflow-x-hidden p-2 md:p-6",children:[a.jsxs("header",{className:"flex flex-wrap items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold",children:[a.jsx(wo,{className:"h-6 w-6 text-primary"}),"AI Cost Analysis"]}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Scheduled Cost reports generated from AWS CUR data"})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(ar,{}),a.jsx("button",{type:"button",onClick:()=>{e.load()},disabled:e.loading,className:"rounded-lg border p-2.5 hover:bg-muted disabled:opacity-50",title:"Refresh reports","aria-label":"Refresh reports",children:a.jsx(Lt,{className:`h-4 w-4 ${e.loading?"animate-spin":""}`})}),i&&e.schedule&&a.jsxs("button",{type:"button",onClick:()=>r(!0),className:"inline-flex h-10 items-center gap-2 rounded-lg bg-primary px-4 text-sm font-medium text-primary-foreground",children:[a.jsx(hi,{className:"h-4 w-4"}),"Report settings"]})]})]}),e.error&&a.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-destructive/40 bg-destructive/5 p-3 text-sm text-destructive",children:[a.jsx(ze,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.error]}),e.loading?a.jsx("div",{className:"h-72 animate-pulse rounded-lg bg-muted"}):e.dataStatus&&!e.dataStatus.ready?a.jsx(Zn,{status:e.dataStatus}):e.status&&!e.status.enabled?a.jsx(ue,{children:a.jsxs(de,{className:"flex min-h-64 flex-col items-center justify-center px-6 text-center",children:[a.jsx(wo,{className:"h-8 w-8 text-muted-foreground"}),a.jsx("h2",{className:"mt-4 text-base font-semibold",children:Yo[e.status.reason??"COST_AI_DISABLED"][0]}),a.jsx("p",{className:"mt-2 max-w-xl text-sm text-muted-foreground",children:Yo[e.status.reason??"COST_AI_DISABLED"][1]})]})}):a.jsxs(a.Fragment,{children:[a.jsxs("section",{className:"flex flex-wrap items-center justify-between gap-3 rounded-lg border bg-card px-4 py-3",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(ii,{className:"h-5 w-5 text-primary"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-semibold",children:e.schedule?.enabled?`${e.schedule.frequency[0].toUpperCase()}${e.schedule.frequency.slice(1)} reports enabled`:"Scheduled reports disabled"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:e.schedule?.enabled?`Next run ${Dr(e.schedule.nextRunAt)} (${e.schedule.timezone})`:i?"Open report settings to configure a schedule":"An administrator can configure the report schedule"})]})]}),e.schedule?.lastRunAt&&a.jsxs("span",{className:"text-xs text-muted-foreground",children:["Last run ",Dr(e.schedule.lastRunAt)]})]}),e.reports.length?a.jsx("div",{className:"overflow-hidden rounded-lg border bg-card",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full min-w-[960px] text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b bg-muted/40 text-left text-xs text-muted-foreground",children:[a.jsx("th",{className:"px-4 py-3 font-medium",children:"Report period"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Schedule"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"AI provider"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Generated"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Status"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Total cost"}),a.jsx("th",{className:"px-4 py-3 text-right font-medium",children:"Actions"})]})}),a.jsx("tbody",{children:e.reports.map(c=>a.jsxs("tr",{className:"border-b last:border-0",children:[a.jsxs("td",{className:"px-4 py-3 font-medium",children:[ug(c.period.Start)," - ",dg(c.period.End)]}),a.jsx("td",{className:"px-4 py-3 capitalize text-muted-foreground",children:c.frequency}),a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("span",{className:"capitalize",children:c.provider||"-"}),c.modelId&&a.jsx("p",{className:"max-w-48 truncate text-xs text-muted-foreground",title:c.modelId,children:c.modelId})]}),a.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:Dr(c.completedAt||c.startedAt||c.createdAt)}),a.jsxs("td",{className:"px-4 py-3",children:[c.status==="FAILED"?a.jsxs("button",{type:"button",onClick:()=>o(c),className:`inline-flex items-center gap-1.5 rounded-full border px-2 py-1 text-xs font-medium hover:opacity-80 ${Xo.FAILED}`,title:"View failure reason",children:[a.jsx(ze,{className:"h-3 w-3"}),"failed"]}):a.jsxs("span",{className:`inline-flex items-center gap-1.5 rounded-full border px-2 py-1 text-xs font-medium ${Xo[c.status]}`,children:[(c.status==="RUNNING"||c.status==="PENDING")&&a.jsx(ct,{className:"h-3 w-3 animate-spin"}),c.status.toLowerCase()]}),c.error&&a.jsx("button",{type:"button",onClick:()=>o(c),className:"mt-1 block max-w-xs truncate text-left text-xs text-destructive underline-offset-2 hover:underline",title:"View complete failure reason",children:c.error==="1"?"View failure reason":c.error}),Jo(c)&&a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:Jo(c)})]}),a.jsx("td",{className:"px-4 py-3",children:c.facts?new Intl.NumberFormat(void 0,{style:"currency",currency:c.facts.currency}).format(c.facts.currentTotal):"-"}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs("button",{type:"button",onClick:()=>{e.download(c)},disabled:!(c.htmlReady||c.pdfReady),className:"inline-flex h-9 items-center gap-2 rounded-lg border px-3 text-sm font-medium hover:bg-muted disabled:cursor-not-allowed disabled:opacity-40",title:c.htmlReady?"Download HTML report":c.pdfReady?"Download PDF report":"Report not ready",children:[a.jsx(fs,{className:"h-4 w-4"}),"Download"]}),i&&a.jsx("button",{type:"button",onClick:()=>{e.remove(c)},disabled:e.removingId===c.id||c.status==="RUNNING"||c.status==="PENDING",className:"inline-flex h-9 w-9 items-center justify-center rounded-lg border text-destructive hover:bg-destructive/10 disabled:cursor-not-allowed disabled:opacity-40",title:"Remove report","aria-label":"Remove report",children:e.removingId===c.id?a.jsx(ct,{className:"h-4 w-4 animate-spin"}):a.jsx(mi,{className:"h-4 w-4"})})]})})]},c.id))})]})})}):a.jsx(ue,{children:a.jsxs(de,{className:"flex min-h-64 flex-col items-center justify-center px-6 text-center",children:[a.jsx(di,{className:"h-8 w-8 text-muted-foreground"}),a.jsx("h2",{className:"mt-4 text-base font-semibold",children:"No scheduled reports yet"}),a.jsx("p",{className:"mt-2 max-w-lg text-sm text-muted-foreground",children:"The first report will appear here after the configured schedule runs."})]})})]}),e.schedule&&a.jsx(Cm,{open:n,schedule:e.schedule,saving:e.saving,onClose:()=>r(!1),onSave:e.saveSchedule}),a.jsx(cg,{report:s,onClose:()=>o(null)})]})}const Bt=ql({component:Aa}),hg=an({getParentRoute:()=>Bt,path:"/",component:nm}),mg=an({getParentRoute:()=>Bt,path:"/reports",component:pm}),pg=an({getParentRoute:()=>Bt,path:"/cur-discovery",component:bm}),gg=an({getParentRoute:()=>Bt,path:"/analysis",component:fg}),xg=an({getParentRoute:()=>Bt,path:"/sources",component:wm});function ys(){return Bt.addChildren([hg,gg,mg,xg,pg])}function bg(e="/cost"){return Oa({routeTree:ys(),basepath:e})}function yg({apiBase:e,token:t,basePath:n="/cost",userRole:r="user",tenantId:s="default"}){si(e,t);const o=P.useMemo(()=>Oa({routeTree:ys(),basepath:n}),[n]);return a.jsx(Gh,{value:r,children:a.jsx(Yh,{tenantId:s,children:a.jsx(iu,{router:o})})})}const vg=[{title:"Overview",url:"/",icon:"DollarSign",roles:["admin","user"]},{title:"AI Analysis",url:"/analysis",icon:"Sparkles",roles:["admin","user"]},{title:"Reports",url:"/reports",icon:"FileText",roles:["admin","user"]},{title:"Sources",url:"/sources",icon:"CloudCog",roles:["admin"]},{title:"CUR Discovery",url:"/cur-discovery",icon:"Search",roles:["admin"]}];exports.CostPage=yg;exports.api=ne;exports.attachAuthInterceptors=af;exports.configureApi=si;exports.costNavItems=vg;exports.createCostRouter=bg;exports.createRouteTree=ys;
61
+ `)},qp=0,Rt=[];function Gp(e){var t=S.useRef([]),n=S.useRef([0,0]),r=S.useRef(),s=S.useState(qp++)[0],o=S.useState(Hi)[0],i=S.useRef(e);S.useEffect(function(){i.current=e},[e]),S.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var p=mp([e.lockRef.current],(e.shards||[]).map(Ko),!0).filter(Boolean);return p.forEach(function(x){return x.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),p.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var c=S.useCallback(function(p,x){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!i.current.allowPinchZoom;var b=kn(p),y=n.current,v="deltaX"in p?p.deltaX:y[0]-b[0],N="deltaY"in p?p.deltaY:y[1]-b[1],j,k=p.target,C=Math.abs(v)>Math.abs(N)?"h":"v";if("touches"in p&&C==="h"&&k.type==="range")return!1;var R=window.getSelection(),_=R&&R.anchorNode,L=_?_===k||_.contains(k):!1;if(L)return!1;var A=qo(C,k);if(!A)return!0;if(A?j=C:(j=C==="v"?"h":"v",A=qo(C,k)),!A)return!1;if(!r.current&&"changedTouches"in p&&(v||N)&&(r.current=j),!j)return!0;var D=r.current||j;return Wp(D,x,p,D==="h"?v:N)},[]),u=S.useCallback(function(p){var x=p;if(!(!Rt.length||Rt[Rt.length-1]!==o)){var b="deltaY"in x?Go(x):kn(x),y=t.current.filter(function(j){return j.name===x.type&&(j.target===x.target||x.target===j.shadowParent)&&Vp(j.delta,b)})[0];if(y&&y.should){x.cancelable&&x.preventDefault();return}if(!y){var v=(i.current.shards||[]).map(Ko).filter(Boolean).filter(function(j){return j.contains(x.target)}),N=v.length>0?c(x,v[0]):!i.current.noIsolation;N&&x.cancelable&&x.preventDefault()}}},[]),d=S.useCallback(function(p,x,b,y){var v={name:p,delta:x,target:b,should:y,shadowParent:Kp(b)};t.current.push(v),setTimeout(function(){t.current=t.current.filter(function(N){return N!==v})},1)},[]),f=S.useCallback(function(p){n.current=kn(p),r.current=void 0},[]),l=S.useCallback(function(p){d(p.type,Go(p),p.target,c(p,e.lockRef.current))},[]),h=S.useCallback(function(p){d(p.type,kn(p),p.target,c(p,e.lockRef.current))},[]);S.useEffect(function(){return Rt.push(o),e.setCallbacks({onScrollCapture:l,onWheelCapture:l,onTouchMoveCapture:h}),document.addEventListener("wheel",u,St),document.addEventListener("touchmove",u,St),document.addEventListener("touchstart",f,St),function(){Rt=Rt.filter(function(p){return p!==o}),document.removeEventListener("wheel",u,St),document.removeEventListener("touchmove",u,St),document.removeEventListener("touchstart",f,St)}},[]);var m=e.removeScrollBar,g=e.inert;return S.createElement(S.Fragment,null,g?S.createElement(o,{styles:Hp(s)}):null,m?S.createElement(Mp,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Kp(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Yp=Rp(Vi,Gp);var Yi=S.forwardRef(function(e,t){return S.createElement(cr,De({},e,{ref:t,sideCar:Yp}))});Yi.classNames=cr.classNames;var Jp=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Nt=new WeakMap,_n=new WeakMap,Pn={},Mr=0,Ji=function(e){return e&&(e.host||Ji(e.parentNode))},Xp=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Ji(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Zp=function(e,t,n,r){var s=Xp(t,Array.isArray(e)?e:[e]);Pn[n]||(Pn[n]=new WeakMap);var o=Pn[n],i=[],c=new Set,u=new Set(s),d=function(l){!l||c.has(l)||(c.add(l),d(l.parentNode))};s.forEach(d);var f=function(l){!l||u.has(l)||Array.prototype.forEach.call(l.children,function(h){if(c.has(h))f(h);else try{var m=h.getAttribute(r),g=m!==null&&m!=="false",p=(Nt.get(h)||0)+1,x=(o.get(h)||0)+1;Nt.set(h,p),o.set(h,x),i.push(h),p===1&&g&&_n.set(h,!0),x===1&&h.setAttribute(n,"true"),g||h.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",h,b)}})};return f(t),c.clear(),Mr++,function(){i.forEach(function(l){var h=Nt.get(l)-1,m=o.get(l)-1;Nt.set(l,h),o.set(l,m),h||(_n.has(l)||l.removeAttribute(r),_n.delete(l)),m||l.removeAttribute(n)}),Mr--,Mr||(Nt=new WeakMap,Nt=new WeakMap,_n=new WeakMap,Pn={})}},Qp=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=Jp(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),Zp(r,s,n,"aria-hidden")):function(){return null}},lr="Dialog",[Xi]=Em(lr),[eg,Oe]=Xi(lr),Zi=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:o,modal:i=!0}=e,c=S.useRef(null),u=S.useRef(null),[d,f]=Om({prop:r,defaultProp:s??!1,onChange:o,caller:lr});return a.jsx(eg,{scope:t,triggerRef:c,contentRef:u,contentId:Pr(),titleId:Pr(),descriptionId:Pr(),open:d,onOpenChange:f,onOpenToggle:S.useCallback(()=>f(l=>!l),[f]),modal:i,children:n})};Zi.displayName=lr;var Qi="DialogTrigger",tg=S.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Oe(Qi,n),o=bt(t,s.triggerRef);return a.jsx(ze.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":bs(s.open),...r,ref:o,onClick:Xe(e.onClick,s.onOpenToggle)})});tg.displayName=Qi;var xs="DialogPortal",[ng,ec]=Xi(xs,{forceMount:void 0}),tc=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,o=Oe(xs,t);return a.jsx(ng,{scope:t,forceMount:n,children:S.Children.map(r,i=>a.jsx(ir,{present:n||o.open,children:a.jsx(Bi,{asChild:!0,container:s,children:i})}))})};tc.displayName=xs;var Qn="DialogOverlay",nc=S.forwardRef((e,t)=>{const n=ec(Qn,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,o=Oe(Qn,e.__scopeDialog);return o.modal?a.jsx(ir,{present:r||o.open,children:a.jsx(sg,{...s,ref:t})}):null});nc.displayName=Qn;var rg=Mi("DialogOverlay.RemoveScroll"),sg=S.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Oe(Qn,n),o=Xm(),i=bt(t,o);return a.jsx(Yi,{as:rg,allowPinchZoom:!0,shards:[s.contentRef],children:a.jsx(ze.div,{"data-state":bs(s.open),...r,ref:i,style:{pointerEvents:"auto",...r.style}})})}),It="DialogContent",rc=S.forwardRef((e,t)=>{const n=ec(It,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,o=Oe(It,e.__scopeDialog);return a.jsx(ir,{present:r||o.open,children:o.modal?a.jsx(og,{...s,ref:t}):a.jsx(ag,{...s,ref:t})})});rc.displayName=It;var og=S.forwardRef((e,t)=>{const n=Oe(It,e.__scopeDialog),r=S.useRef(null),s=bt(t,n.contentRef,r);return S.useEffect(()=>{const o=r.current;if(o)return Qp(o)},[]),a.jsx(sc,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Xe(e.onCloseAutoFocus,o=>{o.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Xe(e.onPointerDownOutside,o=>{const i=o.detail.originalEvent,c=i.button===0&&i.ctrlKey===!0;(i.button===2||c)&&o.preventDefault()}),onFocusOutside:Xe(e.onFocusOutside,o=>o.preventDefault())})}),ag=S.forwardRef((e,t)=>{const n=Oe(It,e.__scopeDialog),r=S.useRef(!1),s=S.useRef(!1);return a.jsx(sc,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{e.onCloseAutoFocus?.(o),o.defaultPrevented||(r.current||n.triggerRef.current?.focus(),o.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:o=>{e.onInteractOutside?.(o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const i=o.target;n.triggerRef.current?.contains(i)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),sc=S.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:o,...i}=e,c=Oe(It,n);return hp(),a.jsx(a.Fragment,{children:a.jsx(Ui,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:o,children:a.jsx(Di,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":bs(c.open),...i,ref:t,deferPointerDownOutside:!0,onDismiss:()=>c.onOpenChange(!1)})})})}),oc="DialogTitle",ac=S.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Oe(oc,n);return a.jsx(ze.h2,{id:s.titleId,...r,ref:t})});ac.displayName=oc;var ic="DialogDescription",cc=S.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Oe(ic,n);return a.jsx(ze.p,{id:s.descriptionId,...r,ref:t})});cc.displayName=ic;var lc="DialogClose",Qr=S.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Oe(lc,n);return a.jsx(ze.button,{type:"button",...r,ref:t,onClick:Xe(e.onClick,()=>s.onOpenChange(!1))})});Qr.displayName=lc;function bs(e){return e?"open":"closed"}const ig=e=>{const t=String(e||"").trim();return t==="1"?"The analyser exited with code 1 without recording the underlying error. Run the report again to capture the detailed failure reason.":t||"The analyser did not provide a failure reason."};function cg({report:e,onClose:t}){return a.jsx(Zi,{open:!!e,onOpenChange:n=>{n||t()},children:a.jsxs(tc,{children:[a.jsx(nc,{className:"fixed inset-0 z-50 bg-black/55"}),a.jsxs(rc,{className:"fixed left-1/2 top-1/2 z-50 max-h-[80vh] w-[calc(100%-2rem)] max-w-2xl -translate-x-1/2 -translate-y-1/2 overflow-y-auto rounded-md border bg-background p-5 shadow-xl",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[a.jsx(Be,{className:"mt-0.5 h-5 w-5 shrink-0 text-destructive"}),a.jsxs("div",{children:[a.jsx(ac,{className:"text-lg font-semibold",children:"AI cost analysis failed"}),a.jsx(cc,{className:"mt-1 text-sm text-muted-foreground",children:"Failure details for the scheduled report."})]})]}),a.jsx(Qr,{className:"rounded-md p-1 hover:bg-muted","aria-label":"Close failure details",children:a.jsx(ft,{className:"h-4 w-4"})})]}),e&&a.jsxs(a.Fragment,{children:[a.jsxs("dl",{className:"mt-5 grid gap-x-6 gap-y-3 border-y py-4 text-sm sm:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx("dt",{className:"text-xs text-muted-foreground",children:"Report period"}),a.jsxs("dd",{className:"mt-1 font-medium",children:[e.period.Start," to ",e.period.End]})]}),a.jsxs("div",{children:[a.jsx("dt",{className:"text-xs text-muted-foreground",children:"Attempt"}),a.jsx("dd",{className:"mt-1 font-medium",children:e.attempts})]}),a.jsxs("div",{children:[a.jsx("dt",{className:"text-xs text-muted-foreground",children:"AI provider"}),a.jsx("dd",{className:"mt-1 font-medium capitalize",children:e.provider||"Not resolved"})]}),a.jsxs("div",{children:[a.jsx("dt",{className:"text-xs text-muted-foreground",children:"Model"}),a.jsx("dd",{className:"mt-1 break-all font-medium",children:e.modelId||"Not resolved"})]})]}),a.jsxs("div",{className:"mt-4",children:[a.jsx("h3",{className:"text-sm font-semibold",children:"Failure reason"}),a.jsx("pre",{className:"mt-2 whitespace-pre-wrap break-words rounded-md border border-destructive/30 bg-destructive/5 p-4 font-mono text-xs leading-5 text-destructive",children:ig(e.error)})]})]}),a.jsx("div",{className:"mt-5 flex justify-end",children:a.jsx(Qr,{className:"rounded-md border px-4 py-2 text-sm font-medium hover:bg-muted",children:"Close"})})]})]})})}function lg(){const{managementAccountId:e,loading:t}=Ut(),[n,r]=P.useState(null),[s,o]=P.useState(null),[i,c]=P.useState(null),[u,d]=P.useState([]),[f,l]=P.useState(!0),[h,m]=P.useState(!1),[g,p]=P.useState(null),[x,b]=P.useState(null),y=P.useRef(!0),v=P.useCallback(async(C=!1)=>{C||l(!0);try{const R=await oe.getDataStatus({managementAccountId:e});if(!y.current)return;if(o(R),!R.ready){r(null),c(null),d([]),b(null);return}const[_,L,A]=await Promise.all([oe.getAnalysisStatus({managementAccountId:e}),oe.getAnalysisSchedule({managementAccountId:e}),oe.getAnalysisReports({managementAccountId:e})]);if(!y.current)return;r(_),c(L),d(A),b(null)}catch(R){y.current&&b(R?.response?.data?.error||R?.message||"Unable to load scheduled AI reports")}finally{y.current&&!C&&l(!1)}},[e]);return P.useEffect(()=>(y.current=!0,t||v(),()=>{y.current=!1}),[v,t]),P.useEffect(()=>{if(!u.some(R=>R.status==="PENDING"||R.status==="RUNNING"))return;const C=window.setInterval(()=>{v(!0)},15e3);return()=>window.clearInterval(C)},[v,u]),{status:n,dataStatus:s,schedule:i,reports:u,loading:f||t,saving:h,removingId:g,error:x,load:v,saveSchedule:async C=>{m(!0),b(null);try{const R=await oe.updateAnalysisSchedule(C,{managementAccountId:e});y.current&&c(R)}catch(R){throw b(R?.response?.data?.error||R?.message||"Unable to save the AI report schedule"),R}finally{y.current&&m(!1)}},download:async C=>{try{const R=C.htmlReady?"html":"pdf",_=await(C.htmlReady?oe.downloadAnalysisHtml(C.id):oe.downloadAnalysisPdf(C.id)),L=URL.createObjectURL(_),A=document.createElement("a");A.href=L,A.download=`meyi-cost-analysis-${C.period.Start}.${R}`,A.click(),URL.revokeObjectURL(L)}catch(R){b(R?.response?.data?.error||R?.message||"Unable to download the report")}},remove:async C=>{if(window.confirm(`Remove the AI cost report for ${C.period.Start} through ${C.period.End}?`)){p(C.id),b(null);try{await oe.removeAnalysisReport(C.id),y.current&&d(R=>R.filter(_=>_.id!==C.id))}catch(R){y.current&&b(R?.response?.data?.error||R?.message||"Unable to remove the AI report")}finally{y.current&&p(null)}}}}}const Dr=e=>e?new Date(e).toLocaleString():"Not scheduled",ug=e=>new Date(`${e}T00:00:00Z`).toLocaleDateString(),dg=e=>{const t=new Date(`${e}T00:00:00Z`);return t.setUTCDate(t.getUTCDate()-1),t.toLocaleDateString()},Yo={COST_AI_DISABLED:["AI cost analysis is not enabled","An administrator must enable the Cost AI deployment setting before scheduled reports can run."],ANALYSER_NOT_CONFIGURED:["AI cost analysis is not fully configured","Cost AI is enabled, but the analyser task settings are incomplete. Redeploy the services stack; the backend log lists the missing settings."],AI_PROVIDER_REQUIRED:["Configure an AI provider","Configure and activate an AI provider in Meyi Connect before scheduled cost reports can run."]},Jo=e=>e.status!=="COMPLETED"||typeof e.ticketCount!="number"?null:typeof e.ticketLimit=="number"?`Created ${e.ticketCount} of top ${e.ticketLimit} tasks`:`Created ${e.ticketCount} ${e.ticketCount===1?"task":"tasks"}`,Xo={COMPLETED:"border-emerald-500/30 bg-emerald-500/10 text-emerald-700",RUNNING:"border-blue-500/30 bg-blue-500/10 text-blue-700",PENDING:"border-amber-500/30 bg-amber-500/10 text-amber-700",FAILED:"border-destructive/30 bg-destructive/10 text-destructive"};function fg(){const e=lg(),t=Kh(),[n,r]=P.useState(!1),[s,o]=P.useState(null),i=t.toLowerCase()==="admin";return a.jsxs("div",{className:"flex min-w-0 max-w-full flex-col gap-6 overflow-x-hidden p-2 md:p-6",children:[a.jsxs("header",{className:"flex flex-wrap items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold",children:[a.jsx(wo,{className:"h-6 w-6 text-primary"}),"AI Cost Analysis"]}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Scheduled Cost reports generated from AWS CUR data"})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(ar,{}),a.jsx("button",{type:"button",onClick:()=>{e.load()},disabled:e.loading,className:"rounded-lg border p-2.5 hover:bg-muted disabled:opacity-50",title:"Refresh reports","aria-label":"Refresh reports",children:a.jsx(Tt,{className:`h-4 w-4 ${e.loading?"animate-spin":""}`})}),i&&e.schedule&&a.jsxs("button",{type:"button",onClick:()=>r(!0),className:"inline-flex h-10 items-center gap-2 rounded-lg bg-primary px-4 text-sm font-medium text-primary-foreground",children:[a.jsx(hi,{className:"h-4 w-4"}),"Report settings"]})]})]}),e.error&&a.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-destructive/40 bg-destructive/5 p-3 text-sm text-destructive",children:[a.jsx(Be,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.error]}),e.loading?a.jsx("div",{className:"h-72 animate-pulse rounded-lg bg-muted"}):e.dataStatus&&!e.dataStatus.ready?a.jsx(Zn,{status:e.dataStatus}):e.status&&!e.status.enabled?a.jsx(ue,{children:a.jsxs(de,{className:"flex min-h-64 flex-col items-center justify-center px-6 text-center",children:[a.jsx(wo,{className:"h-8 w-8 text-muted-foreground"}),a.jsx("h2",{className:"mt-4 text-base font-semibold",children:Yo[e.status.reason??"COST_AI_DISABLED"][0]}),a.jsx("p",{className:"mt-2 max-w-xl text-sm text-muted-foreground",children:Yo[e.status.reason??"COST_AI_DISABLED"][1]})]})}):a.jsxs(a.Fragment,{children:[a.jsxs("section",{className:"flex flex-wrap items-center justify-between gap-3 rounded-lg border bg-card px-4 py-3",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(ii,{className:"h-5 w-5 text-primary"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-semibold",children:e.schedule?.enabled?`${e.schedule.frequency[0].toUpperCase()}${e.schedule.frequency.slice(1)} reports enabled`:"Scheduled reports disabled"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:e.schedule?.enabled?`Next run ${Dr(e.schedule.nextRunAt)} (${e.schedule.timezone})`:i?"Open report settings to configure a schedule":"An administrator can configure the report schedule"})]})]}),e.schedule?.lastRunAt&&a.jsxs("span",{className:"text-xs text-muted-foreground",children:["Last run ",Dr(e.schedule.lastRunAt)]})]}),e.reports.length?a.jsx("div",{className:"overflow-hidden rounded-lg border bg-card",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full min-w-[960px] text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b bg-muted/40 text-left text-xs text-muted-foreground",children:[a.jsx("th",{className:"px-4 py-3 font-medium",children:"Report period"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Schedule"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"AI provider"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Generated"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Status"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Total cost"}),a.jsx("th",{className:"px-4 py-3 text-right font-medium",children:"Actions"})]})}),a.jsx("tbody",{children:e.reports.map(c=>a.jsxs("tr",{className:"border-b last:border-0",children:[a.jsxs("td",{className:"px-4 py-3 font-medium",children:[ug(c.period.Start)," - ",dg(c.period.End)]}),a.jsx("td",{className:"px-4 py-3 capitalize text-muted-foreground",children:c.frequency}),a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("span",{className:"capitalize",children:c.provider||"-"}),c.modelId&&a.jsx("p",{className:"max-w-48 truncate text-xs text-muted-foreground",title:c.modelId,children:c.modelId})]}),a.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:Dr(c.completedAt||c.startedAt||c.createdAt)}),a.jsxs("td",{className:"px-4 py-3",children:[c.status==="FAILED"?a.jsxs("button",{type:"button",onClick:()=>o(c),className:`inline-flex items-center gap-1.5 rounded-full border px-2 py-1 text-xs font-medium hover:opacity-80 ${Xo.FAILED}`,title:"View failure reason",children:[a.jsx(Be,{className:"h-3 w-3"}),"failed"]}):a.jsxs("span",{className:`inline-flex items-center gap-1.5 rounded-full border px-2 py-1 text-xs font-medium ${Xo[c.status]}`,children:[(c.status==="RUNNING"||c.status==="PENDING")&&a.jsx(it,{className:"h-3 w-3 animate-spin"}),c.status.toLowerCase()]}),c.error&&a.jsx("button",{type:"button",onClick:()=>o(c),className:"mt-1 block max-w-xs truncate text-left text-xs text-destructive underline-offset-2 hover:underline",title:"View complete failure reason",children:c.error==="1"?"View failure reason":c.error}),Jo(c)&&a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:Jo(c)})]}),a.jsx("td",{className:"px-4 py-3",children:c.facts?new Intl.NumberFormat(void 0,{style:"currency",currency:c.facts.currency}).format(c.facts.currentTotal):"-"}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsxs("button",{type:"button",onClick:()=>{e.download(c)},disabled:!(c.htmlReady||c.pdfReady),className:"inline-flex h-9 items-center gap-2 rounded-lg border px-3 text-sm font-medium hover:bg-muted disabled:cursor-not-allowed disabled:opacity-40",title:c.htmlReady?"Download HTML report":c.pdfReady?"Download PDF report":"Report not ready",children:[a.jsx(fs,{className:"h-4 w-4"}),"Download"]}),i&&a.jsx("button",{type:"button",onClick:()=>{e.remove(c)},disabled:e.removingId===c.id||c.status==="RUNNING"||c.status==="PENDING",className:"inline-flex h-9 w-9 items-center justify-center rounded-lg border text-destructive hover:bg-destructive/10 disabled:cursor-not-allowed disabled:opacity-40",title:"Remove report","aria-label":"Remove report",children:e.removingId===c.id?a.jsx(it,{className:"h-4 w-4 animate-spin"}):a.jsx(mi,{className:"h-4 w-4"})})]})})]},c.id))})]})})}):a.jsx(ue,{children:a.jsxs(de,{className:"flex min-h-64 flex-col items-center justify-center px-6 text-center",children:[a.jsx(di,{className:"h-8 w-8 text-muted-foreground"}),a.jsx("h2",{className:"mt-4 text-base font-semibold",children:"No scheduled reports yet"}),a.jsx("p",{className:"mt-2 max-w-lg text-sm text-muted-foreground",children:"The first report will appear here after the configured schedule runs."})]})})]}),e.schedule&&a.jsx(Cm,{open:n,schedule:e.schedule,saving:e.saving,onClose:()=>r(!1),onSave:e.saveSchedule}),a.jsx(cg,{report:s,onClose:()=>o(null)})]})}const $t=ql({component:Aa}),hg=an({getParentRoute:()=>$t,path:"/",component:nm}),mg=an({getParentRoute:()=>$t,path:"/reports",component:pm}),pg=an({getParentRoute:()=>$t,path:"/cur-discovery",component:bm}),gg=an({getParentRoute:()=>$t,path:"/analysis",component:fg}),xg=an({getParentRoute:()=>$t,path:"/sources",component:wm});function ys(){return $t.addChildren([hg,gg,mg,xg,pg])}function bg(e="/cost"){return Oa({routeTree:ys(),basepath:e})}function yg({apiBase:e,token:t,basePath:n="/cost",userRole:r="user",tenantId:s="default"}){si(e,t);const o=P.useMemo(()=>Oa({routeTree:ys(),basepath:n}),[n]);return a.jsx(Gh,{value:r,children:a.jsx(Yh,{tenantId:s,children:a.jsx(iu,{router:o})})})}const vg=[{title:"Overview",url:"/",icon:"DollarSign",roles:["admin","user"]},{title:"AI Analysis",url:"/analysis",icon:"Sparkles",roles:["admin","user"]},{title:"Reports",url:"/reports",icon:"FileText",roles:["admin","user"]},{title:"Sources",url:"/sources",icon:"CloudCog",roles:["admin"]},{title:"CUR Discovery",url:"/cur-discovery",icon:"Search",roles:["admin"]}];exports.CostPage=yg;exports.api=ne;exports.attachAuthInterceptors=af;exports.configureApi=si;exports.costNavItems=vg;exports.createCostRouter=bg;exports.createRouteTree=ys;