@meyicloud/meyi-cost-ui 1.5.0 → 1.5.2
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/features/analysis/hooks/use-cost-analysis.d.ts +2 -0
- package/dist/index.js +8 -8
- package/dist/index.mjs +798 -774
- package/dist/services/cost.d.ts +3 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("react"),Na=require("react-dom");function Ca(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const r=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,r.get?r:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const B=Ca(k);var Gt={exports:{}},
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("react"),Na=require("react-dom");function Ca(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const r=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,r.get?r:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const B=Ca(k);var Gt={exports:{}},kt={};var Ar;function _a(){if(Ar)return kt;Ar=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function s(r,n,o){var i=null;if(o!==void 0&&(i=""+o),n.key!==void 0&&(i=""+n.key),"key"in n){o={};for(var c in n)c!=="key"&&(o[c]=n[c])}else o=n;return n=o.ref,{$$typeof:e,type:r,key:i,ref:n!==void 0?n:null,props:o}}return kt.Fragment=t,kt.jsx=s,kt.jsxs=s,kt}var Et={};var Or;function ka(){return Or||(Or=1,process.env.NODE_ENV!=="production"&&(function(){function e(C){if(C==null)return null;if(typeof C=="function")return C.$$typeof===L?null:C.displayName||C.name||null;if(typeof C=="string")return C;switch(C){case x:return"Fragment";case y:return"Profiler";case b:return"StrictMode";case j:return"Suspense";case _:return"SuspenseList";case D:return"Activity"}if(typeof C=="object")switch(typeof C.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),C.$$typeof){case g:return"Portal";case w:return C.displayName||"Context";case S:return(C._context.displayName||"Context")+".Consumer";case N:var U=C.render;return C=C.displayName,C||(C=U.displayName||U.name||"",C=C!==""?"ForwardRef("+C+")":"ForwardRef"),C;case R:return U=C.displayName||null,U!==null?U:e(C.type)||"Memo";case E:U=C._payload,C=C._init;try{return e(C(U))}catch{}}return null}function t(C){return""+C}function s(C){try{t(C);var U=!1}catch{U=!0}if(U){U=console;var W=U.error,q=typeof Symbol=="function"&&Symbol.toStringTag&&C[Symbol.toStringTag]||C.constructor.name||"Object";return W.call(U,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",q),t(C)}}function r(C){if(C===x)return"<>";if(typeof C=="object"&&C!==null&&C.$$typeof===E)return"<...>";try{var U=e(C);return U?"<"+U+">":"<...>"}catch{return"<...>"}}function n(){var C=F.A;return C===null?null:C.getOwner()}function o(){return Error("react-stack-top-frame")}function i(C){if(ee.call(C,"key")){var U=Object.getOwnPropertyDescriptor(C,"key").get;if(U&&U.isReactWarning)return!1}return C.key!==void 0}function c(C,U){function W(){Q||(Q=!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)",U))}W.isReactWarning=!0,Object.defineProperty(C,"key",{get:W,configurable:!0})}function l(){var C=e(this.type);return Y[C]||(Y[C]=!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.")),C=this.props.ref,C!==void 0?C:null}function d(C,U,W,q,M,I){var $=W.ref;return C={$$typeof:p,type:C,key:U,props:W,_owner:q},($!==void 0?$:null)!==null?Object.defineProperty(C,"ref",{enumerable:!1,get:l}):Object.defineProperty(C,"ref",{enumerable:!1,value:null}),C._store={},Object.defineProperty(C._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(C,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(C,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:M}),Object.defineProperty(C,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:I}),Object.freeze&&(Object.freeze(C.props),Object.freeze(C)),C}function f(C,U,W,q,M,I){var $=U.children;if($!==void 0)if(q)if(V($)){for(q=0;q<$.length;q++)u($[q]);Object.freeze&&Object.freeze($)}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 u($);if(ee.call(U,"key")){$=e(C);var J=Object.keys(U).filter(function(ue){return ue!=="key"});q=0<J.length?"{key: someKey, "+J.join(": ..., ")+": ...}":"{key: someKey}",T[$+q]||(J=0<J.length?"{"+J.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} />`,q,$,J,$),T[$+q]=!0)}if($=null,W!==void 0&&(s(W),$=""+W),i(U)&&(s(U.key),$=""+U.key),"key"in U){W={};for(var G in U)G!=="key"&&(W[G]=U[G])}else W=U;return $&&c(W,typeof j=="function"?j.displayName||j.name||"Unknown":j),d(j,$,W,n(),M,I)}function u(j){h(j)?j._store&&(j._store.validated=1):typeof j=="object"&&j!==null&&j.$$typeof===E&&(j._payload.status==="fulfilled"?h(j._payload.value)&&j._payload.value._store&&(j._payload.value._store.validated=1):j._store&&(j._store.validated=1))}function h(j){return typeof j=="object"&&j!==null&&j.$$typeof===p}var m=k,p=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),y=Symbol.for("react.profiler"),S=Symbol.for("react.consumer"),w=Symbol.for("react.context"),N=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),E=Symbol.for("react.lazy"),D=Symbol.for("react.activity"),L=Symbol.for("react.client.reference"),F=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee=Object.prototype.hasOwnProperty,V=Array.isArray,Z=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(j){return j()}};var Q,Y={},le=m.react_stack_bottom_frame.bind(m,o)(),fe=Z(r(o)),T={};kt.Fragment=x,kt.jsx=function(j,U,W){var q=1e4>F.recentlyCreatedOwnerStacks++;return f(j,U,W,!1,q?Error("react-stack-top-frame"):le,q?Z(r(j)):fe)},kt.jsxs=function(j,U,W){var q=1e4>F.recentlyCreatedOwnerStacks++;return f(j,U,W,!0,q?Error("react-stack-top-frame"):le,q?Z(r(j)):fe)}})()),kt}var Lr;function Ea(){return Lr||(Lr=1,process.env.NODE_ENV==="production"?Gt.exports=_a():Gt.exports=ka()),Gt.exports}var a=Ea(),Mt=typeof window<"u"?B.useLayoutEffect:B.useEffect;function Ms(e){const t=B.useRef({value:e,prev:null}),s=t.current.value;return e!==s&&(t.current={value:e,prev:s}),t.current.prev}function Pa(e,t,s={},r={}){B.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!="function")return;const n=new IntersectionObserver(([o])=>{t(o)},s);return n.observe(e.current),()=>{n.disconnect()}},[t,s,r.disabled,e])}function Ta(e){const t=B.useRef(null);return B.useImperativeHandle(e,()=>t.current,[]),t}const Hn=!1;function Dt(e){return e[e.length-1]}function Aa(e){return typeof e=="function"}function Ze(e,t){return Aa(e)?e(t):e}const qn=Object.prototype.hasOwnProperty,Mr=Object.prototype.propertyIsEnumerable;function Gn(e){for(const t in e)if(qn.call(e,t))return!0;return!1}const Oa=()=>Object.create(null),Ye=(e,t)=>Qe(e,t,Oa);function Qe(e,t,s=()=>({}),r=0){if(e===t)return e;if(r>500)return t;const n=t,o=Fr(e)&&Fr(n);if(!o&&!(ms(e)&&ms(n)))return n;const i=o?e:Ir(e);if(!i)return n;const c=o?n:Ir(n);if(!c)return n;const l=i.length,d=c.length,f=o?new Array(d):s();let u=0;for(let h=0;h<d;h++){const m=o?h:c[h],p=e[m],g=n[m];if(p===g){f[m]=p,(o?h<l:qn.call(e,m))&&u++;continue}if(p===null||g===null||typeof p!="object"||typeof g!="object"){f[m]=g;continue}const x=Qe(p,g,s,r+1);f[m]=x,x===p&&u++}return l===d&&u===l?e:f}function Ir(e){const t=Object.getOwnPropertyNames(e);for(const n of t)if(!Mr.call(e,n))return!1;const s=Object.getOwnPropertySymbols(e);if(s.length===0)return t;const r=t;for(const n of s){if(!Mr.call(e,n))return!1;r.push(n)}return r}function ms(e){if(!Dr(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const s=t.prototype;return!(!Dr(s)||!s.hasOwnProperty("isPrototypeOf"))}function Dr(e){return Object.prototype.toString.call(e)==="[object Object]"}function Fr(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function st(e,t,s){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,n=e.length;r<n;r++)if(!st(e[r],t[r],s))return!1;return!0}if(ms(e)&&ms(t)){const r=s?.ignoreUndefined??!0;if(s?.partial){for(const i in t)if((!r||t[i]!==void 0)&&!st(e[i],t[i],s))return!1;return!0}let n=0;if(!r)n=Object.keys(e).length;else for(const i in e)e[i]!==void 0&&n++;let o=0;for(const i in t)if((!r||t[i]!==void 0)&&(o++,o>n||!st(e[i],t[i],s)))return!1;return n===o}return!1}function bt(e){let t,s;const r=new Promise((n,o)=>{t=n,s=o});return r.status="pending",r.resolve=n=>{r.status="resolved",r.value=n,t(n),e?.(n)},r.reject=n=>{r.status="rejected",s(n)},r}function Ft(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}function Ur(e,t){for(let s=e.length-1;s>=0;s--){const r=e[s];if(t(r))return r}}const La=/[\x00-\x1f\x7f"<>`{}]/g;function Ma(e){return e.replace(La,t=>"%"+t.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0"))}function $r(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,s=>{try{return decodeURI(s)}catch{return s}})}return Ma(t)}const Ia=["http:","https:","mailto:","tel:"];function ps(e,t){if(!e)return!1;try{const s=new URL(e);return!t.has(s.protocol)}catch{return!1}}function Et(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 s=0,r="",n;for(;(n=t.exec(e))!==null;)r+=$r(e.slice(s,n.index))+n[0],s=t.lastIndex;r=r+$r(s?e.slice(s):e);let o=!1;return r.startsWith("//")&&(o=!0,r="/"+r.replace(/^\/+/,"")),{path:r,handledProtocolRelativeURL:o}}function Da(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Fa(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let s=0;s<e.length;s++)if(e[s]!==t[s])return!1;return!0}function Ue(){throw new Error("Invariant failed")}function Ut(e){const t=new Map;let s,r;const n=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,s=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 n(i),i.value},set(o,i){if(t.size>=e&&s){const l=s;t.delete(l.key),l.next&&(s=l.next,l.next.prev=void 0),l===r&&(r=void 0)}const c=t.get(o);if(c)c.value=i,n(c);else{const l={key:o,value:i,prev:r};r&&(r.next=l),r=l,s||(s=l),t.set(o,l)}},clear(){t.clear(),s=void 0,r=void 0}}}const Ve=4,Kn=5;function Ua(e){const t=e.indexOf("{");if(t===-1)return null;const s=e.indexOf("}",t);return s===-1||t+1>=e.length?null:[t,s]}function Yn(e,t,s=new Uint16Array(6)){const r=e.indexOf("/",t),n=r===-1?e.length:r,o=e.substring(t,n);if(!o||!o.includes("$"))return s[0]=0,s[1]=t,s[2]=t,s[3]=n,s[4]=n,s[5]=n,s;if(o==="$"){const c=e.length;return s[0]=2,s[1]=t,s[2]=t,s[3]=c,s[4]=c,s[5]=c,s}if(o.charCodeAt(0)===36)return s[0]=1,s[1]=t,s[2]=t+1,s[3]=n,s[4]=n,s[5]=n,s;const i=Ua(o);if(i){const[c,l]=i,d=o.charCodeAt(c+1);if(d===45){if(c+2<o.length&&o.charCodeAt(c+2)===36){const f=c+3,u=l;if(f<u)return s[0]=3,s[1]=t+c,s[2]=t+f,s[3]=t+u,s[4]=t+l+1,s[5]=n,s}}else if(d===36){const f=c+1,u=c+2;return u===l?(s[0]=2,s[1]=t+c,s[2]=t+f,s[3]=t+u,s[4]=t+l+1,s[5]=e.length,s):(s[0]=1,s[1]=t+c,s[2]=t+u,s[3]=t+l,s[4]=t+l+1,s[5]=n,s)}}return s[0]=0,s[1]=t,s[2]=t,s[3]=n,s[4]=n,s[5]=n,s}function _s(e,t,s,r,n,o,i){i?.(s);let c=r;{const l=s.fullPath??s.from,d=l.length,f=s.options?.caseSensitive??e,u=s.options?.params?.parse??s.options?.parseParams;for(;c<d;){const m=Yn(l,c,t);let p;const g=c,x=m[5];switch(c=x+1,o++,m[0]){case 0:{const b=l.substring(m[2],m[3]);if(f){const y=n.static?.get(b);if(y)p=y;else{n.static??=new Map;const S=et(s.fullPath??s.from);S.parent=n,S.depth=o,p=S,n.static.set(b,S)}}else{const y=b.toLowerCase(),S=n.staticInsensitive?.get(y);if(S)p=S;else{n.staticInsensitive??=new Map;const w=et(s.fullPath??s.from);w.parent=n,w.depth=o,p=w,n.staticInsensitive.set(y,w)}}break}case 1:{const b=l.substring(g,m[1]),y=l.substring(m[4],x),S=f&&!!(b||y),w=b?S?b:b.toLowerCase():void 0,N=y?S?y:y.toLowerCase():void 0,_=!u&&n.dynamic?.find(C=>!C.parse&&C.caseSensitive===S&&C.prefix===w&&C.suffix===N);if(_)p=_;else{const C=Ds(1,s.fullPath??s.from,S,w,N);p=C,C.depth=o,C.parent=n,n.dynamic??=[],n.dynamic.push(C)}break}case 3:{const b=l.substring(g,m[1]),y=l.substring(m[4],x),S=f&&!!(b||y),w=b?S?b:b.toLowerCase():void 0,N=y?S?y:y.toLowerCase():void 0,_=!u&&n.optional?.find(C=>!C.parse&&C.caseSensitive===S&&C.prefix===w&&C.suffix===N);if(_)p=_;else{const C=Ds(3,s.fullPath??s.from,S,w,N);p=C,C.parent=n,C.depth=o,n.optional??=[],n.optional.push(C)}break}case 2:{const b=l.substring(g,m[1]),y=l.substring(m[4],x),S=f&&!!(b||y),w=b?S?b:b.toLowerCase():void 0,N=y?S?y:y.toLowerCase():void 0,_=Ds(2,s.fullPath??s.from,S,w,N);p=_,_.parent=n,_.depth=o,n.wildcard??=[],n.wildcard.push(_)}}n=p}if(u&&s.children&&!s.isRoot&&s.id&&s.id.charCodeAt(s.id.lastIndexOf("/")+1)===95){const m=et(s.fullPath??s.from);m.kind=Kn,m.parent=n,o++,m.depth=o,n.pathless??=[],n.pathless.push(m),n=m}const h=(s.path||!s.children)&&!s.isRoot;if(h&&l.endsWith("/")){const m=et(s.fullPath??s.from);m.kind=Ve,m.parent=n,o++,m.depth=o,n.index=m,n=m}n.parse=u??null,n.priority=s.options?.params?.priority??0,h&&!n.route&&(n.route=s,n.fullPath=s.fullPath??s.from)}if(s.children)for(const l of s.children)_s(e,t,l,c,n,o,i)}function Is(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 ze(e){if(e.pathless)for(const t of e.pathless)ze(t);if(e.static)for(const t of e.static.values())ze(t);if(e.staticInsensitive)for(const t of e.staticInsensitive.values())ze(t);if(e.dynamic?.length){e.dynamic.sort(Is);for(const t of e.dynamic)ze(t)}if(e.optional?.length){e.optional.sort(Is);for(const t of e.optional)ze(t)}if(e.wildcard?.length){e.wildcard.sort(Is);for(const t of e.wildcard)ze(t)}}function et(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 Ds(e,t,s,r,n){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:s,prefix:r,suffix:n}}function $a(e,t){const s=et("/"),r=new Uint16Array(6);for(const n of e)_s(!1,r,n,1,s,0);ze(s),t.masksTree=s,t.flatCache=Ut(1e3)}function Ba(e,t){e||="/";const s=t.flatCache.get(e);if(s)return s;const r=mr(e,t.masksTree);return t.flatCache.set(e,r),r}function za(e,t,s,r,n){e||="/",r||="/";const o=t?`case\0${e}`:e;let i=n.singleCache.get(o);return i||(i=et("/"),_s(t,new Uint16Array(6),{from:e},1,i,0),n.singleCache.set(o,i)),mr(r,i,s)}function Va(e,t,s=!1){const r=s?e:`nofuzz\0${e}`,n=t.matchCache.get(r);if(n!==void 0)return n;e||="/";let o;try{o=mr(e,t.segmentTree,s)}catch(i){if(i instanceof URIError)o=null;else throw i}return o&&(o.branch=Xn(o.route)),t.matchCache.set(r,o),o}function Wa(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function Ha(e,t=!1,s){const r=et(e.fullPath),n=new Uint16Array(6),o={},i={};let c=0;return _s(t,n,e,1,r,0,l=>{if(s?.(l,c),l.id in o){if(process.env.NODE_ENV!=="production")throw new Error(`Invariant failed: Duplicate routes found with id: ${String(l.id)}`);Ue()}if(o[l.id]=l,c!==0&&l.path){const d=Wa(l.fullPath);(!i[d]||l.fullPath.endsWith("/"))&&(i[d]=l)}c++}),ze(r),{processedTree:{segmentTree:r,singleCache:Ut(1e3),matchCache:Ut(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:i}}function mr(e,t,s=!1){const r=e.split("/"),n=Ga(e,r,t,s);if(!n)return null;const[o]=Jn(e,r,n);return{route:n.node.route,rawParams:o}}function Jn(e,t,s){const r=qa(s.node);let n=null;const o=Object.create(null);let i=s.extract?.part??0,c=s.extract?.node??0,l=s.extract?.path??0,d=s.extract?.segment??0;for(;c<r.length;i++,c++,l++,d++){const f=r[c];if(f.kind===Ve)break;if(f.kind===Kn){d--,i--,l--;continue}const u=t[i],h=l;if(u&&(l+=u.length),f.kind===1){n??=s.node.fullPath.split("/");const m=n[d],p=f.prefix?.length??0;if(m.charCodeAt(p)===123){const g=f.suffix?.length??0,x=m.substring(p+2,m.length-g-1),b=u.substring(p,u.length-g);o[x]=decodeURIComponent(b)}else{const g=m.substring(1);o[g]=decodeURIComponent(u)}}else if(f.kind===3){if(s.skipped&1<<c){i--,l=h-1;continue}n??=s.node.fullPath.split("/");const m=n[d],p=f.prefix?.length??0,g=f.suffix?.length??0,x=m.substring(p+3,m.length-g-1),b=f.suffix||f.prefix?u.substring(p,u.length-g):u;b&&(o[x]=decodeURIComponent(b))}else if(f.kind===2){const m=f,p=e.substring(h+(m.prefix?.length??0),e.length-(m.suffix?.length??0)),g=decodeURIComponent(p);o["*"]=g,o._splat=g;break}}return s.rawParams&&Object.assign(o,s.rawParams),[o,{part:i,node:c,path:l,segment:d}]}function Xn(e){const t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function qa(e){const t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function Ga(e,t,s,r){if(e==="/"&&s.index)return{node:s.index,skipped:0};const n=!Dt(t),o=n&&e!=="/",i=t.length-(n?1:0),c=[{node:s,index:1,skipped:0,depth:1,statics:0,dynamics:0,optionals:0}];let l=null,d=null;for(;c.length;){const f=c.pop(),{node:u,index:h,skipped:m,depth:p,statics:g,dynamics:x,optionals:b}=f;let{extract:y,rawParams:S}=f;if(u.kind===2&&u.route&&!Yt(d,f))continue;if(u.parse){if(!Br(e,t,f))continue;S=f.rawParams,y=f.extract}r&&u.route&&u.kind!==Ve&&Yt(l,f)&&(l=f);const w=h===i;if(w&&(u.route&&(!o||u.kind===Ve||u.kind===2)&&Yt(d,f)&&(d=f),!u.optional&&!u.wildcard&&!u.index&&!u.pathless))continue;const N=w?void 0:t[h];let _;if(w&&u.index){const C={node:u.index,index:h,skipped:m,depth:p+1,statics:g,dynamics:x,optionals:b,extract:y,rawParams:S};let R=!0;if(u.index.parse&&(Br(e,t,C)||(R=!1)),R){if(!x&&!b&&!m&&Ka(g,i))return C;Yt(d,C)&&(d=C)}}if(u.wildcard)for(let C=u.wildcard.length-1;C>=0;C--){const R=u.wildcard[C],{prefix:E,suffix:D}=R;if(!(E&&(w||!(R.caseSensitive?N:_??=N.toLowerCase()).startsWith(E)))){if(D){if(w)continue;const L=t.slice(h).join("/").slice(-D.length);if((R.caseSensitive?L:L.toLowerCase())!==D)continue}c.push({node:R,index:i,skipped:m,depth:p+1,statics:g,dynamics:x,optionals:b,extract:y,rawParams:S})}}if(u.optional){const C=m|1<<p,R=p+1;for(let E=u.optional.length-1;E>=0;E--){const D=u.optional[E];c.push({node:D,index:h,skipped:C,depth:R,statics:g,dynamics:x,optionals:b,extract:y,rawParams:S})}if(!w)for(let E=u.optional.length-1;E>=0;E--){const D=u.optional[E],{prefix:L,suffix:F}=D;if(L||F){const ee=D.caseSensitive?N:_??=N.toLowerCase();if(L&&!ee.startsWith(L)||F&&!ee.endsWith(F))continue}c.push({node:D,index:h+1,skipped:m,depth:R,statics:g,dynamics:x,optionals:b+Kt(i,h),extract:y,rawParams:S})}}if(!w&&u.dynamic&&N)for(let C=u.dynamic.length-1;C>=0;C--){const R=u.dynamic[C],{prefix:E,suffix:D}=R;if(E||D){const L=R.caseSensitive?N:_??=N.toLowerCase();if(E&&!L.startsWith(E)||D&&!L.endsWith(D))continue}c.push({node:R,index:h+1,skipped:m,depth:p+1,statics:g,dynamics:x+Kt(i,h),optionals:b,extract:y,rawParams:S})}if(!w&&u.staticInsensitive){const C=u.staticInsensitive.get(_??=N.toLowerCase());C&&c.push({node:C,index:h+1,skipped:m,depth:p+1,statics:g+Kt(i,h),dynamics:x,optionals:b,extract:y,rawParams:S})}if(!w&&u.static){const C=u.static.get(N);C&&c.push({node:C,index:h+1,skipped:m,depth:p+1,statics:g+Kt(i,h),dynamics:x,optionals:b,extract:y,rawParams:S})}if(u.pathless){const C=p+1;for(let R=u.pathless.length-1;R>=0;R--){const E=u.pathless[R];c.push({node:E,index:h,skipped:m,depth:C,statics:g,dynamics:x,optionals:b,extract:y,rawParams:S})}}}if(d)return d;if(r&&l){let f=l.index;for(let h=0;h<l.index;h++)f+=t[h].length;const u=f===e.length?"/":e.slice(f);return l.rawParams??=Object.create(null),l.rawParams["**"]=decodeURIComponent(u),l}return null}function Kt(e,t){return 2**(e-t-1)}function Ka(e,t){return e===2**(t-1)-1}function Br(e,t,s){let r,n;try{[r,n]=Jn(e,t,s)}catch{return null}if(s.rawParams=r,s.extract=n,!s.node.parse)return!0;try{if(s.node.parse(r)===!1)return null}catch{}return!0}function Yt(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===Ve)>(e.node.kind===Ve)||t.node.kind===Ve==(e.node.kind===Ve)&&t.depth>e.depth))):!0}function is(e){return pr(e.filter(t=>t!==void 0).join("/"))}function pr(e){return e.replace(/\/{2,}/g,"/")}function Zn(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function Fe(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/{1,}$/,""):e}function Qn(e){return Fe(Zn(e))}function gs(e,t){return e?.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function Ya(e,t,s){return gs(e,s)===gs(t,s)}function Ja({base:e,to:t,trailingSlash:s="never",cache:r}){const n=t.startsWith("/"),o=!n&&t===".";let i;if(r){i=n?t:o?e:e+"\0"+t;const d=r.get(i);if(d)return d}let c;if(o)c=e.split("/");else if(n)c=t.split("/");else{for(c=e.split("/");c.length>1&&Dt(c)==="";)c.pop();const d=t.split("/");for(let f=0,u=d.length;f<u;f++){const h=d[f];h===""?f?f===u-1&&c.push(h):c=[h]:h===".."?c.pop():h==="."||c.push(h)}}c.length>1&&(Dt(c)===""?s==="never"&&c.pop():s==="always"&&c.push(""));const l=pr(c.join("/"))||"/";return i&&r&&r.set(i,l),l}function Xa(e){const t=new Map(e.map(n=>[encodeURIComponent(n),n])),s=Array.from(t.keys()).map(n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),r=new RegExp(s,"g");return n=>n.replace(r,o=>t.get(o)??o)}function Fs(e,t,s){const r=t[e];return typeof r!="string"?r:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split("/").map(n=>Vr(n,s)).join("/"):Vr(r,s)}function zr({path:e,params:t,decoder:s,...r}){let n=!1;const o=Object.create(null);if(!e||e==="/")return{interpolatedPath:"/",usedParams:o,isMissingParams:n};if(!e.includes("$"))return{interpolatedPath:e,usedParams:o,isMissingParams:n};const i=e.length;let c=0,l,d="";for(;c<i;){const f=c;l=Yn(e,f,l);const u=l[5];if(c=u+1,f===u)continue;const h=l[0];if(h===0){d+="/"+e.substring(f,u);continue}if(h===2){const m=t._splat;o._splat=m,o["*"]=m;const p=e.substring(f,l[1]),g=e.substring(l[4],u);if(!m){n=!0,(p||g)&&(d+="/"+p+g);continue}const x=Fs("_splat",t,s);d+="/"+p+x+g;continue}if(h===1){const m=e.substring(l[2],l[3]);!n&&!(m in t)&&(n=!0),o[m]=t[m];const p=e.substring(f,l[1]),g=e.substring(l[4],u),x=Fs(m,t,s)??"undefined";d+="/"+p+x+g;continue}if(h===3){const m=e.substring(l[2],l[3]),p=t[m];if(p==null)continue;o[m]=p;const g=e.substring(f,l[1]),x=e.substring(l[4],u),b=Fs(m,t,s)??"";d+="/"+g+b+x;continue}}return e.endsWith("/")&&(d+="/"),{usedParams:o,interpolatedPath:d||"/",isMissingParams:n}}function Vr(e,t){const s=encodeURIComponent(e);return t?.(s)??s}function ge(e){return e?.isNotFound===!0}function Za(e,t=String){const s=new URLSearchParams;for(const r in e){const n=e[r];n!==void 0&&s.set(r,t(n))}return s.toString()}function Us(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function Qa(e){const t=new URLSearchParams(e),s=Object.create(null);for(const[r,n]of t.entries()){const o=s[r];o==null?s[r]=Us(n):Array.isArray(o)?o.push(Us(n)):s[r]=[o,Us(n)]}return s}const ei=si(JSON.parse),ti=ri(JSON.stringify,JSON.parse);function si(e){return t=>{t[0]==="?"&&(t=t.substring(1));const s=Qa(t);for(const r in s){const n=s[r];if(typeof n=="string")try{s[r]=e(n)}catch{}}return s}}function ri(e,t){const s=typeof t=="function";function r(n){if(typeof n=="object"&&n!==null)try{return e(n)}catch{}else if(s&&typeof n=="string")try{return t(n),e(n)}catch{}return n}return n=>{const o=Za(n,r);return o?`?${o}`:""}}const rt="__root__";function ni(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 s=new Response(null,{status:e.statusCode,headers:t});if(s.options=e,e.throw)throw s;return s}function Se(e){return e instanceof Response&&!!e.options}const tr=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},oi=e=>e.stores.matchesId.get().some(t=>e.stores.matchStores.get(t)?.get()._forcePending),ks=(e,t)=>!!(e.preload&&!e.router.stores.matchStores.has(t)),nt=(e,t,s=!0)=>{const r={...e.router.options.context??{}},n=s?t:t-1;for(let o=0;o<=n;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},Wr=(e,t)=>{if(!e.matches.length)return;const s=t.routeId,r=e.matches.findIndex(i=>i.routeId===e.router.routeTree.id),n=r>=0?r:0;let o=s?e.matches.findIndex(i=>i.routeId===s):e.firstBadMatchIndex??e.matches.length-1;o<0&&(o=n);for(let i=o;i>=0;i--){const c=e.matches[i];if(e.router.looseRoutesById[c.routeId].options.notFoundComponent)return i}return s?o:n},We=(e,t,s)=>{if(!(!Se(s)&&!ge(s)))throw Se(s)&&s.redirectHandled&&!s.options.reloadDocument||(t&&(t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=s,e.updateMatch(t.id,r=>({...r,status:Se(s)?"redirected":ge(s)?"notFound":r.status==="pending"?"success":r.status,context:nt(e,t.index),isFetching:!1,error:s})),ge(s)&&!s.routeId&&(s.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()),Se(s)&&(e.rendered=!0,s.options._fromLocation=e.location,s.redirectHandled=!0,s=e.router.resolveRedirect(s))),s},eo=(e,t)=>{const s=e.router.getMatch(t);return!!(!s||s._nonReactive.dehydrated)},Hr=(e,t,s)=>{const r=nt(e,s);e.updateMatch(t,n=>({...n,context:r}))},Pt=(e,t,s)=>{const{id:r,routeId:n}=e.matches[t],o=e.router.looseRoutesById[n];if(s instanceof Promise)throw s;e.firstBadMatchIndex??=t,We(e,e.router.getMatch(r),s);try{o.options.onError?.(s)}catch(i){s=i,We(e,e.router.getMatch(r),s)}e.updateMatch(r,i=>(i._nonReactive.beforeLoadPromise?.resolve(),i._nonReactive.beforeLoadPromise=void 0,i._nonReactive.loadPromise?.resolve(),{...i,error:s,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})),!e.preload&&!Se(s)&&!ge(s)&&(e.serialError??=s)},to=(e,t,s,r)=>{if(r._nonReactive.pendingTimeout!==void 0)return;const n=s.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!ks(e,t)&&(s.options.loader||s.options.beforeLoad||ro(s))&&typeof n=="number"&&n!==1/0&&(s.options.pendingComponent??e.router.options?.defaultPendingComponent)){const o=setTimeout(()=>{tr(e)},n);r._nonReactive.pendingTimeout=o}},ai=(e,t,s)=>{const r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;to(e,t,s,r);const n=()=>{const o=e.router.getMatch(t);o.preload&&(o.status==="redirected"||o.status==="notFound")&&We(e,o,o.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(n):n()},ii=(e,t,s,r)=>{const n=e.router.getMatch(t);let o=n._nonReactive.loadPromise;n._nonReactive.loadPromise=bt(()=>{o?.resolve(),o=void 0});const{paramsError:i,searchError:c}=n;i&&Pt(e,s,i),c&&Pt(e,s,c),to(e,t,r,n);const l=new AbortController;let d=!1;const f=()=>{d||(d=!0,e.updateMatch(t,w=>({...w,isFetching:"beforeLoad",fetchCount:w.fetchCount+1,abortController:l})))},u=()=>{n._nonReactive.beforeLoadPromise?.resolve(),n._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,w=>({...w,isFetching:!1}))};if(!r.options.beforeLoad){e.router.batch(()=>{f(),u()});return}n._nonReactive.beforeLoadPromise=bt();const h={...nt(e,s,!1),...n.__routeContext},{search:m,params:p,cause:g}=n,x=ks(e,t),b={search:m,abortController:l,params:p,preload:x,context:h,location:e.location,navigate:w=>e.router.navigate({...w,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:x?"preload":g,matches:e.matches,routeId:r.id,...e.router.options.additionalContext},y=w=>{if(w===void 0){e.router.batch(()=>{f(),u()});return}(Se(w)||ge(w))&&(f(),Pt(e,s,w)),e.router.batch(()=>{f(),e.updateMatch(t,N=>({...N,__beforeLoadContext:w})),u()})};let S;try{if(S=r.options.beforeLoad(b),Ft(S))return f(),S.catch(w=>{Pt(e,s,w)}).then(y)}catch(w){f(),Pt(e,s,w)}y(S)},ci=(e,t)=>{const{id:s,routeId:r}=e.matches[t],n=e.router.looseRoutesById[r],o=()=>c(),i=()=>ii(e,s,t,n),c=()=>{if(eo(e,s))return;const l=ai(e,s,n);return Ft(l)?l.then(i):i()};return o()},li=(e,t,s)=>{const r=e.router.getMatch(t);if(!r||!s.options.head&&!s.options.scripts&&!s.options.headers)return;const n={ssr:e.router.options.ssr,matches:e.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([s.options.head?.(n),s.options.scripts?.(n),s.options.headers?.(n)]).then(([o,i,c])=>({meta:o?.meta,links:o?.links,headScripts:o?.scripts,headers:c,scripts:i,styles:o?.styles}))},so=(e,t,s,r,n)=>{const o=t[r-1],{params:i,loaderDeps:c,abortController:l,cause:d}=e.router.getMatch(s),f=nt(e,r),u=ks(e,s);return{params:i,deps:c,preload:!!u,parentMatchPromise:o,abortController:l,context:f,location:e.location,navigate:h=>e.router.navigate({...h,_fromLocation:e.location}),cause:u?"preload":d,route:n,...e.router.options.additionalContext}},qr=async(e,t,s,r,n)=>{try{const o=e.router.getMatch(s);try{(!(Hn??e.router.isServer)||o.ssr===!0)&&$t(n);const i=n.options.loader,c=typeof i=="function"?i:i?.handler,l=c?.(so(e,t,s,r,n)),d=!!c&&Ft(l);if((d||n._lazyPromise||n._componentsPromise||n.options.head||n.options.scripts||n.options.headers||o._nonReactive.minPendingPromise)&&e.updateMatch(s,u=>({...u,isFetching:"loader"})),c){const u=d?await l:l;We(e,e.router.getMatch(s),u),u!==void 0&&e.updateMatch(s,h=>({...h,loaderData:u}))}n._lazyPromise&&await n._lazyPromise;const f=o._nonReactive.minPendingPromise;f&&await f,n._componentsPromise&&await n._componentsPromise,e.updateMatch(s,u=>({...u,error:void 0,context:nt(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(s,d=>({...d,status:d.status==="pending"?"success":d.status,isFetching:!1,context:nt(e,r)}));return}const l=o._nonReactive.minPendingPromise;l&&await l,ge(i)&&await n.options.notFoundComponent?.preload?.(),We(e,e.router.getMatch(s),i);try{n.options.onError?.(i)}catch(d){c=d,We(e,e.router.getMatch(s),d)}!Se(c)&&!ge(c)&&await $t(n,["errorComponent"]),e.updateMatch(s,d=>({...d,error:c,context:nt(e,r),status:"error",isFetching:!1}))}}catch(o){const i=e.router.getMatch(s);i&&(i._nonReactive.loaderPromise=void 0),We(e,i,o)}},di=async(e,t,s)=>{async function r(m,p,g,x,b){const y=Date.now()-p.updatedAt,S=m?b.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:b.options.staleTime??e.router.options.defaultStaleTime??0,w=b.options.shouldReload,N=typeof w=="function"?w(so(e,t,n,s,b)):w,{status:_,invalid:C}=x,R=y>=S&&(!!e.forceStaleReload||x.cause==="enter"||g!==void 0&&g!==x.id);i=_==="success"&&(C||(N??R)),m&&b.options.preload===!1||(i&&!e.sync&&f?(c=!0,(async()=>{try{await qr(e,t,n,s,b);const E=e.router.getMatch(n);E._nonReactive.loaderPromise?.resolve(),E._nonReactive.loadPromise?.resolve(),E._nonReactive.loaderPromise=void 0,E._nonReactive.loadPromise=void 0}catch(E){Se(E)&&await e.router.navigate(E.options)}})()):_!=="success"||i?await qr(e,t,n,s,b):Hr(e,n,s))}const{id:n,routeId:o}=e.matches[s];let i=!1,c=!1;const l=e.router.looseRoutesById[o],d=l.options.loader,f=((typeof d=="function"?void 0:d?.staleReloadMode)??e.router.options.defaultStaleReloadMode)!=="blocking";if(eo(e,n)){if(!e.router.getMatch(n))return e.matches[s];Hr(e,n,s)}else{const m=e.router.getMatch(n),p=e.router.stores.matchesId.get()[s],g=(p&&e.router.stores.matchStores.get(p)||null)?.routeId===o?p:e.router.stores.matches.get().find(b=>b.routeId===o)?.id,x=ks(e,n);if(m._nonReactive.loaderPromise){if(m.status==="success"&&!e.sync&&!m.preload&&f)return m;await m._nonReactive.loaderPromise;const b=e.router.getMatch(n),y=b._nonReactive.error||b.error;y&&We(e,b,y),b.status==="pending"&&await r(x,m,g,b,l)}else{const b=x&&!e.router.stores.matchStores.has(n),y=e.router.getMatch(n);y._nonReactive.loaderPromise=bt(),b!==y.preload&&e.updateMatch(n,S=>({...S,preload:b})),await r(x,m,g,y,l)}}const u=e.router.getMatch(n);c||(u._nonReactive.loaderPromise?.resolve(),u._nonReactive.loadPromise?.resolve(),u._nonReactive.loadPromise=void 0),clearTimeout(u._nonReactive.pendingTimeout),u._nonReactive.pendingTimeout=void 0,c||(u._nonReactive.loaderPromise=void 0),u._nonReactive.dehydrated=void 0;const h=c?u.isFetching:!1;return h!==u.isFetching||u.invalid!==!1?(e.updateMatch(n,m=>({...m,isFetching:h,invalid:!1})),e.router.getMatch(n)):u};async function Gr(e){const t=e,s=[];oi(t.router)&&tr(t);let r;for(let h=0;h<t.matches.length;h++){try{const m=ci(t,h);Ft(m)&&await m}catch(m){if(Se(m))throw m;if(ge(m))r=m;else if(!t.preload)throw m;break}if(t.serialError||t.firstBadMatchIndex!=null)break}const n=t.firstBadMatchIndex??t.matches.length,o=r&&!t.preload?Wr(t,r):void 0,i=r&&t.preload?0:o!==void 0?Math.min(o+1,n):n;let c,l;for(let h=0;h<i;h++)s.push(di(t,s,h));try{await Promise.all(s)}catch{const h=await Promise.allSettled(s);for(const m of h){if(m.status!=="rejected")continue;const p=m.reason;if(Se(p))throw p;ge(p)?c??=p:l??=p}if(l!==void 0)throw l}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=Wr(t,d);if(h===void 0){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Could not find match for notFound boundary");Ue()}const m=t.matches[h],p=t.router.looseRoutesById[m.routeId],g=t.router.options?.defaultNotFoundComponent;!p.options.notFoundComponent&&g&&(p.options.notFoundComponent=g),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 $t(p,["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 $t(h,["errorComponent"])}for(let h=0;h<=f;h++){const{id:m,routeId:p}=t.matches[h],g=t.router.looseRoutesById[p];try{const x=li(t,m,g);if(x){const b=await x;t.updateMatch(m,y=>({...y,...b}))}}catch(x){console.error(`Error executing head for route ${p}:`,x)}}const u=tr(t);if(Ft(u)&&await u,d)throw d;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function Kr(e,t){const s=t.map(r=>e.options[r]?.preload?.()).filter(Boolean);if(s.length!==0)return Promise.all(s)}function $t(e,t=cs){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(r=>{const{id:n,...o}=r.options;Object.assign(e.options,o),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);const s=()=>e._componentsLoaded?void 0:t===cs?(()=>{if(e._componentsPromise===void 0){const r=Kr(e,cs);r?e._componentsPromise=r.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():Kr(e,t);return e._lazyPromise?e._lazyPromise.then(s):s()}function ro(e){for(const t of cs)if(e.options[t]?.preload)return!0;return!1}const cs=["component","errorComponent","pendingComponent","notFoundComponent"];function ui(e){return{input:({url:t})=>{for(const s of e)t=sr(s,t);return t},output:({url:t})=>{for(let s=e.length-1;s>=0;s--)t=no(e[s],t);return t}}}function fi(e){const t=Qn(e.basepath),s=`/${t}`,r=e.caseSensitive?s:s.toLowerCase(),n=`${r}/`;return{input:({url:o})=>{const i=e.caseSensitive?o.pathname:o.pathname.toLowerCase();return i===r?o.pathname="/":i.startsWith(n)&&(o.pathname=o.pathname.slice(s.length)),o},output:({url:o})=>(o.pathname=is(["/",t,o.pathname]),o)}}function sr(e,t){const s=e?.input?.({url:t});if(s){if(typeof s=="string")return new URL(s);if(s instanceof URL)return s}return t}function no(e,t){const s=e?.output?.({url:t});if(s){if(typeof s=="string")return new URL(s);if(s instanceof URL)return s}return t}function hi(e,t){const{createMutableStore:s,createReadonlyStore:r,batch:n,init:o}=t,i=new Map,c=new Map,l=new Map,d=s(e.status),f=s(e.loadedAt),u=s(e.isLoading),h=s(e.isTransitioning),m=s(e.location),p=s(e.resolvedLocation),g=s(e.statusCode),x=s(e.redirect),b=s([]),y=s([]),S=s([]),w=r(()=>$s(i,b.get())),N=r(()=>$s(c,y.get())),_=r(()=>$s(l,S.get())),C=r(()=>b.get()[0]),R=r(()=>b.get().some(Y=>i.get(Y)?.get().status==="pending")),E=r(()=>({locationHref:m.get().href,resolvedLocationHref:p.get()?.href,status:d.get()})),D=r(()=>({status:d.get(),loadedAt:f.get(),isLoading:u.get(),isTransitioning:h.get(),matches:w.get(),location:m.get(),resolvedLocation:p.get(),statusCode:g.get(),redirect:x.get()})),L=Ut(64);function F(Y){let le=L.get(Y);return le||(le=r(()=>{const fe=b.get();for(const T of fe){const j=i.get(T);if(j&&j.routeId===Y)return j.get()}}),L.set(Y,le)),le}const ee={status:d,loadedAt:f,isLoading:u,isTransitioning:h,location:m,resolvedLocation:p,statusCode:g,redirect:x,matchesId:b,pendingIds:y,cachedIds:S,matches:w,pendingMatches:N,cachedMatches:_,firstId:C,hasPending:R,matchRouteDeps:E,matchStores:i,pendingMatchStores:c,cachedMatchStores:l,__store:D,getRouteMatchStore:F,setMatches:V,setPending:Z,setCached:Q};V(e.matches),o?.(ee);function V(Y){Bs(Y,i,b,s,n)}function Z(Y){Bs(Y,c,y,s,n)}function Q(Y){Bs(Y,l,S,s,n)}return ee}function $s(e,t){const s=[];for(const r of t){const n=e.get(r);n&&s.push(n.get())}return s}function Bs(e,t,s,r,n){const o=e.map(c=>c.id),i=new Set(o);n(()=>{for(const c of t.keys())i.has(c)||t.delete(c);for(const c of e){const l=t.get(c.id);if(!l){const d=r(c);d.routeId=c.routeId,t.set(c.id,d);continue}l.routeId=c.routeId,l.get()!==c&&l.set(c)}Fa(s.get(),o)||s.set(o)})}var He="__TSR_index",Yr="popstate",Jr="beforeunload";function mi(e){let t=e.getLocation();const s=new Set,r=i=>{t=e.getLocation(),s.forEach(c=>c({location:t,action:i}))},n=i=>{e.notifyOnIndexChange??!0?r(i):t=e.getLocation()},o=async({task:i,navigateOpts:c,...l})=>{if(c?.ignoreBlocker??!1){i();return}const d=e.getBlockers?.()??[],f=l.type==="PUSH"||l.type==="REPLACE";if(typeof document<"u"&&d.length&&f)for(const u of d){const h=xs(l.path,l.state);if(await u.blockerFn({currentLocation:t,nextLocation:h,action:l.type})){e.onBlocked?.();return}}i()};return{get location(){return t},get length(){return e.getLength()},subscribers:s,subscribe:i=>(s.add(i),()=>{s.delete(i)}),push:(i,c,l)=>{const d=t.state[He];c=Xr(d+1,c),o({task:()=>{e.pushState(i,c),r({type:"PUSH"})},navigateOpts:l,type:"PUSH",path:i,state:c})},replace:(i,c,l)=>{const d=t.state[He];c=Xr(d,c),o({task:()=>{e.replaceState(i,c),r({type:"REPLACE"})},navigateOpts:l,type:"REPLACE",path:i,state:c})},go:(i,c)=>{o({task:()=>{e.go(i),n({type:"GO",index:i})},navigateOpts:c,type:"GO"})},back:i=>{o({task:()=>{e.back(i?.ignoreBlocker??!1),n({type:"BACK"})},navigateOpts:i,type:"BACK"})},forward:i=>{o({task:()=>{e.forward(i?.ignoreBlocker??!1),n({type:"FORWARD"})},navigateOpts:i,type:"FORWARD"})},canGoBack:()=>t.state[He]!==0,createHref:i=>e.createHref(i),block:i=>{if(!e.setBlockers)return()=>{};const c=e.getBlockers?.()??[];return e.setBlockers([...c,i]),()=>{const l=e.getBlockers?.()??[];e.setBlockers?.(l.filter(d=>d!==i))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function Xr(e,t){t||(t={});const s=gr();return{...t,key:s,__TSR_key:s,[He]:e}}function pi(e){const t=typeof document<"u"?window:void 0,s=t.history.pushState,r=t.history.replaceState;let n=[];const o=()=>n,i=R=>n=R,c=(R=>R),l=(()=>xs(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){const R=gr();t.history.replaceState({[He]:0,key:R,__TSR_key:R},"")}let d=l(),f,u=!1,h=!1,m=!1,p=!1;const g=()=>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)},S=(R,E,D)=>{const L=c(E);b||(f=d),d=xs(E,D),x={href:L,state:D,isPush:x?.isPush||R==="push"},b||(b=Promise.resolve().then(()=>y()))},w=R=>{d=l(),C.notify({type:R})},N=async()=>{if(h){h=!1;return}const R=l(),E=R.state[He]-d.state[He],D=E===1,L=E===-1,F=!D&&!L||u;u=!1;const ee=F?"GO":L?"BACK":"FORWARD",V=F?{type:"GO",index:E}:{type:L?"BACK":"FORWARD"};if(m)m=!1;else{const Z=o();if(typeof document<"u"&&Z.length){for(const Q of Z)if(await Q.blockerFn({currentLocation:d,nextLocation:R,action:ee})){h=!0,t.history.go(1),C.notify(V);return}}}d=l(),C.notify(V)},_=R=>{if(p){p=!1;return}let E=!1;const D=o();if(typeof document<"u"&&D.length)for(const L of D){const F=L.enableBeforeUnload??!0;if(F===!0){E=!0;break}if(typeof F=="function"&&F()===!0){E=!0;break}}if(E)return R.preventDefault(),R.returnValue=""},C=mi({getLocation:g,getLength:()=>t.history.length,pushState:(R,E)=>S("push",R,E),replaceState:(R,E)=>S("replace",R,E),back:R=>(R&&(m=!0),p=!0,t.history.back()),forward:R=>{R&&(m=!0),p=!0,t.history.forward()},go:R=>{u=!0,t.history.go(R)},createHref:R=>c(R),flush:y,destroy:()=>{t.history.pushState=s,t.history.replaceState=r,t.removeEventListener(Jr,_,{capture:!0}),t.removeEventListener(Yr,N)},onBlocked:()=>{f&&d!==f&&(d=f)},getBlockers:o,setBlockers:i,notifyOnIndexChange:!1});return t.addEventListener(Jr,_,{capture:!0}),t.addEventListener(Yr,N),t.history.pushState=function(...R){const E=s.apply(t.history,R);return C._ignoreSubscribers||w("PUSH"),E},t.history.replaceState=function(...R){const E=r.apply(t.history,R);return C._ignoreSubscribers||w("REPLACE"),E},C}function gi(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function xs(e,t){const s=gi(e),r=s.indexOf("#"),n=s.indexOf("?"),o=gr();return{href:s,pathname:s.substring(0,r>0?n>0?Math.min(r,n):r:n>0?n:s.length),hash:r>-1?s.substring(r):"",search:n>-1?s.slice(n,r===-1?void 0:r):"",state:t||{[He]:0,key:o,__TSR_key:o}}}function gr(){return(Math.random()+1).toString(36).substring(7)}function xt(e,t){const s=t,r=e;return{fromLocation:s,toLocation:r,pathChanged:s?.pathname!==r.pathname,hrefChanged:s?.href!==r.href,hashChanged:s?.hash!==r.hash}}const rr=new WeakMap;var xi=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=s=>s(),this.update=s=>{process.env.NODE_ENV!=="production"&&s.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,n=this.basepath??r?.basepath??"/",o=this.basepath===void 0,i=r?.rewrite;if(this.options={...r,...s},this.isServer=this.options.isServer??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=Xa(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=pi()),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=Ut(1e3),f=this.buildRouteTree(),this.setRoutes(f)}if(!this.stores&&this.latestLocation){const f=this.getStoreConfig(this);this.batch=f.batch,this.stores=hi(yi(this.latestLocation),f),Pi(this)}let c=!1;const l=this.options.basepath??"/",d=this.options.rewrite;if(o||n!==l||i!==d){this.basepath=l;const f=[],u=Qn(l);u&&u!=="/"&&f.push(fi({basepath:l})),d&&f.push(d),this.rewrite=f.length===0?void 0:f.length===1?f[0]:ui(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 s=Ha(this.routeTree,this.options.caseSensitive,(r,n)=>{r.init({originalIndex:n})});return this.options.routeMasks&&$a(this.options.routeMasks,s.processedTree),s},this.subscribe=(s,r)=>{const n={eventType:s,fn:r};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=s=>{this.subscribers.forEach(r=>{r.eventType===s.type&&r.fn(s)})},this.parseLocation=(s,r)=>{const n=({pathname:l,search:d,hash:f,href:u,state:h})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(l)){const b=this.options.parseSearch(d),y=this.options.stringifySearch(b);return{href:l+y+f,publicHref:l+y+f,pathname:Et(l).path,external:!1,searchStr:y,search:Ye(r?.search,b),hash:Et(f.slice(1)).path,state:Qe(r?.state,h)}}const m=new URL(u,this.origin),p=sr(this.rewrite,m),g=this.options.parseSearch(p.search),x=this.options.stringifySearch(g);return p.search=x,{href:p.href.replace(p.origin,""),publicHref:u,pathname:Et(p.pathname).path,external:!!this.rewrite&&p.origin!==this.origin,searchStr:x,search:Ye(r?.search,g),hash:Et(p.hash.slice(1)).path,state:Qe(r?.state,h)}},o=n(s),{__tempLocation:i,__tempKey:c}=o.state;if(i&&(!c||c===this.tempLocationKey)){const l=n(i);return l.state.key=o.state.key,l.state.__TSR_key=o.state.__TSR_key,delete l.state.__tempLocation,{...l,maskedLocation:o}}return o},this.resolvePathWithBase=(s,r)=>Ja({base:s,to:r.includes("//")?pr(r):r,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(s,r,n)=>typeof s=="string"?this.matchRoutesInternal({pathname:s,search:r},n):this.matchRoutesInternal(s,r),this.getMatchedRoutes=s=>vi({pathname:s,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=s=>{const r=this.getMatch(s);r&&(r.abortController.abort(),clearTimeout(r._nonReactive.pendingTimeout),r._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingIds.get().forEach(s=>{this.cancelMatch(s)}),this.stores.matchesId.get().forEach(s=>{if(this.stores.pendingMatchStores.has(s))return;const r=this.stores.matchStores.get(s)?.get();r&&(r.status==="pending"||r.isFetching==="loader")&&this.cancelMatch(s)})},this.buildLocation=s=>{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 L=this.getMatchedRoutes(o.from).matchedRoutes,F=Ur(c.matchedRoutes,V=>Qr(V.fullPath,o.from)),ee=Ur(L,V=>Qr(V.fullPath,c.fullPath));!F&&!ee&&console.warn(`Could not find match for from: ${o.from}`)}const l=o.unsafeRelative==="path"?i.pathname:o.from??c.fullPath,d=o.to?`${o.to}`:void 0,f=c.search,u=Object.assign(Object.create(null),c.params),h=d?.charCodeAt(0)===47?"/":this.resolvePathWithBase(l,"."),m=d?this.resolvePathWithBase(h,d):h,p=o.params===!1||o.params===null?Object.create(null):(o.params??!0)===!0?u:Object.assign(u,Ze(o.params,u)),g=this.routesByPath[Fe(m)];let x;if(g)x=this.getRouteBranch(g);else if(m.includes("$"))x=[];else{const L=this.getMatchedRoutes(m);x=L.matchedRoutes,this.options.notFoundRoute&&(!L.foundRoute||L.foundRoute.path!=="/"&&L.routeParams["**"])&&(x=[...x,this.options.notFoundRoute])}if(x.length&&Gn(p))for(const L of x){const F=L.options.params?.stringify??L.options.stringifyParams;if(F)try{Object.assign(p,F(p))}catch{}}const b=s.leaveParams?m:Et(zr({path:m,params:p,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;if(process.env.NODE_ENV!=="production"&&g&&!s.leaveParams)try{const L=this.getMatchedRoutes(b);L.foundRoute?.id!==g.id&&console.warn(`Generated path "${b}" for route "${g.id}" matched route "${L.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(s._includeValidateSearch&&this.options.search?.strict){const L={};x.forEach(F=>{if(F.options.validateSearch)try{Object.assign(L,ls(F.options.validateSearch,{...L,...y}))}catch{}}),y=L}y=wi({search:y,dest:o,destRoutes:x,_includeValidateSearch:s._includeValidateSearch}),y=Ye(f,y);const S=this.options.stringifySearch(y),w=o.hash===!0?i.hash:o.hash?Ze(o.hash,i.hash):void 0,N=w?`#${w}`:"";let _=o.state===!0?i.state:o.state?Ze(o.state,i.state):{};_=Qe(i.state,_);const C=`${b}${S}${N}`;let R,E,D=!1;if(this.rewrite){const L=new URL(C,this.origin),F=no(this.rewrite,L);R=L.href.replace(L.origin,""),F.origin!==this.origin?(E=F.href,D=!0):E=F.pathname+F.search+F.hash}else R=Da(C),E=R;return{publicHref:E,href:R,pathname:b,search:y,searchStr:S,state:_,hash:w??"",external:D,unmaskOnReload:o.unmaskOnReload}},n=(o={},i)=>{const c=r(o);let l=i?r(i):void 0;if(!l){const d=Object.create(null);if(this.options.routeMasks){const f=Ba(c.pathname,this.processedTree);if(f){Object.assign(d,f.rawParams);const{from:u,params:h,...m}=f.route,p=h===!1||h===null?Object.create(null):(h??!0)===!0?d:Object.assign(d,Ze(h,d));i={from:s.from,...m,params:p},l=r(i)}}}return l&&(c.maskedLocation=l),c};return s.mask?n(s,{from:s.from,...s.mask}):n(s)},this.commitLocation=async({viewTransition:s,ignoreBlocker:r,...n})=>{let o;const i=()=>{const d=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];d.forEach(u=>{n.state[u]=this.latestLocation.state[u]});const f=st(n.state,this.latestLocation.state);return d.forEach(u=>{delete n.state[u]}),f},c=Fe(this.latestLocation.href)===Fe(n.href);let l=this.commitLocationPromise;if(this.commitLocationPromise=bt(()=>{l?.resolve(),l=void 0}),c&&i())this.load();else{let{maskedLocation:d,hashScrollIntoView:f,...u}=n;d&&(u={...d,state:{...d.state,__tempKey:void 0,__tempLocation:{...u,search:u.searchStr,state:{...u.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(u.unmaskOnReload??this.options.unmaskOnReload??!1)&&(u.state.__tempKey=this.tempLocationKey)),u.state.__hashScrollIntoViewOptions=f??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=s,o=n.replace?"REPLACE":"PUSH",this.history[o==="REPLACE"?"replace":"push"](u.publicHref,u.state,{ignoreBlocker:r})}return this._scroll.next=n.resetScroll??!0,this.history.subscribers.size||this.load(o?{action:{type:o}}:void 0),this.commitLocationPromise},this.buildAndCommitLocation=({replace:s,resetScroll:r,hashScrollIntoView:n,viewTransition:o,ignoreBlocker:i,href:c,...l}={})=>{if(c){const u=this.history.location.state.__TSR_index,h=xs(c,{__TSR_index:s?u:u+1}),m=new URL(h.pathname,this.origin);l.to=sr(this.rewrite,m).pathname,l.search=this.options.parseSearch(h.search),l.hash=h.hash.slice(1)}const d=this.buildLocation({...l,_includeValidateSearch:!0});this.pendingBuiltLocation=d;const f=this.commitLocation({...d,viewTransition:o,replace:s,resetScroll:r,hashScrollIntoView:n,ignoreBlocker:i});return queueMicrotask(()=>{this.pendingBuiltLocation===d&&(this.pendingBuiltLocation=void 0)}),f},this.navigate=async({to:s,reloadDocument:r,href:n,publicHref:o,...i})=>{let c=!1;if(n)try{new URL(`${n}`),c=!0}catch{}if(c&&!r&&(r=!0),r){if(s!==void 0||!n){const d=this.buildLocation({to:s,...i});n=n??d.publicHref,o=o??d.publicHref}const l=!c&&o?o:n;if(ps(l,this.protocolAllowlist)){process.env.NODE_ENV!=="production"&&console.warn(`Blocked navigation to dangerous protocol: ${l}`);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(l):window.location.href=l;return}return this.buildAndCommitLocation({...i,href:n,to:s,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();const s=this.matchRoutes(this.latestLocation),r=this.stores.cachedMatches.get().filter(n=>!s.some(o=>o.id===n.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(s),this.stores.setCached(r)})},this.load=async s=>{const r=s?.action?.type;let n,o,i;const c=this.stores.resolvedLocation.get()??this.stores.location.get();for(i=new Promise(d=>{this.startTransition(async()=>{try{this.beforeLoad(),r?rr.set(this.latestLocation,r):rr.delete(this.latestLocation);const f=this.latestLocation,u=xt(f,this.stores.resolvedLocation.get());this.stores.redirect.get()||this.emit({type:"onBeforeNavigate",...u}),this.emit({type:"onBeforeLoad",...u}),await Gr({router:this,sync:s?.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,p=null,g=null;this.batch(()=>{const x=this.stores.pendingMatches.get(),b=x.length,y=this.stores.matches.get();h=b?y.filter(N=>!this.stores.pendingMatchStores.has(N.id)):null;const S=new Set;for(const N of this.stores.pendingMatchStores.values())N.routeId&&S.add(N.routeId);const w=new Set;for(const N of this.stores.matchStores.values())N.routeId&&w.add(N.routeId);m=b?y.filter(N=>!S.has(N.routeId)):null,p=b?x.filter(N=>!w.has(N.routeId)):null,g=b?x.filter(N=>w.has(N.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(N=>N.status!=="error"&&N.status!=="notFound"&&N.status!=="redirected")]),this.clearExpiredCache())});for(const[x,b]of[[m,"onLeave"],[p,"onEnter"],[g,"onStay"]])if(x)for(const y of x)this.looseRoutesById[y.routeId].options[b]?.(y)})})}})}catch(f){Se(f)?(n=f,this.navigate({...n.options,replace:!0,ignoreBlocker:!0})):ge(f)&&(o=f);const u=n?n.status:o?404:this.stores.matches.get().some(h=>h.status==="error")?500:200;this.batch(()=>{this.stores.statusCode.set(u),this.stores.redirect.set(n)})}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 l;this.hasNotFoundMatch()?l=404:this.stores.matches.get().some(d=>d.status==="error")&&(l=500),l!==void 0&&this.stores.statusCode.set(l)},this.startViewTransition=s=>{const r=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,r&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let n;if(typeof r=="object"&&this.isViewTransitionTypesSupported){const o=this.latestLocation,i=this.stores.resolvedLocation.get(),c=typeof r.types=="function"?r.types(xt(o,i)):r.types;if(c===!1){s();return}n={update:s,types:c}}else n=s;document.startViewTransition(n)}else s()},this.updateMatch=(s,r)=>{this.startTransition(()=>{const n=this.stores.pendingMatchStores.get(s);if(n){n.set(r);return}const o=this.stores.matchStores.get(s);if(o){o.set(r);return}const i=this.stores.cachedMatchStores.get(s);if(i){const c=r(i.get());c.status==="redirected"?this.stores.cachedMatchStores.delete(s)&&this.stores.cachedIds.set(l=>l.filter(d=>d!==s)):i.set(c)}})},this.getMatch=s=>this.stores.cachedMatchStores.get(s)?.get()??this.stores.pendingMatchStores.get(s)?.get()??this.stores.matchStores.get(s)?.get(),this.invalidate=s=>{const r=n=>s?.filter?.(n)??!0?{...n,invalid:!0,...s?.forcePending||n.status==="error"||n.status==="notFound"?{status:"pending",error:void 0}:void 0}:n;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:s?.sync})},this.getParsedLocationHref=s=>s.publicHref||"/",this.resolveRedirect=s=>{const r=s.headers.get("Location");if(!s.options.href||s.options._builtLocation){const n=s.options._builtLocation??this.buildLocation(s.options),o=this.getParsedLocationHref(n);s.options.href=o,s.headers.set("Location",o)}else if(r)try{const n=new URL(r);if(this.origin&&n.origin===this.origin){const o=n.pathname+n.search+n.hash;s.options.href=o,s.headers.set("Location",o)}}catch{}if(s.options.href&&!s.options._builtLocation&&ps(s.options.href,this.protocolAllowlist))throw new Error(process.env.NODE_ENV!=="production"?`Redirect blocked: unsafe protocol in href "${s.options.href}". Allowed protocols: ${Array.from(this.protocolAllowlist).join(", ")}.`:"Redirect blocked: unsafe protocol");return s.headers.get("Location")||s.headers.set("Location",s.options.href),s},this.clearCache=s=>{const r=s?.filter;r!==void 0?this.stores.setCached(this.stores.cachedMatches.get().filter(n=>!r(n))):this.stores.setCached([])},this.clearExpiredCache=()=>{const s=Date.now(),r=n=>{const o=this.looseRoutesById[n.routeId];if(!o.options.loader)return!0;const i=(n.preload?o.options.preloadGcTime??this.options.defaultPreloadGcTime:o.options.gcTime??this.options.defaultGcTime)??300*1e3;return n.status==="error"?!0:s-n.updatedAt>=i};this.clearCache({filter:r})},this.loadRouteChunk=$t,this.preloadRoute=async s=>{const r=s._builtLocation??this.buildLocation(s);let n=this.matchRoutes(r,{throwOnError:!0,preload:!0,dest:s});const o=new Set([...this.stores.matchesId.get(),...this.stores.pendingIds.get()]),i=new Set([...o,...this.stores.cachedIds.get()]),c=n.filter(l=>!i.has(l.id));if(c.length){const l=this.stores.cachedMatches.get();this.stores.setCached([...l,...c])}try{return n=await Gr({router:this,matches:n,location:r,preload:!0,updateMatch:(l,d)=>{o.has(l)?n=n.map(f=>f.id===l?d(f):f):this.updateMatch(l,d)}}),n}catch(l){if(Se(l))return l.options.reloadDocument?void 0:await this.preloadRoute({...l.options,_fromLocation:r});ge(l)||console.error(l);return}},this.matchRoute=(s,r)=>{const n={...s,to:s.to?this.resolvePathWithBase(s.from||"",s.to):void 0,params:s.params||{},leaveParams:!0},o=this.buildLocation(n);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=za(o.pathname,r?.caseSensitive??!1,r?.fuzzy??!1,i.pathname,this.processedTree);return!c||s.params&&!st(c.rawParams,s.params,{partial:!0})?!1:r?.includeSearch??!0?st(i.search,o.search,{partial:!0})?c.rawParams:!1:c.rawParams},this.hasNotFoundMatch=()=>this.stores.matches.get().some(s=>s.status==="notFound"||s.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??ti,parseSearch:e.parseSearch??ei,protocolAllowlist:e.protocolAllowlist??Ia}),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:s}){this.routesById=e,this.routesByPath=t,this.processedTree=s;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=Xn(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 s=this.getMatchedRoutes(e.pathname),{foundRoute:r,routeParams:n}=s;let{matchedRoutes:o}=s,i=!1;(r?r.path!=="/"&&n["**"]:Fe(e.pathname))&&(this.options.notFoundRoute?o=[...o,this.options.notFoundRoute]:i=!0);const c=i?Ri(this.options.notFoundMode,o):void 0,l=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 u=o[f],h=l[f-1];let m,p,g;{const F=h?.search??e.search,ee=h?._strictSearch??void 0;try{const V=ls(u.options.validateSearch,{...F})??void 0;m={...F,...V},p={...ee,...V},g=void 0}catch(V){let Z=V;if(V instanceof bs||(Z=new bs(V.message,{cause:V})),t?.throwOnError)throw Z;m=F,p={},g=Z}}const x=u.options.loaderDeps?.({search:m})??"",b=x?JSON.stringify(x):"",{interpolatedPath:y,usedParams:S}=zr({path:u.fullPath,params:n,decoder:this.pathParamsDecoder,server:this.isServer}),w=u.id+y+b,N=this.getMatch(w),_=d.get(u.id),C=N?._strictParams??S;let R;if(!N)try{en(u,C)}catch(F){if(ge(F)||Se(F)?R=F:R=new bi(F.message,{cause:F}),t?.throwOnError)throw R}Object.assign(n,C);const E=_?"stay":"enter";let D;if(N)D={...N,cause:E,params:_?.params??n,_strictParams:C,search:Ye(_?_.search:N.search,m),_strictSearch:p};else{const F=u.options.loader||u.options.beforeLoad||u.lazyFn||ro(u)?"pending":"success";D={id:w,ssr:u.options.ssr,index:f,routeId:u.id,params:_?.params??n,_strictParams:C,pathname:y,updatedAt:Date.now(),search:_?Ye(_.search,m):m,_strictSearch:p,searchError:void 0,status:F,isFetching:!1,error:void 0,paramsError:R,__routeContext:void 0,_nonReactive:{loadPromise:bt()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:E,loaderDeps:_?Qe(_.loaderDeps,x):x,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:u.options.staticData||{},fullPath:u.fullPath}}t?.preload||(D.globalNotFound=c===u.id),D.searchError=g;const L=this.getParentContext(h);D.context={...L,...D.__routeContext,...D.__beforeLoadContext},l[f]=D}for(let f=0;f<l.length;f++){const u=l[f],h=this.looseRoutesById[u.routeId],m=this.getMatch(u.id),p=d.get(u.routeId);if(u.params=p?Ye(p.params,n):n,!m){const g=l[f-1],x=this.getParentContext(g);if(h.options.context){const b={deps:u.loaderDeps,params:u.params,context:x??{},location:e,navigate:y=>this.navigate({...y,_fromLocation:e}),buildLocation:this.buildLocation,cause:u.cause,abortController:u.abortController,preload:!!u.preload,matches:l,routeId:h.id};u.__routeContext=h.options.context(b)??void 0}u.context={...x,...u.__routeContext,...u.__beforeLoadContext}}}return l}matchRoutesLightweight(e){const t=Dt(this.stores.matchesId.get()),s=this.lightweightCache.get(e);if(s&&s[0]===t)return s[1];const{matchedRoutes:r,routeParams:n}=this.getMatchedRoutes(e.pathname),o=Dt(r),i={...e.search};for(const u of r)try{Object.assign(i,ls(u.options.validateSearch,i))}catch{}const c=t&&this.stores.matchStores.get(t)?.get(),l=c&&c.routeId===o.id&&c.pathname===e.pathname;let d;if(l)d=c.params;else{const u=Object.assign(Object.create(null),n);for(const h of r)try{en(h,u)}catch{}d=u}const f={matchedRoutes:r,fullPath:o.fullPath,search:i,params:d};return this.lightweightCache.set(e,[t,f]),f}},bs=class extends Error{},bi=class extends Error{};const Zr=e=>e.endsWith("/")&&e.length>1?e.slice(0,-1):e;function Qr(e,t){return Zr(e)===Zr(t)}function yi(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:e,matches:[],statusCode:200}}function ls(e,t){if(e==null)return{};if("~standard"in e){const s=e["~standard"].validate(t);if(s instanceof Promise)throw new bs("Async validation not supported");if(s.issues)throw new bs(JSON.stringify(s.issues,void 0,2),{cause:s});return s.value}return"parse"in e?e.parse(t):typeof e=="function"?e(t):{}}function vi({pathname:e,routesById:t,processedTree:s}){const r=Object.create(null),n=Fe(e);let o;const i=Va(n,s,!0);return i&&(o=i.route,Object.assign(r,i.rawParams)),{matchedRoutes:i?.branch||[t.__root__],routeParams:r,foundRoute:o}}function wi({search:e,dest:t,destRoutes:s,_includeValidateSearch:r}){return Si(s)(e,t,r??!1)}function Si(e){let t,s;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 l=({search:d,next:f})=>{const u=f(i.preSearchFilters?i.preSearchFilters.reduce((h,m)=>m(h),d):d);return i.postSearchFilters?i.postSearchFilters.reduce((h,m)=>m(h),u):u};r.push(l)}const c=i.validateSearch;if(c){const l=({search:d,next:f,meta:u})=>{const h=f(d);if(s)try{const m=ls(c,h);if(u&&m)for(const p in m)p in h||(u.defaulted||=new Map).set(p,m[p]);return{...h,...m}}catch{}return h};r.push(l)}}const n=(o,i,c)=>{if(o>=r.length){if(!t.search)return{};if(t.search===!0)return i;const d=Ze(t.search,i);return c&&(c.explicit=d),d}const l=(d,f)=>{if(f){const u=c||{};return{search:n(o+1,d,u),meta:u}}return n(o+1,d,c)};return r[o]({search:i,next:l,meta:c})};return function(i,c,l){return t=c,s=l,n(0,i)}}function Ri(e,t){if(e!=="root")for(let s=t.length-1;s>=0;s--){const r=t[s];if(r.children)return r.id}return rt}function en(e,t){const s=e.options.params?.parse??e.options.parseParams;if(s){const r=s(t);if(r===!1)throw new Error("Route params.parse returned false for a matched route");Object.assign(t,r)}}function ji(){try{return sessionStorage}catch{return}}const Ni="tsr-scroll-restoration-v1_3",oo=ji();function Ci(){try{return JSON.parse(oo?.getItem("tsr-scroll-restoration-v1_3")||"{}")}catch{return{}}}function _i(){try{oo?.setItem(Ni,JSON.stringify(mt))}catch{process.env.NODE_ENV!=="production"&&console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}const mt=Ci(),tn="data-scroll-restoration-id",ki=e=>e.state.__TSR_key||e.href;function Ei(e){const t=e.getAttribute(tn);if(t)return`[${tn}="${t}"]`;let s="",r=e,n;for(;n=r.parentNode;){let o=1,i=r;for(;i=i.previousElementSibling;)o++;const c=`${r.localName}:nth-child(${o})`;s=s?`${c} > ${s}`:c,r=n}return s}let Jt=!1;const pt="window";function nr(e){try{return typeof e=="function"?e():document.querySelector(e)}catch{}}function sn(e){const t=[];for(const s of e){if(s===pt)continue;const r=nr(s);r&&t.push(r)}return t}function Pi(e,t){const s=e.options.scrollRestoration,r=e._scroll;s&&(r.restoring=!0);const n=e.options.getScrollRestorationKey||ki,o=new Map,i=(d,f,u)=>{const h=o.get(d)||{};h.scrollX=f,h.scrollY=u,o.set(d,h)},c=d=>{if(!(Jt||!r.restoring))if(d.target===document)i(pt,scrollX,scrollY);else{const f=d.target;i(f,f.scrollLeft,f.scrollTop)}},l=d=>{if(!r.restoring)return;const f=mt[d]||={};for(const[u,h]of o)u===pt?f[pt]=h:u.isConnected&&(f[Ei(u)]=h)};s&&!r.restoration&&(r.restoration=!0,Jt=!1,history.scrollRestoration="manual",document.addEventListener("scroll",c,!0),e.subscribe("onBeforeLoad",d=>{d.fromLocation&&l(n(d.fromLocation)),o.clear()}),addEventListener("pagehide",()=>{l(n(e.stores.resolvedLocation.get()??e.stores.location.get())),_i()})),!r.reset&&(r.reset=!0,e.subscribe("onRendered",d=>{const f=e.options.scrollRestorationBehavior,u=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 p=n(d.toLocation),g=d.fromLocation&&n(d.fromLocation);if(r.restoring&&g&&g!==p){const x=mt[g];if(x){let b=mt[p];for(const y in x){if(y===pt){if(h)continue}else{const S=nr(y);if(!S||h&&u&&(m??=sn(u),m.includes(S)))continue}b||(b=mt[p]={}),b[y]??=x[y]}}}Jt=!0;try{const x=d.toLocation.hash,b=d.toLocation.state.__hashScrollIntoViewOptions??!0;let y=!1;if(h){const S=rr.get(d.toLocation),w=x&&b&&(S==="PUSH"||S==="REPLACE"),N=r.restoring?mt[p]:void 0;if(N)for(const _ in N){const{scrollX:C,scrollY:R}=N[_];if(_===pt){if(w)continue;scrollTo({top:R,left:C,behavior:f}),y=!0}else{const E=nr(_);E&&(E.scrollLeft=C,E.scrollTop=R)}}if(!y&&!x){const _={top:0,left:0,behavior:f};if(scrollTo(_),u){m??=sn(u);for(const C of m)C.scrollTo(_)}}}!y&&x&&b&&document.getElementById(x)?.scrollIntoView(b)}finally{Jt=!1}}))}const Ti="Error preloading route! ☝️";var ao=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 s=this.options,r=!s?.path&&!s?.id;if(this.parentRoute=this.options.getParentRoute?.(),r)this._path=rt;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.");Ue()}let n=r?rt:s?.path;n&&n!=="/"&&(n=Zn(n));const o=s?.id||n;let i=r?rt:is([this.parentRoute.id==="__root__"?"":this.parentRoute.id,o]);n==="__root__"&&(n="/"),i!=="__root__"&&(i=is(["/",i]));const c=i==="__root__"?"/":is([this.parentRoute.fullPath,n]);this._path=n,this._id=i,this._fullPath=c,this._to=Fe(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=>ni({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.")}},Ai=class extends ao{constructor(e){super(e)}};function xr(e){const t=e.errorComponent??br;return a.jsx(Oi,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:s,reset:r})=>s?B.createElement(t,{error:s,reset:r}):e.children})}var Oi=class extends B.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e,t){const s=e.getResetKey();return t.error&&t.resetKey!==s?{resetKey:s,error:null}:{resetKey:s}}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 br({error:e}){const[t,s]=B.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:()=>s(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 Li({children:e,fallback:t=null}){return io()?a.jsx(k.Fragment,{children:e}):a.jsx(k.Fragment,{children:t})}function io(){return k.useSyncExternalStore(Mi,()=>!0,()=>!1)}function Mi(){return()=>{}}var co=B.createContext(null);function Ce(e){const t=B.useContext(co);return process.env.NODE_ENV!=="production"&&(t||console.warn("Warning: useRouter must be used inside a <RouterProvider> component!")),t}var Es=B.createContext(void 0),Ii=B.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 Di({update:e,notify:t,unwatched:s}){return{link:r,unlink:n,propagate:o,checkDirty:i,shallowPropagate:c};function r(d,f,u){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=u,f.depsTail=m;return}const p=d.subsTail;if(p!==void 0&&p.version===u&&p.sub===f)return;const g=f.depsTail=d.subsTail={version:u,dep:d,sub:f,prevDep:h,nextDep:m,prevSub:p,nextSub:void 0};m!==void 0&&(m.prevDep=g),h!==void 0?h.nextDep=g:f.deps=g,p!==void 0?p.nextSub=g:d.subs=g}function n(d,f=d.sub){const u=d.dep,h=d.prevDep,m=d.nextDep,p=d.nextSub,g=d.prevSub;return m!==void 0?m.prevDep=h:f.depsTail=h,h!==void 0?h.nextDep=m:f.deps=m,p!==void 0?p.prevSub=g:u.subsTail=g,g!==void 0?g.nextSub=p:(u.subs=p)===void 0&&s(u),m}function o(d){let f=d.nextSub,u;e:do{const h=d.sub;let m=h.flags;if(m&60?m&12?m&4?!(m&48)&&l(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 p=h.subs;if(p!==void 0){const g=(d=p).nextSub;g!==void 0&&(u={value:f,prev:u},f=g);continue}}if((d=f)!==void 0){f=d.nextSub;continue}for(;u!==void 0;)if(d=u.value,u=u.prev,d!==void 0){f=d.nextSub;continue e}break}while(!0)}function i(d,f){let u,h=0,m=!1;e:do{const p=d.dep,g=p.flags;if(f.flags&16)m=!0;else if((g&17)===17){if(e(p)){const x=p.subs;x.nextSub!==void 0&&c(x),m=!0}}else if((g&33)===33){(d.nextSub!==void 0||d.prevSub!==void 0)&&(u={value:d,prev:u}),d=p.deps,f=p,++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=u.value,u=u.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,u=f.flags;(u&48)===32&&(f.flags=u|16,(u&6)===2&&t(f))}while((d=d.nextSub)!==void 0)}function l(d,f){let u=f.depsTail;for(;u!==void 0;){if(u===d)return!0;u=u.prevDep}return!1}}function Fi(e,t,s){const r=typeof e=="object",n=r?e:void 0;return{next:(r?e.next:e)?.bind(n),error:(r?e.error:t)?.bind(n),complete:(r?e.complete:s)?.bind(n)}}const or=[];let ds=0;const{link:rn,unlink:Ui,propagate:$i,checkDirty:lo,shallowPropagate:nn}=Di({update(e){return e._update()},notify(e){or[ar++]=e,e.flags&=~se.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=se.Mutable|se.Dirty,ys(e))}});let Xt=0,ar=0,Oe,ir=0;function uo(e){try{++ir,e()}finally{--ir||fo()}}function ys(e){const t=e.depsTail;let s=t!==void 0?t.nextDep:e.deps;for(;s!==void 0;)s=Ui(s,e)}function fo(){if(!(ir>0)){for(;Xt<ar;){const e=or[Xt];or[Xt++]=void 0,e.notify()}Xt=0,ar=0}}function on(e,t){const s=typeof e=="function",r=e,n={_snapshot:s?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:s?se.None:se.Mutable,get(){return Oe!==void 0&&rn(n,Oe,ds),n._snapshot},subscribe(o){const i=Fi(o),c={current:!1},l=Bi(()=>{n.get(),c.current?i.next?.(n._snapshot):c.current=!0});return{unsubscribe:()=>{l.stop()}}},_update(o){const i=Oe,c=t?.compare??Object.is;if(s)Oe=n,++ds,n.depsTail=void 0;else if(o===void 0)return!1;s&&(n.flags=se.Mutable|se.RecursedCheck);try{const l=n._snapshot,d=typeof o=="function"?o(l):o===void 0&&s?r(l):o;return l===void 0||!c(l,d)?(n._snapshot=d,!0):!1}finally{Oe=i,s&&(n.flags&=~se.RecursedCheck),ys(n)}}};return s?(n.flags=se.Mutable|se.Dirty,n.get=function(){const o=n.flags;if(o&se.Dirty||o&se.Pending&&lo(n.deps,n)){if(n._update()){const i=n.subs;i!==void 0&&nn(i)}}else o&se.Pending&&(n.flags=o&~se.Pending);return Oe!==void 0&&rn(n,Oe,ds),n._snapshot}):n.set=function(o){if(n._update(o)){const i=n.subs;i!==void 0&&($i(i),nn(i),fo())}},n}function Bi(e){const t=()=>{const r=Oe;Oe=s,++ds,s.depsTail=void 0,s.flags=se.Watching|se.RecursedCheck;try{return e()}finally{Oe=r,s.flags&=~se.RecursedCheck,ys(s)}},s={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&&lo(this.deps,this)?t():this.flags=se.Watching},stop(){this.flags=se.None,this.depsTail=void 0,ys(this)}};return t(),s}var Zt={exports:{}},zs={},Qt={exports:{}},Vs={};var an;function zi(){if(an)return Vs;an=1;var e=k;function t(u,h){return u===h&&(u!==0||1/u===1/h)||u!==u&&h!==h}var s=typeof Object.is=="function"?Object.is:t,r=e.useState,n=e.useEffect,o=e.useLayoutEffect,i=e.useDebugValue;function c(u,h){var m=h(),p=r({inst:{value:m,getSnapshot:h}}),g=p[0].inst,x=p[1];return o(function(){g.value=m,g.getSnapshot=h,l(g)&&x({inst:g})},[u,m,h]),n(function(){return l(g)&&x({inst:g}),u(function(){l(g)&&x({inst:g})})},[u]),i(m),m}function l(u){var h=u.getSnapshot;u=u.value;try{var m=h();return!s(u,m)}catch{return!0}}function d(u,h){return h()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:c;return Vs.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,Vs}var Ws={};var cn;function Vi(){return cn||(cn=1,process.env.NODE_ENV!=="production"&&(function(){function e(m,p){return m===p&&(m!==0||1/m===1/p)||m!==m&&p!==p}function t(m,p){f||n.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 g=p();if(!u){var x=p();o(g,x)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),u=!0)}x=i({inst:{value:g,getSnapshot:p}});var b=x[0].inst,y=x[1];return l(function(){b.value=g,b.getSnapshot=p,s(b)&&y({inst:b})},[m,g,p]),c(function(){return s(b)&&y({inst:b}),m(function(){s(b)&&y({inst:b})})},[m]),d(g),g}function s(m){var p=m.getSnapshot;m=m.value;try{var g=p();return!o(m,g)}catch{return!0}}function r(m,p){return p()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var n=k,o=typeof Object.is=="function"?Object.is:e,i=n.useState,c=n.useEffect,l=n.useLayoutEffect,d=n.useDebugValue,f=!1,u=!1,h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;Ws.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:h,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Ws}var ln;function ho(){return ln||(ln=1,process.env.NODE_ENV==="production"?Qt.exports=zi():Qt.exports=Vi()),Qt.exports}var dn;function Wi(){if(dn)return zs;dn=1;var e=k,t=ho();function s(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var r=typeof Object.is=="function"?Object.is:s,n=t.useSyncExternalStore,o=e.useRef,i=e.useEffect,c=e.useMemo,l=e.useDebugValue;return zs.useSyncExternalStoreWithSelector=function(d,f,u,h,m){var p=o(null);if(p.current===null){var g={hasValue:!1,value:null};p.current=g}else g=p.current;p=c(function(){function b(_){if(!y){if(y=!0,S=_,_=h(_),m!==void 0&&g.hasValue){var C=g.value;if(m(C,_))return w=C}return w=_}if(C=w,r(S,_))return C;var R=h(_);return m!==void 0&&m(C,R)?(S=_,C):(S=_,w=R)}var y=!1,S,w,N=u===void 0?null:u;return[function(){return b(f())},N===null?void 0:function(){return b(N())}]},[f,u,h,m]);var x=n(d,p[0],p[1]);return i(function(){g.hasValue=!0,g.value=x},[x]),l(x),x},zs}var Hs={};var un;function Hi(){return un||(un=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=k,s=ho(),r=typeof Object.is=="function"?Object.is:e,n=s.useSyncExternalStore,o=t.useRef,i=t.useEffect,c=t.useMemo,l=t.useDebugValue;Hs.useSyncExternalStoreWithSelector=function(d,f,u,h,m){var p=o(null);if(p.current===null){var g={hasValue:!1,value:null};p.current=g}else g=p.current;p=c(function(){function b(_){if(!y){if(y=!0,S=_,_=h(_),m!==void 0&&g.hasValue){var C=g.value;if(m(C,_))return w=C}return w=_}if(C=w,r(S,_))return C;var R=h(_);return m!==void 0&&m(C,R)?(S=_,C):(S=_,w=R)}var y=!1,S,w,N=u===void 0?null:u;return[function(){return b(f())},N===null?void 0:function(){return b(N())}]},[f,u,h,m]);var x=n(d,p[0],p[1]);return i(function(){g.hasValue=!0,g.value=x},[x]),l(x),x},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Hs}var fn;function qi(){return fn||(fn=1,process.env.NODE_ENV==="production"?Zt.exports=Wi():Zt.exports=Hi()),Zt.exports}var Gi=qi();function Ki(e,t){return e===t}function je(e,t,s=Ki){const r=k.useCallback(i=>{if(!e)return()=>{};const{unsubscribe:c}=e.subscribe(i);return c},[e]),n=k.useCallback(()=>e?.get(),[e]);return Gi.useSyncExternalStoreWithSelector(r,n,n,t,s)}var qs={get(){},subscribe(){return{unsubscribe(){}}}};function Yi(e,t){const s=B.useRef();return r=>{const n=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?s.current=Qe(s.current,n):n}}function dt(e){const t=Ce(),s=B.useContext(e.from?Ii:Es),r=e.from?t.stores.getRouteMatchStore(e.from):t.stores.matchStores.get(s),n=Yi(e,t),o=je(r??qs,i=>i?n(i):qs);if(o!==qs)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!"}`);Ue()}}function mo(e){return dt({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function po(e){const{select:t,...s}=e;return dt({...s,select:r=>t?t(r.loaderDeps):r.loaderDeps})}function go(e){return dt({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const s=e.strict===!1?t.params:t._strictParams;return e.select?e.select(s):s}})}function xo(e){return dt({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function bo(e){const t=Ce();return B.useCallback(s=>t.navigate({...s,from:s.from??e?.from}),[e?.from,t])}function yo(e){return dt({...e,select:t=>e.select?e.select(t.context):t.context})}function Ji(e,t){const s=Ce(),r=Ta(t),{activeProps:n,inactiveProps:o,activeOptions:i,to:c,preload:l,preloadDelay:d,preloadIntentProximity:f,hashScrollIntoView:u,replace:h,startTransition:m,resetScroll:p,viewTransition:g,children:x,target:b,disabled:y,style:S,className:w,onClick:N,onBlur:_,onFocus:C,onMouseEnter:R,onMouseLeave:E,onTouchStart:D,ignoreBlocker:L,params:F,search:ee,hash:V,state:Z,mask:Q,reloadDocument:Y,unsafeRelative:le,from:fe,_fromLocation:T,...j}=e,U=io(),W=B.useMemo(()=>e,[s,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),q=je(s.stores.location,te=>te,(te,we)=>te.href===we.href),M=B.useMemo(()=>{const te={_fromLocation:q,...W};return s.buildLocation(te)},[s,q,W]),I=M.maskedLocation?M.maskedLocation.publicHref:M.publicHref,$=M.maskedLocation?M.maskedLocation.external:M.external,J=B.useMemo(()=>sc(I,$,s.history,y),[y,$,I,s.history]),G=B.useMemo(()=>{if(J?.external){if(ps(J.href,s.protocolAllowlist)){process.env.NODE_ENV!=="production"&&console.warn(`Blocked Link with dangerous protocol: ${J.href}`);return}return J.href}if(!rc(c)&&!(typeof c!="string"||c.indexOf(":")===-1))try{if(new URL(c),ps(c,s.protocolAllowlist)){process.env.NODE_ENV!=="production"&&console.warn(`Blocked Link with dangerous protocol: ${c}`);return}return c}catch{}},[c,J,s.protocolAllowlist]),de=B.useMemo(()=>{if(G)return!1;if(i?.exact){if(!Ya(q.pathname,M.pathname,s.basepath))return!1}else{const te=gs(q.pathname,s.basepath),we=gs(M.pathname,s.basepath);if(!(te.startsWith(we)&&(te.length===we.length||te[we.length]==="/")))return!1}return(i?.includeSearch??!0)&&!st(q.search,M.search,{partial:!i?.exact,ignoreUndefined:!i?.explicitUndefined})?!1:i?.includeHash?U&&q.hash===M.hash:!0},[i?.exact,i?.explicitUndefined,i?.includeHash,i?.includeSearch,q,G,U,M.hash,M.pathname,M.search,s.basepath]),be=de?Ze(n,{})??Xi:Gs,ne=de?Gs:Ze(o,{})??Gs,Me=[w,be.className,ne.className].filter(Boolean).join(" "),_e=(S||be.style||ne.style)&&{...S,...be.style,...ne.style},[ke,z]=B.useState(!1),me=B.useRef(!1),ye=e.reloadDocument||G?!1:l??s.options.defaultPreload,Ee=d??s.options.defaultPreloadDelay??0,Te=B.useCallback(()=>{s.preloadRoute({...W,_builtLocation:M}).catch(te=>{console.warn(te),console.warn(Ti)})},[s,W,M]);Pa(r,B.useCallback(te=>{te?.isIntersecting&&Te()},[Te]),tc,{disabled:!!y||ye!=="viewport"}),B.useEffect(()=>{me.current||!y&&ye==="render"&&(Te(),me.current=!0)},[y,Te,ye]);const Ls=te=>{const we=te.currentTarget.getAttribute("target"),Ke=b!==void 0?b:we;if(!y&&!nc(te)&&!te.defaultPrevented&&(!Ke||Ke==="_self")&&te.button===0){te.preventDefault(),Na.flushSync(()=>{z(!0)});const ja=s.subscribe("onResolved",()=>{ja(),z(!1)});s.navigate({...W,replace:h,resetScroll:p,hashScrollIntoView:u,startTransition:m,viewTransition:g,ignoreBlocker:L})}};if(G)return{...j,ref:r,href:G,...x&&{children:x},...b&&{target:b},...y&&{disabled:y},...S&&{style:S},...w&&{className:w},...N&&{onClick:N},..._&&{onBlur:_},...C&&{onFocus:C},...R&&{onMouseEnter:R},...E&&{onMouseLeave:E},...D&&{onTouchStart:D}};const $e=te=>{if(y||ye!=="intent")return;if(!Ee){Te();return}const we=te.currentTarget;if(Tt.has(we))return;const Ke=setTimeout(()=>{Tt.delete(we),Te()},Ee);Tt.set(we,Ke)},Ra=te=>{y||ye!=="intent"||Te()},Tr=te=>{if(y||!ye||!Ee)return;const we=te.currentTarget,Ke=Tt.get(we);Ke&&(clearTimeout(Ke),Tt.delete(we))};return{...j,...be,...ne,href:J?.href,ref:r,onClick:ft([N,Ls]),onBlur:ft([_,Tr]),onFocus:ft([C,$e]),onMouseEnter:ft([R,$e]),onMouseLeave:ft([E,Tr]),onTouchStart:ft([D,Ra]),disabled:!!y,target:b,..._e&&{style:_e},...Me&&{className:Me},...y&&Zi,...de&&Qi,...U&&ke&&ec}}var Gs={},Xi={className:"active"},Zi={role:"link","aria-disabled":!0},Qi={"data-status":"active","aria-current":"page"},ec={"data-transitioning":"transitioning"},Tt=new WeakMap,tc={rootMargin:"100px"},ft=e=>t=>{for(const s of e)if(s){if(t.defaultPrevented)return;s(t)}};function sc(e,t,s,r){if(!r)return t?{href:e,external:!0}:{href:s.createHref(e)||"/",external:!1}}function rc(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var vs=B.forwardRef((e,t)=>{const{_asChild:s,...r}=e,{type:n,...o}=Ji(r,t),i=typeof r.children=="function"?r.children({isActive:o["data-status"]==="active"}):r.children;if(!s){const{disabled:c,...l}=o;return B.createElement("a",l,i)}return B.createElement(s,o,i)});function nc(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var oc=class extends ao{constructor(e){super(e),this.useMatch=t=>dt({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>yo({...t,from:this.id}),this.useSearch=t=>xo({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>go({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>po({...t,from:this.id}),this.useLoaderData=t=>mo({...t,from:this.id}),this.useNavigate=()=>bo({from:this.fullPath}),this.Link=k.forwardRef((t,s)=>a.jsx(vs,{ref:s,from:this.fullPath,...t}))}};function zt(e){return new oc(e)}var ac=class extends Ai{constructor(e){super(e),this.useMatch=t=>dt({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>yo({...t,from:this.id}),this.useSearch=t=>xo({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>go({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>po({...t,from:this.id}),this.useLoaderData=t=>mo({...t,from:this.id}),this.useNavigate=()=>bo({from:this.fullPath}),this.Link=k.forwardRef((t,s)=>a.jsx(vs,{ref:s,from:this.fullPath,...t}))}};function ic(e){return new ac(e)}function cc(e){const t=Ce(),s=`not-found-${je(t.stores.location,r=>r.pathname)}-${je(t.stores.status,r=>r)}`;return a.jsx(xr,{getResetKey:()=>s,onCatch:(r,n)=>{if(ge(r))e.onCatch?.(r,n);else throw r},errorComponent:({error:r})=>{if(ge(r))return e.fallback?.(r);throw r},children:e.children})}function lc(){return a.jsx("p",{children:"Not Found"})}function gt(e){return a.jsx(a.Fragment,{children:e.children})}function vo(e,t,s){return t.options.notFoundComponent?a.jsx(t.options.notFoundComponent,{...s}):e.options.defaultNotFoundComponent?a.jsx(e.options.defaultNotFoundComponent,{...s}):(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(lc,{}))}function dc(e){return null}function uc(){return dc(Ce()),null}var fc=(e,t)=>e.routeId===t.routeId&&e._displayPending===t._displayPending,hc=(e,t)=>e[0]===t[0]&&e[1]===t[1],wo=B.memo(function({matchId:t}){const s=Ce(),r=s.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!`);Ue()}const n=je(s.stores.loadedAt,i=>i),o=je(r,i=>i,fc);return a.jsx(mc,{router:s,matchId:t,resetKey:n,matchState:B.useMemo(()=>{const i=o.routeId,c=s.routesById[i].parentRoute?.id;return{routeId:i,ssr:o.ssr,_displayPending:o._displayPending,parentRouteId:c}},[o._displayPending,o.routeId,o.ssr,s.routesById])})});function mc({router:e,matchId:t,resetKey:s,matchState:r}){const n=e.routesById[r.routeId],o=n.options.pendingComponent??e.options.defaultPendingComponent,i=o?a.jsx(o,{}):null,c=n.options.errorComponent??e.options.defaultErrorComponent,l=n.options.onCatch??e.options.defaultOnCatch,d=n.isRoot?n.options.notFoundComponent??e.options.notFoundRoute?.options.component:n.options.notFoundComponent,f=r.ssr===!1||r.ssr==="data-only",u=(!n.isRoot||n.options.wrapInSuspense||f)&&(n.options.wrapInSuspense??o??(n.options.errorComponent?.preload||f))?B.Suspense:gt,h=c?xr:gt,m=d?cc:gt;return a.jsxs(n.isRoot?n.options.shellComponent??gt:gt,{children:[a.jsx(Es.Provider,{value:t,children:a.jsx(u,{fallback:i,children:a.jsx(h,{getResetKey:()=>s,errorComponent:c||br,onCatch:(p,g)=>{if(ge(p))throw p.routeId??=r.routeId,p;process.env.NODE_ENV!=="production"&&console.warn(`Warning: Error in route match: ${t}`),l?.(p,g)},children:a.jsx(m,{fallback:p=>{if(p.routeId??=r.routeId,!d||p.routeId&&p.routeId!==r.routeId||!p.routeId&&!n.isRoot)throw p;return B.createElement(d,p)},children:f||r._displayPending?a.jsx(Li,{fallback:i,children:a.jsx(hn,{matchId:t})}):a.jsx(hn,{matchId:t})})})})}),r.parentRouteId===rt?a.jsxs(a.Fragment,{children:[a.jsx(pc,{}),e.options.scrollRestoration&&Hn?a.jsx(uc,{}):null]}):null]})}function pc(){const e=Ce(),t=B.useRef();return Mt(()=>{const s=e.stores.resolvedLocation.get(),r=t.current;s&&(!r||r.href!==s.href)&&e.emit({type:"onRendered",...xt(e.stores.location.get(),r??s)}),t.current=s},[je(e.stores.resolvedLocation,s=>s?.state.__TSR_key),e]),null}var hn=B.memo(function({matchId:t}){const s=Ce(),r=(f,u)=>s.getMatch(f.id)?._nonReactive[u]??f._nonReactive[u],n=s.stores.matchStores.get(t);if(!n){if(process.env.NODE_ENV!=="production")throw new Error(`Invariant failed: Could not find match for matchId "${t}". Please file an issue!`);Ue()}const o=je(n,f=>f),i=o.routeId,c=s.routesById[i],l=B.useMemo(()=>{const f=(s.routesById[i].options.remountDeps??s.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,s.options.defaultRemountDeps,s.routesById]),d=B.useMemo(()=>{const f=c.options.component??s.options.defaultComponent;return f?a.jsx(f,{},l):a.jsx(So,{})},[l,c.options.component,s.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??s.options.defaultPendingMinMs;if(f){const u=s.getMatch(o.id);if(u&&!u._nonReactive.minPendingPromise){const h=bt();u._nonReactive.minPendingPromise=h,setTimeout(()=>{h.resolve(),u._nonReactive.minPendingPromise=void 0},f)}}throw r(o,"loadPromise")}if(o.status==="notFound"){if(!ge(o.error)){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Expected a notFound error");Ue()}return vo(s,c,o.error)}if(o.status==="redirected"){if(!Se(o.error)){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Expected a redirect error");Ue()}throw r(o,"loadPromise")}if(o.status==="error")throw o.error;return d}),So=B.memo(function(){const t=Ce(),s=B.useContext(Es);let r,n=!1,o;{const d=s?t.stores.matchStores.get(s):void 0;[r,n]=je(d,f=>[f?.routeId,f?.globalNotFound??!1],hc),o=je(t.stores.matchesId,f=>f[f.findIndex(u=>u===s)+1])}const i=r?t.routesById[r]:void 0,c=t.options.defaultPendingComponent?a.jsx(t.options.defaultPendingComponent,{}):null;if(n){if(!i){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Could not resolve route for Outlet render");Ue()}return vo(t,i,void 0)}if(!o)return null;const l=a.jsx(wo,{matchId:o});return r===rt?a.jsx(B.Suspense,{fallback:c,children:l}):l});function gc(){const e=Ce(),t=B.useRef({router:e,mounted:!1}),[s,r]=B.useState(!1),n=je(e.stores.isLoading,u=>u),o=je(e.stores.hasPending,u=>u),i=Ms(n),c=n||s||o,l=Ms(c),d=n||o,f=Ms(d);return e.startTransition=u=>{r(!0),B.startTransition(()=>{u(),r(!1)})},B.useEffect(()=>{const u=e.history.subscribe(e.load),h=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Fe(e.latestLocation.publicHref)!==Fe(h.publicHref)&&e.commitLocation({...h,replace:!0}),()=>{u()}},[e,e.history]),Mt(()=>{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]),Mt(()=>{i&&!n&&e.emit({type:"onLoad",...xt(e.stores.location.get(),e.stores.resolvedLocation.get())})},[i,e,n]),Mt(()=>{f&&!d&&e.emit({type:"onBeforeRouteMount",...xt(e.stores.location.get(),e.stores.resolvedLocation.get())})},[d,f,e]),Mt(()=>{if(l&&!c){const u=xt(e.stores.location.get(),e.stores.resolvedLocation.get());e.emit({type:"onResolved",...u}),uo(()=>{e.stores.status.set("idle"),e.stores.resolvedLocation.set(e.stores.location.get())})}},[c,l,e]),null}function xc(){const e=Ce(),t=e.routesById[rt].options.pendingComponent??e.options.defaultPendingComponent,s=t?a.jsx(t,{}):null,r=a.jsxs(typeof document<"u"&&e.ssr?gt:B.Suspense,{fallback:s,children:[a.jsx(gc,{}),a.jsx(bc,{})]});return e.options.InnerWrap?a.jsx(e.options.InnerWrap,{children:r}):r}function bc(){const e=Ce(),t=je(e.stores.firstId,n=>n),s=je(e.stores.loadedAt,n=>n),r=t?a.jsx(wo,{matchId:t}):null;return a.jsx(Es.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:a.jsx(xr,{getResetKey:()=>s,errorComponent:br,onCatch:process.env.NODE_ENV!=="production"?n=>{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: ${n.message||n.toString()}`)}:void 0,children:r})})}var yc=e=>({createMutableStore:on,createReadonlyStore:on,batch:uo}),Ro=e=>new vc(e),vc=class extends xi{constructor(e){super(e,yc)}};function wc({router:e,children:t,...s}){Gn(s)&&e.update({...e.options,...s,context:{...e.options.context,...s.context}});const r=a.jsx(co.Provider,{value:e,children:t});return e.options.Wrap?a.jsx(e.options.Wrap,{children:r}):r}function Sc({router:e,...t}){return a.jsx(wc,{router:e,...t,children:a.jsx(xc,{})})}function jo(e,t){return function(){return e.apply(t,arguments)}}const{toString:Rc}=Object.prototype,{getPrototypeOf:yt}=Object,{iterator:Vt,toStringTag:No}=Symbol,ws=(({hasOwnProperty:e})=>(t,s)=>e.call(t,s))(Object.prototype),Bt=(e,t)=>{let s=e;const r=[];for(;s!=null&&s!==Object.prototype;){if(r.indexOf(s)!==-1)return!1;if(r.push(s),ws(s,t))return!0;s=yt(s)}return!1},jc=(e,t)=>e!=null&&Bt(e,t)?e[t]:void 0,yr=(e=>t=>{const s=Rc.call(t);return e[s]||(e[s]=s.slice(8,-1).toLowerCase())})(Object.create(null)),Pe=e=>(e=e.toLowerCase(),t=>yr(t)===e),Ps=e=>t=>typeof t===e,{isArray:it}=Array,vt=Ps("undefined");function Rt(e){return e!==null&&!vt(e)&&e.constructor!==null&&!vt(e.constructor)&&Re(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Co=Pe("ArrayBuffer");function Nc(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Co(e.buffer),t}const Cc=Ps("string"),Re=Ps("function"),_o=Ps("number"),jt=e=>e!==null&&typeof e=="object",_c=e=>e===!0||e===!1,us=e=>{if(!jt(e))return!1;const t=yt(e);return(t===null||t===Object.prototype||yt(t)===null)&&!Bt(e,No)&&!Bt(e,Vt)},kc=e=>{if(!jt(e)||Rt(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Ec=Pe("Date"),Pc=Pe("File"),Tc=e=>!!(e&&typeof e.uri<"u"),Ac=e=>e&&typeof e.getParts<"u",Oc=Pe("Blob"),Lc=Pe("FileList"),Mc=e=>jt(e)&&Re(e.pipe);function Ic(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const mn=Ic(),pn=typeof mn.FormData<"u"?mn.FormData:void 0,Dc=e=>{if(!e)return!1;if(pn&&e instanceof pn)return!0;const t=yt(e);if(!t||t===Object.prototype||!Re(e.append))return!1;const s=yr(e);return s==="formdata"||s==="object"&&Re(e.toString)&&e.toString()==="[object FormData]"},Fc=Pe("URLSearchParams"),[Uc,$c,Bc,zc]=["ReadableStream","Request","Response","Headers"].map(Pe),Vc=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Wt(e,t,{allOwnKeys:s=!1}={}){if(e===null||typeof e>"u")return;let r,n;if(typeof e!="object"&&(e=[e]),it(e))for(r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else{if(Rt(e))return;const o=s?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 ko(e,t){if(Rt(e))return null;t=t.toLowerCase();const s=Object.keys(e);let r=s.length,n;for(;r-- >0;)if(n=s[r],t===n.toLowerCase())return n;return null}const tt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Eo=e=>!vt(e)&&e!==tt;function cr(...e){const{caseless:t,skipUndefined:s}=Eo(this)&&this||{},r={},n=(o,i)=>{if(i==="__proto__"||i==="constructor"||i==="prototype")return;const c=t&&typeof i=="string"&&ko(r,i)||i,l=ws(r,c)?r[c]:void 0;us(l)&&us(o)?r[c]=cr(l,o):us(o)?r[c]=cr({},o):it(o)?r[c]=o.slice():(!s||!vt(o))&&(r[c]=o)};for(let o=0,i=e.length;o<i;o++){const c=e[o];if(!c||Rt(c)||(Wt(c,n),typeof c!="object"||it(c)))continue;const l=Object.getOwnPropertySymbols(c);for(let d=0;d<l.length;d++){const f=l[d];tl.call(c,f)&&n(c[f],f)}}return r}const Wc=(e,t,s,{allOwnKeys:r}={})=>(Wt(t,(n,o)=>{s&&Re(n)?Object.defineProperty(e,o,{__proto__:null,value:jo(n,s),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,o,{__proto__:null,value:n,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),Hc=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),qc=(e,t,s,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}),s&&Object.assign(e.prototype,s)},Gc=(e,t,s,r)=>{let n,o,i;const c={};if(t=t||{},e==null)return t;do{for(n=Object.getOwnPropertyNames(e),o=n.length;o-- >0;)i=n[o],(!r||r(i,e,t))&&!c[i]&&(t[i]=e[i],c[i]=!0);e=s!==!1&&yt(e)}while(e&&(!s||s(e,t))&&e!==Object.prototype);return t},Kc=(e,t,s)=>{e=String(e),(s===void 0||s>e.length)&&(s=e.length),s-=t.length;const r=e.indexOf(t,s);return r!==-1&&r===s},Yc=e=>{if(!e)return null;if(it(e))return e;let t=e.length;if(!_o(t))return null;const s=new Array(t);for(;t-- >0;)s[t]=e[t];return s},Jc=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&yt(Uint8Array)),Xc=(e,t)=>{const r=(e&&e[Vt]).call(e);let n;for(;(n=r.next())&&!n.done;){const o=n.value;t.call(e,o[0],o[1])}},Zc=(e,t)=>{let s;const r=[];for(;(s=e.exec(t))!==null;)r.push(s);return r},Qc=Pe("HTMLFormElement"),el=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(s,r,n){return r.toUpperCase()+n}),{propertyIsEnumerable:tl}=Object.prototype,sl=Pe("RegExp"),Po=(e,t)=>{const s=Object.getOwnPropertyDescriptors(e),r={};Wt(s,(n,o)=>{let i;(i=t(n,o,e))!==!1&&(r[o]=i||n)}),Object.defineProperties(e,r)},rl=e=>{Po(e,(t,s)=>{if(Re(e)&&["arguments","caller","callee"].includes(s))return!1;const r=e[s];if(Re(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+s+"'")})}})},nl=(e,t)=>{const s={},r=n=>{n.forEach(o=>{s[o]=!0})};return it(e)?r(e):r(String(e).split(t)),s},ol=()=>{},al=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function il(e){return!!(e&&Re(e.append)&&e[No]==="FormData"&&e[Vt])}const cl=e=>{const t=new WeakSet,s=r=>{if(jt(r)){if(t.has(r))return;if(Rt(r))return r;if(!("toJSON"in r)){t.add(r);const n=it(r)?[]:{};return Wt(r,(o,i)=>{const c=s(o);!vt(c)&&(n[i]=c)}),t.delete(r),n}}return r};return s(e)},ll=Pe("AsyncFunction"),dl=e=>e&&(jt(e)||Re(e))&&Re(e.then)&&Re(e.catch),To=((e,t)=>e?setImmediate:t?((s,r)=>(tt.addEventListener("message",({source:n,data:o})=>{n===tt&&o===s&&r.length&&r.shift()()},!1),n=>{r.push(n),tt.postMessage(s,"*")}))(`axios@${Math.random()}`,[]):s=>setTimeout(s))(typeof setImmediate=="function",Re(tt.postMessage)),ul=typeof queueMicrotask<"u"?queueMicrotask.bind(tt):typeof process<"u"&&process.nextTick||To,Ao=e=>e!=null&&Re(e[Vt]),fl=e=>e!=null&&Bt(e,Vt)&&Ao(e),v={isArray:it,isArrayBuffer:Co,isBuffer:Rt,isFormData:Dc,isArrayBufferView:Nc,isString:Cc,isNumber:_o,isBoolean:_c,isObject:jt,isPlainObject:us,isEmptyObject:kc,isReadableStream:Uc,isRequest:$c,isResponse:Bc,isHeaders:zc,isUndefined:vt,isDate:Ec,isFile:Pc,isReactNativeBlob:Tc,isReactNative:Ac,isBlob:Oc,isRegExp:sl,isFunction:Re,isStream:Mc,isURLSearchParams:Fc,isTypedArray:Jc,isFileList:Lc,forEach:Wt,merge:cr,extend:Wc,trim:Vc,stripBOM:Hc,inherits:qc,toFlatObject:Gc,kindOf:yr,kindOfTest:Pe,endsWith:Kc,toArray:Yc,forEachEntry:Xc,matchAll:Zc,isHTMLForm:Qc,hasOwnProperty:ws,hasOwnProp:ws,hasOwnInPrototypeChain:Bt,getSafeProp:jc,reduceDescriptors:Po,freezeMethods:rl,toObjectSet:nl,toCamelCase:el,noop:ol,toFiniteNumber:al,findKey:ko,global:tt,isContextDefined:Eo,isSpecCompliantForm:il,toJSONObject:cl,isAsyncFn:ll,isThenable:dl,setImmediate:To,asap:ul,isIterable:Ao,isSafeIterable:fl},hl=v.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"]),ml=e=>{const t={};let s,r,n;return e&&e.split(`
|
|
7
|
-
`).forEach(function(i){n=i.indexOf(":"),s=i.substring(0,n).trim().toLowerCase(),r=i.substring(n+1).trim(),!(!s||t[s]&&hl[s])&&(s==="set-cookie"?t[s]?t[s].push(r):t[s]=[r]:t[s]=t[s]?t[s]+", "+r:r)}),t};function pl(e){let t=0,s=e.length;for(;t<s;){const r=e.charCodeAt(t);if(r!==9&&r!==32)break;t+=1}for(;s>t;){const r=e.charCodeAt(s-1);if(r!==9&&r!==32)break;s-=1}return t===0&&s===e.length?e:e.slice(t,s)}const gl=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),xl=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function vr(e,t){return v.isArray(e)?e.map(s=>vr(s,t)):pl(String(e).replace(t,""))}const bl=e=>vr(e,gl),yl=e=>vr(e,xl);function Oo(e){const t=Object.create(null);return v.forEach(e.toJSON(),(s,r)=>{t[r]=yl(s)}),t}const gn=Symbol("internals");function
|
|
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,...s){const r=new this(t);return s.forEach(n=>r.set(n)),r}static accessor(t){const r=(this[gn]=this[gn]={accessors:{}}).accessors,n=this.prototype;function o(i){const c=At(i);r[c]||(Rl(n,i),r[c]=!0)}return v.isArray(t)?t.forEach(o):o(t),this}};xe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);v.reduceDescriptors(xe.prototype,({value:e},t)=>{let s=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[s]=r}}});v.freezeMethods(xe);const jl="[REDACTED ****]";function Nl(e){if(v.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(v.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function Cl(e,t){const s=new Set(t.map(o=>String(o).toLowerCase())),r=[],n=o=>{if(o===null||typeof o!="object"||v.isBuffer(o))return o;if(r.indexOf(o)!==-1)return;o instanceof xe&&(o=o.toJSON()),r.push(o);let i;if(v.isArray(o))i=[],o.forEach((c,l)=>{const d=n(c);v.isUndefined(d)||(i[l]=d)});else{if(!v.isPlainObject(o)&&Nl(o))return r.pop(),o;i=Object.create(null);for(const[c,l]of Object.entries(o)){const d=s.has(c.toLowerCase())?jl:n(l);v.isUndefined(d)||(i[c]=d)}}return r.pop(),i};return n(e)}let P=class Lo extends Error{static from(t,s,r,n,o,i){const c=new Lo(t.message,s||t.code,r,n,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,s,r,n,o){super(t),Object.defineProperty(this,"message",{__proto__:null,value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,s&&(this.code=s),r&&(this.config=r),n&&(this.request=n),o&&(this.response=o,this.status=o.status)}toJSON(){const t=this.config,s=t&&v.hasOwnProp(t,"redact")?t.redact:void 0,r=v.isArray(s)&&s.length>0?Cl(t,s):v.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}}};P.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";P.ERR_BAD_OPTION="ERR_BAD_OPTION";P.ECONNABORTED="ECONNABORTED";P.ETIMEDOUT="ETIMEDOUT";P.ECONNREFUSED="ECONNREFUSED";P.ERR_NETWORK="ERR_NETWORK";P.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";P.ERR_DEPRECATED="ERR_DEPRECATED";P.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";P.ERR_BAD_REQUEST="ERR_BAD_REQUEST";P.ERR_CANCELED="ERR_CANCELED";P.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";P.ERR_INVALID_URL="ERR_INVALID_URL";P.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const _l=null,Mo=100;function lr(e){return v.isPlainObject(e)||v.isArray(e)}function Io(e){return v.endsWith(e,"[]")?e.slice(0,-2):e}function Ys(e,t,s){return e?e.concat(t).map(function(n,o){return n=Io(n),!s&&o?"["+n+"]":n}).join(s?".":""):t}function kl(e){return v.isArray(e)&&!e.some(lr)}const El=v.toFlatObject(v,{},null,function(t){return/^is[A-Z]/.test(t)});function Ts(e,t,s){if(!v.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,s=v.toFlatObject(s,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,S){return!v.isUndefined(S[y])});const r=s.metaTokens,n=s.visitor||p,o=s.dots,i=s.indexes,c=s.Blob||typeof Blob<"u"&&Blob,l=s.maxDepth===void 0?Mo:s.maxDepth,d=c&&v.isSpecCompliantForm(t),f=[];if(!v.isFunction(n))throw new TypeError("visitor must be a function");function u(b){if(b===null)return"";if(v.isDate(b))return b.toISOString();if(v.isBoolean(b))return b.toString();if(!d&&v.isBlob(b))throw new P("Blob is not supported. Use a Buffer instead.");if(v.isArrayBuffer(b)||v.isTypedArray(b)){if(d&&typeof c=="function")return new c([b]);if(typeof Buffer<"u")return Buffer.from(b);throw new P("Blob is not supported. Use a Buffer instead.",P.ERR_NOT_SUPPORT)}return b}function h(b){if(b>l)throw new P("Object is too deeply nested ("+b+" levels). Max depth: "+l,P.ERR_FORM_DATA_DEPTH_EXCEEDED)}function m(b,y){if(l===1/0)return JSON.stringify(b);const S=[];return JSON.stringify(b,function(N,_){if(!v.isObject(_))return _;for(;S.length&&S[S.length-1]!==this;)S.pop();return S.push(_),h(y+S.length-1),_})}function p(b,y,S){let w=b;if(v.isReactNative(t)&&v.isReactNativeBlob(b))return t.append(Ys(S,y,o),u(b)),!1;if(b&&!S&&typeof b=="object"){if(v.endsWith(y,"{}"))y=r?y:y.slice(0,-2),b=m(b,1);else if(v.isArray(b)&&kl(b)||(v.isFileList(b)||v.endsWith(y,"[]"))&&(w=v.toArray(b)))return y=Io(y),w.forEach(function(_,C){!(v.isUndefined(_)||_===null)&&t.append(i===!0?Ys([y],C,o):i===null?y:y+"[]",u(_))}),!1}return lr(b)?!0:(t.append(Ys(S,y,o),u(b)),!1)}const g=Object.assign(El,{defaultVisitor:p,convertValue:u,isVisitable:lr});function x(b,y,S=0){if(!v.isUndefined(b)){if(h(S),f.indexOf(b)!==-1)throw new Error("Circular reference detected in "+y.join("."));f.push(b),v.forEach(b,function(N,_){(!(v.isUndefined(N)||N===null)&&n.call(t,N,v.isString(_)?_.trim():_,y,g))===!0&&x(N,y?y.concat(_):[_],S+1)}),f.pop()}}if(!v.isObject(e))throw new TypeError("data must be an object");return x(e),t}function xn(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(r){return t[r]})}function wr(e,t){this._pairs=[],e&&Ts(e,this,t)}const Do=wr.prototype;Do.append=function(t,s){this._pairs.push([t,s])};Do.toString=function(t){const s=t?r=>t.call(this,r,xn):xn;return this._pairs.map(function(n){return s(n[0])+"="+s(n[1])},"").join("&")};function Pl(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Fo(e,t,s){if(!t)return e;e=e||"";const r=v.isFunction(s)?{serialize:s}:s,n=v.getSafeProp(r,"encode")||Pl,o=v.getSafeProp(r,"serialize");let i;if(o?i=o(t,r):i=v.isURLSearchParams(t)?t.toString():new wr(t,r).toString(n),i){const c=e.indexOf("#");c!==-1&&(e=e.slice(0,c)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class bn{constructor(){this.handlers=[]}use(t,s,r){return this.handlers.push({fulfilled:t,rejected:s,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){v.forEach(this.handlers,function(r){r!==null&&t(r)})}}const Sr={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Tl=typeof URLSearchParams<"u"?URLSearchParams:wr,Al=typeof FormData<"u"?FormData:null,Ol=typeof Blob<"u"?Blob:null,Ll={isBrowser:!0,classes:{URLSearchParams:Tl,FormData:Al,Blob:Ol},protocols:["http","https","file","blob","url","data"]},Rr=typeof window<"u"&&typeof document<"u",dr=typeof navigator=="object"&&navigator||void 0,Ml=Rr&&(!dr||["ReactNative","NativeScript","NS"].indexOf(dr.product)<0),Il=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Dl=Rr&&window.location.href||"http://localhost",Fl=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Rr,hasStandardBrowserEnv:Ml,hasStandardBrowserWebWorkerEnv:Il,navigator:dr,origin:Dl},Symbol.toStringTag,{value:"Module"})),he={...Fl,...Ll};function Ul(e,t){return Ts(e,new he.classes.URLSearchParams,{visitor:function(s,r,n,o){return he.isNode&&v.isBuffer(s)?(this.append(r,s.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}const yn=Mo;function Uo(e){if(e>yn)throw new P("FormData field is too deeply nested ("+e+" levels). Max depth: "+yn,P.ERR_FORM_DATA_DEPTH_EXCEEDED)}function $l(e){const t=[],s=/\w+|\[(\w*)]/g;let r;for(;(r=s.exec(e))!==null;)Uo(t.length),t.push(r[0]==="[]"?"":r[1]||r[0]);return t}function Bl(e){const t={},s=Object.keys(e);let r;const n=s.length;let o;for(r=0;r<n;r++)o=s[r],t[o]=e[o];return t}function $o(e){function t(s,r,n,o){Uo(o);let i=s[o++];if(i==="__proto__")return!0;const c=Number.isFinite(+i),l=o>=s.length;return i=!i&&v.isArray(n)?n.length:i,l?(v.hasOwnProp(n,i)?n[i]=v.isArray(n[i])?n[i].concat(r):[n[i],r]:n[i]=r,!c):((!v.hasOwnProp(n,i)||!v.isObject(n[i]))&&(n[i]=[]),t(s,r,n[i],o)&&v.isArray(n[i])&&(n[i]=Bl(n[i])),!c)}if(v.isFormData(e)&&v.isFunction(e.entries)){const s={};return v.forEachEntry(e,(r,n)=>{t($l(r),n,s,0)}),s}return null}const ht=(e,t)=>e!=null&&v.hasOwnProp(e,t)?e[t]:void 0;function zl(e,t,s){if(v.isString(e))try{return(t||JSON.parse)(e),v.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(s||JSON.stringify)(e)}const Ht={transitional:Sr,adapter:["xhr","http","fetch"],transformRequest:[function(t,s){const r=s.getContentType()||"",n=r.indexOf("application/json")>-1,o=v.isObject(t);if(o&&v.isHTMLForm(t)&&(t=new FormData(t)),v.isFormData(t))return n?JSON.stringify($o(t)):t;if(v.isArrayBuffer(t)||v.isBuffer(t)||v.isStream(t)||v.isFile(t)||v.isBlob(t)||v.isReadableStream(t))return t;if(v.isArrayBufferView(t))return t.buffer;if(v.isURLSearchParams(t))return s.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(o){const l=ht(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return Ul(t,l).toString();if((c=v.isFileList(t))||r.indexOf("multipart/form-data")>-1){const d=ht(this,"env"),f=d&&d.FormData;return Ts(c?{"files[]":t}:t,f&&new f,l)}}return o||n?(s.setContentType("application/json",!1),zl(t)):t}],transformResponse:[function(t){const s=ht(this,"transitional")||Ht.transitional,r=s&&s.forcedJSONParsing,n=ht(this,"responseType"),o=n==="json";if(v.isResponse(t)||v.isReadableStream(t))return t;if(t&&v.isString(t)&&(r&&!n||o)){const c=!(s&&s.silentJSONParsing)&&o;try{return JSON.parse(t,ht(this,"parseReviver"))}catch(l){if(c)throw l.name==="SyntaxError"?P.from(l,P.ERR_BAD_RESPONSE,this,null,ht(this,"response")):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:he.classes.FormData,Blob:he.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};v.forEach(["delete","get","head","post","put","patch","query"],e=>{Ht.headers[e]={}});function Js(e,t){const s=this||Ht,r=t||s,n=xe.from(r.headers);let o=r.data;return v.forEach(e,function(c){o=c.call(s,o,n.normalize(),t?t.status:void 0)}),n.normalize(),o}function Bo(e){return!!(e&&e.__CANCEL__)}let qt=class extends P{constructor(t,s,r){super(t??"canceled",P.ERR_CANCELED,s,r),this.name="CanceledError",this.__CANCEL__=!0}};function zo(e,t,s){const r=s.config.validateStatus;!s.status||!r||r(s.status)?e(s):t(new P("Request failed with status code "+s.status,s.status>=400&&s.status<500?P.ERR_BAD_REQUEST:P.ERR_BAD_RESPONSE,s.config,s.request,s))}function Vl(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function Wl(e,t){e=e||10;const s=new Array(e),r=new Array(e);let n=0,o=0,i;return t=t!==void 0?t:1e3,function(l){const d=Date.now(),f=r[o];i||(i=d),s[n]=l,r[n]=d;let u=o,h=0;for(;u!==n;)h+=s[u++],u=u%e;if(n=(n+1)%e,n===o&&(o=(o+1)%e),d-i<t)return;const m=f&&d-f;return m?Math.round(h*1e3/m):void 0}}function Hl(e,t){let s=0,r=1e3/t,n,o;const i=(d,f=Date.now())=>{s=f,n=null,o&&(clearTimeout(o),o=null),e(...d)};return[(...d)=>{const f=Date.now(),u=f-s;u>=r?i(d,f):(n=d,o||(o=setTimeout(()=>{o=null,i(n)},r-u)))},()=>n&&i(n)]}const Ss=(e,t,s=3)=>{let r=0;const n=Wl(50,250);return Hl(o=>{if(!o||typeof o.loaded!="number")return;const i=o.loaded,c=o.lengthComputable?o.total:void 0,l=c!=null?Math.min(i,c):i,d=Math.max(0,l-r),f=n(d);r=Math.max(r,l);const u={loaded:l,total:c,progress:c?l/c:void 0,bytes:d,rate:f||void 0,estimated:f&&c?(c-l)/f:void 0,event:o,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(u)},s)},vn=(e,t)=>{const s=e!=null;return[r=>t[0]({lengthComputable:s,total:e,loaded:r}),t[1]]},wn=e=>(...t)=>v.asap(()=>e(...t)),ql=he.hasStandardBrowserEnv?((e,t)=>s=>(s=new URL(s,he.origin),e.protocol===s.protocol&&e.host===s.host&&(t||e.port===s.port)))(new URL(he.origin),he.navigator&&/(msie|trident)/i.test(he.navigator.userAgent)):()=>!0,Gl=he.hasStandardBrowserEnv?{write(e,t,s,r,n,o,i){if(typeof document>"u")return;const c=[`${e}=${encodeURIComponent(t)}`];v.isNumber(s)&&c.push(`expires=${new Date(s).toUTCString()}`),v.isString(r)&&c.push(`path=${r}`),v.isString(n)&&c.push(`domain=${n}`),o===!0&&c.push("secure"),v.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 s=0;s<t.length;s++){const r=t[s].replace(/^\s+/,""),n=r.indexOf("=");if(n!==-1&&r.slice(0,n)===e)try{return decodeURIComponent(r.slice(n+1))}catch{return r.slice(n+1)}}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Kl(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Yl(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const Jl=/^https?:(?!\/\/)/i,Xl=/[\t\n\r]/g;function Zl(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function Ql(e){return Zl(e).replace(Xl,"")}function Sn(e,t){if(typeof e=="string"&&Jl.test(Ql(e)))throw new P('Invalid URL: missing "//" after protocol',P.ERR_INVALID_URL,t)}function Vo(e,t,s,r){Sn(t,r);let n=!Kl(t);return e&&(n||s===!1)?(Sn(e,r),Yl(e,t)):t}const Rn=e=>e instanceof xe?{...e}:e;function ct(e,t){e=e||{},t=t||{};const s=Object.create(null);Object.defineProperty(s,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function r(f,u,h,m){return v.isPlainObject(f)&&v.isPlainObject(u)?v.merge.call({caseless:m},f,u):v.isPlainObject(u)?v.merge({},u):v.isArray(u)?u.slice():u}function n(f,u,h,m){if(v.isUndefined(u)){if(!v.isUndefined(f))return r(void 0,f,h,m)}else return r(f,u,h,m)}function o(f,u){if(!v.isUndefined(u))return r(void 0,u)}function i(f,u){if(v.isUndefined(u)){if(!v.isUndefined(f))return r(void 0,f)}else return r(void 0,u)}function c(f){const u=v.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!v.isUndefined(u))if(v.isPlainObject(u)){if(v.hasOwnProp(u,f))return u[f]}else return;const h=v.hasOwnProp(e,"transitional")?e.transitional:void 0;if(v.isPlainObject(h)&&v.hasOwnProp(h,f))return h[f]}function l(f,u,h){if(v.hasOwnProp(t,h))return r(f,u);if(v.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:l,headers:(f,u,h)=>n(Rn(f),Rn(u),h,!0)};return v.forEach(Object.keys({...e,...t}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const h=v.hasOwnProp(d,u)?d[u]:n,m=v.hasOwnProp(e,u)?e[u]:void 0,p=v.hasOwnProp(t,u)?t[u]:void 0,g=h(m,p,u);v.isUndefined(g)&&h!==l||(s[u]=g)}),v.hasOwnProp(t,"validateStatus")&&v.isUndefined(t.validateStatus)&&c("validateStatusUndefinedResolves")===!1&&(v.hasOwnProp(e,"validateStatus")?s.validateStatus=r(void 0,e.validateStatus):delete s.validateStatus),s}const ed=["content-type","content-length"];function td(e,t,s){if(s!=="content-only"){e.set(t);return}Object.entries(t||{}).forEach(([r,n])=>{ed.includes(r.toLowerCase())&&e.set(r,n)})}const sd=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,s)=>String.fromCharCode(parseInt(s,16)));function Wo(e){const t=ct({},e),s=h=>v.hasOwnProp(t,h)?t[h]:void 0,r=s("data");let n=s("withXSRFToken");const o=s("xsrfHeaderName"),i=s("xsrfCookieName");let c=s("headers");const l=s("auth"),d=s("baseURL"),f=s("allowAbsoluteUrls"),u=s("url");if(t.headers=c=xe.from(c),t.url=Fo(Vo(d,u,f,t),s("params"),s("paramsSerializer")),l){const h=v.getSafeProp(l,"username")||"",m=v.getSafeProp(l,"password")||"";try{c.set("Authorization","Basic "+btoa(h+":"+(m?sd(m):"")))}catch(p){throw P.from(p,P.ERR_BAD_OPTION_VALUE,e)}}if(v.isFormData(r)&&(he.hasStandardBrowserEnv||he.hasStandardBrowserWebWorkerEnv||v.isReactNative(r)?c.setContentType(void 0):v.isFunction(r.getHeaders)&&td(c,r.getHeaders(),s("formDataHeaderPolicy"))),he.hasStandardBrowserEnv&&(v.isFunction(n)&&(n=n(t)),n===!0||n==null&&ql(t.url))){const m=o&&i&&Gl.read(i);m&&c.set(o,m)}return t}const rd=typeof XMLHttpRequest<"u",nd=rd&&function(e){return new Promise(function(s,r){const n=Wo(e);let o=n.data;const i=xe.from(n.headers).normalize();let{responseType:c,onUploadProgress:l,onDownloadProgress:d}=n,f,u,h,m,p;function g(){m&&m(),p&&p(),n.cancelToken&&n.cancelToken.unsubscribe(f),n.signal&&n.signal.removeEventListener("abort",f)}let x=new XMLHttpRequest;x.open(n.method.toUpperCase(),n.url,!0),x.timeout=n.timeout;function b(){if(!x)return;const S=xe.from("getAllResponseHeaders"in x&&x.getAllResponseHeaders()),N={data:!c||c==="text"||c==="json"?x.responseText:x.response,status:x.status,statusText:x.statusText,headers:S,config:e,request:x};zo(function(C){s(C),g()},function(C){r(C),g()},N),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 P("Request aborted",P.ECONNABORTED,e,x)),g(),x=null)},x.onerror=function(w){const N=w&&w.message?w.message:"Network Error",_=new P(N,P.ERR_NETWORK,e,x);_.event=w||null,r(_),g(),x=null},x.ontimeout=function(){let w=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const N=n.transitional||Sr;n.timeoutErrorMessage&&(w=n.timeoutErrorMessage),r(new P(w,N.clarifyTimeoutError?P.ETIMEDOUT:P.ECONNABORTED,e,x)),g(),x=null},o===void 0&&i.setContentType(null),"setRequestHeader"in x&&v.forEach(Oo(i),function(w,N){x.setRequestHeader(N,w)}),v.isUndefined(n.withCredentials)||(x.withCredentials=!!n.withCredentials),c&&c!=="json"&&(x.responseType=n.responseType),d&&([h,p]=Ss(d,!0),x.addEventListener("progress",h)),l&&x.upload&&([u,m]=Ss(l),x.upload.addEventListener("progress",u),x.upload.addEventListener("loadend",m)),(n.cancelToken||n.signal)&&(f=S=>{x&&(r(!S||S.type?new qt(null,e,x):S),x.abort(),g(),x=null)},n.cancelToken&&n.cancelToken.subscribe(f),n.signal&&(n.signal.aborted?f():n.signal.addEventListener("abort",f)));const y=Vl(n.url);if(y&&!he.protocols.includes(y)){r(new P("Unsupported protocol "+y+":",P.ERR_BAD_REQUEST,e)),g();return}x.send(o||null)})},od=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const s=new AbortController;let r=!1;const n=function(l){if(!r){r=!0,i();const d=l instanceof Error?l:this.reason;s.abort(d instanceof P?d:new qt(d instanceof Error?d.message:d))}};let o=t&&setTimeout(()=>{o=null,n(new P(`timeout of ${t}ms exceeded`,P.ETIMEDOUT))},t);const i=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(l=>{l.unsubscribe?l.unsubscribe(n):l.removeEventListener("abort",n)}),e=null)};e.forEach(l=>l.addEventListener("abort",n,{once:!0}));const{signal:c}=s;return c.unsubscribe=()=>v.asap(i),c},ad=function*(e,t){let s=e.byteLength;if(s<t){yield e;return}let r=0,n;for(;r<s;)n=r+t,yield e.slice(r,n),r=n},id=async function*(e,t){for await(const s of cd(e))yield*ad(s,t)},cd=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:s,value:r}=await t.read();if(s)break;yield r}}finally{await t.cancel()}},jn=(e,t,s,r)=>{const n=id(e,t);let o=0,i,c=l=>{i||(i=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:d,value:f}=await n.next();if(d){c(),l.close();return}let u=f.byteLength;if(s){let h=o+=u;s(h)}l.enqueue(new Uint8Array(f))}catch(d){throw c(d),d}},cancel(l){return c(l),n.return()}},{highWaterMark:2})},Rs=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,ld=(e,t,s)=>t+2<s&&Rs(e.charCodeAt(t+1))&&Rs(e.charCodeAt(t+2));function dd(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const s=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(s)){let i=r.length;const c=r.length;for(let m=0;m<c;m++)if(r.charCodeAt(m)===37&&m+2<c){const p=r.charCodeAt(m+1),g=r.charCodeAt(m+2);Rs(p)&&Rs(g)&&(i-=2,m+=2)}let l=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?(l++,d--):f(d)&&(l++,d-=3)),l===1&&d>=0&&(r.charCodeAt(d)===61||f(d))&&l++;const h=Math.floor(i/4)*3-(l||0);return h>0?h:0}let o=0;for(let i=0,c=r.length;i<c;i++){const l=r.charCodeAt(i);if(l===37&&ld(r,i,c))o+=1,i+=2;else if(l<128)o+=1;else if(l<2048)o+=2;else if(l>=55296&&l<=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 jr="1.18.1",Nn=64*1024,{isFunction:es}=v,ud=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,s)=>String.fromCharCode(parseInt(s,16))),Cn=e=>{if(!v.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},_n=(e,...t)=>{try{return!!e(...t)}catch{return!1}},fd=e=>{const t=e.indexOf("://");let s=e;return t!==-1&&(s=s.slice(t+3)),s.includes("@")||s.includes(":")},hd=e=>{const t=v.global!==void 0&&v.global!==null?v.global:globalThis,{ReadableStream:s,TextEncoder:r}=t;e=v.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:n,Request:o,Response:i}=e,c=n?es(n):typeof fetch=="function",l=es(o),d=es(i);if(!c)return!1;const f=c&&es(s),u=c&&(typeof r=="function"?(b=>y=>b.encode(y))(new r):async b=>new Uint8Array(await new o(b).arrayBuffer())),h=l&&f&&_n(()=>{let b=!1;const y=new o(he.origin,{body:new s,method:"POST",get duplex(){return b=!0,"half"}}),S=y.headers.has("Content-Type");return y.body!=null&&y.body.cancel(),b&&!S}),m=d&&f&&_n(()=>v.isReadableStream(new i("").body)),p={stream:m&&(b=>b.body)};c&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!p[b]&&(p[b]=(y,S)=>{let w=y&&y[b];if(w)return w.call(y);throw new P(`Response type '${b}' is not supported`,P.ERR_NOT_SUPPORT,S)})});const g=async b=>{if(b==null)return 0;if(v.isBlob(b))return b.size;if(v.isSpecCompliantForm(b))return(await new o(he.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(v.isArrayBufferView(b)||v.isArrayBuffer(b))return b.byteLength;if(v.isURLSearchParams(b)&&(b=b+""),v.isString(b))return(await u(b)).byteLength},x=async(b,y)=>{const S=v.toFiniteNumber(b.getContentLength());return S??g(y)};return async b=>{let{url:y,method:S,data:w,signal:N,cancelToken:_,timeout:C,onDownloadProgress:R,onUploadProgress:E,responseType:D,headers:L,withCredentials:F="same-origin",fetchOptions:ee,maxContentLength:V,maxBodyLength:Z}=Wo(b);const Q=v.isNumber(V)&&V>-1,Y=v.isNumber(Z)&&Z>-1,le=I=>v.hasOwnProp(b,I)?b[I]:void 0;let fe=n||fetch;D=D?(D+"").toLowerCase():"text";let T=od([N,_&&_.toAbortSignal()],C),j=null;const U=T&&T.unsubscribe&&(()=>{T.unsubscribe()});let W,q=null;const M=()=>new P("Request body larger than maxBodyLength limit",P.ERR_BAD_REQUEST,b,j);try{let I;const $=le("auth");if($){const z=v.getSafeProp($,"username")||"",me=v.getSafeProp($,"password")||"";I={username:z,password:me}}if(fd(y)){const z=new URL(y,he.origin);if(!I&&(z.username||z.password)){const me=Cn(z.username),ye=Cn(z.password);I={username:me,password:ye}}(z.username||z.password)&&(z.username="",z.password="",y=z.href)}if(I&&(L.delete("authorization"),L.set("Authorization","Basic "+btoa(ud((I.username||"")+":"+(I.password||""))))),Q&&typeof y=="string"&&y.startsWith("data:")&&dd(y)>V)throw new P("maxContentLength size of "+V+" exceeded",P.ERR_BAD_RESPONSE,b,j);if(Y&&S!=="get"&&S!=="head"){const z=await g(w);if(typeof z=="number"&&isFinite(z)&&(W=z,z>Z))throw M()}const J=Y&&(v.isReadableStream(w)||v.isStream(w)),G=(z,me,ye)=>jn(z,Nn,Ee=>{if(Y&&Ee>Z)throw q=M();me&&me(Ee)},ye);if(h&&S!=="get"&&S!=="head"&&(E||J)){if(W=W??await x(L,w),W!==0||J){let z=new o(y,{method:"POST",body:w,duplex:"half"}),me;if(v.isFormData(w)&&(me=z.headers.get("content-type"))&&L.setContentType(me),z.body){const[ye,Ee]=E&&vn(W,Ss(wn(E)))||[];w=G(z.body,ye,Ee)}}}else if(J&&!l&&f&&S!=="get"&&S!=="head")w=G(w);else if(J&&l&&!h&&S!=="get"&&S!=="head")throw new P("Stream request bodies are not supported by the current fetch implementation",P.ERR_NOT_SUPPORT,b,j);v.isString(F)||(F=F?"include":"omit");const de=l&&"credentials"in o.prototype;if(v.isFormData(w)){const z=L.getContentType();z&&/^multipart\/form-data/i.test(z)&&!/boundary=/i.test(z)&&L.delete("content-type")}L.set("User-Agent","axios/"+jr,!1);const be={...ee,signal:T,method:S.toUpperCase(),headers:Oo(L.normalize()),body:w,duplex:"half",credentials:de?F:void 0};j=l&&new o(y,be);let ne=await(l?fe(j,ee):fe(y,be));const Me=xe.from(ne.headers);if(Q){const z=v.toFiniteNumber(Me.getContentLength());if(z!=null&&z>V)throw new P("maxContentLength size of "+V+" exceeded",P.ERR_BAD_RESPONSE,b,j)}const _e=m&&(D==="stream"||D==="response");if(m&&ne.body&&(R||Q||_e&&U)){const z={};["status","statusText","headers"].forEach($e=>{z[$e]=ne[$e]});const me=v.toFiniteNumber(Me.getContentLength()),[ye,Ee]=R&&vn(me,Ss(wn(R),!0))||[];let Te=0;const Ls=$e=>{if(Q&&(Te=$e,Te>V))throw new P("maxContentLength size of "+V+" exceeded",P.ERR_BAD_RESPONSE,b,j);ye&&ye($e)};ne=new i(jn(ne.body,Nn,Ls,()=>{Ee&&Ee(),U&&U()}),z)}D=D||"text";let ke=await p[v.findKey(p,D)||"text"](ne,b);if(Q&&!m&&!_e){let z;if(ke!=null&&(typeof ke.byteLength=="number"?z=ke.byteLength:typeof ke.size=="number"?z=ke.size:typeof ke=="string"&&(z=typeof r=="function"?new r().encode(ke).byteLength:ke.length)),typeof z=="number"&&z>V)throw new P("maxContentLength size of "+V+" exceeded",P.ERR_BAD_RESPONSE,b,j)}return!_e&&U&&U(),await new Promise((z,me)=>{zo(z,me,{data:ke,headers:xe.from(ne.headers),status:ne.status,statusText:ne.statusText,config:b,request:j})})}catch(I){if(U&&U(),T&&T.aborted&&T.reason instanceof P){const $=T.reason;throw $.config=b,j&&($.request=j),I!==$&&Object.defineProperty($,"cause",{__proto__:null,value:I,writable:!0,enumerable:!1,configurable:!0}),$}if(q)throw j&&!q.request&&(q.request=j),q;if(I instanceof P)throw j&&!I.request&&(I.request=j),I;if(I&&I.name==="TypeError"&&/Load failed|fetch/i.test(I.message)){const $=new P("Network Error",P.ERR_NETWORK,b,j,I&&I.response);throw Object.defineProperty($,"cause",{__proto__:null,value:I.cause||I,writable:!0,enumerable:!1,configurable:!0}),$}throw P.from(I,I&&I.code,b,j,I&&I.response)}}},md=new Map,Ho=e=>{let t=e&&e.env||{};const{fetch:s,Request:r,Response:n}=t,o=[r,n,s];let i=o.length,c=i,l,d,f=md;for(;c--;)l=o[c],d=f.get(l),d===void 0&&f.set(l,d=c?new Map:hd(t)),f=d;return d};Ho();const Nr={http:_l,xhr:nd,fetch:{get:Ho}};v.forEach(Nr,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const kn=e=>`- ${e}`,pd=e=>v.isFunction(e)||e===null||e===!1;function gd(e,t){e=v.isArray(e)?e:[e];const{length:s}=e;let r,n;const o={};for(let i=0;i<s;i++){r=e[i];let c;if(n=r,!pd(r)&&(n=Nr[(c=String(r)).toLowerCase()],n===void 0))throw new P(`Unknown adapter '${c}'`);if(n&&(v.isFunction(n)||(n=n.get(t))))break;o[c||"#"+i]=n}if(!n){const i=Object.entries(o).map(([l,d])=>`adapter ${l} `+(d===!1?"is not supported by the environment":"is not available in the build"));let c=s?i.length>1?`since :
|
|
6
|
+
<%s key={someKey} {...props} />`,q,$,J,$),T[$+q]=!0)}if($=null,W!==void 0&&(s(W),$=""+W),i(U)&&(s(U.key),$=""+U.key),"key"in U){W={};for(var G in U)G!=="key"&&(W[G]=U[G])}else W=U;return $&&c(W,typeof C=="function"?C.displayName||C.name||"Unknown":C),d(C,$,W,n(),M,I)}function u(C){h(C)?C._store&&(C._store.validated=1):typeof C=="object"&&C!==null&&C.$$typeof===E&&(C._payload.status==="fulfilled"?h(C._payload.value)&&C._payload.value._store&&(C._payload.value._store.validated=1):C._store&&(C._store.validated=1))}function h(C){return typeof C=="object"&&C!==null&&C.$$typeof===p}var m=k,p=Symbol.for("react.transitional.element"),g=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),y=Symbol.for("react.profiler"),S=Symbol.for("react.consumer"),w=Symbol.for("react.context"),N=Symbol.for("react.forward_ref"),j=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),E=Symbol.for("react.lazy"),D=Symbol.for("react.activity"),L=Symbol.for("react.client.reference"),F=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ee=Object.prototype.hasOwnProperty,V=Array.isArray,Z=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(C){return C()}};var Q,Y={},de=m.react_stack_bottom_frame.bind(m,o)(),fe=Z(r(o)),T={};Et.Fragment=x,Et.jsx=function(C,U,W){var q=1e4>F.recentlyCreatedOwnerStacks++;return f(C,U,W,!1,q?Error("react-stack-top-frame"):de,q?Z(r(C)):fe)},Et.jsxs=function(C,U,W){var q=1e4>F.recentlyCreatedOwnerStacks++;return f(C,U,W,!0,q?Error("react-stack-top-frame"):de,q?Z(r(C)):fe)}})()),Et}var Lr;function Ea(){return Lr||(Lr=1,process.env.NODE_ENV==="production"?Gt.exports=_a():Gt.exports=ka()),Gt.exports}var a=Ea(),It=typeof window<"u"?B.useLayoutEffect:B.useEffect;function Ms(e){const t=B.useRef({value:e,prev:null}),s=t.current.value;return e!==s&&(t.current={value:e,prev:s}),t.current.prev}function Pa(e,t,s={},r={}){B.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!="function")return;const n=new IntersectionObserver(([o])=>{t(o)},s);return n.observe(e.current),()=>{n.disconnect()}},[t,s,r.disabled,e])}function Ta(e){const t=B.useRef(null);return B.useImperativeHandle(e,()=>t.current,[]),t}const Hn=!1;function Dt(e){return e[e.length-1]}function Aa(e){return typeof e=="function"}function Ze(e,t){return Aa(e)?e(t):e}const qn=Object.prototype.hasOwnProperty,Mr=Object.prototype.propertyIsEnumerable;function Gn(e){for(const t in e)if(qn.call(e,t))return!0;return!1}const Oa=()=>Object.create(null),Ye=(e,t)=>Qe(e,t,Oa);function Qe(e,t,s=()=>({}),r=0){if(e===t)return e;if(r>500)return t;const n=t,o=Fr(e)&&Fr(n);if(!o&&!(ms(e)&&ms(n)))return n;const i=o?e:Ir(e);if(!i)return n;const c=o?n:Ir(n);if(!c)return n;const l=i.length,d=c.length,f=o?new Array(d):s();let u=0;for(let h=0;h<d;h++){const m=o?h:c[h],p=e[m],g=n[m];if(p===g){f[m]=p,(o?h<l:qn.call(e,m))&&u++;continue}if(p===null||g===null||typeof p!="object"||typeof g!="object"){f[m]=g;continue}const x=Qe(p,g,s,r+1);f[m]=x,x===p&&u++}return l===d&&u===l?e:f}function Ir(e){const t=Object.getOwnPropertyNames(e);for(const n of t)if(!Mr.call(e,n))return!1;const s=Object.getOwnPropertySymbols(e);if(s.length===0)return t;const r=t;for(const n of s){if(!Mr.call(e,n))return!1;r.push(n)}return r}function ms(e){if(!Dr(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const s=t.prototype;return!(!Dr(s)||!s.hasOwnProperty("isPrototypeOf"))}function Dr(e){return Object.prototype.toString.call(e)==="[object Object]"}function Fr(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function st(e,t,s){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,n=e.length;r<n;r++)if(!st(e[r],t[r],s))return!1;return!0}if(ms(e)&&ms(t)){const r=s?.ignoreUndefined??!0;if(s?.partial){for(const i in t)if((!r||t[i]!==void 0)&&!st(e[i],t[i],s))return!1;return!0}let n=0;if(!r)n=Object.keys(e).length;else for(const i in e)e[i]!==void 0&&n++;let o=0;for(const i in t)if((!r||t[i]!==void 0)&&(o++,o>n||!st(e[i],t[i],s)))return!1;return n===o}return!1}function yt(e){let t,s;const r=new Promise((n,o)=>{t=n,s=o});return r.status="pending",r.resolve=n=>{r.status="resolved",r.value=n,t(n),e?.(n)},r.reject=n=>{r.status="rejected",s(n)},r}function Ft(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}function Ur(e,t){for(let s=e.length-1;s>=0;s--){const r=e[s];if(t(r))return r}}const La=/[\x00-\x1f\x7f"<>`{}]/g;function Ma(e){return e.replace(La,t=>"%"+t.charCodeAt(0).toString(16).toUpperCase().padStart(2,"0"))}function $r(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,s=>{try{return decodeURI(s)}catch{return s}})}return Ma(t)}const Ia=["http:","https:","mailto:","tel:"];function ps(e,t){if(!e)return!1;try{const s=new URL(e);return!t.has(s.protocol)}catch{return!1}}function Pt(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 s=0,r="",n;for(;(n=t.exec(e))!==null;)r+=$r(e.slice(s,n.index))+n[0],s=t.lastIndex;r=r+$r(s?e.slice(s):e);let o=!1;return r.startsWith("//")&&(o=!0,r="/"+r.replace(/^\/+/,"")),{path:r,handledProtocolRelativeURL:o}}function Da(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Fa(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let s=0;s<e.length;s++)if(e[s]!==t[s])return!1;return!0}function Ue(){throw new Error("Invariant failed")}function Ut(e){const t=new Map;let s,r;const n=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,s=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 n(i),i.value},set(o,i){if(t.size>=e&&s){const l=s;t.delete(l.key),l.next&&(s=l.next,l.next.prev=void 0),l===r&&(r=void 0)}const c=t.get(o);if(c)c.value=i,n(c);else{const l={key:o,value:i,prev:r};r&&(r.next=l),r=l,s||(s=l),t.set(o,l)}},clear(){t.clear(),s=void 0,r=void 0}}}const Ve=4,Kn=5;function Ua(e){const t=e.indexOf("{");if(t===-1)return null;const s=e.indexOf("}",t);return s===-1||t+1>=e.length?null:[t,s]}function Yn(e,t,s=new Uint16Array(6)){const r=e.indexOf("/",t),n=r===-1?e.length:r,o=e.substring(t,n);if(!o||!o.includes("$"))return s[0]=0,s[1]=t,s[2]=t,s[3]=n,s[4]=n,s[5]=n,s;if(o==="$"){const c=e.length;return s[0]=2,s[1]=t,s[2]=t,s[3]=c,s[4]=c,s[5]=c,s}if(o.charCodeAt(0)===36)return s[0]=1,s[1]=t,s[2]=t+1,s[3]=n,s[4]=n,s[5]=n,s;const i=Ua(o);if(i){const[c,l]=i,d=o.charCodeAt(c+1);if(d===45){if(c+2<o.length&&o.charCodeAt(c+2)===36){const f=c+3,u=l;if(f<u)return s[0]=3,s[1]=t+c,s[2]=t+f,s[3]=t+u,s[4]=t+l+1,s[5]=n,s}}else if(d===36){const f=c+1,u=c+2;return u===l?(s[0]=2,s[1]=t+c,s[2]=t+f,s[3]=t+u,s[4]=t+l+1,s[5]=e.length,s):(s[0]=1,s[1]=t+c,s[2]=t+u,s[3]=t+l,s[4]=t+l+1,s[5]=n,s)}}return s[0]=0,s[1]=t,s[2]=t,s[3]=n,s[4]=n,s[5]=n,s}function _s(e,t,s,r,n,o,i){i?.(s);let c=r;{const l=s.fullPath??s.from,d=l.length,f=s.options?.caseSensitive??e,u=s.options?.params?.parse??s.options?.parseParams;for(;c<d;){const m=Yn(l,c,t);let p;const g=c,x=m[5];switch(c=x+1,o++,m[0]){case 0:{const b=l.substring(m[2],m[3]);if(f){const y=n.static?.get(b);if(y)p=y;else{n.static??=new Map;const S=et(s.fullPath??s.from);S.parent=n,S.depth=o,p=S,n.static.set(b,S)}}else{const y=b.toLowerCase(),S=n.staticInsensitive?.get(y);if(S)p=S;else{n.staticInsensitive??=new Map;const w=et(s.fullPath??s.from);w.parent=n,w.depth=o,p=w,n.staticInsensitive.set(y,w)}}break}case 1:{const b=l.substring(g,m[1]),y=l.substring(m[4],x),S=f&&!!(b||y),w=b?S?b:b.toLowerCase():void 0,N=y?S?y:y.toLowerCase():void 0,j=!u&&n.dynamic?.find(_=>!_.parse&&_.caseSensitive===S&&_.prefix===w&&_.suffix===N);if(j)p=j;else{const _=Ds(1,s.fullPath??s.from,S,w,N);p=_,_.depth=o,_.parent=n,n.dynamic??=[],n.dynamic.push(_)}break}case 3:{const b=l.substring(g,m[1]),y=l.substring(m[4],x),S=f&&!!(b||y),w=b?S?b:b.toLowerCase():void 0,N=y?S?y:y.toLowerCase():void 0,j=!u&&n.optional?.find(_=>!_.parse&&_.caseSensitive===S&&_.prefix===w&&_.suffix===N);if(j)p=j;else{const _=Ds(3,s.fullPath??s.from,S,w,N);p=_,_.parent=n,_.depth=o,n.optional??=[],n.optional.push(_)}break}case 2:{const b=l.substring(g,m[1]),y=l.substring(m[4],x),S=f&&!!(b||y),w=b?S?b:b.toLowerCase():void 0,N=y?S?y:y.toLowerCase():void 0,j=Ds(2,s.fullPath??s.from,S,w,N);p=j,j.parent=n,j.depth=o,n.wildcard??=[],n.wildcard.push(j)}}n=p}if(u&&s.children&&!s.isRoot&&s.id&&s.id.charCodeAt(s.id.lastIndexOf("/")+1)===95){const m=et(s.fullPath??s.from);m.kind=Kn,m.parent=n,o++,m.depth=o,n.pathless??=[],n.pathless.push(m),n=m}const h=(s.path||!s.children)&&!s.isRoot;if(h&&l.endsWith("/")){const m=et(s.fullPath??s.from);m.kind=Ve,m.parent=n,o++,m.depth=o,n.index=m,n=m}n.parse=u??null,n.priority=s.options?.params?.priority??0,h&&!n.route&&(n.route=s,n.fullPath=s.fullPath??s.from)}if(s.children)for(const l of s.children)_s(e,t,l,c,n,o,i)}function Is(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 ze(e){if(e.pathless)for(const t of e.pathless)ze(t);if(e.static)for(const t of e.static.values())ze(t);if(e.staticInsensitive)for(const t of e.staticInsensitive.values())ze(t);if(e.dynamic?.length){e.dynamic.sort(Is);for(const t of e.dynamic)ze(t)}if(e.optional?.length){e.optional.sort(Is);for(const t of e.optional)ze(t)}if(e.wildcard?.length){e.wildcard.sort(Is);for(const t of e.wildcard)ze(t)}}function et(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 Ds(e,t,s,r,n){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:s,prefix:r,suffix:n}}function $a(e,t){const s=et("/"),r=new Uint16Array(6);for(const n of e)_s(!1,r,n,1,s,0);ze(s),t.masksTree=s,t.flatCache=Ut(1e3)}function Ba(e,t){e||="/";const s=t.flatCache.get(e);if(s)return s;const r=mr(e,t.masksTree);return t.flatCache.set(e,r),r}function za(e,t,s,r,n){e||="/",r||="/";const o=t?`case\0${e}`:e;let i=n.singleCache.get(o);return i||(i=et("/"),_s(t,new Uint16Array(6),{from:e},1,i,0),n.singleCache.set(o,i)),mr(r,i,s)}function Va(e,t,s=!1){const r=s?e:`nofuzz\0${e}`,n=t.matchCache.get(r);if(n!==void 0)return n;e||="/";let o;try{o=mr(e,t.segmentTree,s)}catch(i){if(i instanceof URIError)o=null;else throw i}return o&&(o.branch=Xn(o.route)),t.matchCache.set(r,o),o}function Wa(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function Ha(e,t=!1,s){const r=et(e.fullPath),n=new Uint16Array(6),o={},i={};let c=0;return _s(t,n,e,1,r,0,l=>{if(s?.(l,c),l.id in o){if(process.env.NODE_ENV!=="production")throw new Error(`Invariant failed: Duplicate routes found with id: ${String(l.id)}`);Ue()}if(o[l.id]=l,c!==0&&l.path){const d=Wa(l.fullPath);(!i[d]||l.fullPath.endsWith("/"))&&(i[d]=l)}c++}),ze(r),{processedTree:{segmentTree:r,singleCache:Ut(1e3),matchCache:Ut(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:i}}function mr(e,t,s=!1){const r=e.split("/"),n=Ga(e,r,t,s);if(!n)return null;const[o]=Jn(e,r,n);return{route:n.node.route,rawParams:o}}function Jn(e,t,s){const r=qa(s.node);let n=null;const o=Object.create(null);let i=s.extract?.part??0,c=s.extract?.node??0,l=s.extract?.path??0,d=s.extract?.segment??0;for(;c<r.length;i++,c++,l++,d++){const f=r[c];if(f.kind===Ve)break;if(f.kind===Kn){d--,i--,l--;continue}const u=t[i],h=l;if(u&&(l+=u.length),f.kind===1){n??=s.node.fullPath.split("/");const m=n[d],p=f.prefix?.length??0;if(m.charCodeAt(p)===123){const g=f.suffix?.length??0,x=m.substring(p+2,m.length-g-1),b=u.substring(p,u.length-g);o[x]=decodeURIComponent(b)}else{const g=m.substring(1);o[g]=decodeURIComponent(u)}}else if(f.kind===3){if(s.skipped&1<<c){i--,l=h-1;continue}n??=s.node.fullPath.split("/");const m=n[d],p=f.prefix?.length??0,g=f.suffix?.length??0,x=m.substring(p+3,m.length-g-1),b=f.suffix||f.prefix?u.substring(p,u.length-g):u;b&&(o[x]=decodeURIComponent(b))}else if(f.kind===2){const m=f,p=e.substring(h+(m.prefix?.length??0),e.length-(m.suffix?.length??0)),g=decodeURIComponent(p);o["*"]=g,o._splat=g;break}}return s.rawParams&&Object.assign(o,s.rawParams),[o,{part:i,node:c,path:l,segment:d}]}function Xn(e){const t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function qa(e){const t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function Ga(e,t,s,r){if(e==="/"&&s.index)return{node:s.index,skipped:0};const n=!Dt(t),o=n&&e!=="/",i=t.length-(n?1:0),c=[{node:s,index:1,skipped:0,depth:1,statics:0,dynamics:0,optionals:0}];let l=null,d=null;for(;c.length;){const f=c.pop(),{node:u,index:h,skipped:m,depth:p,statics:g,dynamics:x,optionals:b}=f;let{extract:y,rawParams:S}=f;if(u.kind===2&&u.route&&!Yt(d,f))continue;if(u.parse){if(!Br(e,t,f))continue;S=f.rawParams,y=f.extract}r&&u.route&&u.kind!==Ve&&Yt(l,f)&&(l=f);const w=h===i;if(w&&(u.route&&(!o||u.kind===Ve||u.kind===2)&&Yt(d,f)&&(d=f),!u.optional&&!u.wildcard&&!u.index&&!u.pathless))continue;const N=w?void 0:t[h];let j;if(w&&u.index){const _={node:u.index,index:h,skipped:m,depth:p+1,statics:g,dynamics:x,optionals:b,extract:y,rawParams:S};let R=!0;if(u.index.parse&&(Br(e,t,_)||(R=!1)),R){if(!x&&!b&&!m&&Ka(g,i))return _;Yt(d,_)&&(d=_)}}if(u.wildcard)for(let _=u.wildcard.length-1;_>=0;_--){const R=u.wildcard[_],{prefix:E,suffix:D}=R;if(!(E&&(w||!(R.caseSensitive?N:j??=N.toLowerCase()).startsWith(E)))){if(D){if(w)continue;const L=t.slice(h).join("/").slice(-D.length);if((R.caseSensitive?L:L.toLowerCase())!==D)continue}c.push({node:R,index:i,skipped:m,depth:p+1,statics:g,dynamics:x,optionals:b,extract:y,rawParams:S})}}if(u.optional){const _=m|1<<p,R=p+1;for(let E=u.optional.length-1;E>=0;E--){const D=u.optional[E];c.push({node:D,index:h,skipped:_,depth:R,statics:g,dynamics:x,optionals:b,extract:y,rawParams:S})}if(!w)for(let E=u.optional.length-1;E>=0;E--){const D=u.optional[E],{prefix:L,suffix:F}=D;if(L||F){const ee=D.caseSensitive?N:j??=N.toLowerCase();if(L&&!ee.startsWith(L)||F&&!ee.endsWith(F))continue}c.push({node:D,index:h+1,skipped:m,depth:R,statics:g,dynamics:x,optionals:b+Kt(i,h),extract:y,rawParams:S})}}if(!w&&u.dynamic&&N)for(let _=u.dynamic.length-1;_>=0;_--){const R=u.dynamic[_],{prefix:E,suffix:D}=R;if(E||D){const L=R.caseSensitive?N:j??=N.toLowerCase();if(E&&!L.startsWith(E)||D&&!L.endsWith(D))continue}c.push({node:R,index:h+1,skipped:m,depth:p+1,statics:g,dynamics:x+Kt(i,h),optionals:b,extract:y,rawParams:S})}if(!w&&u.staticInsensitive){const _=u.staticInsensitive.get(j??=N.toLowerCase());_&&c.push({node:_,index:h+1,skipped:m,depth:p+1,statics:g+Kt(i,h),dynamics:x,optionals:b,extract:y,rawParams:S})}if(!w&&u.static){const _=u.static.get(N);_&&c.push({node:_,index:h+1,skipped:m,depth:p+1,statics:g+Kt(i,h),dynamics:x,optionals:b,extract:y,rawParams:S})}if(u.pathless){const _=p+1;for(let R=u.pathless.length-1;R>=0;R--){const E=u.pathless[R];c.push({node:E,index:h,skipped:m,depth:_,statics:g,dynamics:x,optionals:b,extract:y,rawParams:S})}}}if(d)return d;if(r&&l){let f=l.index;for(let h=0;h<l.index;h++)f+=t[h].length;const u=f===e.length?"/":e.slice(f);return l.rawParams??=Object.create(null),l.rawParams["**"]=decodeURIComponent(u),l}return null}function Kt(e,t){return 2**(e-t-1)}function Ka(e,t){return e===2**(t-1)-1}function Br(e,t,s){let r,n;try{[r,n]=Jn(e,t,s)}catch{return null}if(s.rawParams=r,s.extract=n,!s.node.parse)return!0;try{if(s.node.parse(r)===!1)return null}catch{}return!0}function Yt(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===Ve)>(e.node.kind===Ve)||t.node.kind===Ve==(e.node.kind===Ve)&&t.depth>e.depth))):!0}function is(e){return pr(e.filter(t=>t!==void 0).join("/"))}function pr(e){return e.replace(/\/{2,}/g,"/")}function Zn(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function Fe(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/{1,}$/,""):e}function Qn(e){return Fe(Zn(e))}function gs(e,t){return e?.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function Ya(e,t,s){return gs(e,s)===gs(t,s)}function Ja({base:e,to:t,trailingSlash:s="never",cache:r}){const n=t.startsWith("/"),o=!n&&t===".";let i;if(r){i=n?t:o?e:e+"\0"+t;const d=r.get(i);if(d)return d}let c;if(o)c=e.split("/");else if(n)c=t.split("/");else{for(c=e.split("/");c.length>1&&Dt(c)==="";)c.pop();const d=t.split("/");for(let f=0,u=d.length;f<u;f++){const h=d[f];h===""?f?f===u-1&&c.push(h):c=[h]:h===".."?c.pop():h==="."||c.push(h)}}c.length>1&&(Dt(c)===""?s==="never"&&c.pop():s==="always"&&c.push(""));const l=pr(c.join("/"))||"/";return i&&r&&r.set(i,l),l}function Xa(e){const t=new Map(e.map(n=>[encodeURIComponent(n),n])),s=Array.from(t.keys()).map(n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),r=new RegExp(s,"g");return n=>n.replace(r,o=>t.get(o)??o)}function Fs(e,t,s){const r=t[e];return typeof r!="string"?r:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split("/").map(n=>Vr(n,s)).join("/"):Vr(r,s)}function zr({path:e,params:t,decoder:s,...r}){let n=!1;const o=Object.create(null);if(!e||e==="/")return{interpolatedPath:"/",usedParams:o,isMissingParams:n};if(!e.includes("$"))return{interpolatedPath:e,usedParams:o,isMissingParams:n};const i=e.length;let c=0,l,d="";for(;c<i;){const f=c;l=Yn(e,f,l);const u=l[5];if(c=u+1,f===u)continue;const h=l[0];if(h===0){d+="/"+e.substring(f,u);continue}if(h===2){const m=t._splat;o._splat=m,o["*"]=m;const p=e.substring(f,l[1]),g=e.substring(l[4],u);if(!m){n=!0,(p||g)&&(d+="/"+p+g);continue}const x=Fs("_splat",t,s);d+="/"+p+x+g;continue}if(h===1){const m=e.substring(l[2],l[3]);!n&&!(m in t)&&(n=!0),o[m]=t[m];const p=e.substring(f,l[1]),g=e.substring(l[4],u),x=Fs(m,t,s)??"undefined";d+="/"+p+x+g;continue}if(h===3){const m=e.substring(l[2],l[3]),p=t[m];if(p==null)continue;o[m]=p;const g=e.substring(f,l[1]),x=e.substring(l[4],u),b=Fs(m,t,s)??"";d+="/"+g+b+x;continue}}return e.endsWith("/")&&(d+="/"),{usedParams:o,interpolatedPath:d||"/",isMissingParams:n}}function Vr(e,t){const s=encodeURIComponent(e);return t?.(s)??s}function ge(e){return e?.isNotFound===!0}function Za(e,t=String){const s=new URLSearchParams;for(const r in e){const n=e[r];n!==void 0&&s.set(r,t(n))}return s.toString()}function Us(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function Qa(e){const t=new URLSearchParams(e),s=Object.create(null);for(const[r,n]of t.entries()){const o=s[r];o==null?s[r]=Us(n):Array.isArray(o)?o.push(Us(n)):s[r]=[o,Us(n)]}return s}const ei=si(JSON.parse),ti=ri(JSON.stringify,JSON.parse);function si(e){return t=>{t[0]==="?"&&(t=t.substring(1));const s=Qa(t);for(const r in s){const n=s[r];if(typeof n=="string")try{s[r]=e(n)}catch{}}return s}}function ri(e,t){const s=typeof t=="function";function r(n){if(typeof n=="object"&&n!==null)try{return e(n)}catch{}else if(s&&typeof n=="string")try{return t(n),e(n)}catch{}return n}return n=>{const o=Za(n,r);return o?`?${o}`:""}}const rt="__root__";function ni(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 s=new Response(null,{status:e.statusCode,headers:t});if(s.options=e,e.throw)throw s;return s}function Se(e){return e instanceof Response&&!!e.options}const tr=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},oi=e=>e.stores.matchesId.get().some(t=>e.stores.matchStores.get(t)?.get()._forcePending),ks=(e,t)=>!!(e.preload&&!e.router.stores.matchStores.has(t)),nt=(e,t,s=!0)=>{const r={...e.router.options.context??{}},n=s?t:t-1;for(let o=0;o<=n;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},Wr=(e,t)=>{if(!e.matches.length)return;const s=t.routeId,r=e.matches.findIndex(i=>i.routeId===e.router.routeTree.id),n=r>=0?r:0;let o=s?e.matches.findIndex(i=>i.routeId===s):e.firstBadMatchIndex??e.matches.length-1;o<0&&(o=n);for(let i=o;i>=0;i--){const c=e.matches[i];if(e.router.looseRoutesById[c.routeId].options.notFoundComponent)return i}return s?o:n},We=(e,t,s)=>{if(!(!Se(s)&&!ge(s)))throw Se(s)&&s.redirectHandled&&!s.options.reloadDocument||(t&&(t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=s,e.updateMatch(t.id,r=>({...r,status:Se(s)?"redirected":ge(s)?"notFound":r.status==="pending"?"success":r.status,context:nt(e,t.index),isFetching:!1,error:s})),ge(s)&&!s.routeId&&(s.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()),Se(s)&&(e.rendered=!0,s.options._fromLocation=e.location,s.redirectHandled=!0,s=e.router.resolveRedirect(s))),s},eo=(e,t)=>{const s=e.router.getMatch(t);return!!(!s||s._nonReactive.dehydrated)},Hr=(e,t,s)=>{const r=nt(e,s);e.updateMatch(t,n=>({...n,context:r}))},Tt=(e,t,s)=>{const{id:r,routeId:n}=e.matches[t],o=e.router.looseRoutesById[n];if(s instanceof Promise)throw s;e.firstBadMatchIndex??=t,We(e,e.router.getMatch(r),s);try{o.options.onError?.(s)}catch(i){s=i,We(e,e.router.getMatch(r),s)}e.updateMatch(r,i=>(i._nonReactive.beforeLoadPromise?.resolve(),i._nonReactive.beforeLoadPromise=void 0,i._nonReactive.loadPromise?.resolve(),{...i,error:s,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})),!e.preload&&!Se(s)&&!ge(s)&&(e.serialError??=s)},to=(e,t,s,r)=>{if(r._nonReactive.pendingTimeout!==void 0)return;const n=s.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!ks(e,t)&&(s.options.loader||s.options.beforeLoad||ro(s))&&typeof n=="number"&&n!==1/0&&(s.options.pendingComponent??e.router.options?.defaultPendingComponent)){const o=setTimeout(()=>{tr(e)},n);r._nonReactive.pendingTimeout=o}},ai=(e,t,s)=>{const r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;to(e,t,s,r);const n=()=>{const o=e.router.getMatch(t);o.preload&&(o.status==="redirected"||o.status==="notFound")&&We(e,o,o.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(n):n()},ii=(e,t,s,r)=>{const n=e.router.getMatch(t);let o=n._nonReactive.loadPromise;n._nonReactive.loadPromise=yt(()=>{o?.resolve(),o=void 0});const{paramsError:i,searchError:c}=n;i&&Tt(e,s,i),c&&Tt(e,s,c),to(e,t,r,n);const l=new AbortController;let d=!1;const f=()=>{d||(d=!0,e.updateMatch(t,w=>({...w,isFetching:"beforeLoad",fetchCount:w.fetchCount+1,abortController:l})))},u=()=>{n._nonReactive.beforeLoadPromise?.resolve(),n._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,w=>({...w,isFetching:!1}))};if(!r.options.beforeLoad){e.router.batch(()=>{f(),u()});return}n._nonReactive.beforeLoadPromise=yt();const h={...nt(e,s,!1),...n.__routeContext},{search:m,params:p,cause:g}=n,x=ks(e,t),b={search:m,abortController:l,params:p,preload:x,context:h,location:e.location,navigate:w=>e.router.navigate({...w,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:x?"preload":g,matches:e.matches,routeId:r.id,...e.router.options.additionalContext},y=w=>{if(w===void 0){e.router.batch(()=>{f(),u()});return}(Se(w)||ge(w))&&(f(),Tt(e,s,w)),e.router.batch(()=>{f(),e.updateMatch(t,N=>({...N,__beforeLoadContext:w})),u()})};let S;try{if(S=r.options.beforeLoad(b),Ft(S))return f(),S.catch(w=>{Tt(e,s,w)}).then(y)}catch(w){f(),Tt(e,s,w)}y(S)},ci=(e,t)=>{const{id:s,routeId:r}=e.matches[t],n=e.router.looseRoutesById[r],o=()=>c(),i=()=>ii(e,s,t,n),c=()=>{if(eo(e,s))return;const l=ai(e,s,n);return Ft(l)?l.then(i):i()};return o()},li=(e,t,s)=>{const r=e.router.getMatch(t);if(!r||!s.options.head&&!s.options.scripts&&!s.options.headers)return;const n={ssr:e.router.options.ssr,matches:e.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([s.options.head?.(n),s.options.scripts?.(n),s.options.headers?.(n)]).then(([o,i,c])=>({meta:o?.meta,links:o?.links,headScripts:o?.scripts,headers:c,scripts:i,styles:o?.styles}))},so=(e,t,s,r,n)=>{const o=t[r-1],{params:i,loaderDeps:c,abortController:l,cause:d}=e.router.getMatch(s),f=nt(e,r),u=ks(e,s);return{params:i,deps:c,preload:!!u,parentMatchPromise:o,abortController:l,context:f,location:e.location,navigate:h=>e.router.navigate({...h,_fromLocation:e.location}),cause:u?"preload":d,route:n,...e.router.options.additionalContext}},qr=async(e,t,s,r,n)=>{try{const o=e.router.getMatch(s);try{(!(Hn??e.router.isServer)||o.ssr===!0)&&$t(n);const i=n.options.loader,c=typeof i=="function"?i:i?.handler,l=c?.(so(e,t,s,r,n)),d=!!c&&Ft(l);if((d||n._lazyPromise||n._componentsPromise||n.options.head||n.options.scripts||n.options.headers||o._nonReactive.minPendingPromise)&&e.updateMatch(s,u=>({...u,isFetching:"loader"})),c){const u=d?await l:l;We(e,e.router.getMatch(s),u),u!==void 0&&e.updateMatch(s,h=>({...h,loaderData:u}))}n._lazyPromise&&await n._lazyPromise;const f=o._nonReactive.minPendingPromise;f&&await f,n._componentsPromise&&await n._componentsPromise,e.updateMatch(s,u=>({...u,error:void 0,context:nt(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(s,d=>({...d,status:d.status==="pending"?"success":d.status,isFetching:!1,context:nt(e,r)}));return}const l=o._nonReactive.minPendingPromise;l&&await l,ge(i)&&await n.options.notFoundComponent?.preload?.(),We(e,e.router.getMatch(s),i);try{n.options.onError?.(i)}catch(d){c=d,We(e,e.router.getMatch(s),d)}!Se(c)&&!ge(c)&&await $t(n,["errorComponent"]),e.updateMatch(s,d=>({...d,error:c,context:nt(e,r),status:"error",isFetching:!1}))}}catch(o){const i=e.router.getMatch(s);i&&(i._nonReactive.loaderPromise=void 0),We(e,i,o)}},di=async(e,t,s)=>{async function r(m,p,g,x,b){const y=Date.now()-p.updatedAt,S=m?b.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:b.options.staleTime??e.router.options.defaultStaleTime??0,w=b.options.shouldReload,N=typeof w=="function"?w(so(e,t,n,s,b)):w,{status:j,invalid:_}=x,R=y>=S&&(!!e.forceStaleReload||x.cause==="enter"||g!==void 0&&g!==x.id);i=j==="success"&&(_||(N??R)),m&&b.options.preload===!1||(i&&!e.sync&&f?(c=!0,(async()=>{try{await qr(e,t,n,s,b);const E=e.router.getMatch(n);E._nonReactive.loaderPromise?.resolve(),E._nonReactive.loadPromise?.resolve(),E._nonReactive.loaderPromise=void 0,E._nonReactive.loadPromise=void 0}catch(E){Se(E)&&await e.router.navigate(E.options)}})()):j!=="success"||i?await qr(e,t,n,s,b):Hr(e,n,s))}const{id:n,routeId:o}=e.matches[s];let i=!1,c=!1;const l=e.router.looseRoutesById[o],d=l.options.loader,f=((typeof d=="function"?void 0:d?.staleReloadMode)??e.router.options.defaultStaleReloadMode)!=="blocking";if(eo(e,n)){if(!e.router.getMatch(n))return e.matches[s];Hr(e,n,s)}else{const m=e.router.getMatch(n),p=e.router.stores.matchesId.get()[s],g=(p&&e.router.stores.matchStores.get(p)||null)?.routeId===o?p:e.router.stores.matches.get().find(b=>b.routeId===o)?.id,x=ks(e,n);if(m._nonReactive.loaderPromise){if(m.status==="success"&&!e.sync&&!m.preload&&f)return m;await m._nonReactive.loaderPromise;const b=e.router.getMatch(n),y=b._nonReactive.error||b.error;y&&We(e,b,y),b.status==="pending"&&await r(x,m,g,b,l)}else{const b=x&&!e.router.stores.matchStores.has(n),y=e.router.getMatch(n);y._nonReactive.loaderPromise=yt(),b!==y.preload&&e.updateMatch(n,S=>({...S,preload:b})),await r(x,m,g,y,l)}}const u=e.router.getMatch(n);c||(u._nonReactive.loaderPromise?.resolve(),u._nonReactive.loadPromise?.resolve(),u._nonReactive.loadPromise=void 0),clearTimeout(u._nonReactive.pendingTimeout),u._nonReactive.pendingTimeout=void 0,c||(u._nonReactive.loaderPromise=void 0),u._nonReactive.dehydrated=void 0;const h=c?u.isFetching:!1;return h!==u.isFetching||u.invalid!==!1?(e.updateMatch(n,m=>({...m,isFetching:h,invalid:!1})),e.router.getMatch(n)):u};async function Gr(e){const t=e,s=[];oi(t.router)&&tr(t);let r;for(let h=0;h<t.matches.length;h++){try{const m=ci(t,h);Ft(m)&&await m}catch(m){if(Se(m))throw m;if(ge(m))r=m;else if(!t.preload)throw m;break}if(t.serialError||t.firstBadMatchIndex!=null)break}const n=t.firstBadMatchIndex??t.matches.length,o=r&&!t.preload?Wr(t,r):void 0,i=r&&t.preload?0:o!==void 0?Math.min(o+1,n):n;let c,l;for(let h=0;h<i;h++)s.push(di(t,s,h));try{await Promise.all(s)}catch{const h=await Promise.allSettled(s);for(const m of h){if(m.status!=="rejected")continue;const p=m.reason;if(Se(p))throw p;ge(p)?c??=p:l??=p}if(l!==void 0)throw l}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=Wr(t,d);if(h===void 0){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Could not find match for notFound boundary");Ue()}const m=t.matches[h],p=t.router.looseRoutesById[m.routeId],g=t.router.options?.defaultNotFoundComponent;!p.options.notFoundComponent&&g&&(p.options.notFoundComponent=g),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 $t(p,["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 $t(h,["errorComponent"])}for(let h=0;h<=f;h++){const{id:m,routeId:p}=t.matches[h],g=t.router.looseRoutesById[p];try{const x=li(t,m,g);if(x){const b=await x;t.updateMatch(m,y=>({...y,...b}))}}catch(x){console.error(`Error executing head for route ${p}:`,x)}}const u=tr(t);if(Ft(u)&&await u,d)throw d;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function Kr(e,t){const s=t.map(r=>e.options[r]?.preload?.()).filter(Boolean);if(s.length!==0)return Promise.all(s)}function $t(e,t=cs){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(r=>{const{id:n,...o}=r.options;Object.assign(e.options,o),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);const s=()=>e._componentsLoaded?void 0:t===cs?(()=>{if(e._componentsPromise===void 0){const r=Kr(e,cs);r?e._componentsPromise=r.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():Kr(e,t);return e._lazyPromise?e._lazyPromise.then(s):s()}function ro(e){for(const t of cs)if(e.options[t]?.preload)return!0;return!1}const cs=["component","errorComponent","pendingComponent","notFoundComponent"];function ui(e){return{input:({url:t})=>{for(const s of e)t=sr(s,t);return t},output:({url:t})=>{for(let s=e.length-1;s>=0;s--)t=no(e[s],t);return t}}}function fi(e){const t=Qn(e.basepath),s=`/${t}`,r=e.caseSensitive?s:s.toLowerCase(),n=`${r}/`;return{input:({url:o})=>{const i=e.caseSensitive?o.pathname:o.pathname.toLowerCase();return i===r?o.pathname="/":i.startsWith(n)&&(o.pathname=o.pathname.slice(s.length)),o},output:({url:o})=>(o.pathname=is(["/",t,o.pathname]),o)}}function sr(e,t){const s=e?.input?.({url:t});if(s){if(typeof s=="string")return new URL(s);if(s instanceof URL)return s}return t}function no(e,t){const s=e?.output?.({url:t});if(s){if(typeof s=="string")return new URL(s);if(s instanceof URL)return s}return t}function hi(e,t){const{createMutableStore:s,createReadonlyStore:r,batch:n,init:o}=t,i=new Map,c=new Map,l=new Map,d=s(e.status),f=s(e.loadedAt),u=s(e.isLoading),h=s(e.isTransitioning),m=s(e.location),p=s(e.resolvedLocation),g=s(e.statusCode),x=s(e.redirect),b=s([]),y=s([]),S=s([]),w=r(()=>$s(i,b.get())),N=r(()=>$s(c,y.get())),j=r(()=>$s(l,S.get())),_=r(()=>b.get()[0]),R=r(()=>b.get().some(Y=>i.get(Y)?.get().status==="pending")),E=r(()=>({locationHref:m.get().href,resolvedLocationHref:p.get()?.href,status:d.get()})),D=r(()=>({status:d.get(),loadedAt:f.get(),isLoading:u.get(),isTransitioning:h.get(),matches:w.get(),location:m.get(),resolvedLocation:p.get(),statusCode:g.get(),redirect:x.get()})),L=Ut(64);function F(Y){let de=L.get(Y);return de||(de=r(()=>{const fe=b.get();for(const T of fe){const C=i.get(T);if(C&&C.routeId===Y)return C.get()}}),L.set(Y,de)),de}const ee={status:d,loadedAt:f,isLoading:u,isTransitioning:h,location:m,resolvedLocation:p,statusCode:g,redirect:x,matchesId:b,pendingIds:y,cachedIds:S,matches:w,pendingMatches:N,cachedMatches:j,firstId:_,hasPending:R,matchRouteDeps:E,matchStores:i,pendingMatchStores:c,cachedMatchStores:l,__store:D,getRouteMatchStore:F,setMatches:V,setPending:Z,setCached:Q};V(e.matches),o?.(ee);function V(Y){Bs(Y,i,b,s,n)}function Z(Y){Bs(Y,c,y,s,n)}function Q(Y){Bs(Y,l,S,s,n)}return ee}function $s(e,t){const s=[];for(const r of t){const n=e.get(r);n&&s.push(n.get())}return s}function Bs(e,t,s,r,n){const o=e.map(c=>c.id),i=new Set(o);n(()=>{for(const c of t.keys())i.has(c)||t.delete(c);for(const c of e){const l=t.get(c.id);if(!l){const d=r(c);d.routeId=c.routeId,t.set(c.id,d);continue}l.routeId=c.routeId,l.get()!==c&&l.set(c)}Fa(s.get(),o)||s.set(o)})}var He="__TSR_index",Yr="popstate",Jr="beforeunload";function mi(e){let t=e.getLocation();const s=new Set,r=i=>{t=e.getLocation(),s.forEach(c=>c({location:t,action:i}))},n=i=>{e.notifyOnIndexChange??!0?r(i):t=e.getLocation()},o=async({task:i,navigateOpts:c,...l})=>{if(c?.ignoreBlocker??!1){i();return}const d=e.getBlockers?.()??[],f=l.type==="PUSH"||l.type==="REPLACE";if(typeof document<"u"&&d.length&&f)for(const u of d){const h=xs(l.path,l.state);if(await u.blockerFn({currentLocation:t,nextLocation:h,action:l.type})){e.onBlocked?.();return}}i()};return{get location(){return t},get length(){return e.getLength()},subscribers:s,subscribe:i=>(s.add(i),()=>{s.delete(i)}),push:(i,c,l)=>{const d=t.state[He];c=Xr(d+1,c),o({task:()=>{e.pushState(i,c),r({type:"PUSH"})},navigateOpts:l,type:"PUSH",path:i,state:c})},replace:(i,c,l)=>{const d=t.state[He];c=Xr(d,c),o({task:()=>{e.replaceState(i,c),r({type:"REPLACE"})},navigateOpts:l,type:"REPLACE",path:i,state:c})},go:(i,c)=>{o({task:()=>{e.go(i),n({type:"GO",index:i})},navigateOpts:c,type:"GO"})},back:i=>{o({task:()=>{e.back(i?.ignoreBlocker??!1),n({type:"BACK"})},navigateOpts:i,type:"BACK"})},forward:i=>{o({task:()=>{e.forward(i?.ignoreBlocker??!1),n({type:"FORWARD"})},navigateOpts:i,type:"FORWARD"})},canGoBack:()=>t.state[He]!==0,createHref:i=>e.createHref(i),block:i=>{if(!e.setBlockers)return()=>{};const c=e.getBlockers?.()??[];return e.setBlockers([...c,i]),()=>{const l=e.getBlockers?.()??[];e.setBlockers?.(l.filter(d=>d!==i))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function Xr(e,t){t||(t={});const s=gr();return{...t,key:s,__TSR_key:s,[He]:e}}function pi(e){const t=typeof document<"u"?window:void 0,s=t.history.pushState,r=t.history.replaceState;let n=[];const o=()=>n,i=R=>n=R,c=(R=>R),l=(()=>xs(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){const R=gr();t.history.replaceState({[He]:0,key:R,__TSR_key:R},"")}let d=l(),f,u=!1,h=!1,m=!1,p=!1;const g=()=>d;let x,b;const y=()=>{x&&(_._ignoreSubscribers=!0,(x.isPush?t.history.pushState:t.history.replaceState)(x.state,"",x.href),_._ignoreSubscribers=!1,x=void 0,b=void 0,f=void 0)},S=(R,E,D)=>{const L=c(E);b||(f=d),d=xs(E,D),x={href:L,state:D,isPush:x?.isPush||R==="push"},b||(b=Promise.resolve().then(()=>y()))},w=R=>{d=l(),_.notify({type:R})},N=async()=>{if(h){h=!1;return}const R=l(),E=R.state[He]-d.state[He],D=E===1,L=E===-1,F=!D&&!L||u;u=!1;const ee=F?"GO":L?"BACK":"FORWARD",V=F?{type:"GO",index:E}:{type:L?"BACK":"FORWARD"};if(m)m=!1;else{const Z=o();if(typeof document<"u"&&Z.length){for(const Q of Z)if(await Q.blockerFn({currentLocation:d,nextLocation:R,action:ee})){h=!0,t.history.go(1),_.notify(V);return}}}d=l(),_.notify(V)},j=R=>{if(p){p=!1;return}let E=!1;const D=o();if(typeof document<"u"&&D.length)for(const L of D){const F=L.enableBeforeUnload??!0;if(F===!0){E=!0;break}if(typeof F=="function"&&F()===!0){E=!0;break}}if(E)return R.preventDefault(),R.returnValue=""},_=mi({getLocation:g,getLength:()=>t.history.length,pushState:(R,E)=>S("push",R,E),replaceState:(R,E)=>S("replace",R,E),back:R=>(R&&(m=!0),p=!0,t.history.back()),forward:R=>{R&&(m=!0),p=!0,t.history.forward()},go:R=>{u=!0,t.history.go(R)},createHref:R=>c(R),flush:y,destroy:()=>{t.history.pushState=s,t.history.replaceState=r,t.removeEventListener(Jr,j,{capture:!0}),t.removeEventListener(Yr,N)},onBlocked:()=>{f&&d!==f&&(d=f)},getBlockers:o,setBlockers:i,notifyOnIndexChange:!1});return t.addEventListener(Jr,j,{capture:!0}),t.addEventListener(Yr,N),t.history.pushState=function(...R){const E=s.apply(t.history,R);return _._ignoreSubscribers||w("PUSH"),E},t.history.replaceState=function(...R){const E=r.apply(t.history,R);return _._ignoreSubscribers||w("REPLACE"),E},_}function gi(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function xs(e,t){const s=gi(e),r=s.indexOf("#"),n=s.indexOf("?"),o=gr();return{href:s,pathname:s.substring(0,r>0?n>0?Math.min(r,n):r:n>0?n:s.length),hash:r>-1?s.substring(r):"",search:n>-1?s.slice(n,r===-1?void 0:r):"",state:t||{[He]:0,key:o,__TSR_key:o}}}function gr(){return(Math.random()+1).toString(36).substring(7)}function xt(e,t){const s=t,r=e;return{fromLocation:s,toLocation:r,pathChanged:s?.pathname!==r.pathname,hrefChanged:s?.href!==r.href,hashChanged:s?.hash!==r.hash}}const rr=new WeakMap;var xi=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=s=>s(),this.update=s=>{process.env.NODE_ENV!=="production"&&s.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,n=this.basepath??r?.basepath??"/",o=this.basepath===void 0,i=r?.rewrite;if(this.options={...r,...s},this.isServer=this.options.isServer??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=Xa(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=pi()),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=Ut(1e3),f=this.buildRouteTree(),this.setRoutes(f)}if(!this.stores&&this.latestLocation){const f=this.getStoreConfig(this);this.batch=f.batch,this.stores=hi(yi(this.latestLocation),f),Pi(this)}let c=!1;const l=this.options.basepath??"/",d=this.options.rewrite;if(o||n!==l||i!==d){this.basepath=l;const f=[],u=Qn(l);u&&u!=="/"&&f.push(fi({basepath:l})),d&&f.push(d),this.rewrite=f.length===0?void 0:f.length===1?f[0]:ui(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 s=Ha(this.routeTree,this.options.caseSensitive,(r,n)=>{r.init({originalIndex:n})});return this.options.routeMasks&&$a(this.options.routeMasks,s.processedTree),s},this.subscribe=(s,r)=>{const n={eventType:s,fn:r};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=s=>{this.subscribers.forEach(r=>{r.eventType===s.type&&r.fn(s)})},this.parseLocation=(s,r)=>{const n=({pathname:l,search:d,hash:f,href:u,state:h})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(l)){const b=this.options.parseSearch(d),y=this.options.stringifySearch(b);return{href:l+y+f,publicHref:l+y+f,pathname:Pt(l).path,external:!1,searchStr:y,search:Ye(r?.search,b),hash:Pt(f.slice(1)).path,state:Qe(r?.state,h)}}const m=new URL(u,this.origin),p=sr(this.rewrite,m),g=this.options.parseSearch(p.search),x=this.options.stringifySearch(g);return p.search=x,{href:p.href.replace(p.origin,""),publicHref:u,pathname:Pt(p.pathname).path,external:!!this.rewrite&&p.origin!==this.origin,searchStr:x,search:Ye(r?.search,g),hash:Pt(p.hash.slice(1)).path,state:Qe(r?.state,h)}},o=n(s),{__tempLocation:i,__tempKey:c}=o.state;if(i&&(!c||c===this.tempLocationKey)){const l=n(i);return l.state.key=o.state.key,l.state.__TSR_key=o.state.__TSR_key,delete l.state.__tempLocation,{...l,maskedLocation:o}}return o},this.resolvePathWithBase=(s,r)=>Ja({base:s,to:r.includes("//")?pr(r):r,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(s,r,n)=>typeof s=="string"?this.matchRoutesInternal({pathname:s,search:r},n):this.matchRoutesInternal(s,r),this.getMatchedRoutes=s=>vi({pathname:s,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=s=>{const r=this.getMatch(s);r&&(r.abortController.abort(),clearTimeout(r._nonReactive.pendingTimeout),r._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingIds.get().forEach(s=>{this.cancelMatch(s)}),this.stores.matchesId.get().forEach(s=>{if(this.stores.pendingMatchStores.has(s))return;const r=this.stores.matchStores.get(s)?.get();r&&(r.status==="pending"||r.isFetching==="loader")&&this.cancelMatch(s)})},this.buildLocation=s=>{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 L=this.getMatchedRoutes(o.from).matchedRoutes,F=Ur(c.matchedRoutes,V=>Qr(V.fullPath,o.from)),ee=Ur(L,V=>Qr(V.fullPath,c.fullPath));!F&&!ee&&console.warn(`Could not find match for from: ${o.from}`)}const l=o.unsafeRelative==="path"?i.pathname:o.from??c.fullPath,d=o.to?`${o.to}`:void 0,f=c.search,u=Object.assign(Object.create(null),c.params),h=d?.charCodeAt(0)===47?"/":this.resolvePathWithBase(l,"."),m=d?this.resolvePathWithBase(h,d):h,p=o.params===!1||o.params===null?Object.create(null):(o.params??!0)===!0?u:Object.assign(u,Ze(o.params,u)),g=this.routesByPath[Fe(m)];let x;if(g)x=this.getRouteBranch(g);else if(m.includes("$"))x=[];else{const L=this.getMatchedRoutes(m);x=L.matchedRoutes,this.options.notFoundRoute&&(!L.foundRoute||L.foundRoute.path!=="/"&&L.routeParams["**"])&&(x=[...x,this.options.notFoundRoute])}if(x.length&&Gn(p))for(const L of x){const F=L.options.params?.stringify??L.options.stringifyParams;if(F)try{Object.assign(p,F(p))}catch{}}const b=s.leaveParams?m:Pt(zr({path:m,params:p,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;if(process.env.NODE_ENV!=="production"&&g&&!s.leaveParams)try{const L=this.getMatchedRoutes(b);L.foundRoute?.id!==g.id&&console.warn(`Generated path "${b}" for route "${g.id}" matched route "${L.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(s._includeValidateSearch&&this.options.search?.strict){const L={};x.forEach(F=>{if(F.options.validateSearch)try{Object.assign(L,ls(F.options.validateSearch,{...L,...y}))}catch{}}),y=L}y=wi({search:y,dest:o,destRoutes:x,_includeValidateSearch:s._includeValidateSearch}),y=Ye(f,y);const S=this.options.stringifySearch(y),w=o.hash===!0?i.hash:o.hash?Ze(o.hash,i.hash):void 0,N=w?`#${w}`:"";let j=o.state===!0?i.state:o.state?Ze(o.state,i.state):{};j=Qe(i.state,j);const _=`${b}${S}${N}`;let R,E,D=!1;if(this.rewrite){const L=new URL(_,this.origin),F=no(this.rewrite,L);R=L.href.replace(L.origin,""),F.origin!==this.origin?(E=F.href,D=!0):E=F.pathname+F.search+F.hash}else R=Da(_),E=R;return{publicHref:E,href:R,pathname:b,search:y,searchStr:S,state:j,hash:w??"",external:D,unmaskOnReload:o.unmaskOnReload}},n=(o={},i)=>{const c=r(o);let l=i?r(i):void 0;if(!l){const d=Object.create(null);if(this.options.routeMasks){const f=Ba(c.pathname,this.processedTree);if(f){Object.assign(d,f.rawParams);const{from:u,params:h,...m}=f.route,p=h===!1||h===null?Object.create(null):(h??!0)===!0?d:Object.assign(d,Ze(h,d));i={from:s.from,...m,params:p},l=r(i)}}}return l&&(c.maskedLocation=l),c};return s.mask?n(s,{from:s.from,...s.mask}):n(s)},this.commitLocation=async({viewTransition:s,ignoreBlocker:r,...n})=>{let o;const i=()=>{const d=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];d.forEach(u=>{n.state[u]=this.latestLocation.state[u]});const f=st(n.state,this.latestLocation.state);return d.forEach(u=>{delete n.state[u]}),f},c=Fe(this.latestLocation.href)===Fe(n.href);let l=this.commitLocationPromise;if(this.commitLocationPromise=yt(()=>{l?.resolve(),l=void 0}),c&&i())this.load();else{let{maskedLocation:d,hashScrollIntoView:f,...u}=n;d&&(u={...d,state:{...d.state,__tempKey:void 0,__tempLocation:{...u,search:u.searchStr,state:{...u.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(u.unmaskOnReload??this.options.unmaskOnReload??!1)&&(u.state.__tempKey=this.tempLocationKey)),u.state.__hashScrollIntoViewOptions=f??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=s,o=n.replace?"REPLACE":"PUSH",this.history[o==="REPLACE"?"replace":"push"](u.publicHref,u.state,{ignoreBlocker:r})}return this._scroll.next=n.resetScroll??!0,this.history.subscribers.size||this.load(o?{action:{type:o}}:void 0),this.commitLocationPromise},this.buildAndCommitLocation=({replace:s,resetScroll:r,hashScrollIntoView:n,viewTransition:o,ignoreBlocker:i,href:c,...l}={})=>{if(c){const u=this.history.location.state.__TSR_index,h=xs(c,{__TSR_index:s?u:u+1}),m=new URL(h.pathname,this.origin);l.to=sr(this.rewrite,m).pathname,l.search=this.options.parseSearch(h.search),l.hash=h.hash.slice(1)}const d=this.buildLocation({...l,_includeValidateSearch:!0});this.pendingBuiltLocation=d;const f=this.commitLocation({...d,viewTransition:o,replace:s,resetScroll:r,hashScrollIntoView:n,ignoreBlocker:i});return queueMicrotask(()=>{this.pendingBuiltLocation===d&&(this.pendingBuiltLocation=void 0)}),f},this.navigate=async({to:s,reloadDocument:r,href:n,publicHref:o,...i})=>{let c=!1;if(n)try{new URL(`${n}`),c=!0}catch{}if(c&&!r&&(r=!0),r){if(s!==void 0||!n){const d=this.buildLocation({to:s,...i});n=n??d.publicHref,o=o??d.publicHref}const l=!c&&o?o:n;if(ps(l,this.protocolAllowlist)){process.env.NODE_ENV!=="production"&&console.warn(`Blocked navigation to dangerous protocol: ${l}`);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(l):window.location.href=l;return}return this.buildAndCommitLocation({...i,href:n,to:s,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();const s=this.matchRoutes(this.latestLocation),r=this.stores.cachedMatches.get().filter(n=>!s.some(o=>o.id===n.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(s),this.stores.setCached(r)})},this.load=async s=>{const r=s?.action?.type;let n,o,i;const c=this.stores.resolvedLocation.get()??this.stores.location.get();for(i=new Promise(d=>{this.startTransition(async()=>{try{this.beforeLoad(),r?rr.set(this.latestLocation,r):rr.delete(this.latestLocation);const f=this.latestLocation,u=xt(f,this.stores.resolvedLocation.get());this.stores.redirect.get()||this.emit({type:"onBeforeNavigate",...u}),this.emit({type:"onBeforeLoad",...u}),await Gr({router:this,sync:s?.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,p=null,g=null;this.batch(()=>{const x=this.stores.pendingMatches.get(),b=x.length,y=this.stores.matches.get();h=b?y.filter(N=>!this.stores.pendingMatchStores.has(N.id)):null;const S=new Set;for(const N of this.stores.pendingMatchStores.values())N.routeId&&S.add(N.routeId);const w=new Set;for(const N of this.stores.matchStores.values())N.routeId&&w.add(N.routeId);m=b?y.filter(N=>!S.has(N.routeId)):null,p=b?x.filter(N=>!w.has(N.routeId)):null,g=b?x.filter(N=>w.has(N.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(N=>N.status!=="error"&&N.status!=="notFound"&&N.status!=="redirected")]),this.clearExpiredCache())});for(const[x,b]of[[m,"onLeave"],[p,"onEnter"],[g,"onStay"]])if(x)for(const y of x)this.looseRoutesById[y.routeId].options[b]?.(y)})})}})}catch(f){Se(f)?(n=f,this.navigate({...n.options,replace:!0,ignoreBlocker:!0})):ge(f)&&(o=f);const u=n?n.status:o?404:this.stores.matches.get().some(h=>h.status==="error")?500:200;this.batch(()=>{this.stores.statusCode.set(u),this.stores.redirect.set(n)})}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 l;this.hasNotFoundMatch()?l=404:this.stores.matches.get().some(d=>d.status==="error")&&(l=500),l!==void 0&&this.stores.statusCode.set(l)},this.startViewTransition=s=>{const r=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,r&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let n;if(typeof r=="object"&&this.isViewTransitionTypesSupported){const o=this.latestLocation,i=this.stores.resolvedLocation.get(),c=typeof r.types=="function"?r.types(xt(o,i)):r.types;if(c===!1){s();return}n={update:s,types:c}}else n=s;document.startViewTransition(n)}else s()},this.updateMatch=(s,r)=>{this.startTransition(()=>{const n=this.stores.pendingMatchStores.get(s);if(n){n.set(r);return}const o=this.stores.matchStores.get(s);if(o){o.set(r);return}const i=this.stores.cachedMatchStores.get(s);if(i){const c=r(i.get());c.status==="redirected"?this.stores.cachedMatchStores.delete(s)&&this.stores.cachedIds.set(l=>l.filter(d=>d!==s)):i.set(c)}})},this.getMatch=s=>this.stores.cachedMatchStores.get(s)?.get()??this.stores.pendingMatchStores.get(s)?.get()??this.stores.matchStores.get(s)?.get(),this.invalidate=s=>{const r=n=>s?.filter?.(n)??!0?{...n,invalid:!0,...s?.forcePending||n.status==="error"||n.status==="notFound"?{status:"pending",error:void 0}:void 0}:n;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:s?.sync})},this.getParsedLocationHref=s=>s.publicHref||"/",this.resolveRedirect=s=>{const r=s.headers.get("Location");if(!s.options.href||s.options._builtLocation){const n=s.options._builtLocation??this.buildLocation(s.options),o=this.getParsedLocationHref(n);s.options.href=o,s.headers.set("Location",o)}else if(r)try{const n=new URL(r);if(this.origin&&n.origin===this.origin){const o=n.pathname+n.search+n.hash;s.options.href=o,s.headers.set("Location",o)}}catch{}if(s.options.href&&!s.options._builtLocation&&ps(s.options.href,this.protocolAllowlist))throw new Error(process.env.NODE_ENV!=="production"?`Redirect blocked: unsafe protocol in href "${s.options.href}". Allowed protocols: ${Array.from(this.protocolAllowlist).join(", ")}.`:"Redirect blocked: unsafe protocol");return s.headers.get("Location")||s.headers.set("Location",s.options.href),s},this.clearCache=s=>{const r=s?.filter;r!==void 0?this.stores.setCached(this.stores.cachedMatches.get().filter(n=>!r(n))):this.stores.setCached([])},this.clearExpiredCache=()=>{const s=Date.now(),r=n=>{const o=this.looseRoutesById[n.routeId];if(!o.options.loader)return!0;const i=(n.preload?o.options.preloadGcTime??this.options.defaultPreloadGcTime:o.options.gcTime??this.options.defaultGcTime)??300*1e3;return n.status==="error"?!0:s-n.updatedAt>=i};this.clearCache({filter:r})},this.loadRouteChunk=$t,this.preloadRoute=async s=>{const r=s._builtLocation??this.buildLocation(s);let n=this.matchRoutes(r,{throwOnError:!0,preload:!0,dest:s});const o=new Set([...this.stores.matchesId.get(),...this.stores.pendingIds.get()]),i=new Set([...o,...this.stores.cachedIds.get()]),c=n.filter(l=>!i.has(l.id));if(c.length){const l=this.stores.cachedMatches.get();this.stores.setCached([...l,...c])}try{return n=await Gr({router:this,matches:n,location:r,preload:!0,updateMatch:(l,d)=>{o.has(l)?n=n.map(f=>f.id===l?d(f):f):this.updateMatch(l,d)}}),n}catch(l){if(Se(l))return l.options.reloadDocument?void 0:await this.preloadRoute({...l.options,_fromLocation:r});ge(l)||console.error(l);return}},this.matchRoute=(s,r)=>{const n={...s,to:s.to?this.resolvePathWithBase(s.from||"",s.to):void 0,params:s.params||{},leaveParams:!0},o=this.buildLocation(n);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=za(o.pathname,r?.caseSensitive??!1,r?.fuzzy??!1,i.pathname,this.processedTree);return!c||s.params&&!st(c.rawParams,s.params,{partial:!0})?!1:r?.includeSearch??!0?st(i.search,o.search,{partial:!0})?c.rawParams:!1:c.rawParams},this.hasNotFoundMatch=()=>this.stores.matches.get().some(s=>s.status==="notFound"||s.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??ti,parseSearch:e.parseSearch??ei,protocolAllowlist:e.protocolAllowlist??Ia}),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:s}){this.routesById=e,this.routesByPath=t,this.processedTree=s;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=Xn(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 s=this.getMatchedRoutes(e.pathname),{foundRoute:r,routeParams:n}=s;let{matchedRoutes:o}=s,i=!1;(r?r.path!=="/"&&n["**"]:Fe(e.pathname))&&(this.options.notFoundRoute?o=[...o,this.options.notFoundRoute]:i=!0);const c=i?Ri(this.options.notFoundMode,o):void 0,l=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 u=o[f],h=l[f-1];let m,p,g;{const F=h?.search??e.search,ee=h?._strictSearch??void 0;try{const V=ls(u.options.validateSearch,{...F})??void 0;m={...F,...V},p={...ee,...V},g=void 0}catch(V){let Z=V;if(V instanceof bs||(Z=new bs(V.message,{cause:V})),t?.throwOnError)throw Z;m=F,p={},g=Z}}const x=u.options.loaderDeps?.({search:m})??"",b=x?JSON.stringify(x):"",{interpolatedPath:y,usedParams:S}=zr({path:u.fullPath,params:n,decoder:this.pathParamsDecoder,server:this.isServer}),w=u.id+y+b,N=this.getMatch(w),j=d.get(u.id),_=N?._strictParams??S;let R;if(!N)try{en(u,_)}catch(F){if(ge(F)||Se(F)?R=F:R=new bi(F.message,{cause:F}),t?.throwOnError)throw R}Object.assign(n,_);const E=j?"stay":"enter";let D;if(N)D={...N,cause:E,params:j?.params??n,_strictParams:_,search:Ye(j?j.search:N.search,m),_strictSearch:p};else{const F=u.options.loader||u.options.beforeLoad||u.lazyFn||ro(u)?"pending":"success";D={id:w,ssr:u.options.ssr,index:f,routeId:u.id,params:j?.params??n,_strictParams:_,pathname:y,updatedAt:Date.now(),search:j?Ye(j.search,m):m,_strictSearch:p,searchError:void 0,status:F,isFetching:!1,error:void 0,paramsError:R,__routeContext:void 0,_nonReactive:{loadPromise:yt()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:E,loaderDeps:j?Qe(j.loaderDeps,x):x,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:u.options.staticData||{},fullPath:u.fullPath}}t?.preload||(D.globalNotFound=c===u.id),D.searchError=g;const L=this.getParentContext(h);D.context={...L,...D.__routeContext,...D.__beforeLoadContext},l[f]=D}for(let f=0;f<l.length;f++){const u=l[f],h=this.looseRoutesById[u.routeId],m=this.getMatch(u.id),p=d.get(u.routeId);if(u.params=p?Ye(p.params,n):n,!m){const g=l[f-1],x=this.getParentContext(g);if(h.options.context){const b={deps:u.loaderDeps,params:u.params,context:x??{},location:e,navigate:y=>this.navigate({...y,_fromLocation:e}),buildLocation:this.buildLocation,cause:u.cause,abortController:u.abortController,preload:!!u.preload,matches:l,routeId:h.id};u.__routeContext=h.options.context(b)??void 0}u.context={...x,...u.__routeContext,...u.__beforeLoadContext}}}return l}matchRoutesLightweight(e){const t=Dt(this.stores.matchesId.get()),s=this.lightweightCache.get(e);if(s&&s[0]===t)return s[1];const{matchedRoutes:r,routeParams:n}=this.getMatchedRoutes(e.pathname),o=Dt(r),i={...e.search};for(const u of r)try{Object.assign(i,ls(u.options.validateSearch,i))}catch{}const c=t&&this.stores.matchStores.get(t)?.get(),l=c&&c.routeId===o.id&&c.pathname===e.pathname;let d;if(l)d=c.params;else{const u=Object.assign(Object.create(null),n);for(const h of r)try{en(h,u)}catch{}d=u}const f={matchedRoutes:r,fullPath:o.fullPath,search:i,params:d};return this.lightweightCache.set(e,[t,f]),f}},bs=class extends Error{},bi=class extends Error{};const Zr=e=>e.endsWith("/")&&e.length>1?e.slice(0,-1):e;function Qr(e,t){return Zr(e)===Zr(t)}function yi(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:e,matches:[],statusCode:200}}function ls(e,t){if(e==null)return{};if("~standard"in e){const s=e["~standard"].validate(t);if(s instanceof Promise)throw new bs("Async validation not supported");if(s.issues)throw new bs(JSON.stringify(s.issues,void 0,2),{cause:s});return s.value}return"parse"in e?e.parse(t):typeof e=="function"?e(t):{}}function vi({pathname:e,routesById:t,processedTree:s}){const r=Object.create(null),n=Fe(e);let o;const i=Va(n,s,!0);return i&&(o=i.route,Object.assign(r,i.rawParams)),{matchedRoutes:i?.branch||[t.__root__],routeParams:r,foundRoute:o}}function wi({search:e,dest:t,destRoutes:s,_includeValidateSearch:r}){return Si(s)(e,t,r??!1)}function Si(e){let t,s;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 l=({search:d,next:f})=>{const u=f(i.preSearchFilters?i.preSearchFilters.reduce((h,m)=>m(h),d):d);return i.postSearchFilters?i.postSearchFilters.reduce((h,m)=>m(h),u):u};r.push(l)}const c=i.validateSearch;if(c){const l=({search:d,next:f,meta:u})=>{const h=f(d);if(s)try{const m=ls(c,h);if(u&&m)for(const p in m)p in h||(u.defaulted||=new Map).set(p,m[p]);return{...h,...m}}catch{}return h};r.push(l)}}const n=(o,i,c)=>{if(o>=r.length){if(!t.search)return{};if(t.search===!0)return i;const d=Ze(t.search,i);return c&&(c.explicit=d),d}const l=(d,f)=>{if(f){const u=c||{};return{search:n(o+1,d,u),meta:u}}return n(o+1,d,c)};return r[o]({search:i,next:l,meta:c})};return function(i,c,l){return t=c,s=l,n(0,i)}}function Ri(e,t){if(e!=="root")for(let s=t.length-1;s>=0;s--){const r=t[s];if(r.children)return r.id}return rt}function en(e,t){const s=e.options.params?.parse??e.options.parseParams;if(s){const r=s(t);if(r===!1)throw new Error("Route params.parse returned false for a matched route");Object.assign(t,r)}}function ji(){try{return sessionStorage}catch{return}}const Ni="tsr-scroll-restoration-v1_3",oo=ji();function Ci(){try{return JSON.parse(oo?.getItem("tsr-scroll-restoration-v1_3")||"{}")}catch{return{}}}function _i(){try{oo?.setItem(Ni,JSON.stringify(mt))}catch{process.env.NODE_ENV!=="production"&&console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}const mt=Ci(),tn="data-scroll-restoration-id",ki=e=>e.state.__TSR_key||e.href;function Ei(e){const t=e.getAttribute(tn);if(t)return`[${tn}="${t}"]`;let s="",r=e,n;for(;n=r.parentNode;){let o=1,i=r;for(;i=i.previousElementSibling;)o++;const c=`${r.localName}:nth-child(${o})`;s=s?`${c} > ${s}`:c,r=n}return s}let Jt=!1;const pt="window";function nr(e){try{return typeof e=="function"?e():document.querySelector(e)}catch{}}function sn(e){const t=[];for(const s of e){if(s===pt)continue;const r=nr(s);r&&t.push(r)}return t}function Pi(e,t){const s=e.options.scrollRestoration,r=e._scroll;s&&(r.restoring=!0);const n=e.options.getScrollRestorationKey||ki,o=new Map,i=(d,f,u)=>{const h=o.get(d)||{};h.scrollX=f,h.scrollY=u,o.set(d,h)},c=d=>{if(!(Jt||!r.restoring))if(d.target===document)i(pt,scrollX,scrollY);else{const f=d.target;i(f,f.scrollLeft,f.scrollTop)}},l=d=>{if(!r.restoring)return;const f=mt[d]||={};for(const[u,h]of o)u===pt?f[pt]=h:u.isConnected&&(f[Ei(u)]=h)};s&&!r.restoration&&(r.restoration=!0,Jt=!1,history.scrollRestoration="manual",document.addEventListener("scroll",c,!0),e.subscribe("onBeforeLoad",d=>{d.fromLocation&&l(n(d.fromLocation)),o.clear()}),addEventListener("pagehide",()=>{l(n(e.stores.resolvedLocation.get()??e.stores.location.get())),_i()})),!r.reset&&(r.reset=!0,e.subscribe("onRendered",d=>{const f=e.options.scrollRestorationBehavior,u=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 p=n(d.toLocation),g=d.fromLocation&&n(d.fromLocation);if(r.restoring&&g&&g!==p){const x=mt[g];if(x){let b=mt[p];for(const y in x){if(y===pt){if(h)continue}else{const S=nr(y);if(!S||h&&u&&(m??=sn(u),m.includes(S)))continue}b||(b=mt[p]={}),b[y]??=x[y]}}}Jt=!0;try{const x=d.toLocation.hash,b=d.toLocation.state.__hashScrollIntoViewOptions??!0;let y=!1;if(h){const S=rr.get(d.toLocation),w=x&&b&&(S==="PUSH"||S==="REPLACE"),N=r.restoring?mt[p]:void 0;if(N)for(const j in N){const{scrollX:_,scrollY:R}=N[j];if(j===pt){if(w)continue;scrollTo({top:R,left:_,behavior:f}),y=!0}else{const E=nr(j);E&&(E.scrollLeft=_,E.scrollTop=R)}}if(!y&&!x){const j={top:0,left:0,behavior:f};if(scrollTo(j),u){m??=sn(u);for(const _ of m)_.scrollTo(j)}}}!y&&x&&b&&document.getElementById(x)?.scrollIntoView(b)}finally{Jt=!1}}))}const Ti="Error preloading route! ☝️";var ao=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 s=this.options,r=!s?.path&&!s?.id;if(this.parentRoute=this.options.getParentRoute?.(),r)this._path=rt;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.");Ue()}let n=r?rt:s?.path;n&&n!=="/"&&(n=Zn(n));const o=s?.id||n;let i=r?rt:is([this.parentRoute.id==="__root__"?"":this.parentRoute.id,o]);n==="__root__"&&(n="/"),i!=="__root__"&&(i=is(["/",i]));const c=i==="__root__"?"/":is([this.parentRoute.fullPath,n]);this._path=n,this._id=i,this._fullPath=c,this._to=Fe(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=>ni({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.")}},Ai=class extends ao{constructor(e){super(e)}};function xr(e){const t=e.errorComponent??br;return a.jsx(Oi,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:s,reset:r})=>s?B.createElement(t,{error:s,reset:r}):e.children})}var Oi=class extends B.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e,t){const s=e.getResetKey();return t.error&&t.resetKey!==s?{resetKey:s,error:null}:{resetKey:s}}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 br({error:e}){const[t,s]=B.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:()=>s(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 Li({children:e,fallback:t=null}){return io()?a.jsx(k.Fragment,{children:e}):a.jsx(k.Fragment,{children:t})}function io(){return k.useSyncExternalStore(Mi,()=>!0,()=>!1)}function Mi(){return()=>{}}var co=B.createContext(null);function Ce(e){const t=B.useContext(co);return process.env.NODE_ENV!=="production"&&(t||console.warn("Warning: useRouter must be used inside a <RouterProvider> component!")),t}var Es=B.createContext(void 0),Ii=B.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 Di({update:e,notify:t,unwatched:s}){return{link:r,unlink:n,propagate:o,checkDirty:i,shallowPropagate:c};function r(d,f,u){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=u,f.depsTail=m;return}const p=d.subsTail;if(p!==void 0&&p.version===u&&p.sub===f)return;const g=f.depsTail=d.subsTail={version:u,dep:d,sub:f,prevDep:h,nextDep:m,prevSub:p,nextSub:void 0};m!==void 0&&(m.prevDep=g),h!==void 0?h.nextDep=g:f.deps=g,p!==void 0?p.nextSub=g:d.subs=g}function n(d,f=d.sub){const u=d.dep,h=d.prevDep,m=d.nextDep,p=d.nextSub,g=d.prevSub;return m!==void 0?m.prevDep=h:f.depsTail=h,h!==void 0?h.nextDep=m:f.deps=m,p!==void 0?p.prevSub=g:u.subsTail=g,g!==void 0?g.nextSub=p:(u.subs=p)===void 0&&s(u),m}function o(d){let f=d.nextSub,u;e:do{const h=d.sub;let m=h.flags;if(m&60?m&12?m&4?!(m&48)&&l(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 p=h.subs;if(p!==void 0){const g=(d=p).nextSub;g!==void 0&&(u={value:f,prev:u},f=g);continue}}if((d=f)!==void 0){f=d.nextSub;continue}for(;u!==void 0;)if(d=u.value,u=u.prev,d!==void 0){f=d.nextSub;continue e}break}while(!0)}function i(d,f){let u,h=0,m=!1;e:do{const p=d.dep,g=p.flags;if(f.flags&16)m=!0;else if((g&17)===17){if(e(p)){const x=p.subs;x.nextSub!==void 0&&c(x),m=!0}}else if((g&33)===33){(d.nextSub!==void 0||d.prevSub!==void 0)&&(u={value:d,prev:u}),d=p.deps,f=p,++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=u.value,u=u.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,u=f.flags;(u&48)===32&&(f.flags=u|16,(u&6)===2&&t(f))}while((d=d.nextSub)!==void 0)}function l(d,f){let u=f.depsTail;for(;u!==void 0;){if(u===d)return!0;u=u.prevDep}return!1}}function Fi(e,t,s){const r=typeof e=="object",n=r?e:void 0;return{next:(r?e.next:e)?.bind(n),error:(r?e.error:t)?.bind(n),complete:(r?e.complete:s)?.bind(n)}}const or=[];let ds=0;const{link:rn,unlink:Ui,propagate:$i,checkDirty:lo,shallowPropagate:nn}=Di({update(e){return e._update()},notify(e){or[ar++]=e,e.flags&=~se.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=se.Mutable|se.Dirty,ys(e))}});let Xt=0,ar=0,Oe,ir=0;function uo(e){try{++ir,e()}finally{--ir||fo()}}function ys(e){const t=e.depsTail;let s=t!==void 0?t.nextDep:e.deps;for(;s!==void 0;)s=Ui(s,e)}function fo(){if(!(ir>0)){for(;Xt<ar;){const e=or[Xt];or[Xt++]=void 0,e.notify()}Xt=0,ar=0}}function on(e,t){const s=typeof e=="function",r=e,n={_snapshot:s?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:s?se.None:se.Mutable,get(){return Oe!==void 0&&rn(n,Oe,ds),n._snapshot},subscribe(o){const i=Fi(o),c={current:!1},l=Bi(()=>{n.get(),c.current?i.next?.(n._snapshot):c.current=!0});return{unsubscribe:()=>{l.stop()}}},_update(o){const i=Oe,c=t?.compare??Object.is;if(s)Oe=n,++ds,n.depsTail=void 0;else if(o===void 0)return!1;s&&(n.flags=se.Mutable|se.RecursedCheck);try{const l=n._snapshot,d=typeof o=="function"?o(l):o===void 0&&s?r(l):o;return l===void 0||!c(l,d)?(n._snapshot=d,!0):!1}finally{Oe=i,s&&(n.flags&=~se.RecursedCheck),ys(n)}}};return s?(n.flags=se.Mutable|se.Dirty,n.get=function(){const o=n.flags;if(o&se.Dirty||o&se.Pending&&lo(n.deps,n)){if(n._update()){const i=n.subs;i!==void 0&&nn(i)}}else o&se.Pending&&(n.flags=o&~se.Pending);return Oe!==void 0&&rn(n,Oe,ds),n._snapshot}):n.set=function(o){if(n._update(o)){const i=n.subs;i!==void 0&&($i(i),nn(i),fo())}},n}function Bi(e){const t=()=>{const r=Oe;Oe=s,++ds,s.depsTail=void 0,s.flags=se.Watching|se.RecursedCheck;try{return e()}finally{Oe=r,s.flags&=~se.RecursedCheck,ys(s)}},s={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&&lo(this.deps,this)?t():this.flags=se.Watching},stop(){this.flags=se.None,this.depsTail=void 0,ys(this)}};return t(),s}var Zt={exports:{}},zs={},Qt={exports:{}},Vs={};var an;function zi(){if(an)return Vs;an=1;var e=k;function t(u,h){return u===h&&(u!==0||1/u===1/h)||u!==u&&h!==h}var s=typeof Object.is=="function"?Object.is:t,r=e.useState,n=e.useEffect,o=e.useLayoutEffect,i=e.useDebugValue;function c(u,h){var m=h(),p=r({inst:{value:m,getSnapshot:h}}),g=p[0].inst,x=p[1];return o(function(){g.value=m,g.getSnapshot=h,l(g)&&x({inst:g})},[u,m,h]),n(function(){return l(g)&&x({inst:g}),u(function(){l(g)&&x({inst:g})})},[u]),i(m),m}function l(u){var h=u.getSnapshot;u=u.value;try{var m=h();return!s(u,m)}catch{return!0}}function d(u,h){return h()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:c;return Vs.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,Vs}var Ws={};var cn;function Vi(){return cn||(cn=1,process.env.NODE_ENV!=="production"&&(function(){function e(m,p){return m===p&&(m!==0||1/m===1/p)||m!==m&&p!==p}function t(m,p){f||n.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 g=p();if(!u){var x=p();o(g,x)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),u=!0)}x=i({inst:{value:g,getSnapshot:p}});var b=x[0].inst,y=x[1];return l(function(){b.value=g,b.getSnapshot=p,s(b)&&y({inst:b})},[m,g,p]),c(function(){return s(b)&&y({inst:b}),m(function(){s(b)&&y({inst:b})})},[m]),d(g),g}function s(m){var p=m.getSnapshot;m=m.value;try{var g=p();return!o(m,g)}catch{return!0}}function r(m,p){return p()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var n=k,o=typeof Object.is=="function"?Object.is:e,i=n.useState,c=n.useEffect,l=n.useLayoutEffect,d=n.useDebugValue,f=!1,u=!1,h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;Ws.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:h,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Ws}var ln;function ho(){return ln||(ln=1,process.env.NODE_ENV==="production"?Qt.exports=zi():Qt.exports=Vi()),Qt.exports}var dn;function Wi(){if(dn)return zs;dn=1;var e=k,t=ho();function s(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var r=typeof Object.is=="function"?Object.is:s,n=t.useSyncExternalStore,o=e.useRef,i=e.useEffect,c=e.useMemo,l=e.useDebugValue;return zs.useSyncExternalStoreWithSelector=function(d,f,u,h,m){var p=o(null);if(p.current===null){var g={hasValue:!1,value:null};p.current=g}else g=p.current;p=c(function(){function b(j){if(!y){if(y=!0,S=j,j=h(j),m!==void 0&&g.hasValue){var _=g.value;if(m(_,j))return w=_}return w=j}if(_=w,r(S,j))return _;var R=h(j);return m!==void 0&&m(_,R)?(S=j,_):(S=j,w=R)}var y=!1,S,w,N=u===void 0?null:u;return[function(){return b(f())},N===null?void 0:function(){return b(N())}]},[f,u,h,m]);var x=n(d,p[0],p[1]);return i(function(){g.hasValue=!0,g.value=x},[x]),l(x),x},zs}var Hs={};var un;function Hi(){return un||(un=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=k,s=ho(),r=typeof Object.is=="function"?Object.is:e,n=s.useSyncExternalStore,o=t.useRef,i=t.useEffect,c=t.useMemo,l=t.useDebugValue;Hs.useSyncExternalStoreWithSelector=function(d,f,u,h,m){var p=o(null);if(p.current===null){var g={hasValue:!1,value:null};p.current=g}else g=p.current;p=c(function(){function b(j){if(!y){if(y=!0,S=j,j=h(j),m!==void 0&&g.hasValue){var _=g.value;if(m(_,j))return w=_}return w=j}if(_=w,r(S,j))return _;var R=h(j);return m!==void 0&&m(_,R)?(S=j,_):(S=j,w=R)}var y=!1,S,w,N=u===void 0?null:u;return[function(){return b(f())},N===null?void 0:function(){return b(N())}]},[f,u,h,m]);var x=n(d,p[0],p[1]);return i(function(){g.hasValue=!0,g.value=x},[x]),l(x),x},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Hs}var fn;function qi(){return fn||(fn=1,process.env.NODE_ENV==="production"?Zt.exports=Wi():Zt.exports=Hi()),Zt.exports}var Gi=qi();function Ki(e,t){return e===t}function je(e,t,s=Ki){const r=k.useCallback(i=>{if(!e)return()=>{};const{unsubscribe:c}=e.subscribe(i);return c},[e]),n=k.useCallback(()=>e?.get(),[e]);return Gi.useSyncExternalStoreWithSelector(r,n,n,t,s)}var qs={get(){},subscribe(){return{unsubscribe(){}}}};function Yi(e,t){const s=B.useRef();return r=>{const n=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?s.current=Qe(s.current,n):n}}function dt(e){const t=Ce(),s=B.useContext(e.from?Ii:Es),r=e.from?t.stores.getRouteMatchStore(e.from):t.stores.matchStores.get(s),n=Yi(e,t),o=je(r??qs,i=>i?n(i):qs);if(o!==qs)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!"}`);Ue()}}function mo(e){return dt({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function po(e){const{select:t,...s}=e;return dt({...s,select:r=>t?t(r.loaderDeps):r.loaderDeps})}function go(e){return dt({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const s=e.strict===!1?t.params:t._strictParams;return e.select?e.select(s):s}})}function xo(e){return dt({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function bo(e){const t=Ce();return B.useCallback(s=>t.navigate({...s,from:s.from??e?.from}),[e?.from,t])}function yo(e){return dt({...e,select:t=>e.select?e.select(t.context):t.context})}function Ji(e,t){const s=Ce(),r=Ta(t),{activeProps:n,inactiveProps:o,activeOptions:i,to:c,preload:l,preloadDelay:d,preloadIntentProximity:f,hashScrollIntoView:u,replace:h,startTransition:m,resetScroll:p,viewTransition:g,children:x,target:b,disabled:y,style:S,className:w,onClick:N,onBlur:j,onFocus:_,onMouseEnter:R,onMouseLeave:E,onTouchStart:D,ignoreBlocker:L,params:F,search:ee,hash:V,state:Z,mask:Q,reloadDocument:Y,unsafeRelative:de,from:fe,_fromLocation:T,...C}=e,U=io(),W=B.useMemo(()=>e,[s,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),q=je(s.stores.location,te=>te,(te,we)=>te.href===we.href),M=B.useMemo(()=>{const te={_fromLocation:q,...W};return s.buildLocation(te)},[s,q,W]),I=M.maskedLocation?M.maskedLocation.publicHref:M.publicHref,$=M.maskedLocation?M.maskedLocation.external:M.external,J=B.useMemo(()=>sc(I,$,s.history,y),[y,$,I,s.history]),G=B.useMemo(()=>{if(J?.external){if(ps(J.href,s.protocolAllowlist)){process.env.NODE_ENV!=="production"&&console.warn(`Blocked Link with dangerous protocol: ${J.href}`);return}return J.href}if(!rc(c)&&!(typeof c!="string"||c.indexOf(":")===-1))try{if(new URL(c),ps(c,s.protocolAllowlist)){process.env.NODE_ENV!=="production"&&console.warn(`Blocked Link with dangerous protocol: ${c}`);return}return c}catch{}},[c,J,s.protocolAllowlist]),ue=B.useMemo(()=>{if(G)return!1;if(i?.exact){if(!Ya(q.pathname,M.pathname,s.basepath))return!1}else{const te=gs(q.pathname,s.basepath),we=gs(M.pathname,s.basepath);if(!(te.startsWith(we)&&(te.length===we.length||te[we.length]==="/")))return!1}return(i?.includeSearch??!0)&&!st(q.search,M.search,{partial:!i?.exact,ignoreUndefined:!i?.explicitUndefined})?!1:i?.includeHash?U&&q.hash===M.hash:!0},[i?.exact,i?.explicitUndefined,i?.includeHash,i?.includeSearch,q,G,U,M.hash,M.pathname,M.search,s.basepath]),be=ue?Ze(n,{})??Xi:Gs,ne=ue?Gs:Ze(o,{})??Gs,Me=[w,be.className,ne.className].filter(Boolean).join(" "),_e=(S||be.style||ne.style)&&{...S,...be.style,...ne.style},[ke,z]=B.useState(!1),me=B.useRef(!1),ye=e.reloadDocument||G?!1:l??s.options.defaultPreload,Ee=d??s.options.defaultPreloadDelay??0,Te=B.useCallback(()=>{s.preloadRoute({...W,_builtLocation:M}).catch(te=>{console.warn(te),console.warn(Ti)})},[s,W,M]);Pa(r,B.useCallback(te=>{te?.isIntersecting&&Te()},[Te]),tc,{disabled:!!y||ye!=="viewport"}),B.useEffect(()=>{me.current||!y&&ye==="render"&&(Te(),me.current=!0)},[y,Te,ye]);const Ls=te=>{const we=te.currentTarget.getAttribute("target"),Ke=b!==void 0?b:we;if(!y&&!nc(te)&&!te.defaultPrevented&&(!Ke||Ke==="_self")&&te.button===0){te.preventDefault(),Na.flushSync(()=>{z(!0)});const ja=s.subscribe("onResolved",()=>{ja(),z(!1)});s.navigate({...W,replace:h,resetScroll:p,hashScrollIntoView:u,startTransition:m,viewTransition:g,ignoreBlocker:L})}};if(G)return{...C,ref:r,href:G,...x&&{children:x},...b&&{target:b},...y&&{disabled:y},...S&&{style:S},...w&&{className:w},...N&&{onClick:N},...j&&{onBlur:j},..._&&{onFocus:_},...R&&{onMouseEnter:R},...E&&{onMouseLeave:E},...D&&{onTouchStart:D}};const $e=te=>{if(y||ye!=="intent")return;if(!Ee){Te();return}const we=te.currentTarget;if(At.has(we))return;const Ke=setTimeout(()=>{At.delete(we),Te()},Ee);At.set(we,Ke)},Ra=te=>{y||ye!=="intent"||Te()},Tr=te=>{if(y||!ye||!Ee)return;const we=te.currentTarget,Ke=At.get(we);Ke&&(clearTimeout(Ke),At.delete(we))};return{...C,...be,...ne,href:J?.href,ref:r,onClick:ft([N,Ls]),onBlur:ft([j,Tr]),onFocus:ft([_,$e]),onMouseEnter:ft([R,$e]),onMouseLeave:ft([E,Tr]),onTouchStart:ft([D,Ra]),disabled:!!y,target:b,..._e&&{style:_e},...Me&&{className:Me},...y&&Zi,...ue&&Qi,...U&&ke&&ec}}var Gs={},Xi={className:"active"},Zi={role:"link","aria-disabled":!0},Qi={"data-status":"active","aria-current":"page"},ec={"data-transitioning":"transitioning"},At=new WeakMap,tc={rootMargin:"100px"},ft=e=>t=>{for(const s of e)if(s){if(t.defaultPrevented)return;s(t)}};function sc(e,t,s,r){if(!r)return t?{href:e,external:!0}:{href:s.createHref(e)||"/",external:!1}}function rc(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var vs=B.forwardRef((e,t)=>{const{_asChild:s,...r}=e,{type:n,...o}=Ji(r,t),i=typeof r.children=="function"?r.children({isActive:o["data-status"]==="active"}):r.children;if(!s){const{disabled:c,...l}=o;return B.createElement("a",l,i)}return B.createElement(s,o,i)});function nc(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var oc=class extends ao{constructor(e){super(e),this.useMatch=t=>dt({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>yo({...t,from:this.id}),this.useSearch=t=>xo({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>go({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>po({...t,from:this.id}),this.useLoaderData=t=>mo({...t,from:this.id}),this.useNavigate=()=>bo({from:this.fullPath}),this.Link=k.forwardRef((t,s)=>a.jsx(vs,{ref:s,from:this.fullPath,...t}))}};function zt(e){return new oc(e)}var ac=class extends Ai{constructor(e){super(e),this.useMatch=t=>dt({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>yo({...t,from:this.id}),this.useSearch=t=>xo({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>go({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>po({...t,from:this.id}),this.useLoaderData=t=>mo({...t,from:this.id}),this.useNavigate=()=>bo({from:this.fullPath}),this.Link=k.forwardRef((t,s)=>a.jsx(vs,{ref:s,from:this.fullPath,...t}))}};function ic(e){return new ac(e)}function cc(e){const t=Ce(),s=`not-found-${je(t.stores.location,r=>r.pathname)}-${je(t.stores.status,r=>r)}`;return a.jsx(xr,{getResetKey:()=>s,onCatch:(r,n)=>{if(ge(r))e.onCatch?.(r,n);else throw r},errorComponent:({error:r})=>{if(ge(r))return e.fallback?.(r);throw r},children:e.children})}function lc(){return a.jsx("p",{children:"Not Found"})}function gt(e){return a.jsx(a.Fragment,{children:e.children})}function vo(e,t,s){return t.options.notFoundComponent?a.jsx(t.options.notFoundComponent,{...s}):e.options.defaultNotFoundComponent?a.jsx(e.options.defaultNotFoundComponent,{...s}):(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(lc,{}))}function dc(e){return null}function uc(){return dc(Ce()),null}var fc=(e,t)=>e.routeId===t.routeId&&e._displayPending===t._displayPending,hc=(e,t)=>e[0]===t[0]&&e[1]===t[1],wo=B.memo(function({matchId:t}){const s=Ce(),r=s.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!`);Ue()}const n=je(s.stores.loadedAt,i=>i),o=je(r,i=>i,fc);return a.jsx(mc,{router:s,matchId:t,resetKey:n,matchState:B.useMemo(()=>{const i=o.routeId,c=s.routesById[i].parentRoute?.id;return{routeId:i,ssr:o.ssr,_displayPending:o._displayPending,parentRouteId:c}},[o._displayPending,o.routeId,o.ssr,s.routesById])})});function mc({router:e,matchId:t,resetKey:s,matchState:r}){const n=e.routesById[r.routeId],o=n.options.pendingComponent??e.options.defaultPendingComponent,i=o?a.jsx(o,{}):null,c=n.options.errorComponent??e.options.defaultErrorComponent,l=n.options.onCatch??e.options.defaultOnCatch,d=n.isRoot?n.options.notFoundComponent??e.options.notFoundRoute?.options.component:n.options.notFoundComponent,f=r.ssr===!1||r.ssr==="data-only",u=(!n.isRoot||n.options.wrapInSuspense||f)&&(n.options.wrapInSuspense??o??(n.options.errorComponent?.preload||f))?B.Suspense:gt,h=c?xr:gt,m=d?cc:gt;return a.jsxs(n.isRoot?n.options.shellComponent??gt:gt,{children:[a.jsx(Es.Provider,{value:t,children:a.jsx(u,{fallback:i,children:a.jsx(h,{getResetKey:()=>s,errorComponent:c||br,onCatch:(p,g)=>{if(ge(p))throw p.routeId??=r.routeId,p;process.env.NODE_ENV!=="production"&&console.warn(`Warning: Error in route match: ${t}`),l?.(p,g)},children:a.jsx(m,{fallback:p=>{if(p.routeId??=r.routeId,!d||p.routeId&&p.routeId!==r.routeId||!p.routeId&&!n.isRoot)throw p;return B.createElement(d,p)},children:f||r._displayPending?a.jsx(Li,{fallback:i,children:a.jsx(hn,{matchId:t})}):a.jsx(hn,{matchId:t})})})})}),r.parentRouteId===rt?a.jsxs(a.Fragment,{children:[a.jsx(pc,{}),e.options.scrollRestoration&&Hn?a.jsx(uc,{}):null]}):null]})}function pc(){const e=Ce(),t=B.useRef();return It(()=>{const s=e.stores.resolvedLocation.get(),r=t.current;s&&(!r||r.href!==s.href)&&e.emit({type:"onRendered",...xt(e.stores.location.get(),r??s)}),t.current=s},[je(e.stores.resolvedLocation,s=>s?.state.__TSR_key),e]),null}var hn=B.memo(function({matchId:t}){const s=Ce(),r=(f,u)=>s.getMatch(f.id)?._nonReactive[u]??f._nonReactive[u],n=s.stores.matchStores.get(t);if(!n){if(process.env.NODE_ENV!=="production")throw new Error(`Invariant failed: Could not find match for matchId "${t}". Please file an issue!`);Ue()}const o=je(n,f=>f),i=o.routeId,c=s.routesById[i],l=B.useMemo(()=>{const f=(s.routesById[i].options.remountDeps??s.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,s.options.defaultRemountDeps,s.routesById]),d=B.useMemo(()=>{const f=c.options.component??s.options.defaultComponent;return f?a.jsx(f,{},l):a.jsx(So,{})},[l,c.options.component,s.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??s.options.defaultPendingMinMs;if(f){const u=s.getMatch(o.id);if(u&&!u._nonReactive.minPendingPromise){const h=yt();u._nonReactive.minPendingPromise=h,setTimeout(()=>{h.resolve(),u._nonReactive.minPendingPromise=void 0},f)}}throw r(o,"loadPromise")}if(o.status==="notFound"){if(!ge(o.error)){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Expected a notFound error");Ue()}return vo(s,c,o.error)}if(o.status==="redirected"){if(!Se(o.error)){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Expected a redirect error");Ue()}throw r(o,"loadPromise")}if(o.status==="error")throw o.error;return d}),So=B.memo(function(){const t=Ce(),s=B.useContext(Es);let r,n=!1,o;{const d=s?t.stores.matchStores.get(s):void 0;[r,n]=je(d,f=>[f?.routeId,f?.globalNotFound??!1],hc),o=je(t.stores.matchesId,f=>f[f.findIndex(u=>u===s)+1])}const i=r?t.routesById[r]:void 0,c=t.options.defaultPendingComponent?a.jsx(t.options.defaultPendingComponent,{}):null;if(n){if(!i){if(process.env.NODE_ENV!=="production")throw new Error("Invariant failed: Could not resolve route for Outlet render");Ue()}return vo(t,i,void 0)}if(!o)return null;const l=a.jsx(wo,{matchId:o});return r===rt?a.jsx(B.Suspense,{fallback:c,children:l}):l});function gc(){const e=Ce(),t=B.useRef({router:e,mounted:!1}),[s,r]=B.useState(!1),n=je(e.stores.isLoading,u=>u),o=je(e.stores.hasPending,u=>u),i=Ms(n),c=n||s||o,l=Ms(c),d=n||o,f=Ms(d);return e.startTransition=u=>{r(!0),B.startTransition(()=>{u(),r(!1)})},B.useEffect(()=>{const u=e.history.subscribe(e.load),h=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Fe(e.latestLocation.publicHref)!==Fe(h.publicHref)&&e.commitLocation({...h,replace:!0}),()=>{u()}},[e,e.history]),It(()=>{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]),It(()=>{i&&!n&&e.emit({type:"onLoad",...xt(e.stores.location.get(),e.stores.resolvedLocation.get())})},[i,e,n]),It(()=>{f&&!d&&e.emit({type:"onBeforeRouteMount",...xt(e.stores.location.get(),e.stores.resolvedLocation.get())})},[d,f,e]),It(()=>{if(l&&!c){const u=xt(e.stores.location.get(),e.stores.resolvedLocation.get());e.emit({type:"onResolved",...u}),uo(()=>{e.stores.status.set("idle"),e.stores.resolvedLocation.set(e.stores.location.get())})}},[c,l,e]),null}function xc(){const e=Ce(),t=e.routesById[rt].options.pendingComponent??e.options.defaultPendingComponent,s=t?a.jsx(t,{}):null,r=a.jsxs(typeof document<"u"&&e.ssr?gt:B.Suspense,{fallback:s,children:[a.jsx(gc,{}),a.jsx(bc,{})]});return e.options.InnerWrap?a.jsx(e.options.InnerWrap,{children:r}):r}function bc(){const e=Ce(),t=je(e.stores.firstId,n=>n),s=je(e.stores.loadedAt,n=>n),r=t?a.jsx(wo,{matchId:t}):null;return a.jsx(Es.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:a.jsx(xr,{getResetKey:()=>s,errorComponent:br,onCatch:process.env.NODE_ENV!=="production"?n=>{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: ${n.message||n.toString()}`)}:void 0,children:r})})}var yc=e=>({createMutableStore:on,createReadonlyStore:on,batch:uo}),Ro=e=>new vc(e),vc=class extends xi{constructor(e){super(e,yc)}};function wc({router:e,children:t,...s}){Gn(s)&&e.update({...e.options,...s,context:{...e.options.context,...s.context}});const r=a.jsx(co.Provider,{value:e,children:t});return e.options.Wrap?a.jsx(e.options.Wrap,{children:r}):r}function Sc({router:e,...t}){return a.jsx(wc,{router:e,...t,children:a.jsx(xc,{})})}function jo(e,t){return function(){return e.apply(t,arguments)}}const{toString:Rc}=Object.prototype,{getPrototypeOf:vt}=Object,{iterator:Vt,toStringTag:No}=Symbol,ws=(({hasOwnProperty:e})=>(t,s)=>e.call(t,s))(Object.prototype),Bt=(e,t)=>{let s=e;const r=[];for(;s!=null&&s!==Object.prototype;){if(r.indexOf(s)!==-1)return!1;if(r.push(s),ws(s,t))return!0;s=vt(s)}return!1},jc=(e,t)=>e!=null&&Bt(e,t)?e[t]:void 0,yr=(e=>t=>{const s=Rc.call(t);return e[s]||(e[s]=s.slice(8,-1).toLowerCase())})(Object.create(null)),Pe=e=>(e=e.toLowerCase(),t=>yr(t)===e),Ps=e=>t=>typeof t===e,{isArray:it}=Array,wt=Ps("undefined");function jt(e){return e!==null&&!wt(e)&&e.constructor!==null&&!wt(e.constructor)&&Re(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Co=Pe("ArrayBuffer");function Nc(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Co(e.buffer),t}const Cc=Ps("string"),Re=Ps("function"),_o=Ps("number"),Nt=e=>e!==null&&typeof e=="object",_c=e=>e===!0||e===!1,us=e=>{if(!Nt(e))return!1;const t=vt(e);return(t===null||t===Object.prototype||vt(t)===null)&&!Bt(e,No)&&!Bt(e,Vt)},kc=e=>{if(!Nt(e)||jt(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},Ec=Pe("Date"),Pc=Pe("File"),Tc=e=>!!(e&&typeof e.uri<"u"),Ac=e=>e&&typeof e.getParts<"u",Oc=Pe("Blob"),Lc=Pe("FileList"),Mc=e=>Nt(e)&&Re(e.pipe);function Ic(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const mn=Ic(),pn=typeof mn.FormData<"u"?mn.FormData:void 0,Dc=e=>{if(!e)return!1;if(pn&&e instanceof pn)return!0;const t=vt(e);if(!t||t===Object.prototype||!Re(e.append))return!1;const s=yr(e);return s==="formdata"||s==="object"&&Re(e.toString)&&e.toString()==="[object FormData]"},Fc=Pe("URLSearchParams"),[Uc,$c,Bc,zc]=["ReadableStream","Request","Response","Headers"].map(Pe),Vc=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Wt(e,t,{allOwnKeys:s=!1}={}){if(e===null||typeof e>"u")return;let r,n;if(typeof e!="object"&&(e=[e]),it(e))for(r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else{if(jt(e))return;const o=s?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 ko(e,t){if(jt(e))return null;t=t.toLowerCase();const s=Object.keys(e);let r=s.length,n;for(;r-- >0;)if(n=s[r],t===n.toLowerCase())return n;return null}const tt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Eo=e=>!wt(e)&&e!==tt;function cr(...e){const{caseless:t,skipUndefined:s}=Eo(this)&&this||{},r={},n=(o,i)=>{if(i==="__proto__"||i==="constructor"||i==="prototype")return;const c=t&&typeof i=="string"&&ko(r,i)||i,l=ws(r,c)?r[c]:void 0;us(l)&&us(o)?r[c]=cr(l,o):us(o)?r[c]=cr({},o):it(o)?r[c]=o.slice():(!s||!wt(o))&&(r[c]=o)};for(let o=0,i=e.length;o<i;o++){const c=e[o];if(!c||jt(c)||(Wt(c,n),typeof c!="object"||it(c)))continue;const l=Object.getOwnPropertySymbols(c);for(let d=0;d<l.length;d++){const f=l[d];tl.call(c,f)&&n(c[f],f)}}return r}const Wc=(e,t,s,{allOwnKeys:r}={})=>(Wt(t,(n,o)=>{s&&Re(n)?Object.defineProperty(e,o,{__proto__:null,value:jo(n,s),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,o,{__proto__:null,value:n,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),Hc=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),qc=(e,t,s,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}),s&&Object.assign(e.prototype,s)},Gc=(e,t,s,r)=>{let n,o,i;const c={};if(t=t||{},e==null)return t;do{for(n=Object.getOwnPropertyNames(e),o=n.length;o-- >0;)i=n[o],(!r||r(i,e,t))&&!c[i]&&(t[i]=e[i],c[i]=!0);e=s!==!1&&vt(e)}while(e&&(!s||s(e,t))&&e!==Object.prototype);return t},Kc=(e,t,s)=>{e=String(e),(s===void 0||s>e.length)&&(s=e.length),s-=t.length;const r=e.indexOf(t,s);return r!==-1&&r===s},Yc=e=>{if(!e)return null;if(it(e))return e;let t=e.length;if(!_o(t))return null;const s=new Array(t);for(;t-- >0;)s[t]=e[t];return s},Jc=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&vt(Uint8Array)),Xc=(e,t)=>{const r=(e&&e[Vt]).call(e);let n;for(;(n=r.next())&&!n.done;){const o=n.value;t.call(e,o[0],o[1])}},Zc=(e,t)=>{let s;const r=[];for(;(s=e.exec(t))!==null;)r.push(s);return r},Qc=Pe("HTMLFormElement"),el=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(s,r,n){return r.toUpperCase()+n}),{propertyIsEnumerable:tl}=Object.prototype,sl=Pe("RegExp"),Po=(e,t)=>{const s=Object.getOwnPropertyDescriptors(e),r={};Wt(s,(n,o)=>{let i;(i=t(n,o,e))!==!1&&(r[o]=i||n)}),Object.defineProperties(e,r)},rl=e=>{Po(e,(t,s)=>{if(Re(e)&&["arguments","caller","callee"].includes(s))return!1;const r=e[s];if(Re(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+s+"'")})}})},nl=(e,t)=>{const s={},r=n=>{n.forEach(o=>{s[o]=!0})};return it(e)?r(e):r(String(e).split(t)),s},ol=()=>{},al=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function il(e){return!!(e&&Re(e.append)&&e[No]==="FormData"&&e[Vt])}const cl=e=>{const t=new WeakSet,s=r=>{if(Nt(r)){if(t.has(r))return;if(jt(r))return r;if(!("toJSON"in r)){t.add(r);const n=it(r)?[]:{};return Wt(r,(o,i)=>{const c=s(o);!wt(c)&&(n[i]=c)}),t.delete(r),n}}return r};return s(e)},ll=Pe("AsyncFunction"),dl=e=>e&&(Nt(e)||Re(e))&&Re(e.then)&&Re(e.catch),To=((e,t)=>e?setImmediate:t?((s,r)=>(tt.addEventListener("message",({source:n,data:o})=>{n===tt&&o===s&&r.length&&r.shift()()},!1),n=>{r.push(n),tt.postMessage(s,"*")}))(`axios@${Math.random()}`,[]):s=>setTimeout(s))(typeof setImmediate=="function",Re(tt.postMessage)),ul=typeof queueMicrotask<"u"?queueMicrotask.bind(tt):typeof process<"u"&&process.nextTick||To,Ao=e=>e!=null&&Re(e[Vt]),fl=e=>e!=null&&Bt(e,Vt)&&Ao(e),v={isArray:it,isArrayBuffer:Co,isBuffer:jt,isFormData:Dc,isArrayBufferView:Nc,isString:Cc,isNumber:_o,isBoolean:_c,isObject:Nt,isPlainObject:us,isEmptyObject:kc,isReadableStream:Uc,isRequest:$c,isResponse:Bc,isHeaders:zc,isUndefined:wt,isDate:Ec,isFile:Pc,isReactNativeBlob:Tc,isReactNative:Ac,isBlob:Oc,isRegExp:sl,isFunction:Re,isStream:Mc,isURLSearchParams:Fc,isTypedArray:Jc,isFileList:Lc,forEach:Wt,merge:cr,extend:Wc,trim:Vc,stripBOM:Hc,inherits:qc,toFlatObject:Gc,kindOf:yr,kindOfTest:Pe,endsWith:Kc,toArray:Yc,forEachEntry:Xc,matchAll:Zc,isHTMLForm:Qc,hasOwnProperty:ws,hasOwnProp:ws,hasOwnInPrototypeChain:Bt,getSafeProp:jc,reduceDescriptors:Po,freezeMethods:rl,toObjectSet:nl,toCamelCase:el,noop:ol,toFiniteNumber:al,findKey:ko,global:tt,isContextDefined:Eo,isSpecCompliantForm:il,toJSONObject:cl,isAsyncFn:ll,isThenable:dl,setImmediate:To,asap:ul,isIterable:Ao,isSafeIterable:fl},hl=v.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"]),ml=e=>{const t={};let s,r,n;return e&&e.split(`
|
|
7
|
+
`).forEach(function(i){n=i.indexOf(":"),s=i.substring(0,n).trim().toLowerCase(),r=i.substring(n+1).trim(),!(!s||t[s]&&hl[s])&&(s==="set-cookie"?t[s]?t[s].push(r):t[s]=[r]:t[s]=t[s]?t[s]+", "+r:r)}),t};function pl(e){let t=0,s=e.length;for(;t<s;){const r=e.charCodeAt(t);if(r!==9&&r!==32)break;t+=1}for(;s>t;){const r=e.charCodeAt(s-1);if(r!==9&&r!==32)break;s-=1}return t===0&&s===e.length?e:e.slice(t,s)}const gl=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),xl=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function vr(e,t){return v.isArray(e)?e.map(s=>vr(s,t)):pl(String(e).replace(t,""))}const bl=e=>vr(e,gl),yl=e=>vr(e,xl);function Oo(e){const t=Object.create(null);return v.forEach(e.toJSON(),(s,r)=>{t[r]=yl(s)}),t}const gn=Symbol("internals");function Ot(e){return e&&String(e).trim().toLowerCase()}function fs(e){return e===!1||e==null?e:v.isArray(e)?e.map(fs):bl(String(e))}function vl(e){const t=Object.create(null),s=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=s.exec(e);)t[r[1]]=r[2];return t}const wl=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Ks(e,t,s,r,n){if(v.isFunction(r))return r.call(this,t,s);if(n&&(t=s),!!v.isString(t)){if(v.isString(r))return t.indexOf(r)!==-1;if(v.isRegExp(r))return r.test(t)}}function Sl(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,s,r)=>s.toUpperCase()+r)}function Rl(e,t){const s=v.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+s,{__proto__:null,value:function(n,o,i){return this[r].call(this,t,n,o,i)},configurable:!0})})}let xe=class{constructor(t){t&&this.set(t)}set(t,s,r){const n=this;function o(c,l,d){const f=Ot(l);if(!f)return;const u=v.findKey(n,f);(!u||n[u]===void 0||d===!0||d===void 0&&n[u]!==!1)&&(n[u||l]=fs(c))}const i=(c,l)=>v.forEach(c,(d,f)=>o(d,f,l));if(v.isPlainObject(t)||t instanceof this.constructor)i(t,s);else if(v.isString(t)&&(t=t.trim())&&!wl(t))i(ml(t),s);else if(v.isObject(t)&&v.isSafeIterable(t)){let c=Object.create(null),l,d;for(const f of t){if(!v.isArray(f))throw new TypeError("Object iterator must return a key-value pair");d=f[0],v.hasOwnProp(c,d)?(l=c[d],c[d]=v.isArray(l)?[...l,f[1]]:[l,f[1]]):c[d]=f[1]}i(c,s)}else t!=null&&o(s,t,r);return this}get(t,s){if(t=Ot(t),t){const r=v.findKey(this,t);if(r){const n=this[r];if(!s)return n;if(s===!0)return vl(n);if(v.isFunction(s))return s.call(this,n,r);if(v.isRegExp(s))return s.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,s){if(t=Ot(t),t){const r=v.findKey(this,t);return!!(r&&this[r]!==void 0&&(!s||Ks(this,this[r],r,s)))}return!1}delete(t,s){const r=this;let n=!1;function o(i){if(i=Ot(i),i){const c=v.findKey(r,i);c&&(!s||Ks(r,r[c],c,s))&&(delete r[c],n=!0)}}return v.isArray(t)?t.forEach(o):o(t),n}clear(t){const s=Object.keys(this);let r=s.length,n=!1;for(;r--;){const o=s[r];(!t||Ks(this,this[o],o,t,!0))&&(delete this[o],n=!0)}return n}normalize(t){const s=this,r={};return v.forEach(this,(n,o)=>{const i=v.findKey(r,o);if(i){s[i]=fs(n),delete s[o];return}const c=t?Sl(o):String(o).trim();c!==o&&delete s[o],s[c]=fs(n),r[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const s=Object.create(null);return v.forEach(this,(r,n)=>{r!=null&&r!==!1&&(s[n]=t&&v.isArray(r)?r.join(", "):r)}),s}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,s])=>t+": "+s).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,...s){const r=new this(t);return s.forEach(n=>r.set(n)),r}static accessor(t){const r=(this[gn]=this[gn]={accessors:{}}).accessors,n=this.prototype;function o(i){const c=Ot(i);r[c]||(Rl(n,i),r[c]=!0)}return v.isArray(t)?t.forEach(o):o(t),this}};xe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);v.reduceDescriptors(xe.prototype,({value:e},t)=>{let s=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[s]=r}}});v.freezeMethods(xe);const jl="[REDACTED ****]";function Nl(e){if(v.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(v.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function Cl(e,t){const s=new Set(t.map(o=>String(o).toLowerCase())),r=[],n=o=>{if(o===null||typeof o!="object"||v.isBuffer(o))return o;if(r.indexOf(o)!==-1)return;o instanceof xe&&(o=o.toJSON()),r.push(o);let i;if(v.isArray(o))i=[],o.forEach((c,l)=>{const d=n(c);v.isUndefined(d)||(i[l]=d)});else{if(!v.isPlainObject(o)&&Nl(o))return r.pop(),o;i=Object.create(null);for(const[c,l]of Object.entries(o)){const d=s.has(c.toLowerCase())?jl:n(l);v.isUndefined(d)||(i[c]=d)}}return r.pop(),i};return n(e)}let P=class Lo extends Error{static from(t,s,r,n,o,i){const c=new Lo(t.message,s||t.code,r,n,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,s,r,n,o){super(t),Object.defineProperty(this,"message",{__proto__:null,value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,s&&(this.code=s),r&&(this.config=r),n&&(this.request=n),o&&(this.response=o,this.status=o.status)}toJSON(){const t=this.config,s=t&&v.hasOwnProp(t,"redact")?t.redact:void 0,r=v.isArray(s)&&s.length>0?Cl(t,s):v.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}}};P.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";P.ERR_BAD_OPTION="ERR_BAD_OPTION";P.ECONNABORTED="ECONNABORTED";P.ETIMEDOUT="ETIMEDOUT";P.ECONNREFUSED="ECONNREFUSED";P.ERR_NETWORK="ERR_NETWORK";P.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";P.ERR_DEPRECATED="ERR_DEPRECATED";P.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";P.ERR_BAD_REQUEST="ERR_BAD_REQUEST";P.ERR_CANCELED="ERR_CANCELED";P.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";P.ERR_INVALID_URL="ERR_INVALID_URL";P.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const _l=null,Mo=100;function lr(e){return v.isPlainObject(e)||v.isArray(e)}function Io(e){return v.endsWith(e,"[]")?e.slice(0,-2):e}function Ys(e,t,s){return e?e.concat(t).map(function(n,o){return n=Io(n),!s&&o?"["+n+"]":n}).join(s?".":""):t}function kl(e){return v.isArray(e)&&!e.some(lr)}const El=v.toFlatObject(v,{},null,function(t){return/^is[A-Z]/.test(t)});function Ts(e,t,s){if(!v.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,s=v.toFlatObject(s,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,S){return!v.isUndefined(S[y])});const r=s.metaTokens,n=s.visitor||p,o=s.dots,i=s.indexes,c=s.Blob||typeof Blob<"u"&&Blob,l=s.maxDepth===void 0?Mo:s.maxDepth,d=c&&v.isSpecCompliantForm(t),f=[];if(!v.isFunction(n))throw new TypeError("visitor must be a function");function u(b){if(b===null)return"";if(v.isDate(b))return b.toISOString();if(v.isBoolean(b))return b.toString();if(!d&&v.isBlob(b))throw new P("Blob is not supported. Use a Buffer instead.");if(v.isArrayBuffer(b)||v.isTypedArray(b)){if(d&&typeof c=="function")return new c([b]);if(typeof Buffer<"u")return Buffer.from(b);throw new P("Blob is not supported. Use a Buffer instead.",P.ERR_NOT_SUPPORT)}return b}function h(b){if(b>l)throw new P("Object is too deeply nested ("+b+" levels). Max depth: "+l,P.ERR_FORM_DATA_DEPTH_EXCEEDED)}function m(b,y){if(l===1/0)return JSON.stringify(b);const S=[];return JSON.stringify(b,function(N,j){if(!v.isObject(j))return j;for(;S.length&&S[S.length-1]!==this;)S.pop();return S.push(j),h(y+S.length-1),j})}function p(b,y,S){let w=b;if(v.isReactNative(t)&&v.isReactNativeBlob(b))return t.append(Ys(S,y,o),u(b)),!1;if(b&&!S&&typeof b=="object"){if(v.endsWith(y,"{}"))y=r?y:y.slice(0,-2),b=m(b,1);else if(v.isArray(b)&&kl(b)||(v.isFileList(b)||v.endsWith(y,"[]"))&&(w=v.toArray(b)))return y=Io(y),w.forEach(function(j,_){!(v.isUndefined(j)||j===null)&&t.append(i===!0?Ys([y],_,o):i===null?y:y+"[]",u(j))}),!1}return lr(b)?!0:(t.append(Ys(S,y,o),u(b)),!1)}const g=Object.assign(El,{defaultVisitor:p,convertValue:u,isVisitable:lr});function x(b,y,S=0){if(!v.isUndefined(b)){if(h(S),f.indexOf(b)!==-1)throw new Error("Circular reference detected in "+y.join("."));f.push(b),v.forEach(b,function(N,j){(!(v.isUndefined(N)||N===null)&&n.call(t,N,v.isString(j)?j.trim():j,y,g))===!0&&x(N,y?y.concat(j):[j],S+1)}),f.pop()}}if(!v.isObject(e))throw new TypeError("data must be an object");return x(e),t}function xn(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(r){return t[r]})}function wr(e,t){this._pairs=[],e&&Ts(e,this,t)}const Do=wr.prototype;Do.append=function(t,s){this._pairs.push([t,s])};Do.toString=function(t){const s=t?r=>t.call(this,r,xn):xn;return this._pairs.map(function(n){return s(n[0])+"="+s(n[1])},"").join("&")};function Pl(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Fo(e,t,s){if(!t)return e;e=e||"";const r=v.isFunction(s)?{serialize:s}:s,n=v.getSafeProp(r,"encode")||Pl,o=v.getSafeProp(r,"serialize");let i;if(o?i=o(t,r):i=v.isURLSearchParams(t)?t.toString():new wr(t,r).toString(n),i){const c=e.indexOf("#");c!==-1&&(e=e.slice(0,c)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class bn{constructor(){this.handlers=[]}use(t,s,r){return this.handlers.push({fulfilled:t,rejected:s,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){v.forEach(this.handlers,function(r){r!==null&&t(r)})}}const Sr={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Tl=typeof URLSearchParams<"u"?URLSearchParams:wr,Al=typeof FormData<"u"?FormData:null,Ol=typeof Blob<"u"?Blob:null,Ll={isBrowser:!0,classes:{URLSearchParams:Tl,FormData:Al,Blob:Ol},protocols:["http","https","file","blob","url","data"]},Rr=typeof window<"u"&&typeof document<"u",dr=typeof navigator=="object"&&navigator||void 0,Ml=Rr&&(!dr||["ReactNative","NativeScript","NS"].indexOf(dr.product)<0),Il=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Dl=Rr&&window.location.href||"http://localhost",Fl=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Rr,hasStandardBrowserEnv:Ml,hasStandardBrowserWebWorkerEnv:Il,navigator:dr,origin:Dl},Symbol.toStringTag,{value:"Module"})),he={...Fl,...Ll};function Ul(e,t){return Ts(e,new he.classes.URLSearchParams,{visitor:function(s,r,n,o){return he.isNode&&v.isBuffer(s)?(this.append(r,s.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}const yn=Mo;function Uo(e){if(e>yn)throw new P("FormData field is too deeply nested ("+e+" levels). Max depth: "+yn,P.ERR_FORM_DATA_DEPTH_EXCEEDED)}function $l(e){const t=[],s=/\w+|\[(\w*)]/g;let r;for(;(r=s.exec(e))!==null;)Uo(t.length),t.push(r[0]==="[]"?"":r[1]||r[0]);return t}function Bl(e){const t={},s=Object.keys(e);let r;const n=s.length;let o;for(r=0;r<n;r++)o=s[r],t[o]=e[o];return t}function $o(e){function t(s,r,n,o){Uo(o);let i=s[o++];if(i==="__proto__")return!0;const c=Number.isFinite(+i),l=o>=s.length;return i=!i&&v.isArray(n)?n.length:i,l?(v.hasOwnProp(n,i)?n[i]=v.isArray(n[i])?n[i].concat(r):[n[i],r]:n[i]=r,!c):((!v.hasOwnProp(n,i)||!v.isObject(n[i]))&&(n[i]=[]),t(s,r,n[i],o)&&v.isArray(n[i])&&(n[i]=Bl(n[i])),!c)}if(v.isFormData(e)&&v.isFunction(e.entries)){const s={};return v.forEachEntry(e,(r,n)=>{t($l(r),n,s,0)}),s}return null}const ht=(e,t)=>e!=null&&v.hasOwnProp(e,t)?e[t]:void 0;function zl(e,t,s){if(v.isString(e))try{return(t||JSON.parse)(e),v.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(s||JSON.stringify)(e)}const Ht={transitional:Sr,adapter:["xhr","http","fetch"],transformRequest:[function(t,s){const r=s.getContentType()||"",n=r.indexOf("application/json")>-1,o=v.isObject(t);if(o&&v.isHTMLForm(t)&&(t=new FormData(t)),v.isFormData(t))return n?JSON.stringify($o(t)):t;if(v.isArrayBuffer(t)||v.isBuffer(t)||v.isStream(t)||v.isFile(t)||v.isBlob(t)||v.isReadableStream(t))return t;if(v.isArrayBufferView(t))return t.buffer;if(v.isURLSearchParams(t))return s.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(o){const l=ht(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return Ul(t,l).toString();if((c=v.isFileList(t))||r.indexOf("multipart/form-data")>-1){const d=ht(this,"env"),f=d&&d.FormData;return Ts(c?{"files[]":t}:t,f&&new f,l)}}return o||n?(s.setContentType("application/json",!1),zl(t)):t}],transformResponse:[function(t){const s=ht(this,"transitional")||Ht.transitional,r=s&&s.forcedJSONParsing,n=ht(this,"responseType"),o=n==="json";if(v.isResponse(t)||v.isReadableStream(t))return t;if(t&&v.isString(t)&&(r&&!n||o)){const c=!(s&&s.silentJSONParsing)&&o;try{return JSON.parse(t,ht(this,"parseReviver"))}catch(l){if(c)throw l.name==="SyntaxError"?P.from(l,P.ERR_BAD_RESPONSE,this,null,ht(this,"response")):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:he.classes.FormData,Blob:he.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};v.forEach(["delete","get","head","post","put","patch","query"],e=>{Ht.headers[e]={}});function Js(e,t){const s=this||Ht,r=t||s,n=xe.from(r.headers);let o=r.data;return v.forEach(e,function(c){o=c.call(s,o,n.normalize(),t?t.status:void 0)}),n.normalize(),o}function Bo(e){return!!(e&&e.__CANCEL__)}let qt=class extends P{constructor(t,s,r){super(t??"canceled",P.ERR_CANCELED,s,r),this.name="CanceledError",this.__CANCEL__=!0}};function zo(e,t,s){const r=s.config.validateStatus;!s.status||!r||r(s.status)?e(s):t(new P("Request failed with status code "+s.status,s.status>=400&&s.status<500?P.ERR_BAD_REQUEST:P.ERR_BAD_RESPONSE,s.config,s.request,s))}function Vl(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}function Wl(e,t){e=e||10;const s=new Array(e),r=new Array(e);let n=0,o=0,i;return t=t!==void 0?t:1e3,function(l){const d=Date.now(),f=r[o];i||(i=d),s[n]=l,r[n]=d;let u=o,h=0;for(;u!==n;)h+=s[u++],u=u%e;if(n=(n+1)%e,n===o&&(o=(o+1)%e),d-i<t)return;const m=f&&d-f;return m?Math.round(h*1e3/m):void 0}}function Hl(e,t){let s=0,r=1e3/t,n,o;const i=(d,f=Date.now())=>{s=f,n=null,o&&(clearTimeout(o),o=null),e(...d)};return[(...d)=>{const f=Date.now(),u=f-s;u>=r?i(d,f):(n=d,o||(o=setTimeout(()=>{o=null,i(n)},r-u)))},()=>n&&i(n)]}const Ss=(e,t,s=3)=>{let r=0;const n=Wl(50,250);return Hl(o=>{if(!o||typeof o.loaded!="number")return;const i=o.loaded,c=o.lengthComputable?o.total:void 0,l=c!=null?Math.min(i,c):i,d=Math.max(0,l-r),f=n(d);r=Math.max(r,l);const u={loaded:l,total:c,progress:c?l/c:void 0,bytes:d,rate:f||void 0,estimated:f&&c?(c-l)/f:void 0,event:o,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(u)},s)},vn=(e,t)=>{const s=e!=null;return[r=>t[0]({lengthComputable:s,total:e,loaded:r}),t[1]]},wn=e=>(...t)=>v.asap(()=>e(...t)),ql=he.hasStandardBrowserEnv?((e,t)=>s=>(s=new URL(s,he.origin),e.protocol===s.protocol&&e.host===s.host&&(t||e.port===s.port)))(new URL(he.origin),he.navigator&&/(msie|trident)/i.test(he.navigator.userAgent)):()=>!0,Gl=he.hasStandardBrowserEnv?{write(e,t,s,r,n,o,i){if(typeof document>"u")return;const c=[`${e}=${encodeURIComponent(t)}`];v.isNumber(s)&&c.push(`expires=${new Date(s).toUTCString()}`),v.isString(r)&&c.push(`path=${r}`),v.isString(n)&&c.push(`domain=${n}`),o===!0&&c.push("secure"),v.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 s=0;s<t.length;s++){const r=t[s].replace(/^\s+/,""),n=r.indexOf("=");if(n!==-1&&r.slice(0,n)===e)try{return decodeURIComponent(r.slice(n+1))}catch{return r.slice(n+1)}}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Kl(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Yl(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}const Jl=/^https?:(?!\/\/)/i,Xl=/[\t\n\r]/g;function Zl(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}function Ql(e){return Zl(e).replace(Xl,"")}function Sn(e,t){if(typeof e=="string"&&Jl.test(Ql(e)))throw new P('Invalid URL: missing "//" after protocol',P.ERR_INVALID_URL,t)}function Vo(e,t,s,r){Sn(t,r);let n=!Kl(t);return e&&(n||s===!1)?(Sn(e,r),Yl(e,t)):t}const Rn=e=>e instanceof xe?{...e}:e;function ct(e,t){e=e||{},t=t||{};const s=Object.create(null);Object.defineProperty(s,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function r(f,u,h,m){return v.isPlainObject(f)&&v.isPlainObject(u)?v.merge.call({caseless:m},f,u):v.isPlainObject(u)?v.merge({},u):v.isArray(u)?u.slice():u}function n(f,u,h,m){if(v.isUndefined(u)){if(!v.isUndefined(f))return r(void 0,f,h,m)}else return r(f,u,h,m)}function o(f,u){if(!v.isUndefined(u))return r(void 0,u)}function i(f,u){if(v.isUndefined(u)){if(!v.isUndefined(f))return r(void 0,f)}else return r(void 0,u)}function c(f){const u=v.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!v.isUndefined(u))if(v.isPlainObject(u)){if(v.hasOwnProp(u,f))return u[f]}else return;const h=v.hasOwnProp(e,"transitional")?e.transitional:void 0;if(v.isPlainObject(h)&&v.hasOwnProp(h,f))return h[f]}function l(f,u,h){if(v.hasOwnProp(t,h))return r(f,u);if(v.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:l,headers:(f,u,h)=>n(Rn(f),Rn(u),h,!0)};return v.forEach(Object.keys({...e,...t}),function(u){if(u==="__proto__"||u==="constructor"||u==="prototype")return;const h=v.hasOwnProp(d,u)?d[u]:n,m=v.hasOwnProp(e,u)?e[u]:void 0,p=v.hasOwnProp(t,u)?t[u]:void 0,g=h(m,p,u);v.isUndefined(g)&&h!==l||(s[u]=g)}),v.hasOwnProp(t,"validateStatus")&&v.isUndefined(t.validateStatus)&&c("validateStatusUndefinedResolves")===!1&&(v.hasOwnProp(e,"validateStatus")?s.validateStatus=r(void 0,e.validateStatus):delete s.validateStatus),s}const ed=["content-type","content-length"];function td(e,t,s){if(s!=="content-only"){e.set(t);return}Object.entries(t||{}).forEach(([r,n])=>{ed.includes(r.toLowerCase())&&e.set(r,n)})}const sd=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,s)=>String.fromCharCode(parseInt(s,16)));function Wo(e){const t=ct({},e),s=h=>v.hasOwnProp(t,h)?t[h]:void 0,r=s("data");let n=s("withXSRFToken");const o=s("xsrfHeaderName"),i=s("xsrfCookieName");let c=s("headers");const l=s("auth"),d=s("baseURL"),f=s("allowAbsoluteUrls"),u=s("url");if(t.headers=c=xe.from(c),t.url=Fo(Vo(d,u,f,t),s("params"),s("paramsSerializer")),l){const h=v.getSafeProp(l,"username")||"",m=v.getSafeProp(l,"password")||"";try{c.set("Authorization","Basic "+btoa(h+":"+(m?sd(m):"")))}catch(p){throw P.from(p,P.ERR_BAD_OPTION_VALUE,e)}}if(v.isFormData(r)&&(he.hasStandardBrowserEnv||he.hasStandardBrowserWebWorkerEnv||v.isReactNative(r)?c.setContentType(void 0):v.isFunction(r.getHeaders)&&td(c,r.getHeaders(),s("formDataHeaderPolicy"))),he.hasStandardBrowserEnv&&(v.isFunction(n)&&(n=n(t)),n===!0||n==null&&ql(t.url))){const m=o&&i&&Gl.read(i);m&&c.set(o,m)}return t}const rd=typeof XMLHttpRequest<"u",nd=rd&&function(e){return new Promise(function(s,r){const n=Wo(e);let o=n.data;const i=xe.from(n.headers).normalize();let{responseType:c,onUploadProgress:l,onDownloadProgress:d}=n,f,u,h,m,p;function g(){m&&m(),p&&p(),n.cancelToken&&n.cancelToken.unsubscribe(f),n.signal&&n.signal.removeEventListener("abort",f)}let x=new XMLHttpRequest;x.open(n.method.toUpperCase(),n.url,!0),x.timeout=n.timeout;function b(){if(!x)return;const S=xe.from("getAllResponseHeaders"in x&&x.getAllResponseHeaders()),N={data:!c||c==="text"||c==="json"?x.responseText:x.response,status:x.status,statusText:x.statusText,headers:S,config:e,request:x};zo(function(_){s(_),g()},function(_){r(_),g()},N),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 P("Request aborted",P.ECONNABORTED,e,x)),g(),x=null)},x.onerror=function(w){const N=w&&w.message?w.message:"Network Error",j=new P(N,P.ERR_NETWORK,e,x);j.event=w||null,r(j),g(),x=null},x.ontimeout=function(){let w=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const N=n.transitional||Sr;n.timeoutErrorMessage&&(w=n.timeoutErrorMessage),r(new P(w,N.clarifyTimeoutError?P.ETIMEDOUT:P.ECONNABORTED,e,x)),g(),x=null},o===void 0&&i.setContentType(null),"setRequestHeader"in x&&v.forEach(Oo(i),function(w,N){x.setRequestHeader(N,w)}),v.isUndefined(n.withCredentials)||(x.withCredentials=!!n.withCredentials),c&&c!=="json"&&(x.responseType=n.responseType),d&&([h,p]=Ss(d,!0),x.addEventListener("progress",h)),l&&x.upload&&([u,m]=Ss(l),x.upload.addEventListener("progress",u),x.upload.addEventListener("loadend",m)),(n.cancelToken||n.signal)&&(f=S=>{x&&(r(!S||S.type?new qt(null,e,x):S),x.abort(),g(),x=null)},n.cancelToken&&n.cancelToken.subscribe(f),n.signal&&(n.signal.aborted?f():n.signal.addEventListener("abort",f)));const y=Vl(n.url);if(y&&!he.protocols.includes(y)){r(new P("Unsupported protocol "+y+":",P.ERR_BAD_REQUEST,e)),g();return}x.send(o||null)})},od=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const s=new AbortController;let r=!1;const n=function(l){if(!r){r=!0,i();const d=l instanceof Error?l:this.reason;s.abort(d instanceof P?d:new qt(d instanceof Error?d.message:d))}};let o=t&&setTimeout(()=>{o=null,n(new P(`timeout of ${t}ms exceeded`,P.ETIMEDOUT))},t);const i=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(l=>{l.unsubscribe?l.unsubscribe(n):l.removeEventListener("abort",n)}),e=null)};e.forEach(l=>l.addEventListener("abort",n,{once:!0}));const{signal:c}=s;return c.unsubscribe=()=>v.asap(i),c},ad=function*(e,t){let s=e.byteLength;if(s<t){yield e;return}let r=0,n;for(;r<s;)n=r+t,yield e.slice(r,n),r=n},id=async function*(e,t){for await(const s of cd(e))yield*ad(s,t)},cd=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:s,value:r}=await t.read();if(s)break;yield r}}finally{await t.cancel()}},jn=(e,t,s,r)=>{const n=id(e,t);let o=0,i,c=l=>{i||(i=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:d,value:f}=await n.next();if(d){c(),l.close();return}let u=f.byteLength;if(s){let h=o+=u;s(h)}l.enqueue(new Uint8Array(f))}catch(d){throw c(d),d}},cancel(l){return c(l),n.return()}},{highWaterMark:2})},Rs=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,ld=(e,t,s)=>t+2<s&&Rs(e.charCodeAt(t+1))&&Rs(e.charCodeAt(t+2));function dd(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;const t=e.indexOf(",");if(t<0)return 0;const s=e.slice(5,t),r=e.slice(t+1);if(/;base64/i.test(s)){let i=r.length;const c=r.length;for(let m=0;m<c;m++)if(r.charCodeAt(m)===37&&m+2<c){const p=r.charCodeAt(m+1),g=r.charCodeAt(m+2);Rs(p)&&Rs(g)&&(i-=2,m+=2)}let l=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?(l++,d--):f(d)&&(l++,d-=3)),l===1&&d>=0&&(r.charCodeAt(d)===61||f(d))&&l++;const h=Math.floor(i/4)*3-(l||0);return h>0?h:0}let o=0;for(let i=0,c=r.length;i<c;i++){const l=r.charCodeAt(i);if(l===37&&ld(r,i,c))o+=1,i+=2;else if(l<128)o+=1;else if(l<2048)o+=2;else if(l>=55296&&l<=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 jr="1.18.1",Nn=64*1024,{isFunction:es}=v,ud=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,s)=>String.fromCharCode(parseInt(s,16))),Cn=e=>{if(!v.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},_n=(e,...t)=>{try{return!!e(...t)}catch{return!1}},fd=e=>{const t=e.indexOf("://");let s=e;return t!==-1&&(s=s.slice(t+3)),s.includes("@")||s.includes(":")},hd=e=>{const t=v.global!==void 0&&v.global!==null?v.global:globalThis,{ReadableStream:s,TextEncoder:r}=t;e=v.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:n,Request:o,Response:i}=e,c=n?es(n):typeof fetch=="function",l=es(o),d=es(i);if(!c)return!1;const f=c&&es(s),u=c&&(typeof r=="function"?(b=>y=>b.encode(y))(new r):async b=>new Uint8Array(await new o(b).arrayBuffer())),h=l&&f&&_n(()=>{let b=!1;const y=new o(he.origin,{body:new s,method:"POST",get duplex(){return b=!0,"half"}}),S=y.headers.has("Content-Type");return y.body!=null&&y.body.cancel(),b&&!S}),m=d&&f&&_n(()=>v.isReadableStream(new i("").body)),p={stream:m&&(b=>b.body)};c&&["text","arrayBuffer","blob","formData","stream"].forEach(b=>{!p[b]&&(p[b]=(y,S)=>{let w=y&&y[b];if(w)return w.call(y);throw new P(`Response type '${b}' is not supported`,P.ERR_NOT_SUPPORT,S)})});const g=async b=>{if(b==null)return 0;if(v.isBlob(b))return b.size;if(v.isSpecCompliantForm(b))return(await new o(he.origin,{method:"POST",body:b}).arrayBuffer()).byteLength;if(v.isArrayBufferView(b)||v.isArrayBuffer(b))return b.byteLength;if(v.isURLSearchParams(b)&&(b=b+""),v.isString(b))return(await u(b)).byteLength},x=async(b,y)=>{const S=v.toFiniteNumber(b.getContentLength());return S??g(y)};return async b=>{let{url:y,method:S,data:w,signal:N,cancelToken:j,timeout:_,onDownloadProgress:R,onUploadProgress:E,responseType:D,headers:L,withCredentials:F="same-origin",fetchOptions:ee,maxContentLength:V,maxBodyLength:Z}=Wo(b);const Q=v.isNumber(V)&&V>-1,Y=v.isNumber(Z)&&Z>-1,de=I=>v.hasOwnProp(b,I)?b[I]:void 0;let fe=n||fetch;D=D?(D+"").toLowerCase():"text";let T=od([N,j&&j.toAbortSignal()],_),C=null;const U=T&&T.unsubscribe&&(()=>{T.unsubscribe()});let W,q=null;const M=()=>new P("Request body larger than maxBodyLength limit",P.ERR_BAD_REQUEST,b,C);try{let I;const $=de("auth");if($){const z=v.getSafeProp($,"username")||"",me=v.getSafeProp($,"password")||"";I={username:z,password:me}}if(fd(y)){const z=new URL(y,he.origin);if(!I&&(z.username||z.password)){const me=Cn(z.username),ye=Cn(z.password);I={username:me,password:ye}}(z.username||z.password)&&(z.username="",z.password="",y=z.href)}if(I&&(L.delete("authorization"),L.set("Authorization","Basic "+btoa(ud((I.username||"")+":"+(I.password||""))))),Q&&typeof y=="string"&&y.startsWith("data:")&&dd(y)>V)throw new P("maxContentLength size of "+V+" exceeded",P.ERR_BAD_RESPONSE,b,C);if(Y&&S!=="get"&&S!=="head"){const z=await g(w);if(typeof z=="number"&&isFinite(z)&&(W=z,z>Z))throw M()}const J=Y&&(v.isReadableStream(w)||v.isStream(w)),G=(z,me,ye)=>jn(z,Nn,Ee=>{if(Y&&Ee>Z)throw q=M();me&&me(Ee)},ye);if(h&&S!=="get"&&S!=="head"&&(E||J)){if(W=W??await x(L,w),W!==0||J){let z=new o(y,{method:"POST",body:w,duplex:"half"}),me;if(v.isFormData(w)&&(me=z.headers.get("content-type"))&&L.setContentType(me),z.body){const[ye,Ee]=E&&vn(W,Ss(wn(E)))||[];w=G(z.body,ye,Ee)}}}else if(J&&!l&&f&&S!=="get"&&S!=="head")w=G(w);else if(J&&l&&!h&&S!=="get"&&S!=="head")throw new P("Stream request bodies are not supported by the current fetch implementation",P.ERR_NOT_SUPPORT,b,C);v.isString(F)||(F=F?"include":"omit");const ue=l&&"credentials"in o.prototype;if(v.isFormData(w)){const z=L.getContentType();z&&/^multipart\/form-data/i.test(z)&&!/boundary=/i.test(z)&&L.delete("content-type")}L.set("User-Agent","axios/"+jr,!1);const be={...ee,signal:T,method:S.toUpperCase(),headers:Oo(L.normalize()),body:w,duplex:"half",credentials:ue?F:void 0};C=l&&new o(y,be);let ne=await(l?fe(C,ee):fe(y,be));const Me=xe.from(ne.headers);if(Q){const z=v.toFiniteNumber(Me.getContentLength());if(z!=null&&z>V)throw new P("maxContentLength size of "+V+" exceeded",P.ERR_BAD_RESPONSE,b,C)}const _e=m&&(D==="stream"||D==="response");if(m&&ne.body&&(R||Q||_e&&U)){const z={};["status","statusText","headers"].forEach($e=>{z[$e]=ne[$e]});const me=v.toFiniteNumber(Me.getContentLength()),[ye,Ee]=R&&vn(me,Ss(wn(R),!0))||[];let Te=0;const Ls=$e=>{if(Q&&(Te=$e,Te>V))throw new P("maxContentLength size of "+V+" exceeded",P.ERR_BAD_RESPONSE,b,C);ye&&ye($e)};ne=new i(jn(ne.body,Nn,Ls,()=>{Ee&&Ee(),U&&U()}),z)}D=D||"text";let ke=await p[v.findKey(p,D)||"text"](ne,b);if(Q&&!m&&!_e){let z;if(ke!=null&&(typeof ke.byteLength=="number"?z=ke.byteLength:typeof ke.size=="number"?z=ke.size:typeof ke=="string"&&(z=typeof r=="function"?new r().encode(ke).byteLength:ke.length)),typeof z=="number"&&z>V)throw new P("maxContentLength size of "+V+" exceeded",P.ERR_BAD_RESPONSE,b,C)}return!_e&&U&&U(),await new Promise((z,me)=>{zo(z,me,{data:ke,headers:xe.from(ne.headers),status:ne.status,statusText:ne.statusText,config:b,request:C})})}catch(I){if(U&&U(),T&&T.aborted&&T.reason instanceof P){const $=T.reason;throw $.config=b,C&&($.request=C),I!==$&&Object.defineProperty($,"cause",{__proto__:null,value:I,writable:!0,enumerable:!1,configurable:!0}),$}if(q)throw C&&!q.request&&(q.request=C),q;if(I instanceof P)throw C&&!I.request&&(I.request=C),I;if(I&&I.name==="TypeError"&&/Load failed|fetch/i.test(I.message)){const $=new P("Network Error",P.ERR_NETWORK,b,C,I&&I.response);throw Object.defineProperty($,"cause",{__proto__:null,value:I.cause||I,writable:!0,enumerable:!1,configurable:!0}),$}throw P.from(I,I&&I.code,b,C,I&&I.response)}}},md=new Map,Ho=e=>{let t=e&&e.env||{};const{fetch:s,Request:r,Response:n}=t,o=[r,n,s];let i=o.length,c=i,l,d,f=md;for(;c--;)l=o[c],d=f.get(l),d===void 0&&f.set(l,d=c?new Map:hd(t)),f=d;return d};Ho();const Nr={http:_l,xhr:nd,fetch:{get:Ho}};v.forEach(Nr,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const kn=e=>`- ${e}`,pd=e=>v.isFunction(e)||e===null||e===!1;function gd(e,t){e=v.isArray(e)?e:[e];const{length:s}=e;let r,n;const o={};for(let i=0;i<s;i++){r=e[i];let c;if(n=r,!pd(r)&&(n=Nr[(c=String(r)).toLowerCase()],n===void 0))throw new P(`Unknown adapter '${c}'`);if(n&&(v.isFunction(n)||(n=n.get(t))))break;o[c||"#"+i]=n}if(!n){const i=Object.entries(o).map(([l,d])=>`adapter ${l} `+(d===!1?"is not supported by the environment":"is not available in the build"));let c=s?i.length>1?`since :
|
|
9
9
|
`+i.map(kn).join(`
|
|
10
10
|
`):" "+kn(i[0]):"as no adapter specified";throw new P("There is no suitable adapter to dispatch the request "+c,P.ERR_NOT_SUPPORT)}return n}const qo={getAdapter:gd,adapters:Nr};function Xs(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new qt(null,e)}function En(e){return Xs(e),e.headers=xe.from(e.headers),e.data=Js.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),qo.getAdapter(e.adapter||Ht.adapter,e)(e).then(function(r){Xs(e),e.response=r;try{r.data=Js.call(e,e.transformResponse,r)}finally{delete e.response}return r.headers=xe.from(r.headers),r},function(r){if(!Bo(r)&&(Xs(e),r&&r.response)){e.response=r.response;try{r.response.data=Js.call(e,e.transformResponse,r.response)}finally{delete e.response}r.response.headers=xe.from(r.response.headers)}return Promise.reject(r)})}const As={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{As[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Pn={};As.transitional=function(t,s,r){function n(o,i){return"[Axios v"+jr+"] Transitional option '"+o+"'"+i+(r?". "+r:"")}return(o,i,c)=>{if(t===!1)throw new P(n(i," has been removed"+(s?" in "+s:"")),P.ERR_DEPRECATED);return s&&!Pn[i]&&(Pn[i]=!0,console.warn(n(i," has been deprecated since v"+s+" and will be removed in the near future"))),t?t(o,i,c):!0}};As.spelling=function(t){return(s,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function xd(e,t,s){if(typeof e!="object"||e===null)throw new P("options must be an object",P.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let n=r.length;for(;n-- >0;){const o=r[n],i=Object.prototype.hasOwnProperty.call(t,o)?t[o]:void 0;if(i){const c=e[o],l=c===void 0||i(c,o,e);if(l!==!0)throw new P("option "+o+" must be "+l,P.ERR_BAD_OPTION_VALUE);continue}if(s!==!0)throw new P("Unknown option "+o,P.ERR_BAD_OPTION)}}const hs={assertOptions:xd,validators:As},pe=hs.validators;let ot=class{constructor(t){this.defaults=t||{},this.interceptors={request:new bn,response:new bn}}async request(t,s){try{return await this._request(t,s)}catch(r){if(r instanceof Error){let n={};Error.captureStackTrace?Error.captureStackTrace(n):n=new Error;const o=(()=>{if(!n.stack)return"";const i=n.stack.indexOf(`
|
|
11
11
|
`);return i===-1?"":n.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),l=c===-1?"":o.slice(c+1);String(r.stack).endsWith(l)||(r.stack+=`
|
|
14
|
-
`+o)}}catch{}}throw r}}_request(t,s){typeof t=="string"?(s=s||{},s.url=t):s=t||{},s=ct(this.defaults,s);const{transitional:r,paramsSerializer:n,headers:o}=s;r!==void 0&&hs.assertOptions(r,{silentJSONParsing:pe.transitional(pe.boolean),forcedJSONParsing:pe.transitional(pe.boolean),clarifyTimeoutError:pe.transitional(pe.boolean),legacyInterceptorReqResOrdering:pe.transitional(pe.boolean),advertiseZstdAcceptEncoding:pe.transitional(pe.boolean),validateStatusUndefinedResolves:pe.transitional(pe.boolean)},!1),n!=null&&(v.isFunction(n)?s.paramsSerializer={serialize:n}:hs.assertOptions(n,{encode:pe.function,serialize:pe.function},!0)),s.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?s.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:s.allowAbsoluteUrls=!0),hs.assertOptions(s,{baseUrl:pe.spelling("baseURL"),withXsrfToken:pe.spelling("withXSRFToken")},!0),s.method=(s.method||this.defaults.method||"get").toLowerCase();let i=o&&v.merge(o.common,o[s.method]);o&&v.forEach(["delete","get","head","post","put","patch","query","common"],p=>{delete o[p]}),s.headers=xe.concat(i,o);const c=[];let l=!0;this.interceptors.request.forEach(function(g){if(typeof g.runWhen=="function"&&g.runWhen(s)===!1)return;l=l&&g.synchronous;const x=s.transitional||Sr;x&&x.legacyInterceptorReqResOrdering?c.unshift(g.fulfilled,g.rejected):c.push(g.fulfilled,g.rejected)});const d=[];this.interceptors.response.forEach(function(g){d.push(g.fulfilled,g.rejected)});let f,u=0,h;if(!l){const p=[En.bind(this),void 0];for(p.unshift(...c),p.push(...d),h=p.length,f=Promise.resolve(s);u<h;)f=f.then(p[u++],p[u++]);return f}h=c.length;let m=s;for(;u<h;){const p=c[u++],g=c[u++];try{m=p(m)}catch(x){g.call(this,x);break}}try{f=En.call(this,m)}catch(p){return Promise.reject(p)}for(u=0,h=d.length;u<h;)f=f.then(d[u++],d[u++]);return f}getUri(t){t=ct(this.defaults,t);const s=Vo(t.baseURL,t.url,t.allowAbsoluteUrls,t);return Fo(s,t.params,t.paramsSerializer)}};v.forEach(["delete","get","head","options"],function(t){ot.prototype[t]=function(s,r){return this.request(ct(r||{},{method:t,url:s,data:r&&v.hasOwnProp(r,"data")?r.data:void 0}))}});v.forEach(["post","put","patch","query"],function(t){function s(r){return function(o,i,c){return this.request(ct(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}ot.prototype[t]=s(),t!=="query"&&(ot.prototype[t+"Form"]=s(!0))});let bd=class Go{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let s;this.promise=new Promise(function(o){s=o});const r=this;this.promise.then(n=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](n);r._listeners=null}),this.promise.then=n=>{let o;const i=new Promise(c=>{r.subscribe(c),o=c}).then(n);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,c){r.reason||(r.reason=new qt(o,i,c),s(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 s=this._listeners.indexOf(t);s!==-1&&this._listeners.splice(s,1)}toAbortSignal(){const t=new AbortController,s=r=>{t.abort(r)};return this.subscribe(s),t.signal.unsubscribe=()=>this.unsubscribe(s),t.signal}static source(){let t;return{token:new Go(function(n){t=n}),cancel:t}}};function yd(e){return function(s){return e.apply(null,s)}}function vd(e){return v.isObject(e)&&e.isAxiosError===!0}const ur={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(ur).forEach(([e,t])=>{ur[t]=e});function Ko(e){const t=new ot(e),s=jo(ot.prototype.request,t);return v.extend(s,ot.prototype,t,{allOwnKeys:!0}),v.extend(s,t,null,{allOwnKeys:!0}),s.create=function(n){return Ko(ct(e,n))},s}const oe=Ko(Ht);oe.Axios=ot;oe.CanceledError=qt;oe.CancelToken=bd;oe.isCancel=Bo;oe.VERSION=jr;oe.toFormData=Ts;oe.AxiosError=P;oe.Cancel=oe.CanceledError;oe.all=function(t){return Promise.all(t)};oe.spread=yd;oe.isAxiosError=vd;oe.mergeConfig=ct;oe.AxiosHeaders=xe;oe.formToJSON=e=>$o(v.isHTMLForm(e)?new FormData(e):e);oe.getAdapter=qo.getAdapter;oe.HttpStatusCode=ur;oe.default=oe;const{Axios:th,AxiosError:sh,CanceledError:rh,isCancel:nh,CancelToken:oh,VERSION:ah,all:ih,Cancel:ch,isAxiosError:lh,spread:dh,toFormData:uh,AxiosHeaders:fh,HttpStatusCode:hh,formToJSON:mh,getAdapter:ph,mergeConfig:gh,create:xh}=oe,re=oe.create({baseURL:"/api/v1/cost"});function Yo(e,t){re.defaults.baseURL=`${e.replace(/\/$/,"")}/cost`,t?re.defaults.headers.common.Authorization=`Bearer ${t}`:delete re.defaults.headers.common.Authorization}function wd(e){e.interceptors.request.use(t=>{if(typeof window<"u"){const s=window.localStorage.getItem("access_token");s?(t.headers=t.headers||{},t.headers.Authorization=`Bearer ${s}`):t.headers&&delete t.headers.Authorization}return t})}const Sd=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Rd=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,s,r)=>r?r.toUpperCase():s.toLowerCase()),Tn=e=>{const t=Rd(e);return t.charAt(0).toUpperCase()+t.slice(1)},Jo=(...e)=>e.filter((t,s,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===s).join(" ").trim(),jd=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var Nd={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 Cd=k.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:s=2,absoluteStrokeWidth:r,className:n="",children:o,iconNode:i,...c},l)=>k.createElement("svg",{ref:l,...Nd,width:t,height:t,stroke:e,strokeWidth:r?Number(s)*24/Number(t):s,className:Jo("lucide",n),...!o&&!jd(c)&&{"aria-hidden":"true"},...c},[...i.map(([d,f])=>k.createElement(d,f)),...Array.isArray(o)?o:[o]]));const X=(e,t)=>{const s=k.forwardRef(({className:r,...n},o)=>k.createElement(Cd,{ref:o,iconNode:t,className:Jo(`lucide-${Sd(Tn(e))}`,`lucide-${e}`,r),...n}));return s.displayName=Tn(e),s};const _d=[["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"}]],kd=X("building-2",_d);const Ed=[["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"}]],Xo=X("calendar-clock",Ed);const Pd=[["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"}]],Td=X("chart-column",Pd);const Ad=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Od=X("chevron-down",Ad);const Ld=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Md=X("chevron-left",Ld);const Id=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Dd=X("chevron-right",Id);const Fd=[["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"}]],lt=X("circle-alert",Fd);const Ud=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],$d=X("circle-check",Ud);const Bd=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],js=X("cloud",Bd);const zd=[["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"}]],Zo=X("database",zd);const Vd=[["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"}]],Qo=X("dollar-sign",Vd);const Wd=[["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"}]],Cr=X("download",Wd);const Hd=[["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"}]],ea=X("external-link",Hd);const qd=[["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"}]],Gd=X("eye",qd);const Kd=[["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"}]],Yd=X("file-down",Kd);const Jd=[["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"}]],ta=X("file-text",Jd);const Xd=[["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"}]],Zd=X("list",Xd);const Qd=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],It=X("loader-circle",Qd);const eu=[["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"}]],tu=X("map-pin",eu);const su=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ru=X("plus",su);const nu=[["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"}]],wt=X("refresh-cw",nu);const ou=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],_r=X("search",ou);const au=[["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"}]],sa=X("server",au);const iu=[["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"}]],ra=X("settings-2",iu);const cu=[["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"}]],An=X("sparkles",cu);const lu=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],du=X("trending-down",lu);const uu=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],na=X("trending-up",uu);const fu=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Os=X("x",fu);function oa(e){var t,s,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var n=e.length;for(t=0;t<n;t++)e[t]&&(s=oa(e[t]))&&(r&&(r+=" "),r+=s)}else for(s in e)e[s]&&(r&&(r+=" "),r+=s);return r}function hu(){for(var e,t,s=0,r="",n=arguments.length;s<n;s++)(e=arguments[s])&&(t=oa(e))&&(r&&(r+=" "),r+=t);return r}const mu=(e,t)=>{const s=new Array(e.length+t.length);for(let r=0;r<e.length;r++)s[r]=e[r];for(let r=0;r<t.length;r++)s[e.length+r]=t[r];return s},pu=(e,t)=>({classGroupId:e,validator:t}),aa=(e=new Map,t=null,s)=>({nextPart:e,validators:t,classGroupId:s}),Ns="-",On=[],gu="arbitrary..",xu=e=>{const t=yu(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return bu(i);const c=i.split(Ns),l=c[0]===""&&c.length>1?1:0;return ia(c,l,t)},getConflictingClassGroupIds:(i,c)=>{if(c){const l=r[i],d=s[i];return l?d?mu(d,l):l:d||On}return s[i]||On}}},ia=(e,t,s)=>{if(e.length-t===0)return s.classGroupId;const n=e[t],o=s.nextPart.get(n);if(o){const d=ia(e,t+1,o);if(d)return d}const i=s.validators;if(i===null)return;const c=t===0?e.join(Ns):e.slice(t).join(Ns),l=i.length;for(let d=0;d<l;d++){const f=i[d];if(f.validator(c))return f.classGroupId}},bu=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),s=t.indexOf(":"),r=t.slice(0,s);return r?gu+r:void 0})(),yu=e=>{const{theme:t,classGroups:s}=e;return vu(s,t)},vu=(e,t)=>{const s=aa();for(const r in e){const n=e[r];kr(n,s,r,t)}return s},kr=(e,t,s,r)=>{const n=e.length;for(let o=0;o<n;o++){const i=e[o];wu(i,t,s,r)}},wu=(e,t,s,r)=>{if(typeof e=="string"){Su(e,t,s);return}if(typeof e=="function"){Ru(e,t,s,r);return}ju(e,t,s,r)},Su=(e,t,s)=>{const r=e===""?t:ca(t,e);r.classGroupId=s},Ru=(e,t,s,r)=>{if(Nu(e)){kr(e(r),t,s,r);return}t.validators===null&&(t.validators=[]),t.validators.push(pu(s,e))},ju=(e,t,s,r)=>{const n=Object.entries(e),o=n.length;for(let i=0;i<o;i++){const[c,l]=n[i];kr(l,ca(t,c),s,r)}},ca=(e,t)=>{let s=e;const r=t.split(Ns),n=r.length;for(let o=0;o<n;o++){const i=r[o];let c=s.nextPart.get(i);c||(c=aa(),s.nextPart.set(i,c)),s=c}return s},Nu=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Cu=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,s=Object.create(null),r=Object.create(null);const n=(o,i)=>{s[o]=i,t++,t>e&&(t=0,r=s,s=Object.create(null))};return{get(o){let i=s[o];if(i!==void 0)return i;if((i=r[o])!==void 0)return n(o,i),i},set(o,i){o in s?s[o]=i:n(o,i)}}},fr="!",Ln=":",_u=[],Mn=(e,t,s,r,n)=>({modifiers:e,hasImportantModifier:t,baseClassName:s,maybePostfixModifierPosition:r,isExternal:n}),ku=e=>{const{prefix:t,experimentalParseClassName:s}=e;let r=n=>{const o=[];let i=0,c=0,l=0,d;const f=n.length;for(let g=0;g<f;g++){const x=n[g];if(i===0&&c===0){if(x===Ln){o.push(n.slice(l,g)),l=g+1;continue}if(x==="/"){d=g;continue}}x==="["?i++:x==="]"?i--:x==="("?c++:x===")"&&c--}const u=o.length===0?n:n.slice(l);let h=u,m=!1;u.endsWith(fr)?(h=u.slice(0,-1),m=!0):u.startsWith(fr)&&(h=u.slice(1),m=!0);const p=d&&d>l?d-l:void 0;return Mn(o,m,h,p)};if(t){const n=t+Ln,o=r;r=i=>i.startsWith(n)?o(i.slice(n.length)):Mn(_u,!1,i,void 0,!0)}if(s){const n=r;r=o=>s({className:o,parseClassName:n})}return r},Eu=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((s,r)=>{t.set(s,1e6+r)}),s=>{const r=[];let n=[];for(let o=0;o<s.length;o++){const i=s[o],c=i[0]==="[",l=t.has(i);c||l?(n.length>0&&(n.sort(),r.push(...n),n=[]),r.push(i)):n.push(i)}return n.length>0&&(n.sort(),r.push(...n)),r}},Pu=e=>({cache:Cu(e.cacheSize),parseClassName:ku(e),sortModifiers:Eu(e),postfixLookupClassGroupIds:Tu(e),...xu(e)}),Tu=e=>{const t=Object.create(null),s=e.postfixLookupClassGroups;if(s)for(let r=0;r<s.length;r++)t[s[r]]=!0;return t},Au=/\s+/,Ou=(e,t)=>{const{parseClassName:s,getClassGroupId:r,getConflictingClassGroupIds:n,sortModifiers:o,postfixLookupClassGroupIds:i}=t,c=[],l=e.trim().split(Au);let d="";for(let f=l.length-1;f>=0;f-=1){const u=l[f],{isExternal:h,modifiers:m,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:x}=s(u);if(h){d=u+(d.length>0?" "+d:d);continue}let b=!!x,y;if(b){const C=g.substring(0,x);y=r(C);const R=y&&i[y]?r(g):void 0;R&&R!==y&&(y=R,b=!1)}else y=r(g);if(!y){if(!b){d=u+(d.length>0?" "+d:d);continue}if(y=r(g),!y){d=u+(d.length>0?" "+d:d);continue}b=!1}const S=m.length===0?"":m.length===1?m[0]:o(m).join(":"),w=p?S+fr:S,N=w+y;if(c.indexOf(N)>-1)continue;c.push(N);const _=n(y,b);for(let C=0;C<_.length;++C){const R=_[C];c.push(w+R)}d=u+(d.length>0?" "+d:d)}return d},Lu=(...e)=>{let t=0,s,r,n="";for(;t<e.length;)(s=e[t++])&&(r=la(s))&&(n&&(n+=" "),n+=r);return n},la=e=>{if(typeof e=="string")return e;let t,s="";for(let r=0;r<e.length;r++)e[r]&&(t=la(e[r]))&&(s&&(s+=" "),s+=t);return s},Mu=(e,...t)=>{let s,r,n,o;const i=l=>{const d=t.reduce((f,u)=>u(f),e());return s=Pu(d),r=s.cache.get,n=s.cache.set,o=c,c(l)},c=l=>{const d=r(l);if(d)return d;const f=Ou(l,s);return n(l,f),f};return o=i,(...l)=>o(Lu(...l))},Iu=[],ae=e=>{const t=s=>s[e]||Iu;return t.isThemeGetter=!0,t},da=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ua=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Du=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Fu=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Uu=/\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$/,$u=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Bu=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,zu=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Be=e=>Du.test(e),H=e=>!!e&&!Number.isNaN(Number(e)),Ae=e=>!!e&&Number.isInteger(Number(e)),Zs=e=>e.endsWith("%")&&H(e.slice(0,-1)),Ie=e=>Fu.test(e),fa=()=>!0,Vu=e=>Uu.test(e)&&!$u.test(e),Er=()=>!1,Wu=e=>Bu.test(e),Hu=e=>zu.test(e),qu=e=>!A(e)&&!O(e),Gu=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)),Ku=e=>Ge(e,pa,Er),A=e=>da.test(e),Je=e=>Ge(e,ga,Vu),In=e=>Ge(e,sf,H),Yu=e=>Ge(e,ba,fa),Ju=e=>Ge(e,xa,Er),Dn=e=>Ge(e,ha,Er),Xu=e=>Ge(e,ma,Hu),ts=e=>Ge(e,ya,Wu),O=e=>ua.test(e),Ot=e=>ut(e,ga),Zu=e=>ut(e,xa),Fn=e=>ut(e,ha),Qu=e=>ut(e,pa),ef=e=>ut(e,ma),ss=e=>ut(e,ya,!0),tf=e=>ut(e,ba,!0),Ge=(e,t,s)=>{const r=da.exec(e);return r?r[1]?t(r[1]):s(r[2]):!1},ut=(e,t,s=!1)=>{const r=ua.exec(e);return r?r[1]?t(r[1]):s:!1},ha=e=>e==="position"||e==="percentage",ma=e=>e==="image"||e==="url",pa=e=>e==="length"||e==="size"||e==="bg-size",ga=e=>e==="length",sf=e=>e==="number",xa=e=>e==="family-name",ba=e=>e==="number"||e==="weight",ya=e=>e==="shadow",rf=()=>{const e=ae("color"),t=ae("font"),s=ae("text"),r=ae("font-weight"),n=ae("tracking"),o=ae("leading"),i=ae("breakpoint"),c=ae("container"),l=ae("spacing"),d=ae("radius"),f=ae("shadow"),u=ae("inset-shadow"),h=ae("text-shadow"),m=ae("drop-shadow"),p=ae("blur"),g=ae("perspective"),x=ae("aspect"),b=ae("ease"),y=ae("animate"),S=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],N=()=>[...w(),O,A],_=()=>["auto","hidden","clip","visible","scroll"],C=()=>["auto","contain","none"],R=()=>[O,A,l],E=()=>[Be,"full","auto",...R()],D=()=>[Ae,"none","subgrid",O,A],L=()=>["auto",{span:["full",Ae,O,A]},Ae,O,A],F=()=>[Ae,"auto",O,A],ee=()=>["auto","min","max","fr",O,A],V=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Z=()=>["start","end","center","stretch","center-safe","end-safe"],Q=()=>["auto",...R()],Y=()=>[Be,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],le=()=>[Be,"screen","full","dvw","lvw","svw","min","max","fit",...R()],fe=()=>[Be,"screen","full","lh","dvh","lvh","svh","min","max","fit",...R()],T=()=>[e,O,A],j=()=>[...w(),Fn,Dn,{position:[O,A]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],W=()=>["auto","cover","contain",Qu,Ku,{size:[O,A]}],q=()=>[Zs,Ot,Je],M=()=>["","none","full",d,O,A],I=()=>["",H,Ot,Je],$=()=>["solid","dashed","dotted","double"],J=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],G=()=>[H,Zs,Fn,Dn],de=()=>["","none",p,O,A],be=()=>["none",H,O,A],ne=()=>["none",H,O,A],Me=()=>[H,O,A],_e=()=>[Be,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ie],breakpoint:[Ie],color:[fa],container:[Ie],"drop-shadow":[Ie],ease:["in","out","in-out"],font:[qu],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ie],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ie],shadow:[Ie],spacing:["px",H],text:[Ie],"text-shadow":[Ie],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Be,A,O,x]}],container:["container"],"container-type":[{"@container":["","normal","size",O,A]}],"container-named":[Gu],columns:[{columns:[H,A,O,c]}],"break-after":[{"break-after":S()}],"break-before":[{"break-before":S()}],"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:N()}],overflow:[{overflow:_()}],"overflow-x":[{"overflow-x":_()}],"overflow-y":[{"overflow-y":_()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:E()}],"inset-x":[{"inset-x":E()}],"inset-y":[{"inset-y":E()}],start:[{"inset-s":E(),start:E()}],end:[{"inset-e":E(),end:E()}],"inset-bs":[{"inset-bs":E()}],"inset-be":[{"inset-be":E()}],top:[{top:E()}],right:[{right:E()}],bottom:[{bottom:E()}],left:[{left:E()}],visibility:["visible","invisible","collapse"],z:[{z:[Ae,"auto",O,A]}],basis:[{basis:[Be,"full","auto",c,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[H,Be,"auto","initial","none",A]}],grow:[{grow:["",H,O,A]}],shrink:[{shrink:["",H,O,A]}],order:[{order:[Ae,"first","last","none",O,A]}],"grid-cols":[{"grid-cols":D()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":D()}],"row-start-end":[{row:L()}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ee()}],"auto-rows":[{"auto-rows":ee()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...V(),"normal"]}],"justify-items":[{"justify-items":[...Z(),"normal"]}],"justify-self":[{"justify-self":["auto",...Z()]}],"align-content":[{content:["normal",...V()]}],"align-items":[{items:[...Z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Z(),{baseline:["","last"]}]}],"place-content":[{"place-content":V()}],"place-items":[{"place-items":[...Z(),"baseline"]}],"place-self":[{"place-self":["auto",...Z()]}],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:Q()}],mx:[{mx:Q()}],my:[{my:Q()}],ms:[{ms:Q()}],me:[{me:Q()}],mbs:[{mbs:Q()}],mbe:[{mbe:Q()}],mt:[{mt:Q()}],mr:[{mr:Q()}],mb:[{mb:Q()}],ml:[{ml:Q()}],"space-x":[{"space-x":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:Y()}],"inline-size":[{inline:["auto",...le()]}],"min-inline-size":[{"min-inline":["auto",...le()]}],"max-inline-size":[{"max-inline":["none",...le()]}],"block-size":[{block:["auto",...fe()]}],"min-block-size":[{"min-block":["auto",...fe()]}],"max-block-size":[{"max-block":["none",...fe()]}],w:[{w:[c,"screen",...Y()]}],"min-w":[{"min-w":[c,"screen","none",...Y()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[i]},...Y()]}],h:[{h:["screen","lh",...Y()]}],"min-h":[{"min-h":["screen","lh","none",...Y()]}],"max-h":[{"max-h":["screen","lh",...Y()]}],"font-size":[{text:["base",s,Ot,Je]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,tf,Yu]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Zs,A]}],"font-family":[{font:[Zu,Ju,t]}],"font-features":[{"font-features":[A]}],"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:[n,O,A]}],"line-clamp":[{"line-clamp":[H,"none",O,In]}],leading:[{leading:[o,...R()]}],"list-image":[{"list-image":["none",O,A]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",O,A]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:T()}],"text-color":[{text:T()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...$(),"wavy"]}],"text-decoration-thickness":[{decoration:[H,"from-font","auto",O,Je]}],"text-decoration-color":[{decoration:T()}],"underline-offset":[{"underline-offset":[H,"auto",O,A]}],"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:[Ae,O,A]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",O,A]}],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",O,A]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:j()}],"bg-repeat":[{bg:U()}],"bg-size":[{bg:W()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ae,O,A],radial:["",O,A],conic:[Ae,O,A]},ef,Xu]}],"bg-color":[{bg:T()}],"gradient-from-pos":[{from:q()}],"gradient-via-pos":[{via:q()}],"gradient-to-pos":[{to:q()}],"gradient-from":[{from:T()}],"gradient-via":[{via:T()}],"gradient-to":[{to:T()}],rounded:[{rounded:M()}],"rounded-s":[{"rounded-s":M()}],"rounded-e":[{"rounded-e":M()}],"rounded-t":[{"rounded-t":M()}],"rounded-r":[{"rounded-r":M()}],"rounded-b":[{"rounded-b":M()}],"rounded-l":[{"rounded-l":M()}],"rounded-ss":[{"rounded-ss":M()}],"rounded-se":[{"rounded-se":M()}],"rounded-ee":[{"rounded-ee":M()}],"rounded-es":[{"rounded-es":M()}],"rounded-tl":[{"rounded-tl":M()}],"rounded-tr":[{"rounded-tr":M()}],"rounded-br":[{"rounded-br":M()}],"rounded-bl":[{"rounded-bl":M()}],"border-w":[{border:I()}],"border-w-x":[{"border-x":I()}],"border-w-y":[{"border-y":I()}],"border-w-s":[{"border-s":I()}],"border-w-e":[{"border-e":I()}],"border-w-bs":[{"border-bs":I()}],"border-w-be":[{"border-be":I()}],"border-w-t":[{"border-t":I()}],"border-w-r":[{"border-r":I()}],"border-w-b":[{"border-b":I()}],"border-w-l":[{"border-l":I()}],"divide-x":[{"divide-x":I()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":I()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...$(),"hidden","none"]}],"divide-style":[{divide:[...$(),"hidden","none"]}],"border-color":[{border:T()}],"border-color-x":[{"border-x":T()}],"border-color-y":[{"border-y":T()}],"border-color-s":[{"border-s":T()}],"border-color-e":[{"border-e":T()}],"border-color-bs":[{"border-bs":T()}],"border-color-be":[{"border-be":T()}],"border-color-t":[{"border-t":T()}],"border-color-r":[{"border-r":T()}],"border-color-b":[{"border-b":T()}],"border-color-l":[{"border-l":T()}],"divide-color":[{divide:T()}],"outline-style":[{outline:[...$(),"none","hidden"]}],"outline-offset":[{"outline-offset":[H,O,A]}],"outline-w":[{outline:["",H,Ot,Je]}],"outline-color":[{outline:T()}],shadow:[{shadow:["","none",f,ss,ts]}],"shadow-color":[{shadow:T()}],"inset-shadow":[{"inset-shadow":["none",u,ss,ts]}],"inset-shadow-color":[{"inset-shadow":T()}],"ring-w":[{ring:I()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:T()}],"ring-offset-w":[{"ring-offset":[H,Je]}],"ring-offset-color":[{"ring-offset":T()}],"inset-ring-w":[{"inset-ring":I()}],"inset-ring-color":[{"inset-ring":T()}],"text-shadow":[{"text-shadow":["none",h,ss,ts]}],"text-shadow-color":[{"text-shadow":T()}],opacity:[{opacity:[H,O,A]}],"mix-blend":[{"mix-blend":[...J(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":J()}],"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":[H]}],"mask-image-linear-from-pos":[{"mask-linear-from":G()}],"mask-image-linear-to-pos":[{"mask-linear-to":G()}],"mask-image-linear-from-color":[{"mask-linear-from":T()}],"mask-image-linear-to-color":[{"mask-linear-to":T()}],"mask-image-t-from-pos":[{"mask-t-from":G()}],"mask-image-t-to-pos":[{"mask-t-to":G()}],"mask-image-t-from-color":[{"mask-t-from":T()}],"mask-image-t-to-color":[{"mask-t-to":T()}],"mask-image-r-from-pos":[{"mask-r-from":G()}],"mask-image-r-to-pos":[{"mask-r-to":G()}],"mask-image-r-from-color":[{"mask-r-from":T()}],"mask-image-r-to-color":[{"mask-r-to":T()}],"mask-image-b-from-pos":[{"mask-b-from":G()}],"mask-image-b-to-pos":[{"mask-b-to":G()}],"mask-image-b-from-color":[{"mask-b-from":T()}],"mask-image-b-to-color":[{"mask-b-to":T()}],"mask-image-l-from-pos":[{"mask-l-from":G()}],"mask-image-l-to-pos":[{"mask-l-to":G()}],"mask-image-l-from-color":[{"mask-l-from":T()}],"mask-image-l-to-color":[{"mask-l-to":T()}],"mask-image-x-from-pos":[{"mask-x-from":G()}],"mask-image-x-to-pos":[{"mask-x-to":G()}],"mask-image-x-from-color":[{"mask-x-from":T()}],"mask-image-x-to-color":[{"mask-x-to":T()}],"mask-image-y-from-pos":[{"mask-y-from":G()}],"mask-image-y-to-pos":[{"mask-y-to":G()}],"mask-image-y-from-color":[{"mask-y-from":T()}],"mask-image-y-to-color":[{"mask-y-to":T()}],"mask-image-radial":[{"mask-radial":[O,A]}],"mask-image-radial-from-pos":[{"mask-radial-from":G()}],"mask-image-radial-to-pos":[{"mask-radial-to":G()}],"mask-image-radial-from-color":[{"mask-radial-from":T()}],"mask-image-radial-to-color":[{"mask-radial-to":T()}],"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":w()}],"mask-image-conic-pos":[{"mask-conic":[H]}],"mask-image-conic-from-pos":[{"mask-conic-from":G()}],"mask-image-conic-to-pos":[{"mask-conic-to":G()}],"mask-image-conic-from-color":[{"mask-conic-from":T()}],"mask-image-conic-to-color":[{"mask-conic-to":T()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:j()}],"mask-repeat":[{mask:U()}],"mask-size":[{mask:W()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",O,A]}],filter:[{filter:["","none",O,A]}],blur:[{blur:de()}],brightness:[{brightness:[H,O,A]}],contrast:[{contrast:[H,O,A]}],"drop-shadow":[{"drop-shadow":["","none",m,ss,ts]}],"drop-shadow-color":[{"drop-shadow":T()}],grayscale:[{grayscale:["",H,O,A]}],"hue-rotate":[{"hue-rotate":[H,O,A]}],invert:[{invert:["",H,O,A]}],saturate:[{saturate:[H,O,A]}],sepia:[{sepia:["",H,O,A]}],"backdrop-filter":[{"backdrop-filter":["","none",O,A]}],"backdrop-blur":[{"backdrop-blur":de()}],"backdrop-brightness":[{"backdrop-brightness":[H,O,A]}],"backdrop-contrast":[{"backdrop-contrast":[H,O,A]}],"backdrop-grayscale":[{"backdrop-grayscale":["",H,O,A]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[H,O,A]}],"backdrop-invert":[{"backdrop-invert":["",H,O,A]}],"backdrop-opacity":[{"backdrop-opacity":[H,O,A]}],"backdrop-saturate":[{"backdrop-saturate":[H,O,A]}],"backdrop-sepia":[{"backdrop-sepia":["",H,O,A]}],"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",O,A]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[H,"initial",O,A]}],ease:[{ease:["linear","initial",b,O,A]}],delay:[{delay:[H,O,A]}],animate:[{animate:["none",y,O,A]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,O,A]}],"perspective-origin":[{"perspective-origin":N()}],rotate:[{rotate:be()}],"rotate-x":[{"rotate-x":be()}],"rotate-y":[{"rotate-y":be()}],"rotate-z":[{"rotate-z":be()}],scale:[{scale:ne()}],"scale-x":[{"scale-x":ne()}],"scale-y":[{"scale-y":ne()}],"scale-z":[{"scale-z":ne()}],"scale-3d":["scale-3d"],skew:[{skew:Me()}],"skew-x":[{"skew-x":Me()}],"skew-y":[{"skew-y":Me()}],transform:[{transform:[O,A,"","none","gpu","cpu"]}],"transform-origin":[{origin:N()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:_e()}],"translate-x":[{"translate-x":_e()}],"translate-y":[{"translate-y":_e()}],"translate-z":[{"translate-z":_e()}],"translate-none":["translate-none"],zoom:[{zoom:[Ae,O,A]}],accent:[{accent:T()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:T()}],"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",O,A]}],"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":T()}],"scrollbar-track-color":[{"scrollbar-track":T()}],"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",O,A]}],fill:[{fill:["none",...T()]}],"stroke-w":[{stroke:[H,Ot,Je,In]}],stroke:[{stroke:["none",...T()]}],"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"]}},nf=Mu(rf);function Nt(...e){return nf(hu(e))}function K(e,t="USD"){return new Intl.NumberFormat("en-US",{style:"currency",currency:t,minimumFractionDigits:2}).format(e)}const ie=B.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,className:Nt("rounded-xl border bg-card text-card-foreground shadow",e),...t}));ie.displayName="Card";const ve=B.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,className:Nt("flex flex-col space-y-1.5 p-6",e),...t}));ve.displayName="CardHeader";const Ne=B.forwardRef(({className:e,...t},s)=>a.jsx("h3",{ref:s,className:Nt("font-semibold leading-none tracking-tight",e),...t}));Ne.displayName="CardTitle";const of=B.forwardRef(({className:e,...t},s)=>a.jsx("p",{ref:s,className:Nt("text-sm text-muted-foreground",e),...t}));of.displayName="CardDescription";const ce=B.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,className:Nt("p-6 pt-0",e),...t}));ce.displayName="CardContent";const af=B.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,className:Nt("flex items-center p-6 pt-0",e),...t}));af.displayName="CardFooter";function Cs({status:e,error:t}){const s=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(lt,{className:"mt-0.5 h-5 w-5 shrink-0 text-destructive"}):a.jsx(Zo,{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:s?"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(vs,{to:s?"/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(ea,{className:"h-4 w-4"}),s?"Connect AWS source":"Review CUR discovery"]}),!s&&a.jsx(vs,{to:"/sources",className:"rounded-md border px-3 py-2 text-sm font-medium hover:bg-muted",children:"Cost sources"})]})]})]})})}function cf({points:e,currency:t="USD"}){const[s,r]=k.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 n=900,o=260,i=70,c=24,l=22,d=48,f=n-i-c,u=o-l-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:l+u-x.value/h*u})),p=s==null?null:m[s],g=x=>{const b=x.currentTarget.getBoundingClientRect(),y=(x.clientX-b.left)/b.width*n;let S=0;for(let w=1;w<m.length;w+=1)Math.abs(m[w].x-y)<Math.abs(m[S].x-y)&&(S=w);r(S)};return a.jsxs("div",{className:"relative w-full",children:[a.jsxs("svg",{viewBox:`0 0 ${n} ${o}`,className:"h-72 w-full",onMouseMove:g,onMouseLeave:()=>r(null),role:"img","aria-label":"Cost trend line chart",children:[[0,.25,.5,.75,1].map(x=>{const b=l+u*x;return a.jsxs("g",{children:[a.jsx("line",{x1:i,y1:b,x2:n-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:K(h*(1-x),t)})]},x)}),a.jsx("line",{x1:i,y1:l+u,x2:n-c,y2:l+u,stroke:"#aebbc5"}),a.jsx("polyline",{points:m.map(x=>`${x.x},${x.y}`).join(" "),fill:"none",stroke:"#1f5f85",strokeWidth:"4",strokeLinejoin:"round",strokeLinecap:"round"}),p&&a.jsx("line",{x1:p.x,y1:l,x2:p.x,y2:l+u,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:s===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))]}),p&&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:`${p.x/n*100}%`,top:`${Math.max(p.y/o*100-4,2)}%`,transform:p.x>n*.75?"translate(-100%, -100%)":"translate(-50%, -100%)"},children:[a.jsx("p",{className:"text-xs font-semibold",children:p.label}),a.jsx("p",{className:"mt-1 text-sm font-bold text-primary",children:K(p.value,t)}),p.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:K(x.value,t)})]},x.label))]})]})}const Un=e=>e.length>16?`${e.slice(0,14)}...`:e,lf=(e,t)=>new Intl.NumberFormat("en-US",{style:"currency",currency:t||"USD",notation:"compact",maximumFractionDigits:1}).format(e);function df({title:e,items:t,currency:s}){const o={top:38,right:18,bottom:72,left:76},i=720-o.left-o.right,c=320-o.top-o.bottom,l=Math.max(...t.map(u=>u.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(u=>{const h=o.top+c-u*c;return a.jsxs("g",{children:[a.jsx("line",{x1:o.left,y1:h,x2:720-o.right,y2:h,stroke:"currentColor",opacity:u===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:lf(l*u,s)})]},u)}),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((u,h)=>{const m=o.left+d*h+d/2,p=Math.max(u.amount/l*c,3),g=o.top+c-p;return a.jsxs("g",{tabIndex:0,"aria-label":`${u.label}: ${K(u.amount,s)}`,className:"outline-none focus-visible:opacity-75",children:[a.jsxs("title",{children:[u.label,": ",K(u.amount,s)]}),a.jsx("rect",{x:m-f/2,y:g,width:f,height:p,rx:"4",className:"fill-primary opacity-80 transition-opacity hover:opacity-100"}),a.jsx("text",{x:m,y:Math.max(g-8,16),textAnchor:"middle",fill:"currentColor",fontSize:"11",fontWeight:"600",children:K(u.amount,s)}),a.jsx("text",{x:m,y:278,textAnchor:"middle",fill:"currentColor",opacity:"0.72",fontSize:"11",children:Un(u.label)}),u.accountId&&a.jsx("text",{x:m,y:295,textAnchor:"middle",fill:"currentColor",opacity:"0.55",fontSize:"9",children:Un(u.accountId)})]},u.key||u.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 (",s,")"]})]})}const va="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 Qs({title:e,icon:t,items:s,currency:r}){const[n,o]=k.useState("chart"),i=s.slice(0,6),c=Math.max(...i.map(l=>l.amount),1);return a.jsxs(ie,{className:"min-w-0",children:[a.jsxs(ve,{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(Ne,{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":n==="chart",title:"Bar chart",className:`rounded p-1.5 ${n==="chart"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"}`,children:a.jsx(Td,{className:"h-4 w-4"})}),a.jsx("button",{type:"button",onClick:()=>o("list"),"aria-label":`Show ${e} as list`,"aria-pressed":n==="list",title:"List",className:`rounded p-1.5 ${n==="list"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"}`,children:a.jsx(Zd,{className:"h-4 w-4"})})]})]}),a.jsx(ce,{children:i.length?n==="chart"?a.jsx(df,{title:e,items:i,currency:r}):a.jsx("div",{className:"space-y-3",children:i.map(l=>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:l.label,children:[l.label,l.accountId?a.jsxs("span",{className:"ml-1 text-xs",children:["(",l.accountId,")"]}):null]}),a.jsx("span",{className:"shrink-0 font-medium",children:K(l.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:`${l.amount/c*100}%`}})})]},l.key||l.label))}):a.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No cost data for this period."})})]})}function uf(){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(ie,{className:va,children:[a.jsx(ve,{className:"pb-2",children:a.jsx("div",{className:"h-3 w-24 animate-pulse rounded bg-muted"})}),a.jsxs(ce,{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(ie,{children:[a.jsx(ve,{children:a.jsx("div",{className:"h-4 w-36 animate-pulse rounded bg-muted"})}),a.jsx(ce,{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(ie,{children:[a.jsx(ve,{children:a.jsx("div",{className:"h-4 w-32 animate-pulse rounded bg-muted"})}),a.jsx(ce,{className:"space-y-4",children:Array.from({length:5},(s,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 ff({data:e,period:t,selectedMonth:s}){const r=e.topServices[0],n=e.topAccounts[0],o=new Date,[i,c]=s.split("-").map(Number),l=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:K(e.totalCost,e.currency)}),a.jsxs("span",{className:"mt-1 block text-sm font-medium text-muted-foreground",children:["Accounts: ",e.activeAccounts]})]}),helper:l,icon:a.jsx(Qo,{})},{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:`${l} across all accounts`,icon:a.jsx(js,{})},{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,s){typeof t=="string"?(s=s||{},s.url=t):s=t||{},s=ct(this.defaults,s);const{transitional:r,paramsSerializer:n,headers:o}=s;r!==void 0&&hs.assertOptions(r,{silentJSONParsing:pe.transitional(pe.boolean),forcedJSONParsing:pe.transitional(pe.boolean),clarifyTimeoutError:pe.transitional(pe.boolean),legacyInterceptorReqResOrdering:pe.transitional(pe.boolean),advertiseZstdAcceptEncoding:pe.transitional(pe.boolean),validateStatusUndefinedResolves:pe.transitional(pe.boolean)},!1),n!=null&&(v.isFunction(n)?s.paramsSerializer={serialize:n}:hs.assertOptions(n,{encode:pe.function,serialize:pe.function},!0)),s.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?s.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:s.allowAbsoluteUrls=!0),hs.assertOptions(s,{baseUrl:pe.spelling("baseURL"),withXsrfToken:pe.spelling("withXSRFToken")},!0),s.method=(s.method||this.defaults.method||"get").toLowerCase();let i=o&&v.merge(o.common,o[s.method]);o&&v.forEach(["delete","get","head","post","put","patch","query","common"],p=>{delete o[p]}),s.headers=xe.concat(i,o);const c=[];let l=!0;this.interceptors.request.forEach(function(g){if(typeof g.runWhen=="function"&&g.runWhen(s)===!1)return;l=l&&g.synchronous;const x=s.transitional||Sr;x&&x.legacyInterceptorReqResOrdering?c.unshift(g.fulfilled,g.rejected):c.push(g.fulfilled,g.rejected)});const d=[];this.interceptors.response.forEach(function(g){d.push(g.fulfilled,g.rejected)});let f,u=0,h;if(!l){const p=[En.bind(this),void 0];for(p.unshift(...c),p.push(...d),h=p.length,f=Promise.resolve(s);u<h;)f=f.then(p[u++],p[u++]);return f}h=c.length;let m=s;for(;u<h;){const p=c[u++],g=c[u++];try{m=p(m)}catch(x){g.call(this,x);break}}try{f=En.call(this,m)}catch(p){return Promise.reject(p)}for(u=0,h=d.length;u<h;)f=f.then(d[u++],d[u++]);return f}getUri(t){t=ct(this.defaults,t);const s=Vo(t.baseURL,t.url,t.allowAbsoluteUrls,t);return Fo(s,t.params,t.paramsSerializer)}};v.forEach(["delete","get","head","options"],function(t){ot.prototype[t]=function(s,r){return this.request(ct(r||{},{method:t,url:s,data:r&&v.hasOwnProp(r,"data")?r.data:void 0}))}});v.forEach(["post","put","patch","query"],function(t){function s(r){return function(o,i,c){return this.request(ct(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:o,data:i}))}}ot.prototype[t]=s(),t!=="query"&&(ot.prototype[t+"Form"]=s(!0))});let bd=class Go{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let s;this.promise=new Promise(function(o){s=o});const r=this;this.promise.then(n=>{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](n);r._listeners=null}),this.promise.then=n=>{let o;const i=new Promise(c=>{r.subscribe(c),o=c}).then(n);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,c){r.reason||(r.reason=new qt(o,i,c),s(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 s=this._listeners.indexOf(t);s!==-1&&this._listeners.splice(s,1)}toAbortSignal(){const t=new AbortController,s=r=>{t.abort(r)};return this.subscribe(s),t.signal.unsubscribe=()=>this.unsubscribe(s),t.signal}static source(){let t;return{token:new Go(function(n){t=n}),cancel:t}}};function yd(e){return function(s){return e.apply(null,s)}}function vd(e){return v.isObject(e)&&e.isAxiosError===!0}const ur={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(ur).forEach(([e,t])=>{ur[t]=e});function Ko(e){const t=new ot(e),s=jo(ot.prototype.request,t);return v.extend(s,ot.prototype,t,{allOwnKeys:!0}),v.extend(s,t,null,{allOwnKeys:!0}),s.create=function(n){return Ko(ct(e,n))},s}const oe=Ko(Ht);oe.Axios=ot;oe.CanceledError=qt;oe.CancelToken=bd;oe.isCancel=Bo;oe.VERSION=jr;oe.toFormData=Ts;oe.AxiosError=P;oe.Cancel=oe.CanceledError;oe.all=function(t){return Promise.all(t)};oe.spread=yd;oe.isAxiosError=vd;oe.mergeConfig=ct;oe.AxiosHeaders=xe;oe.formToJSON=e=>$o(v.isHTMLForm(e)?new FormData(e):e);oe.getAdapter=qo.getAdapter;oe.HttpStatusCode=ur;oe.default=oe;const{Axios:rh,AxiosError:nh,CanceledError:oh,isCancel:ah,CancelToken:ih,VERSION:ch,all:lh,Cancel:dh,isAxiosError:uh,spread:fh,toFormData:hh,AxiosHeaders:mh,HttpStatusCode:ph,formToJSON:gh,getAdapter:xh,mergeConfig:bh,create:yh}=oe,re=oe.create({baseURL:"/api/v1/cost"});function Yo(e,t){re.defaults.baseURL=`${e.replace(/\/$/,"")}/cost`,t?re.defaults.headers.common.Authorization=`Bearer ${t}`:delete re.defaults.headers.common.Authorization}function wd(e){e.interceptors.request.use(t=>{if(typeof window<"u"){const s=window.localStorage.getItem("access_token");s?(t.headers=t.headers||{},t.headers.Authorization=`Bearer ${s}`):t.headers&&delete t.headers.Authorization}return t})}const Sd=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Rd=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,s,r)=>r?r.toUpperCase():s.toLowerCase()),Tn=e=>{const t=Rd(e);return t.charAt(0).toUpperCase()+t.slice(1)},Jo=(...e)=>e.filter((t,s,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===s).join(" ").trim(),jd=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var Nd={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 Cd=k.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:s=2,absoluteStrokeWidth:r,className:n="",children:o,iconNode:i,...c},l)=>k.createElement("svg",{ref:l,...Nd,width:t,height:t,stroke:e,strokeWidth:r?Number(s)*24/Number(t):s,className:Jo("lucide",n),...!o&&!jd(c)&&{"aria-hidden":"true"},...c},[...i.map(([d,f])=>k.createElement(d,f)),...Array.isArray(o)?o:[o]]));const X=(e,t)=>{const s=k.forwardRef(({className:r,...n},o)=>k.createElement(Cd,{ref:o,iconNode:t,className:Jo(`lucide-${Sd(Tn(e))}`,`lucide-${e}`,r),...n}));return s.displayName=Tn(e),s};const _d=[["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"}]],kd=X("building-2",_d);const Ed=[["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"}]],Xo=X("calendar-clock",Ed);const Pd=[["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"}]],Td=X("chart-column",Pd);const Ad=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Od=X("chevron-down",Ad);const Ld=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Md=X("chevron-left",Ld);const Id=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Dd=X("chevron-right",Id);const Fd=[["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"}]],lt=X("circle-alert",Fd);const Ud=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],$d=X("circle-check",Ud);const Bd=[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]],js=X("cloud",Bd);const zd=[["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"}]],Zo=X("database",zd);const Vd=[["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"}]],Qo=X("dollar-sign",Vd);const Wd=[["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"}]],Cr=X("download",Wd);const Hd=[["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"}]],ea=X("external-link",Hd);const qd=[["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"}]],Gd=X("eye",qd);const Kd=[["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"}]],Yd=X("file-down",Kd);const Jd=[["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"}]],ta=X("file-text",Jd);const Xd=[["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"}]],Zd=X("list",Xd);const Qd=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],bt=X("loader-circle",Qd);const eu=[["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"}]],tu=X("map-pin",eu);const su=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ru=X("plus",su);const nu=[["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"}]],St=X("refresh-cw",nu);const ou=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],_r=X("search",ou);const au=[["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"}]],sa=X("server",au);const iu=[["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"}]],ra=X("settings-2",iu);const cu=[["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"}]],An=X("sparkles",cu);const lu=[["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"}]],du=X("trash-2",lu);const uu=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],fu=X("trending-down",uu);const hu=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],na=X("trending-up",hu);const mu=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Os=X("x",mu);function oa(e){var t,s,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var n=e.length;for(t=0;t<n;t++)e[t]&&(s=oa(e[t]))&&(r&&(r+=" "),r+=s)}else for(s in e)e[s]&&(r&&(r+=" "),r+=s);return r}function pu(){for(var e,t,s=0,r="",n=arguments.length;s<n;s++)(e=arguments[s])&&(t=oa(e))&&(r&&(r+=" "),r+=t);return r}const gu=(e,t)=>{const s=new Array(e.length+t.length);for(let r=0;r<e.length;r++)s[r]=e[r];for(let r=0;r<t.length;r++)s[e.length+r]=t[r];return s},xu=(e,t)=>({classGroupId:e,validator:t}),aa=(e=new Map,t=null,s)=>({nextPart:e,validators:t,classGroupId:s}),Ns="-",On=[],bu="arbitrary..",yu=e=>{const t=wu(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return vu(i);const c=i.split(Ns),l=c[0]===""&&c.length>1?1:0;return ia(c,l,t)},getConflictingClassGroupIds:(i,c)=>{if(c){const l=r[i],d=s[i];return l?d?gu(d,l):l:d||On}return s[i]||On}}},ia=(e,t,s)=>{if(e.length-t===0)return s.classGroupId;const n=e[t],o=s.nextPart.get(n);if(o){const d=ia(e,t+1,o);if(d)return d}const i=s.validators;if(i===null)return;const c=t===0?e.join(Ns):e.slice(t).join(Ns),l=i.length;for(let d=0;d<l;d++){const f=i[d];if(f.validator(c))return f.classGroupId}},vu=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),s=t.indexOf(":"),r=t.slice(0,s);return r?bu+r:void 0})(),wu=e=>{const{theme:t,classGroups:s}=e;return Su(s,t)},Su=(e,t)=>{const s=aa();for(const r in e){const n=e[r];kr(n,s,r,t)}return s},kr=(e,t,s,r)=>{const n=e.length;for(let o=0;o<n;o++){const i=e[o];Ru(i,t,s,r)}},Ru=(e,t,s,r)=>{if(typeof e=="string"){ju(e,t,s);return}if(typeof e=="function"){Nu(e,t,s,r);return}Cu(e,t,s,r)},ju=(e,t,s)=>{const r=e===""?t:ca(t,e);r.classGroupId=s},Nu=(e,t,s,r)=>{if(_u(e)){kr(e(r),t,s,r);return}t.validators===null&&(t.validators=[]),t.validators.push(xu(s,e))},Cu=(e,t,s,r)=>{const n=Object.entries(e),o=n.length;for(let i=0;i<o;i++){const[c,l]=n[i];kr(l,ca(t,c),s,r)}},ca=(e,t)=>{let s=e;const r=t.split(Ns),n=r.length;for(let o=0;o<n;o++){const i=r[o];let c=s.nextPart.get(i);c||(c=aa(),s.nextPart.set(i,c)),s=c}return s},_u=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,ku=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,s=Object.create(null),r=Object.create(null);const n=(o,i)=>{s[o]=i,t++,t>e&&(t=0,r=s,s=Object.create(null))};return{get(o){let i=s[o];if(i!==void 0)return i;if((i=r[o])!==void 0)return n(o,i),i},set(o,i){o in s?s[o]=i:n(o,i)}}},fr="!",Ln=":",Eu=[],Mn=(e,t,s,r,n)=>({modifiers:e,hasImportantModifier:t,baseClassName:s,maybePostfixModifierPosition:r,isExternal:n}),Pu=e=>{const{prefix:t,experimentalParseClassName:s}=e;let r=n=>{const o=[];let i=0,c=0,l=0,d;const f=n.length;for(let g=0;g<f;g++){const x=n[g];if(i===0&&c===0){if(x===Ln){o.push(n.slice(l,g)),l=g+1;continue}if(x==="/"){d=g;continue}}x==="["?i++:x==="]"?i--:x==="("?c++:x===")"&&c--}const u=o.length===0?n:n.slice(l);let h=u,m=!1;u.endsWith(fr)?(h=u.slice(0,-1),m=!0):u.startsWith(fr)&&(h=u.slice(1),m=!0);const p=d&&d>l?d-l:void 0;return Mn(o,m,h,p)};if(t){const n=t+Ln,o=r;r=i=>i.startsWith(n)?o(i.slice(n.length)):Mn(Eu,!1,i,void 0,!0)}if(s){const n=r;r=o=>s({className:o,parseClassName:n})}return r},Tu=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((s,r)=>{t.set(s,1e6+r)}),s=>{const r=[];let n=[];for(let o=0;o<s.length;o++){const i=s[o],c=i[0]==="[",l=t.has(i);c||l?(n.length>0&&(n.sort(),r.push(...n),n=[]),r.push(i)):n.push(i)}return n.length>0&&(n.sort(),r.push(...n)),r}},Au=e=>({cache:ku(e.cacheSize),parseClassName:Pu(e),sortModifiers:Tu(e),postfixLookupClassGroupIds:Ou(e),...yu(e)}),Ou=e=>{const t=Object.create(null),s=e.postfixLookupClassGroups;if(s)for(let r=0;r<s.length;r++)t[s[r]]=!0;return t},Lu=/\s+/,Mu=(e,t)=>{const{parseClassName:s,getClassGroupId:r,getConflictingClassGroupIds:n,sortModifiers:o,postfixLookupClassGroupIds:i}=t,c=[],l=e.trim().split(Lu);let d="";for(let f=l.length-1;f>=0;f-=1){const u=l[f],{isExternal:h,modifiers:m,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:x}=s(u);if(h){d=u+(d.length>0?" "+d:d);continue}let b=!!x,y;if(b){const _=g.substring(0,x);y=r(_);const R=y&&i[y]?r(g):void 0;R&&R!==y&&(y=R,b=!1)}else y=r(g);if(!y){if(!b){d=u+(d.length>0?" "+d:d);continue}if(y=r(g),!y){d=u+(d.length>0?" "+d:d);continue}b=!1}const S=m.length===0?"":m.length===1?m[0]:o(m).join(":"),w=p?S+fr:S,N=w+y;if(c.indexOf(N)>-1)continue;c.push(N);const j=n(y,b);for(let _=0;_<j.length;++_){const R=j[_];c.push(w+R)}d=u+(d.length>0?" "+d:d)}return d},Iu=(...e)=>{let t=0,s,r,n="";for(;t<e.length;)(s=e[t++])&&(r=la(s))&&(n&&(n+=" "),n+=r);return n},la=e=>{if(typeof e=="string")return e;let t,s="";for(let r=0;r<e.length;r++)e[r]&&(t=la(e[r]))&&(s&&(s+=" "),s+=t);return s},Du=(e,...t)=>{let s,r,n,o;const i=l=>{const d=t.reduce((f,u)=>u(f),e());return s=Au(d),r=s.cache.get,n=s.cache.set,o=c,c(l)},c=l=>{const d=r(l);if(d)return d;const f=Mu(l,s);return n(l,f),f};return o=i,(...l)=>o(Iu(...l))},Fu=[],ae=e=>{const t=s=>s[e]||Fu;return t.isThemeGetter=!0,t},da=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ua=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Uu=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,$u=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Bu=/\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$/,zu=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Vu=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Wu=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Be=e=>Uu.test(e),H=e=>!!e&&!Number.isNaN(Number(e)),Ae=e=>!!e&&Number.isInteger(Number(e)),Zs=e=>e.endsWith("%")&&H(e.slice(0,-1)),Ie=e=>$u.test(e),fa=()=>!0,Hu=e=>Bu.test(e)&&!zu.test(e),Er=()=>!1,qu=e=>Vu.test(e),Gu=e=>Wu.test(e),Ku=e=>!A(e)&&!O(e),Yu=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)),Ju=e=>Ge(e,pa,Er),A=e=>da.test(e),Je=e=>Ge(e,ga,Hu),In=e=>Ge(e,nf,H),Xu=e=>Ge(e,ba,fa),Zu=e=>Ge(e,xa,Er),Dn=e=>Ge(e,ha,Er),Qu=e=>Ge(e,ma,Gu),ts=e=>Ge(e,ya,qu),O=e=>ua.test(e),Lt=e=>ut(e,ga),ef=e=>ut(e,xa),Fn=e=>ut(e,ha),tf=e=>ut(e,pa),sf=e=>ut(e,ma),ss=e=>ut(e,ya,!0),rf=e=>ut(e,ba,!0),Ge=(e,t,s)=>{const r=da.exec(e);return r?r[1]?t(r[1]):s(r[2]):!1},ut=(e,t,s=!1)=>{const r=ua.exec(e);return r?r[1]?t(r[1]):s:!1},ha=e=>e==="position"||e==="percentage",ma=e=>e==="image"||e==="url",pa=e=>e==="length"||e==="size"||e==="bg-size",ga=e=>e==="length",nf=e=>e==="number",xa=e=>e==="family-name",ba=e=>e==="number"||e==="weight",ya=e=>e==="shadow",of=()=>{const e=ae("color"),t=ae("font"),s=ae("text"),r=ae("font-weight"),n=ae("tracking"),o=ae("leading"),i=ae("breakpoint"),c=ae("container"),l=ae("spacing"),d=ae("radius"),f=ae("shadow"),u=ae("inset-shadow"),h=ae("text-shadow"),m=ae("drop-shadow"),p=ae("blur"),g=ae("perspective"),x=ae("aspect"),b=ae("ease"),y=ae("animate"),S=()=>["auto","avoid","all","avoid-page","page","left","right","column"],w=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],N=()=>[...w(),O,A],j=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto","contain","none"],R=()=>[O,A,l],E=()=>[Be,"full","auto",...R()],D=()=>[Ae,"none","subgrid",O,A],L=()=>["auto",{span:["full",Ae,O,A]},Ae,O,A],F=()=>[Ae,"auto",O,A],ee=()=>["auto","min","max","fr",O,A],V=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Z=()=>["start","end","center","stretch","center-safe","end-safe"],Q=()=>["auto",...R()],Y=()=>[Be,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],de=()=>[Be,"screen","full","dvw","lvw","svw","min","max","fit",...R()],fe=()=>[Be,"screen","full","lh","dvh","lvh","svh","min","max","fit",...R()],T=()=>[e,O,A],C=()=>[...w(),Fn,Dn,{position:[O,A]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],W=()=>["auto","cover","contain",tf,Ju,{size:[O,A]}],q=()=>[Zs,Lt,Je],M=()=>["","none","full",d,O,A],I=()=>["",H,Lt,Je],$=()=>["solid","dashed","dotted","double"],J=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],G=()=>[H,Zs,Fn,Dn],ue=()=>["","none",p,O,A],be=()=>["none",H,O,A],ne=()=>["none",H,O,A],Me=()=>[H,O,A],_e=()=>[Be,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ie],breakpoint:[Ie],color:[fa],container:[Ie],"drop-shadow":[Ie],ease:["in","out","in-out"],font:[Ku],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ie],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ie],shadow:[Ie],spacing:["px",H],text:[Ie],"text-shadow":[Ie],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Be,A,O,x]}],container:["container"],"container-type":[{"@container":["","normal","size",O,A]}],"container-named":[Yu],columns:[{columns:[H,A,O,c]}],"break-after":[{"break-after":S()}],"break-before":[{"break-before":S()}],"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:N()}],overflow:[{overflow:j()}],"overflow-x":[{"overflow-x":j()}],"overflow-y":[{"overflow-y":j()}],overscroll:[{overscroll:_()}],"overscroll-x":[{"overscroll-x":_()}],"overscroll-y":[{"overscroll-y":_()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:E()}],"inset-x":[{"inset-x":E()}],"inset-y":[{"inset-y":E()}],start:[{"inset-s":E(),start:E()}],end:[{"inset-e":E(),end:E()}],"inset-bs":[{"inset-bs":E()}],"inset-be":[{"inset-be":E()}],top:[{top:E()}],right:[{right:E()}],bottom:[{bottom:E()}],left:[{left:E()}],visibility:["visible","invisible","collapse"],z:[{z:[Ae,"auto",O,A]}],basis:[{basis:[Be,"full","auto",c,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[H,Be,"auto","initial","none",A]}],grow:[{grow:["",H,O,A]}],shrink:[{shrink:["",H,O,A]}],order:[{order:[Ae,"first","last","none",O,A]}],"grid-cols":[{"grid-cols":D()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":D()}],"row-start-end":[{row:L()}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ee()}],"auto-rows":[{"auto-rows":ee()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...V(),"normal"]}],"justify-items":[{"justify-items":[...Z(),"normal"]}],"justify-self":[{"justify-self":["auto",...Z()]}],"align-content":[{content:["normal",...V()]}],"align-items":[{items:[...Z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Z(),{baseline:["","last"]}]}],"place-content":[{"place-content":V()}],"place-items":[{"place-items":[...Z(),"baseline"]}],"place-self":[{"place-self":["auto",...Z()]}],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:Q()}],mx:[{mx:Q()}],my:[{my:Q()}],ms:[{ms:Q()}],me:[{me:Q()}],mbs:[{mbs:Q()}],mbe:[{mbe:Q()}],mt:[{mt:Q()}],mr:[{mr:Q()}],mb:[{mb:Q()}],ml:[{ml:Q()}],"space-x":[{"space-x":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:Y()}],"inline-size":[{inline:["auto",...de()]}],"min-inline-size":[{"min-inline":["auto",...de()]}],"max-inline-size":[{"max-inline":["none",...de()]}],"block-size":[{block:["auto",...fe()]}],"min-block-size":[{"min-block":["auto",...fe()]}],"max-block-size":[{"max-block":["none",...fe()]}],w:[{w:[c,"screen",...Y()]}],"min-w":[{"min-w":[c,"screen","none",...Y()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[i]},...Y()]}],h:[{h:["screen","lh",...Y()]}],"min-h":[{"min-h":["screen","lh","none",...Y()]}],"max-h":[{"max-h":["screen","lh",...Y()]}],"font-size":[{text:["base",s,Lt,Je]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,rf,Xu]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Zs,A]}],"font-family":[{font:[ef,Zu,t]}],"font-features":[{"font-features":[A]}],"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:[n,O,A]}],"line-clamp":[{"line-clamp":[H,"none",O,In]}],leading:[{leading:[o,...R()]}],"list-image":[{"list-image":["none",O,A]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",O,A]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:T()}],"text-color":[{text:T()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...$(),"wavy"]}],"text-decoration-thickness":[{decoration:[H,"from-font","auto",O,Je]}],"text-decoration-color":[{decoration:T()}],"underline-offset":[{"underline-offset":[H,"auto",O,A]}],"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:[Ae,O,A]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",O,A]}],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",O,A]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:C()}],"bg-repeat":[{bg:U()}],"bg-size":[{bg:W()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ae,O,A],radial:["",O,A],conic:[Ae,O,A]},sf,Qu]}],"bg-color":[{bg:T()}],"gradient-from-pos":[{from:q()}],"gradient-via-pos":[{via:q()}],"gradient-to-pos":[{to:q()}],"gradient-from":[{from:T()}],"gradient-via":[{via:T()}],"gradient-to":[{to:T()}],rounded:[{rounded:M()}],"rounded-s":[{"rounded-s":M()}],"rounded-e":[{"rounded-e":M()}],"rounded-t":[{"rounded-t":M()}],"rounded-r":[{"rounded-r":M()}],"rounded-b":[{"rounded-b":M()}],"rounded-l":[{"rounded-l":M()}],"rounded-ss":[{"rounded-ss":M()}],"rounded-se":[{"rounded-se":M()}],"rounded-ee":[{"rounded-ee":M()}],"rounded-es":[{"rounded-es":M()}],"rounded-tl":[{"rounded-tl":M()}],"rounded-tr":[{"rounded-tr":M()}],"rounded-br":[{"rounded-br":M()}],"rounded-bl":[{"rounded-bl":M()}],"border-w":[{border:I()}],"border-w-x":[{"border-x":I()}],"border-w-y":[{"border-y":I()}],"border-w-s":[{"border-s":I()}],"border-w-e":[{"border-e":I()}],"border-w-bs":[{"border-bs":I()}],"border-w-be":[{"border-be":I()}],"border-w-t":[{"border-t":I()}],"border-w-r":[{"border-r":I()}],"border-w-b":[{"border-b":I()}],"border-w-l":[{"border-l":I()}],"divide-x":[{"divide-x":I()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":I()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...$(),"hidden","none"]}],"divide-style":[{divide:[...$(),"hidden","none"]}],"border-color":[{border:T()}],"border-color-x":[{"border-x":T()}],"border-color-y":[{"border-y":T()}],"border-color-s":[{"border-s":T()}],"border-color-e":[{"border-e":T()}],"border-color-bs":[{"border-bs":T()}],"border-color-be":[{"border-be":T()}],"border-color-t":[{"border-t":T()}],"border-color-r":[{"border-r":T()}],"border-color-b":[{"border-b":T()}],"border-color-l":[{"border-l":T()}],"divide-color":[{divide:T()}],"outline-style":[{outline:[...$(),"none","hidden"]}],"outline-offset":[{"outline-offset":[H,O,A]}],"outline-w":[{outline:["",H,Lt,Je]}],"outline-color":[{outline:T()}],shadow:[{shadow:["","none",f,ss,ts]}],"shadow-color":[{shadow:T()}],"inset-shadow":[{"inset-shadow":["none",u,ss,ts]}],"inset-shadow-color":[{"inset-shadow":T()}],"ring-w":[{ring:I()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:T()}],"ring-offset-w":[{"ring-offset":[H,Je]}],"ring-offset-color":[{"ring-offset":T()}],"inset-ring-w":[{"inset-ring":I()}],"inset-ring-color":[{"inset-ring":T()}],"text-shadow":[{"text-shadow":["none",h,ss,ts]}],"text-shadow-color":[{"text-shadow":T()}],opacity:[{opacity:[H,O,A]}],"mix-blend":[{"mix-blend":[...J(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":J()}],"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":[H]}],"mask-image-linear-from-pos":[{"mask-linear-from":G()}],"mask-image-linear-to-pos":[{"mask-linear-to":G()}],"mask-image-linear-from-color":[{"mask-linear-from":T()}],"mask-image-linear-to-color":[{"mask-linear-to":T()}],"mask-image-t-from-pos":[{"mask-t-from":G()}],"mask-image-t-to-pos":[{"mask-t-to":G()}],"mask-image-t-from-color":[{"mask-t-from":T()}],"mask-image-t-to-color":[{"mask-t-to":T()}],"mask-image-r-from-pos":[{"mask-r-from":G()}],"mask-image-r-to-pos":[{"mask-r-to":G()}],"mask-image-r-from-color":[{"mask-r-from":T()}],"mask-image-r-to-color":[{"mask-r-to":T()}],"mask-image-b-from-pos":[{"mask-b-from":G()}],"mask-image-b-to-pos":[{"mask-b-to":G()}],"mask-image-b-from-color":[{"mask-b-from":T()}],"mask-image-b-to-color":[{"mask-b-to":T()}],"mask-image-l-from-pos":[{"mask-l-from":G()}],"mask-image-l-to-pos":[{"mask-l-to":G()}],"mask-image-l-from-color":[{"mask-l-from":T()}],"mask-image-l-to-color":[{"mask-l-to":T()}],"mask-image-x-from-pos":[{"mask-x-from":G()}],"mask-image-x-to-pos":[{"mask-x-to":G()}],"mask-image-x-from-color":[{"mask-x-from":T()}],"mask-image-x-to-color":[{"mask-x-to":T()}],"mask-image-y-from-pos":[{"mask-y-from":G()}],"mask-image-y-to-pos":[{"mask-y-to":G()}],"mask-image-y-from-color":[{"mask-y-from":T()}],"mask-image-y-to-color":[{"mask-y-to":T()}],"mask-image-radial":[{"mask-radial":[O,A]}],"mask-image-radial-from-pos":[{"mask-radial-from":G()}],"mask-image-radial-to-pos":[{"mask-radial-to":G()}],"mask-image-radial-from-color":[{"mask-radial-from":T()}],"mask-image-radial-to-color":[{"mask-radial-to":T()}],"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":w()}],"mask-image-conic-pos":[{"mask-conic":[H]}],"mask-image-conic-from-pos":[{"mask-conic-from":G()}],"mask-image-conic-to-pos":[{"mask-conic-to":G()}],"mask-image-conic-from-color":[{"mask-conic-from":T()}],"mask-image-conic-to-color":[{"mask-conic-to":T()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:C()}],"mask-repeat":[{mask:U()}],"mask-size":[{mask:W()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",O,A]}],filter:[{filter:["","none",O,A]}],blur:[{blur:ue()}],brightness:[{brightness:[H,O,A]}],contrast:[{contrast:[H,O,A]}],"drop-shadow":[{"drop-shadow":["","none",m,ss,ts]}],"drop-shadow-color":[{"drop-shadow":T()}],grayscale:[{grayscale:["",H,O,A]}],"hue-rotate":[{"hue-rotate":[H,O,A]}],invert:[{invert:["",H,O,A]}],saturate:[{saturate:[H,O,A]}],sepia:[{sepia:["",H,O,A]}],"backdrop-filter":[{"backdrop-filter":["","none",O,A]}],"backdrop-blur":[{"backdrop-blur":ue()}],"backdrop-brightness":[{"backdrop-brightness":[H,O,A]}],"backdrop-contrast":[{"backdrop-contrast":[H,O,A]}],"backdrop-grayscale":[{"backdrop-grayscale":["",H,O,A]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[H,O,A]}],"backdrop-invert":[{"backdrop-invert":["",H,O,A]}],"backdrop-opacity":[{"backdrop-opacity":[H,O,A]}],"backdrop-saturate":[{"backdrop-saturate":[H,O,A]}],"backdrop-sepia":[{"backdrop-sepia":["",H,O,A]}],"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",O,A]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[H,"initial",O,A]}],ease:[{ease:["linear","initial",b,O,A]}],delay:[{delay:[H,O,A]}],animate:[{animate:["none",y,O,A]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,O,A]}],"perspective-origin":[{"perspective-origin":N()}],rotate:[{rotate:be()}],"rotate-x":[{"rotate-x":be()}],"rotate-y":[{"rotate-y":be()}],"rotate-z":[{"rotate-z":be()}],scale:[{scale:ne()}],"scale-x":[{"scale-x":ne()}],"scale-y":[{"scale-y":ne()}],"scale-z":[{"scale-z":ne()}],"scale-3d":["scale-3d"],skew:[{skew:Me()}],"skew-x":[{"skew-x":Me()}],"skew-y":[{"skew-y":Me()}],transform:[{transform:[O,A,"","none","gpu","cpu"]}],"transform-origin":[{origin:N()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:_e()}],"translate-x":[{"translate-x":_e()}],"translate-y":[{"translate-y":_e()}],"translate-z":[{"translate-z":_e()}],"translate-none":["translate-none"],zoom:[{zoom:[Ae,O,A]}],accent:[{accent:T()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:T()}],"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",O,A]}],"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":T()}],"scrollbar-track-color":[{"scrollbar-track":T()}],"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",O,A]}],fill:[{fill:["none",...T()]}],"stroke-w":[{stroke:[H,Lt,Je,In]}],stroke:[{stroke:["none",...T()]}],"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"]}},af=Du(of);function Ct(...e){return af(pu(e))}function K(e,t="USD"){return new Intl.NumberFormat("en-US",{style:"currency",currency:t,minimumFractionDigits:2}).format(e)}const ce=B.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,className:Ct("rounded-xl border bg-card text-card-foreground shadow",e),...t}));ce.displayName="Card";const ve=B.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,className:Ct("flex flex-col space-y-1.5 p-6",e),...t}));ve.displayName="CardHeader";const Ne=B.forwardRef(({className:e,...t},s)=>a.jsx("h3",{ref:s,className:Ct("font-semibold leading-none tracking-tight",e),...t}));Ne.displayName="CardTitle";const cf=B.forwardRef(({className:e,...t},s)=>a.jsx("p",{ref:s,className:Ct("text-sm text-muted-foreground",e),...t}));cf.displayName="CardDescription";const le=B.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,className:Ct("p-6 pt-0",e),...t}));le.displayName="CardContent";const lf=B.forwardRef(({className:e,...t},s)=>a.jsx("div",{ref:s,className:Ct("flex items-center p-6 pt-0",e),...t}));lf.displayName="CardFooter";function Cs({status:e,error:t}){const s=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(lt,{className:"mt-0.5 h-5 w-5 shrink-0 text-destructive"}):a.jsx(Zo,{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:s?"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(vs,{to:s?"/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(ea,{className:"h-4 w-4"}),s?"Connect AWS source":"Review CUR discovery"]}),!s&&a.jsx(vs,{to:"/sources",className:"rounded-md border px-3 py-2 text-sm font-medium hover:bg-muted",children:"Cost sources"})]})]})]})})}function df({points:e,currency:t="USD"}){const[s,r]=k.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 n=900,o=260,i=70,c=24,l=22,d=48,f=n-i-c,u=o-l-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:l+u-x.value/h*u})),p=s==null?null:m[s],g=x=>{const b=x.currentTarget.getBoundingClientRect(),y=(x.clientX-b.left)/b.width*n;let S=0;for(let w=1;w<m.length;w+=1)Math.abs(m[w].x-y)<Math.abs(m[S].x-y)&&(S=w);r(S)};return a.jsxs("div",{className:"relative w-full",children:[a.jsxs("svg",{viewBox:`0 0 ${n} ${o}`,className:"h-72 w-full",onMouseMove:g,onMouseLeave:()=>r(null),role:"img","aria-label":"Cost trend line chart",children:[[0,.25,.5,.75,1].map(x=>{const b=l+u*x;return a.jsxs("g",{children:[a.jsx("line",{x1:i,y1:b,x2:n-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:K(h*(1-x),t)})]},x)}),a.jsx("line",{x1:i,y1:l+u,x2:n-c,y2:l+u,stroke:"#aebbc5"}),a.jsx("polyline",{points:m.map(x=>`${x.x},${x.y}`).join(" "),fill:"none",stroke:"#1f5f85",strokeWidth:"4",strokeLinejoin:"round",strokeLinecap:"round"}),p&&a.jsx("line",{x1:p.x,y1:l,x2:p.x,y2:l+u,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:s===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))]}),p&&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:`${p.x/n*100}%`,top:`${Math.max(p.y/o*100-4,2)}%`,transform:p.x>n*.75?"translate(-100%, -100%)":"translate(-50%, -100%)"},children:[a.jsx("p",{className:"text-xs font-semibold",children:p.label}),a.jsx("p",{className:"mt-1 text-sm font-bold text-primary",children:K(p.value,t)}),p.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:K(x.value,t)})]},x.label))]})]})}const Un=e=>e.length>16?`${e.slice(0,14)}...`:e,uf=(e,t)=>new Intl.NumberFormat("en-US",{style:"currency",currency:t||"USD",notation:"compact",maximumFractionDigits:1}).format(e);function ff({title:e,items:t,currency:s}){const o={top:38,right:18,bottom:72,left:76},i=720-o.left-o.right,c=320-o.top-o.bottom,l=Math.max(...t.map(u=>u.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(u=>{const h=o.top+c-u*c;return a.jsxs("g",{children:[a.jsx("line",{x1:o.left,y1:h,x2:720-o.right,y2:h,stroke:"currentColor",opacity:u===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:uf(l*u,s)})]},u)}),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((u,h)=>{const m=o.left+d*h+d/2,p=Math.max(u.amount/l*c,3),g=o.top+c-p;return a.jsxs("g",{tabIndex:0,"aria-label":`${u.label}: ${K(u.amount,s)}`,className:"outline-none focus-visible:opacity-75",children:[a.jsxs("title",{children:[u.label,": ",K(u.amount,s)]}),a.jsx("rect",{x:m-f/2,y:g,width:f,height:p,rx:"4",className:"fill-primary opacity-80 transition-opacity hover:opacity-100"}),a.jsx("text",{x:m,y:Math.max(g-8,16),textAnchor:"middle",fill:"currentColor",fontSize:"11",fontWeight:"600",children:K(u.amount,s)}),a.jsx("text",{x:m,y:278,textAnchor:"middle",fill:"currentColor",opacity:"0.72",fontSize:"11",children:Un(u.label)}),u.accountId&&a.jsx("text",{x:m,y:295,textAnchor:"middle",fill:"currentColor",opacity:"0.55",fontSize:"9",children:Un(u.accountId)})]},u.key||u.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 (",s,")"]})]})}const va="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 Qs({title:e,icon:t,items:s,currency:r}){const[n,o]=k.useState("chart"),i=s.slice(0,6),c=Math.max(...i.map(l=>l.amount),1);return a.jsxs(ce,{className:"min-w-0",children:[a.jsxs(ve,{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(Ne,{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":n==="chart",title:"Bar chart",className:`rounded p-1.5 ${n==="chart"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"}`,children:a.jsx(Td,{className:"h-4 w-4"})}),a.jsx("button",{type:"button",onClick:()=>o("list"),"aria-label":`Show ${e} as list`,"aria-pressed":n==="list",title:"List",className:`rounded p-1.5 ${n==="list"?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-muted"}`,children:a.jsx(Zd,{className:"h-4 w-4"})})]})]}),a.jsx(le,{children:i.length?n==="chart"?a.jsx(ff,{title:e,items:i,currency:r}):a.jsx("div",{className:"space-y-3",children:i.map(l=>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:l.label,children:[l.label,l.accountId?a.jsxs("span",{className:"ml-1 text-xs",children:["(",l.accountId,")"]}):null]}),a.jsx("span",{className:"shrink-0 font-medium",children:K(l.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:`${l.amount/c*100}%`}})})]},l.key||l.label))}):a.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No cost data for this period."})})]})}function hf(){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(ce,{className:va,children:[a.jsx(ve,{className:"pb-2",children:a.jsx("div",{className:"h-3 w-24 animate-pulse rounded bg-muted"})}),a.jsxs(le,{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(ce,{children:[a.jsx(ve,{children:a.jsx("div",{className:"h-4 w-36 animate-pulse rounded bg-muted"})}),a.jsx(le,{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(ce,{children:[a.jsx(ve,{children:a.jsx("div",{className:"h-4 w-32 animate-pulse rounded bg-muted"})}),a.jsx(le,{className:"space-y-4",children:Array.from({length:5},(s,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 mf({data:e,period:t,selectedMonth:s}){const r=e.topServices[0],n=e.topAccounts[0],o=new Date,[i,c]=s.split("-").map(Number),l=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:K(e.totalCost,e.currency)}),a.jsxs("span",{className:"mt-1 block text-sm font-medium text-muted-foreground",children:["Accounts: ",e.activeAccounts]})]}),helper:l,icon:a.jsx(Qo,{})},{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:`${l} across all accounts`,icon:a.jsx(js,{})},{label:"Highest cost service",value:r?a.jsx("span",{className:"whitespace-pre-line text-sm",children:`Service - ${r.label}
|
|
15
15
|
Cost - ${K(r.amount,e.currency)}`}):"-",helper:l,icon:a.jsx(sa,{})},{label:"Highest cost account",value:n?a.jsx("span",{className:"whitespace-pre-line text-sm",children:`Account Name - ${n.label}
|
|
16
16
|
Account Id - ${n.accountId||n.key||"Unknown"}
|
|
17
|
-
Cost - ${K(n.amount,e.currency)}`}):"-",helper:l,icon:a.jsx(js,{})}];return a.jsx("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(min(100%,240px),1fr))] gap-4",children:d.map(f=>a.jsxs(ie,{className:va,children:[a.jsxs(ve,{className:"flex flex-row items-center justify-between pb-2",children:[a.jsx(Ne,{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(ce,{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))})}const ue={getOverview:e=>re.get("/overview",{params:e}).then(t=>t.data),getAccounts:()=>re.get("/accounts").then(e=>e.data),getReports:e=>re.get("/reports",{params:e}).then(t=>t.data),getFilterOptions:e=>re.get("/filter-options",{params:{start:e?.start,end:e?.end,tagKey:e?.filterTagKey}}).then(t=>t.data),getTags:e=>re.get("/tags",{params:e}).then(t=>t.data),getDataStatus:()=>re.get("/data-status").then(e=>e.data),getAnalysisStatus:()=>re.get("/analysis/status").then(e=>e.data),getLatestAnalysis:()=>re.get("/analysis/latest").then(e=>e.data.analysis),getAnalysisSchedule:()=>re.get("/analysis/schedule").then(e=>e.data),updateAnalysisSchedule:e=>re.put("/analysis/schedule",e).then(t=>t.data),getAnalysisReports:()=>re.get("/analysis/reports").then(e=>e.data.reports),downloadAnalysisPdf:e=>re.get(`/analysis/reports/${e}/pdf`,{responseType:"blob"}).then(t=>t.data),getSources:()=>re.get("/sources").then(e=>e.data),createSource:e=>re.post("/sources",e).then(t=>t.data),getSourceStatus:e=>re.get(`/sources/${e}/status`).then(t=>t.data),verifySource:e=>re.post(`/sources/${e}/verify`).then(t=>t.data),downloadSourceTemplate:e=>re.get(`/sources/${e}/template`,{responseType:"blob"}).then(t=>t.data)};function hf(){const e=new Date,t=`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}`,[s,r]=k.useState(null),[n,o]=k.useState(!0),[i,c]=k.useState(null),[l,d]=k.useState(null),[f,u]=k.useState("monthly"),[h,m]=k.useState(t),p=k.useRef(0),g=Array.from({length:e.getMonth()+1},(S,w)=>({value:`${e.getFullYear()}-${String(w+1).padStart(2,"0")}`,label:new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric"}).format(new Date(e.getFullYear(),w,1))})),x=async(S=f,w=h)=>{const N=++p.current;o(!0),r(null),c(null);try{let _;if(S==="yearly")_={period:S,start:`${e.getFullYear()}-01-01`};else{const[E,D]=w.split("-").map(Number),L=w===t?e.getDate():new Date(E,D,0).getDate();_={period:S,start:`${w}-01`,end:`${w}-${String(L).padStart(2,"0")}`}}const C=await ue.getDataStatus();if(N===p.current&&d(C),!C.ready)return;const R=await ue.getOverview(_);N===p.current&&r(R)}catch(_){N===p.current&&c(_?.response?.data?.error||_.message||"Failed to load AWS costs")}finally{N===p.current&&o(!1)}};return k.useEffect(()=>{x(f,h)},[f,h]),{data:s,dataStatus:l,loading:n,error:i,period:f,selectedMonth:h,monthOptions:g,changePeriod:S=>{S!==f&&(o(!0),r(null),u(S))},changeMonth:S=>{S===h||!g.some(w=>w.value===S)||(o(!0),r(null),m(S))},refresh:()=>x(f,h)}}function mf(){const{data:e,dataStatus:t,loading:s,error:r,period:n,selectedMonth:o,monthOptions:i,changePeriod:c,changeMonth:l,refresh:d}=hf();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(Qo,{className:"h-6 w-6 text-primary"}),"Cloud Cost Management"]}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Costs across all AWS organization and member accounts available to this tenant"})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n==="monthly"&&a.jsx("select",{"aria-label":"Cost month",value:o,onChange:f=>l(f.target.value),disabled:s,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 ${n===f?"bg-primary text-primary-foreground":"hover:bg-muted"}`,children:f},f))}),a.jsx("button",{onClick:()=>{d()},disabled:s,className:"rounded-lg border p-2 hover:bg-muted",children:a.jsx(wt,{className:`h-4 w-4 ${s?"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(lt,{className:"h-4 w-4"}),r]}),s?a.jsx(uf,{}):t&&!t.ready?a.jsx(Cs,{status:t}):r&&!e?a.jsx(Cs,{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(ff,{data:e,period:n,selectedMonth:o}),e.message&&!/historical data beyond 14 months/i.test(e.message)&&a.jsx(ie,{children:a.jsx(ce,{className:"py-8 text-center text-sm text-muted-foreground",children:e.message})}),a.jsxs(ie,{children:[a.jsxs(ve,{className:"flex flex-row items-center gap-2",children:[a.jsx(na,{className:"h-4 w-4 text-primary"}),a.jsxs(Ne,{className:"text-sm",children:["Cost Trend - ",n==="monthly"?"Monthly":"Yearly"]})]}),a.jsx(ce,{children:a.jsx(cf,{points:e.trends.map(f=>({key:f.month,label:n==="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(Qs,{title:"Top services",icon:a.jsx(sa,{className:"h-4 w-4"}),items:e.topServices,currency:e.currency}),a.jsx(Qs,{title:"AWS accounts",icon:a.jsx(kd,{className:"h-4 w-4"}),items:e.topAccounts,currency:e.currency}),a.jsx(Qs,{title:"Regional distribution",icon:a.jsx(tu,{className:"h-4 w-4"}),items:e.topRegions,currency:e.currency})]})]}):null]})}const rs=["#6264e9","#eb67ad","#31c39a","#f29a05","#579bea","#9078ed","#f7842c","#24b9ad","#8ac926","#ffca3a","#6a4c93","#1982c4"];function $n(e,t){const s=new Date(e.length===10?`${e}T00:00:00Z`:e);return Number.isFinite(s.getTime())?s.toLocaleDateString(void 0,t?{month:"short",day:"numeric",year:"numeric"}:{month:"short",year:"numeric"}):e}function pf({timeline:e,currency:t="USD",daily:s=!1}){const[r,n]=k.useState(null),[o,i]=k.useState(null),c=k.useMemo(()=>{const h=new Map;for(const m of e)for(const p of m.groups)h.set(p.label,(h.get(p.label)||0)+p.amount);return[...h.entries()].sort((m,p)=>p[1]-m[1]).map(([m],p)=>({label:m,color:rs[p%rs.length]}))},[e]),l=new Map(c.map(h=>[h.label,h.color])),d=Math.max(...e.map(h=>h.total),1),f=r??o,u=f==null?null:e[f];return e.length?a.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,1fr)_288px]",onMouseLeave:()=>n(null),children:[a.jsxs("div",{children:[a.jsxs("div",{className:"grid min-h-80 grid-cols-[64px_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(h=>a.jsx("span",{children:K(d*h,t)},h))}),a.jsxs("div",{children:[a.jsxs("div",{className:"relative flex h-64 items-end justify-around border-b px-4",children:[[0,25,50,75].map(h=>a.jsx("span",{className:"pointer-events-none absolute left-0 right-0 border-t border-dashed border-slate-200",style:{top:`${h}%`}},h)),e.map((h,m)=>a.jsx("button",{type:"button",onMouseEnter:()=>n(m),onMouseLeave:()=>n(null),onPointerDown:p=>p.preventDefault(),onFocus:()=>i(m),onBlur:()=>i(null),className:"group z-10 flex h-full min-w-10 flex-1 items-end justify-center px-2 outline-none focus-visible:ring-2 focus-visible:ring-primary",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(h.total/d*100,1)}%`},children:h.groups.map(p=>a.jsx("span",{style:{backgroundColor:l.get(p.label)||rs[0],height:`${h.total?p.amount/h.total*100:0}%`}},p.key||p.label))})},`${h.start}-${m}`))]}),a.jsx("div",{className:"flex justify-around px-4 pt-2",children:e.map((h,m)=>a.jsx("span",{className:"min-w-10 flex-1 text-center text-[11px] text-muted-foreground",children:$n(h.start,s)},`${h.start}-label-${m}`))})]})]}),a.jsxs("div",{className:"mt-5 flex flex-wrap gap-x-4 gap-y-2",children:[c.slice(0,8).map(h=>a.jsxs("span",{className:"flex items-center gap-1.5 text-xs",children:[a.jsx("span",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:h.color}}),h.label]},h.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:u?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:$n(u.start,s)}),a.jsxs("div",{className:"mt-3 space-y-2",children:[[...u.groups].sort((h,m)=>m.amount-h.amount).slice(0,5).map(h=>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:l.get(h.label)||rs[0]}}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:h.label}),a.jsx("strong",{children:K(h.amount,t)})]},h.key||h.label)),u.groups.length>5&&a.jsxs("p",{className:"text-xs italic text-muted-foreground",children:["+ ",u.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:K(u.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 gf({rows:e,currency:t}){const s=e.slice(0,8),r=Math.max(1,...s.flatMap(n=>[n.current?.amount||0,n.previous?.amount||0]));return a.jsxs(ie,{className:"bg-primary/5",children:[a.jsx(ve,{children:a.jsx(Ne,{className:"text-sm",children:"Comparison Overview"})}),a.jsx(ce,{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:s.map(n=>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: ${K(n.current?.amount||0,t)}`,className:"w-1/3 max-w-10 rounded-t bg-indigo-500",style:{height:`${Math.max((n.current?.amount||0)/r*100,n.current?.amount?1:0)}%`}}),a.jsx("div",{title:`Previous: ${K(n.previous?.amount||0,t)}`,className:"w-1/3 max-w-10 rounded-t bg-pink-400",style:{height:`${Math.max((n.previous?.amount||0)/r*100,n.previous?.amount?1:0)}%`}})]}),a.jsx("span",{title:n.label,className:"mt-2 w-full truncate text-center text-[10px] text-muted-foreground",children:n.label})]},n.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 Le({label:e,value:t,helper:s,accent:r=!1,trend:n}){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:[n!=null&&(n<0?a.jsx(du,{className:"h-4 w-4 text-red-500"}):a.jsx(na,{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":n!=null&&n<0?"text-red-500":""}`,children:t}),s&&a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:s})]})}function ns({label:e,options:t,selected:s,onChange:r}){const n=s.length?`${s.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:n}),a.jsx(Od,{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:s.includes(o.value),onChange:i=>r(i.target.checked?[...s,o.value]:s.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 xf(){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 qe=10,hr=new Date,bf=new Date(Date.UTC(hr.getUTCFullYear(),hr.getUTCMonth()-2,1)).toISOString().slice(0,10),yf=hr.toISOString().slice(0,10),Lt={services:[],regions:[],accountIds:[],tagKey:"",tagValues:[]},at={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 Bn(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 zn(e,t){const s=new Date(`${e}T00:00:00Z`);if(t==="monthly"){const n=new Date(Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),0)),o=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),1)),i=new Date(o);i.setUTCDate(i.getUTCDate()-1);const c=new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),1));return{currentStart:o.toISOString().slice(0,10),currentEnd:n.toISOString().slice(0,10),previousStart:c.toISOString().slice(0,10),previousEnd:i.toISOString().slice(0,10)}}const r=new Date(s);return r.setUTCDate(r.getUTCDate()-1),{currentStart:e,currentEnd:e,previousStart:r.toISOString().slice(0,10),previousEnd:r.toISOString().slice(0,10)}}function St(e,t,s){const r=new Date(`${e}T00:00:00Z`),n=new Date(`${t}T00:00:00Z`);if(s==="monthly"&&r.getUTCFullYear()===n.getUTCFullYear()&&r.getUTCMonth()===n.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(n)}`}function vf(e){const t=new Map;return e.current.summary.forEach(s=>t.set(s.key||s.label,{current:s})),e.previous.summary.forEach(s=>{const r=s.key||s.label;t.set(r,{...t.get(r),previous:s})}),[...t.entries()].map(([s,r])=>{const n=r.current?.amount||0,o=r.previous?.amount||0,i=n-o;return{key:s,label:r.current?.label||r.previous?.label||s,...r,difference:i,change:o?i/Math.abs(o)*100:0}}).sort((s,r)=>Math.max(r.current?.amount||0,r.previous?.amount||0)-Math.max(s.current?.amount||0,s.previous?.amount||0))}function Xe(e){return e?.length?e.map(t=>`${t.label}
|
|
17
|
+
Cost - ${K(n.amount,e.currency)}`}):"-",helper:l,icon:a.jsx(js,{})}];return a.jsx("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(min(100%,240px),1fr))] gap-4",children:d.map(f=>a.jsxs(ce,{className:va,children:[a.jsxs(ve,{className:"flex flex-row items-center justify-between pb-2",children:[a.jsx(Ne,{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(le,{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))})}const ie={getOverview:e=>re.get("/overview",{params:e}).then(t=>t.data),getAccounts:()=>re.get("/accounts").then(e=>e.data),getReports:e=>re.get("/reports",{params:e}).then(t=>t.data),getFilterOptions:e=>re.get("/filter-options",{params:{start:e?.start,end:e?.end,tagKey:e?.filterTagKey}}).then(t=>t.data),getTags:e=>re.get("/tags",{params:e}).then(t=>t.data),getDataStatus:()=>re.get("/data-status").then(e=>e.data),getAnalysisStatus:()=>re.get("/analysis/status").then(e=>e.data),getLatestAnalysis:()=>re.get("/analysis/latest").then(e=>e.data.analysis),getAnalysisSchedule:()=>re.get("/analysis/schedule").then(e=>e.data),updateAnalysisSchedule:e=>re.put("/analysis/schedule",e).then(t=>t.data),getAnalysisReports:()=>re.get("/analysis/reports").then(e=>e.data.reports),removeAnalysisReport:e=>re.delete(`/analysis/reports/${e}`).then(t=>t.data),downloadAnalysisPdf:e=>re.get(`/analysis/reports/${e}/pdf`,{responseType:"blob"}).then(t=>t.data),getSources:()=>re.get("/sources").then(e=>e.data),createSource:e=>re.post("/sources",e).then(t=>t.data),getSourceStatus:e=>re.get(`/sources/${e}/status`).then(t=>t.data),verifySource:e=>re.post(`/sources/${e}/verify`).then(t=>t.data),downloadSourceTemplate:e=>re.get(`/sources/${e}/template`,{responseType:"blob"}).then(t=>t.data)};function pf(){const e=new Date,t=`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}`,[s,r]=k.useState(null),[n,o]=k.useState(!0),[i,c]=k.useState(null),[l,d]=k.useState(null),[f,u]=k.useState("monthly"),[h,m]=k.useState(t),p=k.useRef(0),g=Array.from({length:e.getMonth()+1},(S,w)=>({value:`${e.getFullYear()}-${String(w+1).padStart(2,"0")}`,label:new Intl.DateTimeFormat("en-US",{month:"long",year:"numeric"}).format(new Date(e.getFullYear(),w,1))})),x=async(S=f,w=h)=>{const N=++p.current;o(!0),r(null),c(null);try{let j;if(S==="yearly")j={period:S,start:`${e.getFullYear()}-01-01`};else{const[E,D]=w.split("-").map(Number),L=w===t?e.getDate():new Date(E,D,0).getDate();j={period:S,start:`${w}-01`,end:`${w}-${String(L).padStart(2,"0")}`}}const _=await ie.getDataStatus();if(N===p.current&&d(_),!_.ready)return;const R=await ie.getOverview(j);N===p.current&&r(R)}catch(j){N===p.current&&c(j?.response?.data?.error||j.message||"Failed to load AWS costs")}finally{N===p.current&&o(!1)}};return k.useEffect(()=>{x(f,h)},[f,h]),{data:s,dataStatus:l,loading:n,error:i,period:f,selectedMonth:h,monthOptions:g,changePeriod:S=>{S!==f&&(o(!0),r(null),u(S))},changeMonth:S=>{S===h||!g.some(w=>w.value===S)||(o(!0),r(null),m(S))},refresh:()=>x(f,h)}}function gf(){const{data:e,dataStatus:t,loading:s,error:r,period:n,selectedMonth:o,monthOptions:i,changePeriod:c,changeMonth:l,refresh:d}=pf();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(Qo,{className:"h-6 w-6 text-primary"}),"Cloud Cost Management"]}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Costs across all AWS organization and member accounts available to this tenant"})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n==="monthly"&&a.jsx("select",{"aria-label":"Cost month",value:o,onChange:f=>l(f.target.value),disabled:s,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 ${n===f?"bg-primary text-primary-foreground":"hover:bg-muted"}`,children:f},f))}),a.jsx("button",{onClick:()=>{d()},disabled:s,className:"rounded-lg border p-2 hover:bg-muted",children:a.jsx(St,{className:`h-4 w-4 ${s?"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(lt,{className:"h-4 w-4"}),r]}),s?a.jsx(hf,{}):t&&!t.ready?a.jsx(Cs,{status:t}):r&&!e?a.jsx(Cs,{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(mf,{data:e,period:n,selectedMonth:o}),e.message&&!/historical data beyond 14 months/i.test(e.message)&&a.jsx(ce,{children:a.jsx(le,{className:"py-8 text-center text-sm text-muted-foreground",children:e.message})}),a.jsxs(ce,{children:[a.jsxs(ve,{className:"flex flex-row items-center gap-2",children:[a.jsx(na,{className:"h-4 w-4 text-primary"}),a.jsxs(Ne,{className:"text-sm",children:["Cost Trend - ",n==="monthly"?"Monthly":"Yearly"]})]}),a.jsx(le,{children:a.jsx(df,{points:e.trends.map(f=>({key:f.month,label:n==="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(Qs,{title:"Top services",icon:a.jsx(sa,{className:"h-4 w-4"}),items:e.topServices,currency:e.currency}),a.jsx(Qs,{title:"AWS accounts",icon:a.jsx(kd,{className:"h-4 w-4"}),items:e.topAccounts,currency:e.currency}),a.jsx(Qs,{title:"Regional distribution",icon:a.jsx(tu,{className:"h-4 w-4"}),items:e.topRegions,currency:e.currency})]})]}):null]})}const rs=["#6264e9","#eb67ad","#31c39a","#f29a05","#579bea","#9078ed","#f7842c","#24b9ad","#8ac926","#ffca3a","#6a4c93","#1982c4"];function $n(e,t){const s=new Date(e.length===10?`${e}T00:00:00Z`:e);return Number.isFinite(s.getTime())?s.toLocaleDateString(void 0,t?{month:"short",day:"numeric",year:"numeric"}:{month:"short",year:"numeric"}):e}function xf({timeline:e,currency:t="USD",daily:s=!1}){const[r,n]=k.useState(null),[o,i]=k.useState(null),c=k.useMemo(()=>{const h=new Map;for(const m of e)for(const p of m.groups)h.set(p.label,(h.get(p.label)||0)+p.amount);return[...h.entries()].sort((m,p)=>p[1]-m[1]).map(([m],p)=>({label:m,color:rs[p%rs.length]}))},[e]),l=new Map(c.map(h=>[h.label,h.color])),d=Math.max(...e.map(h=>h.total),1),f=r??o,u=f==null?null:e[f];return e.length?a.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,1fr)_288px]",onMouseLeave:()=>n(null),children:[a.jsxs("div",{children:[a.jsxs("div",{className:"grid min-h-80 grid-cols-[64px_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(h=>a.jsx("span",{children:K(d*h,t)},h))}),a.jsxs("div",{children:[a.jsxs("div",{className:"relative flex h-64 items-end justify-around border-b px-4",children:[[0,25,50,75].map(h=>a.jsx("span",{className:"pointer-events-none absolute left-0 right-0 border-t border-dashed border-slate-200",style:{top:`${h}%`}},h)),e.map((h,m)=>a.jsx("button",{type:"button",onMouseEnter:()=>n(m),onMouseLeave:()=>n(null),onPointerDown:p=>p.preventDefault(),onFocus:()=>i(m),onBlur:()=>i(null),className:"group z-10 flex h-full min-w-10 flex-1 items-end justify-center px-2 outline-none focus-visible:ring-2 focus-visible:ring-primary",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(h.total/d*100,1)}%`},children:h.groups.map(p=>a.jsx("span",{style:{backgroundColor:l.get(p.label)||rs[0],height:`${h.total?p.amount/h.total*100:0}%`}},p.key||p.label))})},`${h.start}-${m}`))]}),a.jsx("div",{className:"flex justify-around px-4 pt-2",children:e.map((h,m)=>a.jsx("span",{className:"min-w-10 flex-1 text-center text-[11px] text-muted-foreground",children:$n(h.start,s)},`${h.start}-label-${m}`))})]})]}),a.jsxs("div",{className:"mt-5 flex flex-wrap gap-x-4 gap-y-2",children:[c.slice(0,8).map(h=>a.jsxs("span",{className:"flex items-center gap-1.5 text-xs",children:[a.jsx("span",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:h.color}}),h.label]},h.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:u?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:$n(u.start,s)}),a.jsxs("div",{className:"mt-3 space-y-2",children:[[...u.groups].sort((h,m)=>m.amount-h.amount).slice(0,5).map(h=>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:l.get(h.label)||rs[0]}}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:h.label}),a.jsx("strong",{children:K(h.amount,t)})]},h.key||h.label)),u.groups.length>5&&a.jsxs("p",{className:"text-xs italic text-muted-foreground",children:["+ ",u.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:K(u.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 bf({rows:e,currency:t}){const s=e.slice(0,8),r=Math.max(1,...s.flatMap(n=>[n.current?.amount||0,n.previous?.amount||0]));return a.jsxs(ce,{className:"bg-primary/5",children:[a.jsx(ve,{children:a.jsx(Ne,{className:"text-sm",children:"Comparison Overview"})}),a.jsx(le,{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:s.map(n=>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: ${K(n.current?.amount||0,t)}`,className:"w-1/3 max-w-10 rounded-t bg-indigo-500",style:{height:`${Math.max((n.current?.amount||0)/r*100,n.current?.amount?1:0)}%`}}),a.jsx("div",{title:`Previous: ${K(n.previous?.amount||0,t)}`,className:"w-1/3 max-w-10 rounded-t bg-pink-400",style:{height:`${Math.max((n.previous?.amount||0)/r*100,n.previous?.amount?1:0)}%`}})]}),a.jsx("span",{title:n.label,className:"mt-2 w-full truncate text-center text-[10px] text-muted-foreground",children:n.label})]},n.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 Le({label:e,value:t,helper:s,accent:r=!1,trend:n}){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:[n!=null&&(n<0?a.jsx(fu,{className:"h-4 w-4 text-red-500"}):a.jsx(na,{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":n!=null&&n<0?"text-red-500":""}`,children:t}),s&&a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:s})]})}function ns({label:e,options:t,selected:s,onChange:r}){const n=s.length?`${s.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:n}),a.jsx(Od,{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:s.includes(o.value),onChange:i=>r(i.target.checked?[...s,o.value]:s.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 yf(){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(bt,{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 qe=10,hr=new Date,vf=new Date(Date.UTC(hr.getUTCFullYear(),hr.getUTCMonth()-2,1)).toISOString().slice(0,10),wf=hr.toISOString().slice(0,10),Mt={services:[],regions:[],accountIds:[],tagKey:"",tagValues:[]},at={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 Bn(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 zn(e,t){const s=new Date(`${e}T00:00:00Z`);if(t==="monthly"){const n=new Date(Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),0)),o=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),1)),i=new Date(o);i.setUTCDate(i.getUTCDate()-1);const c=new Date(Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),1));return{currentStart:o.toISOString().slice(0,10),currentEnd:n.toISOString().slice(0,10),previousStart:c.toISOString().slice(0,10),previousEnd:i.toISOString().slice(0,10)}}const r=new Date(s);return r.setUTCDate(r.getUTCDate()-1),{currentStart:e,currentEnd:e,previousStart:r.toISOString().slice(0,10),previousEnd:r.toISOString().slice(0,10)}}function Rt(e,t,s){const r=new Date(`${e}T00:00:00Z`),n=new Date(`${t}T00:00:00Z`);if(s==="monthly"&&r.getUTCFullYear()===n.getUTCFullYear()&&r.getUTCMonth()===n.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(n)}`}function Sf(e){const t=new Map;return e.current.summary.forEach(s=>t.set(s.key||s.label,{current:s})),e.previous.summary.forEach(s=>{const r=s.key||s.label;t.set(r,{...t.get(r),previous:s})}),[...t.entries()].map(([s,r])=>{const n=r.current?.amount||0,o=r.previous?.amount||0,i=n-o;return{key:s,label:r.current?.label||r.previous?.label||s,...r,difference:i,change:o?i/Math.abs(o)*100:0}}).sort((s,r)=>Math.max(r.current?.amount||0,r.previous?.amount||0)-Math.max(s.current?.amount||0,s.previous?.amount||0))}function Xe(e){return e?.length?e.map(t=>`${t.label}
|
|
18
18
|
${K(t.amount,"USD")}`).join(`
|
|
19
|
-
`):"—"}function Vn({values:e}){const[t,s]=k.useState(!1);return a.jsxs("div",{className:"relative",children:[a.jsxs("button",{type:"button",onClick:()=>s(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:()=>s(!1),children:a.jsx(Os,{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:K(r.amount,"USD")})]},r.key)):a.jsx("p",{className:"text-xs text-muted-foreground",children:"No related values."})]})]})}function wa({page:e,pages:t,total:s,onChange:r}){const n=s?(e-1)*qe+1:0,o=Math.min(e*qe,s);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 ",n,"–",o," of ",s]}),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(Md,{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(Dd,{className:"h-4 w-4"})})]})]})}function wf({groupBy:e,report:t}){const[s,r]=k.useState(""),[n,o]=k.useState(1),[i,c]=k.useState(null),[l,d]=k.useState({percentage:!0,accounts:!0,regions:!0}),f=at[e],u=k.useMemo(()=>{const g=s.trim().toLowerCase();return g?t.summary.filter(x=>`${x.label} ${x.accountId||""}`.toLowerCase().includes(g)):t.summary},[t,s]),h=Math.max(1,Math.ceil(u.length/qe)),m=u.slice((n-1)*qe,n*qe),p=3+Number(l.percentage)+Number(l.accounts)+Number(l.regions);return k.useEffect(()=>{o(1)},[t,s,e]),a.jsxs(ie,{children:[a.jsxs(ve,{className:"flex flex-row flex-wrap items-center justify-between gap-3",children:[a.jsx(Ne,{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(_r,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("input",{"aria-label":"Search breakdown",value:s,onChange:g=>r(g.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(ra,{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(l).map(([g,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,[g]:b.target.checked}))}),g]},g))})]})]})]}),a.jsx(ce,{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"}),l.percentage&&a.jsx("th",{className:"px-4",children:"Percentage"}),l.accounts&&a.jsx("th",{className:"px-4",children:"Accounts"}),l.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(g=>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:g.label,children:g.label}),e==="account"&&a.jsx("div",{className:"font-mono text-xs text-muted-foreground",children:g.accountId||g.key})]}),a.jsx("td",{className:"px-4 font-semibold",children:K(g.amount,t.currency)}),l.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(g.percentage||0,100)}%`}})}),a.jsxs("strong",{className:"text-primary",children:[g.percentage?.toFixed(2),"%"]})]}),l.accounts&&a.jsx("td",{className:"px-4",children:a.jsx(Vn,{values:g.accounts||[]})}),l.regions&&a.jsx("td",{className:"px-4",children:a.jsx(Vn,{values:g.regions||[]})}),a.jsx("td",{className:"px-4 text-center",children:a.jsx("button",{type:"button",onClick:()=>c(g),title:"View cost details",className:"text-primary hover:opacity-70",children:a.jsx(Gd,{className:"h-4 w-4"})})})]},g.key||g.label)):a.jsx("tr",{children:a.jsx("td",{colSpan:p,className:"py-12 text-center text-muted-foreground",children:f.empty})})})]})}),a.jsx(wa,{page:n,pages:h,total:u.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:g=>g.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(Os,{})})]}),a.jsxs("div",{className:"mt-5 grid gap-3 sm:grid-cols-3",children:[a.jsx(Le,{label:"Cost",value:K(i.amount,t.currency)}),a.jsx(Le,{label:"Accounts",value:String(i.accounts?.length||0)}),a.jsx(Le,{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(g=>a.jsxs("div",{className:"flex justify-between border-t py-2 text-xs",children:[a.jsx("span",{children:g.label}),a.jsx("strong",{children:K(g.amount,t.currency)})]},g.key))]}),a.jsxs("div",{children:[a.jsx("h4",{className:"mb-2 text-sm font-semibold",children:"Regions"}),(i.regions||[]).map(g=>a.jsxs("div",{className:"flex justify-between border-t py-2 text-xs",children:[a.jsx("span",{children:g.label}),a.jsx("strong",{children:K(g.amount,t.currency)})]},g.key))]})]})]})})]})}function Sf({rows:e,groupBy:t,comparison:s,granularity:r}){const[n,o]=k.useState(""),[i,c]=k.useState(1),l=k.useMemo(()=>{const m=n.trim().toLowerCase();return m?e.filter(p=>p.label.toLowerCase().includes(m)):e},[e,n]),d=Math.max(1,Math.ceil(l.length/qe)),f=l.slice((i-1)*qe,i*qe),u=St(s.currentStart,s.currentEnd,r),h=St(s.previousStart,s.previousEnd,r);return k.useEffect(()=>{c(1)},[n,t,s]),a.jsxs(ie,{children:[a.jsxs(ve,{className:"flex flex-row flex-wrap items-center justify-between gap-3",children:[a.jsx(Ne,{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(_r,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("input",{"aria-label":"Search comparison",value:n,onChange:m=>o(m.target.value),placeholder:"Search...",className:"w-48 bg-transparent outline-none"})]})]}),a.jsx(ce,{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:[at[t].item," name"]}),a.jsxs("th",{className:"px-4",children:[u,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:K(m.current?.amount||0,s.current.currency)}),a.jsx("td",{className:"px-4",children:K(m.previous?.amount||0,s.previous.currency)}),a.jsxs("td",{className:`px-4 font-medium ${m.difference<0?"text-red-500":"text-emerald-600"}`,children:[m.difference>=0?"+":"",K(m.difference,s.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(wa,{page:i,pages:d,total:l.length,onChange:c})]})}function Rf(e){const{mode:t,groupBy:s,start:r,end:n,granularity:o,reportTagKey:i,options:c,filters:l,loading:d,filtersLoading:f,comparisonPeriods:u}=e;return a.jsxs("aside",{className:"space-y-4",children:[a.jsxs(ie,{className:"bg-primary/5",children:[a.jsx(ve,{children:a.jsx(Ne,{className:"text-sm uppercase text-primary",children:"Report parameters"})}),a.jsxs(ce,{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:n,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: ",u.currentStart," to ",u.currentEnd,a.jsx("br",{}),"Previous: ",u.previousStart," to ",u.previousEnd]}),s==="tag"&&a.jsxs("label",{className:"block text-xs text-muted-foreground",children:["Group by tag key",a.jsx("select",{value:i,onChange:h=>e.onReportTagKeyChange(h.target.value),className:"mt-1 w-full rounded-md border bg-background p-2 text-sm text-foreground",children:c.tagKeys.map(h=>a.jsx("option",{children:h},h))})]}),a.jsxs("button",{onClick:e.onRun,disabled:d,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(wt,{className:`h-4 w-4 ${d?"animate-spin":""}`}),"Run report"]})]})]}),a.jsxs(ie,{className:"bg-primary/5",children:[a.jsx(ve,{children:a.jsx(Ne,{className:"text-sm uppercase text-primary",children:"Filter by"})}),a.jsxs(ce,{className:"space-y-3",children:[a.jsx(ns,{label:"Services",options:c.services,selected:l.services,onChange:h=>e.onFiltersChange(m=>({...m,services:h}))}),a.jsx(ns,{label:"Region",options:c.regions,selected:l.regions,onChange:h=>e.onFiltersChange(m=>({...m,regions:h}))}),a.jsx(ns,{label:"Linked Account",options:c.accounts,selected:l.accountIds,onChange:h=>e.onFiltersChange(m=>({...m,accountIds:h}))}),a.jsxs("select",{value:l.tagKey,onChange:h=>{const m=h.target.value;e.onFiltersChange(p=>({...p,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))]}),l.tagKey&&a.jsx(ns,{label:"Tag values",options:c.tagValues.map(h=>({value:h,label:h})),selected:l.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 jf(){const[e,t]=k.useState("service"),[s,r]=k.useState("standard"),[n,o]=k.useState(bf),[i,c]=k.useState(yf),[l,d]=k.useState("monthly"),[f,u]=k.useState("Name"),[h,m]=k.useState({services:[],regions:[],accounts:[],tagKeys:[],tagValues:[]}),[p,g]=k.useState(Lt),[x,b]=k.useState(Lt),[y,S]=k.useState(null),[w,N]=k.useState(null),[_,C]=k.useState(!0),[R,E]=k.useState(!1),[D,L]=k.useState(null),[F,ee]=k.useState(null),V=k.useRef(0),Z=k.useMemo(()=>w?vf(w):[],[w]),Q=zn(i,l),Y=(M,I,$,J)=>({start:I,end:$,groupBy:J,granularity:l,tagKey:f,services:M.services.join(","),regions:M.regions.join(","),accountIds:M.accountIds.join(","),filterTagKey:M.tagKey||void 0,tagValues:M.tagValues.join(",")}),le=async(M="")=>{E(!0);try{const I=F||await ue.getDataStatus();if(ee(I),!I.ready)return;const $=await ue.getFilterOptions({start:n,end:i,filterTagKey:M||void 0});m(J=>M?{...J,tagValues:$.tagValues}:$),!M&&$.tagKeys.length&&!$.tagKeys.includes(f)&&u($.tagKeys[0])}catch(I){L(I?.response?.data?.error||I.message||"Failed to load filter values")}finally{E(!1)}},fe=async(M=x,I=s,$=e)=>{const J=++V.current;C(!0),L(null),S(null),N(null);try{const G=await ue.getDataStatus();if(J===V.current&&ee(G),!G.ready)return;if(I==="compare"){const de=zn(i,l),[be,ne]=await Promise.all([ue.getReports(Y(M,de.currentStart,de.currentEnd,$)),ue.getReports(Y(M,de.previousStart,de.previousEnd,$))]);J===V.current&&(S(be),N({current:be,previous:ne,...de}))}else{const de=await ue.getReports(Y(M,n,i,$));J===V.current&&S(de)}}catch(G){J===V.current&&L(G?.response?.data?.error||G.message||"Failed to generate cost report")}finally{J===V.current&&C(!1)}};return k.useEffect(()=>{fe(x,s,e)},[e,s]),k.useEffect(()=>{le()},[]),{groupBy:e,mode:s,start:n,end:i,granularity:l,reportTagKey:f,options:h,draftFilters:p,report:y,comparison:w,loading:_,filtersLoading:R,error:D,dataStatus:F,comparedRows:Z,selectedComparisonPeriods:Q,setStart:o,setEnd:c,setGranularity:d,setReportTagKey:u,setDraftFilters:g,changeGroup:M=>{M!==e&&(C(!0),S(null),N(null),t(M))},changeMode:M=>{M!==s&&(C(!0),S(null),N(null),r(M))},applyFilters:()=>{const M={...p,services:[...p.services],regions:[...p.regions],accountIds:[...p.accountIds],tagValues:[...p.tagValues]};b(M),fe(M)},resetFilters:()=>{g(Lt),b(Lt),fe(Lt)},runReport:()=>{le(),fe()},loadOptions:le}}function Nf(e){const{report:t,comparison:s,rows:r,groupBy:n,mode:o,start:i,end:c}=e,l=at[n];let d,f;o==="compare"&&s?(d=[[l.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 Vn({values:e}){const[t,s]=k.useState(!1);return a.jsxs("div",{className:"relative",children:[a.jsxs("button",{type:"button",onClick:()=>s(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:()=>s(!1),children:a.jsx(Os,{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:K(r.amount,"USD")})]},r.key)):a.jsx("p",{className:"text-xs text-muted-foreground",children:"No related values."})]})]})}function wa({page:e,pages:t,total:s,onChange:r}){const n=s?(e-1)*qe+1:0,o=Math.min(e*qe,s);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 ",n,"–",o," of ",s]}),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(Md,{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(Dd,{className:"h-4 w-4"})})]})]})}function Rf({groupBy:e,report:t}){const[s,r]=k.useState(""),[n,o]=k.useState(1),[i,c]=k.useState(null),[l,d]=k.useState({percentage:!0,accounts:!0,regions:!0}),f=at[e],u=k.useMemo(()=>{const g=s.trim().toLowerCase();return g?t.summary.filter(x=>`${x.label} ${x.accountId||""}`.toLowerCase().includes(g)):t.summary},[t,s]),h=Math.max(1,Math.ceil(u.length/qe)),m=u.slice((n-1)*qe,n*qe),p=3+Number(l.percentage)+Number(l.accounts)+Number(l.regions);return k.useEffect(()=>{o(1)},[t,s,e]),a.jsxs(ce,{children:[a.jsxs(ve,{className:"flex flex-row flex-wrap items-center justify-between gap-3",children:[a.jsx(Ne,{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(_r,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("input",{"aria-label":"Search breakdown",value:s,onChange:g=>r(g.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(ra,{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(l).map(([g,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,[g]:b.target.checked}))}),g]},g))})]})]})]}),a.jsx(le,{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"}),l.percentage&&a.jsx("th",{className:"px-4",children:"Percentage"}),l.accounts&&a.jsx("th",{className:"px-4",children:"Accounts"}),l.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(g=>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:g.label,children:g.label}),e==="account"&&a.jsx("div",{className:"font-mono text-xs text-muted-foreground",children:g.accountId||g.key})]}),a.jsx("td",{className:"px-4 font-semibold",children:K(g.amount,t.currency)}),l.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(g.percentage||0,100)}%`}})}),a.jsxs("strong",{className:"text-primary",children:[g.percentage?.toFixed(2),"%"]})]}),l.accounts&&a.jsx("td",{className:"px-4",children:a.jsx(Vn,{values:g.accounts||[]})}),l.regions&&a.jsx("td",{className:"px-4",children:a.jsx(Vn,{values:g.regions||[]})}),a.jsx("td",{className:"px-4 text-center",children:a.jsx("button",{type:"button",onClick:()=>c(g),title:"View cost details",className:"text-primary hover:opacity-70",children:a.jsx(Gd,{className:"h-4 w-4"})})})]},g.key||g.label)):a.jsx("tr",{children:a.jsx("td",{colSpan:p,className:"py-12 text-center text-muted-foreground",children:f.empty})})})]})}),a.jsx(wa,{page:n,pages:h,total:u.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:g=>g.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(Os,{})})]}),a.jsxs("div",{className:"mt-5 grid gap-3 sm:grid-cols-3",children:[a.jsx(Le,{label:"Cost",value:K(i.amount,t.currency)}),a.jsx(Le,{label:"Accounts",value:String(i.accounts?.length||0)}),a.jsx(Le,{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(g=>a.jsxs("div",{className:"flex justify-between border-t py-2 text-xs",children:[a.jsx("span",{children:g.label}),a.jsx("strong",{children:K(g.amount,t.currency)})]},g.key))]}),a.jsxs("div",{children:[a.jsx("h4",{className:"mb-2 text-sm font-semibold",children:"Regions"}),(i.regions||[]).map(g=>a.jsxs("div",{className:"flex justify-between border-t py-2 text-xs",children:[a.jsx("span",{children:g.label}),a.jsx("strong",{children:K(g.amount,t.currency)})]},g.key))]})]})]})})]})}function jf({rows:e,groupBy:t,comparison:s,granularity:r}){const[n,o]=k.useState(""),[i,c]=k.useState(1),l=k.useMemo(()=>{const m=n.trim().toLowerCase();return m?e.filter(p=>p.label.toLowerCase().includes(m)):e},[e,n]),d=Math.max(1,Math.ceil(l.length/qe)),f=l.slice((i-1)*qe,i*qe),u=Rt(s.currentStart,s.currentEnd,r),h=Rt(s.previousStart,s.previousEnd,r);return k.useEffect(()=>{c(1)},[n,t,s]),a.jsxs(ce,{children:[a.jsxs(ve,{className:"flex flex-row flex-wrap items-center justify-between gap-3",children:[a.jsx(Ne,{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(_r,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("input",{"aria-label":"Search comparison",value:n,onChange:m=>o(m.target.value),placeholder:"Search...",className:"w-48 bg-transparent outline-none"})]})]}),a.jsx(le,{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:[at[t].item," name"]}),a.jsxs("th",{className:"px-4",children:[u,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:K(m.current?.amount||0,s.current.currency)}),a.jsx("td",{className:"px-4",children:K(m.previous?.amount||0,s.previous.currency)}),a.jsxs("td",{className:`px-4 font-medium ${m.difference<0?"text-red-500":"text-emerald-600"}`,children:[m.difference>=0?"+":"",K(m.difference,s.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(wa,{page:i,pages:d,total:l.length,onChange:c})]})}function Nf(e){const{mode:t,groupBy:s,start:r,end:n,granularity:o,reportTagKey:i,options:c,filters:l,loading:d,filtersLoading:f,comparisonPeriods:u}=e;return a.jsxs("aside",{className:"space-y-4",children:[a.jsxs(ce,{className:"bg-primary/5",children:[a.jsx(ve,{children:a.jsx(Ne,{className:"text-sm uppercase text-primary",children:"Report parameters"})}),a.jsxs(le,{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:n,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: ",u.currentStart," to ",u.currentEnd,a.jsx("br",{}),"Previous: ",u.previousStart," to ",u.previousEnd]}),s==="tag"&&a.jsxs("label",{className:"block text-xs text-muted-foreground",children:["Group by tag key",a.jsx("select",{value:i,onChange:h=>e.onReportTagKeyChange(h.target.value),className:"mt-1 w-full rounded-md border bg-background p-2 text-sm text-foreground",children:c.tagKeys.map(h=>a.jsx("option",{children:h},h))})]}),a.jsxs("button",{onClick:e.onRun,disabled:d,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(St,{className:`h-4 w-4 ${d?"animate-spin":""}`}),"Run report"]})]})]}),a.jsxs(ce,{className:"bg-primary/5",children:[a.jsx(ve,{children:a.jsx(Ne,{className:"text-sm uppercase text-primary",children:"Filter by"})}),a.jsxs(le,{className:"space-y-3",children:[a.jsx(ns,{label:"Services",options:c.services,selected:l.services,onChange:h=>e.onFiltersChange(m=>({...m,services:h}))}),a.jsx(ns,{label:"Region",options:c.regions,selected:l.regions,onChange:h=>e.onFiltersChange(m=>({...m,regions:h}))}),a.jsx(ns,{label:"Linked Account",options:c.accounts,selected:l.accountIds,onChange:h=>e.onFiltersChange(m=>({...m,accountIds:h}))}),a.jsxs("select",{value:l.tagKey,onChange:h=>{const m=h.target.value;e.onFiltersChange(p=>({...p,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))]}),l.tagKey&&a.jsx(ns,{label:"Tag values",options:c.tagValues.map(h=>({value:h,label:h})),selected:l.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 Cf(){const[e,t]=k.useState("service"),[s,r]=k.useState("standard"),[n,o]=k.useState(vf),[i,c]=k.useState(wf),[l,d]=k.useState("monthly"),[f,u]=k.useState("Name"),[h,m]=k.useState({services:[],regions:[],accounts:[],tagKeys:[],tagValues:[]}),[p,g]=k.useState(Mt),[x,b]=k.useState(Mt),[y,S]=k.useState(null),[w,N]=k.useState(null),[j,_]=k.useState(!0),[R,E]=k.useState(!1),[D,L]=k.useState(null),[F,ee]=k.useState(null),V=k.useRef(0),Z=k.useMemo(()=>w?Sf(w):[],[w]),Q=zn(i,l),Y=(M,I,$,J)=>({start:I,end:$,groupBy:J,granularity:l,tagKey:f,services:M.services.join(","),regions:M.regions.join(","),accountIds:M.accountIds.join(","),filterTagKey:M.tagKey||void 0,tagValues:M.tagValues.join(",")}),de=async(M="")=>{E(!0);try{const I=F||await ie.getDataStatus();if(ee(I),!I.ready)return;const $=await ie.getFilterOptions({start:n,end:i,filterTagKey:M||void 0});m(J=>M?{...J,tagValues:$.tagValues}:$),!M&&$.tagKeys.length&&!$.tagKeys.includes(f)&&u($.tagKeys[0])}catch(I){L(I?.response?.data?.error||I.message||"Failed to load filter values")}finally{E(!1)}},fe=async(M=x,I=s,$=e)=>{const J=++V.current;_(!0),L(null),S(null),N(null);try{const G=await ie.getDataStatus();if(J===V.current&&ee(G),!G.ready)return;if(I==="compare"){const ue=zn(i,l),[be,ne]=await Promise.all([ie.getReports(Y(M,ue.currentStart,ue.currentEnd,$)),ie.getReports(Y(M,ue.previousStart,ue.previousEnd,$))]);J===V.current&&(S(be),N({current:be,previous:ne,...ue}))}else{const ue=await ie.getReports(Y(M,n,i,$));J===V.current&&S(ue)}}catch(G){J===V.current&&L(G?.response?.data?.error||G.message||"Failed to generate cost report")}finally{J===V.current&&_(!1)}};return k.useEffect(()=>{fe(x,s,e)},[e,s]),k.useEffect(()=>{de()},[]),{groupBy:e,mode:s,start:n,end:i,granularity:l,reportTagKey:f,options:h,draftFilters:p,report:y,comparison:w,loading:j,filtersLoading:R,error:D,dataStatus:F,comparedRows:Z,selectedComparisonPeriods:Q,setStart:o,setEnd:c,setGranularity:d,setReportTagKey:u,setDraftFilters:g,changeGroup:M=>{M!==e&&(_(!0),S(null),N(null),t(M))},changeMode:M=>{M!==s&&(_(!0),S(null),N(null),r(M))},applyFilters:()=>{const M={...p,services:[...p.services],regions:[...p.regions],accountIds:[...p.accountIds],tagValues:[...p.tagValues]};b(M),fe(M)},resetFilters:()=>{g(Mt),b(Mt),fe(Mt)},runReport:()=>{de(),fe()},loadOptions:de}}function _f(e){const{report:t,comparison:s,rows:r,groupBy:n,mode:o,start:i,end:c}=e,l=at[n];let d,f;o==="compare"&&s?(d=[[l.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-${n}-${Date.now()}.csv`):(d=[[l.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=`${n}-summary-report-${Date.now()}.csv`);const u=document.createElement("a");u.href=URL.createObjectURL(new Blob([d],{type:"text/csv"})),u.download=f,u.click(),URL.revokeObjectURL(u.href)}async function Cf(e){const{report:t,comparison:s,rows:r,groupBy:n,mode:o,start:i,end:c,granularity:l}=e,d=at[n],[{jsPDF:f},{default:u}]=await Promise.all([Promise.resolve().then(()=>require("./jspdf.es.min-C10id8ME.cjs")).then(g=>g.jspdf_es_min),Promise.resolve().then(()=>require("./jspdf.plugin.autotable-CvTok6mL.cjs"))]),h=new f({orientation:"landscape",unit:"pt",format:"a4"}),m=(g,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 ${g.pageNumber}`,h.internal.pageSize.width-70,h.internal.pageSize.height-18)};if(o==="compare"&&s){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: ${s.previous.totalCost}`,40,82),h.text(`Current Cost: ${s.current.totalCost}`,220,82),h.text(`Granularity: ${l}`,400,82),u(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(g=>[g.label,g.current?.amount?.toFixed(2)||"0.00",g.previous?.amount?.toFixed(2)||"0.00",St(s.currentStart,s.currentEnd,l),St(s.previousStart,s.previousEnd,l),`${g.change.toFixed(4)}%`,Xe(g.current?.accounts),Xe(g.previous?.accounts),Xe(g.current?.regions),Xe(g.previous?.regions)]),styles:{fontSize:6,cellPadding:3,overflow:"linebreak"},headStyles:{fillColor:[242,237,255],textColor:[82,35,190]},didDrawPage:g=>m(g,s.previousStart,s.currentEnd),margin:{bottom:32}}),h.save(`comparison-report-${n}-${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: ${K(t.totalCost,t.currency)}`,40,112),h.setTextColor(98,86,230),h.text("COST SUMMARY BREAKDOWN",40,136);const p=n==="account";u(h,{startY:146,head:[p?["Account ID","Account Name","Total Cost","Percentage","Regions"]:[`${d.item} Name`,"Total Cost","Percentage","Accounts","Regions"]],body:t.summary.map(g=>p?[g.accountId||g.key||"—",g.label,K(g.amount,t.currency),`${(g.percentage||0).toFixed(2)}%`,Xe(g.regions)]:[g.label,K(g.amount,t.currency),`${(g.percentage||0).toFixed(2)}%`,Xe(g.accounts),Xe(g.regions)]),styles:{fontSize:7,cellPadding:4,overflow:"linebreak"},headStyles:{fillColor:[242,237,255],textColor:[82,35,190]},didDrawPage:g=>m(g,i,c),margin:{bottom:32}}),h.save(`${n}-summary-report-${Date.now()}.pdf`)}function _f(){const e=jf(),{groupBy:t,mode:s,report:r,comparison:n,comparedRows:o,loading:i,error:c,dataStatus:l,granularity:d,start:f,end:u}=e,h=at[t],m=r?.summary[0],p=n?n.current.totalCost-n.previous.totalCost:0,g=n?.previous.totalCost?p/Math.abs(n.previous.totalCost)*100:0,x=r?{report:r,comparison:n,rows:o,groupBy:t,mode:s,start:f,end:u,granularity:d}:null,b=a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{onClick:()=>x&&void Cf(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(Yd,{className:"h-4 w-4"}),"PDF"]}),a.jsxs("button",{onClick:()=>x&&Nf(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(Cr,{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",{children:[a.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold",children:[a.jsx(ta,{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"})]}),!i&&(l&&!l.ready||c&&!l)?a.jsx(Cs,{status:l,error:c}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"flex gap-1 overflow-x-auto border-b",children:Object.keys(at).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:at[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(lt,{className:"h-4 w-4"}),c]}),i?a.jsx(xf,{}):s==="compare"&&n?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: ",Bn(n.current.updatedAt)]})]}),b]}),a.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[a.jsx(Le,{label:"Period accrued total",value:`${K(n.current.totalCost,n.current.currency)} vs ${K(n.previous.totalCost,n.previous.currency)}`,helper:`${g>=0?"+":""}${g.toFixed(1)}% from previous period`,trend:g}),a.jsx(Le,{label:St(n.currentStart,n.currentEnd,d),value:K(n.current.totalCost,n.current.currency),helper:"Current period spending"}),a.jsx(Le,{label:St(n.previousStart,n.previousEnd,d),value:K(n.previous.totalCost,n.previous.currency),helper:"Previous period spending"}),a.jsx(Le,{label:d==="monthly"?"Monthly change":"Period change",value:`${p>=0?"+":""}${K(p,n.current.currency)}`,helper:`${g>=0?"+":""}${g.toFixed(1)}% from previous period`,trend:p})]})]}),a.jsx(gf,{rows:o,currency:n.current.currency}),a.jsx(Sf,{rows:o,groupBy:t,comparison:n,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(lt,{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: ",Bn(r.updatedAt)]})]}),b]}),a.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[a.jsx(Le,{label:"Accrued cost",value:K(r.totalCost,r.currency)}),a.jsx(Le,{label:h.top,value:m?K(m.amount,r.currency):"-",accent:!0}),a.jsx(Le,{label:h.count,value:String(r.count||0),accent:!0})]})]}),a.jsxs(ie,{children:[a.jsx(ve,{children:a.jsx(Ne,{className:"text-sm",children:"Cost Trend"})}),a.jsx(ce,{children:a.jsx(pf,{timeline:r.timeline||[],currency:r.currency||"USD",daily:d==="daily"})})]}),a.jsx(wf,{groupBy:t,report:r})]}):null]}),a.jsx(Rf,{mode:s,groupBy:t,start:f,end:u,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 Wn={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"},kf={INFO:"text-muted-foreground",WARN:"text-amber-600",ERROR:"text-destructive"},os=e=>e?new Date(e).toLocaleString():"—";function Ef({status:e}){return a.jsx("span",{className:`rounded-full border px-2 py-0.5 text-xs font-medium ${Wn[e]||Wn.PENDING}`,children:e.replace(/_/g," ")})}function De({label:e,value:t,mono:s}){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 ${s?"font-mono text-xs":""}`,children:t||"—"})]})}function Pf(){const[e,t]=k.useState([]),[s,r]=k.useState([]),[n,o]=k.useState(!0),[i,c]=k.useState(null),l=k.useCallback(async()=>{o(!0),c(null);try{const d=await re.get("/cur-discovery",{params:{logLimit:100}});t(d.data?.jobs||[]),r(d.data?.logs||[])}catch(d){c(d?.response?.data?.error||d?.message||"Unable to load CUR discovery status")}finally{o(!1)}},[]);return k.useEffect(()=>{l()},[l]),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(_r,{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.jsx("button",{onClick:()=>{l()},disabled:n,className:"rounded-lg border p-2 hover:bg-muted disabled:opacity-50","aria-label":"Refresh",children:a.jsx(wt,{className:`h-4 w-4 ${n?"animate-spin":""}`})})]}),i&&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(lt,{className:"h-4 w-4"}),i]}),!n&&!i&&!e.length&&a.jsx(ie,{children:a.jsx(ce,{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."})}),e.map(d=>a.jsxs(ie,{children:[a.jsxs(ve,{className:"flex flex-row flex-wrap items-center gap-3",children:[a.jsx(Zo,{className:"h-4 w-4 text-primary"}),a.jsxs(Ne,{className:"text-sm",children:["Connection ",d.connectionId]}),a.jsx(Ef,{status:d.status}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:["attempt ",d.attemptCount]}),a.jsxs("span",{className:"ms-auto text-xs text-muted-foreground",children:["next check ",os(d.nextRunAt)]})]}),a.jsxs(ce,{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[a.jsx(De,{label:"Source",value:d.curS3Uri||`s3://${d.bucket}/${d.prefix}`,mono:!0}),a.jsx(De,{label:"Tenant partition",value:d.tenantPartition,mono:!0}),a.jsx(De,{label:"Region",value:d.region}),a.jsx(De,{label:"Glue database",value:d.database,mono:!0}),a.jsx(De,{label:"Discovered table",value:d.table,mono:!0}),a.jsx(De,{label:"Table location",value:d.tableLocation,mono:!0}),a.jsx(De,{label:"Sample object",value:d.sampleObjectKey,mono:!0}),a.jsx(De,{label:"Last data",value:os(d.lastDataAt)}),a.jsx(De,{label:"Last checked",value:os(d.lastFinishedAt||d.lastStartedAt)}),d.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:d.lastError})]})]},d.id)),e.length>0&&a.jsxs(ie,{children:[a.jsx(ve,{children:a.jsx(Ne,{className:"text-sm",children:"Recent activity"})}),a.jsx(ce,{children:s.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:s.map(d=>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:os(d.createdAt)}),a.jsx("td",{className:`py-2 pe-4 text-xs font-medium ${kf[d.level]||""}`,children:d.level}),a.jsx("td",{className:"whitespace-nowrap py-2 pe-4 font-mono text-xs",children:d.event}),a.jsx("td",{className:"py-2",children:d.message})]},d.id))})]})}):a.jsx("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"No log entries recorded yet."})})]})]})}const Tf="https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/template",Af=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",as=e=>e?.response?.data?.error||e?.response?.data?.message||e?.message||"Request failed";function Of(){const[e,t]=k.useState([]),[s,r]=k.useState(!0),[n,o]=k.useState(!1),[i,c]=k.useState(""),[l,d]=k.useState(!1),[f,u]=k.useState(null),[h,m]=k.useState(null),[p,g]=k.useState(null),x=k.useCallback(async()=>{r(!0),g(null);try{t((await ue.getSources()).sources||[])}catch(w){g(as(w))}finally{r(!1)}},[]);k.useEffect(()=>{x()},[x]);const b=async w=>{if(w.preventDefault(),!/^\d{12}$/.test(i)){g("AWS account ID must contain exactly 12 digits");return}m("create"),g(null);try{const N=await ue.createSource({managementAccountId:i,regionMode:l?"ALL":"SINGLE"});u(N.connectionId),o(!1),c(""),d(!1),await x()}catch(N){g(as(N))}finally{m(null)}},y=async w=>{m(`download-${w}`),g(null);try{const N=await ue.downloadSourceTemplate(w),_=URL.createObjectURL(N),C=document.createElement("a");C.href=_,C.download=`meyi-connect-cost-${w}.yaml`,C.click(),URL.revokeObjectURL(_),u(w)}catch(N){g(as(N))}finally{m(null)}},S=async w=>{m(`verify-${w}`),g(null);try{const N=await ue.verifySource(w);N.status==="FAILED"&&g(N.message||"AWS connection verification failed"),await x()}catch(N){g(as(N))}finally{m(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(js,{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:()=>{x()},disabled:s,className:"rounded-md border p-2 hover:bg-muted disabled:opacity-50","aria-label":"Refresh sources",title:"Refresh sources",children:a.jsx(wt,{className:`h-4 w-4 ${s?"animate-spin":""}`})}),a.jsxs("button",{type:"button",onClick:()=>{g(null),o(!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(ru,{className:"h-4 w-4"}),"Add AWS account"]})]})]}),p&&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(lt,{className:"mt-0.5 h-4 w-4 shrink-0"}),p]}),!s&&e.length===0&&a.jsxs("div",{className:"rounded-md border border-dashed py-14 text-center",children:[a.jsx(js,{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."})]}),e.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:e.map(w=>a.jsxs("tr",{className:`border-b last:border-0 ${f===w.connectionId?"bg-muted/30":""}`,children:[a.jsx("td",{className:"px-4 py-3 font-mono",children:w.managementAccountId||"Pending"}),a.jsx("td",{className:"px-4 py-3 font-mono text-xs",children:w.connectionId}),a.jsxs("td",{className:"px-4 py-3",children:[w.accountScope," / ",w.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 ${Af(w.status)}`,children:w.status.replace(/_/g," ")}),w.stackSetStatus&&a.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:w.stackSetStatus.replace(/_/g," ")})]}),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:()=>{y(w.connectionId)},disabled:!!h,className:"rounded-md border p-2 hover:bg-muted disabled:opacity-50",title:"Download CloudFormation template","aria-label":"Download CloudFormation template",children:h===`download-${w.connectionId}`?a.jsx(It,{className:"h-4 w-4 animate-spin"}):a.jsx(Cr,{className:"h-4 w-4"})}),a.jsx("a",{href:Tf,target:"_blank",rel:"noreferrer",className:"rounded-md border p-2 hover:bg-muted",title:"Open AWS CloudFormation","aria-label":"Open AWS CloudFormation",children:a.jsx(ea,{className:"h-4 w-4"})}),a.jsxs("button",{type:"button",onClick:()=>{S(w.connectionId)},disabled:!!h||w.status==="CONNECTED",className:"flex items-center gap-2 rounded-md border px-3 py-2 font-medium hover:bg-muted disabled:opacity-50",children:[h===`verify-${w.connectionId}`?a.jsx(It,{className:"h-4 w-4 animate-spin"}):w.status==="CONNECTED"?a.jsx($d,{className:"h-4 w-4 text-emerald-600"}):a.jsx(wt,{className:"h-4 w-4"}),w.status==="CONNECTED"?"Connected":"Verify"]})]})})]},w.connectionId))})]})}),n&&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:w=>{b(w)},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:()=>o(!1),className:"rounded-md p-1 hover:bg-muted","aria-label":"Close",children:a.jsx(Os,{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:i,onChange:w=>c(w.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:l,onChange:w=>d(w.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:()=>o(!1),className:"rounded-md border px-4 py-2 text-sm font-medium hover:bg-muted",children:"Cancel"}),a.jsxs("button",{type:"submit",disabled:h==="create"||i.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:[h==="create"&&a.jsx(It,{className:"h-4 w-4 animate-spin"}),"Create source"]})]})]})})]})}const Sa=k.createContext("user"),Lf=Sa.Provider,Mf=()=>k.useContext(Sa),If=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Df=["UTC","Asia/Kolkata","America/New_York","America/Los_Angeles","Europe/London","Europe/Berlin","Asia/Singapore","Asia/Tokyo","Australia/Sydney"];function Ff({open:e,schedule:t,saving:s,onClose:r,onSave:n}){const[o,i]=k.useState(t);if(k.useEffect(()=>i(t),[t,e]),!e)return null;const c=l=>i(d=>({...d,frequency:l}));return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/55 p-4",role:"presentation",onMouseDown:l=>{l.target===l.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(Xo,{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(Os,{className:"h-4 w-4"})})]}),a.jsxs("form",{className:"space-y-5 p-5",onSubmit:l=>{l.preventDefault(),n({enabled:o.enabled,frequency:o.frequency,time:o.time,timezone:o.timezone,dayOfWeek:o.dayOfWeek,dayOfMonth:o.dayOfMonth}).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:l=>i(d=>({...d,enabled:l.target.checked})),className:"h-4 w-4 accent-primary"})]}),a.jsxs("fieldset",{disabled:!o.enabled||s,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(l=>a.jsx("button",{type:"button",onClick:()=>c(l),className:`rounded-md px-3 py-2 text-sm capitalize ${o.frequency===l?"bg-primary text-primary-foreground":"hover:bg-muted"}`,children:l},l))})]}),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:l=>i(d=>({...d,time:l.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:l=>i(d=>({...d,timezone:l.target.value})),className:"mt-2 block h-10 w-full rounded-lg border bg-background px-3 font-normal",children:[...new Set([o.timezone,...Df])].map(l=>a.jsx("option",{children:l},l))})]})]}),o.frequency==="weekly"&&a.jsxs("label",{className:"block text-sm font-medium",children:["Day of week",a.jsx("select",{value:o.dayOfWeek??1,onChange:l=>i(d=>({...d,dayOfWeek:Number(l.target.value)})),className:"mt-2 block h-10 w-full rounded-lg border bg-background px-3 font-normal",children:If.map((l,d)=>a.jsx("option",{value:d,children:l},l))})]}),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:l=>i(d=>({...d,dayOfMonth:Number(l.target.value)})),className:"mt-2 block h-10 w-full rounded-lg border bg-background px-3 font-normal"})]}),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:s,className:"rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground disabled:opacity-50",children:s?"Saving":"Save schedule"})]})]})]})})}function Uf(){const[e,t]=k.useState(null),[s,r]=k.useState(null),[n,o]=k.useState(null),[i,c]=k.useState([]),[l,d]=k.useState(!0),[f,u]=k.useState(!1),[h,m]=k.useState(null),p=k.useRef(!0),g=k.useCallback(async(y=!1)=>{y||d(!0);try{const[S,w,N,_]=await Promise.all([ue.getAnalysisStatus(),ue.getDataStatus(),ue.getAnalysisSchedule(),ue.getAnalysisReports()]);if(!p.current)return;t(S),r(w),o(N),c(_),m(null)}catch(S){p.current&&m(S?.response?.data?.error||S?.message||"Unable to load scheduled AI reports")}finally{p.current&&!y&&d(!1)}},[]);return k.useEffect(()=>(p.current=!0,g(),()=>{p.current=!1}),[g]),k.useEffect(()=>{if(!i.some(S=>S.status==="PENDING"||S.status==="RUNNING"))return;const y=window.setInterval(()=>{g(!0)},15e3);return()=>window.clearInterval(y)},[g,i]),{status:e,dataStatus:s,schedule:n,reports:i,loading:l,saving:f,error:h,load:g,saveSchedule:async y=>{u(!0),m(null);try{const S=await ue.updateAnalysisSchedule(y);p.current&&o(S)}catch(S){throw m(S?.response?.data?.error||S?.message||"Unable to save the AI report schedule"),S}finally{p.current&&u(!1)}},download:async y=>{try{const S=await ue.downloadAnalysisPdf(y.id),w=URL.createObjectURL(S),N=document.createElement("a");N.href=w,N.download=`meyi-cost-analysis-${y.period.Start}.pdf`,N.click(),URL.revokeObjectURL(w)}catch(S){m(S?.response?.data?.error||S?.message||"Unable to download the PDF report")}}}}const er=e=>e?new Date(e).toLocaleString():"Not scheduled",$f=e=>new Date(`${e}T00:00:00Z`).toLocaleDateString(),Bf=e=>{const t=new Date(`${e}T00:00:00Z`);return t.setUTCDate(t.getUTCDate()-1),t.toLocaleDateString()},zf={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 Vf(){const e=Uf(),t=Mf(),[s,r]=k.useState(!1),n=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(An,{className:"h-6 w-6 text-primary"}),"AI Cost Analysis"]}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Scheduled FinOps reports generated from AWS CUR data"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[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(wt,{className:`h-4 w-4 ${e.loading?"animate-spin":""}`})}),n&&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(ra,{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(lt,{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(Cs,{status:e.dataStatus}):e.status&&!e.status.enabled?a.jsx(ie,{children:a.jsxs(ce,{className:"flex min-h-64 flex-col items-center justify-center px-6 text-center",children:[a.jsx(An,{className:"h-8 w-8 text-muted-foreground"}),a.jsx("h2",{className:"mt-4 text-base font-semibold",children:e.status.reason==="AI_PROVIDER_REQUIRED"?"Configure an AI provider":"AI cost analysis is not enabled"}),a.jsx("p",{className:"mt-2 max-w-xl text-sm text-muted-foreground",children:e.status.reason==="AI_PROVIDER_REQUIRED"?"Configure and activate an AI provider in Meyi Connect before scheduled cost reports can run.":"An administrator must enable the Cost AI deployment setting before scheduled reports can run."})]})}):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(Xo,{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 ${er(e.schedule.nextRunAt)} (${e.schedule.timezone})`:n?"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 ",er(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-[900px] 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:"PDF"})]})}),a.jsx("tbody",{children:e.reports.map(o=>a.jsxs("tr",{className:"border-b last:border-0",children:[a.jsxs("td",{className:"px-4 py-3 font-medium",children:[$f(o.period.Start)," - ",Bf(o.period.End)]}),a.jsx("td",{className:"px-4 py-3 capitalize text-muted-foreground",children:o.frequency}),a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("span",{className:"capitalize",children:o.provider||"-"}),o.modelId&&a.jsx("p",{className:"max-w-48 truncate text-xs text-muted-foreground",title:o.modelId,children:o.modelId})]}),a.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:er(o.completedAt||o.startedAt||o.createdAt)}),a.jsxs("td",{className:"px-4 py-3",children:[a.jsxs("span",{className:`inline-flex items-center gap-1.5 rounded-full border px-2 py-1 text-xs font-medium ${zf[o.status]}`,children:[(o.status==="RUNNING"||o.status==="PENDING")&&a.jsx(It,{className:"h-3 w-3 animate-spin"}),o.status.toLowerCase()]}),o.error&&a.jsx("p",{className:"mt-1 max-w-xs truncate text-xs text-destructive",title:o.error,children:o.error})]}),a.jsx("td",{className:"px-4 py-3",children:o.facts?new Intl.NumberFormat(void 0,{style:"currency",currency:o.facts.currency}).format(o.facts.currentTotal):"-"}),a.jsx("td",{className:"px-4 py-3 text-right",children:a.jsxs("button",{type:"button",onClick:()=>{e.download(o)},disabled:!o.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:o.pdfReady?"Download PDF":"PDF not ready",children:[a.jsx(Cr,{className:"h-4 w-4"}),"Download"]})})]},o.id))})]})})}):a.jsx(ie,{children:a.jsxs(ce,{className:"flex min-h-64 flex-col items-center justify-center px-6 text-center",children:[a.jsx(ta,{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(Ff,{open:s,schedule:e.schedule,saving:e.saving,onClose:()=>r(!1),onSave:e.saveSchedule})]})}const Ct=ic({component:So}),Wf=zt({getParentRoute:()=>Ct,path:"/",component:mf}),Hf=zt({getParentRoute:()=>Ct,path:"/reports",component:_f}),qf=zt({getParentRoute:()=>Ct,path:"/cur-discovery",component:Pf}),Gf=zt({getParentRoute:()=>Ct,path:"/analysis",component:Vf}),Kf=zt({getParentRoute:()=>Ct,path:"/sources",component:Of});function Pr(){return Ct.addChildren([Wf,Gf,Hf,Kf,qf])}function Yf(e="/cost"){return Ro({routeTree:Pr(),basepath:e})}function Jf({apiBase:e,token:t,basePath:s="/cost",userRole:r="user"}){Yo(e,t);const n=k.useMemo(()=>Ro({routeTree:Pr(),basepath:s}),[s]);return a.jsx(Lf,{value:r,children:a.jsx(Sc,{router:n})})}const Xf=[{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=Jf;exports.api=re;exports.attachAuthInterceptors=wd;exports.configureApi=Yo;exports.costNavItems=Xf;exports.createCostRouter=Yf;exports.createRouteTree=Pr;
|
|
21
|
+
`),f=`${n}-summary-report-${Date.now()}.csv`);const u=document.createElement("a");u.href=URL.createObjectURL(new Blob([d],{type:"text/csv"})),u.download=f,u.click(),URL.revokeObjectURL(u.href)}async function kf(e){const{report:t,comparison:s,rows:r,groupBy:n,mode:o,start:i,end:c,granularity:l}=e,d=at[n],[{jsPDF:f},{default:u}]=await Promise.all([Promise.resolve().then(()=>require("./jspdf.es.min-C10id8ME.cjs")).then(g=>g.jspdf_es_min),Promise.resolve().then(()=>require("./jspdf.plugin.autotable-CvTok6mL.cjs"))]),h=new f({orientation:"landscape",unit:"pt",format:"a4"}),m=(g,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 ${g.pageNumber}`,h.internal.pageSize.width-70,h.internal.pageSize.height-18)};if(o==="compare"&&s){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: ${s.previous.totalCost}`,40,82),h.text(`Current Cost: ${s.current.totalCost}`,220,82),h.text(`Granularity: ${l}`,400,82),u(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(g=>[g.label,g.current?.amount?.toFixed(2)||"0.00",g.previous?.amount?.toFixed(2)||"0.00",Rt(s.currentStart,s.currentEnd,l),Rt(s.previousStart,s.previousEnd,l),`${g.change.toFixed(4)}%`,Xe(g.current?.accounts),Xe(g.previous?.accounts),Xe(g.current?.regions),Xe(g.previous?.regions)]),styles:{fontSize:6,cellPadding:3,overflow:"linebreak"},headStyles:{fillColor:[242,237,255],textColor:[82,35,190]},didDrawPage:g=>m(g,s.previousStart,s.currentEnd),margin:{bottom:32}}),h.save(`comparison-report-${n}-${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: ${K(t.totalCost,t.currency)}`,40,112),h.setTextColor(98,86,230),h.text("COST SUMMARY BREAKDOWN",40,136);const p=n==="account";u(h,{startY:146,head:[p?["Account ID","Account Name","Total Cost","Percentage","Regions"]:[`${d.item} Name`,"Total Cost","Percentage","Accounts","Regions"]],body:t.summary.map(g=>p?[g.accountId||g.key||"—",g.label,K(g.amount,t.currency),`${(g.percentage||0).toFixed(2)}%`,Xe(g.regions)]:[g.label,K(g.amount,t.currency),`${(g.percentage||0).toFixed(2)}%`,Xe(g.accounts),Xe(g.regions)]),styles:{fontSize:7,cellPadding:4,overflow:"linebreak"},headStyles:{fillColor:[242,237,255],textColor:[82,35,190]},didDrawPage:g=>m(g,i,c),margin:{bottom:32}}),h.save(`${n}-summary-report-${Date.now()}.pdf`)}function Ef(){const e=Cf(),{groupBy:t,mode:s,report:r,comparison:n,comparedRows:o,loading:i,error:c,dataStatus:l,granularity:d,start:f,end:u}=e,h=at[t],m=r?.summary[0],p=n?n.current.totalCost-n.previous.totalCost:0,g=n?.previous.totalCost?p/Math.abs(n.previous.totalCost)*100:0,x=r?{report:r,comparison:n,rows:o,groupBy:t,mode:s,start:f,end:u,granularity:d}:null,b=a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{onClick:()=>x&&void kf(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(Yd,{className:"h-4 w-4"}),"PDF"]}),a.jsxs("button",{onClick:()=>x&&_f(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(Cr,{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",{children:[a.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold",children:[a.jsx(ta,{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"})]}),!i&&(l&&!l.ready||c&&!l)?a.jsx(Cs,{status:l,error:c}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"flex gap-1 overflow-x-auto border-b",children:Object.keys(at).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:at[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(lt,{className:"h-4 w-4"}),c]}),i?a.jsx(yf,{}):s==="compare"&&n?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: ",Bn(n.current.updatedAt)]})]}),b]}),a.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[a.jsx(Le,{label:"Period accrued total",value:`${K(n.current.totalCost,n.current.currency)} vs ${K(n.previous.totalCost,n.previous.currency)}`,helper:`${g>=0?"+":""}${g.toFixed(1)}% from previous period`,trend:g}),a.jsx(Le,{label:Rt(n.currentStart,n.currentEnd,d),value:K(n.current.totalCost,n.current.currency),helper:"Current period spending"}),a.jsx(Le,{label:Rt(n.previousStart,n.previousEnd,d),value:K(n.previous.totalCost,n.previous.currency),helper:"Previous period spending"}),a.jsx(Le,{label:d==="monthly"?"Monthly change":"Period change",value:`${p>=0?"+":""}${K(p,n.current.currency)}`,helper:`${g>=0?"+":""}${g.toFixed(1)}% from previous period`,trend:p})]})]}),a.jsx(bf,{rows:o,currency:n.current.currency}),a.jsx(jf,{rows:o,groupBy:t,comparison:n,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(lt,{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: ",Bn(r.updatedAt)]})]}),b]}),a.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[a.jsx(Le,{label:"Accrued cost",value:K(r.totalCost,r.currency)}),a.jsx(Le,{label:h.top,value:m?K(m.amount,r.currency):"-",accent:!0}),a.jsx(Le,{label:h.count,value:String(r.count||0),accent:!0})]})]}),a.jsxs(ce,{children:[a.jsx(ve,{children:a.jsx(Ne,{className:"text-sm",children:"Cost Trend"})}),a.jsx(le,{children:a.jsx(xf,{timeline:r.timeline||[],currency:r.currency||"USD",daily:d==="daily"})})]}),a.jsx(Rf,{groupBy:t,report:r})]}):null]}),a.jsx(Nf,{mode:s,groupBy:t,start:f,end:u,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 Wn={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"},Pf={INFO:"text-muted-foreground",WARN:"text-amber-600",ERROR:"text-destructive"},os=e=>e?new Date(e).toLocaleString():"—";function Tf({status:e}){return a.jsx("span",{className:`rounded-full border px-2 py-0.5 text-xs font-medium ${Wn[e]||Wn.PENDING}`,children:e.replace(/_/g," ")})}function De({label:e,value:t,mono:s}){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 ${s?"font-mono text-xs":""}`,children:t||"—"})]})}function Af(){const[e,t]=k.useState([]),[s,r]=k.useState([]),[n,o]=k.useState(!0),[i,c]=k.useState(null),l=k.useCallback(async()=>{o(!0),c(null);try{const d=await re.get("/cur-discovery",{params:{logLimit:100}});t(d.data?.jobs||[]),r(d.data?.logs||[])}catch(d){c(d?.response?.data?.error||d?.message||"Unable to load CUR discovery status")}finally{o(!1)}},[]);return k.useEffect(()=>{l()},[l]),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(_r,{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.jsx("button",{onClick:()=>{l()},disabled:n,className:"rounded-lg border p-2 hover:bg-muted disabled:opacity-50","aria-label":"Refresh",children:a.jsx(St,{className:`h-4 w-4 ${n?"animate-spin":""}`})})]}),i&&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(lt,{className:"h-4 w-4"}),i]}),!n&&!i&&!e.length&&a.jsx(ce,{children:a.jsx(le,{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."})}),e.map(d=>a.jsxs(ce,{children:[a.jsxs(ve,{className:"flex flex-row flex-wrap items-center gap-3",children:[a.jsx(Zo,{className:"h-4 w-4 text-primary"}),a.jsxs(Ne,{className:"text-sm",children:["Connection ",d.connectionId]}),a.jsx(Tf,{status:d.status}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:["attempt ",d.attemptCount]}),a.jsxs("span",{className:"ms-auto text-xs text-muted-foreground",children:["next check ",os(d.nextRunAt)]})]}),a.jsxs(le,{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[a.jsx(De,{label:"Source",value:d.curS3Uri||`s3://${d.bucket}/${d.prefix}`,mono:!0}),a.jsx(De,{label:"Tenant partition",value:d.tenantPartition,mono:!0}),a.jsx(De,{label:"Region",value:d.region}),a.jsx(De,{label:"Glue database",value:d.database,mono:!0}),a.jsx(De,{label:"Discovered table",value:d.table,mono:!0}),a.jsx(De,{label:"Table location",value:d.tableLocation,mono:!0}),a.jsx(De,{label:"Sample object",value:d.sampleObjectKey,mono:!0}),a.jsx(De,{label:"Last data",value:os(d.lastDataAt)}),a.jsx(De,{label:"Last checked",value:os(d.lastFinishedAt||d.lastStartedAt)}),d.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:d.lastError})]})]},d.id)),e.length>0&&a.jsxs(ce,{children:[a.jsx(ve,{children:a.jsx(Ne,{className:"text-sm",children:"Recent activity"})}),a.jsx(le,{children:s.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:s.map(d=>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:os(d.createdAt)}),a.jsx("td",{className:`py-2 pe-4 text-xs font-medium ${Pf[d.level]||""}`,children:d.level}),a.jsx("td",{className:"whitespace-nowrap py-2 pe-4 font-mono text-xs",children:d.event}),a.jsx("td",{className:"py-2",children:d.message})]},d.id))})]})}):a.jsx("p",{className:"py-6 text-center text-sm text-muted-foreground",children:"No log entries recorded yet."})})]})]})}const Of="https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/template",Lf=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",as=e=>e?.response?.data?.error||e?.response?.data?.message||e?.message||"Request failed";function Mf(){const[e,t]=k.useState([]),[s,r]=k.useState(!0),[n,o]=k.useState(!1),[i,c]=k.useState(""),[l,d]=k.useState(!1),[f,u]=k.useState(null),[h,m]=k.useState(null),[p,g]=k.useState(null),x=k.useCallback(async()=>{r(!0),g(null);try{t((await ie.getSources()).sources||[])}catch(w){g(as(w))}finally{r(!1)}},[]);k.useEffect(()=>{x()},[x]);const b=async w=>{if(w.preventDefault(),!/^\d{12}$/.test(i)){g("AWS account ID must contain exactly 12 digits");return}m("create"),g(null);try{const N=await ie.createSource({managementAccountId:i,regionMode:l?"ALL":"SINGLE"});u(N.connectionId),o(!1),c(""),d(!1),await x()}catch(N){g(as(N))}finally{m(null)}},y=async w=>{m(`download-${w}`),g(null);try{const N=await ie.downloadSourceTemplate(w),j=URL.createObjectURL(N),_=document.createElement("a");_.href=j,_.download=`meyi-connect-cost-${w}.yaml`,_.click(),URL.revokeObjectURL(j),u(w)}catch(N){g(as(N))}finally{m(null)}},S=async w=>{m(`verify-${w}`),g(null);try{const N=await ie.verifySource(w);N.status==="FAILED"&&g(N.message||"AWS connection verification failed"),await x()}catch(N){g(as(N))}finally{m(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(js,{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:()=>{x()},disabled:s,className:"rounded-md border p-2 hover:bg-muted disabled:opacity-50","aria-label":"Refresh sources",title:"Refresh sources",children:a.jsx(St,{className:`h-4 w-4 ${s?"animate-spin":""}`})}),a.jsxs("button",{type:"button",onClick:()=>{g(null),o(!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(ru,{className:"h-4 w-4"}),"Add AWS account"]})]})]}),p&&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(lt,{className:"mt-0.5 h-4 w-4 shrink-0"}),p]}),!s&&e.length===0&&a.jsxs("div",{className:"rounded-md border border-dashed py-14 text-center",children:[a.jsx(js,{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."})]}),e.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:e.map(w=>a.jsxs("tr",{className:`border-b last:border-0 ${f===w.connectionId?"bg-muted/30":""}`,children:[a.jsx("td",{className:"px-4 py-3 font-mono",children:w.managementAccountId||"Pending"}),a.jsx("td",{className:"px-4 py-3 font-mono text-xs",children:w.connectionId}),a.jsxs("td",{className:"px-4 py-3",children:[w.accountScope," / ",w.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 ${Lf(w.status)}`,children:w.status.replace(/_/g," ")}),w.stackSetStatus&&a.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:w.stackSetStatus.replace(/_/g," ")})]}),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:()=>{y(w.connectionId)},disabled:!!h,className:"rounded-md border p-2 hover:bg-muted disabled:opacity-50",title:"Download CloudFormation template","aria-label":"Download CloudFormation template",children:h===`download-${w.connectionId}`?a.jsx(bt,{className:"h-4 w-4 animate-spin"}):a.jsx(Cr,{className:"h-4 w-4"})}),a.jsx("a",{href:Of,target:"_blank",rel:"noreferrer",className:"rounded-md border p-2 hover:bg-muted",title:"Open AWS CloudFormation","aria-label":"Open AWS CloudFormation",children:a.jsx(ea,{className:"h-4 w-4"})}),a.jsxs("button",{type:"button",onClick:()=>{S(w.connectionId)},disabled:!!h||w.status==="CONNECTED",className:"flex items-center gap-2 rounded-md border px-3 py-2 font-medium hover:bg-muted disabled:opacity-50",children:[h===`verify-${w.connectionId}`?a.jsx(bt,{className:"h-4 w-4 animate-spin"}):w.status==="CONNECTED"?a.jsx($d,{className:"h-4 w-4 text-emerald-600"}):a.jsx(St,{className:"h-4 w-4"}),w.status==="CONNECTED"?"Connected":"Verify"]})]})})]},w.connectionId))})]})}),n&&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:w=>{b(w)},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:()=>o(!1),className:"rounded-md p-1 hover:bg-muted","aria-label":"Close",children:a.jsx(Os,{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:i,onChange:w=>c(w.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:l,onChange:w=>d(w.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:()=>o(!1),className:"rounded-md border px-4 py-2 text-sm font-medium hover:bg-muted",children:"Cancel"}),a.jsxs("button",{type:"submit",disabled:h==="create"||i.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:[h==="create"&&a.jsx(bt,{className:"h-4 w-4 animate-spin"}),"Create source"]})]})]})})]})}const Sa=k.createContext("user"),If=Sa.Provider,Df=()=>k.useContext(Sa),Ff=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Uf=["UTC","Asia/Kolkata","America/New_York","America/Los_Angeles","Europe/London","Europe/Berlin","Asia/Singapore","Asia/Tokyo","Australia/Sydney"];function $f({open:e,schedule:t,saving:s,onClose:r,onSave:n}){const[o,i]=k.useState(t);if(k.useEffect(()=>i(t),[t,e]),!e)return null;const c=l=>i(d=>({...d,frequency:l}));return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/55 p-4",role:"presentation",onMouseDown:l=>{l.target===l.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(Xo,{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(Os,{className:"h-4 w-4"})})]}),a.jsxs("form",{className:"space-y-5 p-5",onSubmit:l=>{l.preventDefault(),n({enabled:o.enabled,frequency:o.frequency,time:o.time,timezone:o.timezone,dayOfWeek:o.dayOfWeek,dayOfMonth:o.dayOfMonth}).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:l=>i(d=>({...d,enabled:l.target.checked})),className:"h-4 w-4 accent-primary"})]}),a.jsxs("fieldset",{disabled:!o.enabled||s,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(l=>a.jsx("button",{type:"button",onClick:()=>c(l),className:`rounded-md px-3 py-2 text-sm capitalize ${o.frequency===l?"bg-primary text-primary-foreground":"hover:bg-muted"}`,children:l},l))})]}),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:l=>i(d=>({...d,time:l.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:l=>i(d=>({...d,timezone:l.target.value})),className:"mt-2 block h-10 w-full rounded-lg border bg-background px-3 font-normal",children:[...new Set([o.timezone,...Uf])].map(l=>a.jsx("option",{children:l},l))})]})]}),o.frequency==="weekly"&&a.jsxs("label",{className:"block text-sm font-medium",children:["Day of week",a.jsx("select",{value:o.dayOfWeek??1,onChange:l=>i(d=>({...d,dayOfWeek:Number(l.target.value)})),className:"mt-2 block h-10 w-full rounded-lg border bg-background px-3 font-normal",children:Ff.map((l,d)=>a.jsx("option",{value:d,children:l},l))})]}),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:l=>i(d=>({...d,dayOfMonth:Number(l.target.value)})),className:"mt-2 block h-10 w-full rounded-lg border bg-background px-3 font-normal"})]}),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:s,className:"rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground disabled:opacity-50",children:s?"Saving":"Save schedule"})]})]})]})})}function Bf(){const[e,t]=k.useState(null),[s,r]=k.useState(null),[n,o]=k.useState(null),[i,c]=k.useState([]),[l,d]=k.useState(!0),[f,u]=k.useState(!1),[h,m]=k.useState(null),[p,g]=k.useState(null),x=k.useRef(!0),b=k.useCallback(async(N=!1)=>{N||d(!0);try{const[j,_,R,E]=await Promise.all([ie.getAnalysisStatus(),ie.getDataStatus(),ie.getAnalysisSchedule(),ie.getAnalysisReports()]);if(!x.current)return;t(j),r(_),o(R),c(E),g(null)}catch(j){x.current&&g(j?.response?.data?.error||j?.message||"Unable to load scheduled AI reports")}finally{x.current&&!N&&d(!1)}},[]);return k.useEffect(()=>(x.current=!0,b(),()=>{x.current=!1}),[b]),k.useEffect(()=>{if(!i.some(j=>j.status==="PENDING"||j.status==="RUNNING"))return;const N=window.setInterval(()=>{b(!0)},15e3);return()=>window.clearInterval(N)},[b,i]),{status:e,dataStatus:s,schedule:n,reports:i,loading:l,saving:f,removingId:h,error:p,load:b,saveSchedule:async N=>{u(!0),g(null);try{const j=await ie.updateAnalysisSchedule(N);x.current&&o(j)}catch(j){throw g(j?.response?.data?.error||j?.message||"Unable to save the AI report schedule"),j}finally{x.current&&u(!1)}},download:async N=>{try{const j=await ie.downloadAnalysisPdf(N.id),_=URL.createObjectURL(j),R=document.createElement("a");R.href=_,R.download=`meyi-cost-analysis-${N.period.Start}.pdf`,R.click(),URL.revokeObjectURL(_)}catch(j){g(j?.response?.data?.error||j?.message||"Unable to download the PDF report")}},remove:async N=>{if(window.confirm(`Remove the AI cost report for ${N.period.Start} through ${N.period.End}?`)){m(N.id),g(null);try{await ie.removeAnalysisReport(N.id),x.current&&c(j=>j.filter(_=>_.id!==N.id))}catch(j){x.current&&g(j?.response?.data?.error||j?.message||"Unable to remove the AI report")}finally{x.current&&m(null)}}}}}const er=e=>e?new Date(e).toLocaleString():"Not scheduled",zf=e=>new Date(`${e}T00:00:00Z`).toLocaleDateString(),Vf=e=>{const t=new Date(`${e}T00:00:00Z`);return t.setUTCDate(t.getUTCDate()-1),t.toLocaleDateString()},Wf={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 Hf(){const e=Bf(),t=Df(),[s,r]=k.useState(!1),n=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(An,{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 items-center gap-2",children:[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(St,{className:`h-4 w-4 ${e.loading?"animate-spin":""}`})}),n&&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(ra,{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(lt,{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(Cs,{status:e.dataStatus}):e.status&&!e.status.enabled?a.jsx(ce,{children:a.jsxs(le,{className:"flex min-h-64 flex-col items-center justify-center px-6 text-center",children:[a.jsx(An,{className:"h-8 w-8 text-muted-foreground"}),a.jsx("h2",{className:"mt-4 text-base font-semibold",children:e.status.reason==="AI_PROVIDER_REQUIRED"?"Configure an AI provider":"AI cost analysis is not enabled"}),a.jsx("p",{className:"mt-2 max-w-xl text-sm text-muted-foreground",children:e.status.reason==="AI_PROVIDER_REQUIRED"?"Configure and activate an AI provider in Meyi Connect before scheduled cost reports can run.":"An administrator must enable the Cost AI deployment setting before scheduled reports can run."})]})}):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(Xo,{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 ${er(e.schedule.nextRunAt)} (${e.schedule.timezone})`:n?"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 ",er(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(o=>a.jsxs("tr",{className:"border-b last:border-0",children:[a.jsxs("td",{className:"px-4 py-3 font-medium",children:[zf(o.period.Start)," - ",Vf(o.period.End)]}),a.jsx("td",{className:"px-4 py-3 capitalize text-muted-foreground",children:o.frequency}),a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("span",{className:"capitalize",children:o.provider||"-"}),o.modelId&&a.jsx("p",{className:"max-w-48 truncate text-xs text-muted-foreground",title:o.modelId,children:o.modelId})]}),a.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:er(o.completedAt||o.startedAt||o.createdAt)}),a.jsxs("td",{className:"px-4 py-3",children:[a.jsxs("span",{className:`inline-flex items-center gap-1.5 rounded-full border px-2 py-1 text-xs font-medium ${Wf[o.status]}`,children:[(o.status==="RUNNING"||o.status==="PENDING")&&a.jsx(bt,{className:"h-3 w-3 animate-spin"}),o.status.toLowerCase()]}),o.error&&a.jsx("p",{className:"mt-1 max-w-xs truncate text-xs text-destructive",title:o.error,children:o.error})]}),a.jsx("td",{className:"px-4 py-3",children:o.facts?new Intl.NumberFormat(void 0,{style:"currency",currency:o.facts.currency}).format(o.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(o)},disabled:!o.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:o.pdfReady?"Download PDF":"PDF not ready",children:[a.jsx(Cr,{className:"h-4 w-4"}),"Download"]}),n&&a.jsx("button",{type:"button",onClick:()=>{e.remove(o)},disabled:e.removingId===o.id||o.status==="RUNNING"||o.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===o.id?a.jsx(bt,{className:"h-4 w-4 animate-spin"}):a.jsx(du,{className:"h-4 w-4"})})]})})]},o.id))})]})})}):a.jsx(ce,{children:a.jsxs(le,{className:"flex min-h-64 flex-col items-center justify-center px-6 text-center",children:[a.jsx(ta,{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($f,{open:s,schedule:e.schedule,saving:e.saving,onClose:()=>r(!1),onSave:e.saveSchedule})]})}const _t=ic({component:So}),qf=zt({getParentRoute:()=>_t,path:"/",component:gf}),Gf=zt({getParentRoute:()=>_t,path:"/reports",component:Ef}),Kf=zt({getParentRoute:()=>_t,path:"/cur-discovery",component:Af}),Yf=zt({getParentRoute:()=>_t,path:"/analysis",component:Hf}),Jf=zt({getParentRoute:()=>_t,path:"/sources",component:Mf});function Pr(){return _t.addChildren([qf,Yf,Gf,Jf,Kf])}function Xf(e="/cost"){return Ro({routeTree:Pr(),basepath:e})}function Zf({apiBase:e,token:t,basePath:s="/cost",userRole:r="user"}){Yo(e,t);const n=k.useMemo(()=>Ro({routeTree:Pr(),basepath:s}),[s]);return a.jsx(If,{value:r,children:a.jsx(Sc,{router:n})})}const Qf=[{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=Zf;exports.api=re;exports.attachAuthInterceptors=wd;exports.configureApi=Yo;exports.costNavItems=Qf;exports.createCostRouter=Xf;exports.createRouteTree=Pr;
|