tokmon 0.21.0 → 0.22.1
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/{bootstrap-ink-QHJOOWIW.js → bootstrap-ink-CCESIGED.js} +121 -39
- package/dist/{chunk-7MFZMI5C.js → chunk-E25RUTXB.js} +12 -0
- package/dist/{chunk-YCIUMAKK.js → chunk-FLLNU6BN.js} +380 -123
- package/dist/{chunk-CPN67OK6.js → chunk-RA3SCIG6.js} +4 -52
- package/dist/cli.js +4 -4
- package/dist/{config-UPNBGIJO.js → config-F7TY5ZFA.js} +5 -1
- package/dist/{daemon-LZVP4SWF.js → daemon-A3NSDSPZ.js} +3 -3
- package/dist/server-P7T4ZMC6.js +9 -0
- package/dist/web/assets/breakdown-C3Zqnewe.js +4 -0
- package/dist/web/assets/{index-CZOCHnad.css → index-BCaPGYQA.css} +1 -1
- package/dist/web/assets/index-BkdjevbO.js +173 -0
- package/dist/web/assets/timeline-C2vHjZJ3.js +1 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/server-F7CUK4ZM.js +0 -9
- package/dist/web/assets/breakdown-ClwCJce8.js +0 -4
- package/dist/web/assets/chart-Dcuh_e3J.js +0 -69
- package/dist/web/assets/index-nAr5lqix.js +0 -105
- package/dist/web/assets/timeline-gDyrCQ0O.js +0 -2
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./timeline-gDyrCQ0O.js","./chart-Dcuh_e3J.js","./breakdown-ClwCJce8.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var KE=Object.defineProperty;var QE=(e,t,n)=>t in e?KE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var O=(e,t,n)=>QE(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const u of a.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&s(u)}).observe(document,{childList:!0,subtree:!0});function n(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function s(i){if(i.ep)return;i.ep=!0;const a=n(i);fetch(i.href,a)}})();var D5=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function JE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Th={exports:{}},Sa={},$h={exports:{}},Pe={};/**
|
|
3
|
-
* @license React
|
|
4
|
-
* react.production.min.js
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
7
|
-
*
|
|
8
|
-
* This source code is licensed under the MIT license found in the
|
|
9
|
-
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/var mv;function YE(){if(mv)return Pe;mv=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),u=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),p=Symbol.iterator;function x(M){return M===null||typeof M!="object"?null:(M=p&&M[p]||M["@@iterator"],typeof M=="function"?M:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,k={};function b(M,J,pe){this.props=M,this.context=J,this.refs=k,this.updater=pe||v}b.prototype.isReactComponent={},b.prototype.setState=function(M,J){if(typeof M!="object"&&typeof M!="function"&&M!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,M,J,"setState")},b.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function _(){}_.prototype=b.prototype;function R(M,J,pe){this.props=M,this.context=J,this.refs=k,this.updater=pe||v}var j=R.prototype=new _;j.constructor=R,w(j,b.prototype),j.isPureReactComponent=!0;var E=Array.isArray,T=Object.prototype.hasOwnProperty,$={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};function U(M,J,pe){var he,ce={},be=null,$e=null;if(J!=null)for(he in J.ref!==void 0&&($e=J.ref),J.key!==void 0&&(be=""+J.key),J)T.call(J,he)&&!L.hasOwnProperty(he)&&(ce[he]=J[he]);var Ce=arguments.length-2;if(Ce===1)ce.children=pe;else if(1<Ce){for(var Ee=Array(Ce),lt=0;lt<Ce;lt++)Ee[lt]=arguments[lt+2];ce.children=Ee}if(M&&M.defaultProps)for(he in Ce=M.defaultProps,Ce)ce[he]===void 0&&(ce[he]=Ce[he]);return{$$typeof:e,type:M,key:be,ref:$e,props:ce,_owner:$.current}}function z(M,J){return{$$typeof:e,type:M.type,key:J,ref:M.ref,props:M.props,_owner:M._owner}}function Z(M){return typeof M=="object"&&M!==null&&M.$$typeof===e}function te(M){var J={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(pe){return J[pe]})}var ae=/\/+/g;function P(M,J){return typeof M=="object"&&M!==null&&M.key!=null?te(""+M.key):J.toString(36)}function H(M,J,pe,he,ce){var be=typeof M;(be==="undefined"||be==="boolean")&&(M=null);var $e=!1;if(M===null)$e=!0;else switch(be){case"string":case"number":$e=!0;break;case"object":switch(M.$$typeof){case e:case t:$e=!0}}if($e)return $e=M,ce=ce($e),M=he===""?"."+P($e,0):he,E(ce)?(pe="",M!=null&&(pe=M.replace(ae,"$&/")+"/"),H(ce,J,pe,"",function(lt){return lt})):ce!=null&&(Z(ce)&&(ce=z(ce,pe+(!ce.key||$e&&$e.key===ce.key?"":(""+ce.key).replace(ae,"$&/")+"/")+M)),J.push(ce)),1;if($e=0,he=he===""?".":he+":",E(M))for(var Ce=0;Ce<M.length;Ce++){be=M[Ce];var Ee=he+P(be,Ce);$e+=H(be,J,pe,Ee,ce)}else if(Ee=x(M),typeof Ee=="function")for(M=Ee.call(M),Ce=0;!(be=M.next()).done;)be=be.value,Ee=he+P(be,Ce++),$e+=H(be,J,pe,Ee,ce);else if(be==="object")throw J=String(M),Error("Objects are not valid as a React child (found: "+(J==="[object Object]"?"object with keys {"+Object.keys(M).join(", ")+"}":J)+"). If you meant to render a collection of children, use an array instead.");return $e}function X(M,J,pe){if(M==null)return M;var he=[],ce=0;return H(M,he,"","",function(be){return J.call(pe,be,ce++)}),he}function K(M){if(M._status===-1){var J=M._result;J=J(),J.then(function(pe){(M._status===0||M._status===-1)&&(M._status=1,M._result=pe)},function(pe){(M._status===0||M._status===-1)&&(M._status=2,M._result=pe)}),M._status===-1&&(M._status=0,M._result=J)}if(M._status===1)return M._result.default;throw M._result}var q={current:null},Y={transition:null},se={ReactCurrentDispatcher:q,ReactCurrentBatchConfig:Y,ReactCurrentOwner:$};function ee(){throw Error("act(...) is not supported in production builds of React.")}return Pe.Children={map:X,forEach:function(M,J,pe){X(M,function(){J.apply(this,arguments)},pe)},count:function(M){var J=0;return X(M,function(){J++}),J},toArray:function(M){return X(M,function(J){return J})||[]},only:function(M){if(!Z(M))throw Error("React.Children.only expected to receive a single React element child.");return M}},Pe.Component=b,Pe.Fragment=n,Pe.Profiler=i,Pe.PureComponent=R,Pe.StrictMode=s,Pe.Suspense=d,Pe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=se,Pe.act=ee,Pe.cloneElement=function(M,J,pe){if(M==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+M+".");var he=w({},M.props),ce=M.key,be=M.ref,$e=M._owner;if(J!=null){if(J.ref!==void 0&&(be=J.ref,$e=$.current),J.key!==void 0&&(ce=""+J.key),M.type&&M.type.defaultProps)var Ce=M.type.defaultProps;for(Ee in J)T.call(J,Ee)&&!L.hasOwnProperty(Ee)&&(he[Ee]=J[Ee]===void 0&&Ce!==void 0?Ce[Ee]:J[Ee])}var Ee=arguments.length-2;if(Ee===1)he.children=pe;else if(1<Ee){Ce=Array(Ee);for(var lt=0;lt<Ee;lt++)Ce[lt]=arguments[lt+2];he.children=Ce}return{$$typeof:e,type:M.type,key:ce,ref:be,props:he,_owner:$e}},Pe.createContext=function(M){return M={$$typeof:u,_currentValue:M,_currentValue2:M,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},M.Provider={$$typeof:a,_context:M},M.Consumer=M},Pe.createElement=U,Pe.createFactory=function(M){var J=U.bind(null,M);return J.type=M,J},Pe.createRef=function(){return{current:null}},Pe.forwardRef=function(M){return{$$typeof:f,render:M}},Pe.isValidElement=Z,Pe.lazy=function(M){return{$$typeof:m,_payload:{_status:-1,_result:M},_init:K}},Pe.memo=function(M,J){return{$$typeof:h,type:M,compare:J===void 0?null:J}},Pe.startTransition=function(M){var J=Y.transition;Y.transition={};try{M()}finally{Y.transition=J}},Pe.unstable_act=ee,Pe.useCallback=function(M,J){return q.current.useCallback(M,J)},Pe.useContext=function(M){return q.current.useContext(M)},Pe.useDebugValue=function(){},Pe.useDeferredValue=function(M){return q.current.useDeferredValue(M)},Pe.useEffect=function(M,J){return q.current.useEffect(M,J)},Pe.useId=function(){return q.current.useId()},Pe.useImperativeHandle=function(M,J,pe){return q.current.useImperativeHandle(M,J,pe)},Pe.useInsertionEffect=function(M,J){return q.current.useInsertionEffect(M,J)},Pe.useLayoutEffect=function(M,J){return q.current.useLayoutEffect(M,J)},Pe.useMemo=function(M,J){return q.current.useMemo(M,J)},Pe.useReducer=function(M,J,pe){return q.current.useReducer(M,J,pe)},Pe.useRef=function(M){return q.current.useRef(M)},Pe.useState=function(M){return q.current.useState(M)},Pe.useSyncExternalStore=function(M,J,pe){return q.current.useSyncExternalStore(M,J,pe)},Pe.useTransition=function(){return q.current.useTransition()},Pe.version="18.3.1",Pe}var yv;function yl(){return yv||(yv=1,$h.exports=YE()),$h.exports}/**
|
|
11
|
-
* @license React
|
|
12
|
-
* react-jsx-runtime.production.min.js
|
|
13
|
-
*
|
|
14
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
15
|
-
*
|
|
16
|
-
* This source code is licensed under the MIT license found in the
|
|
17
|
-
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/var xv;function XE(){if(xv)return Sa;xv=1;var e=yl(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function u(f,d,h){var m,p={},x=null,v=null;h!==void 0&&(x=""+h),d.key!==void 0&&(x=""+d.key),d.ref!==void 0&&(v=d.ref);for(m in d)s.call(d,m)&&!a.hasOwnProperty(m)&&(p[m]=d[m]);if(f&&f.defaultProps)for(m in d=f.defaultProps,d)p[m]===void 0&&(p[m]=d[m]);return{$$typeof:t,type:f,key:x,ref:v,props:p,_owner:i.current}}return Sa.Fragment=n,Sa.jsx=u,Sa.jsxs=u,Sa}var vv;function ZE(){return vv||(vv=1,Th.exports=XE()),Th.exports}var y=ZE(),V=yl();const Ga=JE(V);var Gu={},Fh={exports:{}},sn={},Lh={exports:{}},Oh={};/**
|
|
19
|
-
* @license React
|
|
20
|
-
* scheduler.production.min.js
|
|
21
|
-
*
|
|
22
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the MIT license found in the
|
|
25
|
-
* LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/var Sv;function eP(){return Sv||(Sv=1,(function(e){function t(Y,se){var ee=Y.length;Y.push(se);e:for(;0<ee;){var M=ee-1>>>1,J=Y[M];if(0<i(J,se))Y[M]=se,Y[ee]=J,ee=M;else break e}}function n(Y){return Y.length===0?null:Y[0]}function s(Y){if(Y.length===0)return null;var se=Y[0],ee=Y.pop();if(ee!==se){Y[0]=ee;e:for(var M=0,J=Y.length,pe=J>>>1;M<pe;){var he=2*(M+1)-1,ce=Y[he],be=he+1,$e=Y[be];if(0>i(ce,ee))be<J&&0>i($e,ce)?(Y[M]=$e,Y[be]=ee,M=be):(Y[M]=ce,Y[he]=ee,M=he);else if(be<J&&0>i($e,ee))Y[M]=$e,Y[be]=ee,M=be;else break e}}return se}function i(Y,se){var ee=Y.sortIndex-se.sortIndex;return ee!==0?ee:Y.id-se.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var u=Date,f=u.now();e.unstable_now=function(){return u.now()-f}}var d=[],h=[],m=1,p=null,x=3,v=!1,w=!1,k=!1,b=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function j(Y){for(var se=n(h);se!==null;){if(se.callback===null)s(h);else if(se.startTime<=Y)s(h),se.sortIndex=se.expirationTime,t(d,se);else break;se=n(h)}}function E(Y){if(k=!1,j(Y),!w)if(n(d)!==null)w=!0,K(T);else{var se=n(h);se!==null&&q(E,se.startTime-Y)}}function T(Y,se){w=!1,k&&(k=!1,_(U),U=-1),v=!0;var ee=x;try{for(j(se),p=n(d);p!==null&&(!(p.expirationTime>se)||Y&&!te());){var M=p.callback;if(typeof M=="function"){p.callback=null,x=p.priorityLevel;var J=M(p.expirationTime<=se);se=e.unstable_now(),typeof J=="function"?p.callback=J:p===n(d)&&s(d),j(se)}else s(d);p=n(d)}if(p!==null)var pe=!0;else{var he=n(h);he!==null&&q(E,he.startTime-se),pe=!1}return pe}finally{p=null,x=ee,v=!1}}var $=!1,L=null,U=-1,z=5,Z=-1;function te(){return!(e.unstable_now()-Z<z)}function ae(){if(L!==null){var Y=e.unstable_now();Z=Y;var se=!0;try{se=L(!0,Y)}finally{se?P():($=!1,L=null)}}else $=!1}var P;if(typeof R=="function")P=function(){R(ae)};else if(typeof MessageChannel<"u"){var H=new MessageChannel,X=H.port2;H.port1.onmessage=ae,P=function(){X.postMessage(null)}}else P=function(){b(ae,0)};function K(Y){L=Y,$||($=!0,P())}function q(Y,se){U=b(function(){Y(e.unstable_now())},se)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(Y){Y.callback=null},e.unstable_continueExecution=function(){w||v||(w=!0,K(T))},e.unstable_forceFrameRate=function(Y){0>Y||125<Y?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<Y?Math.floor(1e3/Y):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_getFirstCallbackNode=function(){return n(d)},e.unstable_next=function(Y){switch(x){case 1:case 2:case 3:var se=3;break;default:se=x}var ee=x;x=se;try{return Y()}finally{x=ee}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(Y,se){switch(Y){case 1:case 2:case 3:case 4:case 5:break;default:Y=3}var ee=x;x=Y;try{return se()}finally{x=ee}},e.unstable_scheduleCallback=function(Y,se,ee){var M=e.unstable_now();switch(typeof ee=="object"&&ee!==null?(ee=ee.delay,ee=typeof ee=="number"&&0<ee?M+ee:M):ee=M,Y){case 1:var J=-1;break;case 2:J=250;break;case 5:J=1073741823;break;case 4:J=1e4;break;default:J=5e3}return J=ee+J,Y={id:m++,callback:se,priorityLevel:Y,startTime:ee,expirationTime:J,sortIndex:-1},ee>M?(Y.sortIndex=ee,t(h,Y),n(d)===null&&Y===n(h)&&(k?(_(U),U=-1):k=!0,q(E,ee-M))):(Y.sortIndex=J,t(d,Y),w||v||(w=!0,K(T))),Y},e.unstable_shouldYield=te,e.unstable_wrapCallback=function(Y){var se=x;return function(){var ee=x;x=se;try{return Y.apply(this,arguments)}finally{x=ee}}}})(Oh)),Oh}var wv;function tP(){return wv||(wv=1,Lh.exports=eP()),Lh.exports}/**
|
|
27
|
-
* @license React
|
|
28
|
-
* react-dom.production.min.js
|
|
29
|
-
*
|
|
30
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
31
|
-
*
|
|
32
|
-
* This source code is licensed under the MIT license found in the
|
|
33
|
-
* LICENSE file in the root directory of this source tree.
|
|
34
|
-
*/var kv;function nP(){if(kv)return sn;kv=1;var e=yl(),t=tP();function n(r){for(var o="https://reactjs.org/docs/error-decoder.html?invariant="+r,l=1;l<arguments.length;l++)o+="&args[]="+encodeURIComponent(arguments[l]);return"Minified React error #"+r+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,i={};function a(r,o){u(r,o),u(r+"Capture",o)}function u(r,o){for(i[r]=o,r=0;r<o.length;r++)s.add(o[r])}var f=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),d=Object.prototype.hasOwnProperty,h=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,m={},p={};function x(r){return d.call(p,r)?!0:d.call(m,r)?!1:h.test(r)?p[r]=!0:(m[r]=!0,!1)}function v(r,o,l,c){if(l!==null&&l.type===0)return!1;switch(typeof o){case"function":case"symbol":return!0;case"boolean":return c?!1:l!==null?!l.acceptsBooleans:(r=r.toLowerCase().slice(0,5),r!=="data-"&&r!=="aria-");default:return!1}}function w(r,o,l,c){if(o===null||typeof o>"u"||v(r,o,l,c))return!0;if(c)return!1;if(l!==null)switch(l.type){case 3:return!o;case 4:return o===!1;case 5:return isNaN(o);case 6:return isNaN(o)||1>o}return!1}function k(r,o,l,c,g,S,C){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=c,this.attributeNamespace=g,this.mustUseProperty=l,this.propertyName=r,this.type=o,this.sanitizeURL=S,this.removeEmptyString=C}var b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(r){b[r]=new k(r,0,!1,r,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(r){var o=r[0];b[o]=new k(o,1,!1,r[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(r){b[r]=new k(r,2,!1,r.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(r){b[r]=new k(r,2,!1,r,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(r){b[r]=new k(r,3,!1,r.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(r){b[r]=new k(r,3,!0,r,null,!1,!1)}),["capture","download"].forEach(function(r){b[r]=new k(r,4,!1,r,null,!1,!1)}),["cols","rows","size","span"].forEach(function(r){b[r]=new k(r,6,!1,r,null,!1,!1)}),["rowSpan","start"].forEach(function(r){b[r]=new k(r,5,!1,r.toLowerCase(),null,!1,!1)});var _=/[\-:]([a-z])/g;function R(r){return r[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(r){var o=r.replace(_,R);b[o]=new k(o,1,!1,r,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(r){var o=r.replace(_,R);b[o]=new k(o,1,!1,r,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(r){var o=r.replace(_,R);b[o]=new k(o,1,!1,r,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(r){b[r]=new k(r,1,!1,r.toLowerCase(),null,!1,!1)}),b.xlinkHref=new k("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(r){b[r]=new k(r,1,!1,r.toLowerCase(),null,!0,!0)});function j(r,o,l,c){var g=b.hasOwnProperty(o)?b[o]:null;(g!==null?g.type!==0:c||!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(w(o,l,g,c)&&(l=null),c||g===null?x(o)&&(l===null?r.removeAttribute(o):r.setAttribute(o,""+l)):g.mustUseProperty?r[g.propertyName]=l===null?g.type===3?!1:"":l:(o=g.attributeName,c=g.attributeNamespace,l===null?r.removeAttribute(o):(g=g.type,l=g===3||g===4&&l===!0?"":""+l,c?r.setAttributeNS(c,o,l):r.setAttribute(o,l))))}var E=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,T=Symbol.for("react.element"),$=Symbol.for("react.portal"),L=Symbol.for("react.fragment"),U=Symbol.for("react.strict_mode"),z=Symbol.for("react.profiler"),Z=Symbol.for("react.provider"),te=Symbol.for("react.context"),ae=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),H=Symbol.for("react.suspense_list"),X=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),q=Symbol.for("react.offscreen"),Y=Symbol.iterator;function se(r){return r===null||typeof r!="object"?null:(r=Y&&r[Y]||r["@@iterator"],typeof r=="function"?r:null)}var ee=Object.assign,M;function J(r){if(M===void 0)try{throw Error()}catch(l){var o=l.stack.trim().match(/\n( *(at )?)/);M=o&&o[1]||""}return`
|
|
35
|
-
`+M+r}var pe=!1;function he(r,o){if(!r||pe)return"";pe=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(o)if(o=function(){throw Error()},Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(Q){var c=Q}Reflect.construct(r,[],o)}else{try{o.call()}catch(Q){c=Q}r.call(o.prototype)}else{try{throw Error()}catch(Q){c=Q}r()}}catch(Q){if(Q&&c&&typeof Q.stack=="string"){for(var g=Q.stack.split(`
|
|
36
|
-
`),S=c.stack.split(`
|
|
37
|
-
`),C=g.length-1,I=S.length-1;1<=C&&0<=I&&g[C]!==S[I];)I--;for(;1<=C&&0<=I;C--,I--)if(g[C]!==S[I]){if(C!==1||I!==1)do if(C--,I--,0>I||g[C]!==S[I]){var N=`
|
|
38
|
-
`+g[C].replace(" at new "," at ");return r.displayName&&N.includes("<anonymous>")&&(N=N.replace("<anonymous>",r.displayName)),N}while(1<=C&&0<=I);break}}}finally{pe=!1,Error.prepareStackTrace=l}return(r=r?r.displayName||r.name:"")?J(r):""}function ce(r){switch(r.tag){case 5:return J(r.type);case 16:return J("Lazy");case 13:return J("Suspense");case 19:return J("SuspenseList");case 0:case 2:case 15:return r=he(r.type,!1),r;case 11:return r=he(r.type.render,!1),r;case 1:return r=he(r.type,!0),r;default:return""}}function be(r){if(r==null)return null;if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case L:return"Fragment";case $:return"Portal";case z:return"Profiler";case U:return"StrictMode";case P:return"Suspense";case H:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case te:return(r.displayName||"Context")+".Consumer";case Z:return(r._context.displayName||"Context")+".Provider";case ae:var o=r.render;return r=r.displayName,r||(r=o.displayName||o.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case X:return o=r.displayName||null,o!==null?o:be(r.type)||"Memo";case K:o=r._payload,r=r._init;try{return be(r(o))}catch{}}return null}function $e(r){var o=r.type;switch(r.tag){case 24:return"Cache";case 9:return(o.displayName||"Context")+".Consumer";case 10:return(o._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return r=o.render,r=r.displayName||r.name||"",o.displayName||(r!==""?"ForwardRef("+r+")":"ForwardRef");case 7:return"Fragment";case 5:return o;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return be(o);case 8:return o===U?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function Ce(r){switch(typeof r){case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function Ee(r){var o=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function lt(r){var o=Ee(r)?"checked":"value",l=Object.getOwnPropertyDescriptor(r.constructor.prototype,o),c=""+r[o];if(!r.hasOwnProperty(o)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var g=l.get,S=l.set;return Object.defineProperty(r,o,{configurable:!0,get:function(){return g.call(this)},set:function(C){c=""+C,S.call(this,C)}}),Object.defineProperty(r,o,{enumerable:l.enumerable}),{getValue:function(){return c},setValue:function(C){c=""+C},stopTracking:function(){r._valueTracker=null,delete r[o]}}}}function Sr(r){r._valueTracker||(r._valueTracker=lt(r))}function Ns(r){if(!r)return!1;var o=r._valueTracker;if(!o)return!0;var l=o.getValue(),c="";return r&&(c=Ee(r)?r.checked?"true":"false":r.value),r=c,r!==l?(o.setValue(r),!0):!1}function Ms(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}function Eo(r,o){var l=o.checked;return ee({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:l??r._wrapperState.initialChecked})}function Al(r,o){var l=o.defaultValue==null?"":o.defaultValue,c=o.checked!=null?o.checked:o.defaultChecked;l=Ce(o.value!=null?o.value:l),r._wrapperState={initialChecked:c,initialValue:l,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function $i(r,o){o=o.checked,o!=null&&j(r,"checked",o,!1)}function Po(r,o){$i(r,o);var l=Ce(o.value),c=o.type;if(l!=null)c==="number"?(l===0&&r.value===""||r.value!=l)&&(r.value=""+l):r.value!==""+l&&(r.value=""+l);else if(c==="submit"||c==="reset"){r.removeAttribute("value");return}o.hasOwnProperty("value")?Ts(r,o.type,l):o.hasOwnProperty("defaultValue")&&Ts(r,o.type,Ce(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(r.defaultChecked=!!o.defaultChecked)}function wr(r,o,l){if(o.hasOwnProperty("value")||o.hasOwnProperty("defaultValue")){var c=o.type;if(!(c!=="submit"&&c!=="reset"||o.value!==void 0&&o.value!==null))return;o=""+r._wrapperState.initialValue,l||o===r.value||(r.value=o),r.defaultValue=o}l=r.name,l!==""&&(r.name=""),r.defaultChecked=!!r._wrapperState.initialChecked,l!==""&&(r.name=l)}function Ts(r,o,l){(o!=="number"||Ms(r.ownerDocument)!==r)&&(l==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+l&&(r.defaultValue=""+l))}var hn=Array.isArray;function zr(r,o,l,c){if(r=r.options,o){o={};for(var g=0;g<l.length;g++)o["$"+l[g]]=!0;for(l=0;l<r.length;l++)g=o.hasOwnProperty("$"+r[l].value),r[l].selected!==g&&(r[l].selected=g),g&&c&&(r[l].defaultSelected=!0)}else{for(l=""+Ce(l),o=null,g=0;g<r.length;g++){if(r[g].value===l){r[g].selected=!0,c&&(r[g].defaultSelected=!0);return}o!==null||r[g].disabled||(o=r[g])}o!==null&&(o.selected=!0)}}function Io(r,o){if(o.dangerouslySetInnerHTML!=null)throw Error(n(91));return ee({},o,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function Dl(r,o){var l=o.value;if(l==null){if(l=o.children,o=o.defaultValue,l!=null){if(o!=null)throw Error(n(92));if(hn(l)){if(1<l.length)throw Error(n(93));l=l[0]}o=l}o==null&&(o=""),l=o}r._wrapperState={initialValue:Ce(l)}}function Fi(r,o){var l=Ce(o.value),c=Ce(o.defaultValue);l!=null&&(l=""+l,l!==r.value&&(r.value=l),o.defaultValue==null&&r.defaultValue!==l&&(r.defaultValue=l)),c!=null&&(r.defaultValue=""+c)}function Oe(r){var o=r.textContent;o===r._wrapperState.initialValue&&o!==""&&o!==null&&(r.value=o)}function Mt(r){switch(r){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Bn(r,o){return r==null||r==="http://www.w3.org/1999/xhtml"?Mt(o):r==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var jo,j0=(function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(o,l,c,g){MSApp.execUnsafeLocalFunction(function(){return r(o,l,c,g)})}:r})(function(r,o){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=o;else{for(jo=jo||document.createElement("div"),jo.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=jo.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;o.firstChild;)r.appendChild(o.firstChild)}});function Li(r,o){if(o){var l=r.firstChild;if(l&&l===r.lastChild&&l.nodeType===3){l.nodeValue=o;return}}r.textContent=o}var Oi={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},X_=["Webkit","ms","Moz","O"];Object.keys(Oi).forEach(function(r){X_.forEach(function(o){o=o+r.charAt(0).toUpperCase()+r.substring(1),Oi[o]=Oi[r]})});function N0(r,o,l){return o==null||typeof o=="boolean"||o===""?"":l||typeof o!="number"||o===0||Oi.hasOwnProperty(r)&&Oi[r]?(""+o).trim():o+"px"}function M0(r,o){r=r.style;for(var l in o)if(o.hasOwnProperty(l)){var c=l.indexOf("--")===0,g=N0(l,o[l],c);l==="float"&&(l="cssFloat"),c?r.setProperty(l,g):r[l]=g}}var Z_=ee({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Hf(r,o){if(o){if(Z_[r]&&(o.children!=null||o.dangerouslySetInnerHTML!=null))throw Error(n(137,r));if(o.dangerouslySetInnerHTML!=null){if(o.children!=null)throw Error(n(60));if(typeof o.dangerouslySetInnerHTML!="object"||!("__html"in o.dangerouslySetInnerHTML))throw Error(n(61))}if(o.style!=null&&typeof o.style!="object")throw Error(n(62))}}function Wf(r,o){if(r.indexOf("-")===-1)return typeof o.is=="string";switch(r){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Gf=null;function Kf(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var Qf=null,No=null,Mo=null;function T0(r){if(r=oa(r)){if(typeof Qf!="function")throw Error(n(280));var o=r.stateNode;o&&(o=lu(o),Qf(r.stateNode,r.type,o))}}function $0(r){No?Mo?Mo.push(r):Mo=[r]:No=r}function F0(){if(No){var r=No,o=Mo;if(Mo=No=null,T0(r),o)for(r=0;r<o.length;r++)T0(o[r])}}function L0(r,o){return r(o)}function O0(){}var Jf=!1;function A0(r,o,l){if(Jf)return r(o,l);Jf=!0;try{return L0(r,o,l)}finally{Jf=!1,(No!==null||Mo!==null)&&(O0(),F0())}}function Ai(r,o){var l=r.stateNode;if(l===null)return null;var c=lu(l);if(c===null)return null;l=c[o];e:switch(o){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(r=r.type,c=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!c;break e;default:r=!1}if(r)return null;if(l&&typeof l!="function")throw Error(n(231,o,typeof l));return l}var Yf=!1;if(f)try{var Di={};Object.defineProperty(Di,"passive",{get:function(){Yf=!0}}),window.addEventListener("test",Di,Di),window.removeEventListener("test",Di,Di)}catch{Yf=!1}function eR(r,o,l,c,g,S,C,I,N){var Q=Array.prototype.slice.call(arguments,3);try{o.apply(l,Q)}catch(oe){this.onError(oe)}}var zi=!1,zl=null,Ul=!1,Xf=null,tR={onError:function(r){zi=!0,zl=r}};function nR(r,o,l,c,g,S,C,I,N){zi=!1,zl=null,eR.apply(tR,arguments)}function rR(r,o,l,c,g,S,C,I,N){if(nR.apply(this,arguments),zi){if(zi){var Q=zl;zi=!1,zl=null}else throw Error(n(198));Ul||(Ul=!0,Xf=Q)}}function $s(r){var o=r,l=r;if(r.alternate)for(;o.return;)o=o.return;else{r=o;do o=r,(o.flags&4098)!==0&&(l=o.return),r=o.return;while(r)}return o.tag===3?l:null}function D0(r){if(r.tag===13){var o=r.memoizedState;if(o===null&&(r=r.alternate,r!==null&&(o=r.memoizedState)),o!==null)return o.dehydrated}return null}function z0(r){if($s(r)!==r)throw Error(n(188))}function sR(r){var o=r.alternate;if(!o){if(o=$s(r),o===null)throw Error(n(188));return o!==r?null:r}for(var l=r,c=o;;){var g=l.return;if(g===null)break;var S=g.alternate;if(S===null){if(c=g.return,c!==null){l=c;continue}break}if(g.child===S.child){for(S=g.child;S;){if(S===l)return z0(g),r;if(S===c)return z0(g),o;S=S.sibling}throw Error(n(188))}if(l.return!==c.return)l=g,c=S;else{for(var C=!1,I=g.child;I;){if(I===l){C=!0,l=g,c=S;break}if(I===c){C=!0,c=g,l=S;break}I=I.sibling}if(!C){for(I=S.child;I;){if(I===l){C=!0,l=S,c=g;break}if(I===c){C=!0,c=S,l=g;break}I=I.sibling}if(!C)throw Error(n(189))}}if(l.alternate!==c)throw Error(n(190))}if(l.tag!==3)throw Error(n(188));return l.stateNode.current===l?r:o}function U0(r){return r=sR(r),r!==null?V0(r):null}function V0(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var o=V0(r);if(o!==null)return o;r=r.sibling}return null}var B0=t.unstable_scheduleCallback,q0=t.unstable_cancelCallback,oR=t.unstable_shouldYield,iR=t.unstable_requestPaint,ut=t.unstable_now,aR=t.unstable_getCurrentPriorityLevel,Zf=t.unstable_ImmediatePriority,H0=t.unstable_UserBlockingPriority,Vl=t.unstable_NormalPriority,lR=t.unstable_LowPriority,W0=t.unstable_IdlePriority,Bl=null,ar=null;function uR(r){if(ar&&typeof ar.onCommitFiberRoot=="function")try{ar.onCommitFiberRoot(Bl,r,void 0,(r.current.flags&128)===128)}catch{}}var qn=Math.clz32?Math.clz32:dR,cR=Math.log,fR=Math.LN2;function dR(r){return r>>>=0,r===0?32:31-(cR(r)/fR|0)|0}var ql=64,Hl=4194304;function Ui(r){switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return r&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return r}}function Wl(r,o){var l=r.pendingLanes;if(l===0)return 0;var c=0,g=r.suspendedLanes,S=r.pingedLanes,C=l&268435455;if(C!==0){var I=C&~g;I!==0?c=Ui(I):(S&=C,S!==0&&(c=Ui(S)))}else C=l&~g,C!==0?c=Ui(C):S!==0&&(c=Ui(S));if(c===0)return 0;if(o!==0&&o!==c&&(o&g)===0&&(g=c&-c,S=o&-o,g>=S||g===16&&(S&4194240)!==0))return o;if((c&4)!==0&&(c|=l&16),o=r.entangledLanes,o!==0)for(r=r.entanglements,o&=c;0<o;)l=31-qn(o),g=1<<l,c|=r[l],o&=~g;return c}function hR(r,o){switch(r){case 1:case 2:case 4:return o+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function gR(r,o){for(var l=r.suspendedLanes,c=r.pingedLanes,g=r.expirationTimes,S=r.pendingLanes;0<S;){var C=31-qn(S),I=1<<C,N=g[C];N===-1?((I&l)===0||(I&c)!==0)&&(g[C]=hR(I,o)):N<=o&&(r.expiredLanes|=I),S&=~I}}function ed(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function G0(){var r=ql;return ql<<=1,(ql&4194240)===0&&(ql=64),r}function td(r){for(var o=[],l=0;31>l;l++)o.push(r);return o}function Vi(r,o,l){r.pendingLanes|=o,o!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,o=31-qn(o),r[o]=l}function pR(r,o){var l=r.pendingLanes&~o;r.pendingLanes=o,r.suspendedLanes=0,r.pingedLanes=0,r.expiredLanes&=o,r.mutableReadLanes&=o,r.entangledLanes&=o,o=r.entanglements;var c=r.eventTimes;for(r=r.expirationTimes;0<l;){var g=31-qn(l),S=1<<g;o[g]=0,c[g]=-1,r[g]=-1,l&=~S}}function nd(r,o){var l=r.entangledLanes|=o;for(r=r.entanglements;l;){var c=31-qn(l),g=1<<c;g&o|r[c]&o&&(r[c]|=o),l&=~g}}var Ae=0;function K0(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var Q0,rd,J0,Y0,X0,sd=!1,Gl=[],Ur=null,Vr=null,Br=null,Bi=new Map,qi=new Map,qr=[],mR="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Z0(r,o){switch(r){case"focusin":case"focusout":Ur=null;break;case"dragenter":case"dragleave":Vr=null;break;case"mouseover":case"mouseout":Br=null;break;case"pointerover":case"pointerout":Bi.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":qi.delete(o.pointerId)}}function Hi(r,o,l,c,g,S){return r===null||r.nativeEvent!==S?(r={blockedOn:o,domEventName:l,eventSystemFlags:c,nativeEvent:S,targetContainers:[g]},o!==null&&(o=oa(o),o!==null&&rd(o)),r):(r.eventSystemFlags|=c,o=r.targetContainers,g!==null&&o.indexOf(g)===-1&&o.push(g),r)}function yR(r,o,l,c,g){switch(o){case"focusin":return Ur=Hi(Ur,r,o,l,c,g),!0;case"dragenter":return Vr=Hi(Vr,r,o,l,c,g),!0;case"mouseover":return Br=Hi(Br,r,o,l,c,g),!0;case"pointerover":var S=g.pointerId;return Bi.set(S,Hi(Bi.get(S)||null,r,o,l,c,g)),!0;case"gotpointercapture":return S=g.pointerId,qi.set(S,Hi(qi.get(S)||null,r,o,l,c,g)),!0}return!1}function ey(r){var o=Fs(r.target);if(o!==null){var l=$s(o);if(l!==null){if(o=l.tag,o===13){if(o=D0(l),o!==null){r.blockedOn=o,X0(r.priority,function(){J0(l)});return}}else if(o===3&&l.stateNode.current.memoizedState.isDehydrated){r.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}r.blockedOn=null}function Kl(r){if(r.blockedOn!==null)return!1;for(var o=r.targetContainers;0<o.length;){var l=id(r.domEventName,r.eventSystemFlags,o[0],r.nativeEvent);if(l===null){l=r.nativeEvent;var c=new l.constructor(l.type,l);Gf=c,l.target.dispatchEvent(c),Gf=null}else return o=oa(l),o!==null&&rd(o),r.blockedOn=l,!1;o.shift()}return!0}function ty(r,o,l){Kl(r)&&l.delete(o)}function xR(){sd=!1,Ur!==null&&Kl(Ur)&&(Ur=null),Vr!==null&&Kl(Vr)&&(Vr=null),Br!==null&&Kl(Br)&&(Br=null),Bi.forEach(ty),qi.forEach(ty)}function Wi(r,o){r.blockedOn===o&&(r.blockedOn=null,sd||(sd=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,xR)))}function Gi(r){function o(g){return Wi(g,r)}if(0<Gl.length){Wi(Gl[0],r);for(var l=1;l<Gl.length;l++){var c=Gl[l];c.blockedOn===r&&(c.blockedOn=null)}}for(Ur!==null&&Wi(Ur,r),Vr!==null&&Wi(Vr,r),Br!==null&&Wi(Br,r),Bi.forEach(o),qi.forEach(o),l=0;l<qr.length;l++)c=qr[l],c.blockedOn===r&&(c.blockedOn=null);for(;0<qr.length&&(l=qr[0],l.blockedOn===null);)ey(l),l.blockedOn===null&&qr.shift()}var To=E.ReactCurrentBatchConfig,Ql=!0;function vR(r,o,l,c){var g=Ae,S=To.transition;To.transition=null;try{Ae=1,od(r,o,l,c)}finally{Ae=g,To.transition=S}}function SR(r,o,l,c){var g=Ae,S=To.transition;To.transition=null;try{Ae=4,od(r,o,l,c)}finally{Ae=g,To.transition=S}}function od(r,o,l,c){if(Ql){var g=id(r,o,l,c);if(g===null)Cd(r,o,c,Jl,l),Z0(r,c);else if(yR(g,r,o,l,c))c.stopPropagation();else if(Z0(r,c),o&4&&-1<mR.indexOf(r)){for(;g!==null;){var S=oa(g);if(S!==null&&Q0(S),S=id(r,o,l,c),S===null&&Cd(r,o,c,Jl,l),S===g)break;g=S}g!==null&&c.stopPropagation()}else Cd(r,o,c,null,l)}}var Jl=null;function id(r,o,l,c){if(Jl=null,r=Kf(c),r=Fs(r),r!==null)if(o=$s(r),o===null)r=null;else if(l=o.tag,l===13){if(r=D0(o),r!==null)return r;r=null}else if(l===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;r=null}else o!==r&&(r=null);return Jl=r,null}function ny(r){switch(r){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(aR()){case Zf:return 1;case H0:return 4;case Vl:case lR:return 16;case W0:return 536870912;default:return 16}default:return 16}}var Hr=null,ad=null,Yl=null;function ry(){if(Yl)return Yl;var r,o=ad,l=o.length,c,g="value"in Hr?Hr.value:Hr.textContent,S=g.length;for(r=0;r<l&&o[r]===g[r];r++);var C=l-r;for(c=1;c<=C&&o[l-c]===g[S-c];c++);return Yl=g.slice(r,1<c?1-c:void 0)}function Xl(r){var o=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&o===13&&(r=13)):r=o,r===10&&(r=13),32<=r||r===13?r:0}function Zl(){return!0}function sy(){return!1}function gn(r){function o(l,c,g,S,C){this._reactName=l,this._targetInst=g,this.type=c,this.nativeEvent=S,this.target=C,this.currentTarget=null;for(var I in r)r.hasOwnProperty(I)&&(l=r[I],this[I]=l?l(S):S[I]);return this.isDefaultPrevented=(S.defaultPrevented!=null?S.defaultPrevented:S.returnValue===!1)?Zl:sy,this.isPropagationStopped=sy,this}return ee(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Zl)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Zl)},persist:function(){},isPersistent:Zl}),o}var $o={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ld=gn($o),Ki=ee({},$o,{view:0,detail:0}),wR=gn(Ki),ud,cd,Qi,eu=ee({},Ki,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:dd,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Qi&&(Qi&&r.type==="mousemove"?(ud=r.screenX-Qi.screenX,cd=r.screenY-Qi.screenY):cd=ud=0,Qi=r),ud)},movementY:function(r){return"movementY"in r?r.movementY:cd}}),oy=gn(eu),kR=ee({},eu,{dataTransfer:0}),CR=gn(kR),bR=ee({},Ki,{relatedTarget:0}),fd=gn(bR),_R=ee({},$o,{animationName:0,elapsedTime:0,pseudoElement:0}),RR=gn(_R),ER=ee({},$o,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),PR=gn(ER),IR=ee({},$o,{data:0}),iy=gn(IR),jR={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},NR={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},MR={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function TR(r){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(r):(r=MR[r])?!!o[r]:!1}function dd(){return TR}var $R=ee({},Ki,{key:function(r){if(r.key){var o=jR[r.key]||r.key;if(o!=="Unidentified")return o}return r.type==="keypress"?(r=Xl(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?NR[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:dd,charCode:function(r){return r.type==="keypress"?Xl(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?Xl(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),FR=gn($R),LR=ee({},eu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ay=gn(LR),OR=ee({},Ki,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:dd}),AR=gn(OR),DR=ee({},$o,{propertyName:0,elapsedTime:0,pseudoElement:0}),zR=gn(DR),UR=ee({},eu,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),VR=gn(UR),BR=[9,13,27,32],hd=f&&"CompositionEvent"in window,Ji=null;f&&"documentMode"in document&&(Ji=document.documentMode);var qR=f&&"TextEvent"in window&&!Ji,ly=f&&(!hd||Ji&&8<Ji&&11>=Ji),uy=" ",cy=!1;function fy(r,o){switch(r){case"keyup":return BR.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function dy(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Fo=!1;function HR(r,o){switch(r){case"compositionend":return dy(o);case"keypress":return o.which!==32?null:(cy=!0,uy);case"textInput":return r=o.data,r===uy&&cy?null:r;default:return null}}function WR(r,o){if(Fo)return r==="compositionend"||!hd&&fy(r,o)?(r=ry(),Yl=ad=Hr=null,Fo=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1<o.char.length)return o.char;if(o.which)return String.fromCharCode(o.which)}return null;case"compositionend":return ly&&o.locale!=="ko"?null:o.data;default:return null}}var GR={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function hy(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o==="input"?!!GR[r.type]:o==="textarea"}function gy(r,o,l,c){$0(c),o=ou(o,"onChange"),0<o.length&&(l=new ld("onChange","change",null,l,c),r.push({event:l,listeners:o}))}var Yi=null,Xi=null;function KR(r){My(r,0)}function tu(r){var o=zo(r);if(Ns(o))return r}function QR(r,o){if(r==="change")return o}var py=!1;if(f){var gd;if(f){var pd="oninput"in document;if(!pd){var my=document.createElement("div");my.setAttribute("oninput","return;"),pd=typeof my.oninput=="function"}gd=pd}else gd=!1;py=gd&&(!document.documentMode||9<document.documentMode)}function yy(){Yi&&(Yi.detachEvent("onpropertychange",xy),Xi=Yi=null)}function xy(r){if(r.propertyName==="value"&&tu(Xi)){var o=[];gy(o,Xi,r,Kf(r)),A0(KR,o)}}function JR(r,o,l){r==="focusin"?(yy(),Yi=o,Xi=l,Yi.attachEvent("onpropertychange",xy)):r==="focusout"&&yy()}function YR(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return tu(Xi)}function XR(r,o){if(r==="click")return tu(o)}function ZR(r,o){if(r==="input"||r==="change")return tu(o)}function eE(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var Hn=typeof Object.is=="function"?Object.is:eE;function Zi(r,o){if(Hn(r,o))return!0;if(typeof r!="object"||r===null||typeof o!="object"||o===null)return!1;var l=Object.keys(r),c=Object.keys(o);if(l.length!==c.length)return!1;for(c=0;c<l.length;c++){var g=l[c];if(!d.call(o,g)||!Hn(r[g],o[g]))return!1}return!0}function vy(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Sy(r,o){var l=vy(r);r=0;for(var c;l;){if(l.nodeType===3){if(c=r+l.textContent.length,r<=o&&c>=o)return{node:l,offset:o-r};r=c}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=vy(l)}}function wy(r,o){return r&&o?r===o?!0:r&&r.nodeType===3?!1:o&&o.nodeType===3?wy(r,o.parentNode):"contains"in r?r.contains(o):r.compareDocumentPosition?!!(r.compareDocumentPosition(o)&16):!1:!1}function ky(){for(var r=window,o=Ms();o instanceof r.HTMLIFrameElement;){try{var l=typeof o.contentWindow.location.href=="string"}catch{l=!1}if(l)r=o.contentWindow;else break;o=Ms(r.document)}return o}function md(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o&&(o==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||o==="textarea"||r.contentEditable==="true")}function tE(r){var o=ky(),l=r.focusedElem,c=r.selectionRange;if(o!==l&&l&&l.ownerDocument&&wy(l.ownerDocument.documentElement,l)){if(c!==null&&md(l)){if(o=c.start,r=c.end,r===void 0&&(r=o),"selectionStart"in l)l.selectionStart=o,l.selectionEnd=Math.min(r,l.value.length);else if(r=(o=l.ownerDocument||document)&&o.defaultView||window,r.getSelection){r=r.getSelection();var g=l.textContent.length,S=Math.min(c.start,g);c=c.end===void 0?S:Math.min(c.end,g),!r.extend&&S>c&&(g=c,c=S,S=g),g=Sy(l,S);var C=Sy(l,c);g&&C&&(r.rangeCount!==1||r.anchorNode!==g.node||r.anchorOffset!==g.offset||r.focusNode!==C.node||r.focusOffset!==C.offset)&&(o=o.createRange(),o.setStart(g.node,g.offset),r.removeAllRanges(),S>c?(r.addRange(o),r.extend(C.node,C.offset)):(o.setEnd(C.node,C.offset),r.addRange(o)))}}for(o=[],r=l;r=r.parentNode;)r.nodeType===1&&o.push({element:r,left:r.scrollLeft,top:r.scrollTop});for(typeof l.focus=="function"&&l.focus(),l=0;l<o.length;l++)r=o[l],r.element.scrollLeft=r.left,r.element.scrollTop=r.top}}var nE=f&&"documentMode"in document&&11>=document.documentMode,Lo=null,yd=null,ea=null,xd=!1;function Cy(r,o,l){var c=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;xd||Lo==null||Lo!==Ms(c)||(c=Lo,"selectionStart"in c&&md(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),ea&&Zi(ea,c)||(ea=c,c=ou(yd,"onSelect"),0<c.length&&(o=new ld("onSelect","select",null,o,l),r.push({event:o,listeners:c}),o.target=Lo)))}function nu(r,o){var l={};return l[r.toLowerCase()]=o.toLowerCase(),l["Webkit"+r]="webkit"+o,l["Moz"+r]="moz"+o,l}var Oo={animationend:nu("Animation","AnimationEnd"),animationiteration:nu("Animation","AnimationIteration"),animationstart:nu("Animation","AnimationStart"),transitionend:nu("Transition","TransitionEnd")},vd={},by={};f&&(by=document.createElement("div").style,"AnimationEvent"in window||(delete Oo.animationend.animation,delete Oo.animationiteration.animation,delete Oo.animationstart.animation),"TransitionEvent"in window||delete Oo.transitionend.transition);function ru(r){if(vd[r])return vd[r];if(!Oo[r])return r;var o=Oo[r],l;for(l in o)if(o.hasOwnProperty(l)&&l in by)return vd[r]=o[l];return r}var _y=ru("animationend"),Ry=ru("animationiteration"),Ey=ru("animationstart"),Py=ru("transitionend"),Iy=new Map,jy="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Wr(r,o){Iy.set(r,o),a(o,[r])}for(var Sd=0;Sd<jy.length;Sd++){var wd=jy[Sd],rE=wd.toLowerCase(),sE=wd[0].toUpperCase()+wd.slice(1);Wr(rE,"on"+sE)}Wr(_y,"onAnimationEnd"),Wr(Ry,"onAnimationIteration"),Wr(Ey,"onAnimationStart"),Wr("dblclick","onDoubleClick"),Wr("focusin","onFocus"),Wr("focusout","onBlur"),Wr(Py,"onTransitionEnd"),u("onMouseEnter",["mouseout","mouseover"]),u("onMouseLeave",["mouseout","mouseover"]),u("onPointerEnter",["pointerout","pointerover"]),u("onPointerLeave",["pointerout","pointerover"]),a("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),a("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),a("onBeforeInput",["compositionend","keypress","textInput","paste"]),a("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ta="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),oE=new Set("cancel close invalid load scroll toggle".split(" ").concat(ta));function Ny(r,o,l){var c=r.type||"unknown-event";r.currentTarget=l,rR(c,o,void 0,r),r.currentTarget=null}function My(r,o){o=(o&4)!==0;for(var l=0;l<r.length;l++){var c=r[l],g=c.event;c=c.listeners;e:{var S=void 0;if(o)for(var C=c.length-1;0<=C;C--){var I=c[C],N=I.instance,Q=I.currentTarget;if(I=I.listener,N!==S&&g.isPropagationStopped())break e;Ny(g,I,Q),S=N}else for(C=0;C<c.length;C++){if(I=c[C],N=I.instance,Q=I.currentTarget,I=I.listener,N!==S&&g.isPropagationStopped())break e;Ny(g,I,Q),S=N}}}if(Ul)throw r=Xf,Ul=!1,Xf=null,r}function We(r,o){var l=o[Id];l===void 0&&(l=o[Id]=new Set);var c=r+"__bubble";l.has(c)||(Ty(o,r,2,!1),l.add(c))}function kd(r,o,l){var c=0;o&&(c|=4),Ty(l,r,c,o)}var su="_reactListening"+Math.random().toString(36).slice(2);function na(r){if(!r[su]){r[su]=!0,s.forEach(function(l){l!=="selectionchange"&&(oE.has(l)||kd(l,!1,r),kd(l,!0,r))});var o=r.nodeType===9?r:r.ownerDocument;o===null||o[su]||(o[su]=!0,kd("selectionchange",!1,o))}}function Ty(r,o,l,c){switch(ny(o)){case 1:var g=vR;break;case 4:g=SR;break;default:g=od}l=g.bind(null,o,l,r),g=void 0,!Yf||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(g=!0),c?g!==void 0?r.addEventListener(o,l,{capture:!0,passive:g}):r.addEventListener(o,l,!0):g!==void 0?r.addEventListener(o,l,{passive:g}):r.addEventListener(o,l,!1)}function Cd(r,o,l,c,g){var S=c;if((o&1)===0&&(o&2)===0&&c!==null)e:for(;;){if(c===null)return;var C=c.tag;if(C===3||C===4){var I=c.stateNode.containerInfo;if(I===g||I.nodeType===8&&I.parentNode===g)break;if(C===4)for(C=c.return;C!==null;){var N=C.tag;if((N===3||N===4)&&(N=C.stateNode.containerInfo,N===g||N.nodeType===8&&N.parentNode===g))return;C=C.return}for(;I!==null;){if(C=Fs(I),C===null)return;if(N=C.tag,N===5||N===6){c=S=C;continue e}I=I.parentNode}}c=c.return}A0(function(){var Q=S,oe=Kf(l),ie=[];e:{var ne=Iy.get(r);if(ne!==void 0){var fe=ld,ge=r;switch(r){case"keypress":if(Xl(l)===0)break e;case"keydown":case"keyup":fe=FR;break;case"focusin":ge="focus",fe=fd;break;case"focusout":ge="blur",fe=fd;break;case"beforeblur":case"afterblur":fe=fd;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":fe=oy;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":fe=CR;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":fe=AR;break;case _y:case Ry:case Ey:fe=RR;break;case Py:fe=zR;break;case"scroll":fe=wR;break;case"wheel":fe=VR;break;case"copy":case"cut":case"paste":fe=PR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":fe=ay}var me=(o&4)!==0,ct=!me&&r==="scroll",B=me?ne!==null?ne+"Capture":null:ne;me=[];for(var F=Q,W;F!==null;){W=F;var le=W.stateNode;if(W.tag===5&&le!==null&&(W=le,B!==null&&(le=Ai(F,B),le!=null&&me.push(ra(F,le,W)))),ct)break;F=F.return}0<me.length&&(ne=new fe(ne,ge,null,l,oe),ie.push({event:ne,listeners:me}))}}if((o&7)===0){e:{if(ne=r==="mouseover"||r==="pointerover",fe=r==="mouseout"||r==="pointerout",ne&&l!==Gf&&(ge=l.relatedTarget||l.fromElement)&&(Fs(ge)||ge[kr]))break e;if((fe||ne)&&(ne=oe.window===oe?oe:(ne=oe.ownerDocument)?ne.defaultView||ne.parentWindow:window,fe?(ge=l.relatedTarget||l.toElement,fe=Q,ge=ge?Fs(ge):null,ge!==null&&(ct=$s(ge),ge!==ct||ge.tag!==5&&ge.tag!==6)&&(ge=null)):(fe=null,ge=Q),fe!==ge)){if(me=oy,le="onMouseLeave",B="onMouseEnter",F="mouse",(r==="pointerout"||r==="pointerover")&&(me=ay,le="onPointerLeave",B="onPointerEnter",F="pointer"),ct=fe==null?ne:zo(fe),W=ge==null?ne:zo(ge),ne=new me(le,F+"leave",fe,l,oe),ne.target=ct,ne.relatedTarget=W,le=null,Fs(oe)===Q&&(me=new me(B,F+"enter",ge,l,oe),me.target=W,me.relatedTarget=ct,le=me),ct=le,fe&&ge)t:{for(me=fe,B=ge,F=0,W=me;W;W=Ao(W))F++;for(W=0,le=B;le;le=Ao(le))W++;for(;0<F-W;)me=Ao(me),F--;for(;0<W-F;)B=Ao(B),W--;for(;F--;){if(me===B||B!==null&&me===B.alternate)break t;me=Ao(me),B=Ao(B)}me=null}else me=null;fe!==null&&$y(ie,ne,fe,me,!1),ge!==null&&ct!==null&&$y(ie,ct,ge,me,!0)}}e:{if(ne=Q?zo(Q):window,fe=ne.nodeName&&ne.nodeName.toLowerCase(),fe==="select"||fe==="input"&&ne.type==="file")var ye=QR;else if(hy(ne))if(py)ye=ZR;else{ye=YR;var xe=JR}else(fe=ne.nodeName)&&fe.toLowerCase()==="input"&&(ne.type==="checkbox"||ne.type==="radio")&&(ye=XR);if(ye&&(ye=ye(r,Q))){gy(ie,ye,l,oe);break e}xe&&xe(r,ne,Q),r==="focusout"&&(xe=ne._wrapperState)&&xe.controlled&&ne.type==="number"&&Ts(ne,"number",ne.value)}switch(xe=Q?zo(Q):window,r){case"focusin":(hy(xe)||xe.contentEditable==="true")&&(Lo=xe,yd=Q,ea=null);break;case"focusout":ea=yd=Lo=null;break;case"mousedown":xd=!0;break;case"contextmenu":case"mouseup":case"dragend":xd=!1,Cy(ie,l,oe);break;case"selectionchange":if(nE)break;case"keydown":case"keyup":Cy(ie,l,oe)}var ve;if(hd)e:{switch(r){case"compositionstart":var ke="onCompositionStart";break e;case"compositionend":ke="onCompositionEnd";break e;case"compositionupdate":ke="onCompositionUpdate";break e}ke=void 0}else Fo?fy(r,l)&&(ke="onCompositionEnd"):r==="keydown"&&l.keyCode===229&&(ke="onCompositionStart");ke&&(ly&&l.locale!=="ko"&&(Fo||ke!=="onCompositionStart"?ke==="onCompositionEnd"&&Fo&&(ve=ry()):(Hr=oe,ad="value"in Hr?Hr.value:Hr.textContent,Fo=!0)),xe=ou(Q,ke),0<xe.length&&(ke=new iy(ke,r,null,l,oe),ie.push({event:ke,listeners:xe}),ve?ke.data=ve:(ve=dy(l),ve!==null&&(ke.data=ve)))),(ve=qR?HR(r,l):WR(r,l))&&(Q=ou(Q,"onBeforeInput"),0<Q.length&&(oe=new iy("onBeforeInput","beforeinput",null,l,oe),ie.push({event:oe,listeners:Q}),oe.data=ve))}My(ie,o)})}function ra(r,o,l){return{instance:r,listener:o,currentTarget:l}}function ou(r,o){for(var l=o+"Capture",c=[];r!==null;){var g=r,S=g.stateNode;g.tag===5&&S!==null&&(g=S,S=Ai(r,l),S!=null&&c.unshift(ra(r,S,g)),S=Ai(r,o),S!=null&&c.push(ra(r,S,g))),r=r.return}return c}function Ao(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function $y(r,o,l,c,g){for(var S=o._reactName,C=[];l!==null&&l!==c;){var I=l,N=I.alternate,Q=I.stateNode;if(N!==null&&N===c)break;I.tag===5&&Q!==null&&(I=Q,g?(N=Ai(l,S),N!=null&&C.unshift(ra(l,N,I))):g||(N=Ai(l,S),N!=null&&C.push(ra(l,N,I)))),l=l.return}C.length!==0&&r.push({event:o,listeners:C})}var iE=/\r\n?/g,aE=/\u0000|\uFFFD/g;function Fy(r){return(typeof r=="string"?r:""+r).replace(iE,`
|
|
39
|
-
`).replace(aE,"")}function iu(r,o,l){if(o=Fy(o),Fy(r)!==o&&l)throw Error(n(425))}function au(){}var bd=null,_d=null;function Rd(r,o){return r==="textarea"||r==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}var Ed=typeof setTimeout=="function"?setTimeout:void 0,lE=typeof clearTimeout=="function"?clearTimeout:void 0,Ly=typeof Promise=="function"?Promise:void 0,uE=typeof queueMicrotask=="function"?queueMicrotask:typeof Ly<"u"?function(r){return Ly.resolve(null).then(r).catch(cE)}:Ed;function cE(r){setTimeout(function(){throw r})}function Pd(r,o){var l=o,c=0;do{var g=l.nextSibling;if(r.removeChild(l),g&&g.nodeType===8)if(l=g.data,l==="/$"){if(c===0){r.removeChild(g),Gi(o);return}c--}else l!=="$"&&l!=="$?"&&l!=="$!"||c++;l=g}while(l);Gi(o)}function Gr(r){for(;r!=null;r=r.nextSibling){var o=r.nodeType;if(o===1||o===3)break;if(o===8){if(o=r.data,o==="$"||o==="$!"||o==="$?")break;if(o==="/$")return null}}return r}function Oy(r){r=r.previousSibling;for(var o=0;r;){if(r.nodeType===8){var l=r.data;if(l==="$"||l==="$!"||l==="$?"){if(o===0)return r;o--}else l==="/$"&&o++}r=r.previousSibling}return null}var Do=Math.random().toString(36).slice(2),lr="__reactFiber$"+Do,sa="__reactProps$"+Do,kr="__reactContainer$"+Do,Id="__reactEvents$"+Do,fE="__reactListeners$"+Do,dE="__reactHandles$"+Do;function Fs(r){var o=r[lr];if(o)return o;for(var l=r.parentNode;l;){if(o=l[kr]||l[lr]){if(l=o.alternate,o.child!==null||l!==null&&l.child!==null)for(r=Oy(r);r!==null;){if(l=r[lr])return l;r=Oy(r)}return o}r=l,l=r.parentNode}return null}function oa(r){return r=r[lr]||r[kr],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function zo(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function lu(r){return r[sa]||null}var jd=[],Uo=-1;function Kr(r){return{current:r}}function Ge(r){0>Uo||(r.current=jd[Uo],jd[Uo]=null,Uo--)}function qe(r,o){Uo++,jd[Uo]=r.current,r.current=o}var Qr={},Ot=Kr(Qr),Zt=Kr(!1),Ls=Qr;function Vo(r,o){var l=r.type.contextTypes;if(!l)return Qr;var c=r.stateNode;if(c&&c.__reactInternalMemoizedUnmaskedChildContext===o)return c.__reactInternalMemoizedMaskedChildContext;var g={},S;for(S in l)g[S]=o[S];return c&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=o,r.__reactInternalMemoizedMaskedChildContext=g),g}function en(r){return r=r.childContextTypes,r!=null}function uu(){Ge(Zt),Ge(Ot)}function Ay(r,o,l){if(Ot.current!==Qr)throw Error(n(168));qe(Ot,o),qe(Zt,l)}function Dy(r,o,l){var c=r.stateNode;if(o=o.childContextTypes,typeof c.getChildContext!="function")return l;c=c.getChildContext();for(var g in c)if(!(g in o))throw Error(n(108,$e(r)||"Unknown",g));return ee({},l,c)}function cu(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||Qr,Ls=Ot.current,qe(Ot,r),qe(Zt,Zt.current),!0}function zy(r,o,l){var c=r.stateNode;if(!c)throw Error(n(169));l?(r=Dy(r,o,Ls),c.__reactInternalMemoizedMergedChildContext=r,Ge(Zt),Ge(Ot),qe(Ot,r)):Ge(Zt),qe(Zt,l)}var Cr=null,fu=!1,Nd=!1;function Uy(r){Cr===null?Cr=[r]:Cr.push(r)}function hE(r){fu=!0,Uy(r)}function Jr(){if(!Nd&&Cr!==null){Nd=!0;var r=0,o=Ae;try{var l=Cr;for(Ae=1;r<l.length;r++){var c=l[r];do c=c(!0);while(c!==null)}Cr=null,fu=!1}catch(g){throw Cr!==null&&(Cr=Cr.slice(r+1)),B0(Zf,Jr),g}finally{Ae=o,Nd=!1}}return null}var Bo=[],qo=0,du=null,hu=0,Pn=[],In=0,Os=null,br=1,_r="";function As(r,o){Bo[qo++]=hu,Bo[qo++]=du,du=r,hu=o}function Vy(r,o,l){Pn[In++]=br,Pn[In++]=_r,Pn[In++]=Os,Os=r;var c=br;r=_r;var g=32-qn(c)-1;c&=~(1<<g),l+=1;var S=32-qn(o)+g;if(30<S){var C=g-g%5;S=(c&(1<<C)-1).toString(32),c>>=C,g-=C,br=1<<32-qn(o)+g|l<<g|c,_r=S+r}else br=1<<S|l<<g|c,_r=r}function Md(r){r.return!==null&&(As(r,1),Vy(r,1,0))}function Td(r){for(;r===du;)du=Bo[--qo],Bo[qo]=null,hu=Bo[--qo],Bo[qo]=null;for(;r===Os;)Os=Pn[--In],Pn[In]=null,_r=Pn[--In],Pn[In]=null,br=Pn[--In],Pn[In]=null}var pn=null,mn=null,Qe=!1,Wn=null;function By(r,o){var l=Tn(5,null,null,0);l.elementType="DELETED",l.stateNode=o,l.return=r,o=r.deletions,o===null?(r.deletions=[l],r.flags|=16):o.push(l)}function qy(r,o){switch(r.tag){case 5:var l=r.type;return o=o.nodeType!==1||l.toLowerCase()!==o.nodeName.toLowerCase()?null:o,o!==null?(r.stateNode=o,pn=r,mn=Gr(o.firstChild),!0):!1;case 6:return o=r.pendingProps===""||o.nodeType!==3?null:o,o!==null?(r.stateNode=o,pn=r,mn=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(l=Os!==null?{id:br,overflow:_r}:null,r.memoizedState={dehydrated:o,treeContext:l,retryLane:1073741824},l=Tn(18,null,null,0),l.stateNode=o,l.return=r,r.child=l,pn=r,mn=null,!0):!1;default:return!1}}function $d(r){return(r.mode&1)!==0&&(r.flags&128)===0}function Fd(r){if(Qe){var o=mn;if(o){var l=o;if(!qy(r,o)){if($d(r))throw Error(n(418));o=Gr(l.nextSibling);var c=pn;o&&qy(r,o)?By(c,l):(r.flags=r.flags&-4097|2,Qe=!1,pn=r)}}else{if($d(r))throw Error(n(418));r.flags=r.flags&-4097|2,Qe=!1,pn=r}}}function Hy(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;pn=r}function gu(r){if(r!==pn)return!1;if(!Qe)return Hy(r),Qe=!0,!1;var o;if((o=r.tag!==3)&&!(o=r.tag!==5)&&(o=r.type,o=o!=="head"&&o!=="body"&&!Rd(r.type,r.memoizedProps)),o&&(o=mn)){if($d(r))throw Wy(),Error(n(418));for(;o;)By(r,o),o=Gr(o.nextSibling)}if(Hy(r),r.tag===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(n(317));e:{for(r=r.nextSibling,o=0;r;){if(r.nodeType===8){var l=r.data;if(l==="/$"){if(o===0){mn=Gr(r.nextSibling);break e}o--}else l!=="$"&&l!=="$!"&&l!=="$?"||o++}r=r.nextSibling}mn=null}}else mn=pn?Gr(r.stateNode.nextSibling):null;return!0}function Wy(){for(var r=mn;r;)r=Gr(r.nextSibling)}function Ho(){mn=pn=null,Qe=!1}function Ld(r){Wn===null?Wn=[r]:Wn.push(r)}var gE=E.ReactCurrentBatchConfig;function ia(r,o,l){if(r=l.ref,r!==null&&typeof r!="function"&&typeof r!="object"){if(l._owner){if(l=l._owner,l){if(l.tag!==1)throw Error(n(309));var c=l.stateNode}if(!c)throw Error(n(147,r));var g=c,S=""+r;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===S?o.ref:(o=function(C){var I=g.refs;C===null?delete I[S]:I[S]=C},o._stringRef=S,o)}if(typeof r!="string")throw Error(n(284));if(!l._owner)throw Error(n(290,r))}return r}function pu(r,o){throw r=Object.prototype.toString.call(o),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":r))}function Gy(r){var o=r._init;return o(r._payload)}function Ky(r){function o(B,F){if(r){var W=B.deletions;W===null?(B.deletions=[F],B.flags|=16):W.push(F)}}function l(B,F){if(!r)return null;for(;F!==null;)o(B,F),F=F.sibling;return null}function c(B,F){for(B=new Map;F!==null;)F.key!==null?B.set(F.key,F):B.set(F.index,F),F=F.sibling;return B}function g(B,F){return B=ss(B,F),B.index=0,B.sibling=null,B}function S(B,F,W){return B.index=W,r?(W=B.alternate,W!==null?(W=W.index,W<F?(B.flags|=2,F):W):(B.flags|=2,F)):(B.flags|=1048576,F)}function C(B){return r&&B.alternate===null&&(B.flags|=2),B}function I(B,F,W,le){return F===null||F.tag!==6?(F=Eh(W,B.mode,le),F.return=B,F):(F=g(F,W),F.return=B,F)}function N(B,F,W,le){var ye=W.type;return ye===L?oe(B,F,W.props.children,le,W.key):F!==null&&(F.elementType===ye||typeof ye=="object"&&ye!==null&&ye.$$typeof===K&&Gy(ye)===F.type)?(le=g(F,W.props),le.ref=ia(B,F,W),le.return=B,le):(le=Du(W.type,W.key,W.props,null,B.mode,le),le.ref=ia(B,F,W),le.return=B,le)}function Q(B,F,W,le){return F===null||F.tag!==4||F.stateNode.containerInfo!==W.containerInfo||F.stateNode.implementation!==W.implementation?(F=Ph(W,B.mode,le),F.return=B,F):(F=g(F,W.children||[]),F.return=B,F)}function oe(B,F,W,le,ye){return F===null||F.tag!==7?(F=Ws(W,B.mode,le,ye),F.return=B,F):(F=g(F,W),F.return=B,F)}function ie(B,F,W){if(typeof F=="string"&&F!==""||typeof F=="number")return F=Eh(""+F,B.mode,W),F.return=B,F;if(typeof F=="object"&&F!==null){switch(F.$$typeof){case T:return W=Du(F.type,F.key,F.props,null,B.mode,W),W.ref=ia(B,null,F),W.return=B,W;case $:return F=Ph(F,B.mode,W),F.return=B,F;case K:var le=F._init;return ie(B,le(F._payload),W)}if(hn(F)||se(F))return F=Ws(F,B.mode,W,null),F.return=B,F;pu(B,F)}return null}function ne(B,F,W,le){var ye=F!==null?F.key:null;if(typeof W=="string"&&W!==""||typeof W=="number")return ye!==null?null:I(B,F,""+W,le);if(typeof W=="object"&&W!==null){switch(W.$$typeof){case T:return W.key===ye?N(B,F,W,le):null;case $:return W.key===ye?Q(B,F,W,le):null;case K:return ye=W._init,ne(B,F,ye(W._payload),le)}if(hn(W)||se(W))return ye!==null?null:oe(B,F,W,le,null);pu(B,W)}return null}function fe(B,F,W,le,ye){if(typeof le=="string"&&le!==""||typeof le=="number")return B=B.get(W)||null,I(F,B,""+le,ye);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case T:return B=B.get(le.key===null?W:le.key)||null,N(F,B,le,ye);case $:return B=B.get(le.key===null?W:le.key)||null,Q(F,B,le,ye);case K:var xe=le._init;return fe(B,F,W,xe(le._payload),ye)}if(hn(le)||se(le))return B=B.get(W)||null,oe(F,B,le,ye,null);pu(F,le)}return null}function ge(B,F,W,le){for(var ye=null,xe=null,ve=F,ke=F=0,Ct=null;ve!==null&&ke<W.length;ke++){ve.index>ke?(Ct=ve,ve=null):Ct=ve.sibling;var Fe=ne(B,ve,W[ke],le);if(Fe===null){ve===null&&(ve=Ct);break}r&&ve&&Fe.alternate===null&&o(B,ve),F=S(Fe,F,ke),xe===null?ye=Fe:xe.sibling=Fe,xe=Fe,ve=Ct}if(ke===W.length)return l(B,ve),Qe&&As(B,ke),ye;if(ve===null){for(;ke<W.length;ke++)ve=ie(B,W[ke],le),ve!==null&&(F=S(ve,F,ke),xe===null?ye=ve:xe.sibling=ve,xe=ve);return Qe&&As(B,ke),ye}for(ve=c(B,ve);ke<W.length;ke++)Ct=fe(ve,B,ke,W[ke],le),Ct!==null&&(r&&Ct.alternate!==null&&ve.delete(Ct.key===null?ke:Ct.key),F=S(Ct,F,ke),xe===null?ye=Ct:xe.sibling=Ct,xe=Ct);return r&&ve.forEach(function(os){return o(B,os)}),Qe&&As(B,ke),ye}function me(B,F,W,le){var ye=se(W);if(typeof ye!="function")throw Error(n(150));if(W=ye.call(W),W==null)throw Error(n(151));for(var xe=ye=null,ve=F,ke=F=0,Ct=null,Fe=W.next();ve!==null&&!Fe.done;ke++,Fe=W.next()){ve.index>ke?(Ct=ve,ve=null):Ct=ve.sibling;var os=ne(B,ve,Fe.value,le);if(os===null){ve===null&&(ve=Ct);break}r&&ve&&os.alternate===null&&o(B,ve),F=S(os,F,ke),xe===null?ye=os:xe.sibling=os,xe=os,ve=Ct}if(Fe.done)return l(B,ve),Qe&&As(B,ke),ye;if(ve===null){for(;!Fe.done;ke++,Fe=W.next())Fe=ie(B,Fe.value,le),Fe!==null&&(F=S(Fe,F,ke),xe===null?ye=Fe:xe.sibling=Fe,xe=Fe);return Qe&&As(B,ke),ye}for(ve=c(B,ve);!Fe.done;ke++,Fe=W.next())Fe=fe(ve,B,ke,Fe.value,le),Fe!==null&&(r&&Fe.alternate!==null&&ve.delete(Fe.key===null?ke:Fe.key),F=S(Fe,F,ke),xe===null?ye=Fe:xe.sibling=Fe,xe=Fe);return r&&ve.forEach(function(GE){return o(B,GE)}),Qe&&As(B,ke),ye}function ct(B,F,W,le){if(typeof W=="object"&&W!==null&&W.type===L&&W.key===null&&(W=W.props.children),typeof W=="object"&&W!==null){switch(W.$$typeof){case T:e:{for(var ye=W.key,xe=F;xe!==null;){if(xe.key===ye){if(ye=W.type,ye===L){if(xe.tag===7){l(B,xe.sibling),F=g(xe,W.props.children),F.return=B,B=F;break e}}else if(xe.elementType===ye||typeof ye=="object"&&ye!==null&&ye.$$typeof===K&&Gy(ye)===xe.type){l(B,xe.sibling),F=g(xe,W.props),F.ref=ia(B,xe,W),F.return=B,B=F;break e}l(B,xe);break}else o(B,xe);xe=xe.sibling}W.type===L?(F=Ws(W.props.children,B.mode,le,W.key),F.return=B,B=F):(le=Du(W.type,W.key,W.props,null,B.mode,le),le.ref=ia(B,F,W),le.return=B,B=le)}return C(B);case $:e:{for(xe=W.key;F!==null;){if(F.key===xe)if(F.tag===4&&F.stateNode.containerInfo===W.containerInfo&&F.stateNode.implementation===W.implementation){l(B,F.sibling),F=g(F,W.children||[]),F.return=B,B=F;break e}else{l(B,F);break}else o(B,F);F=F.sibling}F=Ph(W,B.mode,le),F.return=B,B=F}return C(B);case K:return xe=W._init,ct(B,F,xe(W._payload),le)}if(hn(W))return ge(B,F,W,le);if(se(W))return me(B,F,W,le);pu(B,W)}return typeof W=="string"&&W!==""||typeof W=="number"?(W=""+W,F!==null&&F.tag===6?(l(B,F.sibling),F=g(F,W),F.return=B,B=F):(l(B,F),F=Eh(W,B.mode,le),F.return=B,B=F),C(B)):l(B,F)}return ct}var Wo=Ky(!0),Qy=Ky(!1),mu=Kr(null),yu=null,Go=null,Od=null;function Ad(){Od=Go=yu=null}function Dd(r){var o=mu.current;Ge(mu),r._currentValue=o}function zd(r,o,l){for(;r!==null;){var c=r.alternate;if((r.childLanes&o)!==o?(r.childLanes|=o,c!==null&&(c.childLanes|=o)):c!==null&&(c.childLanes&o)!==o&&(c.childLanes|=o),r===l)break;r=r.return}}function Ko(r,o){yu=r,Od=Go=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&o)!==0&&(tn=!0),r.firstContext=null)}function jn(r){var o=r._currentValue;if(Od!==r)if(r={context:r,memoizedValue:o,next:null},Go===null){if(yu===null)throw Error(n(308));Go=r,yu.dependencies={lanes:0,firstContext:r}}else Go=Go.next=r;return o}var Ds=null;function Ud(r){Ds===null?Ds=[r]:Ds.push(r)}function Jy(r,o,l,c){var g=o.interleaved;return g===null?(l.next=l,Ud(o)):(l.next=g.next,g.next=l),o.interleaved=l,Rr(r,c)}function Rr(r,o){r.lanes|=o;var l=r.alternate;for(l!==null&&(l.lanes|=o),l=r,r=r.return;r!==null;)r.childLanes|=o,l=r.alternate,l!==null&&(l.childLanes|=o),l=r,r=r.return;return l.tag===3?l.stateNode:null}var Yr=!1;function Vd(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Yy(r,o){r=r.updateQueue,o.updateQueue===r&&(o.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,effects:r.effects})}function Er(r,o){return{eventTime:r,lane:o,tag:0,payload:null,callback:null,next:null}}function Xr(r,o,l){var c=r.updateQueue;if(c===null)return null;if(c=c.shared,(Te&2)!==0){var g=c.pending;return g===null?o.next=o:(o.next=g.next,g.next=o),c.pending=o,Rr(r,l)}return g=c.interleaved,g===null?(o.next=o,Ud(c)):(o.next=g.next,g.next=o),c.interleaved=o,Rr(r,l)}function xu(r,o,l){if(o=o.updateQueue,o!==null&&(o=o.shared,(l&4194240)!==0)){var c=o.lanes;c&=r.pendingLanes,l|=c,o.lanes=l,nd(r,l)}}function Xy(r,o){var l=r.updateQueue,c=r.alternate;if(c!==null&&(c=c.updateQueue,l===c)){var g=null,S=null;if(l=l.firstBaseUpdate,l!==null){do{var C={eventTime:l.eventTime,lane:l.lane,tag:l.tag,payload:l.payload,callback:l.callback,next:null};S===null?g=S=C:S=S.next=C,l=l.next}while(l!==null);S===null?g=S=o:S=S.next=o}else g=S=o;l={baseState:c.baseState,firstBaseUpdate:g,lastBaseUpdate:S,shared:c.shared,effects:c.effects},r.updateQueue=l;return}r=l.lastBaseUpdate,r===null?l.firstBaseUpdate=o:r.next=o,l.lastBaseUpdate=o}function vu(r,o,l,c){var g=r.updateQueue;Yr=!1;var S=g.firstBaseUpdate,C=g.lastBaseUpdate,I=g.shared.pending;if(I!==null){g.shared.pending=null;var N=I,Q=N.next;N.next=null,C===null?S=Q:C.next=Q,C=N;var oe=r.alternate;oe!==null&&(oe=oe.updateQueue,I=oe.lastBaseUpdate,I!==C&&(I===null?oe.firstBaseUpdate=Q:I.next=Q,oe.lastBaseUpdate=N))}if(S!==null){var ie=g.baseState;C=0,oe=Q=N=null,I=S;do{var ne=I.lane,fe=I.eventTime;if((c&ne)===ne){oe!==null&&(oe=oe.next={eventTime:fe,lane:0,tag:I.tag,payload:I.payload,callback:I.callback,next:null});e:{var ge=r,me=I;switch(ne=o,fe=l,me.tag){case 1:if(ge=me.payload,typeof ge=="function"){ie=ge.call(fe,ie,ne);break e}ie=ge;break e;case 3:ge.flags=ge.flags&-65537|128;case 0:if(ge=me.payload,ne=typeof ge=="function"?ge.call(fe,ie,ne):ge,ne==null)break e;ie=ee({},ie,ne);break e;case 2:Yr=!0}}I.callback!==null&&I.lane!==0&&(r.flags|=64,ne=g.effects,ne===null?g.effects=[I]:ne.push(I))}else fe={eventTime:fe,lane:ne,tag:I.tag,payload:I.payload,callback:I.callback,next:null},oe===null?(Q=oe=fe,N=ie):oe=oe.next=fe,C|=ne;if(I=I.next,I===null){if(I=g.shared.pending,I===null)break;ne=I,I=ne.next,ne.next=null,g.lastBaseUpdate=ne,g.shared.pending=null}}while(!0);if(oe===null&&(N=ie),g.baseState=N,g.firstBaseUpdate=Q,g.lastBaseUpdate=oe,o=g.shared.interleaved,o!==null){g=o;do C|=g.lane,g=g.next;while(g!==o)}else S===null&&(g.shared.lanes=0);Vs|=C,r.lanes=C,r.memoizedState=ie}}function Zy(r,o,l){if(r=o.effects,o.effects=null,r!==null)for(o=0;o<r.length;o++){var c=r[o],g=c.callback;if(g!==null){if(c.callback=null,c=l,typeof g!="function")throw Error(n(191,g));g.call(c)}}}var aa={},ur=Kr(aa),la=Kr(aa),ua=Kr(aa);function zs(r){if(r===aa)throw Error(n(174));return r}function Bd(r,o){switch(qe(ua,o),qe(la,r),qe(ur,aa),r=o.nodeType,r){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:Bn(null,"");break;default:r=r===8?o.parentNode:o,o=r.namespaceURI||null,r=r.tagName,o=Bn(o,r)}Ge(ur),qe(ur,o)}function Qo(){Ge(ur),Ge(la),Ge(ua)}function ex(r){zs(ua.current);var o=zs(ur.current),l=Bn(o,r.type);o!==l&&(qe(la,r),qe(ur,l))}function qd(r){la.current===r&&(Ge(ur),Ge(la))}var Ze=Kr(0);function Su(r){for(var o=r;o!==null;){if(o.tag===13){var l=o.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||l.data==="$?"||l.data==="$!"))return o}else if(o.tag===19&&o.memoizedProps.revealOrder!==void 0){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var Hd=[];function Wd(){for(var r=0;r<Hd.length;r++)Hd[r]._workInProgressVersionPrimary=null;Hd.length=0}var wu=E.ReactCurrentDispatcher,Gd=E.ReactCurrentBatchConfig,Us=0,et=null,pt=null,wt=null,ku=!1,ca=!1,fa=0,pE=0;function At(){throw Error(n(321))}function Kd(r,o){if(o===null)return!1;for(var l=0;l<o.length&&l<r.length;l++)if(!Hn(r[l],o[l]))return!1;return!0}function Qd(r,o,l,c,g,S){if(Us=S,et=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,wu.current=r===null||r.memoizedState===null?vE:SE,r=l(c,g),ca){S=0;do{if(ca=!1,fa=0,25<=S)throw Error(n(301));S+=1,wt=pt=null,o.updateQueue=null,wu.current=wE,r=l(c,g)}while(ca)}if(wu.current=_u,o=pt!==null&&pt.next!==null,Us=0,wt=pt=et=null,ku=!1,o)throw Error(n(300));return r}function Jd(){var r=fa!==0;return fa=0,r}function cr(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return wt===null?et.memoizedState=wt=r:wt=wt.next=r,wt}function Nn(){if(pt===null){var r=et.alternate;r=r!==null?r.memoizedState:null}else r=pt.next;var o=wt===null?et.memoizedState:wt.next;if(o!==null)wt=o,pt=r;else{if(r===null)throw Error(n(310));pt=r,r={memoizedState:pt.memoizedState,baseState:pt.baseState,baseQueue:pt.baseQueue,queue:pt.queue,next:null},wt===null?et.memoizedState=wt=r:wt=wt.next=r}return wt}function da(r,o){return typeof o=="function"?o(r):o}function Yd(r){var o=Nn(),l=o.queue;if(l===null)throw Error(n(311));l.lastRenderedReducer=r;var c=pt,g=c.baseQueue,S=l.pending;if(S!==null){if(g!==null){var C=g.next;g.next=S.next,S.next=C}c.baseQueue=g=S,l.pending=null}if(g!==null){S=g.next,c=c.baseState;var I=C=null,N=null,Q=S;do{var oe=Q.lane;if((Us&oe)===oe)N!==null&&(N=N.next={lane:0,action:Q.action,hasEagerState:Q.hasEagerState,eagerState:Q.eagerState,next:null}),c=Q.hasEagerState?Q.eagerState:r(c,Q.action);else{var ie={lane:oe,action:Q.action,hasEagerState:Q.hasEagerState,eagerState:Q.eagerState,next:null};N===null?(I=N=ie,C=c):N=N.next=ie,et.lanes|=oe,Vs|=oe}Q=Q.next}while(Q!==null&&Q!==S);N===null?C=c:N.next=I,Hn(c,o.memoizedState)||(tn=!0),o.memoizedState=c,o.baseState=C,o.baseQueue=N,l.lastRenderedState=c}if(r=l.interleaved,r!==null){g=r;do S=g.lane,et.lanes|=S,Vs|=S,g=g.next;while(g!==r)}else g===null&&(l.lanes=0);return[o.memoizedState,l.dispatch]}function Xd(r){var o=Nn(),l=o.queue;if(l===null)throw Error(n(311));l.lastRenderedReducer=r;var c=l.dispatch,g=l.pending,S=o.memoizedState;if(g!==null){l.pending=null;var C=g=g.next;do S=r(S,C.action),C=C.next;while(C!==g);Hn(S,o.memoizedState)||(tn=!0),o.memoizedState=S,o.baseQueue===null&&(o.baseState=S),l.lastRenderedState=S}return[S,c]}function tx(){}function nx(r,o){var l=et,c=Nn(),g=o(),S=!Hn(c.memoizedState,g);if(S&&(c.memoizedState=g,tn=!0),c=c.queue,Zd(ox.bind(null,l,c,r),[r]),c.getSnapshot!==o||S||wt!==null&&wt.memoizedState.tag&1){if(l.flags|=2048,ha(9,sx.bind(null,l,c,g,o),void 0,null),kt===null)throw Error(n(349));(Us&30)!==0||rx(l,o,g)}return g}function rx(r,o,l){r.flags|=16384,r={getSnapshot:o,value:l},o=et.updateQueue,o===null?(o={lastEffect:null,stores:null},et.updateQueue=o,o.stores=[r]):(l=o.stores,l===null?o.stores=[r]:l.push(r))}function sx(r,o,l,c){o.value=l,o.getSnapshot=c,ix(o)&&ax(r)}function ox(r,o,l){return l(function(){ix(o)&&ax(r)})}function ix(r){var o=r.getSnapshot;r=r.value;try{var l=o();return!Hn(r,l)}catch{return!0}}function ax(r){var o=Rr(r,1);o!==null&&Jn(o,r,1,-1)}function lx(r){var o=cr();return typeof r=="function"&&(r=r()),o.memoizedState=o.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:da,lastRenderedState:r},o.queue=r,r=r.dispatch=xE.bind(null,et,r),[o.memoizedState,r]}function ha(r,o,l,c){return r={tag:r,create:o,destroy:l,deps:c,next:null},o=et.updateQueue,o===null?(o={lastEffect:null,stores:null},et.updateQueue=o,o.lastEffect=r.next=r):(l=o.lastEffect,l===null?o.lastEffect=r.next=r:(c=l.next,l.next=r,r.next=c,o.lastEffect=r)),r}function ux(){return Nn().memoizedState}function Cu(r,o,l,c){var g=cr();et.flags|=r,g.memoizedState=ha(1|o,l,void 0,c===void 0?null:c)}function bu(r,o,l,c){var g=Nn();c=c===void 0?null:c;var S=void 0;if(pt!==null){var C=pt.memoizedState;if(S=C.destroy,c!==null&&Kd(c,C.deps)){g.memoizedState=ha(o,l,S,c);return}}et.flags|=r,g.memoizedState=ha(1|o,l,S,c)}function cx(r,o){return Cu(8390656,8,r,o)}function Zd(r,o){return bu(2048,8,r,o)}function fx(r,o){return bu(4,2,r,o)}function dx(r,o){return bu(4,4,r,o)}function hx(r,o){if(typeof o=="function")return r=r(),o(r),function(){o(null)};if(o!=null)return r=r(),o.current=r,function(){o.current=null}}function gx(r,o,l){return l=l!=null?l.concat([r]):null,bu(4,4,hx.bind(null,o,r),l)}function eh(){}function px(r,o){var l=Nn();o=o===void 0?null:o;var c=l.memoizedState;return c!==null&&o!==null&&Kd(o,c[1])?c[0]:(l.memoizedState=[r,o],r)}function mx(r,o){var l=Nn();o=o===void 0?null:o;var c=l.memoizedState;return c!==null&&o!==null&&Kd(o,c[1])?c[0]:(r=r(),l.memoizedState=[r,o],r)}function yx(r,o,l){return(Us&21)===0?(r.baseState&&(r.baseState=!1,tn=!0),r.memoizedState=l):(Hn(l,o)||(l=G0(),et.lanes|=l,Vs|=l,r.baseState=!0),o)}function mE(r,o){var l=Ae;Ae=l!==0&&4>l?l:4,r(!0);var c=Gd.transition;Gd.transition={};try{r(!1),o()}finally{Ae=l,Gd.transition=c}}function xx(){return Nn().memoizedState}function yE(r,o,l){var c=ns(r);if(l={lane:c,action:l,hasEagerState:!1,eagerState:null,next:null},vx(r))Sx(o,l);else if(l=Jy(r,o,l,c),l!==null){var g=Kt();Jn(l,r,c,g),wx(l,o,c)}}function xE(r,o,l){var c=ns(r),g={lane:c,action:l,hasEagerState:!1,eagerState:null,next:null};if(vx(r))Sx(o,g);else{var S=r.alternate;if(r.lanes===0&&(S===null||S.lanes===0)&&(S=o.lastRenderedReducer,S!==null))try{var C=o.lastRenderedState,I=S(C,l);if(g.hasEagerState=!0,g.eagerState=I,Hn(I,C)){var N=o.interleaved;N===null?(g.next=g,Ud(o)):(g.next=N.next,N.next=g),o.interleaved=g;return}}catch{}finally{}l=Jy(r,o,g,c),l!==null&&(g=Kt(),Jn(l,r,c,g),wx(l,o,c))}}function vx(r){var o=r.alternate;return r===et||o!==null&&o===et}function Sx(r,o){ca=ku=!0;var l=r.pending;l===null?o.next=o:(o.next=l.next,l.next=o),r.pending=o}function wx(r,o,l){if((l&4194240)!==0){var c=o.lanes;c&=r.pendingLanes,l|=c,o.lanes=l,nd(r,l)}}var _u={readContext:jn,useCallback:At,useContext:At,useEffect:At,useImperativeHandle:At,useInsertionEffect:At,useLayoutEffect:At,useMemo:At,useReducer:At,useRef:At,useState:At,useDebugValue:At,useDeferredValue:At,useTransition:At,useMutableSource:At,useSyncExternalStore:At,useId:At,unstable_isNewReconciler:!1},vE={readContext:jn,useCallback:function(r,o){return cr().memoizedState=[r,o===void 0?null:o],r},useContext:jn,useEffect:cx,useImperativeHandle:function(r,o,l){return l=l!=null?l.concat([r]):null,Cu(4194308,4,hx.bind(null,o,r),l)},useLayoutEffect:function(r,o){return Cu(4194308,4,r,o)},useInsertionEffect:function(r,o){return Cu(4,2,r,o)},useMemo:function(r,o){var l=cr();return o=o===void 0?null:o,r=r(),l.memoizedState=[r,o],r},useReducer:function(r,o,l){var c=cr();return o=l!==void 0?l(o):o,c.memoizedState=c.baseState=o,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:o},c.queue=r,r=r.dispatch=yE.bind(null,et,r),[c.memoizedState,r]},useRef:function(r){var o=cr();return r={current:r},o.memoizedState=r},useState:lx,useDebugValue:eh,useDeferredValue:function(r){return cr().memoizedState=r},useTransition:function(){var r=lx(!1),o=r[0];return r=mE.bind(null,r[1]),cr().memoizedState=r,[o,r]},useMutableSource:function(){},useSyncExternalStore:function(r,o,l){var c=et,g=cr();if(Qe){if(l===void 0)throw Error(n(407));l=l()}else{if(l=o(),kt===null)throw Error(n(349));(Us&30)!==0||rx(c,o,l)}g.memoizedState=l;var S={value:l,getSnapshot:o};return g.queue=S,cx(ox.bind(null,c,S,r),[r]),c.flags|=2048,ha(9,sx.bind(null,c,S,l,o),void 0,null),l},useId:function(){var r=cr(),o=kt.identifierPrefix;if(Qe){var l=_r,c=br;l=(c&~(1<<32-qn(c)-1)).toString(32)+l,o=":"+o+"R"+l,l=fa++,0<l&&(o+="H"+l.toString(32)),o+=":"}else l=pE++,o=":"+o+"r"+l.toString(32)+":";return r.memoizedState=o},unstable_isNewReconciler:!1},SE={readContext:jn,useCallback:px,useContext:jn,useEffect:Zd,useImperativeHandle:gx,useInsertionEffect:fx,useLayoutEffect:dx,useMemo:mx,useReducer:Yd,useRef:ux,useState:function(){return Yd(da)},useDebugValue:eh,useDeferredValue:function(r){var o=Nn();return yx(o,pt.memoizedState,r)},useTransition:function(){var r=Yd(da)[0],o=Nn().memoizedState;return[r,o]},useMutableSource:tx,useSyncExternalStore:nx,useId:xx,unstable_isNewReconciler:!1},wE={readContext:jn,useCallback:px,useContext:jn,useEffect:Zd,useImperativeHandle:gx,useInsertionEffect:fx,useLayoutEffect:dx,useMemo:mx,useReducer:Xd,useRef:ux,useState:function(){return Xd(da)},useDebugValue:eh,useDeferredValue:function(r){var o=Nn();return pt===null?o.memoizedState=r:yx(o,pt.memoizedState,r)},useTransition:function(){var r=Xd(da)[0],o=Nn().memoizedState;return[r,o]},useMutableSource:tx,useSyncExternalStore:nx,useId:xx,unstable_isNewReconciler:!1};function Gn(r,o){if(r&&r.defaultProps){o=ee({},o),r=r.defaultProps;for(var l in r)o[l]===void 0&&(o[l]=r[l]);return o}return o}function th(r,o,l,c){o=r.memoizedState,l=l(c,o),l=l==null?o:ee({},o,l),r.memoizedState=l,r.lanes===0&&(r.updateQueue.baseState=l)}var Ru={isMounted:function(r){return(r=r._reactInternals)?$s(r)===r:!1},enqueueSetState:function(r,o,l){r=r._reactInternals;var c=Kt(),g=ns(r),S=Er(c,g);S.payload=o,l!=null&&(S.callback=l),o=Xr(r,S,g),o!==null&&(Jn(o,r,g,c),xu(o,r,g))},enqueueReplaceState:function(r,o,l){r=r._reactInternals;var c=Kt(),g=ns(r),S=Er(c,g);S.tag=1,S.payload=o,l!=null&&(S.callback=l),o=Xr(r,S,g),o!==null&&(Jn(o,r,g,c),xu(o,r,g))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var l=Kt(),c=ns(r),g=Er(l,c);g.tag=2,o!=null&&(g.callback=o),o=Xr(r,g,c),o!==null&&(Jn(o,r,c,l),xu(o,r,c))}};function kx(r,o,l,c,g,S,C){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(c,S,C):o.prototype&&o.prototype.isPureReactComponent?!Zi(l,c)||!Zi(g,S):!0}function Cx(r,o,l){var c=!1,g=Qr,S=o.contextType;return typeof S=="object"&&S!==null?S=jn(S):(g=en(o)?Ls:Ot.current,c=o.contextTypes,S=(c=c!=null)?Vo(r,g):Qr),o=new o(l,S),r.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=Ru,r.stateNode=o,o._reactInternals=r,c&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=g,r.__reactInternalMemoizedMaskedChildContext=S),o}function bx(r,o,l,c){r=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(l,c),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(l,c),o.state!==r&&Ru.enqueueReplaceState(o,o.state,null)}function nh(r,o,l,c){var g=r.stateNode;g.props=l,g.state=r.memoizedState,g.refs={},Vd(r);var S=o.contextType;typeof S=="object"&&S!==null?g.context=jn(S):(S=en(o)?Ls:Ot.current,g.context=Vo(r,S)),g.state=r.memoizedState,S=o.getDerivedStateFromProps,typeof S=="function"&&(th(r,o,S,l),g.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof g.getSnapshotBeforeUpdate=="function"||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(o=g.state,typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount(),o!==g.state&&Ru.enqueueReplaceState(g,g.state,null),vu(r,l,g,c),g.state=r.memoizedState),typeof g.componentDidMount=="function"&&(r.flags|=4194308)}function Jo(r,o){try{var l="",c=o;do l+=ce(c),c=c.return;while(c);var g=l}catch(S){g=`
|
|
40
|
-
Error generating stack: `+S.message+`
|
|
41
|
-
`+S.stack}return{value:r,source:o,stack:g,digest:null}}function rh(r,o,l){return{value:r,source:null,stack:l??null,digest:o??null}}function sh(r,o){try{console.error(o.value)}catch(l){setTimeout(function(){throw l})}}var kE=typeof WeakMap=="function"?WeakMap:Map;function _x(r,o,l){l=Er(-1,l),l.tag=3,l.payload={element:null};var c=o.value;return l.callback=function(){Tu||(Tu=!0,vh=c),sh(r,o)},l}function Rx(r,o,l){l=Er(-1,l),l.tag=3;var c=r.type.getDerivedStateFromError;if(typeof c=="function"){var g=o.value;l.payload=function(){return c(g)},l.callback=function(){sh(r,o)}}var S=r.stateNode;return S!==null&&typeof S.componentDidCatch=="function"&&(l.callback=function(){sh(r,o),typeof c!="function"&&(es===null?es=new Set([this]):es.add(this));var C=o.stack;this.componentDidCatch(o.value,{componentStack:C!==null?C:""})}),l}function Ex(r,o,l){var c=r.pingCache;if(c===null){c=r.pingCache=new kE;var g=new Set;c.set(o,g)}else g=c.get(o),g===void 0&&(g=new Set,c.set(o,g));g.has(l)||(g.add(l),r=LE.bind(null,r,o,l),o.then(r,r))}function Px(r){do{var o;if((o=r.tag===13)&&(o=r.memoizedState,o=o!==null?o.dehydrated!==null:!0),o)return r;r=r.return}while(r!==null);return null}function Ix(r,o,l,c,g){return(r.mode&1)===0?(r===o?r.flags|=65536:(r.flags|=128,l.flags|=131072,l.flags&=-52805,l.tag===1&&(l.alternate===null?l.tag=17:(o=Er(-1,1),o.tag=2,Xr(l,o,1))),l.lanes|=1),r):(r.flags|=65536,r.lanes=g,r)}var CE=E.ReactCurrentOwner,tn=!1;function Gt(r,o,l,c){o.child=r===null?Qy(o,null,l,c):Wo(o,r.child,l,c)}function jx(r,o,l,c,g){l=l.render;var S=o.ref;return Ko(o,g),c=Qd(r,o,l,c,S,g),l=Jd(),r!==null&&!tn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~g,Pr(r,o,g)):(Qe&&l&&Md(o),o.flags|=1,Gt(r,o,c,g),o.child)}function Nx(r,o,l,c,g){if(r===null){var S=l.type;return typeof S=="function"&&!Rh(S)&&S.defaultProps===void 0&&l.compare===null&&l.defaultProps===void 0?(o.tag=15,o.type=S,Mx(r,o,S,c,g)):(r=Du(l.type,null,c,o,o.mode,g),r.ref=o.ref,r.return=o,o.child=r)}if(S=r.child,(r.lanes&g)===0){var C=S.memoizedProps;if(l=l.compare,l=l!==null?l:Zi,l(C,c)&&r.ref===o.ref)return Pr(r,o,g)}return o.flags|=1,r=ss(S,c),r.ref=o.ref,r.return=o,o.child=r}function Mx(r,o,l,c,g){if(r!==null){var S=r.memoizedProps;if(Zi(S,c)&&r.ref===o.ref)if(tn=!1,o.pendingProps=c=S,(r.lanes&g)!==0)(r.flags&131072)!==0&&(tn=!0);else return o.lanes=r.lanes,Pr(r,o,g)}return oh(r,o,l,c,g)}function Tx(r,o,l){var c=o.pendingProps,g=c.children,S=r!==null?r.memoizedState:null;if(c.mode==="hidden")if((o.mode&1)===0)o.memoizedState={baseLanes:0,cachePool:null,transitions:null},qe(Xo,yn),yn|=l;else{if((l&1073741824)===0)return r=S!==null?S.baseLanes|l:l,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:r,cachePool:null,transitions:null},o.updateQueue=null,qe(Xo,yn),yn|=r,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},c=S!==null?S.baseLanes:l,qe(Xo,yn),yn|=c}else S!==null?(c=S.baseLanes|l,o.memoizedState=null):c=l,qe(Xo,yn),yn|=c;return Gt(r,o,g,l),o.child}function $x(r,o){var l=o.ref;(r===null&&l!==null||r!==null&&r.ref!==l)&&(o.flags|=512,o.flags|=2097152)}function oh(r,o,l,c,g){var S=en(l)?Ls:Ot.current;return S=Vo(o,S),Ko(o,g),l=Qd(r,o,l,c,S,g),c=Jd(),r!==null&&!tn?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~g,Pr(r,o,g)):(Qe&&c&&Md(o),o.flags|=1,Gt(r,o,l,g),o.child)}function Fx(r,o,l,c,g){if(en(l)){var S=!0;cu(o)}else S=!1;if(Ko(o,g),o.stateNode===null)Pu(r,o),Cx(o,l,c),nh(o,l,c,g),c=!0;else if(r===null){var C=o.stateNode,I=o.memoizedProps;C.props=I;var N=C.context,Q=l.contextType;typeof Q=="object"&&Q!==null?Q=jn(Q):(Q=en(l)?Ls:Ot.current,Q=Vo(o,Q));var oe=l.getDerivedStateFromProps,ie=typeof oe=="function"||typeof C.getSnapshotBeforeUpdate=="function";ie||typeof C.UNSAFE_componentWillReceiveProps!="function"&&typeof C.componentWillReceiveProps!="function"||(I!==c||N!==Q)&&bx(o,C,c,Q),Yr=!1;var ne=o.memoizedState;C.state=ne,vu(o,c,C,g),N=o.memoizedState,I!==c||ne!==N||Zt.current||Yr?(typeof oe=="function"&&(th(o,l,oe,c),N=o.memoizedState),(I=Yr||kx(o,l,I,c,ne,N,Q))?(ie||typeof C.UNSAFE_componentWillMount!="function"&&typeof C.componentWillMount!="function"||(typeof C.componentWillMount=="function"&&C.componentWillMount(),typeof C.UNSAFE_componentWillMount=="function"&&C.UNSAFE_componentWillMount()),typeof C.componentDidMount=="function"&&(o.flags|=4194308)):(typeof C.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=c,o.memoizedState=N),C.props=c,C.state=N,C.context=Q,c=I):(typeof C.componentDidMount=="function"&&(o.flags|=4194308),c=!1)}else{C=o.stateNode,Yy(r,o),I=o.memoizedProps,Q=o.type===o.elementType?I:Gn(o.type,I),C.props=Q,ie=o.pendingProps,ne=C.context,N=l.contextType,typeof N=="object"&&N!==null?N=jn(N):(N=en(l)?Ls:Ot.current,N=Vo(o,N));var fe=l.getDerivedStateFromProps;(oe=typeof fe=="function"||typeof C.getSnapshotBeforeUpdate=="function")||typeof C.UNSAFE_componentWillReceiveProps!="function"&&typeof C.componentWillReceiveProps!="function"||(I!==ie||ne!==N)&&bx(o,C,c,N),Yr=!1,ne=o.memoizedState,C.state=ne,vu(o,c,C,g);var ge=o.memoizedState;I!==ie||ne!==ge||Zt.current||Yr?(typeof fe=="function"&&(th(o,l,fe,c),ge=o.memoizedState),(Q=Yr||kx(o,l,Q,c,ne,ge,N)||!1)?(oe||typeof C.UNSAFE_componentWillUpdate!="function"&&typeof C.componentWillUpdate!="function"||(typeof C.componentWillUpdate=="function"&&C.componentWillUpdate(c,ge,N),typeof C.UNSAFE_componentWillUpdate=="function"&&C.UNSAFE_componentWillUpdate(c,ge,N)),typeof C.componentDidUpdate=="function"&&(o.flags|=4),typeof C.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof C.componentDidUpdate!="function"||I===r.memoizedProps&&ne===r.memoizedState||(o.flags|=4),typeof C.getSnapshotBeforeUpdate!="function"||I===r.memoizedProps&&ne===r.memoizedState||(o.flags|=1024),o.memoizedProps=c,o.memoizedState=ge),C.props=c,C.state=ge,C.context=N,c=Q):(typeof C.componentDidUpdate!="function"||I===r.memoizedProps&&ne===r.memoizedState||(o.flags|=4),typeof C.getSnapshotBeforeUpdate!="function"||I===r.memoizedProps&&ne===r.memoizedState||(o.flags|=1024),c=!1)}return ih(r,o,l,c,S,g)}function ih(r,o,l,c,g,S){$x(r,o);var C=(o.flags&128)!==0;if(!c&&!C)return g&&zy(o,l,!1),Pr(r,o,S);c=o.stateNode,CE.current=o;var I=C&&typeof l.getDerivedStateFromError!="function"?null:c.render();return o.flags|=1,r!==null&&C?(o.child=Wo(o,r.child,null,S),o.child=Wo(o,null,I,S)):Gt(r,o,I,S),o.memoizedState=c.state,g&&zy(o,l,!0),o.child}function Lx(r){var o=r.stateNode;o.pendingContext?Ay(r,o.pendingContext,o.pendingContext!==o.context):o.context&&Ay(r,o.context,!1),Bd(r,o.containerInfo)}function Ox(r,o,l,c,g){return Ho(),Ld(g),o.flags|=256,Gt(r,o,l,c),o.child}var ah={dehydrated:null,treeContext:null,retryLane:0};function lh(r){return{baseLanes:r,cachePool:null,transitions:null}}function Ax(r,o,l){var c=o.pendingProps,g=Ze.current,S=!1,C=(o.flags&128)!==0,I;if((I=C)||(I=r!==null&&r.memoizedState===null?!1:(g&2)!==0),I?(S=!0,o.flags&=-129):(r===null||r.memoizedState!==null)&&(g|=1),qe(Ze,g&1),r===null)return Fd(o),r=o.memoizedState,r!==null&&(r=r.dehydrated,r!==null)?((o.mode&1)===0?o.lanes=1:r.data==="$!"?o.lanes=8:o.lanes=1073741824,null):(C=c.children,r=c.fallback,S?(c=o.mode,S=o.child,C={mode:"hidden",children:C},(c&1)===0&&S!==null?(S.childLanes=0,S.pendingProps=C):S=zu(C,c,0,null),r=Ws(r,c,l,null),S.return=o,r.return=o,S.sibling=r,o.child=S,o.child.memoizedState=lh(l),o.memoizedState=ah,r):uh(o,C));if(g=r.memoizedState,g!==null&&(I=g.dehydrated,I!==null))return bE(r,o,C,c,I,g,l);if(S){S=c.fallback,C=o.mode,g=r.child,I=g.sibling;var N={mode:"hidden",children:c.children};return(C&1)===0&&o.child!==g?(c=o.child,c.childLanes=0,c.pendingProps=N,o.deletions=null):(c=ss(g,N),c.subtreeFlags=g.subtreeFlags&14680064),I!==null?S=ss(I,S):(S=Ws(S,C,l,null),S.flags|=2),S.return=o,c.return=o,c.sibling=S,o.child=c,c=S,S=o.child,C=r.child.memoizedState,C=C===null?lh(l):{baseLanes:C.baseLanes|l,cachePool:null,transitions:C.transitions},S.memoizedState=C,S.childLanes=r.childLanes&~l,o.memoizedState=ah,c}return S=r.child,r=S.sibling,c=ss(S,{mode:"visible",children:c.children}),(o.mode&1)===0&&(c.lanes=l),c.return=o,c.sibling=null,r!==null&&(l=o.deletions,l===null?(o.deletions=[r],o.flags|=16):l.push(r)),o.child=c,o.memoizedState=null,c}function uh(r,o){return o=zu({mode:"visible",children:o},r.mode,0,null),o.return=r,r.child=o}function Eu(r,o,l,c){return c!==null&&Ld(c),Wo(o,r.child,null,l),r=uh(o,o.pendingProps.children),r.flags|=2,o.memoizedState=null,r}function bE(r,o,l,c,g,S,C){if(l)return o.flags&256?(o.flags&=-257,c=rh(Error(n(422))),Eu(r,o,C,c)):o.memoizedState!==null?(o.child=r.child,o.flags|=128,null):(S=c.fallback,g=o.mode,c=zu({mode:"visible",children:c.children},g,0,null),S=Ws(S,g,C,null),S.flags|=2,c.return=o,S.return=o,c.sibling=S,o.child=c,(o.mode&1)!==0&&Wo(o,r.child,null,C),o.child.memoizedState=lh(C),o.memoizedState=ah,S);if((o.mode&1)===0)return Eu(r,o,C,null);if(g.data==="$!"){if(c=g.nextSibling&&g.nextSibling.dataset,c)var I=c.dgst;return c=I,S=Error(n(419)),c=rh(S,c,void 0),Eu(r,o,C,c)}if(I=(C&r.childLanes)!==0,tn||I){if(c=kt,c!==null){switch(C&-C){case 4:g=2;break;case 16:g=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:g=32;break;case 536870912:g=268435456;break;default:g=0}g=(g&(c.suspendedLanes|C))!==0?0:g,g!==0&&g!==S.retryLane&&(S.retryLane=g,Rr(r,g),Jn(c,r,g,-1))}return _h(),c=rh(Error(n(421))),Eu(r,o,C,c)}return g.data==="$?"?(o.flags|=128,o.child=r.child,o=OE.bind(null,r),g._reactRetry=o,null):(r=S.treeContext,mn=Gr(g.nextSibling),pn=o,Qe=!0,Wn=null,r!==null&&(Pn[In++]=br,Pn[In++]=_r,Pn[In++]=Os,br=r.id,_r=r.overflow,Os=o),o=uh(o,c.children),o.flags|=4096,o)}function Dx(r,o,l){r.lanes|=o;var c=r.alternate;c!==null&&(c.lanes|=o),zd(r.return,o,l)}function ch(r,o,l,c,g){var S=r.memoizedState;S===null?r.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:c,tail:l,tailMode:g}:(S.isBackwards=o,S.rendering=null,S.renderingStartTime=0,S.last=c,S.tail=l,S.tailMode=g)}function zx(r,o,l){var c=o.pendingProps,g=c.revealOrder,S=c.tail;if(Gt(r,o,c.children,l),c=Ze.current,(c&2)!==0)c=c&1|2,o.flags|=128;else{if(r!==null&&(r.flags&128)!==0)e:for(r=o.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&Dx(r,l,o);else if(r.tag===19)Dx(r,l,o);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===o)break e;for(;r.sibling===null;){if(r.return===null||r.return===o)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}c&=1}if(qe(Ze,c),(o.mode&1)===0)o.memoizedState=null;else switch(g){case"forwards":for(l=o.child,g=null;l!==null;)r=l.alternate,r!==null&&Su(r)===null&&(g=l),l=l.sibling;l=g,l===null?(g=o.child,o.child=null):(g=l.sibling,l.sibling=null),ch(o,!1,g,l,S);break;case"backwards":for(l=null,g=o.child,o.child=null;g!==null;){if(r=g.alternate,r!==null&&Su(r)===null){o.child=g;break}r=g.sibling,g.sibling=l,l=g,g=r}ch(o,!0,l,null,S);break;case"together":ch(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function Pu(r,o){(o.mode&1)===0&&r!==null&&(r.alternate=null,o.alternate=null,o.flags|=2)}function Pr(r,o,l){if(r!==null&&(o.dependencies=r.dependencies),Vs|=o.lanes,(l&o.childLanes)===0)return null;if(r!==null&&o.child!==r.child)throw Error(n(153));if(o.child!==null){for(r=o.child,l=ss(r,r.pendingProps),o.child=l,l.return=o;r.sibling!==null;)r=r.sibling,l=l.sibling=ss(r,r.pendingProps),l.return=o;l.sibling=null}return o.child}function _E(r,o,l){switch(o.tag){case 3:Lx(o),Ho();break;case 5:ex(o);break;case 1:en(o.type)&&cu(o);break;case 4:Bd(o,o.stateNode.containerInfo);break;case 10:var c=o.type._context,g=o.memoizedProps.value;qe(mu,c._currentValue),c._currentValue=g;break;case 13:if(c=o.memoizedState,c!==null)return c.dehydrated!==null?(qe(Ze,Ze.current&1),o.flags|=128,null):(l&o.child.childLanes)!==0?Ax(r,o,l):(qe(Ze,Ze.current&1),r=Pr(r,o,l),r!==null?r.sibling:null);qe(Ze,Ze.current&1);break;case 19:if(c=(l&o.childLanes)!==0,(r.flags&128)!==0){if(c)return zx(r,o,l);o.flags|=128}if(g=o.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),qe(Ze,Ze.current),c)break;return null;case 22:case 23:return o.lanes=0,Tx(r,o,l)}return Pr(r,o,l)}var Ux,fh,Vx,Bx;Ux=function(r,o){for(var l=o.child;l!==null;){if(l.tag===5||l.tag===6)r.appendChild(l.stateNode);else if(l.tag!==4&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===o)break;for(;l.sibling===null;){if(l.return===null||l.return===o)return;l=l.return}l.sibling.return=l.return,l=l.sibling}},fh=function(){},Vx=function(r,o,l,c){var g=r.memoizedProps;if(g!==c){r=o.stateNode,zs(ur.current);var S=null;switch(l){case"input":g=Eo(r,g),c=Eo(r,c),S=[];break;case"select":g=ee({},g,{value:void 0}),c=ee({},c,{value:void 0}),S=[];break;case"textarea":g=Io(r,g),c=Io(r,c),S=[];break;default:typeof g.onClick!="function"&&typeof c.onClick=="function"&&(r.onclick=au)}Hf(l,c);var C;l=null;for(Q in g)if(!c.hasOwnProperty(Q)&&g.hasOwnProperty(Q)&&g[Q]!=null)if(Q==="style"){var I=g[Q];for(C in I)I.hasOwnProperty(C)&&(l||(l={}),l[C]="")}else Q!=="dangerouslySetInnerHTML"&&Q!=="children"&&Q!=="suppressContentEditableWarning"&&Q!=="suppressHydrationWarning"&&Q!=="autoFocus"&&(i.hasOwnProperty(Q)?S||(S=[]):(S=S||[]).push(Q,null));for(Q in c){var N=c[Q];if(I=g!=null?g[Q]:void 0,c.hasOwnProperty(Q)&&N!==I&&(N!=null||I!=null))if(Q==="style")if(I){for(C in I)!I.hasOwnProperty(C)||N&&N.hasOwnProperty(C)||(l||(l={}),l[C]="");for(C in N)N.hasOwnProperty(C)&&I[C]!==N[C]&&(l||(l={}),l[C]=N[C])}else l||(S||(S=[]),S.push(Q,l)),l=N;else Q==="dangerouslySetInnerHTML"?(N=N?N.__html:void 0,I=I?I.__html:void 0,N!=null&&I!==N&&(S=S||[]).push(Q,N)):Q==="children"?typeof N!="string"&&typeof N!="number"||(S=S||[]).push(Q,""+N):Q!=="suppressContentEditableWarning"&&Q!=="suppressHydrationWarning"&&(i.hasOwnProperty(Q)?(N!=null&&Q==="onScroll"&&We("scroll",r),S||I===N||(S=[])):(S=S||[]).push(Q,N))}l&&(S=S||[]).push("style",l);var Q=S;(o.updateQueue=Q)&&(o.flags|=4)}},Bx=function(r,o,l,c){l!==c&&(o.flags|=4)};function ga(r,o){if(!Qe)switch(r.tailMode){case"hidden":o=r.tail;for(var l=null;o!==null;)o.alternate!==null&&(l=o),o=o.sibling;l===null?r.tail=null:l.sibling=null;break;case"collapsed":l=r.tail;for(var c=null;l!==null;)l.alternate!==null&&(c=l),l=l.sibling;c===null?o||r.tail===null?r.tail=null:r.tail.sibling=null:c.sibling=null}}function Dt(r){var o=r.alternate!==null&&r.alternate.child===r.child,l=0,c=0;if(o)for(var g=r.child;g!==null;)l|=g.lanes|g.childLanes,c|=g.subtreeFlags&14680064,c|=g.flags&14680064,g.return=r,g=g.sibling;else for(g=r.child;g!==null;)l|=g.lanes|g.childLanes,c|=g.subtreeFlags,c|=g.flags,g.return=r,g=g.sibling;return r.subtreeFlags|=c,r.childLanes=l,o}function RE(r,o,l){var c=o.pendingProps;switch(Td(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Dt(o),null;case 1:return en(o.type)&&uu(),Dt(o),null;case 3:return c=o.stateNode,Qo(),Ge(Zt),Ge(Ot),Wd(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(r===null||r.child===null)&&(gu(o)?o.flags|=4:r===null||r.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,Wn!==null&&(kh(Wn),Wn=null))),fh(r,o),Dt(o),null;case 5:qd(o);var g=zs(ua.current);if(l=o.type,r!==null&&o.stateNode!=null)Vx(r,o,l,c,g),r.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!c){if(o.stateNode===null)throw Error(n(166));return Dt(o),null}if(r=zs(ur.current),gu(o)){c=o.stateNode,l=o.type;var S=o.memoizedProps;switch(c[lr]=o,c[sa]=S,r=(o.mode&1)!==0,l){case"dialog":We("cancel",c),We("close",c);break;case"iframe":case"object":case"embed":We("load",c);break;case"video":case"audio":for(g=0;g<ta.length;g++)We(ta[g],c);break;case"source":We("error",c);break;case"img":case"image":case"link":We("error",c),We("load",c);break;case"details":We("toggle",c);break;case"input":Al(c,S),We("invalid",c);break;case"select":c._wrapperState={wasMultiple:!!S.multiple},We("invalid",c);break;case"textarea":Dl(c,S),We("invalid",c)}Hf(l,S),g=null;for(var C in S)if(S.hasOwnProperty(C)){var I=S[C];C==="children"?typeof I=="string"?c.textContent!==I&&(S.suppressHydrationWarning!==!0&&iu(c.textContent,I,r),g=["children",I]):typeof I=="number"&&c.textContent!==""+I&&(S.suppressHydrationWarning!==!0&&iu(c.textContent,I,r),g=["children",""+I]):i.hasOwnProperty(C)&&I!=null&&C==="onScroll"&&We("scroll",c)}switch(l){case"input":Sr(c),wr(c,S,!0);break;case"textarea":Sr(c),Oe(c);break;case"select":case"option":break;default:typeof S.onClick=="function"&&(c.onclick=au)}c=g,o.updateQueue=c,c!==null&&(o.flags|=4)}else{C=g.nodeType===9?g:g.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=Mt(l)),r==="http://www.w3.org/1999/xhtml"?l==="script"?(r=C.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof c.is=="string"?r=C.createElement(l,{is:c.is}):(r=C.createElement(l),l==="select"&&(C=r,c.multiple?C.multiple=!0:c.size&&(C.size=c.size))):r=C.createElementNS(r,l),r[lr]=o,r[sa]=c,Ux(r,o,!1,!1),o.stateNode=r;e:{switch(C=Wf(l,c),l){case"dialog":We("cancel",r),We("close",r),g=c;break;case"iframe":case"object":case"embed":We("load",r),g=c;break;case"video":case"audio":for(g=0;g<ta.length;g++)We(ta[g],r);g=c;break;case"source":We("error",r),g=c;break;case"img":case"image":case"link":We("error",r),We("load",r),g=c;break;case"details":We("toggle",r),g=c;break;case"input":Al(r,c),g=Eo(r,c),We("invalid",r);break;case"option":g=c;break;case"select":r._wrapperState={wasMultiple:!!c.multiple},g=ee({},c,{value:void 0}),We("invalid",r);break;case"textarea":Dl(r,c),g=Io(r,c),We("invalid",r);break;default:g=c}Hf(l,g),I=g;for(S in I)if(I.hasOwnProperty(S)){var N=I[S];S==="style"?M0(r,N):S==="dangerouslySetInnerHTML"?(N=N?N.__html:void 0,N!=null&&j0(r,N)):S==="children"?typeof N=="string"?(l!=="textarea"||N!=="")&&Li(r,N):typeof N=="number"&&Li(r,""+N):S!=="suppressContentEditableWarning"&&S!=="suppressHydrationWarning"&&S!=="autoFocus"&&(i.hasOwnProperty(S)?N!=null&&S==="onScroll"&&We("scroll",r):N!=null&&j(r,S,N,C))}switch(l){case"input":Sr(r),wr(r,c,!1);break;case"textarea":Sr(r),Oe(r);break;case"option":c.value!=null&&r.setAttribute("value",""+Ce(c.value));break;case"select":r.multiple=!!c.multiple,S=c.value,S!=null?zr(r,!!c.multiple,S,!1):c.defaultValue!=null&&zr(r,!!c.multiple,c.defaultValue,!0);break;default:typeof g.onClick=="function"&&(r.onclick=au)}switch(l){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}}c&&(o.flags|=4)}o.ref!==null&&(o.flags|=512,o.flags|=2097152)}return Dt(o),null;case 6:if(r&&o.stateNode!=null)Bx(r,o,r.memoizedProps,c);else{if(typeof c!="string"&&o.stateNode===null)throw Error(n(166));if(l=zs(ua.current),zs(ur.current),gu(o)){if(c=o.stateNode,l=o.memoizedProps,c[lr]=o,(S=c.nodeValue!==l)&&(r=pn,r!==null))switch(r.tag){case 3:iu(c.nodeValue,l,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&iu(c.nodeValue,l,(r.mode&1)!==0)}S&&(o.flags|=4)}else c=(l.nodeType===9?l:l.ownerDocument).createTextNode(c),c[lr]=o,o.stateNode=c}return Dt(o),null;case 13:if(Ge(Ze),c=o.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(Qe&&mn!==null&&(o.mode&1)!==0&&(o.flags&128)===0)Wy(),Ho(),o.flags|=98560,S=!1;else if(S=gu(o),c!==null&&c.dehydrated!==null){if(r===null){if(!S)throw Error(n(318));if(S=o.memoizedState,S=S!==null?S.dehydrated:null,!S)throw Error(n(317));S[lr]=o}else Ho(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Dt(o),S=!1}else Wn!==null&&(kh(Wn),Wn=null),S=!0;if(!S)return o.flags&65536?o:null}return(o.flags&128)!==0?(o.lanes=l,o):(c=c!==null,c!==(r!==null&&r.memoizedState!==null)&&c&&(o.child.flags|=8192,(o.mode&1)!==0&&(r===null||(Ze.current&1)!==0?mt===0&&(mt=3):_h())),o.updateQueue!==null&&(o.flags|=4),Dt(o),null);case 4:return Qo(),fh(r,o),r===null&&na(o.stateNode.containerInfo),Dt(o),null;case 10:return Dd(o.type._context),Dt(o),null;case 17:return en(o.type)&&uu(),Dt(o),null;case 19:if(Ge(Ze),S=o.memoizedState,S===null)return Dt(o),null;if(c=(o.flags&128)!==0,C=S.rendering,C===null)if(c)ga(S,!1);else{if(mt!==0||r!==null&&(r.flags&128)!==0)for(r=o.child;r!==null;){if(C=Su(r),C!==null){for(o.flags|=128,ga(S,!1),c=C.updateQueue,c!==null&&(o.updateQueue=c,o.flags|=4),o.subtreeFlags=0,c=l,l=o.child;l!==null;)S=l,r=c,S.flags&=14680066,C=S.alternate,C===null?(S.childLanes=0,S.lanes=r,S.child=null,S.subtreeFlags=0,S.memoizedProps=null,S.memoizedState=null,S.updateQueue=null,S.dependencies=null,S.stateNode=null):(S.childLanes=C.childLanes,S.lanes=C.lanes,S.child=C.child,S.subtreeFlags=0,S.deletions=null,S.memoizedProps=C.memoizedProps,S.memoizedState=C.memoizedState,S.updateQueue=C.updateQueue,S.type=C.type,r=C.dependencies,S.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),l=l.sibling;return qe(Ze,Ze.current&1|2),o.child}r=r.sibling}S.tail!==null&&ut()>Zo&&(o.flags|=128,c=!0,ga(S,!1),o.lanes=4194304)}else{if(!c)if(r=Su(C),r!==null){if(o.flags|=128,c=!0,l=r.updateQueue,l!==null&&(o.updateQueue=l,o.flags|=4),ga(S,!0),S.tail===null&&S.tailMode==="hidden"&&!C.alternate&&!Qe)return Dt(o),null}else 2*ut()-S.renderingStartTime>Zo&&l!==1073741824&&(o.flags|=128,c=!0,ga(S,!1),o.lanes=4194304);S.isBackwards?(C.sibling=o.child,o.child=C):(l=S.last,l!==null?l.sibling=C:o.child=C,S.last=C)}return S.tail!==null?(o=S.tail,S.rendering=o,S.tail=o.sibling,S.renderingStartTime=ut(),o.sibling=null,l=Ze.current,qe(Ze,c?l&1|2:l&1),o):(Dt(o),null);case 22:case 23:return bh(),c=o.memoizedState!==null,r!==null&&r.memoizedState!==null!==c&&(o.flags|=8192),c&&(o.mode&1)!==0?(yn&1073741824)!==0&&(Dt(o),o.subtreeFlags&6&&(o.flags|=8192)):Dt(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function EE(r,o){switch(Td(o),o.tag){case 1:return en(o.type)&&uu(),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return Qo(),Ge(Zt),Ge(Ot),Wd(),r=o.flags,(r&65536)!==0&&(r&128)===0?(o.flags=r&-65537|128,o):null;case 5:return qd(o),null;case 13:if(Ge(Ze),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(n(340));Ho()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return Ge(Ze),null;case 4:return Qo(),null;case 10:return Dd(o.type._context),null;case 22:case 23:return bh(),null;case 24:return null;default:return null}}var Iu=!1,zt=!1,PE=typeof WeakSet=="function"?WeakSet:Set,de=null;function Yo(r,o){var l=r.ref;if(l!==null)if(typeof l=="function")try{l(null)}catch(c){nt(r,o,c)}else l.current=null}function dh(r,o,l){try{l()}catch(c){nt(r,o,c)}}var qx=!1;function IE(r,o){if(bd=Ql,r=ky(),md(r)){if("selectionStart"in r)var l={start:r.selectionStart,end:r.selectionEnd};else e:{l=(l=r.ownerDocument)&&l.defaultView||window;var c=l.getSelection&&l.getSelection();if(c&&c.rangeCount!==0){l=c.anchorNode;var g=c.anchorOffset,S=c.focusNode;c=c.focusOffset;try{l.nodeType,S.nodeType}catch{l=null;break e}var C=0,I=-1,N=-1,Q=0,oe=0,ie=r,ne=null;t:for(;;){for(var fe;ie!==l||g!==0&&ie.nodeType!==3||(I=C+g),ie!==S||c!==0&&ie.nodeType!==3||(N=C+c),ie.nodeType===3&&(C+=ie.nodeValue.length),(fe=ie.firstChild)!==null;)ne=ie,ie=fe;for(;;){if(ie===r)break t;if(ne===l&&++Q===g&&(I=C),ne===S&&++oe===c&&(N=C),(fe=ie.nextSibling)!==null)break;ie=ne,ne=ie.parentNode}ie=fe}l=I===-1||N===-1?null:{start:I,end:N}}else l=null}l=l||{start:0,end:0}}else l=null;for(_d={focusedElem:r,selectionRange:l},Ql=!1,de=o;de!==null;)if(o=de,r=o.child,(o.subtreeFlags&1028)!==0&&r!==null)r.return=o,de=r;else for(;de!==null;){o=de;try{var ge=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if(ge!==null){var me=ge.memoizedProps,ct=ge.memoizedState,B=o.stateNode,F=B.getSnapshotBeforeUpdate(o.elementType===o.type?me:Gn(o.type,me),ct);B.__reactInternalSnapshotBeforeUpdate=F}break;case 3:var W=o.stateNode.containerInfo;W.nodeType===1?W.textContent="":W.nodeType===9&&W.documentElement&&W.removeChild(W.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(le){nt(o,o.return,le)}if(r=o.sibling,r!==null){r.return=o.return,de=r;break}de=o.return}return ge=qx,qx=!1,ge}function pa(r,o,l){var c=o.updateQueue;if(c=c!==null?c.lastEffect:null,c!==null){var g=c=c.next;do{if((g.tag&r)===r){var S=g.destroy;g.destroy=void 0,S!==void 0&&dh(o,l,S)}g=g.next}while(g!==c)}}function ju(r,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var l=o=o.next;do{if((l.tag&r)===r){var c=l.create;l.destroy=c()}l=l.next}while(l!==o)}}function hh(r){var o=r.ref;if(o!==null){var l=r.stateNode;switch(r.tag){case 5:r=l;break;default:r=l}typeof o=="function"?o(r):o.current=r}}function Hx(r){var o=r.alternate;o!==null&&(r.alternate=null,Hx(o)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(o=r.stateNode,o!==null&&(delete o[lr],delete o[sa],delete o[Id],delete o[fE],delete o[dE])),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}function Wx(r){return r.tag===5||r.tag===3||r.tag===4}function Gx(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Wx(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function gh(r,o,l){var c=r.tag;if(c===5||c===6)r=r.stateNode,o?l.nodeType===8?l.parentNode.insertBefore(r,o):l.insertBefore(r,o):(l.nodeType===8?(o=l.parentNode,o.insertBefore(r,l)):(o=l,o.appendChild(r)),l=l._reactRootContainer,l!=null||o.onclick!==null||(o.onclick=au));else if(c!==4&&(r=r.child,r!==null))for(gh(r,o,l),r=r.sibling;r!==null;)gh(r,o,l),r=r.sibling}function ph(r,o,l){var c=r.tag;if(c===5||c===6)r=r.stateNode,o?l.insertBefore(r,o):l.appendChild(r);else if(c!==4&&(r=r.child,r!==null))for(ph(r,o,l),r=r.sibling;r!==null;)ph(r,o,l),r=r.sibling}var Tt=null,Kn=!1;function Zr(r,o,l){for(l=l.child;l!==null;)Kx(r,o,l),l=l.sibling}function Kx(r,o,l){if(ar&&typeof ar.onCommitFiberUnmount=="function")try{ar.onCommitFiberUnmount(Bl,l)}catch{}switch(l.tag){case 5:zt||Yo(l,o);case 6:var c=Tt,g=Kn;Tt=null,Zr(r,o,l),Tt=c,Kn=g,Tt!==null&&(Kn?(r=Tt,l=l.stateNode,r.nodeType===8?r.parentNode.removeChild(l):r.removeChild(l)):Tt.removeChild(l.stateNode));break;case 18:Tt!==null&&(Kn?(r=Tt,l=l.stateNode,r.nodeType===8?Pd(r.parentNode,l):r.nodeType===1&&Pd(r,l),Gi(r)):Pd(Tt,l.stateNode));break;case 4:c=Tt,g=Kn,Tt=l.stateNode.containerInfo,Kn=!0,Zr(r,o,l),Tt=c,Kn=g;break;case 0:case 11:case 14:case 15:if(!zt&&(c=l.updateQueue,c!==null&&(c=c.lastEffect,c!==null))){g=c=c.next;do{var S=g,C=S.destroy;S=S.tag,C!==void 0&&((S&2)!==0||(S&4)!==0)&&dh(l,o,C),g=g.next}while(g!==c)}Zr(r,o,l);break;case 1:if(!zt&&(Yo(l,o),c=l.stateNode,typeof c.componentWillUnmount=="function"))try{c.props=l.memoizedProps,c.state=l.memoizedState,c.componentWillUnmount()}catch(I){nt(l,o,I)}Zr(r,o,l);break;case 21:Zr(r,o,l);break;case 22:l.mode&1?(zt=(c=zt)||l.memoizedState!==null,Zr(r,o,l),zt=c):Zr(r,o,l);break;default:Zr(r,o,l)}}function Qx(r){var o=r.updateQueue;if(o!==null){r.updateQueue=null;var l=r.stateNode;l===null&&(l=r.stateNode=new PE),o.forEach(function(c){var g=AE.bind(null,r,c);l.has(c)||(l.add(c),c.then(g,g))})}}function Qn(r,o){var l=o.deletions;if(l!==null)for(var c=0;c<l.length;c++){var g=l[c];try{var S=r,C=o,I=C;e:for(;I!==null;){switch(I.tag){case 5:Tt=I.stateNode,Kn=!1;break e;case 3:Tt=I.stateNode.containerInfo,Kn=!0;break e;case 4:Tt=I.stateNode.containerInfo,Kn=!0;break e}I=I.return}if(Tt===null)throw Error(n(160));Kx(S,C,g),Tt=null,Kn=!1;var N=g.alternate;N!==null&&(N.return=null),g.return=null}catch(Q){nt(g,o,Q)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)Jx(o,r),o=o.sibling}function Jx(r,o){var l=r.alternate,c=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(Qn(o,r),fr(r),c&4){try{pa(3,r,r.return),ju(3,r)}catch(me){nt(r,r.return,me)}try{pa(5,r,r.return)}catch(me){nt(r,r.return,me)}}break;case 1:Qn(o,r),fr(r),c&512&&l!==null&&Yo(l,l.return);break;case 5:if(Qn(o,r),fr(r),c&512&&l!==null&&Yo(l,l.return),r.flags&32){var g=r.stateNode;try{Li(g,"")}catch(me){nt(r,r.return,me)}}if(c&4&&(g=r.stateNode,g!=null)){var S=r.memoizedProps,C=l!==null?l.memoizedProps:S,I=r.type,N=r.updateQueue;if(r.updateQueue=null,N!==null)try{I==="input"&&S.type==="radio"&&S.name!=null&&$i(g,S),Wf(I,C);var Q=Wf(I,S);for(C=0;C<N.length;C+=2){var oe=N[C],ie=N[C+1];oe==="style"?M0(g,ie):oe==="dangerouslySetInnerHTML"?j0(g,ie):oe==="children"?Li(g,ie):j(g,oe,ie,Q)}switch(I){case"input":Po(g,S);break;case"textarea":Fi(g,S);break;case"select":var ne=g._wrapperState.wasMultiple;g._wrapperState.wasMultiple=!!S.multiple;var fe=S.value;fe!=null?zr(g,!!S.multiple,fe,!1):ne!==!!S.multiple&&(S.defaultValue!=null?zr(g,!!S.multiple,S.defaultValue,!0):zr(g,!!S.multiple,S.multiple?[]:"",!1))}g[sa]=S}catch(me){nt(r,r.return,me)}}break;case 6:if(Qn(o,r),fr(r),c&4){if(r.stateNode===null)throw Error(n(162));g=r.stateNode,S=r.memoizedProps;try{g.nodeValue=S}catch(me){nt(r,r.return,me)}}break;case 3:if(Qn(o,r),fr(r),c&4&&l!==null&&l.memoizedState.isDehydrated)try{Gi(o.containerInfo)}catch(me){nt(r,r.return,me)}break;case 4:Qn(o,r),fr(r);break;case 13:Qn(o,r),fr(r),g=r.child,g.flags&8192&&(S=g.memoizedState!==null,g.stateNode.isHidden=S,!S||g.alternate!==null&&g.alternate.memoizedState!==null||(xh=ut())),c&4&&Qx(r);break;case 22:if(oe=l!==null&&l.memoizedState!==null,r.mode&1?(zt=(Q=zt)||oe,Qn(o,r),zt=Q):Qn(o,r),fr(r),c&8192){if(Q=r.memoizedState!==null,(r.stateNode.isHidden=Q)&&!oe&&(r.mode&1)!==0)for(de=r,oe=r.child;oe!==null;){for(ie=de=oe;de!==null;){switch(ne=de,fe=ne.child,ne.tag){case 0:case 11:case 14:case 15:pa(4,ne,ne.return);break;case 1:Yo(ne,ne.return);var ge=ne.stateNode;if(typeof ge.componentWillUnmount=="function"){c=ne,l=ne.return;try{o=c,ge.props=o.memoizedProps,ge.state=o.memoizedState,ge.componentWillUnmount()}catch(me){nt(c,l,me)}}break;case 5:Yo(ne,ne.return);break;case 22:if(ne.memoizedState!==null){Zx(ie);continue}}fe!==null?(fe.return=ne,de=fe):Zx(ie)}oe=oe.sibling}e:for(oe=null,ie=r;;){if(ie.tag===5){if(oe===null){oe=ie;try{g=ie.stateNode,Q?(S=g.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none"):(I=ie.stateNode,N=ie.memoizedProps.style,C=N!=null&&N.hasOwnProperty("display")?N.display:null,I.style.display=N0("display",C))}catch(me){nt(r,r.return,me)}}}else if(ie.tag===6){if(oe===null)try{ie.stateNode.nodeValue=Q?"":ie.memoizedProps}catch(me){nt(r,r.return,me)}}else if((ie.tag!==22&&ie.tag!==23||ie.memoizedState===null||ie===r)&&ie.child!==null){ie.child.return=ie,ie=ie.child;continue}if(ie===r)break e;for(;ie.sibling===null;){if(ie.return===null||ie.return===r)break e;oe===ie&&(oe=null),ie=ie.return}oe===ie&&(oe=null),ie.sibling.return=ie.return,ie=ie.sibling}}break;case 19:Qn(o,r),fr(r),c&4&&Qx(r);break;case 21:break;default:Qn(o,r),fr(r)}}function fr(r){var o=r.flags;if(o&2){try{e:{for(var l=r.return;l!==null;){if(Wx(l)){var c=l;break e}l=l.return}throw Error(n(160))}switch(c.tag){case 5:var g=c.stateNode;c.flags&32&&(Li(g,""),c.flags&=-33);var S=Gx(r);ph(r,S,g);break;case 3:case 4:var C=c.stateNode.containerInfo,I=Gx(r);gh(r,I,C);break;default:throw Error(n(161))}}catch(N){nt(r,r.return,N)}r.flags&=-3}o&4096&&(r.flags&=-4097)}function jE(r,o,l){de=r,Yx(r)}function Yx(r,o,l){for(var c=(r.mode&1)!==0;de!==null;){var g=de,S=g.child;if(g.tag===22&&c){var C=g.memoizedState!==null||Iu;if(!C){var I=g.alternate,N=I!==null&&I.memoizedState!==null||zt;I=Iu;var Q=zt;if(Iu=C,(zt=N)&&!Q)for(de=g;de!==null;)C=de,N=C.child,C.tag===22&&C.memoizedState!==null?ev(g):N!==null?(N.return=C,de=N):ev(g);for(;S!==null;)de=S,Yx(S),S=S.sibling;de=g,Iu=I,zt=Q}Xx(r)}else(g.subtreeFlags&8772)!==0&&S!==null?(S.return=g,de=S):Xx(r)}}function Xx(r){for(;de!==null;){var o=de;if((o.flags&8772)!==0){var l=o.alternate;try{if((o.flags&8772)!==0)switch(o.tag){case 0:case 11:case 15:zt||ju(5,o);break;case 1:var c=o.stateNode;if(o.flags&4&&!zt)if(l===null)c.componentDidMount();else{var g=o.elementType===o.type?l.memoizedProps:Gn(o.type,l.memoizedProps);c.componentDidUpdate(g,l.memoizedState,c.__reactInternalSnapshotBeforeUpdate)}var S=o.updateQueue;S!==null&&Zy(o,S,c);break;case 3:var C=o.updateQueue;if(C!==null){if(l=null,o.child!==null)switch(o.child.tag){case 5:l=o.child.stateNode;break;case 1:l=o.child.stateNode}Zy(o,C,l)}break;case 5:var I=o.stateNode;if(l===null&&o.flags&4){l=I;var N=o.memoizedProps;switch(o.type){case"button":case"input":case"select":case"textarea":N.autoFocus&&l.focus();break;case"img":N.src&&(l.src=N.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(o.memoizedState===null){var Q=o.alternate;if(Q!==null){var oe=Q.memoizedState;if(oe!==null){var ie=oe.dehydrated;ie!==null&&Gi(ie)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}zt||o.flags&512&&hh(o)}catch(ne){nt(o,o.return,ne)}}if(o===r){de=null;break}if(l=o.sibling,l!==null){l.return=o.return,de=l;break}de=o.return}}function Zx(r){for(;de!==null;){var o=de;if(o===r){de=null;break}var l=o.sibling;if(l!==null){l.return=o.return,de=l;break}de=o.return}}function ev(r){for(;de!==null;){var o=de;try{switch(o.tag){case 0:case 11:case 15:var l=o.return;try{ju(4,o)}catch(N){nt(o,l,N)}break;case 1:var c=o.stateNode;if(typeof c.componentDidMount=="function"){var g=o.return;try{c.componentDidMount()}catch(N){nt(o,g,N)}}var S=o.return;try{hh(o)}catch(N){nt(o,S,N)}break;case 5:var C=o.return;try{hh(o)}catch(N){nt(o,C,N)}}}catch(N){nt(o,o.return,N)}if(o===r){de=null;break}var I=o.sibling;if(I!==null){I.return=o.return,de=I;break}de=o.return}}var NE=Math.ceil,Nu=E.ReactCurrentDispatcher,mh=E.ReactCurrentOwner,Mn=E.ReactCurrentBatchConfig,Te=0,kt=null,ht=null,$t=0,yn=0,Xo=Kr(0),mt=0,ma=null,Vs=0,Mu=0,yh=0,ya=null,nn=null,xh=0,Zo=1/0,Ir=null,Tu=!1,vh=null,es=null,$u=!1,ts=null,Fu=0,xa=0,Sh=null,Lu=-1,Ou=0;function Kt(){return(Te&6)!==0?ut():Lu!==-1?Lu:Lu=ut()}function ns(r){return(r.mode&1)===0?1:(Te&2)!==0&&$t!==0?$t&-$t:gE.transition!==null?(Ou===0&&(Ou=G0()),Ou):(r=Ae,r!==0||(r=window.event,r=r===void 0?16:ny(r.type)),r)}function Jn(r,o,l,c){if(50<xa)throw xa=0,Sh=null,Error(n(185));Vi(r,l,c),((Te&2)===0||r!==kt)&&(r===kt&&((Te&2)===0&&(Mu|=l),mt===4&&rs(r,$t)),rn(r,c),l===1&&Te===0&&(o.mode&1)===0&&(Zo=ut()+500,fu&&Jr()))}function rn(r,o){var l=r.callbackNode;gR(r,o);var c=Wl(r,r===kt?$t:0);if(c===0)l!==null&&q0(l),r.callbackNode=null,r.callbackPriority=0;else if(o=c&-c,r.callbackPriority!==o){if(l!=null&&q0(l),o===1)r.tag===0?hE(nv.bind(null,r)):Uy(nv.bind(null,r)),uE(function(){(Te&6)===0&&Jr()}),l=null;else{switch(K0(c)){case 1:l=Zf;break;case 4:l=H0;break;case 16:l=Vl;break;case 536870912:l=W0;break;default:l=Vl}l=cv(l,tv.bind(null,r))}r.callbackPriority=o,r.callbackNode=l}}function tv(r,o){if(Lu=-1,Ou=0,(Te&6)!==0)throw Error(n(327));var l=r.callbackNode;if(ei()&&r.callbackNode!==l)return null;var c=Wl(r,r===kt?$t:0);if(c===0)return null;if((c&30)!==0||(c&r.expiredLanes)!==0||o)o=Au(r,c);else{o=c;var g=Te;Te|=2;var S=sv();(kt!==r||$t!==o)&&(Ir=null,Zo=ut()+500,qs(r,o));do try{$E();break}catch(I){rv(r,I)}while(!0);Ad(),Nu.current=S,Te=g,ht!==null?o=0:(kt=null,$t=0,o=mt)}if(o!==0){if(o===2&&(g=ed(r),g!==0&&(c=g,o=wh(r,g))),o===1)throw l=ma,qs(r,0),rs(r,c),rn(r,ut()),l;if(o===6)rs(r,c);else{if(g=r.current.alternate,(c&30)===0&&!ME(g)&&(o=Au(r,c),o===2&&(S=ed(r),S!==0&&(c=S,o=wh(r,S))),o===1))throw l=ma,qs(r,0),rs(r,c),rn(r,ut()),l;switch(r.finishedWork=g,r.finishedLanes=c,o){case 0:case 1:throw Error(n(345));case 2:Hs(r,nn,Ir);break;case 3:if(rs(r,c),(c&130023424)===c&&(o=xh+500-ut(),10<o)){if(Wl(r,0)!==0)break;if(g=r.suspendedLanes,(g&c)!==c){Kt(),r.pingedLanes|=r.suspendedLanes&g;break}r.timeoutHandle=Ed(Hs.bind(null,r,nn,Ir),o);break}Hs(r,nn,Ir);break;case 4:if(rs(r,c),(c&4194240)===c)break;for(o=r.eventTimes,g=-1;0<c;){var C=31-qn(c);S=1<<C,C=o[C],C>g&&(g=C),c&=~S}if(c=g,c=ut()-c,c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3e3>c?3e3:4320>c?4320:1960*NE(c/1960))-c,10<c){r.timeoutHandle=Ed(Hs.bind(null,r,nn,Ir),c);break}Hs(r,nn,Ir);break;case 5:Hs(r,nn,Ir);break;default:throw Error(n(329))}}}return rn(r,ut()),r.callbackNode===l?tv.bind(null,r):null}function wh(r,o){var l=ya;return r.current.memoizedState.isDehydrated&&(qs(r,o).flags|=256),r=Au(r,o),r!==2&&(o=nn,nn=l,o!==null&&kh(o)),r}function kh(r){nn===null?nn=r:nn.push.apply(nn,r)}function ME(r){for(var o=r;;){if(o.flags&16384){var l=o.updateQueue;if(l!==null&&(l=l.stores,l!==null))for(var c=0;c<l.length;c++){var g=l[c],S=g.getSnapshot;g=g.value;try{if(!Hn(S(),g))return!1}catch{return!1}}}if(l=o.child,o.subtreeFlags&16384&&l!==null)l.return=o,o=l;else{if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function rs(r,o){for(o&=~yh,o&=~Mu,r.suspendedLanes|=o,r.pingedLanes&=~o,r=r.expirationTimes;0<o;){var l=31-qn(o),c=1<<l;r[l]=-1,o&=~c}}function nv(r){if((Te&6)!==0)throw Error(n(327));ei();var o=Wl(r,0);if((o&1)===0)return rn(r,ut()),null;var l=Au(r,o);if(r.tag!==0&&l===2){var c=ed(r);c!==0&&(o=c,l=wh(r,c))}if(l===1)throw l=ma,qs(r,0),rs(r,o),rn(r,ut()),l;if(l===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=o,Hs(r,nn,Ir),rn(r,ut()),null}function Ch(r,o){var l=Te;Te|=1;try{return r(o)}finally{Te=l,Te===0&&(Zo=ut()+500,fu&&Jr())}}function Bs(r){ts!==null&&ts.tag===0&&(Te&6)===0&&ei();var o=Te;Te|=1;var l=Mn.transition,c=Ae;try{if(Mn.transition=null,Ae=1,r)return r()}finally{Ae=c,Mn.transition=l,Te=o,(Te&6)===0&&Jr()}}function bh(){yn=Xo.current,Ge(Xo)}function qs(r,o){r.finishedWork=null,r.finishedLanes=0;var l=r.timeoutHandle;if(l!==-1&&(r.timeoutHandle=-1,lE(l)),ht!==null)for(l=ht.return;l!==null;){var c=l;switch(Td(c),c.tag){case 1:c=c.type.childContextTypes,c!=null&&uu();break;case 3:Qo(),Ge(Zt),Ge(Ot),Wd();break;case 5:qd(c);break;case 4:Qo();break;case 13:Ge(Ze);break;case 19:Ge(Ze);break;case 10:Dd(c.type._context);break;case 22:case 23:bh()}l=l.return}if(kt=r,ht=r=ss(r.current,null),$t=yn=o,mt=0,ma=null,yh=Mu=Vs=0,nn=ya=null,Ds!==null){for(o=0;o<Ds.length;o++)if(l=Ds[o],c=l.interleaved,c!==null){l.interleaved=null;var g=c.next,S=l.pending;if(S!==null){var C=S.next;S.next=g,c.next=C}l.pending=c}Ds=null}return r}function rv(r,o){do{var l=ht;try{if(Ad(),wu.current=_u,ku){for(var c=et.memoizedState;c!==null;){var g=c.queue;g!==null&&(g.pending=null),c=c.next}ku=!1}if(Us=0,wt=pt=et=null,ca=!1,fa=0,mh.current=null,l===null||l.return===null){mt=1,ma=o,ht=null;break}e:{var S=r,C=l.return,I=l,N=o;if(o=$t,I.flags|=32768,N!==null&&typeof N=="object"&&typeof N.then=="function"){var Q=N,oe=I,ie=oe.tag;if((oe.mode&1)===0&&(ie===0||ie===11||ie===15)){var ne=oe.alternate;ne?(oe.updateQueue=ne.updateQueue,oe.memoizedState=ne.memoizedState,oe.lanes=ne.lanes):(oe.updateQueue=null,oe.memoizedState=null)}var fe=Px(C);if(fe!==null){fe.flags&=-257,Ix(fe,C,I,S,o),fe.mode&1&&Ex(S,Q,o),o=fe,N=Q;var ge=o.updateQueue;if(ge===null){var me=new Set;me.add(N),o.updateQueue=me}else ge.add(N);break e}else{if((o&1)===0){Ex(S,Q,o),_h();break e}N=Error(n(426))}}else if(Qe&&I.mode&1){var ct=Px(C);if(ct!==null){(ct.flags&65536)===0&&(ct.flags|=256),Ix(ct,C,I,S,o),Ld(Jo(N,I));break e}}S=N=Jo(N,I),mt!==4&&(mt=2),ya===null?ya=[S]:ya.push(S),S=C;do{switch(S.tag){case 3:S.flags|=65536,o&=-o,S.lanes|=o;var B=_x(S,N,o);Xy(S,B);break e;case 1:I=N;var F=S.type,W=S.stateNode;if((S.flags&128)===0&&(typeof F.getDerivedStateFromError=="function"||W!==null&&typeof W.componentDidCatch=="function"&&(es===null||!es.has(W)))){S.flags|=65536,o&=-o,S.lanes|=o;var le=Rx(S,I,o);Xy(S,le);break e}}S=S.return}while(S!==null)}iv(l)}catch(ye){o=ye,ht===l&&l!==null&&(ht=l=l.return);continue}break}while(!0)}function sv(){var r=Nu.current;return Nu.current=_u,r===null?_u:r}function _h(){(mt===0||mt===3||mt===2)&&(mt=4),kt===null||(Vs&268435455)===0&&(Mu&268435455)===0||rs(kt,$t)}function Au(r,o){var l=Te;Te|=2;var c=sv();(kt!==r||$t!==o)&&(Ir=null,qs(r,o));do try{TE();break}catch(g){rv(r,g)}while(!0);if(Ad(),Te=l,Nu.current=c,ht!==null)throw Error(n(261));return kt=null,$t=0,mt}function TE(){for(;ht!==null;)ov(ht)}function $E(){for(;ht!==null&&!oR();)ov(ht)}function ov(r){var o=uv(r.alternate,r,yn);r.memoizedProps=r.pendingProps,o===null?iv(r):ht=o,mh.current=null}function iv(r){var o=r;do{var l=o.alternate;if(r=o.return,(o.flags&32768)===0){if(l=RE(l,o,yn),l!==null){ht=l;return}}else{if(l=EE(l,o),l!==null){l.flags&=32767,ht=l;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{mt=6,ht=null;return}}if(o=o.sibling,o!==null){ht=o;return}ht=o=r}while(o!==null);mt===0&&(mt=5)}function Hs(r,o,l){var c=Ae,g=Mn.transition;try{Mn.transition=null,Ae=1,FE(r,o,l,c)}finally{Mn.transition=g,Ae=c}return null}function FE(r,o,l,c){do ei();while(ts!==null);if((Te&6)!==0)throw Error(n(327));l=r.finishedWork;var g=r.finishedLanes;if(l===null)return null;if(r.finishedWork=null,r.finishedLanes=0,l===r.current)throw Error(n(177));r.callbackNode=null,r.callbackPriority=0;var S=l.lanes|l.childLanes;if(pR(r,S),r===kt&&(ht=kt=null,$t=0),(l.subtreeFlags&2064)===0&&(l.flags&2064)===0||$u||($u=!0,cv(Vl,function(){return ei(),null})),S=(l.flags&15990)!==0,(l.subtreeFlags&15990)!==0||S){S=Mn.transition,Mn.transition=null;var C=Ae;Ae=1;var I=Te;Te|=4,mh.current=null,IE(r,l),Jx(l,r),tE(_d),Ql=!!bd,_d=bd=null,r.current=l,jE(l),iR(),Te=I,Ae=C,Mn.transition=S}else r.current=l;if($u&&($u=!1,ts=r,Fu=g),S=r.pendingLanes,S===0&&(es=null),uR(l.stateNode),rn(r,ut()),o!==null)for(c=r.onRecoverableError,l=0;l<o.length;l++)g=o[l],c(g.value,{componentStack:g.stack,digest:g.digest});if(Tu)throw Tu=!1,r=vh,vh=null,r;return(Fu&1)!==0&&r.tag!==0&&ei(),S=r.pendingLanes,(S&1)!==0?r===Sh?xa++:(xa=0,Sh=r):xa=0,Jr(),null}function ei(){if(ts!==null){var r=K0(Fu),o=Mn.transition,l=Ae;try{if(Mn.transition=null,Ae=16>r?16:r,ts===null)var c=!1;else{if(r=ts,ts=null,Fu=0,(Te&6)!==0)throw Error(n(331));var g=Te;for(Te|=4,de=r.current;de!==null;){var S=de,C=S.child;if((de.flags&16)!==0){var I=S.deletions;if(I!==null){for(var N=0;N<I.length;N++){var Q=I[N];for(de=Q;de!==null;){var oe=de;switch(oe.tag){case 0:case 11:case 15:pa(8,oe,S)}var ie=oe.child;if(ie!==null)ie.return=oe,de=ie;else for(;de!==null;){oe=de;var ne=oe.sibling,fe=oe.return;if(Hx(oe),oe===Q){de=null;break}if(ne!==null){ne.return=fe,de=ne;break}de=fe}}}var ge=S.alternate;if(ge!==null){var me=ge.child;if(me!==null){ge.child=null;do{var ct=me.sibling;me.sibling=null,me=ct}while(me!==null)}}de=S}}if((S.subtreeFlags&2064)!==0&&C!==null)C.return=S,de=C;else e:for(;de!==null;){if(S=de,(S.flags&2048)!==0)switch(S.tag){case 0:case 11:case 15:pa(9,S,S.return)}var B=S.sibling;if(B!==null){B.return=S.return,de=B;break e}de=S.return}}var F=r.current;for(de=F;de!==null;){C=de;var W=C.child;if((C.subtreeFlags&2064)!==0&&W!==null)W.return=C,de=W;else e:for(C=F;de!==null;){if(I=de,(I.flags&2048)!==0)try{switch(I.tag){case 0:case 11:case 15:ju(9,I)}}catch(ye){nt(I,I.return,ye)}if(I===C){de=null;break e}var le=I.sibling;if(le!==null){le.return=I.return,de=le;break e}de=I.return}}if(Te=g,Jr(),ar&&typeof ar.onPostCommitFiberRoot=="function")try{ar.onPostCommitFiberRoot(Bl,r)}catch{}c=!0}return c}finally{Ae=l,Mn.transition=o}}return!1}function av(r,o,l){o=Jo(l,o),o=_x(r,o,1),r=Xr(r,o,1),o=Kt(),r!==null&&(Vi(r,1,o),rn(r,o))}function nt(r,o,l){if(r.tag===3)av(r,r,l);else for(;o!==null;){if(o.tag===3){av(o,r,l);break}else if(o.tag===1){var c=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(es===null||!es.has(c))){r=Jo(l,r),r=Rx(o,r,1),o=Xr(o,r,1),r=Kt(),o!==null&&(Vi(o,1,r),rn(o,r));break}}o=o.return}}function LE(r,o,l){var c=r.pingCache;c!==null&&c.delete(o),o=Kt(),r.pingedLanes|=r.suspendedLanes&l,kt===r&&($t&l)===l&&(mt===4||mt===3&&($t&130023424)===$t&&500>ut()-xh?qs(r,0):yh|=l),rn(r,o)}function lv(r,o){o===0&&((r.mode&1)===0?o=1:(o=Hl,Hl<<=1,(Hl&130023424)===0&&(Hl=4194304)));var l=Kt();r=Rr(r,o),r!==null&&(Vi(r,o,l),rn(r,l))}function OE(r){var o=r.memoizedState,l=0;o!==null&&(l=o.retryLane),lv(r,l)}function AE(r,o){var l=0;switch(r.tag){case 13:var c=r.stateNode,g=r.memoizedState;g!==null&&(l=g.retryLane);break;case 19:c=r.stateNode;break;default:throw Error(n(314))}c!==null&&c.delete(o),lv(r,l)}var uv;uv=function(r,o,l){if(r!==null)if(r.memoizedProps!==o.pendingProps||Zt.current)tn=!0;else{if((r.lanes&l)===0&&(o.flags&128)===0)return tn=!1,_E(r,o,l);tn=(r.flags&131072)!==0}else tn=!1,Qe&&(o.flags&1048576)!==0&&Vy(o,hu,o.index);switch(o.lanes=0,o.tag){case 2:var c=o.type;Pu(r,o),r=o.pendingProps;var g=Vo(o,Ot.current);Ko(o,l),g=Qd(null,o,c,r,g,l);var S=Jd();return o.flags|=1,typeof g=="object"&&g!==null&&typeof g.render=="function"&&g.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,en(c)?(S=!0,cu(o)):S=!1,o.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,Vd(o),g.updater=Ru,o.stateNode=g,g._reactInternals=o,nh(o,c,r,l),o=ih(null,o,c,!0,S,l)):(o.tag=0,Qe&&S&&Md(o),Gt(null,o,g,l),o=o.child),o;case 16:c=o.elementType;e:{switch(Pu(r,o),r=o.pendingProps,g=c._init,c=g(c._payload),o.type=c,g=o.tag=zE(c),r=Gn(c,r),g){case 0:o=oh(null,o,c,r,l);break e;case 1:o=Fx(null,o,c,r,l);break e;case 11:o=jx(null,o,c,r,l);break e;case 14:o=Nx(null,o,c,Gn(c.type,r),l);break e}throw Error(n(306,c,""))}return o;case 0:return c=o.type,g=o.pendingProps,g=o.elementType===c?g:Gn(c,g),oh(r,o,c,g,l);case 1:return c=o.type,g=o.pendingProps,g=o.elementType===c?g:Gn(c,g),Fx(r,o,c,g,l);case 3:e:{if(Lx(o),r===null)throw Error(n(387));c=o.pendingProps,S=o.memoizedState,g=S.element,Yy(r,o),vu(o,c,null,l);var C=o.memoizedState;if(c=C.element,S.isDehydrated)if(S={element:c,isDehydrated:!1,cache:C.cache,pendingSuspenseBoundaries:C.pendingSuspenseBoundaries,transitions:C.transitions},o.updateQueue.baseState=S,o.memoizedState=S,o.flags&256){g=Jo(Error(n(423)),o),o=Ox(r,o,c,l,g);break e}else if(c!==g){g=Jo(Error(n(424)),o),o=Ox(r,o,c,l,g);break e}else for(mn=Gr(o.stateNode.containerInfo.firstChild),pn=o,Qe=!0,Wn=null,l=Qy(o,null,c,l),o.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(Ho(),c===g){o=Pr(r,o,l);break e}Gt(r,o,c,l)}o=o.child}return o;case 5:return ex(o),r===null&&Fd(o),c=o.type,g=o.pendingProps,S=r!==null?r.memoizedProps:null,C=g.children,Rd(c,g)?C=null:S!==null&&Rd(c,S)&&(o.flags|=32),$x(r,o),Gt(r,o,C,l),o.child;case 6:return r===null&&Fd(o),null;case 13:return Ax(r,o,l);case 4:return Bd(o,o.stateNode.containerInfo),c=o.pendingProps,r===null?o.child=Wo(o,null,c,l):Gt(r,o,c,l),o.child;case 11:return c=o.type,g=o.pendingProps,g=o.elementType===c?g:Gn(c,g),jx(r,o,c,g,l);case 7:return Gt(r,o,o.pendingProps,l),o.child;case 8:return Gt(r,o,o.pendingProps.children,l),o.child;case 12:return Gt(r,o,o.pendingProps.children,l),o.child;case 10:e:{if(c=o.type._context,g=o.pendingProps,S=o.memoizedProps,C=g.value,qe(mu,c._currentValue),c._currentValue=C,S!==null)if(Hn(S.value,C)){if(S.children===g.children&&!Zt.current){o=Pr(r,o,l);break e}}else for(S=o.child,S!==null&&(S.return=o);S!==null;){var I=S.dependencies;if(I!==null){C=S.child;for(var N=I.firstContext;N!==null;){if(N.context===c){if(S.tag===1){N=Er(-1,l&-l),N.tag=2;var Q=S.updateQueue;if(Q!==null){Q=Q.shared;var oe=Q.pending;oe===null?N.next=N:(N.next=oe.next,oe.next=N),Q.pending=N}}S.lanes|=l,N=S.alternate,N!==null&&(N.lanes|=l),zd(S.return,l,o),I.lanes|=l;break}N=N.next}}else if(S.tag===10)C=S.type===o.type?null:S.child;else if(S.tag===18){if(C=S.return,C===null)throw Error(n(341));C.lanes|=l,I=C.alternate,I!==null&&(I.lanes|=l),zd(C,l,o),C=S.sibling}else C=S.child;if(C!==null)C.return=S;else for(C=S;C!==null;){if(C===o){C=null;break}if(S=C.sibling,S!==null){S.return=C.return,C=S;break}C=C.return}S=C}Gt(r,o,g.children,l),o=o.child}return o;case 9:return g=o.type,c=o.pendingProps.children,Ko(o,l),g=jn(g),c=c(g),o.flags|=1,Gt(r,o,c,l),o.child;case 14:return c=o.type,g=Gn(c,o.pendingProps),g=Gn(c.type,g),Nx(r,o,c,g,l);case 15:return Mx(r,o,o.type,o.pendingProps,l);case 17:return c=o.type,g=o.pendingProps,g=o.elementType===c?g:Gn(c,g),Pu(r,o),o.tag=1,en(c)?(r=!0,cu(o)):r=!1,Ko(o,l),Cx(o,c,g),nh(o,c,g,l),ih(null,o,c,!0,r,l);case 19:return zx(r,o,l);case 22:return Tx(r,o,l)}throw Error(n(156,o.tag))};function cv(r,o){return B0(r,o)}function DE(r,o,l,c){this.tag=r,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Tn(r,o,l,c){return new DE(r,o,l,c)}function Rh(r){return r=r.prototype,!(!r||!r.isReactComponent)}function zE(r){if(typeof r=="function")return Rh(r)?1:0;if(r!=null){if(r=r.$$typeof,r===ae)return 11;if(r===X)return 14}return 2}function ss(r,o){var l=r.alternate;return l===null?(l=Tn(r.tag,o,r.key,r.mode),l.elementType=r.elementType,l.type=r.type,l.stateNode=r.stateNode,l.alternate=r,r.alternate=l):(l.pendingProps=o,l.type=r.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=r.flags&14680064,l.childLanes=r.childLanes,l.lanes=r.lanes,l.child=r.child,l.memoizedProps=r.memoizedProps,l.memoizedState=r.memoizedState,l.updateQueue=r.updateQueue,o=r.dependencies,l.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},l.sibling=r.sibling,l.index=r.index,l.ref=r.ref,l}function Du(r,o,l,c,g,S){var C=2;if(c=r,typeof r=="function")Rh(r)&&(C=1);else if(typeof r=="string")C=5;else e:switch(r){case L:return Ws(l.children,g,S,o);case U:C=8,g|=8;break;case z:return r=Tn(12,l,o,g|2),r.elementType=z,r.lanes=S,r;case P:return r=Tn(13,l,o,g),r.elementType=P,r.lanes=S,r;case H:return r=Tn(19,l,o,g),r.elementType=H,r.lanes=S,r;case q:return zu(l,g,S,o);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case Z:C=10;break e;case te:C=9;break e;case ae:C=11;break e;case X:C=14;break e;case K:C=16,c=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return o=Tn(C,l,o,g),o.elementType=r,o.type=c,o.lanes=S,o}function Ws(r,o,l,c){return r=Tn(7,r,c,o),r.lanes=l,r}function zu(r,o,l,c){return r=Tn(22,r,c,o),r.elementType=q,r.lanes=l,r.stateNode={isHidden:!1},r}function Eh(r,o,l){return r=Tn(6,r,null,o),r.lanes=l,r}function Ph(r,o,l){return o=Tn(4,r.children!==null?r.children:[],r.key,o),o.lanes=l,o.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},o}function UE(r,o,l,c,g){this.tag=o,this.containerInfo=r,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=td(0),this.expirationTimes=td(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=td(0),this.identifierPrefix=c,this.onRecoverableError=g,this.mutableSourceEagerHydrationData=null}function Ih(r,o,l,c,g,S,C,I,N){return r=new UE(r,o,l,I,N),o===1?(o=1,S===!0&&(o|=8)):o=0,S=Tn(3,null,null,o),r.current=S,S.stateNode=r,S.memoizedState={element:c,isDehydrated:l,cache:null,transitions:null,pendingSuspenseBoundaries:null},Vd(S),r}function VE(r,o,l){var c=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:$,key:c==null?null:""+c,children:r,containerInfo:o,implementation:l}}function fv(r){if(!r)return Qr;r=r._reactInternals;e:{if($s(r)!==r||r.tag!==1)throw Error(n(170));var o=r;do{switch(o.tag){case 3:o=o.stateNode.context;break e;case 1:if(en(o.type)){o=o.stateNode.__reactInternalMemoizedMergedChildContext;break e}}o=o.return}while(o!==null);throw Error(n(171))}if(r.tag===1){var l=r.type;if(en(l))return Dy(r,l,o)}return o}function dv(r,o,l,c,g,S,C,I,N){return r=Ih(l,c,!0,r,g,S,C,I,N),r.context=fv(null),l=r.current,c=Kt(),g=ns(l),S=Er(c,g),S.callback=o??null,Xr(l,S,g),r.current.lanes=g,Vi(r,g,c),rn(r,c),r}function Uu(r,o,l,c){var g=o.current,S=Kt(),C=ns(g);return l=fv(l),o.context===null?o.context=l:o.pendingContext=l,o=Er(S,C),o.payload={element:r},c=c===void 0?null:c,c!==null&&(o.callback=c),r=Xr(g,o,C),r!==null&&(Jn(r,g,C,S),xu(r,g,C)),C}function Vu(r){if(r=r.current,!r.child)return null;switch(r.child.tag){case 5:return r.child.stateNode;default:return r.child.stateNode}}function hv(r,o){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var l=r.retryLane;r.retryLane=l!==0&&l<o?l:o}}function jh(r,o){hv(r,o),(r=r.alternate)&&hv(r,o)}function BE(){return null}var gv=typeof reportError=="function"?reportError:function(r){console.error(r)};function Nh(r){this._internalRoot=r}Bu.prototype.render=Nh.prototype.render=function(r){var o=this._internalRoot;if(o===null)throw Error(n(409));Uu(r,o,null,null)},Bu.prototype.unmount=Nh.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var o=r.containerInfo;Bs(function(){Uu(null,r,null,null)}),o[kr]=null}};function Bu(r){this._internalRoot=r}Bu.prototype.unstable_scheduleHydration=function(r){if(r){var o=Y0();r={blockedOn:null,target:r,priority:o};for(var l=0;l<qr.length&&o!==0&&o<qr[l].priority;l++);qr.splice(l,0,r),l===0&&ey(r)}};function Mh(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function qu(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function pv(){}function qE(r,o,l,c,g){if(g){if(typeof c=="function"){var S=c;c=function(){var Q=Vu(C);S.call(Q)}}var C=dv(o,c,r,0,null,!1,!1,"",pv);return r._reactRootContainer=C,r[kr]=C.current,na(r.nodeType===8?r.parentNode:r),Bs(),C}for(;g=r.lastChild;)r.removeChild(g);if(typeof c=="function"){var I=c;c=function(){var Q=Vu(N);I.call(Q)}}var N=Ih(r,0,!1,null,null,!1,!1,"",pv);return r._reactRootContainer=N,r[kr]=N.current,na(r.nodeType===8?r.parentNode:r),Bs(function(){Uu(o,N,l,c)}),N}function Hu(r,o,l,c,g){var S=l._reactRootContainer;if(S){var C=S;if(typeof g=="function"){var I=g;g=function(){var N=Vu(C);I.call(N)}}Uu(o,C,r,g)}else C=qE(l,o,r,g,c);return Vu(C)}Q0=function(r){switch(r.tag){case 3:var o=r.stateNode;if(o.current.memoizedState.isDehydrated){var l=Ui(o.pendingLanes);l!==0&&(nd(o,l|1),rn(o,ut()),(Te&6)===0&&(Zo=ut()+500,Jr()))}break;case 13:Bs(function(){var c=Rr(r,1);if(c!==null){var g=Kt();Jn(c,r,1,g)}}),jh(r,1)}},rd=function(r){if(r.tag===13){var o=Rr(r,134217728);if(o!==null){var l=Kt();Jn(o,r,134217728,l)}jh(r,134217728)}},J0=function(r){if(r.tag===13){var o=ns(r),l=Rr(r,o);if(l!==null){var c=Kt();Jn(l,r,o,c)}jh(r,o)}},Y0=function(){return Ae},X0=function(r,o){var l=Ae;try{return Ae=r,o()}finally{Ae=l}},Qf=function(r,o,l){switch(o){case"input":if(Po(r,l),o=l.name,l.type==="radio"&&o!=null){for(l=r;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),o=0;o<l.length;o++){var c=l[o];if(c!==r&&c.form===r.form){var g=lu(c);if(!g)throw Error(n(90));Ns(c),Po(c,g)}}}break;case"textarea":Fi(r,l);break;case"select":o=l.value,o!=null&&zr(r,!!l.multiple,o,!1)}},L0=Ch,O0=Bs;var HE={usingClientEntryPoint:!1,Events:[oa,zo,lu,$0,F0,Ch]},va={findFiberByHostInstance:Fs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},WE={bundleType:va.bundleType,version:va.version,rendererPackageName:va.rendererPackageName,rendererConfig:va.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:E.ReactCurrentDispatcher,findHostInstanceByFiber:function(r){return r=U0(r),r===null?null:r.stateNode},findFiberByHostInstance:va.findFiberByHostInstance||BE,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Wu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Wu.isDisabled&&Wu.supportsFiber)try{Bl=Wu.inject(WE),ar=Wu}catch{}}return sn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=HE,sn.createPortal=function(r,o){var l=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Mh(o))throw Error(n(200));return VE(r,o,null,l)},sn.createRoot=function(r,o){if(!Mh(r))throw Error(n(299));var l=!1,c="",g=gv;return o!=null&&(o.unstable_strictMode===!0&&(l=!0),o.identifierPrefix!==void 0&&(c=o.identifierPrefix),o.onRecoverableError!==void 0&&(g=o.onRecoverableError)),o=Ih(r,1,!1,null,null,l,!1,c,g),r[kr]=o.current,na(r.nodeType===8?r.parentNode:r),new Nh(o)},sn.findDOMNode=function(r){if(r==null)return null;if(r.nodeType===1)return r;var o=r._reactInternals;if(o===void 0)throw typeof r.render=="function"?Error(n(188)):(r=Object.keys(r).join(","),Error(n(268,r)));return r=U0(o),r=r===null?null:r.stateNode,r},sn.flushSync=function(r){return Bs(r)},sn.hydrate=function(r,o,l){if(!qu(o))throw Error(n(200));return Hu(null,r,o,!0,l)},sn.hydrateRoot=function(r,o,l){if(!Mh(r))throw Error(n(405));var c=l!=null&&l.hydratedSources||null,g=!1,S="",C=gv;if(l!=null&&(l.unstable_strictMode===!0&&(g=!0),l.identifierPrefix!==void 0&&(S=l.identifierPrefix),l.onRecoverableError!==void 0&&(C=l.onRecoverableError)),o=dv(o,null,r,1,l??null,g,!1,S,C),r[kr]=o.current,na(r),c)for(r=0;r<c.length;r++)l=c[r],g=l._getVersion,g=g(l._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[l,g]:o.mutableSourceEagerHydrationData.push(l,g);return new Bu(o)},sn.render=function(r,o,l){if(!qu(o))throw Error(n(200));return Hu(null,r,o,!1,l)},sn.unmountComponentAtNode=function(r){if(!qu(r))throw Error(n(40));return r._reactRootContainer?(Bs(function(){Hu(null,null,r,!1,function(){r._reactRootContainer=null,r[kr]=null})}),!0):!1},sn.unstable_batchedUpdates=Ch,sn.unstable_renderSubtreeIntoContainer=function(r,o,l,c){if(!qu(l))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return Hu(r,o,l,!1,c)},sn.version="18.3.1-next-f1338f8080-20240426",sn}var Cv;function h1(){if(Cv)return Fh.exports;Cv=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Fh.exports=nP(),Fh.exports}var bv;function rP(){if(bv)return Gu;bv=1;var e=h1();return Gu.createRoot=e.createRoot,Gu.hydrateRoot=e.hydrateRoot,Gu}var sP=rP(),oP={};const Up=lP();function Ye(e,...t){if(!Up)return;const n=aP(e,...t);performance.mark(n);try{console.log(e,...t)}catch{console.log(n)}}function iP(e,...t){Up&&console.warn(e,...t)}function aP(e,...t){return e.replace(/%[sfdO]/g,n=>{const s=t.shift();return n==="%O"&&s?JSON.stringify(s).replace(/"([^"]+)":/g,"$1:"):String(s)})}function lP(){if(typeof window>"u")return(oP.DEBUG||"").includes("nuqs");try{const e="nuqs-localStorage-test";if(typeof localStorage>"u")return!1;localStorage.setItem(e,e);const t=localStorage.getItem(e)===e;return localStorage.removeItem(e),t&&(localStorage.getItem("debug")||"").includes("nuqs")}catch{return!1}}const uP={303:"Multiple adapter contexts detected. This might happen in monorepos.",404:"nuqs requires an adapter to work with your framework.",409:"Multiple versions of the library are loaded. This may lead to unexpected behavior. Currently using `%s`, but `%s` (via the %s adapter) was about to load on top.",414:"Max safe URL length exceeded. Some browsers may not be able to accept this URL. Consider limiting the amount of state stored in the URL.",422:"Invalid options combination: `limitUrlUpdates: debounce` should be used in SSR scenarios, with `shallow: false`",429:"URL update rate-limited by the browser. Consider increasing `throttleMs` for key(s) `%s`. %O",500:"Empty search params cache. Search params can't be accessed in Layouts.",501:"Search params cache already populated. Have you called `parse` twice?"};function xl(e){return`[nuqs] ${uP[e]}
|
|
42
|
-
See https://nuqs.dev/NUQS-${e}`}function cP(e){if(e.size===0)return"";const t=[];for(const[s,i]of e.entries()){const a=s.replace(/#/g,"%23").replace(/&/g,"%26").replace(/\+/g,"%2B").replace(/=/g,"%3D").replace(/\?/g,"%3F");t.push(`${a}=${fP(i)}`)}return"?"+t.join("&")}function fP(e){return e.replace(/%/g,"%25").replace(/\+/g,"%2B").replace(/ /g,"+").replace(/#/g,"%23").replace(/&/g,"%26").replace(/"/g,"%22").replace(/'/g,"%27").replace(/`/g,"%60").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/[\x00-\x1F]/g,t=>encodeURIComponent(t))}const fo=V.createContext({useAdapter(){throw new Error(xl(404))}});fo.displayName="NuqsAdapterContext";Up&&typeof window<"u"&&(window.__NuqsAdapterContext&&window.__NuqsAdapterContext!==fo&&console.error(xl(303)),window.__NuqsAdapterContext=fo);function dP(e){return({children:t,defaultOptions:n,processUrlSearchParams:s,...i})=>V.createElement(fo.Provider,{...i,value:{useAdapter:e,defaultOptions:n,processUrlSearchParams:s}},t)}function hP(e){const t=V.useContext(fo);if(!("useAdapter"in t))throw new Error(xl(404));return t.useAdapter(e)}const gP=()=>V.useContext(fo).defaultOptions,pP=()=>V.useContext(fo).processUrlSearchParams;function mP(){var e;if(typeof window>"u"||!window.GestureEvent)return 50;try{const t=(e=navigator.userAgent)==null?void 0:e.match(/version\/([\d\.]+) safari/i);return parseFloat(t[1])>=17?120:320}catch{return 320}}function yP(e){return{method:"throttle",timeMs:e}}const Aa=yP(mP());function xP(e){return e===null||Array.isArray(e)&&e.length===0}function vP(e,t,n){if(typeof e=="string")n.set(t,e);else{n.delete(t);for(const s of e)n.append(t,s);n.has(t)||n.set(t,"")}return n}function Vp(){const e=new Map;return{on(t,n){const s=e.get(t)||[];return s.push(n),e.set(t,s),()=>this.off(t,n)},off(t,n){const s=e.get(t);s&&e.set(t,s.filter(i=>i!==n))},emit(t,n){var s;(s=e.get(t))==null||s.forEach(i=>i(n))}}}function Fg(e,t,n){function s(){e(),n.removeEventListener("abort",a)}const i=setTimeout(s,t);function a(){clearTimeout(i),n.removeEventListener("abort",a)}n.addEventListener("abort",a)}function Lg(){const e=Promise;if(Promise.hasOwnProperty("withResolvers"))return Promise.withResolvers();let t=()=>{},n=()=>{};return{promise:new e((s,i)=>{t=s,n=i}),resolve:t,reject:n}}function SP(e,t){let n=t;for(let s=e.length-1;s>=0;s--){const i=e[s];if(!i)continue;const a=n;n=()=>i(a)}n()}function Og(){return new URLSearchParams(location.search)}var g1=class{constructor(){O(this,"updateMap",new Map);O(this,"options",{history:"replace",scroll:!1,shallow:!0});O(this,"timeMs",Aa.timeMs);O(this,"transitions",new Set);O(this,"resolvers",null);O(this,"controller",null);O(this,"lastFlushedAt",0);O(this,"resetQueueOnNextPush",!1)}push({key:e,query:t,options:n},s=Aa.timeMs){this.resetQueueOnNextPush&&(this.reset(),this.resetQueueOnNextPush=!1),Ye("[nuqs gtq] Enqueueing %s=%s %O",e,t,n),this.updateMap.set(e,t),n.history==="push"&&(this.options.history="push"),n.scroll&&(this.options.scroll=!0),n.shallow===!1&&(this.options.shallow=!1),n.startTransition&&this.transitions.add(n.startTransition),(!Number.isFinite(this.timeMs)||s>this.timeMs)&&(this.timeMs=s)}getQueuedQuery(e){return this.updateMap.get(e)}getPendingPromise({getSearchParamsSnapshot:e=Og}){var t;return((t=this.resolvers)==null?void 0:t.promise)??Promise.resolve(e())}flush({getSearchParamsSnapshot:e=Og,rateLimitFactor:t=1,...n},s){if(this.controller??(this.controller=new AbortController),!Number.isFinite(this.timeMs))return Ye("[nuqs gtq] Skipping flush due to throttleMs=Infinity"),Promise.resolve(e());if(this.resolvers)return this.resolvers.promise;this.resolvers=Lg();const i=()=>{this.lastFlushedAt=performance.now();const[u,f]=this.applyPendingUpdates({...n,autoResetQueueOnUpdate:n.autoResetQueueOnUpdate??!0,getSearchParamsSnapshot:e},s);f===null?(this.resolvers.resolve(u),this.resetQueueOnNextPush=!0):this.resolvers.reject(u),this.resolvers=null};return Fg(()=>{const u=performance.now()-this.lastFlushedAt,f=this.timeMs,d=t*Math.max(0,f-u);Ye("[nuqs gtq] Scheduling flush in %f ms. Throttled at %f ms (x%f)",d,f,t),d===0?i():Fg(i,d,this.controller.signal)},0,this.controller.signal),this.resolvers.promise}abort(){var e,t;return(e=this.controller)==null||e.abort(),this.controller=new AbortController,(t=this.resolvers)==null||t.resolve(new URLSearchParams),this.resolvers=null,this.reset()}reset(){const e=Array.from(this.updateMap.keys());return Ye("[nuqs gtq] Resetting queue %s",JSON.stringify(Object.fromEntries(this.updateMap))),this.updateMap.clear(),this.transitions.clear(),this.options={history:"replace",scroll:!1,shallow:!0},this.timeMs=Aa.timeMs,e}applyPendingUpdates(e,t){const{updateUrl:n,getSearchParamsSnapshot:s}=e;let i=s();if(Ye("[nuqs gtq] Applying %d pending update(s) on top of %s",this.updateMap.size,i.toString()),this.updateMap.size===0)return[i,null];const a=Array.from(this.updateMap.entries()),u={...this.options},f=Array.from(this.transitions);e.autoResetQueueOnUpdate&&this.reset(),Ye("[nuqs gtq] Flushing queue %O with options %O",a,u);for(const[d,h]of a)h===null?i.delete(d):i=vP(h,d,i);t&&(i=t(i));try{return SP(f,()=>{n(i,u)}),[i,null]}catch(d){return console.error(xl(429),a.map(([h])=>h).join(),d),[i,d]}}};const fc=new g1;function wP(e,t,n){const s=V.useCallback(()=>{const a=Object.fromEntries(e.map(u=>[u,n(u)]));return[JSON.stringify(a),a]},[e.join(","),n]),i=V.useRef(null);return i.current===null&&(i.current=s()),V.useSyncExternalStore(V.useCallback(a=>{const u=e.map(f=>t(f,a));return()=>u.forEach(f=>f())},[e.join(","),t]),()=>{const[a,u]=s();return i.current[0]===a?i.current[1]:(i.current=[a,u],u)},()=>i.current[1])}var kP=class{constructor(e){O(this,"callback");O(this,"resolvers",Lg());O(this,"controller",new AbortController);O(this,"queuedValue");this.callback=e}abort(){this.controller.abort(),this.queuedValue=void 0}push(e,t){return this.queuedValue=e,this.controller.abort(),this.controller=new AbortController,Fg(()=>{const n=this.resolvers;try{Ye("[nuqs dq] Flushing debounce queue",e);const s=this.callback(e);Ye("[nuqs dq] Reset debounce queue %O",this.queuedValue),this.queuedValue=void 0,this.resolvers=Lg(),s.then(i=>n.resolve(i)).catch(i=>n.reject(i))}catch(s){this.queuedValue=void 0,n.reject(s)}},t,this.controller.signal),this.resolvers.promise}},CP=class{constructor(e=new g1){O(this,"throttleQueue");O(this,"queues",new Map);O(this,"queuedQuerySync",Vp());this.throttleQueue=e}useQueuedQueries(e){return wP(e,(t,n)=>this.queuedQuerySync.on(t,n),t=>this.getQueuedQuery(t))}push(e,t,n,s){if(!Number.isFinite(t)){const u=n.getSearchParamsSnapshot??Og;return Promise.resolve(u())}const i=e.key;if(!this.queues.has(i)){Ye("[nuqs dqc] Creating debounce queue for `%s`",i);const u=new kP(f=>(this.throttleQueue.push(f),this.throttleQueue.flush(n,s).finally(()=>{var d;((d=this.queues.get(f.key))==null?void 0:d.queuedValue)===void 0&&(Ye("[nuqs dqc] Cleaning up empty queue for `%s`",f.key),this.queues.delete(f.key)),this.queuedQuerySync.emit(f.key)})));this.queues.set(i,u)}Ye("[nuqs dqc] Enqueueing debounce update %O",e);const a=this.queues.get(i).push(e,t);return this.queuedQuerySync.emit(i),a}abort(e){var n;const t=this.queues.get(e);return t?(Ye("[nuqs dqc] Aborting debounce queue %s=%s",e,(n=t.queuedValue)==null?void 0:n.query),this.queues.delete(e),t.abort(),this.queuedQuerySync.emit(e),s=>(s.then(t.resolvers.resolve,t.resolvers.reject),s)):s=>s}abortAll(){var e;for(const[t,n]of this.queues.entries())Ye("[nuqs dqc] Aborting debounce queue %s=%s",t,(e=n.queuedValue)==null?void 0:e.query),n.abort(),n.resolvers.resolve(new URLSearchParams),this.queuedQuerySync.emit(t);this.queues.clear()}getQueuedQuery(e){var n,s;const t=(s=(n=this.queues.get(e))==null?void 0:n.queuedValue)==null?void 0:s.query;return t!==void 0?t:this.throttleQueue.getQueuedQuery(e)}};const Ah=new CP(fc);function p1(e,t){return e===t?!0:e===null||t===null||typeof e=="string"||typeof t=="string"||e.length!==t.length?!1:e.every((n,s)=>n===t[s])}function _v(e,t,n){return s=>{if(!(t.length===0||t.some(a=>!p1(s.getAll(a),e.getAll(a)))))return Ye("[nuqs `%s`] no change, returning previous",t.join(","),s),s;const i=m1(e,t,n);return Ye("[nuqs `%s`] subbed search params change\n from %O\n to %O",t.join(","),s,i),i}}function m1(e,t,n){if(t.length===0)return e;const s=n?new URLSearchParams(e):e;for(const i of e.keys())t.includes(i)||s.delete(i);return s}const bP="__nuqs__",Ag=Vp();function _P(e){return function(n,s){const i=new URL(location.href);i.search=cP(n),Ye("[nuqs react] Updating url: %s",i),e&&s.shallow===!1?(s.history==="push"?location.assign:location.replace).call(location,i):(s.history==="push"?history.pushState:history.replaceState).call(history,history.state,bP,i),Ag.emit("update",n),s.scroll===!0&&window.scrollTo({top:0})}}const y1=V.createContext({fullPageNavigationOnShallowFalseUpdates:!1});function RP(e){const{fullPageNavigationOnShallowFalseUpdates:t}=V.useContext(y1),[n,s]=V.useState(()=>typeof location>"u"?new URLSearchParams:m1(new URLSearchParams(location.search),e,!1));return V.useEffect(()=>{const i=()=>{s(_v(new URLSearchParams(location.search),e,!1))},a=u=>{s(_v(u,e,!0))};return Ag.on("update",a),window.addEventListener("popstate",i),()=>{Ag.off("update",a),window.removeEventListener("popstate",i)}},[e.join("&")]),{searchParams:n,updateUrl:V.useMemo(()=>_P(t),[t])}}const EP=dP(RP);function PP({children:e,fullPageNavigationOnShallowFalseUpdates:t=!1,...n}){return V.createElement(y1.Provider,{value:{fullPageNavigationOnShallowFalseUpdates:t}},V.createElement(EP,{...n,children:e}))}var Ma=typeof window<"u"?V.useLayoutEffect:V.useEffect;function Dh(e){const t=V.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function IP(e,t,n={},s={}){V.useEffect(()=>{if(!e.current||s.disabled||typeof IntersectionObserver!="function")return;const i=new IntersectionObserver(([a])=>{t(a)},n);return i.observe(e.current),()=>{i.disconnect()}},[t,n,s.disabled,e])}function jP(e){const t=V.useRef(null);return V.useImperativeHandle(e,()=>t.current,[]),t}const x1=!1;function Ka(e){return e[e.length-1]}function NP(e){return typeof e=="function"}function Xs(e,t){return NP(e)?e(t):e}const v1=Object.prototype.hasOwnProperty,Rv=Object.prototype.propertyIsEnumerable;function S1(e){for(const t in e)if(v1.call(e,t))return!0;return!1}const MP=()=>Object.create(null),Gs=(e,t)=>Zs(e,t,MP);function Zs(e,t,n=()=>({}),s=0){if(e===t)return e;if(s>500)return t;const i=t,a=Iv(e)&&Iv(i);if(!a&&!(_c(e)&&_c(i)))return i;const u=a?e:Ev(e);if(!u)return i;const f=a?i:Ev(i);if(!f)return i;const d=u.length,h=f.length,m=a?new Array(h):n();let p=0;for(let x=0;x<h;x++){const v=a?x:f[x],w=e[v],k=i[v];if(w===k){m[v]=w,(a?x<d:v1.call(e,v))&&p++;continue}if(w===null||k===null||typeof w!="object"||typeof k!="object"){m[v]=k;continue}const b=Zs(w,k,n,s+1);m[v]=b,b===w&&p++}return d===h&&p===d?e:m}function Ev(e){const t=Object.getOwnPropertyNames(e);for(const i of t)if(!Rv.call(e,i))return!1;const n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;const s=t;for(const i of n){if(!Rv.call(e,i))return!1;s.push(i)}return s}function _c(e){if(!Pv(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const n=t.prototype;return!(!Pv(n)||!n.hasOwnProperty("isPrototypeOf"))}function Pv(e){return Object.prototype.toString.call(e)==="[object Object]"}function Iv(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function to(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let s=0,i=e.length;s<i;s++)if(!to(e[s],t[s],n))return!1;return!0}if(_c(e)&&_c(t)){const s=(n==null?void 0:n.ignoreUndefined)??!0;if(n!=null&&n.partial){for(const u in t)if((!s||t[u]!==void 0)&&!to(e[u],t[u],n))return!1;return!0}let i=0;if(!s)i=Object.keys(e).length;else for(const u in e)e[u]!==void 0&&i++;let a=0;for(const u in t)if((!s||t[u]!==void 0)&&(a++,a>i||!to(e[u],t[u],n)))return!1;return i===a}return!1}function mi(e){let t,n;const s=new Promise((i,a)=>{t=i,n=a});return s.status="pending",s.resolve=i=>{s.status="resolved",s.value=i,t(i),e==null||e(i)},s.reject=i=>{s.status="rejected",n(i)},s}function Qa(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}function TP(e){return e.replace(/[\x00-\x1f\x7f]/g,"")}function jv(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,n=>{try{return decodeURI(n)}catch{return n}})}return TP(t)}const $P=["http:","https:","mailto:","tel:"];function Rc(e,t){if(!e)return!1;try{const n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function wa(e){if(!e)return{path:e,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith("//"))return{path:e,handledProtocolRelativeURL:!1};const t=/%25|%5C/gi;let n=0,s="",i;for(;(i=t.exec(e))!==null;)s+=jv(e.slice(n,i.index))+i[0],n=t.lastIndex;s=s+jv(n?e.slice(n):e);let a=!1;return s.startsWith("//")&&(a=!0,s="/"+s.replace(/^\/+/,"")),{path:s,handledProtocolRelativeURL:a}}function FP(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function LP(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Tr(){throw new Error("Invariant failed")}function Ja(e){const t=new Map;let n,s;const i=a=>{a.next&&(a.prev?(a.prev.next=a.next,a.next.prev=a.prev,a.next=void 0,s&&(s.next=a,a.prev=s)):(a.next.prev=void 0,n=a.next,a.next=void 0,s&&(a.prev=s,s.next=a)),s=a)};return{get(a){const u=t.get(a);if(u)return i(u),u.value},set(a,u){if(t.size>=e&&n){const d=n;t.delete(d.key),d.next&&(n=d.next,d.next.prev=void 0),d===s&&(s=void 0)}const f=t.get(a);if(f)f.value=u,i(f);else{const d={key:a,value:u,prev:s};s&&(s.next=d),s=d,n||(n=d),t.set(a,d)}},clear(){t.clear(),n=void 0,s=void 0}}}const cs=4,w1=5;function OP(e){const t=e.indexOf("{");if(t===-1)return null;const n=e.indexOf("}",t);return n===-1||t+1>=e.length?null:[t,n]}function k1(e,t,n=new Uint16Array(6)){const s=e.indexOf("/",t),i=s===-1?e.length:s,a=e.substring(t,i);if(!a||!a.includes("$"))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a==="$"){const f=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=f,n[4]=f,n[5]=f,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;const u=OP(a);if(u){const[f,d]=u,h=a.charCodeAt(f+1);if(h===45){if(f+2<a.length&&a.charCodeAt(f+2)===36){const m=f+3,p=d;if(m<p)return n[0]=3,n[1]=t+f,n[2]=t+m,n[3]=t+p,n[4]=t+d+1,n[5]=i,n}}else if(h===36){const m=f+1,p=f+2;return p===d?(n[0]=2,n[1]=t+f,n[2]=t+m,n[3]=t+p,n[4]=t+d+1,n[5]=e.length,n):(n[0]=1,n[1]=t+f,n[2]=t+p,n[3]=t+d,n[4]=t+d+1,n[5]=i,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}function rf(e,t,n,s,i,a,u){var d,h,m,p,x,v,w,k,b,_;u==null||u(n);let f=s;{const R=n.fullPath??n.from,j=R.length,E=((d=n.options)==null?void 0:d.caseSensitive)??e,T=((m=(h=n.options)==null?void 0:h.params)==null?void 0:m.parse)??((p=n.options)==null?void 0:p.parseParams);for(;f<j;){const L=k1(R,f,t);let U;const z=f,Z=L[5];switch(f=Z+1,a++,L[0]){case 0:{const te=R.substring(L[2],L[3]);if(E){const ae=(x=i.static)==null?void 0:x.get(te);if(ae)U=ae;else{i.static??(i.static=new Map);const P=eo(n.fullPath??n.from);P.parent=i,P.depth=a,U=P,i.static.set(te,P)}}else{const ae=te.toLowerCase(),P=(v=i.staticInsensitive)==null?void 0:v.get(ae);if(P)U=P;else{i.staticInsensitive??(i.staticInsensitive=new Map);const H=eo(n.fullPath??n.from);H.parent=i,H.depth=a,U=H,i.staticInsensitive.set(ae,H)}}break}case 1:{const te=R.substring(z,L[1]),ae=R.substring(L[4],Z),P=E&&!!(te||ae),H=te?P?te:te.toLowerCase():void 0,X=ae?P?ae:ae.toLowerCase():void 0,K=!T&&((w=i.dynamic)==null?void 0:w.find(q=>!q.parse&&q.caseSensitive===P&&q.prefix===H&&q.suffix===X));if(K)U=K;else{const q=Uh(1,n.fullPath??n.from,P,H,X);U=q,q.depth=a,q.parent=i,i.dynamic??(i.dynamic=[]),i.dynamic.push(q)}break}case 3:{const te=R.substring(z,L[1]),ae=R.substring(L[4],Z),P=E&&!!(te||ae),H=te?P?te:te.toLowerCase():void 0,X=ae?P?ae:ae.toLowerCase():void 0,K=!T&&((k=i.optional)==null?void 0:k.find(q=>!q.parse&&q.caseSensitive===P&&q.prefix===H&&q.suffix===X));if(K)U=K;else{const q=Uh(3,n.fullPath??n.from,P,H,X);U=q,q.parent=i,q.depth=a,i.optional??(i.optional=[]),i.optional.push(q)}break}case 2:{const te=R.substring(z,L[1]),ae=R.substring(L[4],Z),P=E&&!!(te||ae),H=te?P?te:te.toLowerCase():void 0,X=ae?P?ae:ae.toLowerCase():void 0,K=Uh(2,n.fullPath??n.from,P,H,X);U=K,K.parent=i,K.depth=a,i.wildcard??(i.wildcard=[]),i.wildcard.push(K)}}i=U}if(T&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf("/")+1)===95){const L=eo(n.fullPath??n.from);L.kind=w1,L.parent=i,a++,L.depth=a,i.pathless??(i.pathless=[]),i.pathless.push(L),i=L}const $=(n.path||!n.children)&&!n.isRoot;if($&&R.endsWith("/")){const L=eo(n.fullPath??n.from);L.kind=cs,L.parent=i,a++,L.depth=a,i.index=L,i=L}i.parse=T??null,i.priority=((_=(b=n.options)==null?void 0:b.params)==null?void 0:_.priority)??0,$&&!i.route&&(i.route=n,i.fullPath=n.fullPath??n.from)}if(n.children)for(const R of n.children)rf(e,t,R,f,i,a,u)}function zh(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 ls(e){var t,n,s;if(e.pathless)for(const i of e.pathless)ls(i);if(e.static)for(const i of e.static.values())ls(i);if(e.staticInsensitive)for(const i of e.staticInsensitive.values())ls(i);if((t=e.dynamic)!=null&&t.length){e.dynamic.sort(zh);for(const i of e.dynamic)ls(i)}if((n=e.optional)!=null&&n.length){e.optional.sort(zh);for(const i of e.optional)ls(i)}if((s=e.wildcard)!=null&&s.length){e.wildcard.sort(zh);for(const i of e.wildcard)ls(i)}}function eo(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 Uh(e,t,n,s,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:s,suffix:i}}function AP(e,t){const n=eo("/"),s=new Uint16Array(6);for(const i of e)rf(!1,s,i,1,n,0);ls(n),t.masksTree=n,t.flatCache=Ja(1e3)}function DP(e,t){e||(e="/");const n=t.flatCache.get(e);if(n)return n;const s=Bp(e,t.masksTree);return t.flatCache.set(e,s),s}function zP(e,t,n,s,i){e||(e="/"),s||(s="/");const a=t?`case\0${e}`:e;let u=i.singleCache.get(a);return u||(u=eo("/"),rf(t,new Uint16Array(6),{from:e},1,u,0),i.singleCache.set(a,u)),Bp(s,u,n)}function UP(e,t,n=!1){const s=n?e:`nofuzz\0${e}`,i=t.matchCache.get(s);if(i!==void 0)return i;e||(e="/");let a;try{a=Bp(e,t.segmentTree,n)}catch(u){if(u instanceof URIError)a=null;else throw u}return a&&(a.branch=b1(a.route)),t.matchCache.set(s,a),a}function VP(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function BP(e,t=!1,n){const s=eo(e.fullPath),i=new Uint16Array(6),a={},u={};let f=0;return rf(t,i,e,1,s,0,d=>{if(n==null||n(d,f),d.id in a&&Tr(),a[d.id]=d,f!==0&&d.path){const h=VP(d.fullPath);(!u[h]||d.fullPath.endsWith("/"))&&(u[h]=d)}f++}),ls(s),{processedTree:{segmentTree:s,singleCache:Ja(1e3),matchCache:Ja(1e3),flatCache:null,masksTree:null},routesById:a,routesByPath:u}}function Bp(e,t,n=!1){const s=e.split("/"),i=HP(e,s,t,n);if(!i)return null;const[a]=C1(e,s,i);return{route:i.node.route,rawParams:a}}function C1(e,t,n){var m,p,x,v,w,k,b,_,R,j;const s=qP(n.node);let i=null;const a=Object.create(null);let u=((m=n.extract)==null?void 0:m.part)??0,f=((p=n.extract)==null?void 0:p.node)??0,d=((x=n.extract)==null?void 0:x.path)??0,h=((v=n.extract)==null?void 0:v.segment)??0;for(;f<s.length;u++,f++,d++,h++){const E=s[f];if(E.kind===cs)break;if(E.kind===w1){h--,u--,d--;continue}const T=t[u],$=d;if(T&&(d+=T.length),E.kind===1){i??(i=n.node.fullPath.split("/"));const L=i[h],U=((w=E.prefix)==null?void 0:w.length)??0;if(L.charCodeAt(U)===123){const z=((k=E.suffix)==null?void 0:k.length)??0,Z=L.substring(U+2,L.length-z-1),te=T.substring(U,T.length-z);a[Z]=decodeURIComponent(te)}else{const z=L.substring(1);a[z]=decodeURIComponent(T)}}else if(E.kind===3){if(n.skipped&1<<f){u--,d=$-1;continue}i??(i=n.node.fullPath.split("/"));const L=i[h],U=((b=E.prefix)==null?void 0:b.length)??0,z=((_=E.suffix)==null?void 0:_.length)??0,Z=L.substring(U+3,L.length-z-1),te=E.suffix||E.prefix?T.substring(U,T.length-z):T;te&&(a[Z]=decodeURIComponent(te))}else if(E.kind===2){const L=E,U=e.substring($+(((R=L.prefix)==null?void 0:R.length)??0),e.length-(((j=L.suffix)==null?void 0:j.length)??0)),z=decodeURIComponent(U);a["*"]=z,a._splat=z;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:u,node:f,path:d,segment:h}]}function b1(e){const t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function qP(e){const t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function HP(e,t,n,s){if(e==="/"&&n.index)return{node:n.index,skipped:0};const i=!Ka(t),a=i&&e!=="/",u=t.length-(i?1:0),f=[{node:n,index:1,skipped:0,depth:1,statics:0,dynamics:0,optionals:0}];let d=null,h=null;for(;f.length;){const m=f.pop(),{node:p,index:x,skipped:v,depth:w,statics:k,dynamics:b,optionals:_}=m;let{extract:R,rawParams:j}=m;if(p.kind===2&&p.route&&!Qu(h,m))continue;if(p.parse){if(!Nv(e,t,m))continue;j=m.rawParams,R=m.extract}s&&p.route&&p.kind!==cs&&Qu(d,m)&&(d=m);const E=x===u;if(E&&(p.route&&(!a||p.kind===cs||p.kind===2)&&Qu(h,m)&&(h=m),!p.optional&&!p.wildcard&&!p.index&&!p.pathless))continue;const T=E?void 0:t[x];let $;if(E&&p.index){const L={node:p.index,index:x,skipped:v,depth:w+1,statics:k,dynamics:b,optionals:_,extract:R,rawParams:j};let U=!0;if(p.index.parse&&(Nv(e,t,L)||(U=!1)),U){if(!b&&!_&&!v&&WP(k,u))return L;Qu(h,L)&&(h=L)}}if(p.wildcard)for(let L=p.wildcard.length-1;L>=0;L--){const U=p.wildcard[L],{prefix:z,suffix:Z}=U;if(!(z&&(E||!(U.caseSensitive?T:$??($=T.toLowerCase())).startsWith(z)))){if(Z){if(E)continue;const te=t.slice(x).join("/").slice(-Z.length);if((U.caseSensitive?te:te.toLowerCase())!==Z)continue}f.push({node:U,index:u,skipped:v,depth:w+1,statics:k,dynamics:b,optionals:_,extract:R,rawParams:j})}}if(p.optional){const L=v|1<<w,U=w+1;for(let z=p.optional.length-1;z>=0;z--){const Z=p.optional[z];f.push({node:Z,index:x,skipped:L,depth:U,statics:k,dynamics:b,optionals:_,extract:R,rawParams:j})}if(!E)for(let z=p.optional.length-1;z>=0;z--){const Z=p.optional[z],{prefix:te,suffix:ae}=Z;if(te||ae){const P=Z.caseSensitive?T:$??($=T.toLowerCase());if(te&&!P.startsWith(te)||ae&&!P.endsWith(ae))continue}f.push({node:Z,index:x+1,skipped:v,depth:U,statics:k,dynamics:b,optionals:_+Ku(u,x),extract:R,rawParams:j})}}if(!E&&p.dynamic&&T)for(let L=p.dynamic.length-1;L>=0;L--){const U=p.dynamic[L],{prefix:z,suffix:Z}=U;if(z||Z){const te=U.caseSensitive?T:$??($=T.toLowerCase());if(z&&!te.startsWith(z)||Z&&!te.endsWith(Z))continue}f.push({node:U,index:x+1,skipped:v,depth:w+1,statics:k,dynamics:b+Ku(u,x),optionals:_,extract:R,rawParams:j})}if(!E&&p.staticInsensitive){const L=p.staticInsensitive.get($??($=T.toLowerCase()));L&&f.push({node:L,index:x+1,skipped:v,depth:w+1,statics:k+Ku(u,x),dynamics:b,optionals:_,extract:R,rawParams:j})}if(!E&&p.static){const L=p.static.get(T);L&&f.push({node:L,index:x+1,skipped:v,depth:w+1,statics:k+Ku(u,x),dynamics:b,optionals:_,extract:R,rawParams:j})}if(p.pathless){const L=w+1;for(let U=p.pathless.length-1;U>=0;U--){const z=p.pathless[U];f.push({node:z,index:x,skipped:v,depth:L,statics:k,dynamics:b,optionals:_,extract:R,rawParams:j})}}}if(h)return h;if(s&&d){let m=d.index;for(let x=0;x<d.index;x++)m+=t[x].length;const p=m===e.length?"/":e.slice(m);return d.rawParams??(d.rawParams=Object.create(null)),d.rawParams["**"]=decodeURIComponent(p),d}return null}function Ku(e,t){return 2**(e-t-1)}function WP(e,t){return e===2**(t-1)-1}function Nv(e,t,n){let s,i;try{[s,i]=C1(e,t,n)}catch{return null}if(n.rawParams=s,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(s)===!1)return null}catch{}return!0}function Qu(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===cs)>(e.node.kind===cs)||t.node.kind===cs==(e.node.kind===cs)&&t.depth>e.depth))):!0}function dc(e){return qp(e.filter(t=>t!==void 0).join("/"))}function qp(e){return e.replace(/\/{2,}/g,"/")}function _1(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function Mr(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/{1,}$/,""):e}function R1(e){return Mr(_1(e))}function Ec(e,t){return e!=null&&e.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function GP(e,t,n){return Ec(e,n)===Ec(t,n)}function KP({base:e,to:t,trailingSlash:n="never",cache:s}){const i=t.startsWith("/"),a=!i&&t===".";let u;if(s){u=i?t:a?e:e+"\0"+t;const h=s.get(u);if(h)return h}let f;if(a)f=e.split("/");else if(i)f=t.split("/");else{for(f=e.split("/");f.length>1&&Ka(f)==="";)f.pop();const h=t.split("/");for(let m=0,p=h.length;m<p;m++){const x=h[m];x===""?m?m===p-1&&f.push(x):f=[x]:x===".."?f.pop():x==="."||f.push(x)}}f.length>1&&(Ka(f)===""?n==="never"&&f.pop():n==="always"&&f.push(""));const d=qp(f.join("/"))||"/";return u&&s&&s.set(u,d),d}function QP(e){const t=new Map(e.map(i=>[encodeURIComponent(i),i])),n=Array.from(t.keys()).map(i=>i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),s=new RegExp(n,"g");return i=>i.replace(s,a=>t.get(a)??a)}function Vh(e,t,n){const s=t[e];return typeof s!="string"?s:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(s)?s:s.split("/").map(i=>Tv(i,n)).join("/"):Tv(s,n)}function Mv({path:e,params:t,decoder:n,...s}){let i=!1;const a=Object.create(null);if(!e||e==="/")return{interpolatedPath:"/",usedParams:a,isMissingParams:i};if(!e.includes("$"))return{interpolatedPath:e,usedParams:a,isMissingParams:i};const u=e.length;let f=0,d,h="";for(;f<u;){const m=f;d=k1(e,m,d);const p=d[5];if(f=p+1,m===p)continue;const x=d[0];if(x===0){h+="/"+e.substring(m,p);continue}if(x===2){const v=t._splat;a._splat=v,a["*"]=v;const w=e.substring(m,d[1]),k=e.substring(d[4],p);if(!v){i=!0,(w||k)&&(h+="/"+w+k);continue}const b=Vh("_splat",t,n);h+="/"+w+b+k;continue}if(x===1){const v=e.substring(d[2],d[3]);!i&&!(v in t)&&(i=!0),a[v]=t[v];const w=e.substring(m,d[1]),k=e.substring(d[4],p),b=Vh(v,t,n)??"undefined";h+="/"+w+b+k;continue}if(x===3){const v=e.substring(d[2],d[3]),w=t[v];if(w==null)continue;a[v]=w;const k=e.substring(m,d[1]),b=e.substring(d[4],p),_=Vh(v,t,n)??"";h+="/"+k+_+b;continue}}return e.endsWith("/")&&(h+="/"),{usedParams:a,interpolatedPath:h||"/",isMissingParams:i}}function Tv(e,t){const n=encodeURIComponent(e);return(t==null?void 0:t(n))??n}function Bt(e){return(e==null?void 0:e.isNotFound)===!0}function JP(e,t=String){const n=new URLSearchParams;for(const s in e){const i=e[s];i!==void 0&&n.set(s,t(i))}return n.toString()}function Bh(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function YP(e){const t=new URLSearchParams(e),n=Object.create(null);for(const[s,i]of t.entries()){const a=n[s];a==null?n[s]=Bh(i):Array.isArray(a)?a.push(Bh(i)):n[s]=[a,Bh(i)]}return n}const XP=eI(JSON.parse),ZP=tI(JSON.stringify,JSON.parse);function eI(e){return t=>{t[0]==="?"&&(t=t.substring(1));const n=YP(t);for(const s in n){const i=n[s];if(typeof i=="string")try{n[s]=e(i)}catch{}}return n}}function tI(e,t){const n=typeof t=="function";function s(i){if(typeof i=="object"&&i!==null)try{return e(i)}catch{}else if(n&&typeof i=="string")try{return t(i),e(i)}catch{}return i}return i=>{const a=JP(i,s);return a?`?${a}`:""}}const no="__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 n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function on(e){return e instanceof Response&&!!e.options}const Dg=e=>{var t;if(!e.rendered)return e.rendered=!0,(t=e.onReady)==null?void 0:t.call(e)},rI=e=>e.stores.matchesId.get().some(t=>{var n;return(n=e.stores.matchStores.get(t))==null?void 0:n.get()._forcePending}),sf=(e,t)=>!!(e.preload&&!e.router.stores.matchStores.has(t)),ro=(e,t,n=!0)=>{const s={...e.router.options.context??{}},i=n?t:t-1;for(let a=0;a<=i;a++){const u=e.matches[a];if(!u)continue;const f=e.router.getMatch(u.id);f&&Object.assign(s,f.__routeContext,f.__beforeLoadContext)}return s},$v=(e,t)=>{if(!e.matches.length)return;const n=t.routeId,s=e.matches.findIndex(u=>u.routeId===e.router.routeTree.id),i=s>=0?s:0;let a=n?e.matches.findIndex(u=>u.routeId===n):e.firstBadMatchIndex??e.matches.length-1;a<0&&(a=i);for(let u=a;u>=0;u--){const f=e.matches[u];if(e.router.looseRoutesById[f.routeId].options.notFoundComponent)return u}return n?a:i},fs=(e,t,n)=>{var s,i,a;if(!(!on(n)&&!Bt(n)))throw on(n)&&n.redirectHandled&&!n.options.reloadDocument||(t&&((s=t._nonReactive.beforeLoadPromise)==null||s.resolve(),(i=t._nonReactive.loaderPromise)==null||i.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=n,e.updateMatch(t.id,u=>({...u,status:on(n)?"redirected":Bt(n)?"notFound":u.status==="pending"?"success":u.status,context:ro(e,t.index),isFetching:!1,error:n})),Bt(n)&&!n.routeId&&(n.routeId=t.routeId),(a=t._nonReactive.loadPromise)==null||a.resolve()),on(n)&&(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n))),n},E1=(e,t)=>{const n=e.router.getMatch(t);return!!(!n||n._nonReactive.dehydrated)},Fv=(e,t,n)=>{const s=ro(e,n);e.updateMatch(t,i=>({...i,context:s}))},ka=(e,t,n)=>{var u,f;const{id:s,routeId:i}=e.matches[t],a=e.router.looseRoutesById[i];if(n instanceof Promise)throw n;e.firstBadMatchIndex??(e.firstBadMatchIndex=t),fs(e,e.router.getMatch(s),n);try{(f=(u=a.options).onError)==null||f.call(u,n)}catch(d){n=d,fs(e,e.router.getMatch(s),n)}e.updateMatch(s,d=>{var h,m;return(h=d._nonReactive.beforeLoadPromise)==null||h.resolve(),d._nonReactive.beforeLoadPromise=void 0,(m=d._nonReactive.loadPromise)==null||m.resolve(),{...d,error:n,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController}}),!e.preload&&!on(n)&&!Bt(n)&&(e.serialError??(e.serialError=n))},P1=(e,t,n,s)=>{var a;if(s._nonReactive.pendingTimeout!==void 0)return;const i=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!sf(e,t)&&(n.options.loader||n.options.beforeLoad||j1(n))&&typeof i=="number"&&i!==1/0&&(n.options.pendingComponent??((a=e.router.options)==null?void 0:a.defaultPendingComponent))){const u=setTimeout(()=>{Dg(e)},i);s._nonReactive.pendingTimeout=u}},sI=(e,t,n)=>{const s=e.router.getMatch(t);if(!s._nonReactive.beforeLoadPromise&&!s._nonReactive.loaderPromise)return;P1(e,t,n,s);const i=()=>{const a=e.router.getMatch(t);a.preload&&(a.status==="redirected"||a.status==="notFound")&&fs(e,a,a.error)};return s._nonReactive.beforeLoadPromise?s._nonReactive.beforeLoadPromise.then(i):i()},oI=(e,t,n,s)=>{const i=e.router.getMatch(t);let a=i._nonReactive.loadPromise;i._nonReactive.loadPromise=mi(()=>{a==null||a.resolve(),a=void 0});const{paramsError:u,searchError:f}=i;u&&ka(e,n,u),f&&ka(e,n,f),P1(e,t,s,i);const d=new AbortController;let h=!1;const m=()=>{h||(h=!0,e.updateMatch(t,E=>({...E,isFetching:"beforeLoad",fetchCount:E.fetchCount+1,abortController:d})))},p=()=>{var E;(E=i._nonReactive.beforeLoadPromise)==null||E.resolve(),i._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,T=>({...T,isFetching:!1}))};if(!s.options.beforeLoad){e.router.batch(()=>{m(),p()});return}i._nonReactive.beforeLoadPromise=mi();const x={...ro(e,n,!1),...i.__routeContext},{search:v,params:w,cause:k}=i,b=sf(e,t),_={search:v,abortController:d,params:w,preload:b,context:x,location:e.location,navigate:E=>e.router.navigate({...E,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:b?"preload":k,matches:e.matches,routeId:s.id,...e.router.options.additionalContext},R=E=>{if(E===void 0){e.router.batch(()=>{m(),p()});return}(on(E)||Bt(E))&&(m(),ka(e,n,E)),e.router.batch(()=>{m(),e.updateMatch(t,T=>({...T,__beforeLoadContext:E})),p()})};let j;try{if(j=s.options.beforeLoad(_),Qa(j))return m(),j.catch(E=>{ka(e,n,E)}).then(R)}catch(E){m(),ka(e,n,E)}R(j)},iI=(e,t)=>{const{id:n,routeId:s}=e.matches[t],i=e.router.looseRoutesById[s],a=()=>f(),u=()=>oI(e,n,t,i),f=()=>{if(E1(e,n))return;const d=sI(e,n,i);return Qa(d)?d.then(u):u()};return a()},aI=(e,t,n)=>{var a,u,f,d,h,m;const s=e.router.getMatch(t);if(!s||!n.options.head&&!n.options.scripts&&!n.options.headers)return;const i={ssr:e.router.options.ssr,matches:e.matches,match:s,params:s.params,loaderData:s.loaderData};return Promise.all([(u=(a=n.options).head)==null?void 0:u.call(a,i),(d=(f=n.options).scripts)==null?void 0:d.call(f,i),(m=(h=n.options).headers)==null?void 0:m.call(h,i)]).then(([p,x,v])=>({meta:p==null?void 0:p.meta,links:p==null?void 0:p.links,headScripts:p==null?void 0:p.scripts,headers:v,scripts:x,styles:p==null?void 0:p.styles}))},I1=(e,t,n,s,i)=>{const a=t[s-1],{params:u,loaderDeps:f,abortController:d,cause:h}=e.router.getMatch(n),m=ro(e,s),p=sf(e,n);return{params:u,deps:f,preload:!!p,parentMatchPromise:a,abortController:d,context:m,location:e.location,navigate:x=>e.router.navigate({...x,_fromLocation:e.location}),cause:p?"preload":h,route:i,...e.router.options.additionalContext}},Lv=async(e,t,n,s,i)=>{var a,u,f,d,h;try{const m=e.router.getMatch(n);try{(!(x1??e.router.isServer)||m.ssr===!0)&&Ya(i);const p=i.options.loader,x=typeof p=="function"?p:p==null?void 0:p.handler,v=x==null?void 0:x(I1(e,t,n,s,i)),w=!!x&&Qa(v);if((w||i._lazyPromise||i._componentsPromise||i.options.head||i.options.scripts||i.options.headers||m._nonReactive.minPendingPromise)&&e.updateMatch(n,b=>({...b,isFetching:"loader"})),x){const b=w?await v:v;fs(e,e.router.getMatch(n),b),b!==void 0&&e.updateMatch(n,_=>({..._,loaderData:b}))}i._lazyPromise&&await i._lazyPromise;const k=m._nonReactive.minPendingPromise;k&&await k,i._componentsPromise&&await i._componentsPromise,e.updateMatch(n,b=>({...b,error:void 0,context:ro(e,s),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(p){let x=p;if((x==null?void 0:x.name)==="AbortError"){if(m.abortController.signal.aborted){(a=m._nonReactive.loaderPromise)==null||a.resolve(),m._nonReactive.loaderPromise=void 0;return}e.updateMatch(n,w=>({...w,status:w.status==="pending"?"success":w.status,isFetching:!1,context:ro(e,s)}));return}const v=m._nonReactive.minPendingPromise;v&&await v,Bt(p)&&await((f=(u=i.options.notFoundComponent)==null?void 0:u.preload)==null?void 0:f.call(u)),fs(e,e.router.getMatch(n),p);try{(h=(d=i.options).onError)==null||h.call(d,p)}catch(w){x=w,fs(e,e.router.getMatch(n),w)}!on(x)&&!Bt(x)&&await Ya(i,["errorComponent"]),e.updateMatch(n,w=>({...w,error:x,context:ro(e,s),status:"error",isFetching:!1}))}}catch(m){const p=e.router.getMatch(n);p&&(p._nonReactive.loaderPromise=void 0),fs(e,p,m)}},lI=async(e,t,n)=>{var v,w,k,b;async function s(_,R,j,E,T){const $=Date.now()-R.updatedAt,L=_?T.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:T.options.staleTime??e.router.options.defaultStaleTime??0,U=T.options.shouldReload,z=typeof U=="function"?U(I1(e,t,i,n,T)):U,{status:Z,invalid:te}=E,ae=$>=L&&(!!e.forceStaleReload||E.cause==="enter"||j!==void 0&&j!==E.id);u=Z==="success"&&(te||(z??ae)),_&&T.options.preload===!1||(u&&!e.sync&&m?(f=!0,(async()=>{var P,H;try{await Lv(e,t,i,n,T);const X=e.router.getMatch(i);(P=X._nonReactive.loaderPromise)==null||P.resolve(),(H=X._nonReactive.loadPromise)==null||H.resolve(),X._nonReactive.loaderPromise=void 0,X._nonReactive.loadPromise=void 0}catch(X){on(X)&&await e.router.navigate(X.options)}})()):Z!=="success"||u?await Lv(e,t,i,n,T):Fv(e,i,n))}const{id:i,routeId:a}=e.matches[n];let u=!1,f=!1;const d=e.router.looseRoutesById[a],h=d.options.loader,m=((typeof h=="function"||h==null?void 0:h.staleReloadMode)??e.router.options.defaultStaleReloadMode)!=="blocking";if(E1(e,i)){if(!e.router.getMatch(i))return e.matches[n];Fv(e,i,n)}else{const _=e.router.getMatch(i),R=e.router.stores.matchesId.get()[n],j=((v=R&&e.router.stores.matchStores.get(R)||null)==null?void 0:v.routeId)===a?R:(w=e.router.stores.matches.get().find(T=>T.routeId===a))==null?void 0:w.id,E=sf(e,i);if(_._nonReactive.loaderPromise){if(_.status==="success"&&!e.sync&&!_.preload&&m)return _;await _._nonReactive.loaderPromise;const T=e.router.getMatch(i),$=T._nonReactive.error||T.error;$&&fs(e,T,$),T.status==="pending"&&await s(E,_,j,T,d)}else{const T=E&&!e.router.stores.matchStores.has(i),$=e.router.getMatch(i);$._nonReactive.loaderPromise=mi(),T!==$.preload&&e.updateMatch(i,L=>({...L,preload:T})),await s(E,_,j,$,d)}}const p=e.router.getMatch(i);f||((k=p._nonReactive.loaderPromise)==null||k.resolve(),(b=p._nonReactive.loadPromise)==null||b.resolve(),p._nonReactive.loadPromise=void 0),clearTimeout(p._nonReactive.pendingTimeout),p._nonReactive.pendingTimeout=void 0,f||(p._nonReactive.loaderPromise=void 0),p._nonReactive.dehydrated=void 0;const x=f?p.isFetching:!1;return x!==p.isFetching||p.invalid!==!1?(e.updateMatch(i,_=>({..._,isFetching:x,invalid:!1})),e.router.getMatch(i)):p};async function Ov(e){var x,v;const t=e,n=[];rI(t.router)&&Dg(t);let s;for(let w=0;w<t.matches.length;w++){try{const k=iI(t,w);Qa(k)&&await k}catch(k){if(on(k))throw k;if(Bt(k))s=k;else if(!t.preload)throw k;break}if(t.serialError||t.firstBadMatchIndex!=null)break}const i=t.firstBadMatchIndex??t.matches.length,a=s&&!t.preload?$v(t,s):void 0,u=s&&t.preload?0:a!==void 0?Math.min(a+1,i):i;let f,d;for(let w=0;w<u;w++)n.push(lI(t,n,w));try{await Promise.all(n)}catch{const w=await Promise.allSettled(n);for(const k of w){if(k.status!=="rejected")continue;const b=k.reason;if(on(b))throw b;Bt(b)?f??(f=b):d??(d=b)}if(d!==void 0)throw d}const h=f??(s&&!t.preload?s:void 0);let m=t.firstBadMatchIndex!==void 0?t.firstBadMatchIndex:t.matches.length-1;if(!h&&s&&t.preload)return t.matches;if(h){const w=$v(t,h);w===void 0&&Tr();const k=t.matches[w],b=t.router.looseRoutesById[k.routeId],_=(x=t.router.options)==null?void 0:x.defaultNotFoundComponent;!b.options.notFoundComponent&&_&&(b.options.notFoundComponent=_),h.routeId=k.routeId;const R=k.routeId===t.router.routeTree.id;t.updateMatch(k.id,j=>({...j,...R?{status:"success",globalNotFound:!0,error:void 0}:{status:"notFound",error:h},isFetching:!1})),m=w,await Ya(b,["notFoundComponent"])}else if(!t.preload){const w=t.matches[0];w.globalNotFound||(v=t.router.getMatch(w.id))!=null&&v.globalNotFound&&t.updateMatch(w.id,k=>({...k,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){const w=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await Ya(w,["errorComponent"])}for(let w=0;w<=m;w++){const{id:k,routeId:b}=t.matches[w],_=t.router.looseRoutesById[b];try{const R=aI(t,k,_);if(R){const j=await R;t.updateMatch(k,E=>({...E,...j}))}}catch(R){console.error(`Error executing head for route ${b}:`,R)}}const p=Dg(t);if(Qa(p)&&await p,h)throw h;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function Av(e,t){const n=t.map(s=>{var i,a;return(a=(i=e.options[s])==null?void 0:i.preload)==null?void 0:a.call(i)}).filter(Boolean);if(n.length!==0)return Promise.all(n)}function Ya(e,t=hc){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(s=>{const{id:i,...a}=s.options;Object.assign(e.options,a),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);const n=()=>e._componentsLoaded?void 0:t===hc?(()=>{if(e._componentsPromise===void 0){const s=Av(e,hc);s?e._componentsPromise=s.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():Av(e,t);return e._lazyPromise?e._lazyPromise.then(n):n()}function j1(e){var t;for(const n of hc)if((t=e.options[n])!=null&&t.preload)return!0;return!1}const hc=["component","errorComponent","pendingComponent","notFoundComponent"];function uI(e){return{input:({url:t})=>{for(const n of e)t=zg(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=N1(e[n],t);return t}}}function cI(e){const t=R1(e.basepath),n=`/${t}`,s=e.caseSensitive?n:n.toLowerCase(),i=`${s}/`;return{input:({url:a})=>{const u=e.caseSensitive?a.pathname:a.pathname.toLowerCase();return u===s?a.pathname="/":u.startsWith(i)&&(a.pathname=a.pathname.slice(n.length)),a},output:({url:a})=>(a.pathname=dc(["/",t,a.pathname]),a)}}function zg(e,t){var s;const n=(s=e==null?void 0:e.input)==null?void 0:s.call(e,{url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function N1(e,t){var s;const n=(s=e==null?void 0:e.output)==null?void 0:s.call(e,{url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function fI(e,t){const{createMutableStore:n,createReadonlyStore:s,batch:i,init:a}=t,u=new Map,f=new Map,d=new Map,h=n(e.status),m=n(e.loadedAt),p=n(e.isLoading),x=n(e.isTransitioning),v=n(e.location),w=n(e.resolvedLocation),k=n(e.statusCode),b=n(e.redirect),_=n([]),R=n([]),j=n([]),E=s(()=>qh(u,_.get())),T=s(()=>qh(f,R.get())),$=s(()=>qh(d,j.get())),L=s(()=>_.get()[0]),U=s(()=>_.get().some(q=>{var Y;return((Y=u.get(q))==null?void 0:Y.get().status)==="pending"})),z=s(()=>{var q;return{locationHref:v.get().href,resolvedLocationHref:(q=w.get())==null?void 0:q.href,status:h.get()}}),Z=s(()=>({status:h.get(),loadedAt:m.get(),isLoading:p.get(),isTransitioning:x.get(),matches:E.get(),location:v.get(),resolvedLocation:w.get(),statusCode:k.get(),redirect:b.get()})),te=Ja(64);function ae(q){let Y=te.get(q);return Y||(Y=s(()=>{const se=_.get();for(const ee of se){const M=u.get(ee);if(M&&M.routeId===q)return M.get()}}),te.set(q,Y)),Y}const P={status:h,loadedAt:m,isLoading:p,isTransitioning:x,location:v,resolvedLocation:w,statusCode:k,redirect:b,matchesId:_,pendingIds:R,cachedIds:j,matches:E,pendingMatches:T,cachedMatches:$,firstId:L,hasPending:U,matchRouteDeps:z,matchStores:u,pendingMatchStores:f,cachedMatchStores:d,__store:Z,getRouteMatchStore:ae,setMatches:H,setPending:X,setCached:K};H(e.matches),a==null||a(P);function H(q){Hh(q,u,_,n,i)}function X(q){Hh(q,f,R,n,i)}function K(q){Hh(q,d,j,n,i)}return P}function qh(e,t){const n=[];for(const s of t){const i=e.get(s);i&&n.push(i.get())}return n}function Hh(e,t,n,s,i){const a=e.map(f=>f.id),u=new Set(a);i(()=>{for(const f of t.keys())u.has(f)||t.delete(f);for(const f of e){const d=t.get(f.id);if(!d){const h=s(f);h.routeId=f.routeId,t.set(f.id,h);continue}d.routeId=f.routeId,d.get()!==f&&d.set(f)}LP(n.get(),a)||n.set(a)})}var ps="__TSR_index",Dv="popstate",zv="beforeunload";function dI(e){let t=e.getLocation();const n=new Set,s=u=>{t=e.getLocation(),n.forEach(f=>f({location:t,action:u}))},i=u=>{e.notifyOnIndexChange??!0?s(u):t=e.getLocation()},a=async({task:u,navigateOpts:f,...d})=>{var p,x;if((f==null?void 0:f.ignoreBlocker)??!1){u();return}const h=((p=e.getBlockers)==null?void 0:p.call(e))??[],m=d.type==="PUSH"||d.type==="REPLACE";if(typeof document<"u"&&h.length&&m)for(const v of h){const w=Xa(d.path,d.state);if(await v.blockerFn({currentLocation:t,nextLocation:w,action:d.type})){(x=e.onBlocked)==null||x.call(e);return}}u()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:u=>(n.add(u),()=>{n.delete(u)}),push:(u,f,d)=>{const h=t.state[ps];f=Uv(h+1,f),a({task:()=>{e.pushState(u,f),s({type:"PUSH"})},navigateOpts:d,type:"PUSH",path:u,state:f})},replace:(u,f,d)=>{const h=t.state[ps];f=Uv(h,f),a({task:()=>{e.replaceState(u,f),s({type:"REPLACE"})},navigateOpts:d,type:"REPLACE",path:u,state:f})},go:(u,f)=>{a({task:()=>{e.go(u),i({type:"GO",index:u})},navigateOpts:f,type:"GO"})},back:u=>{a({task:()=>{e.back((u==null?void 0:u.ignoreBlocker)??!1),i({type:"BACK"})},navigateOpts:u,type:"BACK"})},forward:u=>{a({task:()=>{e.forward((u==null?void 0:u.ignoreBlocker)??!1),i({type:"FORWARD"})},navigateOpts:u,type:"FORWARD"})},canGoBack:()=>t.state[ps]!==0,createHref:u=>e.createHref(u),block:u=>{var d;if(!e.setBlockers)return()=>{};const f=((d=e.getBlockers)==null?void 0:d.call(e))??[];return e.setBlockers([...f,u]),()=>{var m,p;const h=((m=e.getBlockers)==null?void 0:m.call(e))??[];(p=e.setBlockers)==null||p.call(e,h.filter(x=>x!==u))}},flush:()=>{var u;return(u=e.flush)==null?void 0:u.call(e)},destroy:()=>{var u;return(u=e.destroy)==null?void 0:u.call(e)},notify:s}}function Uv(e,t){t||(t={});const n=Hp();return{...t,key:n,__TSR_key:n,[ps]:e}}function M1(e){var U,z;const t=(e==null?void 0:e.window)??(typeof document<"u"?window:void 0),n=t.history.pushState,s=t.history.replaceState;let i=[];const a=()=>i,u=Z=>i=Z,f=(e==null?void 0:e.createHref)??(Z=>Z),d=(e==null?void 0:e.parseLocation)??(()=>Xa(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!((U=t.history.state)!=null&&U.__TSR_key)&&!((z=t.history.state)!=null&&z.key)){const Z=Hp();t.history.replaceState({[ps]:0,key:Z,__TSR_key:Z},"")}let h=d(),m,p=!1,x=!1,v=!1,w=!1;const k=()=>h;let b,_;const R=()=>{b&&(L._ignoreSubscribers=!0,(b.isPush?t.history.pushState:t.history.replaceState)(b.state,"",b.href),L._ignoreSubscribers=!1,b=void 0,_=void 0,m=void 0)},j=(Z,te,ae)=>{const P=f(te);_||(m=h),h=Xa(te,ae),b={href:P,state:ae,isPush:(b==null?void 0:b.isPush)||Z==="push"},_||(_=Promise.resolve().then(()=>R()))},E=Z=>{h=d(),L.notify({type:Z})},T=async()=>{if(x){x=!1;return}const Z=d(),te=Z.state[ps]-h.state[ps],ae=te===1,P=te===-1,H=!ae&&!P||p;p=!1;const X=H?"GO":P?"BACK":"FORWARD",K=H?{type:"GO",index:te}:{type:P?"BACK":"FORWARD"};if(v)v=!1;else{const q=a();if(typeof document<"u"&&q.length){for(const Y of q)if(await Y.blockerFn({currentLocation:h,nextLocation:Z,action:X})){x=!0,t.history.go(1),L.notify(K);return}}}h=d(),L.notify(K)},$=Z=>{if(w){w=!1;return}let te=!1;const ae=a();if(typeof document<"u"&&ae.length)for(const P of ae){const H=P.enableBeforeUnload??!0;if(H===!0){te=!0;break}if(typeof H=="function"&&H()===!0){te=!0;break}}if(te)return Z.preventDefault(),Z.returnValue=""},L=dI({getLocation:k,getLength:()=>t.history.length,pushState:(Z,te)=>j("push",Z,te),replaceState:(Z,te)=>j("replace",Z,te),back:Z=>(Z&&(v=!0),w=!0,t.history.back()),forward:Z=>{Z&&(v=!0),w=!0,t.history.forward()},go:Z=>{p=!0,t.history.go(Z)},createHref:Z=>f(Z),flush:R,destroy:()=>{t.history.pushState=n,t.history.replaceState=s,t.removeEventListener(zv,$,{capture:!0}),t.removeEventListener(Dv,T)},onBlocked:()=>{m&&h!==m&&(h=m)},getBlockers:a,setBlockers:u,notifyOnIndexChange:!1});return t.addEventListener(zv,$,{capture:!0}),t.addEventListener(Dv,T),t.history.pushState=function(...Z){const te=n.apply(t.history,Z);return L._ignoreSubscribers||E("PUSH"),te},t.history.replaceState=function(...Z){const te=s.apply(t.history,Z);return L._ignoreSubscribers||E("REPLACE"),te},L}function hI(e){const t=typeof document<"u"?window:void 0;return M1({window:t,parseLocation:()=>{const n=t.location.hash.split("#").slice(1),s=n[0]??"/",i=t.location.search,a=n.slice(1);return Xa(`${s}${i}${a.length===0?"":`#${a.join("#")}`}`,t.history.state)},createHref:n=>`${t.location.pathname}${t.location.search}#${n}`})}function gI(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function Xa(e,t){const n=gI(e),s=n.indexOf("#"),i=n.indexOf("?"),a=Hp();return{href:n,pathname:n.substring(0,s>0?i>0?Math.min(s,i):s:i>0?i:n.length),hash:s>-1?n.substring(s):"",search:i>-1?n.slice(i,s===-1?void 0:s):"",state:t||{[ps]:0,key:a,__TSR_key:a}}}function Hp(){return(Math.random()+1).toString(36).substring(7)}function fi(e,t){const n=t,s=e;return{fromLocation:n,toLocation:s,pathChanged:(n==null?void 0:n.pathname)!==s.pathname,hrefChanged:(n==null?void 0:n.href)!==s.href,hashChanged:(n==null?void 0:n.hash)!==s.hash}}const Ug=new WeakMap;var pI=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.startTransition=n=>n(),this.update=n=>{var m;const s=this.options,i=this.basepath??(s==null?void 0:s.basepath)??"/",a=this.basepath===void 0,u=s==null?void 0:s.rewrite;if(this.options={...s,...n},this.isServer=this.options.isServer??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=QP(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=M1()),this.origin=this.options.origin,this.origin||(window!=null&&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 p;this.resolvePathCache=Ja(1e3),p=this.buildRouteTree(),this.setRoutes(p)}if(!this.stores&&this.latestLocation){const p=this.getStoreConfig(this);this.batch=p.batch,this.stores=fI(yI(this.latestLocation),p),PI(this)}let f=!1;const d=this.options.basepath??"/",h=this.options.rewrite;if(a||i!==d||u!==h){this.basepath=d;const p=[],x=R1(d);x&&x!=="/"&&p.push(cI({basepath:d})),h&&p.push(h),this.rewrite=p.length===0?void 0:p.length===1?p[0]:uI(p),this.history&&this.updateLatestLocation(),f=!0}f&&this.stores&&this.stores.location.set(this.latestLocation),typeof window<"u"&&"CSS"in window&&typeof((m=window.CSS)==null?void 0:m.supports)=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a))"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const n=BP(this.routeTree,this.options.caseSensitive,(s,i)=>{s.init({originalIndex:i})});return this.options.routeMasks&&AP(this.options.routeMasks,n.processedTree),n},this.subscribe=(n,s)=>{const i={eventType:n,fn:s};return this.subscribers.add(i),()=>{this.subscribers.delete(i)}},this.emit=n=>{this.subscribers.forEach(s=>{s.eventType===n.type&&s.fn(n)})},this.parseLocation=(n,s)=>{const i=({pathname:d,search:h,hash:m,href:p,state:x})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(d)){const _=this.options.parseSearch(h),R=this.options.stringifySearch(_);return{href:d+R+m,publicHref:d+R+m,pathname:wa(d).path,external:!1,searchStr:R,search:Gs(s==null?void 0:s.search,_),hash:wa(m.slice(1)).path,state:Zs(s==null?void 0:s.state,x)}}const v=new URL(p,this.origin),w=zg(this.rewrite,v),k=this.options.parseSearch(w.search),b=this.options.stringifySearch(k);return w.search=b,{href:w.href.replace(w.origin,""),publicHref:p,pathname:wa(w.pathname).path,external:!!this.rewrite&&w.origin!==this.origin,searchStr:b,search:Gs(s==null?void 0:s.search,k),hash:wa(w.hash.slice(1)).path,state:Zs(s==null?void 0:s.state,x)}},a=i(n),{__tempLocation:u,__tempKey:f}=a.state;if(u&&(!f||f===this.tempLocationKey)){const d=i(u);return d.state.key=a.state.key,d.state.__TSR_key=a.state.__TSR_key,delete d.state.__tempLocation,{...d,maskedLocation:a}}return a},this.resolvePathWithBase=(n,s)=>KP({base:n,to:s.includes("//")?qp(s):s,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(n,s,i)=>typeof n=="string"?this.matchRoutesInternal({pathname:n,search:s},i):this.matchRoutesInternal(n,s),this.getMatchedRoutes=n=>xI({pathname:n,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=n=>{const s=this.getMatch(n);s&&(s.abortController.abort(),clearTimeout(s._nonReactive.pendingTimeout),s._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingIds.get().forEach(n=>{this.cancelMatch(n)}),this.stores.matchesId.get().forEach(n=>{var i;if(this.stores.pendingMatchStores.has(n))return;const s=(i=this.stores.matchStores.get(n))==null?void 0:i.get();s&&(s.status==="pending"||s.isFetching==="loader")&&this.cancelMatch(n)})},this.buildLocation=n=>{const s=(a={})=>{var te,ae;const u=a._fromLocation||this.pendingBuiltLocation||this.latestLocation,f=this.matchRoutesLightweight(u);a.from;const d=a.unsafeRelative==="path"?u.pathname:a.from??f.fullPath,h=a.to?`${a.to}`:void 0,m=f.search,p=Object.assign(Object.create(null),f.params),x=(h==null?void 0:h.charCodeAt(0))===47?"/":this.resolvePathWithBase(d,"."),v=h?this.resolvePathWithBase(x,h):x,w=a.params===!1||a.params===null?Object.create(null):(a.params??!0)===!0?p:Object.assign(p,Xs(a.params,p)),k=this.routesByPath[Mr(v)];let b;if(k)b=this.getRouteBranch(k);else if(v.includes("$"))b=[];else{const P=this.getMatchedRoutes(v);b=P.matchedRoutes,this.options.notFoundRoute&&(!P.foundRoute||P.foundRoute.path!=="/"&&P.routeParams["**"])&&(b=[...b,this.options.notFoundRoute])}if(b.length&&S1(w))for(const P of b){const H=((te=P.options.params)==null?void 0:te.stringify)??P.options.stringifyParams;if(H)try{Object.assign(w,H(w))}catch{}}const _=n.leaveParams?v:wa(Mv({path:v,params:w,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;let R=m;if(n._includeValidateSearch&&((ae=this.options.search)!=null&&ae.strict)){const P={};b.forEach(H=>{if(H.options.validateSearch)try{Object.assign(P,gc(H.options.validateSearch,{...P,...R}))}catch{}}),R=P}R=vI({search:R,dest:a,destRoutes:b,_includeValidateSearch:n._includeValidateSearch}),R=Gs(m,R);const j=this.options.stringifySearch(R),E=a.hash===!0?u.hash:a.hash?Xs(a.hash,u.hash):void 0,T=E?`#${E}`:"";let $=a.state===!0?u.state:a.state?Xs(a.state,u.state):{};$=Zs(u.state,$);const L=`${_}${j}${T}`;let U,z,Z=!1;if(this.rewrite){const P=new URL(L,this.origin),H=N1(this.rewrite,P);U=P.href.replace(P.origin,""),H.origin!==this.origin?(z=H.href,Z=!0):z=H.pathname+H.search+H.hash}else U=FP(L),z=U;return{publicHref:z,href:U,pathname:_,search:R,searchStr:j,state:$,hash:E??"",external:Z,unmaskOnReload:a.unmaskOnReload}},i=(a={},u)=>{const f=s(a);let d=u?s(u):void 0;if(!d){const h=Object.create(null);if(this.options.routeMasks){const m=DP(f.pathname,this.processedTree);if(m){Object.assign(h,m.rawParams);const{from:p,params:x,...v}=m.route,w=x===!1||x===null?Object.create(null):(x??!0)===!0?h:Object.assign(h,Xs(x,h));u={from:n.from,...v,params:w},d=s(u)}}}return d&&(f.maskedLocation=d),f};return n.mask?i(n,{from:n.from,...n.mask}):i(n)},this.commitLocation=async({viewTransition:n,ignoreBlocker:s,...i})=>{let a;const u=()=>{const h=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];h.forEach(p=>{i.state[p]=this.latestLocation.state[p]});const m=to(i.state,this.latestLocation.state);return h.forEach(p=>{delete i.state[p]}),m},f=Mr(this.latestLocation.href)===Mr(i.href);let d=this.commitLocationPromise;if(this.commitLocationPromise=mi(()=>{d==null||d.resolve(),d=void 0}),f&&u())this.load();else{let{maskedLocation:h,hashScrollIntoView:m,...p}=i;h&&(p={...h,state:{...h.state,__tempKey:void 0,__tempLocation:{...p,search:p.searchStr,state:{...p.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(p.unmaskOnReload??this.options.unmaskOnReload??!1)&&(p.state.__tempKey=this.tempLocationKey)),p.state.__hashScrollIntoViewOptions=m??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=n,a=i.replace?"REPLACE":"PUSH",this.history[a==="REPLACE"?"replace":"push"](p.publicHref,p.state,{ignoreBlocker:s})}return this._scroll.next=i.resetScroll??!0,this.history.subscribers.size||this.load(a?{action:{type:a}}:void 0),this.commitLocationPromise},this.buildAndCommitLocation=({replace:n,resetScroll:s,hashScrollIntoView:i,viewTransition:a,ignoreBlocker:u,href:f,...d}={})=>{if(f){const p=this.history.location.state.__TSR_index,x=Xa(f,{__TSR_index:n?p:p+1}),v=new URL(x.pathname,this.origin);d.to=zg(this.rewrite,v).pathname,d.search=this.options.parseSearch(x.search),d.hash=x.hash.slice(1)}const h=this.buildLocation({...d,_includeValidateSearch:!0});this.pendingBuiltLocation=h;const m=this.commitLocation({...h,viewTransition:a,replace:n,resetScroll:s,hashScrollIntoView:i,ignoreBlocker:u});return Promise.resolve().then(()=>{this.pendingBuiltLocation===h&&(this.pendingBuiltLocation=void 0)}),m},this.navigate=async({to:n,reloadDocument:s,href:i,publicHref:a,...u})=>{var d,h;let f=!1;if(i)try{new URL(`${i}`),f=!0}catch{}if(f&&!s&&(s=!0),s){if(n!==void 0||!i){const p=this.buildLocation({to:n,...u});i=i??p.publicHref,a=a??p.publicHref}const m=!f&&a?a:i;if(Rc(m,this.protocolAllowlist))return Promise.resolve();if(!u.ignoreBlocker){const p=((h=(d=this.history).getBlockers)==null?void 0:h.call(d))??[];for(const x of p)if(x!=null&&x.blockerFn&&await x.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return Promise.resolve()}return u.replace?window.location.replace(m):window.location.href=m,Promise.resolve()}return this.buildAndCommitLocation({...u,href:i,to:n,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();const n=this.matchRoutes(this.latestLocation),s=this.stores.cachedMatches.get().filter(i=>!n.some(a=>a.id===i.id));this.batch(()=>{this.stores.status.set("pending"),this.stores.statusCode.set(200),this.stores.isLoading.set(!0),this.stores.location.set(this.latestLocation),this.stores.setPending(n),this.stores.setCached(s)})},this.load=async n=>{var h;const s=(h=n==null?void 0:n.action)==null?void 0:h.type;let i,a,u;const f=this.stores.resolvedLocation.get()??this.stores.location.get();for(u=new Promise(m=>{this.startTransition(async()=>{var p;try{this.beforeLoad(),s?Ug.set(this.latestLocation,s):Ug.delete(this.latestLocation);const x=this.latestLocation,v=fi(x,this.stores.resolvedLocation.get());this.stores.redirect.get()||this.emit({type:"onBeforeNavigate",...v}),this.emit({type:"onBeforeLoad",...v}),await Ov({router:this,sync:n==null?void 0:n.sync,forceStaleReload:f.href===x.href,matches:this.stores.pendingMatches.get(),location:x,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{var R,j;let w=null,k=null,b=null,_=null;this.batch(()=>{const E=this.stores.pendingMatches.get(),T=E.length,$=this.stores.matches.get();w=T?$.filter(z=>!this.stores.pendingMatchStores.has(z.id)):null;const L=new Set;for(const z of this.stores.pendingMatchStores.values())z.routeId&&L.add(z.routeId);const U=new Set;for(const z of this.stores.matchStores.values())z.routeId&&U.add(z.routeId);k=T?$.filter(z=>!L.has(z.routeId)):null,b=T?E.filter(z=>!U.has(z.routeId)):null,_=T?E.filter(z=>U.has(z.routeId)):$,this.stores.isLoading.set(!1),this.stores.loadedAt.set(Date.now()),T&&(this.stores.setMatches(E),this.stores.setPending([]),this.stores.setCached([...this.stores.cachedMatches.get(),...w.filter(z=>z.status!=="error"&&z.status!=="notFound"&&z.status!=="redirected")]),this.clearExpiredCache())});for(const[E,T]of[[k,"onLeave"],[b,"onEnter"],[_,"onStay"]])if(E)for(const $ of E)(j=(R=this.looseRoutesById[$.routeId].options)[T])==null||j.call(R,$)})})}})}catch(x){on(x)?(i=x,this.navigate({...i.options,replace:!0,ignoreBlocker:!0})):Bt(x)&&(a=x);const v=i?i.status:a?404:this.stores.matches.get().some(w=>w.status==="error")?500:200;this.batch(()=>{this.stores.statusCode.set(v),this.stores.redirect.set(i)})}this.latestLoadPromise===u&&((p=this.commitLocationPromise)==null||p.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),m()})}),this.latestLoadPromise=u,await u;this.latestLoadPromise&&u!==this.latestLoadPromise;)await this.latestLoadPromise;let d;this.hasNotFoundMatch()?d=404:this.stores.matches.get().some(m=>m.status==="error")&&(d=500),d!==void 0&&this.stores.statusCode.set(d)},this.startViewTransition=n=>{const s=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,s&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let i;if(typeof s=="object"&&this.isViewTransitionTypesSupported){const a=this.latestLocation,u=this.stores.resolvedLocation.get(),f=typeof s.types=="function"?s.types(fi(a,u)):s.types;if(f===!1){n();return}i={update:n,types:f}}else i=n;document.startViewTransition(i)}else n()},this.updateMatch=(n,s)=>{this.startTransition(()=>{const i=this.stores.pendingMatchStores.get(n);if(i){i.set(s);return}const a=this.stores.matchStores.get(n);if(a){a.set(s);return}const u=this.stores.cachedMatchStores.get(n);if(u){const f=s(u.get());f.status==="redirected"?this.stores.cachedMatchStores.delete(n)&&this.stores.cachedIds.set(d=>d.filter(h=>h!==n)):u.set(f)}})},this.getMatch=n=>{var s,i,a;return((s=this.stores.cachedMatchStores.get(n))==null?void 0:s.get())??((i=this.stores.pendingMatchStores.get(n))==null?void 0:i.get())??((a=this.stores.matchStores.get(n))==null?void 0:a.get())},this.invalidate=n=>{const s=i=>{var a;return((a=n==null?void 0:n.filter)==null?void 0:a.call(n,i))??!0?{...i,invalid:!0,...n!=null&&n.forcePending||i.status==="error"||i.status==="notFound"?{status:"pending",error:void 0}:void 0}:i};return this.batch(()=>{this.stores.setMatches(this.stores.matches.get().map(s)),this.stores.setCached(this.stores.cachedMatches.get().map(s)),this.stores.setPending(this.stores.pendingMatches.get().map(s))}),this.shouldViewTransition=!1,this.load({sync:n==null?void 0:n.sync})},this.getParsedLocationHref=n=>n.publicHref||"/",this.resolveRedirect=n=>{const s=n.headers.get("Location");if(!n.options.href||n.options._builtLocation){const i=n.options._builtLocation??this.buildLocation(n.options),a=this.getParsedLocationHref(i);n.options.href=a,n.headers.set("Location",a)}else if(s)try{const i=new URL(s);if(this.origin&&i.origin===this.origin){const a=i.pathname+i.search+i.hash;n.options.href=a,n.headers.set("Location",a)}}catch{}if(n.options.href&&!n.options._builtLocation&&Rc(n.options.href,this.protocolAllowlist))throw new Error("Redirect blocked: unsafe protocol");return n.headers.get("Location")||n.headers.set("Location",n.options.href),n},this.clearCache=n=>{const s=n==null?void 0:n.filter;s!==void 0?this.stores.setCached(this.stores.cachedMatches.get().filter(i=>!s(i))):this.stores.setCached([])},this.clearExpiredCache=()=>{const n=Date.now(),s=i=>{const a=this.looseRoutesById[i.routeId];if(!a.options.loader)return!0;const u=(i.preload?a.options.preloadGcTime??this.options.defaultPreloadGcTime:a.options.gcTime??this.options.defaultGcTime)??300*1e3;return i.status==="error"?!0:n-i.updatedAt>=u};this.clearCache({filter:s})},this.loadRouteChunk=Ya,this.preloadRoute=async n=>{const s=n._builtLocation??this.buildLocation(n);let i=this.matchRoutes(s,{throwOnError:!0,preload:!0,dest:n});const a=new Set([...this.stores.matchesId.get(),...this.stores.pendingIds.get()]),u=new Set([...a,...this.stores.cachedIds.get()]),f=i.filter(d=>!u.has(d.id));if(f.length){const d=this.stores.cachedMatches.get();this.stores.setCached([...d,...f])}try{return i=await Ov({router:this,matches:i,location:s,preload:!0,updateMatch:(d,h)=>{a.has(d)?i=i.map(m=>m.id===d?h(m):m):this.updateMatch(d,h)}}),i}catch(d){if(on(d))return d.options.reloadDocument?void 0:await this.preloadRoute({...d.options,_fromLocation:s});Bt(d)||console.error(d);return}},this.matchRoute=(n,s)=>{const i={...n,to:n.to?this.resolvePathWithBase(n.from||"",n.to):void 0,params:n.params||{},leaveParams:!0},a=this.buildLocation(i);if(s!=null&&s.pending&&this.stores.status.get()!=="pending")return!1;const u=((s==null?void 0:s.pending)===void 0?!this.stores.isLoading.get():s.pending)?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),f=zP(a.pathname,(s==null?void 0:s.caseSensitive)??!1,(s==null?void 0:s.fuzzy)??!1,u.pathname,this.processedTree);return!f||n.params&&!to(f.rawParams,n.params,{partial:!0})?!1:(s==null?void 0:s.includeSearch)??!0?to(u.search,a.search,{partial:!0})?f.rawParams:!1:f.rawParams},this.hasNotFoundMatch=()=>this.stores.matches.get().some(n=>n.status==="notFound"||n.globalNotFound),this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??"fuzzy",stringifySearch:e.stringifySearch??ZP,parseSearch:e.parseSearch??XP,protocolAllowlist:e.protocolAllowlist??$P}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;const s=this.options.notFoundRoute;s&&(s.init({originalIndex:99999999999}),this.routesById[s.id]=s)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=b1(e),this.routeBranchCache.set(e,t)),t}get looseRoutesById(){return this.routesById}getParentContext(e){return e!=null&&e.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,t){var m,p;const n=this.getMatchedRoutes(e.pathname),{foundRoute:s,routeParams:i}=n;let{matchedRoutes:a}=n,u=!1;(s?s.path!=="/"&&i["**"]:Mr(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:u=!0);const f=u?wI(this.options.notFoundMode,a):void 0,d=new Array(a.length),h=new Map;for(const x of this.stores.matchStores.values())x.routeId&&h.set(x.routeId,x.get());for(let x=0;x<a.length;x++){const v=a[x],w=d[x-1];let k,b,_;{const H=(w==null?void 0:w.search)??e.search,X=(w==null?void 0:w._strictSearch)??void 0;try{const K=gc(v.options.validateSearch,{...H})??void 0;k={...H,...K},b={...X,...K},_=void 0}catch(K){let q=K;if(K instanceof Pc||(q=new Pc(K.message,{cause:K})),t!=null&&t.throwOnError)throw q;k=H,b={},_=q}}const R=((p=(m=v.options).loaderDeps)==null?void 0:p.call(m,{search:k}))??"",j=R?JSON.stringify(R):"",{interpolatedPath:E,usedParams:T}=Mv({path:v.fullPath,params:i,decoder:this.pathParamsDecoder,server:this.isServer}),$=v.id+E+j,L=this.getMatch($),U=h.get(v.id),z=(L==null?void 0:L._strictParams)??T;let Z;if(!L)try{Vv(v,z)}catch(H){if(Bt(H)||on(H)?Z=H:Z=new mI(H.message,{cause:H}),t!=null&&t.throwOnError)throw Z}Object.assign(i,z);const te=U?"stay":"enter";let ae;if(L)ae={...L,cause:te,params:(U==null?void 0:U.params)??i,_strictParams:z,search:Gs(U?U.search:L.search,k),_strictSearch:b};else{const H=v.options.loader||v.options.beforeLoad||v.lazyFn||j1(v)?"pending":"success";ae={id:$,ssr:v.options.ssr,index:x,routeId:v.id,params:(U==null?void 0:U.params)??i,_strictParams:z,pathname:E,updatedAt:Date.now(),search:U?Gs(U.search,k):k,_strictSearch:b,searchError:void 0,status:H,isFetching:!1,error:void 0,paramsError:Z,__routeContext:void 0,_nonReactive:{loadPromise:mi()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:te,loaderDeps:U?Zs(U.loaderDeps,R):R,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:v.options.staticData||{},fullPath:v.fullPath}}t!=null&&t.preload||(ae.globalNotFound=f===v.id),ae.searchError=_;const P=this.getParentContext(w);ae.context={...P,...ae.__routeContext,...ae.__beforeLoadContext},d[x]=ae}for(let x=0;x<d.length;x++){const v=d[x],w=this.looseRoutesById[v.routeId],k=this.getMatch(v.id),b=h.get(v.routeId);if(v.params=b?Gs(b.params,i):i,!k){const _=d[x-1],R=this.getParentContext(_);if(w.options.context){const j={deps:v.loaderDeps,params:v.params,context:R??{},location:e,navigate:E=>this.navigate({...E,_fromLocation:e}),buildLocation:this.buildLocation,cause:v.cause,abortController:v.abortController,preload:!!v.preload,matches:d,routeId:w.id};v.__routeContext=w.options.context(j)??void 0}v.context={...R,...v.__routeContext,...v.__beforeLoadContext}}}return d}matchRoutesLightweight(e){var h;const{matchedRoutes:t,routeParams:n}=this.getMatchedRoutes(e.pathname),s=Ka(t),i={...e.search};for(const m of t)try{Object.assign(i,gc(m.options.validateSearch,i))}catch{}const a=Ka(this.stores.matchesId.get()),u=a&&((h=this.stores.matchStores.get(a))==null?void 0:h.get()),f=u&&u.routeId===s.id&&u.pathname===e.pathname;let d;if(f)d=u.params;else{const m=Object.assign(Object.create(null),n);for(const p of t)try{Vv(p,m)}catch{}d=m}return{matchedRoutes:t,fullPath:s.fullPath,search:i,params:d}}},Pc=class extends Error{},mI=class extends Error{};function yI(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:e,matches:[],statusCode:200}}function gc(e,t){if(e==null)return{};if("~standard"in e){const n=e["~standard"].validate(t);if(n instanceof Promise)throw new Pc("Async validation not supported");if(n.issues)throw new Pc(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return"parse"in e?e.parse(t):typeof e=="function"?e(t):{}}function xI({pathname:e,routesById:t,processedTree:n}){const s=Object.create(null),i=Mr(e);let a;const u=UP(i,n,!0);return u&&(a=u.route,Object.assign(s,u.rawParams)),{matchedRoutes:(u==null?void 0:u.branch)||[t.__root__],routeParams:s,foundRoute:a}}function vI({search:e,dest:t,destRoutes:n,_includeValidateSearch:s}){return SI(n)(e,t,s??!1)}function SI(e){var a;let t,n;const s=[];for(const u of e){const f=u.options;if("search"in f)(a=f.search)!=null&&a.middlewares&&s.push(...f.search.middlewares);else if(f.preSearchFilters||f.postSearchFilters){const h=({search:m,next:p})=>{const x=p(f.preSearchFilters?f.preSearchFilters.reduce((v,w)=>w(v),m):m);return f.postSearchFilters?f.postSearchFilters.reduce((v,w)=>w(v),x):x};s.push(h)}const d=f.validateSearch;if(d){const h=({search:m,next:p,meta:x})=>{const v=p(m);if(n)try{const w=gc(d,v);if(x&&w)for(const k in w)k in v||(x.defaulted||(x.defaulted=new Map)).set(k,w[k]);return{...v,...w}}catch{}return v};s.push(h)}}const i=(u,f,d)=>{if(u>=s.length){if(!t.search)return{};if(t.search===!0)return f;const m=Xs(t.search,f);return d&&(d.explicit=m),m}const h=(m,p)=>{if(p){const x=d||{};return{search:i(u+1,m,x),meta:x}}return i(u+1,m,d)};return s[u]({search:f,next:h,meta:d})};return function(f,d,h){return t=d,n=h,i(0,f)}}function wI(e,t){if(e!=="root")for(let n=t.length-1;n>=0;n--){const s=t[n];if(s.children)return s.id}return no}function Vv(e,t){var s;const n=((s=e.options.params)==null?void 0:s.parse)??e.options.parseParams;if(n){const i=n(t);if(i===!1)throw new Error("Route params.parse returned false for a matched route");Object.assign(t,i)}}function kI(){try{return sessionStorage}catch{return}}const CI="tsr-scroll-restoration-v1_3",di=kI();function bI(){try{return JSON.parse((di==null?void 0:di.getItem("tsr-scroll-restoration-v1_3"))||"{}")}catch{return{}}}function _I(){try{di==null||di.setItem(CI,JSON.stringify(is))}catch{}}const is=bI(),Bv="data-scroll-restoration-id",RI=e=>e.state.__TSR_key||e.href;function EI(e){const t=e.getAttribute(Bv);if(t)return`[${Bv}="${t}"]`;let n="",s=e,i;for(;i=s.parentNode;){let a=1,u=s;for(;u=u.previousElementSibling;)a++;const f=`${s.localName}:nth-child(${a})`;n=n?`${f} > ${n}`:f,s=i}return n}let Ju=!1;const ai="window";function Vg(e){try{return typeof e=="function"?e():document.querySelector(e)}catch{}}function qv(e){const t=[];for(const n of e){if(n===ai)continue;const s=Vg(n);s&&t.push(s)}return t}function PI(e,t){const n=e.options.scrollRestoration,s=e._scroll;n&&(s.restoring=!0);const i=e.options.getScrollRestorationKey||RI,a=new Map,u=(h,m,p)=>{const x=a.get(h)||{};x.scrollX=m,x.scrollY=p,a.set(h,x)},f=h=>{if(!(Ju||!s.restoring))if(h.target===document)u(ai,scrollX,scrollY);else{const m=h.target;u(m,m.scrollLeft,m.scrollTop)}},d=h=>{if(!s.restoring)return;const m=is[h]||(is[h]={});for(const[p,x]of a)p===ai?m[ai]=x:p.isConnected&&(m[EI(p)]=x)};n&&!s.restoration&&(s.restoration=!0,Ju=!1,history.scrollRestoration="manual",document.addEventListener("scroll",f,!0),e.subscribe("onBeforeLoad",h=>{h.fromLocation&&d(i(h.fromLocation)),a.clear()}),addEventListener("pagehide",()=>{d(i(e.stores.resolvedLocation.get()??e.stores.location.get())),_I()})),!s.reset&&(s.reset=!0,e.subscribe("onRendered",h=>{var b;const m=e.options.scrollRestorationBehavior,p=e.options.scrollToTopSelectors,x=s.next;let v;if(a.clear(),x||(s.next=!0),typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation}))return;const w=i(h.toLocation),k=h.fromLocation&&i(h.fromLocation);if(s.restoring&&k&&k!==w){const _=is[k];if(_){let R=is[w];for(const j in _){if(j===ai){if(x)continue}else{const E=Vg(j);if(!E||x&&p&&(v??(v=qv(p)),v.includes(E)))continue}R||(R=is[w]={}),R[j]??(R[j]=_[j])}}}Ju=!0;try{const _=h.toLocation.hash,R=h.toLocation.state.__hashScrollIntoViewOptions??!0;let j=!1;if(x){const E=Ug.get(h.toLocation),T=_&&R&&(E==="PUSH"||E==="REPLACE"),$=s.restoring?is[w]:void 0;if($)for(const L in $){const{scrollX:U,scrollY:z}=$[L];if(L===ai){if(T)continue;scrollTo({top:z,left:U,behavior:m}),j=!0}else{const Z=Vg(L);Z&&(Z.scrollLeft=U,Z.scrollTop=z)}}if(!j&&!_){const L={top:0,left:0,behavior:m};if(scrollTo(L),p){v??(v=qv(p));for(const U of v)U.scrollTo(L)}}}!j&&_&&R&&((b=document.getElementById(_))==null||b.scrollIntoView(R))}finally{Ju=!1}}))}const II="Error preloading route! ☝️";var T1=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=>{var d,h;this.originalIndex=t.originalIndex;const n=this.options,s=!(n!=null&&n.path)&&!(n!=null&&n.id);this.parentRoute=(h=(d=this.options).getParentRoute)==null?void 0:h.call(d),s?this._path=no:this.parentRoute||Tr();let i=s?no:n==null?void 0:n.path;i&&i!=="/"&&(i=_1(i));const a=(n==null?void 0:n.id)||i;let u=s?no:dc([this.parentRoute.id==="__root__"?"":this.parentRoute.id,a]);i==="__root__"&&(i="/"),u!=="__root__"&&(u=dc(["/",u]));const f=u==="__root__"?"/":dc([this.parentRoute.fullPath,i]);this._path=i,this._id=u,this._fullPath=f,this._to=Mr(f)},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!=null&&e.getParentRoute),e!=null&&e.id&&(e!=null&&e.path))throw new Error("Route cannot have both an 'id' and a 'path' option.")}},jI=class extends T1{constructor(e){super(e)}};function Wp(e){const t=e.errorComponent??Gp;return y.jsx(NI,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:s})=>n?V.createElement(t,{error:n,reset:s}):e.children})}var NI=class extends V.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e,t){const n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.error,reset:()=>{this.reset()}})}};function Gp({error:e}){const[t,n]=V.useState(!1);return y.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[y.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),y.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>n(s=>!s),children:t?"Hide Error":"Show Error"})]}),y.jsx("div",{style:{height:".25rem"}}),t?y.jsx("div",{children:y.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?y.jsx("code",{children:e.message}):null})}):null]})}function MI({children:e,fallback:t=null}){return $1()?y.jsx(Ga.Fragment,{children:e}):y.jsx(Ga.Fragment,{children:t})}function $1(){return Ga.useSyncExternalStore(TI,()=>!0,()=>!1)}function TI(){return()=>{}}var F1=V.createContext(null);function En(e){return V.useContext(F1)}var of=V.createContext(void 0),$I=V.createContext(void 0),Je=(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))(Je||{});function FI({update:e,notify:t,unwatched:n}){return{link:s,unlink:i,propagate:a,checkDirty:u,shallowPropagate:f};function s(h,m,p){const x=m.depsTail;if(x!==void 0&&x.dep===h)return;const v=x!==void 0?x.nextDep:m.deps;if(v!==void 0&&v.dep===h){v.version=p,m.depsTail=v;return}const w=h.subsTail;if(w!==void 0&&w.version===p&&w.sub===m)return;const k=m.depsTail=h.subsTail={version:p,dep:h,sub:m,prevDep:x,nextDep:v,prevSub:w,nextSub:void 0};v!==void 0&&(v.prevDep=k),x!==void 0?x.nextDep=k:m.deps=k,w!==void 0?w.nextSub=k:h.subs=k}function i(h,m=h.sub){const p=h.dep,x=h.prevDep,v=h.nextDep,w=h.nextSub,k=h.prevSub;return v!==void 0?v.prevDep=x:m.depsTail=x,x!==void 0?x.nextDep=v:m.deps=v,w!==void 0?w.prevSub=k:p.subsTail=k,k!==void 0?k.nextSub=w:(p.subs=w)===void 0&&n(p),v}function a(h){let m=h.nextSub,p;e:do{const x=h.sub;let v=x.flags;if(v&60?v&12?v&4?!(v&48)&&d(h,x)?(x.flags=v|40,v&=1):v=0:x.flags=v&-9|32:v=0:x.flags=v|32,v&2&&t(x),v&1){const w=x.subs;if(w!==void 0){const k=(h=w).nextSub;k!==void 0&&(p={value:m,prev:p},m=k);continue}}if((h=m)!==void 0){m=h.nextSub;continue}for(;p!==void 0;)if(h=p.value,p=p.prev,h!==void 0){m=h.nextSub;continue e}break}while(!0)}function u(h,m){let p,x=0,v=!1;e:do{const w=h.dep,k=w.flags;if(m.flags&16)v=!0;else if((k&17)===17){if(e(w)){const b=w.subs;b.nextSub!==void 0&&f(b),v=!0}}else if((k&33)===33){(h.nextSub!==void 0||h.prevSub!==void 0)&&(p={value:h,prev:p}),h=w.deps,m=w,++x;continue}if(!v){const b=h.nextDep;if(b!==void 0){h=b;continue}}for(;x--;){const b=m.subs,_=b.nextSub!==void 0;if(_?(h=p.value,p=p.prev):h=b,v){if(e(m)){_&&f(b),m=h.sub;continue}v=!1}else m.flags&=-33;m=h.sub;const R=h.nextDep;if(R!==void 0){h=R;continue e}}return v}while(!0)}function f(h){do{const m=h.sub,p=m.flags;(p&48)===32&&(m.flags=p|16,(p&6)===2&&t(m))}while((h=h.nextSub)!==void 0)}function d(h,m){let p=m.depsTail;for(;p!==void 0;){if(p===h)return!0;p=p.prevDep}return!1}}function LI(e,t,n){var a,u,f;const s=typeof e=="object",i=s?e:void 0;return{next:(a=s?e.next:e)==null?void 0:a.bind(i),error:(u=s?e.error:t)==null?void 0:u.bind(i),complete:(f=s?e.complete:n)==null?void 0:f.bind(i)}}const Bg=[];let pc=0;const{link:Hv,unlink:OI,propagate:AI,checkDirty:L1,shallowPropagate:Wv}=FI({update(e){return e._update()},notify(e){Bg[qg++]=e,e.flags&=~Je.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=Je.Mutable|Je.Dirty,Ic(e))}});let Yu=0,qg=0,dr,Hg=0;function O1(e){try{++Hg,e()}finally{--Hg||A1()}}function Ic(e){const t=e.depsTail;let n=t!==void 0?t.nextDep:e.deps;for(;n!==void 0;)n=OI(n,e)}function A1(){if(!(Hg>0)){for(;Yu<qg;){const e=Bg[Yu];Bg[Yu++]=void 0,e.notify()}Yu=0,qg=0}}function Gv(e,t){const n=typeof e=="function",s=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?Je.None:Je.Mutable,get(){return dr!==void 0&&Hv(i,dr,pc),i._snapshot},subscribe(a){const u=LI(a),f={current:!1},d=DI(()=>{var h;i.get(),f.current?(h=u.next)==null||h.call(u,i._snapshot):f.current=!0});return{unsubscribe:()=>{d.stop()}}},_update(a){const u=dr,f=(t==null?void 0:t.compare)??Object.is;if(n)dr=i,++pc,i.depsTail=void 0;else if(a===void 0)return!1;n&&(i.flags=Je.Mutable|Je.RecursedCheck);try{const d=i._snapshot,h=typeof a=="function"?a(d):a===void 0&&n?s(d):a;return d===void 0||!f(d,h)?(i._snapshot=h,!0):!1}finally{dr=u,n&&(i.flags&=~Je.RecursedCheck),Ic(i)}}};return n?(i.flags=Je.Mutable|Je.Dirty,i.get=function(){const a=i.flags;if(a&Je.Dirty||a&Je.Pending&&L1(i.deps,i)){if(i._update()){const u=i.subs;u!==void 0&&Wv(u)}}else a&Je.Pending&&(i.flags=a&~Je.Pending);return dr!==void 0&&Hv(i,dr,pc),i._snapshot}):i.set=function(a){if(i._update(a)){const u=i.subs;u!==void 0&&(AI(u),Wv(u),A1())}},i}function DI(e){const t=()=>{const s=dr;dr=n,++pc,n.depsTail=void 0,n.flags=Je.Watching|Je.RecursedCheck;try{return e()}finally{dr=s,n.flags&=~Je.RecursedCheck,Ic(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:Je.Watching|Je.RecursedCheck,notify(){const s=this.flags;s&Je.Dirty||s&Je.Pending&&L1(this.deps,this)?t():this.flags=Je.Watching},stop(){this.flags=Je.None,this.depsTail=void 0,Ic(this)}};return t(),n}var Wh={exports:{}},Gh={},Kh={exports:{}},Qh={};/**
|
|
43
|
-
* @license React
|
|
44
|
-
* use-sync-external-store-shim.production.js
|
|
45
|
-
*
|
|
46
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
47
|
-
*
|
|
48
|
-
* This source code is licensed under the MIT license found in the
|
|
49
|
-
* LICENSE file in the root directory of this source tree.
|
|
50
|
-
*/var Kv;function zI(){if(Kv)return Qh;Kv=1;var e=yl();function t(p,x){return p===x&&(p!==0||1/p===1/x)||p!==p&&x!==x}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,i=e.useEffect,a=e.useLayoutEffect,u=e.useDebugValue;function f(p,x){var v=x(),w=s({inst:{value:v,getSnapshot:x}}),k=w[0].inst,b=w[1];return a(function(){k.value=v,k.getSnapshot=x,d(k)&&b({inst:k})},[p,v,x]),i(function(){return d(k)&&b({inst:k}),p(function(){d(k)&&b({inst:k})})},[p]),u(v),v}function d(p){var x=p.getSnapshot;p=p.value;try{var v=x();return!n(p,v)}catch{return!0}}function h(p,x){return x()}var m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:f;return Qh.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:m,Qh}var Qv;function UI(){return Qv||(Qv=1,Kh.exports=zI()),Kh.exports}/**
|
|
51
|
-
* @license React
|
|
52
|
-
* use-sync-external-store-shim/with-selector.production.js
|
|
53
|
-
*
|
|
54
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
55
|
-
*
|
|
56
|
-
* This source code is licensed under the MIT license found in the
|
|
57
|
-
* LICENSE file in the root directory of this source tree.
|
|
58
|
-
*/var Jv;function VI(){if(Jv)return Gh;Jv=1;var e=yl(),t=UI();function n(h,m){return h===m&&(h!==0||1/h===1/m)||h!==h&&m!==m}var s=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,a=e.useRef,u=e.useEffect,f=e.useMemo,d=e.useDebugValue;return Gh.useSyncExternalStoreWithSelector=function(h,m,p,x,v){var w=a(null);if(w.current===null){var k={hasValue:!1,value:null};w.current=k}else k=w.current;w=f(function(){function _($){if(!R){if(R=!0,j=$,$=x($),v!==void 0&&k.hasValue){var L=k.value;if(v(L,$))return E=L}return E=$}if(L=E,s(j,$))return L;var U=x($);return v!==void 0&&v(L,U)?(j=$,L):(j=$,E=U)}var R=!1,j,E,T=p===void 0?null:p;return[function(){return _(m())},T===null?void 0:function(){return _(T())}]},[m,p,x,v]);var b=i(h,w[0],w[1]);return u(function(){k.hasValue=!0,k.value=b},[b]),d(b),b},Gh}var Yv;function BI(){return Yv||(Yv=1,Wh.exports=VI()),Wh.exports}var qI=BI();function HI(e,t){return e===t}function Qt(e,t,n=HI){const s=V.useCallback(u=>{if(!e)return()=>{};const{unsubscribe:f}=e.subscribe(u);return f},[e]),i=V.useCallback(()=>e==null?void 0:e.get(),[e]);return qI.useSyncExternalStoreWithSelector(s,i,i,t,n)}var Jh={get(){},subscribe(){return{unsubscribe(){}}}};function D1(e,t){const n=V.useRef();return s=>{const i=e!=null&&e.select?e.select(s):s;return(e==null?void 0:e.structuralSharing)??t.options.defaultStructuralSharing?n.current=Zs(n.current,i):i}}function xo(e){const t=En(),n=V.useContext(e.from?$I:of),s=e.from?t.stores.getRouteMatchStore(e.from):t.stores.matchStores.get(n),i=D1(e,t),a=Qt(s??Jh,u=>u?i(u):Jh);if(a!==Jh)return a;(e.shouldThrow??!0)&&Tr()}function z1(e){return xo({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function U1(e){const{select:t,...n}=e;return xo({...n,select:s=>t?t(s.loaderDeps):s.loaderDeps})}function V1(e){return xo({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function B1(e){return xo({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function q1(e){const t=En();return V.useCallback(n=>t.navigate({...n,from:n.from??(e==null?void 0:e.from)}),[e==null?void 0:e.from,t])}function H1(e){return xo({...e,select:t=>e.select?e.select(t.context):t.context})}var WI=h1();function GI(e,t){const n=En(),s=jP(t),{activeProps:i,inactiveProps:a,activeOptions:u,to:f,preload:d,preloadDelay:h,preloadIntentProximity:m,hashScrollIntoView:p,replace:x,startTransition:v,resetScroll:w,viewTransition:k,children:b,target:_,disabled:R,style:j,className:E,onClick:T,onBlur:$,onFocus:L,onMouseEnter:U,onMouseLeave:z,onTouchStart:Z,ignoreBlocker:te,params:ae,search:P,hash:H,state:X,mask:K,reloadDocument:q,unsafeRelative:Y,from:se,_fromLocation:ee,...M}=e,J=$1(),pe=V.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),he=Qt(n.stores.location,Oe=>Oe,(Oe,Mt)=>Oe.href===Mt.href),ce=V.useMemo(()=>{const Oe={_fromLocation:he,...pe};return n.buildLocation(Oe)},[n,he,pe]),be=ce.maskedLocation?ce.maskedLocation.publicHref:ce.publicHref,$e=ce.maskedLocation?ce.maskedLocation.external:ce.external,Ce=V.useMemo(()=>ZI(be,$e,n.history,R),[R,$e,be,n.history]),Ee=V.useMemo(()=>{if(Ce!=null&&Ce.external)return Rc(Ce.href,n.protocolAllowlist)?void 0:Ce.href;if(!ej(f)&&!(typeof f!="string"||f.indexOf(":")===-1))try{return new URL(f),Rc(f,n.protocolAllowlist)?void 0:f}catch{}},[f,Ce,n.protocolAllowlist]),lt=V.useMemo(()=>{if(Ee)return!1;if(u!=null&&u.exact){if(!GP(he.pathname,ce.pathname,n.basepath))return!1}else{const Oe=Ec(he.pathname,n.basepath),Mt=Ec(ce.pathname,n.basepath);if(!(Oe.startsWith(Mt)&&(Oe.length===Mt.length||Oe[Mt.length]==="/")))return!1}return((u==null?void 0:u.includeSearch)??!0)&&!to(he.search,ce.search,{partial:!(u!=null&&u.exact),ignoreUndefined:!(u!=null&&u.explicitUndefined)})?!1:u!=null&&u.includeHash?J&&he.hash===ce.hash:!0},[u==null?void 0:u.exact,u==null?void 0:u.explicitUndefined,u==null?void 0:u.includeHash,u==null?void 0:u.includeSearch,he,Ee,J,ce.hash,ce.pathname,ce.search,n.basepath]),Sr=lt?Xs(i,{})??KI:Yh,Ns=lt?Yh:Xs(a,{})??Yh,Ms=[E,Sr.className,Ns.className].filter(Boolean).join(" "),Eo=(j||Sr.style||Ns.style)&&{...j,...Sr.style,...Ns.style},[Al,$i]=V.useState(!1),Po=V.useRef(!1),wr=e.reloadDocument||Ee?!1:d??n.options.defaultPreload,Ts=h??n.options.defaultPreloadDelay??0,hn=V.useCallback(()=>{n.preloadRoute({...pe,_builtLocation:ce}).catch(Oe=>{console.warn(Oe),console.warn(II)})},[n,pe,ce]);IP(s,V.useCallback(Oe=>{Oe!=null&&Oe.isIntersecting&&hn()},[hn]),XI,{disabled:!!R||wr!=="viewport"}),V.useEffect(()=>{Po.current||!R&&wr==="render"&&(hn(),Po.current=!0)},[R,hn,wr]);const zr=Oe=>{const Mt=Oe.currentTarget.getAttribute("target"),Bn=_!==void 0?_:Mt;if(!R&&!tj(Oe)&&!Oe.defaultPrevented&&(!Bn||Bn==="_self")&&Oe.button===0){Oe.preventDefault(),WI.flushSync(()=>{$i(!0)});const jo=n.subscribe("onResolved",()=>{jo(),$i(!1)});n.navigate({...pe,replace:x,resetScroll:w,hashScrollIntoView:p,startTransition:v,viewTransition:k,ignoreBlocker:te})}};if(Ee)return{...M,ref:s,href:Ee,...b&&{children:b},..._&&{target:_},...R&&{disabled:R},...j&&{style:j},...E&&{className:E},...T&&{onClick:T},...$&&{onBlur:$},...L&&{onFocus:L},...U&&{onMouseEnter:U},...z&&{onMouseLeave:z},...Z&&{onTouchStart:Z}};const Io=Oe=>{if(R||wr!=="intent")return;if(!Ts){hn();return}const Mt=Oe.currentTarget;if(Ca.has(Mt))return;const Bn=setTimeout(()=>{Ca.delete(Mt),hn()},Ts);Ca.set(Mt,Bn)},Dl=Oe=>{R||wr!=="intent"||hn()},Fi=Oe=>{if(R||!wr||!Ts)return;const Mt=Oe.currentTarget,Bn=Ca.get(Mt);Bn&&(clearTimeout(Bn),Ca.delete(Mt))};return{...M,...Sr,...Ns,href:Ce==null?void 0:Ce.href,ref:s,onClick:ti([T,zr]),onBlur:ti([$,Fi]),onFocus:ti([L,Io]),onMouseEnter:ti([U,Io]),onMouseLeave:ti([z,Fi]),onTouchStart:ti([Z,Dl]),disabled:!!R,target:_,...Eo&&{style:Eo},...Ms&&{className:Ms},...R&&QI,...lt&&JI,...J&&Al&&YI}}var Yh={},KI={className:"active"},QI={role:"link","aria-disabled":!0},JI={"data-status":"active","aria-current":"page"},YI={"data-transitioning":"transitioning"},Ca=new WeakMap,XI={rootMargin:"100px"},ti=e=>t=>{for(const n of e)if(n){if(t.defaultPrevented)return;n(t)}};function ZI(e,t,n,s){if(!s)return t?{href:e,external:!0}:{href:n.createHref(e)||"/",external:!1}}function ej(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var Kp=V.forwardRef((e,t)=>{const{_asChild:n,...s}=e,{type:i,...a}=GI(s,t),u=typeof s.children=="function"?s.children({isActive:a["data-status"]==="active"}):s.children;if(!n){const{disabled:f,...d}=a;return V.createElement("a",d,u)}return V.createElement(n,a,u)});function tj(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var nj=class extends T1{constructor(e){super(e),this.useMatch=t=>xo({select:t==null?void 0:t.select,from:this.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>H1({...t,from:this.id}),this.useSearch=t=>B1({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useParams=t=>V1({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useLoaderDeps=t=>U1({...t,from:this.id}),this.useLoaderData=t=>z1({...t,from:this.id}),this.useNavigate=()=>q1({from:this.fullPath}),this.Link=Ga.forwardRef((t,n)=>y.jsx(Kp,{ref:n,from:this.fullPath,...t}))}};function W1(e){return new nj(e)}var rj=class extends jI{constructor(e){super(e),this.useMatch=t=>xo({select:t==null?void 0:t.select,from:this.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>H1({...t,from:this.id}),this.useSearch=t=>B1({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useParams=t=>V1({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useLoaderDeps=t=>U1({...t,from:this.id}),this.useLoaderData=t=>z1({...t,from:this.id}),this.useNavigate=()=>q1({from:this.fullPath}),this.Link=Ga.forwardRef((t,n)=>y.jsx(Kp,{ref:n,from:this.fullPath,...t}))}};function sj(e){return new rj(e)}function oj(e){const t=En(),n=`not-found-${Qt(t.stores.location,s=>s.pathname)}-${Qt(t.stores.status,s=>s)}`;return y.jsx(Wp,{getResetKey:()=>n,onCatch:(s,i)=>{var a;if(Bt(s))(a=e.onCatch)==null||a.call(e,s,i);else throw s},errorComponent:({error:s})=>{var i;if(Bt(s))return(i=e.fallback)==null?void 0:i.call(e,s);throw s},children:e.children})}function ij(){return y.jsx("p",{children:"Not Found"})}function li(e){return y.jsx(y.Fragment,{children:e.children})}function G1(e,t,n){return t.options.notFoundComponent?y.jsx(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?y.jsx(e.options.defaultNotFoundComponent,{...n}):y.jsx(ij,{})}function aj(e){return null}function lj(){return aj(En()),null}var uj=(e,t)=>e.routeId===t.routeId&&e._displayPending===t._displayPending,cj=(e,t)=>e[0]===t[0]&&e[1]===t[1],K1=V.memo(function({matchId:t}){const n=En(),s=n.stores.matchStores.get(t);s||Tr();const i=Qt(n.stores.loadedAt,u=>u),a=Qt(s,u=>u,uj);return y.jsx(fj,{router:n,matchId:t,resetKey:i,matchState:V.useMemo(()=>{var d;const u=a.routeId,f=(d=n.routesById[u].parentRoute)==null?void 0:d.id;return{routeId:u,ssr:a.ssr,_displayPending:a._displayPending,parentRouteId:f}},[a._displayPending,a.routeId,a.ssr,n.routesById])})});function fj({router:e,matchId:t,resetKey:n,matchState:s}){var w,k;const i=e.routesById[s.routeId],a=i.options.pendingComponent??e.options.defaultPendingComponent,u=a?y.jsx(a,{}):null,f=i.options.errorComponent??e.options.defaultErrorComponent,d=i.options.onCatch??e.options.defaultOnCatch,h=i.isRoot?i.options.notFoundComponent??((w=e.options.notFoundRoute)==null?void 0:w.options.component):i.options.notFoundComponent,m=s.ssr===!1||s.ssr==="data-only",p=(!i.isRoot||i.options.wrapInSuspense||m)&&(i.options.wrapInSuspense??a??(((k=i.options.errorComponent)==null?void 0:k.preload)||m))?V.Suspense:li,x=f?Wp:li,v=h?oj:li;return y.jsxs(i.isRoot?i.options.shellComponent??li:li,{children:[y.jsx(of.Provider,{value:t,children:y.jsx(p,{fallback:u,children:y.jsx(x,{getResetKey:()=>n,errorComponent:f||Gp,onCatch:(b,_)=>{if(Bt(b))throw b.routeId??(b.routeId=s.routeId),b;d==null||d(b,_)},children:y.jsx(v,{fallback:b=>{if(b.routeId??(b.routeId=s.routeId),!h||b.routeId&&b.routeId!==s.routeId||!b.routeId&&!i.isRoot)throw b;return V.createElement(h,b)},children:m||s._displayPending?y.jsx(MI,{fallback:u,children:y.jsx(Xv,{matchId:t})}):y.jsx(Xv,{matchId:t})})})})}),s.parentRouteId===no?y.jsxs(y.Fragment,{children:[y.jsx(dj,{}),e.options.scrollRestoration&&x1?y.jsx(lj,{}):null]}):null]})}function dj(){const e=En(),t=V.useRef();return Ma(()=>{const n=e.stores.resolvedLocation.get(),s=t.current;n&&(!s||s.href!==n.href)&&e.emit({type:"onRendered",...fi(e.stores.location.get(),s??n)}),t.current=n},[Qt(e.stores.resolvedLocation,n=>n==null?void 0:n.state.__TSR_key),e]),null}var Xv=V.memo(function({matchId:t}){const n=En(),s=(m,p)=>{var x;return((x=n.getMatch(m.id))==null?void 0:x._nonReactive[p])??m._nonReactive[p]},i=n.stores.matchStores.get(t);i||Tr();const a=Qt(i,m=>m),u=a.routeId,f=n.routesById[u],d=V.useMemo(()=>{var p;const m=(p=n.routesById[u].options.remountDeps??n.options.defaultRemountDeps)==null?void 0:p({routeId:u,loaderDeps:a.loaderDeps,params:a._strictParams,search:a._strictSearch});return m?JSON.stringify(m):void 0},[u,a.loaderDeps,a._strictParams,a._strictSearch,n.options.defaultRemountDeps,n.routesById]),h=V.useMemo(()=>{const m=f.options.component??n.options.defaultComponent;return m?y.jsx(m,{},d):y.jsx(Q1,{})},[d,f.options.component,n.options.defaultComponent]);if(a._displayPending)throw s(a,"displayPendingPromise");if(a._forcePending)throw s(a,"minPendingPromise");if(a.status==="pending"){const m=f.options.pendingMinMs??n.options.defaultPendingMinMs;if(m){const p=n.getMatch(a.id);if(p&&!p._nonReactive.minPendingPromise){const x=mi();p._nonReactive.minPendingPromise=x,setTimeout(()=>{x.resolve(),p._nonReactive.minPendingPromise=void 0},m)}}throw s(a,"loadPromise")}if(a.status==="notFound")return Bt(a.error)||Tr(),G1(n,f,a.error);if(a.status==="redirected")throw on(a.error)||Tr(),s(a,"loadPromise");if(a.status==="error")throw a.error;return h}),Q1=V.memo(function(){const t=En(),n=V.useContext(of);let s,i=!1,a;{const h=n?t.stores.matchStores.get(n):void 0;[s,i]=Qt(h,m=>[m==null?void 0:m.routeId,(m==null?void 0:m.globalNotFound)??!1],cj),a=Qt(t.stores.matchesId,m=>m[m.findIndex(p=>p===n)+1])}const u=s?t.routesById[s]:void 0,f=t.options.defaultPendingComponent?y.jsx(t.options.defaultPendingComponent,{}):null;if(i)return u||Tr(),G1(t,u,void 0);if(!a)return null;const d=y.jsx(K1,{matchId:a});return s===no?y.jsx(V.Suspense,{fallback:f,children:d}):d});function hj(){const e=En(),t=V.useRef({router:e,mounted:!1}),[n,s]=V.useState(!1),i=Qt(e.stores.isLoading,p=>p),a=Qt(e.stores.hasPending,p=>p),u=Dh(i),f=i||n||a,d=Dh(f),h=i||a,m=Dh(h);return e.startTransition=p=>{s(!0),V.startTransition(()=>{p(),s(!1)})},V.useEffect(()=>{const p=e.history.subscribe(e.load),x=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Mr(e.latestLocation.publicHref)!==Mr(x.publicHref)&&e.commitLocation({...x,replace:!0}),()=>{p()}},[e,e.history]),Ma(()=>{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(x){console.error(x)}})()},[e]),Ma(()=>{u&&!i&&e.emit({type:"onLoad",...fi(e.stores.location.get(),e.stores.resolvedLocation.get())})},[u,e,i]),Ma(()=>{m&&!h&&e.emit({type:"onBeforeRouteMount",...fi(e.stores.location.get(),e.stores.resolvedLocation.get())})},[h,m,e]),Ma(()=>{if(d&&!f){const p=fi(e.stores.location.get(),e.stores.resolvedLocation.get());e.emit({type:"onResolved",...p}),O1(()=>{e.stores.status.set("idle"),e.stores.resolvedLocation.set(e.stores.location.get())})}},[f,d,e]),null}function gj(){const e=En(),t=e.routesById[no].options.pendingComponent??e.options.defaultPendingComponent,n=t?y.jsx(t,{}):null,s=y.jsxs(typeof document<"u"&&e.ssr?li:V.Suspense,{fallback:n,children:[y.jsx(hj,{}),y.jsx(pj,{})]});return e.options.InnerWrap?y.jsx(e.options.InnerWrap,{children:s}):s}function pj(){const e=En(),t=Qt(e.stores.firstId,i=>i),n=Qt(e.stores.loadedAt,i=>i),s=t?y.jsx(K1,{matchId:t}):null;return y.jsx(of.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?s:y.jsx(Wp,{getResetKey:()=>n,errorComponent:Gp,onCatch:void 0,children:s})})}var mj=e=>({createMutableStore:Gv,createReadonlyStore:Gv,batch:O1}),yj=e=>new xj(e),xj=class extends pI{constructor(e){super(e,mj)}};function vj({router:e,children:t,...n}){S1(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});const s=y.jsx(F1.Provider,{value:e,children:t});return e.options.Wrap?y.jsx(e.options.Wrap,{children:s}):s}function Sj({router:e,...t}){return y.jsx(vj,{router:e,...t,children:y.jsx(gj,{})})}function wj(e){const t=En({warn:(e==null?void 0:e.router)===void 0}),n=(e==null?void 0:e.router)||t;return Qt(n.stores.__store,D1(e,n))}const Za="#8d9090",vn={green:"#6caa71",greenBright:"#79be7e",cyan:"#7ccbcd",cyanBright:"#84dde0",blue:"#6d96b4",blueBright:"#67b5ed",magenta:"#bd7bcd",magentaBright:"#d389e5",yellow:"#c4ac62",yellowBright:"#d9c074",red:"#b45648",redBright:"#cf6a5a",white:"#dee5eb",whiteBright:"#f3f5f5",gray:Za,grey:Za},kj={claude:vn.green,codex:vn.cyan,cursor:vn.magenta,copilot:vn.white,pi:vn.blue,opencode:vn.yellow,antigravity:vn.red,gemini:vn.greenBright};function Cj(e){return e?e.startsWith("#")?e:vn[e]??Za:Za}const so=Cj;function bj(e){return kj[e]??Za}const Zv=["#00d7ff","#00d787","#e6b450","#d75f87","#5f87ff","#af87ff","#5fd7a7","#ff8787","#d7af5f","#87d7ff","#d787d7","#9ee493","#ffb454","#7aa2f7","#bb9af7"],eS=new Map;function Qp(e){const t=eS.get(e);if(t)return t;let n=0;for(let i=0;i<e.length;i++)n=n*31+e.charCodeAt(i)>>>0;const s=Zv[n%Zv.length];return eS.set(e,s),s}const z5={input:vn.blue,output:vn.green,cacheCreate:vn.yellow,cacheRead:vn.cyan};function Or(e){return e.replace(/^claude-/,"").replace(/^gpt-/,"gpt-").replace(/-\d{8}$/,"").replace(/-latest$/,"")}const tS=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ue(e,t={}){if(!Number.isFinite(e))return"$0.00";const n=t.sign&&e>0?"+":"",s=Math.abs(e);return s>=1e5?`${n}$${(e/1e3).toFixed(0)}k`:s>=1e4?`${n}$${(e/1e3).toFixed(1)}k`:s>=1?`${n}$${e.toFixed(2)}`:s>=.01?`${n}$${e.toFixed(3)}`:s===0?"$0.00":`${n}$${e.toFixed(4)}`}function U5(e){if(!Number.isFinite(e))return"$0";const t=Math.abs(e);return t>=1e6?`$${(e/1e6).toFixed(1).replace(/\.0$/,"")}M`:t>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:t>=1?`$${Math.round(e)}`:t===0?"$0":`$${e.toFixed(2)}`}function wn(e){if(!Number.isFinite(e)||e===0)return"0";const t=Math.abs(e);return t>=1e9?`${(e/1e9).toFixed(2)}B`:t>=1e6?`${(e/1e6).toFixed(2)}M`:t>=1e3?`${(e/1e3).toFixed(1)}k`:String(Math.round(e))}function bs(e){return Number.isFinite(e)?Math.round(e).toLocaleString("en-US"):"0"}function J1(e){if(!Number.isFinite(e))return"0";const t=Math.abs(e);return t>=1e6?`${(e/1e6).toFixed(1)}M`:t>=1e4?`${Math.round(e/1e3)}k`:Math.round(e).toLocaleString("en-US")}function Y1(e,t=0){return Number.isFinite(e)?`${(e*100).toFixed(t)}%`:"0%"}function _j(e,t){const n=Math.max(0,Math.round((t-e)/1e3));if(n<2)return"just now";if(n<60)return`${n}s ago`;const s=Math.round(n/60);if(s<60)return`${s}m ago`;const i=Math.round(s/60);return i<24?`${i}h ago`:`${Math.round(i/24)}d ago`}function el(e){const t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(t)return`${tS[Number(t[2])-1]} ${Number(t[3])}`;const n=/^(\d{4})-(\d{2})$/.exec(e);return n?`${tS[Number(n[2])-1]} ${n[1]}`:e}function tl(e){return e.input+e.output+e.cacheCreate+e.cacheRead}const ds=864e5,Rj=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],$r=e=>{const[t,n,s]=e.split("-").map(Number);return Date.UTC(t,(n||1)-1,s||1)},vl=e=>new Date(e).toISOString().slice(0,10),Ej=e=>{try{return new Intl.DateTimeFormat("en-CA",{timeZone:e||void 0,year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date)}catch{return new Date().toISOString().slice(0,10)}},nl=e=>(new Date(e).getUTCDay()+6)%7,Pj=e=>{const t=$r(e);return vl(t-nl(t)*ds)},Ij={period:"all"},X1=[{key:"7d",label:"7 days"},{key:"30d",label:"30 days"},{key:"90d",label:"90 days"},{key:"mtd",label:"month"},{key:"all",label:"6 months"}];function Z1(e){return e.providers.length?new Set(e.providers):null}function Jp(e,t){const n=Z1(t);return e.accounts.filter(s=>!(!s.hasUsage||t.account!=="all"&&s.id!==t.account||n&&!n.has(s.providerId)))}function Wg(e){var t,n,s,i,a,u,f,d,h;return!!(e.hasBilling&&((n=(t=e.billing)==null?void 0:t.metrics)!=null&&n.length||(s=e.billing)!=null&&s.plan||(i=e.billing)!=null&&i.error||(f=(u=(a=e.billing)==null?void 0:a.activity)==null?void 0:u.series)!=null&&f.length||(h=(d=e.billing)==null?void 0:d.modelSpend)!=null&&h.length))}function jj(e,t){const n=Z1(t);return e.accounts.filter(s=>!(!s.hasUsage&&!Wg(s)||t.account!=="all"&&s.id!==t.account||n&&!n.has(s.providerId)))}function ek(e){var n;let t=null;for(const s of e)for(const i of((n=s.table)==null?void 0:n.daily)??[])(!t||i.label>t)&&(t=i.label);return t}function tk(e,t,n){if(!t||e==="all")return null;if(e==="mtd")return Ej(n).slice(0,7)+"-01";const s=e==="7d"?7:e==="90d"?90:30;return vl($r(t)-(s-1)*ds)}function Nj(e,t,n,s){if(!n||e==="all")return null;const i=tk(e,n,s);if(t==="daily")return i;const a=t==="monthly"?365:84,u=vl($r(n)-(a-1)*ds);return i&&i<u?i:u}function Mj(e){return e.reduce((t,n)=>(t.input+=n.input,t.output+=n.output,t.cacheCreate+=n.cacheCreate,t.cacheRead+=n.cacheRead,t.cacheSavings+=n.cacheSavings,t.cost+=n.cost,t.count+=n.count,t),{input:0,output:0,cacheCreate:0,cacheRead:0,cacheSavings:0,cost:0,count:0})}function Tj(e,t,n){var h;if(!e)return[];const s=Jp(e,t),i=ek(s),a=Nj(t.period,n,i,e.tz),u=a?n==="monthly"?a.slice(0,7):n==="weekly"?Pj(a):a:null,f=t.models.length?new Set(t.models):null,d=new Map;for(const m of s)for(const p of((h=m.table)==null?void 0:h[n])??[]){if(u&&p.label<u)continue;const x=f?p.breakdown.filter(k=>f.has(k.name)):p.breakdown;if(f&&x.length===0)continue;const v=d.get(p.label),w=Mj(x);if(!v)d.set(p.label,{label:p.label,models:x.map(k=>k.name).sort(),...w,total:tl(w),breakdown:x.map(k=>({...k}))});else{v.input+=w.input,v.output+=w.output,v.cacheCreate+=w.cacheCreate,v.cacheRead+=w.cacheRead,v.cacheSavings+=w.cacheSavings,v.total+=tl(w),v.cost+=w.cost,v.count+=w.count;const k=new Map(v.breakdown.map(b=>[b.name,b]));for(const b of x){const _=k.get(b.name);_?(_.input+=b.input,_.output+=b.output,_.cacheCreate+=b.cacheCreate,_.cacheRead+=b.cacheRead,_.cacheSavings+=b.cacheSavings,_.cost+=b.cost,_.count+=b.count):k.set(b.name,{...b})}v.breakdown=[...k.values()].sort((b,_)=>_.cost-b.cost),v.models=v.breakdown.map(b=>b.name)}}return[...d.values()]}const $j=()=>({cost:0,tokens:0,cacheSavings:0,calls:0}),Fj=(e,t,n,s,i)=>{e.cost+=t,e.tokens+=n,e.cacheSavings+=s,e.calls+=i};function Lj(){return{totals:$j(),burnRate:0,timelineMap:new Map,cacheByDay:new Map,provAgg:new Map,modelAgg:new Map,modelTrend:new Map,modelOptionSet:new Set,tokenComposition:{input:0,output:0,cacheCreate:0,cacheRead:0}}}function Oj(e,t,n,s,i){let a=0,u=0,f=0,d=0;for(const p of t.breakdown){if(e.modelOptionSet.add(p.name),i&&!i.has(p.name))continue;const x=tl(p);a+=p.cost,u+=x,f+=p.cacheSavings,d+=p.count,e.tokenComposition.input+=p.input,e.tokenComposition.output+=p.output,e.tokenComposition.cacheCreate+=p.cacheCreate,e.tokenComposition.cacheRead+=p.cacheRead;const v=e.modelAgg.get(p.name)??{cost:0,tokens:0,cacheSavings:0,calls:0};v.cost+=p.cost,v.tokens+=x,v.cacheSavings+=p.cacheSavings,v.calls+=p.count,e.modelAgg.set(p.name,v);let w=e.modelTrend.get(p.name);w||(w=new Map,e.modelTrend.set(p.name,w)),w.set(t.label,(w.get(t.label)??0)+p.cost)}if(i&&d===0&&a===0)return;Fj(e.totals,a,u,f,d);const h=e.timelineMap.get(t.label)??{date:t.label,total:0,tokens:0,byProvider:{}};h.total+=a,h.tokens+=u,h.byProvider[n]=(h.byProvider[n]??0)+a,e.timelineMap.set(t.label,h),e.cacheByDay.set(t.label,(e.cacheByDay.get(t.label)??0)+f);const m=e.provAgg.get(n)??{id:n,name:n,color:s,cost:0,tokens:0,calls:0};m.cost+=a,m.tokens+=u,m.calls+=d,e.provAgg.set(n,m)}function Aj(e){return[...e.timelineMap.values()].sort((t,n)=>t.date.localeCompare(n.date))}function Dj(e,t,n){const s=t.map(i=>i.date);return[...e.modelAgg.entries()].map(([i,a])=>{const u=e.modelTrend.get(i);return{model:i,color:Qp(i),cost:a.cost,tokens:a.tokens,cacheSavings:a.cacheSavings,calls:a.calls,share:n>0?a.cost/n:0,tokenShare:e.totals.tokens>0?a.tokens/e.totals.tokens:0,callShare:e.totals.calls>0?a.calls/e.totals.calls:0,trend:s.map(f=>(u==null?void 0:u.get(f))??0)}}).sort((i,a)=>a.cost-i.cost)}function zj(e,t){var R,j,E;const n=e?Jp(e,t):[],s=ek(n),i=tk(t.period,s,(e==null?void 0:e.tz)??""),a=t.models.length?new Set(t.models):null,u=new Map,f=new Map;for(const T of(e==null?void 0:e.providers)??[])u.set(T.id,T.color),f.set(T.id,T.name);const d=Lj(),h=T=>!i||T>=i;for(const T of n){d.burnRate+=((R=T.dashboard)==null?void 0:R.burnRate)??0;const $=T.providerId,L=u.get($)??T.color;for(const U of((j=T.table)==null?void 0:j.daily)??[])h(U.label)&&Oj(d,U,$,L,a)}for(const T of d.provAgg.values()){const $=f.get(T.id);$&&(T.name=$)}const m=Aj(d);let p=0;const x=m.map(T=>(p+=T.total,{date:T.date,total:p})),v=m.map(T=>({date:T.date,value:d.cacheByDay.get(T.date)??0})),w=new Map;for(const T of n)for(const $ of((E=T.table)==null?void 0:E.daily)??[]){if(!h($.label))continue;const L=a?$.breakdown.filter(z=>a.has(z.name)):$.breakdown;if(a&&L.length===0)continue;let U=w.get($.label);U||(U={tokens:0,calls:0,cacheSavings:0,models:new Map},w.set($.label,U));for(const z of L)U.tokens+=tl(z),U.calls+=z.count,U.cacheSavings+=z.cacheSavings,U.models.set(z.name,(U.models.get(z.name)??0)+z.cost)}const k=m.map(T=>{const $=w.get(T.date);return{date:T.date,cost:T.total,tokens:($==null?void 0:$.tokens)??0,calls:($==null?void 0:$.calls)??0,cacheSavings:($==null?void 0:$.cacheSavings)??0,models:$?[...$.models.entries()].map(([L,U])=>({name:L,cost:U})).sort((L,U)=>U.cost-L.cost):[]}}),b=[...d.provAgg.values()].sort((T,$)=>$.cost-T.cost),_=Dj(d,m,d.totals.cost);return{filteredAccounts:n,totals:d.totals,burnRate:d.burnRate,timeline:m,cumulative:x,cacheSavingsSeries:v,calendar:k,cardAccounts:e?jj(e,t):[],byProvider:b,byModel:_,tokenComposition:d.tokenComposition,modelOptions:[...d.modelOptionSet].sort(),latestDay:s,rangeStart:i}}function Wt({children:e,className:t="size-4",...n}){return y.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round",className:t,"aria-hidden":!0,...n,children:e})}const Uj=e=>y.jsxs(Wt,{...e,children:[y.jsx("path",{d:"M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"}),y.jsx("circle",{cx:"12",cy:"13",r:"4"})]}),yi=e=>y.jsx(Wt,{...e,children:y.jsx("path",{d:"M20 6 9 17l-5-5"})}),Vj=e=>y.jsxs(Wt,{...e,children:[y.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),y.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),Bj=e=>y.jsxs(Wt,{...e,children:[y.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),y.jsx("path",{d:"m7 10 5 5 5-5"}),y.jsx("path",{d:"M12 15V3"})]}),Xh=e=>y.jsx(Wt,{...e,children:y.jsx("path",{d:"M3 6.5A2.5 2.5 0 0 1 5.5 4H9l2 2h7.5A2.5 2.5 0 0 1 21 8.5v8A2.5 2.5 0 0 1 18.5 19h-13A2.5 2.5 0 0 1 3 16.5z"})}),qj=e=>y.jsxs(Wt,{...e,children:[y.jsx("path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8"}),y.jsx("path",{d:"m16 6-4-4-4 4"}),y.jsx("path",{d:"M12 2v13"})]}),Yp=e=>y.jsx(Wt,{...e,children:y.jsx("path",{d:"m6 9 6 6 6-6"})}),Hj=e=>y.jsxs(Wt,{...e,children:[y.jsx("circle",{cx:"11",cy:"11",r:"8"}),y.jsx("path",{d:"m21 21-4.3-4.3"})]}),xi=e=>y.jsxs(Wt,{...e,children:[y.jsx("path",{d:"M18 6 6 18"}),y.jsx("path",{d:"m6 6 12 12"})]}),Wj=e=>y.jsxs(Wt,{...e,children:[y.jsx("circle",{cx:"12",cy:"12",r:"4"}),y.jsx("path",{d:"M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"})]}),Gj=e=>y.jsx(Wt,{...e,children:y.jsx("path",{d:"M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"})}),Kj=e=>y.jsxs(Wt,{...e,children:[y.jsx("circle",{cx:"12",cy:"12",r:"3"}),y.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),Qj=e=>y.jsx(Wt,{...e,children:y.jsx("path",{d:"M12 5v14M5 12h14"})}),Jj=e=>y.jsx(Wt,{...e,children:y.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m3 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"})}),nS=e=>y.jsxs(Wt,{...e,children:[y.jsx("path",{d:"M12 20h9"}),y.jsx("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4z"})]}),nk=e=>y.jsx(Wt,{...e,children:y.jsx("path",{d:"m18 15-6-6-6 6"})}),Xp="focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent";function Sn({options:e,value:t,onChange:n,size:s="sm",btnClassName:i,containerClassName:a,ariaLabel:u}){const f="flex items-center overflow-hidden rounded border border-line",d=s==="xs"?"px-1.5 py-0.5 text-[10px] transition max-sm:py-1.5":"px-2 py-1 text-xs transition max-sm:py-2",h=s==="xs"?"bg-bg-3 text-accent":"bg-bg-2 text-accent",m=s==="xs"?"text-fg-faint hover:text-fg":"text-fg-dim hover:text-fg";return y.jsx("div",{className:a??f,role:"group","aria-label":u,children:e.map(p=>y.jsx("button",{type:"button","aria-pressed":t===p.value,onClick:()=>n(p.value),className:`${i??d} ${Xp} ${t===p.value?h:m}`,children:p.label},String(p.value)))})}function rS({label:e,value:t,children:n}){const[s,i]=V.useState(!1),a=V.useRef(null);return V.useEffect(()=>{if(!s)return;const u=d=>{a.current&&!a.current.contains(d.target)&&i(!1)},f=d=>{d.key==="Escape"&&i(!1)};return document.addEventListener("mousedown",u),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",f)}},[s]),y.jsxs("div",{ref:a,className:"relative",children:[y.jsxs("button",{type:"button","aria-haspopup":"menu","aria-expanded":s,onClick:()=>i(u=>!u),className:`flex items-center gap-1.5 rounded border border-line bg-bg-1 px-2 py-1 text-xs text-fg-dim transition hover:border-line-2 hover:text-fg max-sm:py-2 ${Xp}`,children:[y.jsxs("span",{className:"text-fg-faint",children:[e,":"]}),y.jsx("span",{className:"text-fg",children:t}),y.jsx(Yp,{className:`size-3 transition ${s?"rotate-180":""}`})]}),s&&y.jsx("div",{role:"menu",className:"absolute right-0 z-50 mt-1 min-w-44 max-w-[calc(100vw-2.5rem)] rounded-md border border-line-2 bg-bg-2 p-1 shadow-xl",children:n(()=>i(!1))})]})}function sS({children:e}){return y.jsx("div",{className:"flex flex-col",children:e})}function Xu({active:e,onClick:t,children:n}){return y.jsx("button",{type:"button",role:"menuitem",onClick:t,className:`flex min-w-0 items-center gap-2 rounded px-2 py-1 text-left text-xs transition ${Xp} ${e?"bg-bg-3 text-fg-bright":"text-fg-dim hover:bg-bg-3 hover:text-fg"}`,children:n})}function Yj({snapshot:e,derived:t,filters:n,setFilters:s}){const i=(e==null?void 0:e.providers)??[],u=((e==null?void 0:e.accounts)??[]).filter(_=>_.hasUsage),f=new Set(u.map(_=>_.providerId)),d=i.filter(_=>f.has(_.id)),h=new Set(t.cardAccounts.map(_=>_.providerId)),m=i.filter(_=>!f.has(_.id)&&h.has(_.id)),p=n.providers.length?u.filter(_=>n.providers.includes(_.providerId)):u,x=_=>{var R;return((R=i.find(j=>j.id===_))==null?void 0:R.name)??_},v=_=>_.name&&_.name!==x(_.providerId)?`${x(_.providerId)} · ${_.name}`:x(_.providerId),w=u.find(_=>_.id===n.account),k=_=>s(R=>{const j=R.providers.includes(_);return{...R,providers:j?R.providers.filter(E=>E!==_):[...R.providers,_]}}),b=n.providers.length>0||n.models.length>0||n.account!=="all";return y.jsx("div",{className:"border-t border-line bg-bg-0/70",children:y.jsxs("div",{className:"mx-auto flex max-w-[1600px] flex-wrap items-center gap-x-4 gap-y-2 px-5 py-2.5 2xl:max-w-[1920px]",children:[y.jsx("span",{className:"hidden text-xs text-fg-faint sm:inline",children:"filter:"}),y.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[d.map(_=>{const R=n.providers.includes(_.id),j=n.providers.length>0&&!R;return y.jsxs("button",{type:"button","aria-pressed":R,onClick:()=>k(_.id),className:"flex items-center gap-1.5 rounded border px-2 py-0.5 text-xs transition focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent max-sm:py-1.5",style:{borderColor:R?_.color:"var(--color-line)",color:j?"var(--color-fg-faint)":R?_.color:"var(--color-fg-dim)",background:R?"var(--color-bg-2)":"transparent"},title:R?`hide ${_.name}`:n.providers.length?`add ${_.name}`:`show only ${_.name}`,children:[y.jsx("span",{style:{color:_.color,opacity:j?.4:1},"aria-hidden":!0,children:R?"●":"○"}),_.name]},_.id)}),m.length>0&&y.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-fg-faint",title:"Billing-only providers — shown as cards with plan & quota; no usage timeline to filter",children:[d.length>0&&y.jsx("span",{className:"text-line-2",children:"|"}),y.jsx("span",{children:"billing-only:"}),m.map(_=>y.jsxs("span",{className:"flex items-center gap-1 text-fg-dim",children:[y.jsx("span",{style:{color:_.color,opacity:.55},"aria-hidden":!0,children:"·"}),_.name]},_.id))]})]}),y.jsxs("div",{className:"flex w-full flex-wrap items-center gap-2 md:ml-auto md:w-auto",children:[p.length>1?y.jsx(rS,{label:"account",value:n.account==="all"?"all":w?v(w):"all",children:_=>y.jsxs(sS,{children:[y.jsx(Xu,{active:n.account==="all",onClick:()=>{s(R=>({...R,account:"all"})),_()},children:"All accounts"}),y.jsx("div",{className:"my-1 h-px bg-line"}),y.jsx("div",{className:"max-h-64 overflow-y-auto",children:p.map(R=>y.jsxs(Xu,{active:n.account===R.id,onClick:()=>{s(j=>({...j,account:R.id})),_()},children:[y.jsx("span",{style:{color:R.color},"aria-hidden":!0,children:"●"})," ",y.jsx("span",{className:"truncate",children:v(R)})]},R.id))})]})}):p.length===1?y.jsxs("span",{className:"rounded border border-line bg-bg-1 px-2 py-1 text-xs text-fg-dim",children:["account: ",y.jsx("span",{className:"text-fg",children:v(p[0])})]}):null,y.jsx(rS,{label:"model",value:n.models.length===0?"all":n.models.length===1?Or(n.models[0]):`${n.models.length} models`,children:()=>y.jsxs(sS,{children:[y.jsx(Xu,{active:n.models.length===0,onClick:()=>s(_=>({..._,models:[]})),children:"All models"}),y.jsx("div",{className:"my-1 h-px bg-line"}),y.jsxs("div",{className:"max-h-64 overflow-y-auto",children:[t.modelOptions.length===0&&y.jsx("div",{className:"px-2 py-1 text-xs text-fg-faint",children:"no models in range"}),t.modelOptions.map(_=>{const R=n.models.includes(_);return y.jsxs(Xu,{active:R,onClick:()=>s(j=>({...j,models:R?j.models.filter(E=>E!==_):[...j.models,_]})),children:[y.jsx("span",{className:R?"text-accent":"text-fg-faint","aria-hidden":!0,children:R?"◉":"○"})," ",Or(_)]},_)})]})]})}),y.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[y.jsx("span",{className:"text-xs text-fg-faint",children:"range:"}),y.jsx(Sn,{options:X1.map(_=>({value:_.key,label:_.key==="mtd"?"MTD":_.key==="all"?"6M":_.key})),value:n.period,onChange:_=>s(R=>({...R,period:_})),size:"sm",ariaLabel:"time range"})]}),b&&y.jsxs("button",{type:"button",onClick:()=>s(_=>({..._,providers:[],models:[],account:"all"})),className:"flex items-center gap-1 rounded border border-line bg-bg-1 px-2 py-1 text-xs text-fg-faint transition hover:border-warning/60 hover:text-warning focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent",title:"Clear provider, model & account filters","aria-label":"Clear provider, model and account filters",children:[y.jsx(xi,{className:"size-3","aria-hidden":!0})," clear"]})]})]})})}function Xj(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;const n=document.implementation.createHTMLDocument(),s=n.createElement("base"),i=n.createElement("a");return n.head.appendChild(s),n.body.appendChild(i),t&&(s.href=t),i.href=e,i.href}const Zj=(()=>{let e=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function ms(e){const t=[];for(let n=0,s=e.length;n<s;n++)t.push(e[n]);return t}let ni=null;function rk(e={}){return ni||(e.includeStyleProperties?(ni=e.includeStyleProperties,ni):(ni=ms(window.getComputedStyle(document.documentElement)),ni))}function jc(e,t){const s=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return s?parseFloat(s.replace("px","")):0}function e2(e){const t=jc(e,"border-left-width"),n=jc(e,"border-right-width");return e.clientWidth+t+n}function t2(e){const t=jc(e,"border-top-width"),n=jc(e,"border-bottom-width");return e.clientHeight+t+n}function sk(e,t={}){const n=t.width||e2(e),s=t.height||t2(e);return{width:n,height:s}}function n2(){let e,t;try{t=process}catch{}const n=t&&t.env?t.env.devicePixelRatio:null;return n&&(e=parseInt(n,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}const xn=16384;function r2(e){(e.width>xn||e.height>xn)&&(e.width>xn&&e.height>xn?e.width>e.height?(e.height*=xn/e.width,e.width=xn):(e.width*=xn/e.height,e.height=xn):e.width>xn?(e.height*=xn/e.width,e.width=xn):(e.width*=xn/e.height,e.height=xn))}function s2(e,t={}){return e.toBlob?new Promise(n=>{e.toBlob(n,t.type?t.type:"image/png",t.quality?t.quality:1)}):new Promise(n=>{const s=window.atob(e.toDataURL(t.type?t.type:void 0,t.quality?t.quality:void 0).split(",")[1]),i=s.length,a=new Uint8Array(i);for(let u=0;u<i;u+=1)a[u]=s.charCodeAt(u);n(new Blob([a],{type:t.type?t.type:"image/png"}))})}function Nc(e){return new Promise((t,n)=>{const s=new Image;s.onload=()=>{s.decode().then(()=>{requestAnimationFrame(()=>t(s))})},s.onerror=n,s.crossOrigin="anonymous",s.decoding="async",s.src=e})}async function o2(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function i2(e,t,n){const s="http://www.w3.org/2000/svg",i=document.createElementNS(s,"svg"),a=document.createElementNS(s,"foreignObject");return i.setAttribute("width",`${t}`),i.setAttribute("height",`${n}`),i.setAttribute("viewBox",`0 0 ${t} ${n}`),a.setAttribute("width","100%"),a.setAttribute("height","100%"),a.setAttribute("x","0"),a.setAttribute("y","0"),a.setAttribute("externalResourcesRequired","true"),i.appendChild(a),a.appendChild(e),o2(i)}const an=(e,t)=>{if(e instanceof t)return!0;const n=Object.getPrototypeOf(e);return n===null?!1:n.constructor.name===t.name||an(n,t)};function a2(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function l2(e,t){return rk(t).map(n=>{const s=e.getPropertyValue(n),i=e.getPropertyPriority(n);return`${n}: ${s}${i?" !important":""};`}).join(" ")}function u2(e,t,n,s){const i=`.${e}:${t}`,a=n.cssText?a2(n):l2(n,s);return document.createTextNode(`${i}{${a}}`)}function oS(e,t,n,s){const i=window.getComputedStyle(e,n),a=i.getPropertyValue("content");if(a===""||a==="none")return;const u=Zj();try{t.className=`${t.className} ${u}`}catch{return}const f=document.createElement("style");f.appendChild(u2(u,n,i,s)),t.appendChild(f)}function c2(e,t,n){oS(e,t,":before",n),oS(e,t,":after",n)}const iS="application/font-woff",aS="image/jpeg",f2={woff:iS,woff2:iS,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:aS,jpeg:aS,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function d2(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function Zp(e){const t=d2(e).toLowerCase();return f2[t]||""}function h2(e){return e.split(/,/)[1]}function Gg(e){return e.search(/^(data:)/)!==-1}function g2(e,t){return`data:${t};base64,${e}`}async function ok(e,t,n){const s=await fetch(e,t);if(s.status===404)throw new Error(`Resource "${s.url}" not found`);const i=await s.blob();return new Promise((a,u)=>{const f=new FileReader;f.onerror=u,f.onloadend=()=>{try{a(n({res:s,result:f.result}))}catch(d){u(d)}},f.readAsDataURL(i)})}const Zh={};function p2(e,t,n){let s=e.replace(/\?.*/,"");return n&&(s=e),/ttf|otf|eot|woff2?/i.test(s)&&(s=s.replace(/.*\//,"")),t?`[${t}]${s}`:s}async function em(e,t,n){const s=p2(e,t,n.includeQueryParams);if(Zh[s]!=null)return Zh[s];n.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let i;try{const a=await ok(e,n.fetchRequestInit,({res:u,result:f})=>(t||(t=u.headers.get("Content-Type")||""),h2(f)));i=g2(a,t)}catch(a){i=n.imagePlaceholder||"";let u=`Failed to fetch resource: ${e}`;a&&(u=typeof a=="string"?a:a.message),u&&console.warn(u)}return Zh[s]=i,i}async function m2(e){const t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):Nc(t)}async function y2(e,t){if(e.currentSrc){const a=document.createElement("canvas"),u=a.getContext("2d");a.width=e.clientWidth,a.height=e.clientHeight,u==null||u.drawImage(e,0,0,a.width,a.height);const f=a.toDataURL();return Nc(f)}const n=e.poster,s=Zp(n),i=await em(n,s,t);return Nc(i)}async function x2(e,t){var n;try{if(!((n=e==null?void 0:e.contentDocument)===null||n===void 0)&&n.body)return await af(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function v2(e,t){return an(e,HTMLCanvasElement)?m2(e):an(e,HTMLVideoElement)?y2(e,t):an(e,HTMLIFrameElement)?x2(e,t):e.cloneNode(ik(e))}const S2=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",ik=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function w2(e,t,n){var s,i;if(ik(t))return t;let a=[];return S2(e)&&e.assignedNodes?a=ms(e.assignedNodes()):an(e,HTMLIFrameElement)&&(!((s=e.contentDocument)===null||s===void 0)&&s.body)?a=ms(e.contentDocument.body.childNodes):a=ms(((i=e.shadowRoot)!==null&&i!==void 0?i:e).childNodes),a.length===0||an(e,HTMLVideoElement)||await a.reduce((u,f)=>u.then(()=>af(f,n)).then(d=>{d&&t.appendChild(d)}),Promise.resolve()),t}function k2(e,t,n){const s=t.style;if(!s)return;const i=window.getComputedStyle(e);i.cssText?(s.cssText=i.cssText,s.transformOrigin=i.transformOrigin):rk(n).forEach(a=>{let u=i.getPropertyValue(a);a==="font-size"&&u.endsWith("px")&&(u=`${Math.floor(parseFloat(u.substring(0,u.length-2)))-.1}px`),an(e,HTMLIFrameElement)&&a==="display"&&u==="inline"&&(u="block"),a==="d"&&t.getAttribute("d")&&(u=`path(${t.getAttribute("d")})`),s.setProperty(a,u,i.getPropertyPriority(a))})}function C2(e,t){an(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),an(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function b2(e,t){if(an(e,HTMLSelectElement)){const s=Array.from(t.children).find(i=>e.value===i.getAttribute("value"));s&&s.setAttribute("selected","")}}function _2(e,t,n){return an(t,Element)&&(k2(e,t,n),c2(e,t,n),C2(e,t),b2(e,t)),t}async function R2(e,t){const n=e.querySelectorAll?e.querySelectorAll("use"):[];if(n.length===0)return e;const s={};for(let a=0;a<n.length;a++){const f=n[a].getAttribute("xlink:href");if(f){const d=e.querySelector(f),h=document.querySelector(f);!d&&h&&!s[f]&&(s[f]=await af(h,t,!0))}}const i=Object.values(s);if(i.length){const a="http://www.w3.org/1999/xhtml",u=document.createElementNS(a,"svg");u.setAttribute("xmlns",a),u.style.position="absolute",u.style.width="0",u.style.height="0",u.style.overflow="hidden",u.style.display="none";const f=document.createElementNS(a,"defs");u.appendChild(f);for(let d=0;d<i.length;d++)f.appendChild(i[d]);e.appendChild(u)}return e}async function af(e,t,n){return!n&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(s=>v2(s,t)).then(s=>w2(e,s,t)).then(s=>_2(e,s,t)).then(s=>R2(s,t))}const ak=/url\((['"]?)([^'"]+?)\1\)/g,E2=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,P2=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function I2(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function j2(e){const t=[];return e.replace(ak,(n,s,i)=>(t.push(i),n)),t.filter(n=>!Gg(n))}async function N2(e,t,n,s,i){try{const a=n?Xj(t,n):t,u=Zp(t);let f;return i||(f=await em(a,u,s)),e.replace(I2(t),`$1${f}$3`)}catch{}return e}function M2(e,{preferredFontFormat:t}){return t?e.replace(P2,n=>{for(;;){const[s,,i]=E2.exec(n)||[];if(!i)return"";if(i===t)return`src: ${s};`}}):e}function lk(e){return e.search(ak)!==-1}async function uk(e,t,n){if(!lk(e))return e;const s=M2(e,n);return j2(s).reduce((a,u)=>a.then(f=>N2(f,u,t,n)),Promise.resolve(s))}async function ri(e,t,n){var s;const i=(s=t.style)===null||s===void 0?void 0:s.getPropertyValue(e);if(i){const a=await uk(i,null,n);return t.style.setProperty(e,a,t.style.getPropertyPriority(e)),!0}return!1}async function T2(e,t){await ri("background",e,t)||await ri("background-image",e,t),await ri("mask",e,t)||await ri("-webkit-mask",e,t)||await ri("mask-image",e,t)||await ri("-webkit-mask-image",e,t)}async function $2(e,t){const n=an(e,HTMLImageElement);if(!(n&&!Gg(e.src))&&!(an(e,SVGImageElement)&&!Gg(e.href.baseVal)))return;const s=n?e.src:e.href.baseVal,i=await em(s,Zp(s),t);await new Promise((a,u)=>{e.onload=a,e.onerror=t.onImageErrorHandler?(...d)=>{try{a(t.onImageErrorHandler(...d))}catch(h){u(h)}}:u;const f=e;f.decode&&(f.decode=a),f.loading==="lazy"&&(f.loading="eager"),n?(e.srcset="",e.src=i):e.href.baseVal=i})}async function F2(e,t){const s=ms(e.childNodes).map(i=>ck(i,t));await Promise.all(s).then(()=>e)}async function ck(e,t){an(e,Element)&&(await T2(e,t),await $2(e,t),await F2(e,t))}function L2(e,t){const{style:n}=e;t.backgroundColor&&(n.backgroundColor=t.backgroundColor),t.width&&(n.width=`${t.width}px`),t.height&&(n.height=`${t.height}px`);const s=t.style;return s!=null&&Object.keys(s).forEach(i=>{n[i]=s[i]}),e}const lS={};async function uS(e){let t=lS[e];if(t!=null)return t;const s=await(await fetch(e)).text();return t={url:e,cssText:s},lS[e]=t,t}async function cS(e,t){let n=e.cssText;const s=/url\(["']?([^"')]+)["']?\)/g,a=(n.match(/url\([^)]+\)/g)||[]).map(async u=>{let f=u.replace(s,"$1");return f.startsWith("https://")||(f=new URL(f,e.url).href),ok(f,t.fetchRequestInit,({result:d})=>(n=n.replace(u,`url(${d})`),[u,d]))});return Promise.all(a).then(()=>n)}function fS(e){if(e==null)return[];const t=[],n=/(\/\*[\s\S]*?\*\/)/gi;let s=e.replace(n,"");const i=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const d=i.exec(s);if(d===null)break;t.push(d[0])}s=s.replace(i,"");const a=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,u="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",f=new RegExp(u,"gi");for(;;){let d=a.exec(s);if(d===null){if(d=f.exec(s),d===null)break;a.lastIndex=f.lastIndex}else f.lastIndex=a.lastIndex;t.push(d[0])}return t}async function O2(e,t){const n=[],s=[];return e.forEach(i=>{if("cssRules"in i)try{ms(i.cssRules||[]).forEach((a,u)=>{if(a.type===CSSRule.IMPORT_RULE){let f=u+1;const d=a.href,h=uS(d).then(m=>cS(m,t)).then(m=>fS(m).forEach(p=>{try{i.insertRule(p,p.startsWith("@import")?f+=1:i.cssRules.length)}catch(x){console.error("Error inserting rule from remote css",{rule:p,error:x})}})).catch(m=>{console.error("Error loading remote css",m.toString())});s.push(h)}})}catch(a){const u=e.find(f=>f.href==null)||document.styleSheets[0];i.href!=null&&s.push(uS(i.href).then(f=>cS(f,t)).then(f=>fS(f).forEach(d=>{u.insertRule(d,u.cssRules.length)})).catch(f=>{console.error("Error loading remote stylesheet",f)})),console.error("Error inlining remote css file",a)}}),Promise.all(s).then(()=>(e.forEach(i=>{if("cssRules"in i)try{ms(i.cssRules||[]).forEach(a=>{n.push(a)})}catch(a){console.error(`Error while reading CSS rules from ${i.href}`,a)}}),n))}function A2(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>lk(t.style.getPropertyValue("src")))}async function D2(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");const n=ms(e.ownerDocument.styleSheets),s=await O2(n,t);return A2(s)}function fk(e){return e.trim().replace(/["']/g,"")}function z2(e){const t=new Set;function n(s){(s.style.fontFamily||getComputedStyle(s).fontFamily).split(",").forEach(a=>{t.add(fk(a))}),Array.from(s.children).forEach(a=>{a instanceof HTMLElement&&n(a)})}return n(e),t}async function U2(e,t){const n=await D2(e,t),s=z2(e);return(await Promise.all(n.filter(a=>s.has(fk(a.style.fontFamily))).map(a=>{const u=a.parentStyleSheet?a.parentStyleSheet.href:null;return uk(a.cssText,u,t)}))).join(`
|
|
59
|
-
`)}async function V2(e,t){const n=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await U2(e,t);if(n){const s=document.createElement("style"),i=document.createTextNode(n);s.appendChild(i),e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s)}}async function B2(e,t={}){const{width:n,height:s}=sk(e,t),i=await af(e,t,!0);return await V2(i,t),await ck(i,t),L2(i,t),await i2(i,n,s)}async function dk(e,t={}){const{width:n,height:s}=sk(e,t),i=await B2(e,t),a=await Nc(i),u=document.createElement("canvas"),f=u.getContext("2d"),d=t.pixelRatio||n2(),h=t.canvasWidth||n,m=t.canvasHeight||s;return u.width=h*d,u.height=m*d,t.skipAutoScale||r2(u),u.style.width=`${h}`,u.style.height=`${m}`,t.backgroundColor&&(f.fillStyle=t.backgroundColor,f.fillRect(0,0,u.width,u.height)),f.drawImage(a,0,0,u.width,u.height),u}async function q2(e,t={}){return(await dk(e,t)).toDataURL()}async function H2(e,t={}){const n=await dk(e,t);return await s2(n)}const hk="#0a0a0a";async function gk(){try{await document.fonts.ready}catch{}await new Promise(e=>requestAnimationFrame(()=>e(null)))}async function W2(e,t={}){return await gk(),q2(e,{pixelRatio:t.pixelRatio??2,backgroundColor:t.backgroundColor??hk,cacheBust:!0,skipFonts:!1})}function G2(e,t){const n=document.createElement("a");n.href=e,n.download=t,document.body.appendChild(n),n.click(),n.remove()}async function K2(e,t,n){G2(await W2(e,n),t)}async function Q2(e,t){try{await gk();const n=await H2(e,{pixelRatio:(t==null?void 0:t.pixelRatio)??2,backgroundColor:(t==null?void 0:t.backgroundColor)??hk,cacheBust:!0});return!n||!navigator.clipboard||typeof ClipboardItem>"u"?!1:(await navigator.clipboard.write([new ClipboardItem({"image/png":n})]),!0)}catch{return!1}}function J2(e){const t=new Date,n=s=>String(s).padStart(2,"0");return`tokmon-${e}-${t.getFullYear()}${n(t.getMonth()+1)}${n(t.getDate())}-${n(t.getHours())}${n(t.getMinutes())}.png`}const eg=["▁","▂","▃","▄","▅","▆","▇","█"];function rl({data:e,color:t="var(--color-accent)",className:n=""}){const s=eg.length-1,i=Math.max(...e,0),a=Math.min(...e,0),u=i>0&&a===i;return y.jsx("span",{className:`font-mono leading-none ${n}`,style:{color:t},"aria-hidden":!0,children:e.length===0?"·":u?eg[Math.floor(s/2)].repeat(e.length):e.map(f=>eg[i<=0?0:Math.max(0,Math.min(s,Math.floor(f/i*(s+.999))))]).join("")})}function Zu({label:e,value:t,sub:n,valueClass:s="text-fg-bright"}){return y.jsxs("div",{children:[y.jsx("div",{className:"font-display text-[10px] uppercase tracking-wide text-fg-faint",children:e}),y.jsx("div",{className:`tnum mt-1 text-xl ${s}`,children:t}),n!=null&&y.jsx("div",{className:"mt-0.5 text-xs text-fg-dim",children:n})]})}function Y2({children:e}){return y.jsx("div",{className:"flex h-full min-h-24 items-center justify-center text-center text-xs text-fg-faint",children:e})}function Mc({variant:e="footer",version:t}){return e==="corner"?y.jsxs("div",{className:"pointer-events-none absolute bottom-3 right-3 z-10 flex items-center gap-1.5 rounded bg-bg-0/60 px-2 py-1 font-display text-[11px] tracking-wide text-fg-faint backdrop-blur-sm",children:[y.jsx("span",{className:"text-accent",children:"●"})," tokmon"]}):y.jsxs("div",{className:"flex items-center gap-2 font-display text-sm tracking-wide",children:[y.jsx("span",{className:"text-accent",children:"●"}),y.jsx("span",{className:"text-fg-bright",children:"tokmon"}),y.jsxs("span",{className:"text-xs tracking-normal text-fg-faint",children:["github.com/DavidIlie/tokmon",t?` · v${t}`:""]})]})}const dS=e=>`last ${e}`,X2=V.forwardRef(function({derived:t,periodLabel:n,tz:s,version:i,opts:a},u){const f=t.byModel.slice(0,5),d=t.totals.cost>0,h=m=>d?m.share:m.tokenShare;return y.jsxs("div",{ref:u,className:"relative flex flex-col",style:{width:1040,height:540,background:"var(--color-bg-0)",backgroundImage:a.glow?"radial-gradient(circle at 50% -10%, color-mix(in oklab, var(--color-accent) 16%, transparent), transparent 55%), radial-gradient(var(--color-line-faint) 1px, transparent 1px)":"radial-gradient(var(--color-line-faint) 1px, transparent 1px)",backgroundSize:a.glow?"100% 100%, 24px 24px":"24px 24px",fontFamily:"var(--font-mono)",color:"var(--color-fg)"},children:[y.jsxs("div",{className:"flex items-baseline gap-2 border-b border-line px-6 py-3.5",children:[y.jsx("span",{className:"font-display text-sm tracking-wide text-accent",children:"tokmon"}),y.jsxs("span",{className:"text-sm text-fg-dim",children:["usage · ",dS(n)]}),y.jsx("span",{className:"ml-auto text-xs text-fg-faint",children:s})]}),y.jsxs("div",{className:"flex flex-1 gap-9 px-9 py-7",children:[y.jsxs("div",{className:"flex w-[300px] shrink-0 flex-col",children:[y.jsx("div",{className:"font-display text-xs uppercase tracking-widest text-fg-faint",children:d?"total spend":"total tokens"}),y.jsx("div",{className:"tnum mt-1 text-cost",style:{fontSize:64,lineHeight:1},children:d?Ue(t.totals.cost):wn(t.totals.tokens)}),y.jsxs("div",{className:"mt-auto flex flex-col gap-3",children:[d?y.jsx(ec,{label:"tokens",value:wn(t.totals.tokens)}):y.jsx(ec,{label:"spend",value:Ue(t.totals.cost)}),y.jsx(ec,{label:"cache saved",value:Ue(t.totals.cacheSavings),className:"text-positive"}),y.jsx(ec,{label:"calls",value:bs(t.totals.calls)})]})]}),y.jsxs("div",{className:"flex flex-1 flex-col gap-2 border-l border-line pl-9",children:[y.jsxs("div",{className:"font-display text-xs uppercase tracking-widest text-fg-faint",children:["top models · ",dS(n)]}),f.length===0?y.jsx("div",{className:"flex flex-1 items-center text-sm text-fg-faint",children:"no model usage in range"}):f.map(m=>y.jsxs("div",{className:"flex items-center gap-3",children:[y.jsx("span",{className:"size-2 shrink-0 rounded-[2px]",style:{background:m.color}}),y.jsx("span",{className:"w-28 shrink-0 truncate text-sm text-fg",children:Or(m.model)}),y.jsx("span",{className:"h-1.5 flex-1 overflow-hidden rounded-full bg-bg-3",children:y.jsx("span",{className:"block h-full rounded-full",style:{width:`${Math.min(100,h(m)*100)}%`,minWidth:2,background:m.color}})}),y.jsx("span",{className:"tnum w-10 shrink-0 text-right text-xs text-fg-faint",children:Y1(h(m))}),y.jsx("span",{className:"tnum w-20 shrink-0 text-right text-sm text-cost",children:d?Ue(m.cost):wn(m.tokens)})]},m.model))]})]}),y.jsx("div",{className:"border-t border-line px-9 pt-3",children:y.jsx(rl,{data:t.timeline.map(m=>m.total),color:"var(--color-accent)",className:"text-2xl tracking-tight"})}),y.jsxs("div",{className:"flex items-center justify-between border-t border-line px-9 py-3.5",children:[a.wmPos==="footer"?y.jsx(Mc,{variant:"footer",version:i}):y.jsx("span",{className:"text-xs text-fg-faint",children:"tokmon"}),y.jsx("span",{className:"text-xs text-fg-faint",children:n})]}),a.wmPos==="corner"&&y.jsx(Mc,{variant:"corner"})]})});function ec({label:e,value:t,className:n="text-fg-bright"}){return y.jsxs("div",{children:[y.jsx("div",{className:"text-[11px] uppercase tracking-wide text-fg-faint",children:e}),y.jsx("div",{className:`tnum mt-1 truncate text-xl ${n}`,children:t})]})}const Z2=V.forwardRef(function({node:t,title:n,framed:s,wmPos:i},a){const u=V.useRef(null);return V.useEffect(()=>{const f=u.current;if(!f)return;f.innerHTML="";const d=t.cloneNode(!0);return d.querySelectorAll("[data-chrome]").forEach(h=>h.remove()),d.style.width=`${Math.round(t.getBoundingClientRect().width)}px`,d.classList.remove("hover:border-line-2"),f.appendChild(d),()=>{f.innerHTML=""}},[t]),y.jsxs("div",{ref:a,className:"relative",style:{background:"var(--color-bg-0)",backgroundImage:"radial-gradient(var(--color-line-faint) 1px, transparent 1px)",backgroundSize:"24px 24px",padding:s?28:16,fontFamily:"var(--font-mono)"},children:[s&&y.jsxs("div",{className:"mb-3 flex items-baseline gap-2",children:[y.jsx("span",{className:"font-display text-xs tracking-wide text-accent",children:"tokmon"}),y.jsxs("span",{className:"font-display text-xs uppercase tracking-wider text-fg-dim",children:["/ ",n]})]}),y.jsx("div",{ref:u}),i==="footer"?y.jsx("div",{className:"mt-3 flex justify-end",children:y.jsx(Mc,{variant:"footer"})}):y.jsx(Mc,{variant:"corner"})]})}),eN=600,hS=360,tN=e=>e==="light"?"#f4f5f5":"#0a0a0a";function nN({source:e,onClose:t}){const n=e.kind==="summary",s=V.useRef(null),i=V.useRef(null),a=V.useRef(null),u=V.useRef(),[f,d]=V.useState(()=>document.documentElement.classList.contains("light")?"light":"dark"),[h,m]=V.useState(n?"footer":"corner"),[p,x]=V.useState("2"),[v,w]=V.useState(!0),[k,b]=V.useState(!0),[_,R]=V.useState({w:n?1040:700,h:n?540:360}),[j,E]=V.useState(null);V.useEffect(()=>{var P;const te=document.activeElement;(P=i.current)==null||P.focus();const ae=H=>{if(H.key==="Escape"){t();return}if(H.key!=="Tab"||!a.current)return;const X=a.current.querySelectorAll('button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])');if(X.length===0)return;const K=X[0],q=X[X.length-1];H.shiftKey&&document.activeElement===K?(H.preventDefault(),q.focus()):!H.shiftKey&&document.activeElement===q&&(H.preventDefault(),K.focus())};return document.addEventListener("keydown",ae),()=>{var H;document.removeEventListener("keydown",ae),(H=te==null?void 0:te.focus)==null||H.call(te)}},[t]),V.useEffect(()=>()=>{u.current&&clearTimeout(u.current)},[]);const T=te=>{E(te),u.current&&clearTimeout(u.current),u.current=setTimeout(()=>E(null),1600)};V.useEffect(()=>{const te=s.current;if(!te)return;const ae=()=>R({w:te.offsetWidth||_.w,h:te.offsetHeight||_.h});ae();const P=new ResizeObserver(ae);P.observe(te);const H=setTimeout(ae,80);return()=>{P.disconnect(),clearTimeout(H)}},[e,k,h,f,v]);const $=Math.min(eN/_.w,hS/_.h,1),L={pixelRatio:Number(p),backgroundColor:tN(f)},U=J2(n?"summary":e.captureName),z=async()=>{s.current&&(await K2(s.current,U,L),T("dl"))},Z=async()=>{s.current&&T(await Q2(s.current,L)?"copy":"fail")};return y.jsx("div",{className:"dialog-fade fixed inset-0 z-[60] flex items-center justify-center bg-bg-0/70 p-4 backdrop-blur-sm",onMouseDown:te=>{te.target===te.currentTarget&&t()},role:"dialog","aria-modal":"true","aria-label":"Share",children:y.jsxs("div",{ref:a,className:"dialog-pop relative flex max-h-[88vh] w-full max-w-[720px] flex-col overflow-hidden rounded-md border border-line-2 bg-bg-1",children:[y.jsx("div",{className:"pointer-events-none absolute left-3 top-2 font-display text-[11px] uppercase tracking-wider text-fg-dim",children:"share"}),y.jsx("button",{type:"button",onClick:t,"aria-label":"Close",className:"absolute right-2 top-2 z-10 rounded p-1 text-fg-faint transition hover:text-fg focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent",children:y.jsx(xi,{className:"size-4"})}),y.jsx("div",{className:"flex items-center justify-center bg-bg-0 px-6 pb-5 pt-9",style:{minHeight:hS+24},children:y.jsx("div",{className:"overflow-hidden rounded",style:{width:_.w*$,height:_.h*$},children:y.jsx("div",{style:{width:_.w,height:_.h,transform:`scale(${$})`,transformOrigin:"top left"},children:y.jsx("div",{className:f==="light"?"light":"dark",children:n?y.jsx(X2,{ref:s,derived:e.derived,periodLabel:e.periodLabel,tz:e.tz,version:e.version,opts:{glow:v,wmPos:h}}):y.jsx(Z2,{ref:s,node:e.node,title:e.captureName,framed:k,wmPos:h})})})})}),y.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2 border-t border-line px-4 py-3 text-[11px]",children:[y.jsx(_a,{label:"theme",children:y.jsx(Sn,{size:"xs",containerClassName:ba,ariaLabel:"export theme",options:[{value:"dark",label:"dark"},{value:"light",label:"light"}],value:f,onChange:d})}),y.jsx(_a,{label:"mark",children:y.jsx(Sn,{size:"xs",containerClassName:ba,ariaLabel:"watermark position",options:[{value:"footer",label:"footer"},{value:"corner",label:"corner"}],value:h,onChange:m})}),n?y.jsx(_a,{label:"glow",children:y.jsx(Sn,{size:"xs",containerClassName:ba,ariaLabel:"accent glow",options:[{value:"on",label:"on"},{value:"off",label:"off"}],value:v?"on":"off",onChange:te=>w(te==="on")})}):y.jsx(_a,{label:"frame",children:y.jsx(Sn,{size:"xs",containerClassName:ba,ariaLabel:"frame",options:[{value:"framed",label:"framed"},{value:"bare",label:"bare"}],value:k?"framed":"bare",onChange:te=>b(te==="framed")})}),y.jsx(_a,{label:"scale",children:y.jsx(Sn,{size:"xs",containerClassName:ba,ariaLabel:"export scale",options:[{value:"1",label:"1x"},{value:"2",label:"2x"},{value:"3",label:"3x"}],value:p,onChange:x})}),y.jsxs("span",{className:"ml-auto tnum text-fg-faint",children:[_.w," × ",_.h," · ",p,"x"]})]}),y.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-line px-4 py-3",children:[y.jsxs("button",{type:"button",onClick:Z,className:"flex items-center gap-1.5 rounded border border-line bg-bg-1 px-3 py-1.5 text-xs text-fg-dim transition hover:border-line-2 hover:text-fg active:scale-[0.97] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent",children:[j==="copy"?y.jsx(yi,{className:"size-3.5 text-positive"}):j==="fail"?y.jsx(xi,{className:"size-3.5 text-warning"}):y.jsx(Vj,{className:"size-3.5"})," ",j==="copy"?"copied":j==="fail"?"copy failed":"copy"]}),y.jsxs("button",{type:"button",ref:i,onClick:z,className:"flex items-center gap-1.5 rounded border border-accent/60 bg-bg-1 px-3 py-1.5 text-xs text-accent transition hover:bg-bg-2 active:scale-[0.97] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent",children:[j==="dl"?y.jsx(yi,{className:"size-3.5 text-positive"}):y.jsx(Bj,{className:"size-3.5"})," download PNG"]})]})]})})}const ba="flex items-center overflow-hidden rounded border border-line text-[10px]";function _a({label:e,children:t}){return y.jsxs("span",{className:"flex items-center gap-1.5",children:[y.jsx("span",{className:"text-fg-faint",children:e}),t]})}const pk=V.createContext(()=>{}),mk=()=>V.useContext(pk);function rN({children:e}){const[t,n]=V.useState(null);return y.jsxs(pk.Provider,{value:n,children:[e,t&&y.jsx(nN,{source:t,onClose:()=>n(null)})]})}function sN({derived:e,periodLabel:t,tz:n,version:s}){const i=mk();return y.jsxs("button",{type:"button",onClick:()=>i({kind:"summary",derived:e,periodLabel:t,tz:n,version:s}),className:"flex items-center gap-1.5 rounded border border-line bg-bg-1 px-2.5 py-1 text-xs text-fg-dim transition hover:border-accent/60 hover:text-accent active:scale-[0.97] max-sm:py-2",title:"Create a shareable image",children:[y.jsx(qj,{className:"size-3.5"}),y.jsx("span",{children:"share"})]})}const Da=["claude","codex","cursor","copilot","pi","opencode","antigravity","gemini"],Ra={interval:2,billingInterval:5,clearScreen:!0,timezone:null,accounts:[],activeAccountId:null,disabledProviders:[],onboarded:!1,dashboardLayout:"grid",defaultFocus:"all",ascii:"auto",knownProviders:[]},oN=["claude","codex","cursor"],tg=["cyan","magenta","green","yellow","blue","red"],sl=[...Da],iN=["cyan","magenta","green","yellow","blue","red","cyanBright","magentaBright","greenBright"],oo={claude:{name:"Claude",color:"green"},codex:{name:"Codex",color:"cyan"},cursor:{name:"Cursor",color:"magenta"},copilot:{name:"Copilot",color:"white"},pi:{name:"Pi",color:"blue"},opencode:{name:"opencode",color:"yellow"},antigravity:{name:"Antigravity",color:"red"},gemini:{name:"Gemini",color:"greenBright"}};function aN(e,t=sl.filter(s=>!e.disabledProviders.includes(s)),n){const s=new Set(t),i=new Set,a=new Set,u=new Set,f=new Set,d=[],h=(p,x)=>`${p}:${x&&x!=="~"?x:"~"}`,m=p=>{u.add(p.id),f.add(h(p.providerId,p.homeDir)),d.push(p)};if(e.accounts.forEach((p,x)=>{const v=oo[p.providerId];i.add(p.id),a.add(h(p.providerId,p.homeDir)),m({id:p.id,providerId:p.providerId,name:p.name,homeDir:p.homeDir||"~",color:p.color||v.color,source:"configured",explicitId:p.id,explicitIndex:x})}),n)for(const p of n){if(e.disabledProviders.includes(p.providerId))continue;const x=h(p.providerId,p.homeDir);if(i.has(p.id)||a.has(x)||u.has(p.id)||f.has(x))continue;const v=oo[p.providerId];m({id:p.id,providerId:p.providerId,name:p.name,homeDir:p.homeDir||"~",color:p.color||v.color,source:"auto"})}for(const p of sl){if(e.disabledProviders.includes(p)||!s.has(p))continue;const x=h(p,"~");if(i.has(p)||a.has(x)||u.has(p)||f.has(x))continue;const v=oo[p];m({id:p,providerId:p,name:v.name,homeDir:"~",color:v.color,source:"auto"})}return d}function gS(e,t,n){return typeof e=="number"&&Number.isFinite(e)&&e>=n?e:t}function yk(e){try{return new Intl.DateTimeFormat("en-CA",{timeZone:e}),!0}catch{return!1}}function tm(e){try{const t=(Array.isArray(e.accounts)?e.accounts:[]).map(n=>({...n,providerId:n.providerId??"claude"})).filter(n=>typeof(n==null?void 0:n.id)=="string"&&typeof(n==null?void 0:n.name)=="string"&&Da.includes(n.providerId)).map(n=>({...n,homeDir:typeof n.homeDir=="string"&&n.homeDir.trim()?n.homeDir:"~"}));return{...Ra,interval:gS(e.interval,Ra.interval,1),billingInterval:gS(e.billingInterval,Ra.billingInterval,1),clearScreen:typeof e.clearScreen=="boolean"?e.clearScreen:Ra.clearScreen,timezone:typeof e.timezone=="string"&&e.timezone.trim()&&yk(e.timezone.trim())?e.timezone.trim():null,accounts:t,activeAccountId:typeof e.activeAccountId=="string"?e.activeAccountId:null,disabledProviders:(Array.isArray(e.disabledProviders)?e.disabledProviders:[]).filter(n=>Da.includes(n)),onboarded:e.onboarded===!0,dashboardLayout:e.dashboardLayout==="single"?"single":"grid",defaultFocus:e.defaultFocus==="last"?"last":"all",ascii:e.ascii==="on"?"on":e.ascii==="off"?"off":"auto",knownProviders:Array.isArray(e.knownProviders)?e.knownProviders.filter(n=>Da.includes(n)):e.onboarded===!0?[...oN]:[]}}catch{return{...Ra}}}function lN(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"").slice(0,48)}function xk(e,t){const n=lN(e)||"account",s=new Set(t.map(i=>i.id));if(!s.has(n))return n;for(let i=2;i<1e3;i++){const a=`${n}_${i}`;if(!s.has(a))return a}return`${n}_${Date.now()}`}function uN(e){const t=new Set(e.map(n=>n.color).filter(Boolean));for(const n of tg)if(!t.has(n))return n;return tg[e.length%tg.length]}function nm(e){return e?e.replace(/\x1b\][\s\S]*?(?:\x07|\x1b\\)/g,"").replace(/\x1b\[[0-?]*[ -/]*[@-~]/g,"").replace(/\x1bO./g,"").replace(/\x1b/g,"").replace(/[\x00-\x1f\x7f-\x9f]/g,"").replace(/\[20[01]~/g,""):""}const Lt=(e,t)=>{switch(t.length){case 0:return e;case 1:return t[0](e);case 2:return t[1](t[0](e));case 3:return t[2](t[1](t[0](e)));case 4:return t[3](t[2](t[1](t[0](e))));case 5:return t[4](t[3](t[2](t[1](t[0](e)))));case 6:return t[5](t[4](t[3](t[2](t[1](t[0](e))))));case 7:return t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))));case 8:return t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e))))))));case 9:return t[8](t[7](t[6](t[5](t[4](t[3](t[2](t[1](t[0](e)))))))));default:{let n=e;for(let s=0,i=t.length;s<i;s++)n=t[s](n);return n}}},cN={pipe(){return Lt(this,arguments)}},lf=(function(){function e(){}return e.prototype=cN,e})(),re=function(e,t){if(typeof e=="function")return function(){return e(arguments)?t.apply(this,arguments):n=>t(n,...arguments)};switch(e){case 0:case 1:throw new RangeError(`Invalid arity ${e}`);case 2:return function(n,s){return arguments.length>=2?t(n,s):function(i){return t(i,n)}};case 3:return function(n,s,i){return arguments.length>=3?t(n,s,i):function(a){return t(a,n,s)}};default:return function(){if(arguments.length>=e)return t.apply(this,arguments);const n=arguments;return function(s){return t(s,...n)}}}},_e=e=>e,_s=e=>()=>e,rm=_s(!0),vk=_s(!1),uf=_s(void 0),Sl=uf;function Sk(e,t,n,s,i,a,u,f,d){switch(arguments.length){case 1:return e;case 2:return function(){return t(e.apply(this,arguments))};case 3:return function(){return n(t(e.apply(this,arguments)))};case 4:return function(){return s(n(t(e.apply(this,arguments))))};case 5:return function(){return i(s(n(t(e.apply(this,arguments)))))};case 6:return function(){return a(i(s(n(t(e.apply(this,arguments))))))};case 7:return function(){return u(a(i(s(n(t(e.apply(this,arguments)))))))};case 8:return function(){return f(u(a(i(s(n(t(e.apply(this,arguments))))))))};case 9:return function(){return d(f(u(a(i(s(n(t(e.apply(this,arguments)))))))))}}}function Rs(e){const t=new WeakMap;return n=>{if(t.has(n))return t.get(n);const s=e(n);return t.set(n,s),s}}const Kg=e=>{const t=new Set(Reflect.ownKeys(e));if(e.constructor===Object)return t;e instanceof Error&&t.delete("stack");const n=Object.getPrototypeOf(e);let s=n;for(;s!==null&&s!==Object.prototype;){const i=Reflect.ownKeys(s);for(let a=0;a<i.length;a++)t.add(i[a]);s=Object.getPrototypeOf(s)}return t.has("constructor")&&typeof e.constructor=="function"&&n===e.constructor.prototype&&t.delete("constructor"),t},Qg=new WeakSet;function sm(e){return typeof e=="string"}function wk(e){return typeof e=="number"}function fN(e){return typeof e=="boolean"}function cf(e){return typeof e=="function"}function dN(e){return e!==void 0}function hN(e){return e!=null}function gN(e){return!1}function kk(e){return!0}function pN(e){return typeof e=="object"&&e!==null||cf(e)}const De=re(2,(e,t)=>pN(e)&&t in e);function mN(e){return De(e,Symbol.iterator)||sm(e)}const Yt="~effect/interfaces/Hash",dt=e=>{switch(typeof e){case"number":return om(e);case"bigint":return _t(e.toString(10));case"boolean":return _t(String(e));case"symbol":return _t(String(e));case"string":return _t(e);case"undefined":return _t("undefined");case"function":case"object":{if(e===null)return _t("null");if(e instanceof Date)return _t(e.toISOString());if(e instanceof RegExp)return _t(e.toString());{if(Qg.has(e))return Jg(e);if(rg.has(e))return rg.get(e);const t=wN(e,()=>yN(e)?e[Yt]():typeof e=="function"?Jg(e):Array.isArray(e)||ArrayBuffer.isView(e)?Ck(e):e instanceof Map?vN(e):e instanceof Set?SN(e):im(e));return rg.set(e,t),t}}default:throw new Error(`BUG: unhandled typeof ${typeof e} - please report an issue at https://github.com/Effect-TS/effect/issues`)}},Jg=e=>(ng.has(e)||ng.set(e,om(Math.floor(Math.random()*Number.MAX_SAFE_INTEGER))),ng.get(e)),Xn=re(2,(e,t)=>e*53^t),ff=e=>e&3221225471|e>>>1&1073741824,yN=e=>De(e,Yt),om=e=>{if(e!==e)return _t("NaN");if(e===1/0)return _t("Infinity");if(e===-1/0)return _t("-Infinity");let t=e|0;for(t!==e&&(t^=e*4294967295);e>4294967295;)t^=e/=4294967295;return ff(t)},_t=e=>{let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return ff(t)},xN=(e,t)=>{let n=12289;for(const s of t)n^=Xn(dt(s),dt(e[s]));return ff(n)},im=e=>xN(e,Kg(e)),am=(e,t)=>n=>{let s=e;for(const i of n)s^=t(i);return ff(s)},Ck=am(6151,dt),vN=am(_t("Map"),([e,t])=>Xn(dt(e),dt(t))),SN=am(_t("Set"),dt),ng=new WeakMap,rg=new WeakMap,sg=new WeakSet;function wN(e,t){if(sg.has(e))return _t("[Circular]");sg.add(e);const n=t();return sg.delete(e),n}const Xt="~effect/interfaces/Equal";function kn(){return arguments.length===1?e=>ho(e,arguments[0]):ho(arguments[0],arguments[1])}function ho(e,t){if(e===t)return!0;if(e==null||t==null)return!1;const n=typeof e;return n!==typeof t?!1:n==="number"&&e!==e&&t!==t?!0:n!=="object"&&n!=="function"||Qg.has(e)||Qg.has(t)?!1:bN(e,t,CN)}function kN(e,t,n){const s=og.has(e),i=ig.has(t);if(s&&i)return!0;if(s||i)return!1;og.add(e),ig.add(t);const a=n();return og.delete(e),ig.delete(t),a}const og=new WeakSet,ig=new WeakSet;function CN(e,t){if(dt(e)!==dt(t))return!1;if(e instanceof Date)return t instanceof Date?e.toISOString()===t.toISOString():!1;if(e instanceof RegExp)return t instanceof RegExp?e.toString()===t.toString():!1;const n=pS(e),s=pS(t);if(n!==s)return!1;const i=n&&s;return typeof e=="function"&&!i?!1:kN(e,t,()=>i?e[Xt](t):Array.isArray(e)?!Array.isArray(t)||e.length!==t.length?!1:_N(e,t):ArrayBuffer.isView(e)?!ArrayBuffer.isView(t)||e.byteLength!==t.byteLength?!1:RN(e,t):e instanceof Map?!(t instanceof Map)||e.size!==t.size?!1:IN(e,t):e instanceof Set?!(t instanceof Set)||e.size!==t.size?!1:NN(e,t):EN(e,t))}function bN(e,t,n){let s=tc.get(e);if(!s)s=new WeakMap,tc.set(e,s);else if(s.has(t))return s.get(t);const i=n(e,t);s.set(t,i);let a=tc.get(t);return a||(a=new WeakMap,tc.set(t,a)),a.set(e,i),i}const tc=new WeakMap;function _N(e,t){for(let n=0;n<e.length;n++)if(!ho(e[n],t[n]))return!1;return!0}function RN(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function EN(e,t){const n=Kg(e),s=Kg(t);if(n.size!==s.size)return!1;for(const i of n)if(!s.has(i)||!ho(e[i],t[i]))return!1;return!0}function PN(e,t){return function(s,i){for(const[a,u]of s){let f=!1;for(const[d,h]of i)if(e(a,d)&&t(u,h)){f=!0;break}if(!f)return!1}return!0}}const IN=PN(ho,ho);function jN(e){return function(n,s){for(const i of n){let a=!1;for(const u of s)if(e(i,u)){a=!0;break}if(!a)return!1}return!0}}const NN=jN(ho),pS=e=>De(e,Xt),MN=()=>kn,TN=e=>(t,n)=>t===n||e(t,n),$N=(e,t)=>e===t,FN=()=>$N;function LN(e){return TN((t,n)=>{if(t.length!==n.length)return!1;for(let s=0;s<t.length;s++)if(!e(t[s],n[s]))return!1;return!0})}const bk=e=>e.length>0,df=Symbol.for("~effect/Redactable"),ON=e=>De(e,df);function hf(e){return ON(e)?_k(e):e}function _k(e){var t;return e[df](((t=globalThis[za])==null?void 0:t.context)??AN)}const za="~effect/Fiber/currentFiber",AN={"~effect/Context":{},mapUnsafe:new Map,pipe(){return Lt(this,arguments)}};function vt(e,t){const n=(t==null?void 0:t.space)??0,s=new WeakSet,i=n?typeof n=="number"?" ".repeat(n):n:"",a=h=>i.repeat(h),u=(h,m)=>{const p=h==null?void 0:h.constructor;return p&&p!==Object.prototype.constructor&&p.name?`${p.name}(${m})`:m},f=h=>{try{return Reflect.ownKeys(h)}catch{return["[ownKeys threw]"]}};function d(h,m=0){if(Array.isArray(h)){if(s.has(h))return mS;if(s.add(h),!i||h.length<=1)return`[${h.map(x=>d(x,m)).join(",")}]`;const p=h.map(x=>d(x,m+1)).join(`,
|
|
60
|
-
`+a(m+1));return`[
|
|
61
|
-
${a(m+1)}${p}
|
|
62
|
-
${a(m)}]`}if(h instanceof Date)return zN(h);if(!(t!=null&&t.ignoreToString)&&De(h,"toString")&&typeof h.toString=="function"&&h.toString!==Object.prototype.toString&&h.toString!==Array.prototype.toString){const p=UN(h);return h instanceof Error&&h.cause?`${p} (cause: ${d(h.cause,m)})`:p}if(typeof h=="string")return JSON.stringify(h);if(typeof h=="number"||h==null||typeof h=="boolean"||typeof h=="symbol")return String(h);if(typeof h=="bigint")return String(h)+"n";if(typeof h=="object"||typeof h=="function"){if(s.has(h))return mS;if(s.add(h),df in h)return vt(_k(h));if(Symbol.iterator in h)return`${h.constructor.name}(${d(Array.from(h),m)})`;const p=f(h);if(!i||p.length<=1){const v=`{${p.map(w=>`${Tc(w)}:${d(h[w],m)}`).join(",")}}`;return u(h,v)}const x=`{
|
|
63
|
-
${p.map(v=>`${a(m+1)}${Tc(v)}: ${d(h[v],m+1)}`).join(`,
|
|
64
|
-
`)}
|
|
65
|
-
${a(m)}}`;return u(h,x)}return String(h)}return d(e,0)}const mS="[Circular]";function Tc(e){return typeof e=="string"?JSON.stringify(e):String(e)}function DN(e){return e.map(t=>`[${Tc(t)}]`).join("")}function zN(e){try{return e.toISOString()}catch{return"Invalid Date"}}function UN(e){try{const t=e.toString();return typeof t=="string"?t:String(t)}catch{return"[toString threw]"}}function Rk(e,t){let n=[];const s=JSON.stringify(e,(i,a)=>typeof a=="object"&&a!==null?n.includes(a)?void 0:n.push(a)&&hf(a):a,t==null?void 0:t.space);return n=void 0,s}const go=Symbol.for("nodejs.util.inspect.custom"),wl=e=>{try{if(De(e,"toJSON")&&cf(e.toJSON)&&e.toJSON.length===0)return e.toJSON();if(Array.isArray(e))return e.map(wl)}catch{return"[toJSON threw]"}return hf(e)},VN=(e,t=2)=>{if(typeof e=="string")return e;try{return typeof e=="object"?BN(e,t):String(e)}catch{return String(e)}},BN=(e,t)=>{let n=[];const s=JSON.stringify(e,(i,a)=>typeof a=="object"&&a!==null?n.includes(a)?void 0:n.push(a)&&hf(a):a,t);return n=void 0,s},yS={toJSON(){return wl(this)},[go](){return this.toJSON()},toString(){return vt(this.toJSON())}};class gf{constructor(t){O(this,"called",!1);O(this,"self");this.self=t}next(t){return this.called?{value:t,done:!0}:(this.called=!0,{value:this.self,done:!1})}[Symbol.iterator](){return new gf(this.self)}}const vi="~effect/Utils/internal",Ek={[vi]:e=>e()},qN={[vi]:e=>{try{return e()}finally{}}};var Qw;const HN=((Qw=Ek[vi](()=>new Error().stack))==null?void 0:Qw.includes(vi))===!0,Jt=HN?Ek[vi]:qN[vi],Es="~effect/Effect",ol="~effect/Exit",WN={_A:_e,_E:_e,_R:_e},Pk=`${Es}/identifier`,Ie=`${Es}/args`,It=`${Es}/evaluate`,Cn=`${Es}/successCont`,gr=`${Es}/failureCont`,po=`${Es}/ensureCont`,Js=Symbol.for("effect/Effect/Yield"),Ps={pipe(){return Lt(this,arguments)},toJSON(){return{...this}},toString(){return vt(this.toJSON(),{ignoreToString:!0,space:2})},[go](){return this.toJSON()}},pf={[Symbol.iterator](){return new gf(this)}},GN={...pf,pipe(){return Lt(this,arguments)}},KN={[Es]:WN,...Ps,[Symbol.iterator](){return new gf(this)},asEffect(){return this},toJSON(){return{_id:"Effect",op:this[Pk],...Ie in this?{args:this[Ie]}:void 0}}},Ht=e=>De(e,Es),Ik=e=>De(e,ol),mc="~effect/Cause",yc="~effect/Cause/Reason",mf=e=>De(e,mc),QN=e=>De(e,yc);var Jw;class vo{constructor(t){O(this,Jw);O(this,"reasons");this[mc]=mc,this.reasons=t}pipe(){return Lt(this,arguments)}toJSON(){return{_id:"Cause",failures:this.reasons.map(t=>t.toJSON())}}toString(){return`Cause(${vt(this.reasons)})`}[(Jw=mc,go)](){return this.toJSON()}[Xt](t){return mf(t)&&this.reasons.length===t.reasons.length&&this.reasons.every((n,s)=>kn(n,t.reasons[s]))}[Yt](){return Ck(this.reasons)}}const xS=new WeakMap;var Yw;class lm{constructor(t,n,s){O(this,Yw);O(this,"annotations");O(this,"_tag");if(this[yc]=yc,this._tag=t,n!==yf&&typeof s=="object"&&s!==null&&n.size>0){const i=xS.get(s);i&&(n=new Map([...i,...n])),xS.set(s,n)}this.annotations=n}annotate(t,n){if(t.mapUnsafe.size===0)return this;const s=new Map(this.annotations);t.mapUnsafe.forEach((a,u)=>{(n==null?void 0:n.overwrite)!==!0&&s.has(u)||s.set(u,a)});const i=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return i.annotations=s,i}pipe(){return Lt(this,arguments)}toString(){return vt(this)}[(Yw=yc,go)](){return this.toString()}}const yf=new Map;class jk extends lm{constructor(n,s=yf){super("Fail",s,n);O(this,"error");this.error=n}toString(){return`Fail(${vt(this.error)})`}toJSON(){return{_tag:"Fail",error:this.error}}[Xt](n){return um(n)&&kn(this.error,n.error)&&kn(this.annotations,n.annotations)}[Yt](){return Xn(_t(this._tag))(Xn(dt(this.error))(dt(this.annotations)))}}const il=e=>new vo(e),JN=new vo([]),Nk=e=>new vo([new jk(e)]);class Mk extends lm{constructor(n,s=yf){super("Die",s,n);O(this,"defect");this.defect=n}toString(){return`Die(${vt(this.defect)})`}toJSON(){return{_tag:"Die",defect:this.defect}}[Xt](n){return XN(n)&&kn(this.defect,n.defect)&&kn(this.annotations,n.annotations)}[Yt](){return Xn(_t(this._tag))(Xn(dt(this.defect))(dt(this.annotations)))}}const YN=e=>new vo([new Mk(e)]),Yg=re(e=>mf(e[0]),(e,t,n)=>t.mapUnsafe.size===0?e:new vo(e.reasons.map(s=>s.annotate(t,n)))),um=e=>e._tag==="Fail",XN=e=>e._tag==="Die",cm=e=>e._tag==="Interrupt";function ZN(e){return Si("Effect.evaluate: Not implemented")}const kl=e=>({...KN,[Pk]:e.op,[It]:e[It]??ZN,[Cn]:e[Cn],[gr]:e[gr],[po]:e[po]}),rr=e=>{const t=kl(e);return function(){const n=Object.create(t);return n[Ie]=e.single===!1?arguments:arguments[0],n}},Tk=e=>{const t={...kl(e),[ol]:ol,_tag:e.op,get[e.prop](){return this[Ie]},toString(){return`${e.op}(${vt(this[Ie])})`},toJSON(){return{_id:"Exit",_tag:e.op,[e.prop]:this[Ie]}},[Xt](n){return Ik(n)&&n._tag===this._tag&&kn(this[Ie],n[Ie])},[Yt](){return Xn(_t(e.op),dt(this[Ie]))}};return function(n){const s=Object.create(t);return s[Ie]=n,s}},it=Tk({op:"Success",prop:"value",[It](e){const t=e.getCont(Cn);return t?t[Cn](this[Ie],e,this):e.yieldWith(this)}}),xf={key:"effect/Cause/StackTrace"},eM={key:"effect/Cause/InterruptorStackTrace"},On=Tk({op:"Failure",prop:"cause",[It](e){let t=this[Ie],n=!1;e.currentStackFrame&&(t=Yg(t,{mapUnsafe:new Map([[xf.key,e.currentStackFrame]])}),n=!0);let s=e.getCont(gr);for(;e.interruptible&&e._interruptedCause&&s;)s=e.getCont(gr);return s?s[gr](t,e,n?void 0:this):e.yieldWith(n?this:On(t))}}),yr=e=>On(Nk(e)),Si=e=>On(YN(e)),Ve=rr({op:"WithFiber",[It](e){return this[Ie](e)}}),tM=(function(){class e extends globalThis.Error{asEffect(){return yr(this)}}return Object.assign(e.prototype,GN),e})(),$k=(function(){const e=Symbol.for("effect/Data/Error/plainArgs");return class extends tM{constructor(n){super(n==null?void 0:n.message,n!=null&&n.cause?{cause:n.cause}:void 0),n&&(Object.assign(this,n),Object.defineProperty(this,e,{value:n,enumerable:!1}))}toJSON(){return{...this[e],...this}}}})(),fm=e=>{class t extends $k{constructor(){super(...arguments);O(this,"_tag",e)}}return t.prototype.name=e,t},vS="~effect/Cause/NoSuchElementError";var Xw,Zw;class nM extends(Zw=fm("NoSuchElementError"),Xw=vS,Zw){constructor(n){super({message:n});O(this,Xw,vS)}}const al="~effect/Cause/Done",rM=e=>De(e,al),Fk={[al]:al,_tag:"Done",value:void 0},dm=e=>e===void 0?Fk:{[al]:al,_tag:"Done",value:e},sM=yr(Fk),oM=e=>e===void 0?sM:yr(dm(e)),Lk="~effect/data/Option",Ok={[Lk]:{_A:e=>e},...Ps,...pf},Ak=Object.assign(Object.create(Ok),{_tag:"Some",_op:"Some",[Xt](e){return Dk(e)&&Uk(e)&&kn(this.value,e.value)},[Yt](){return Xn(dt(this._tag))(dt(this.value))},toString(){return`some(${vt(this.value)})`},toJSON(){return{_id:"Option",_tag:this._tag,value:wl(this.value)}},asEffect(){return it(this.value)}});Object.defineProperty(Ak,"valueOrUndefined",{get(){return this.value}});const iM=dt("None"),aM=Object.assign(Object.create(Ok),{_tag:"None",_op:"None",valueOrUndefined:void 0,[Xt](e){return Dk(e)&&zk(e)},[Yt](){return iM},toString(){return"none()"},toJSON(){return{_id:"Option",_tag:this._tag}},asEffect(){return yr(new nM)}}),Dk=e=>De(e,Lk),zk=e=>e._tag==="None",Uk=e=>e._tag==="Some",lM=Object.create(aM),uM=e=>{const t=Object.create(Ak);return t.value=e,t},Vk="~effect/data/Result",Bk={[Vk]:{_A:e=>e,_E:e=>e},...Ps,...pf},cM=Object.assign(Object.create(Bk),{_tag:"Success",_op:"Success",[Xt](e){return qk(e)&&Wk(e)&&kn(this.success,e.success)},[Yt](){return Xn(dt(this._tag))(dt(this.success))},toString(){return`success(${vt(this.success)})`},toJSON(){return{_id:"Result",_tag:this._tag,value:wl(this.success)}},asEffect(){return it(this.success)}}),fM=Object.assign(Object.create(Bk),{_tag:"Failure",_op:"Failure",[Xt](e){return qk(e)&&Hk(e)&&kn(this.failure,e.failure)},[Yt](){return Xn(dt(this._tag))(dt(this.failure))},toString(){return`failure(${vt(this.failure)})`},toJSON(){return{_id:"Result",_tag:this._tag,failure:wl(this.failure)}},asEffect(){return yr(this.failure)}}),qk=e=>De(e,Vk),Hk=e=>e._tag==="Failure",Wk=e=>e._tag==="Success",dM=e=>{const t=Object.create(fM);return t.failure=e,t},hM=e=>{const t=Object.create(cM);return t.success=e,t};function hm(e){return(t,n)=>t===n?0:e(t,n)}const gM=hm((e,t)=>globalThis.Number.isNaN(e)&&globalThis.Number.isNaN(t)?0:globalThis.Number.isNaN(e)?-1:globalThis.Number.isNaN(t)?1:e<t?-1:1),pM=re(2,(e,t)=>hm((n,s)=>e(t(n),t(s)))),mM=e=>re(2,(t,n)=>e(t,n)===1),yM=e=>re(2,(t,n)=>t===n||e(t,n)<1?t:n),xM=e=>re(2,(t,n)=>t===n||e(t,n)>-1?t:n),An=()=>lM,Me=uM,So=zk,ks=Uk,vM=re(2,(e,t)=>So(e)?t():e.value),Gk=vM(uf),gm=re(2,(e,t)=>So(e)?An():Me(t(e.value))),SM=re(2,(e,t)=>So(e)?An():t(e.value)?Me(e.value):An()),Dr=hM,Zn=dM,jt=Hk,wM=Wk,kM={[Symbol.iterator](){return CM}},CM={next(){return{done:!0,value:void 0}}},bM=()=>kM,_M=re(2,(e,t)=>Object.hasOwn(e,t)),RM=e=>Object.keys(e),EM=e=>re(2,(t,n)=>{for(const s of RM(t))if(!_M(n,s)||!e(t[s],n[s]))return!1;return!0}),PM=e=>{const t=EM(e);return(n,s)=>t(n,s)&&t(s,n)},SS=globalThis.Array,mr=e=>SS.isArray(e)?e:SS.from(e),Kk=re(2,(e,t)=>[...e,t]),IM=re(2,(e,t)=>mr(e).concat(mr(t))),wS=bk,$c=bk;function jM(e,t){return e<0||e>=t.length}const NM=re(2,(e,t)=>{const n=Math.floor(t);if(jM(n,e))throw new Error(`Index out of bounds: ${n}`);return e[n]}),MM=NM(0),TM=e=>e.slice(1),$M=re(3,(e,t,n)=>{const s=mr(e),i=mr(t);return $c(s)?$c(i)?AM(n)(IM(s,i)):s:i}),FM=re(2,(e,t)=>$M(e,t,MN())),LM=()=>[],OM=re(2,(e,t)=>e.map(t)),AM=re(2,(e,t)=>{const n=mr(e);if($c(n)){const s=[MM(n)],i=TM(n);for(const a of i)s.every(u=>!t(a,u))&&s.push(a);return s}return[]}),kS="~effect/Context/Service",Un=function(){var i;const e=Error.stackTraceLimit;Error.stackTraceLimit=2;const t=new Error;Error.stackTraceLimit=e;function n(){}const s=n;return Object.setPrototypeOf(s,DM),Object.defineProperty(s,"stack",{get(){return t.stack}}),arguments.length>0?(s.key=arguments[0],(i=arguments[1])!=null&&i.defaultValue&&(s[Fc]=Fc,s.defaultValue=arguments[1].defaultValue),s):function(a,u){return s.key=a,u!=null&&u.make&&(s.make=u.make),s}},DM={[kS]:kS,...Ps,...pf,toJSON(){return{_id:"Service",key:this.key,stack:this.stack}},asEffect(){return(this.asEffect=_s(Ve(t=>it(io(t.context,this)))))()},of(e){return e},context(e){return wi(this,e)},use(e){return Ve(t=>e(io(t.context,this)))},useSync(e){return Ve(t=>it(e(io(t.context,this))))}},Fc="~effect/Context/Reference",Qk="~effect/Context",ys=e=>{const t=Object.create(zM);return t.mapUnsafe=e,t.mutable=!1,t},zM={...Ps,[Qk]:{_Services:e=>e},toJSON(){return{_id:"Context",services:Array.from(this.mapUnsafe).map(([e,t])=>({key:e,value:t}))}},[Xt](e){if(!Jk(e)||this.mapUnsafe.size!==e.mapUnsafe.size)return!1;for(const t of this.mapUnsafe.keys())if(!e.mapUnsafe.has(t)||!kn(this.mapUnsafe.get(t),e.mapUnsafe.get(t)))return!1;return!0},[Yt](){return om(this.mapUnsafe.size)}},Jk=e=>De(e,Qk),Yk=e=>De(e,Fc),er=()=>UM,UM=ys(new Map),wi=(e,t)=>ys(new Map([[e.key,t]])),Is=re(3,(e,t,n)=>Xk(e,s=>{s.set(t.key,n)})),VM=re(3,(e,t,n)=>e.mapUnsafe.has(t.key)?e.mapUnsafe.get(t.key):Yk(t)?Sf(t):n()),vf=re(2,(e,t)=>{if(!e.mapUnsafe.has(t.key)){if(Fc in t)return Sf(t);throw qM(t)}return e.mapUnsafe.get(t.key)}),io=vf,BM=(e,t)=>e.mapUnsafe.has(t.key)?e.mapUnsafe.get(t.key):Sf(t),ag="~effect/Context/defaultValue",Sf=e=>ag in e?e[ag]:e[ag]=e.defaultValue(),qM=e=>{const t=new Error(`Service not found${e.key?`: ${String(e.key)}`:""}`);if(e.stack){const n=e.stack.split(`
|
|
66
|
-
`);if(n.length>2){const s=n[2].match(/at (.*)/);s&&(t.message=t.message+` (defined at ${s[1]})`)}}if(t.stack){const n=t.stack.split(`
|
|
67
|
-
`);n.splice(1,3),t.stack=n.join(`
|
|
68
|
-
`)}return t},HM=re(2,(e,t)=>e.mapUnsafe.has(t.key)?Me(e.mapUnsafe.get(t.key)):Yk(t)?Me(Sf(t)):An()),ki=re(2,(e,t)=>e.mapUnsafe.size===0?t:t.mapUnsafe.size===0?e:Xk(e,n=>{t.mapUnsafe.forEach((s,i)=>n.set(i,s))})),WM=(...e)=>{const t=new Map;for(let n=0;n<e.length;n++)e[n].mapUnsafe.forEach((s,i)=>{t.set(i,s)});return ys(t)},Xk=(e,t)=>{if(e.mutable)return t(e.mapUnsafe),e;const n=new Map(e.mapUnsafe);return t(n),ys(n)},Xe=Un,Lc="~effect/time/Duration",GM=BigInt(0),Zk=BigInt(1e3),KM=BigInt(1e6),QM=/^(-?\d+(?:\.\d+)?)\s+(nanos?|micros?|millis?|seconds?|minutes?|hours?|days?|weeks?)$/,pm=e=>{switch(typeof e){case"number":return ll(e);case"bigint":return _S(e);case"string":{const t=QM.exec(e);if(!t)break;const[n,s,i]=t,a=Number(s);switch(i){case"nano":case"nanos":return _S(BigInt(s));case"micro":case"micros":return nT(BigInt(s));case"milli":case"millis":return ll(a);case"second":case"seconds":return rT(a);case"minute":case"minutes":return sT(a);case"hour":case"hours":return oT(a);case"day":case"days":return iT(a);case"week":case"weeks":return aT(a)}break}case"object":{if(e===null)break;if(Lc in e)return e;if(Array.isArray(e))return e.length!==2||!e.every(wk)?CS(e):Number.isNaN(e[0])||Number.isNaN(e[1])?mm:e[0]===-1/0||e[1]===-1/0?tT:e[0]===1/0||e[1]===1/0?eT:ln(BigInt(Math.round(e[0]*1e9))+BigInt(Math.round(e[1])));const t=e;let n=0;if(t.weeks&&(n+=t.weeks*6048e5),t.days&&(n+=t.days*864e5),t.hours&&(n+=t.hours*36e5),t.minutes&&(n+=t.minutes*6e4),t.seconds&&(n+=t.seconds*1e3),t.milliseconds&&(n+=t.milliseconds),!t.microseconds&&!t.nanoseconds)return ln(n);let s=BigInt(n)*KM;return t.microseconds&&(s+=BigInt(t.microseconds)*Zk),t.nanoseconds&&(s+=BigInt(t.nanoseconds)),ln(s)}}return CS(e)},CS=e=>{throw new Error(`Invalid Input: ${e}`)},bS={_tag:"Millis",millis:0},JM={_tag:"Infinity"},YM={_tag:"NegativeInfinity"},XM={[Lc]:Lc,[Yt](){return im(this.value)},[Xt](e){return ZM(e)&&dT(this,e)},toString(){switch(this.value._tag){case"Infinity":return"Infinity";case"NegativeInfinity":return"-Infinity";case"Nanos":return`${this.value.nanos} nanos`;case"Millis":return`${this.value.millis} millis`}},toJSON(){switch(this.value._tag){case"Millis":return{_id:"Duration",_tag:"Millis",millis:this.value.millis};case"Nanos":return{_id:"Duration",_tag:"Nanos",nanos:String(this.value.nanos)};case"Infinity":return{_id:"Duration",_tag:"Infinity"};case"NegativeInfinity":return{_id:"Duration",_tag:"NegativeInfinity"}}},[go](){return this.toJSON()},pipe(){return Lt(this,arguments)}},ln=e=>{const t=Object.create(XM);return typeof e=="number"?isNaN(e)||e===0||Object.is(e,-0)?t.value=bS:Number.isFinite(e)?Number.isInteger(e)?t.value={_tag:"Millis",millis:e}:t.value={_tag:"Nanos",nanos:BigInt(Math.round(e*1e6))}:t.value=e>0?JM:YM:e===GM?t.value=bS:t.value={_tag:"Nanos",nanos:e},t},ZM=e=>De(e,Lc),mm=ln(0),eT=ln(1/0),tT=ln(-1/0),_S=e=>ln(e),nT=e=>ln(e*Zk),ll=e=>ln(e),rT=e=>ln(e*1e3),sT=e=>ln(e*6e4),oT=e=>ln(e*36e5),iT=e=>ln(e*864e5),aT=e=>ln(e*6048e5),eC=e=>lT(e,{onMillis:_e,onNanos:t=>Number(t)/1e6,onInfinity:()=>1/0,onNegativeInfinity:()=>-1/0}),RS=e=>{switch(e.value._tag){case"Infinity":case"NegativeInfinity":throw new Error("Cannot convert infinite duration to nanos");case"Nanos":return e.value.nanos;case"Millis":return BigInt(Math.round(e.value.millis*1e6))}},lT=re(2,(e,t)=>{switch(e.value._tag){case"Millis":return t.onMillis(e.value.millis);case"Nanos":return t.onNanos(e.value.nanos);case"Infinity":return t.onInfinity();case"NegativeInfinity":return(t.onNegativeInfinity??t.onInfinity)()}}),tC=re(3,(e,t,n)=>e.value._tag==="Infinity"||e.value._tag==="NegativeInfinity"||t.value._tag==="Infinity"||t.value._tag==="NegativeInfinity"?n.onInfinity(e,t):e.value._tag==="Millis"?t.value._tag==="Millis"?n.onMillis(e.value.millis,t.value.millis):n.onNanos(RS(e),t.value.nanos):n.onNanos(e.value.nanos,RS(t))),nC=hm((e,t)=>tC(e,t,{onMillis:(n,s)=>n<s?-1:n>s?1:0,onNanos:(n,s)=>n<s?-1:n>s?1:0,onInfinity:(n,s)=>n.value._tag===s.value._tag?0:n.value._tag==="Infinity"?1:n.value._tag==="NegativeInfinity"||s.value._tag==="Infinity"?-1:1})),uT=(e,t)=>tC(e,t,{onMillis:(n,s)=>n===s,onNanos:(n,s)=>n===s,onInfinity:(n,s)=>n.value._tag===s.value._tag}),cT=yM(nC),fT=xM(nC),dT=re(2,(e,t)=>uT(e,t)),hT=e=>t=>!jt(e(t)),gT=e=>t=>t.has(e)?Dr(t):Zn(t),pT=re(2,(e,t)=>n=>{const s=e(n);return jt(s)?s:t(s.success)}),rC=re(2,(e,t)=>n=>{const s=e(n);if(jt(s))return Zn(n);const i=t(s.success);return jt(i)?Zn(n):i}),sC=Xe("effect/Scheduler",{defaultValue:()=>new iC}),oC="setImmediate"in globalThis?e=>{const t=globalThis.setImmediate(e);return()=>globalThis.clearImmediate(t)}:e=>{const t=setTimeout(e,0);return()=>clearTimeout(t)};class mT{constructor(){O(this,"buckets",[])}scheduleTask(t,n){const s=this.buckets,i=s.length;let a,u=0;for(;u<i&&!(s[u][0]>n);u++)a=s[u];a&&a[0]===n?a[1].push(t):u===i?s.push([n,[t]]):s.splice(u,0,[n,[t]])}drain(){const t=this.buckets;return this.buckets=[],t}}class iC{constructor(t="async",n=oC){O(this,"executionMode");O(this,"setImmediate");this.executionMode=t,this.setImmediate=n}shouldYield(t){return t.currentOpCount>=t.maxOpsBeforeYield}makeDispatcher(){return new yT(this.setImmediate)}}class yT{constructor(t=oC){O(this,"tasks",new mT);O(this,"running");O(this,"setImmediate");O(this,"afterScheduled",()=>{this.running=void 0,this.runTasks()});this.setImmediate=t}scheduleTask(t,n){this.tasks.scheduleTask(t,n),this.running===void 0&&(this.running=this.setImmediate(this.afterScheduled))}runTasks(){const t=this.tasks.drain();for(let n=0;n<t.length;n++){const s=t[n][1];for(let i=0;i<s.length;i++)s[i]()}}flush(){for(;this.tasks.buckets.length>0;)this.running!==void 0&&(this.running(),this.running=void 0),this.runTasks()}}const xT=Xe("effect/Scheduler/MaxOpsBeforeYield",{defaultValue:()=>2048}),vT=Xe("effect/Scheduler/PreventSchedulerYield",{defaultValue:()=>!1}),aC="effect/Tracer/ParentSpan";class ST extends Un()(aC){}const wT=e=>e,Xg=Xe("effect/Tracer/DisablePropagation",{defaultValue:vk}),kT=Xe("effect/Tracer/CurrentTraceLevel",{defaultValue:()=>"Info"}),CT=Xe("effect/Tracer/MinimumTraceLevel",{defaultValue:()=>"All"}),lC="effect/Tracer",bT=Xe(lC,{defaultValue:()=>wT({span:e=>new _T(e)})});class _T{constructor(t){O(this,"_tag","Span");O(this,"spanId");O(this,"traceId","native");O(this,"sampled");O(this,"name");O(this,"parent");O(this,"annotations");O(this,"links");O(this,"startTime");O(this,"kind");O(this,"status");O(this,"attributes");O(this,"events",[]);var n;this.name=t.name,this.parent=t.parent,this.annotations=t.annotations,this.links=t.links,this.startTime=t.startTime,this.kind=t.kind,this.sampled=t.sampled,this.status={_tag:"Started",startTime:t.startTime},this.attributes=new Map,this.traceId=((n=Gk(t.parent))==null?void 0:n.traceId)??ES(32),this.spanId=ES(16)}end(t,n){this.status={_tag:"Ended",endTime:t,exit:n,startTime:this.status.startTime}}attribute(t,n){this.attributes.set(t,n)}event(t,n,s){this.events.push([t,n,s??{}])}addLinks(t){this.links.push(...t)}}const ES=(function(){const e="abcdef0123456789",t=e.length;return function(n){let s="";for(let i=0;i<n;i++)s+=e.charAt(Math.floor(Math.random()*t));return s}})(),RT="effect/observability/Metric/FiberRuntimeMetricsKey",ET=Xe("effect/References/CurrentConcurrency",{defaultValue:()=>"unbounded"}),uC=Xe("effect/References/CurrentStackFrame",{defaultValue:uf}),PT=Xe("effect/References/TracerEnabled",{defaultValue:rm}),cC=Xe("effect/References/TracerTimingEnabled",{defaultValue:rm}),IT=Xe("effect/References/TracerSpanAnnotations",{defaultValue:()=>({})}),jT=Xe("effect/References/TracerSpanLinks",{defaultValue:()=>[]}),ym=Xe("effect/References/CurrentLogAnnotations",{defaultValue:()=>({})}),NT=Xe("effect/References/CurrentLogLevel",{defaultValue:()=>"Info"}),MT=Xe("effect/References/MinimumLogLevel",{defaultValue:()=>"Info"}),TT=Xe("effect/References/CurrentLogSpans",{defaultValue:()=>[]}),$T=e=>{if((e==null?void 0:e.captureStackTrace)===!1)return e;if((e==null?void 0:e.captureStackTrace)!==void 0&&typeof e.captureStackTrace!="boolean")return e;const t=Error.stackTraceLimit;Error.stackTraceLimit=3;const n=new Error;return Error.stackTraceLimit=t,{...e,captureStackTrace:LT(()=>n.stack)}},FT=e=>t=>{let n;return()=>{if(n!==void 0)return n;const s=t();if(!s)return;const i=s.split(`
|
|
69
|
-
`);if(i[e]!==void 0)return n=i[e].trim(),n}},LT=FT(3),OT="dev";class fC extends lm{constructor(n,s=yf){super("Interrupt",s,"Interrupted");O(this,"fiberId");this.fiberId=n}toString(){return`Interrupt(${this.fiberId})`}toJSON(){return{_tag:"Interrupt",fiberId:this.fiberId}}[Xt](n){return cm(n)&&this.fiberId===n.fiberId&&this.annotations===n.annotations}[Yt](){return Xn(_t(`${this._tag}:${this.fiberId}`))(Jg(this.annotations))}}const AT=e=>new fC(e),xm=e=>new vo([new fC(e)]),DT=e=>{const t=e.reasons.find(um);return t?Dr(t):Zn(e)},wo=e=>{for(let t=0;t<e.reasons.length;t++){const n=e.reasons[t];if(n._tag==="Fail")return Dr(n.error)}return Zn(e)},zT=e=>e.reasons.some(cm),vm=e=>{let t;for(let n=0;n<e.reasons.length;n++){const s=e.reasons[n];s._tag==="Interrupt"&&(t??(t=new Set),s.fiberId!==void 0&&t.add(s.fiberId))}return t?Dr(t):Zn(e)},UT=e=>{const t=vm(e);return jt(t)?VT:t.success},VT=new Set,BT=e=>e.reasons.length>0&&e.reasons.every(cm),qT=re(2,(e,t)=>{if(e.reasons.length===0)return t;if(t.reasons.length===0)return e;const n=new vo(FM(e.reasons,t.reasons));return kn(e,n)?e:n}),HT=e=>{const t={Fail:[],Die:[],Interrupt:[]};for(let n=0;n<e.reasons.length;n++)t[e.reasons[n]._tag].push(e.reasons[n]);return t},Sm=e=>{const t=HT(e);return t.Fail.length>0?t.Fail[0].error:t.Die.length>0?t.Die[0].defect:t.Interrupt.length>0?new globalThis.Error("All fibers interrupted without error"):new globalThis.Error("Empty cause")},WT=e=>{const t=[],n=[];if(e.reasons.length===0)return t;const s=Error.stackTraceLimit;Error.stackTraceLimit=1;for(const i of e.reasons){if(i._tag==="Interrupt"){n.push(i);continue}t.push(Zg(i._tag==="Die"?i.defect:i.error,i.annotations))}if(t.length===0){const i=new Error("The fiber was interrupted by:");i.name="InterruptCause",i.stack=JT(i,n);const a=new globalThis.Error("All fibers interrupted without error",{cause:i});a.name="InterruptError",a.stack=`${a.name}: ${a.message}`,t.push(Zg(a,n[0].annotations))}return Error.stackTraceLimit=s,t},Zg=(e,t)=>{const n=typeof e;let s;if(e&&n==="object"){if(s=new globalThis.Error(GT(e),{cause:e.cause?Zg(e.cause):void 0}),typeof e.name=="string"&&(s.name=e.name),typeof e.stack=="string")s.stack=QT(e.stack,s,t);else{const i=`${s.name}: ${s.message}`;s.stack=t?dC(i,t):i}for(const i of Object.keys(e))i in s||(s[i]=e[i])}else s=new globalThis.Error(e?n==="string"?e:Rk(e):`Unknown error: ${e}`);return s},GT=e=>{if(typeof e.message=="string")return e.message;if(typeof e.toString=="function"&&e.toString!==Object.prototype.toString&&e.toString!==Array.prototype.toString)try{return e.toString()}catch{}return Rk(e)},KT=/\((.*)\)/g,QT=(e,t,n)=>{const s=`${t.name}: ${t.message}`,i=(e.startsWith(s)?e.slice(s.length):e).split(`
|
|
70
|
-
`),a=[s];for(let u=1;u<i.length&&!/(?:Generator\.next|~effect\/Effect)/.test(i[u]);u++)a.push(i[u]);return n?dC(a.join(`
|
|
71
|
-
`),n):a.join(`
|
|
72
|
-
`)},dC=(e,t)=>{const n=t==null?void 0:t.get(xf.key);return n&&(e=`${e}
|
|
73
|
-
${hC(n)}`),e},JT=(e,t)=>{const n=[`${e.name}: ${e.message}`];for(const s of t){const i=s.fiberId!==void 0?`#${s.fiberId}`:"unknown",a=s.annotations.get(eM.key);n.push(` at fiber (${i})`),a&&n.push(hC(a))}return n.join(`
|
|
74
|
-
`)},hC=e=>{const t=[];let n=e,s=0;for(;n&&s<10;){const i=n.stack();if(i){const a=i.matchAll(KT);let u=!1;for(const[,f]of a)u=!0,t.push(` at ${n.name} (${f})`);u||t.push(` at ${n.name} (${i.replace(/^at /,"")})`)}else t.push(` at ${n.name}`);n=n.parent,s++}return t.join(`
|
|
75
|
-
`)},gC=e=>WT(e).map(t=>t.cause?`${t.stack} {
|
|
76
|
-
${pC(t.cause," ")}
|
|
77
|
-
}`:t.stack).join(`
|
|
78
|
-
`),pC=(e,t)=>{const n=e.stack.split(`
|
|
79
|
-
`);let s=`${t}[cause]: ${n[0]}`;for(let i=1,a=n.length;i<a;i++)s+=`
|
|
80
|
-
${t}${n[i]}`;return e.cause&&(s+=` {
|
|
81
|
-
${pC(e.cause,`${t} `)}
|
|
82
|
-
${t}}`),s},ep=`~effect/Fiber/${OT}`,YT={_A:_e,_E:_e},XT={id:0},wm=()=>globalThis[za];var e1;e1=ep;class mC{constructor(t,n=!0){O(this,e1);O(this,"id");O(this,"interruptible");O(this,"currentOpCount");O(this,"currentLoopCount");O(this,"_stack");O(this,"_observers");O(this,"_exit");O(this,"_currentExit");O(this,"_children");O(this,"_interruptedCause");O(this,"_yielded");O(this,"context");O(this,"currentScheduler");O(this,"currentTracerContext");O(this,"currentSpan");O(this,"currentLogLevel");O(this,"minimumLogLevel");O(this,"currentStackFrame");O(this,"runtimeMetrics");O(this,"maxOpsBeforeYield");O(this,"currentPreventYield");O(this,"_dispatcher");this[ep]=YT,this.setContext(t),this.id=++XT.id,this.currentOpCount=0,this.currentLoopCount=0,this.interruptible=n,this._stack=[],this._observers=[],this._exit=void 0,this._children=void 0,this._interruptedCause=void 0,this._yielded=void 0}get currentDispatcher(){return this._dispatcher??(this._dispatcher=this.currentScheduler.makeDispatcher())}getRef(t){return BM(this.context,t)}addObserver(t){return this._exit?(t(this._exit),Sl):(this._observers.push(t),()=>{const n=this._observers.indexOf(t);n>=0&&this._observers.splice(n,1)})}interruptUnsafe(t,n){if(this._exit)return;let s=xm(t);this.currentStackFrame&&(s=Yg(s,wi(xf,this.currentStackFrame))),n&&(s=Yg(s,n)),this._interruptedCause=this._interruptedCause?qT(this._interruptedCause,s):s,this.interruptible&&this.evaluate(Ft(this._interruptedCause))}pollUnsafe(){return this._exit}evaluate(t){var s,i;if((s=this.runtimeMetrics)==null||s.recordFiberStart(this.context),this._exit)return;if(this._yielded!==void 0){const a=this._yielded;this._yielded=void 0,a()}const n=this.runLoop(t);if(n!==Js){this._exit=n,(i=this.runtimeMetrics)==null||i.recordFiberEnd(this.context,this._exit);for(let a=0;a<this._observers.length;a++)this._observers[a](n);this._observers.length=0}}runLoop(t){const n=globalThis[za];globalThis[za]=this;let s=!1,i=t;this.currentOpCount=0;const a=++this.currentLoopCount;try{for(;;){if(this.currentOpCount++,!s&&!this.currentPreventYield&&this.currentScheduler.shouldYield(this)){s=!0;const u=i;i=Le(Cm,()=>u)}if(i=this.currentTracerContext?this.currentTracerContext(i,this):i[It](this),a!==this.currentLoopCount)return Js;if(i===Js){const u=this._yielded;return ol in u?(this._yielded=void 0,u):Js}}}catch(u){return De(i,It)?this.runLoop(Si(u)):Si(`Fiber.runLoop: Not a valid effect: ${String(i)}`)}finally{globalThis[za]=n}}getCont(t){for(;;){const n=this._stack.pop();if(!n)return;const s=n[po]&&n[po](this);if(s)return s[t]=s,s;if(n[t])return n}}yieldWith(t){return this._yielded=t,Js}children(){return this._children??(this._children=new Set)}pipe(){return Lt(this,arguments)}setContext(t){this.context=t;const n=this.getRef(sC);n!==this.currentScheduler&&(this.currentScheduler=n,this._dispatcher=void 0),this.currentSpan=t.mapUnsafe.get(aC),this.currentLogLevel=this.getRef(NT),this.minimumLogLevel=this.getRef(MT),this.currentStackFrame=t.mapUnsafe.get(uC.key),this.maxOpsBeforeYield=this.getRef(xT),this.currentPreventYield=this.getRef(vT),this.runtimeMetrics=t.mapUnsafe.get(RT);const s=t.mapUnsafe.get(lC);this.currentTracerContext=s?s.context:void 0}get currentSpanLocal(){var t;return((t=this.currentSpan)==null?void 0:t._tag)==="Span"?this.currentSpan:void 0}}const wf=e=>{if(!e.currentStackFrame)return;const t=new Map;return t.set(xf.key,e.currentStackFrame),ys(t)},yC=e=>{const t=e;return t._exit?Re(t._exit):sr(n=>t._exit?n(Re(t._exit)):yt(e.addObserver(s=>n(Re(s)))))},xC=e=>sr(t=>{const n=e[Symbol.iterator](),s=[];let i;function a(){let u=n.next();for(;!u.done;){if(u.value._exit){s.push(u.value._exit),u=n.next();continue}i=u.value.addObserver(f=>{s.push(f),a()});return}t(Re(s))}return a(),yt(()=>i==null?void 0:i())}),km=e=>Ve(t=>ZT(e,t.id)),ZT=re(e=>De(e[0],ep),(e,t,n)=>Ve(s=>{let i=wf(s);return i=i&&n?ki(i,n):i??n,e.interruptUnsafe(t,i),bC(yC(e))})),Oc=e=>Ve(t=>{const n=wf(t);for(const s of e)s.interruptUnsafe(t.id,n);return bC(xC(e))}),Re=it,Ft=On,kf=yr,yt=rr({op:"Sync",[It](e){const t=this[Ie](),n=e.getCont(Cn);return n?n[Cn](t,e):e.yieldWith(it(t))}}),St=rr({op:"Suspend",[It](e){return this[Ie]()}}),e$=rr({op:"Yield",[It](e){let t=!1;return e.currentDispatcher.scheduleTask(()=>{t||e.evaluate(Dn)},this[Ie]??0),e.yieldWith(()=>{t=!0})}}),Cm=e$(0),t$=e=>Re(Me(e)),n$=Re(An()),Cf=e=>Si(e),vC=e=>St(()=>kf(Jt(e))),ot=Re(void 0),r$=e=>SC(function(t,n){Jt(()=>e(n)).then(s=>t(Re(s)),s=>t(Cf(s)))},e.length!==0),s$=e=>Ve(t=>e(t.id)),SC=rr({op:"Async",single:!1,[It](e){const t=Jt(()=>this[Ie][0].bind(e.currentScheduler));let n=!1,s=!1;const i=this[Ie][1]?new AbortController:void 0,a=t(u=>{n||(n=!0,s?e.evaluate(u):s=u)},i==null?void 0:i.signal);return s!==!1?s:(s=!0,e._yielded=()=>{n=!0},i===void 0&&a===void 0||e._stack.push(o$(()=>(n=!0,i==null||i.abort(),a??Dn))),Js)}}),o$=rr({op:"AsyncFinalizer",[po](e){e.interruptible&&(e.interruptible=!1,e._stack.push(If))},[gr](e,t){return zT(e)?Le(this[Ie](),()=>Ft(e)):Ft(e)}}),sr=e=>SC(e,e.length>=2),i$=sr(Sl),a$=(...e)=>St(()=>ul(e.length===1?e[0]():e[1].call(e[0].self))),wC=(e,...t)=>{const n=t.length===0?function(){return St(()=>ul(e.apply(this,arguments)))}:function(){let s=St(()=>ul(e.apply(this,arguments)));for(let i=0;i<t.length;i++)s=t[i](s,...arguments);return s};return kC(e.length,n)},kC=(e,t)=>Object.defineProperty(t,"length",{value:e,configurable:!0}),l$=(e,...t)=>kC(e.length,t.length===0?function(){return PS(()=>e.apply(this,arguments))}:function(){let n=PS(()=>e.apply(this,arguments));for(const s of t)n=s(n);return n}),PS=e=>{try{const t=e();let n;for(;;){const s=t.next(n);if(s.done)return Re(s.value);const a=s.value.asEffect(),u=a;if(u&&u._tag==="Success"){n=u.value;continue}else{if(u&&u._tag==="Failure")return a;{let f=!0;return St(()=>f?(f=!1,Le(a,d=>ul(t,d))):St(()=>ul(e())))}}}}catch(t){return Cf(t)}},ul=rr({op:"Iterator",single:!1,[Cn](e,t){const n=this[Ie][0];for(;;){const s=n.next(e);if(s.done)return Re(s.value);const i=s.value.asEffect();if(bn(i)){if(i._tag==="Failure")return i}else return t._stack.push(this),i;e=i.value}},[It](e){return this[Cn](this[Ie][1],e)}}),ji=re(2,(e,t)=>{const n=Re(t);return Le(e,s=>n)}),Cl=re(2,(e,t)=>Le(e,n=>Ht(t)?t:Jt(()=>t(n)))),CC=re(2,(e,t)=>Le(e,n=>ji(Ht(t)?t:Jt(()=>t(n)),n))),bC=e=>Le(e,t=>Dn),u$=(e,t)=>Ve(n=>sr(s=>{let i=!1;const a=new Set,u=d=>{i=!0,s(a.size===0?d:Le(LC(Oc(a)),()=>d))};let f=0;for(const d of e){if(i)break;const h=f++,m=Nf(n,d,!0,!0,!1);a.add(m),m.addObserver(p=>{a.delete(m);const x=!i;u(p),x&&(t!=null&&t.onWinner)&&t.onWinner({fiber:m,index:h,parentFiber:n})})}return Oc(a)})),_C=re(e=>Ht(e[1]),(e,t,n)=>u$([e,t],n)),Le=re(2,(e,t)=>{const n=Object.create(c$);return n[Ie]=e,n[Cn]=t.length!==1?s=>t(s):t,n}),c$=kl({op:"OnSuccess",[It](e){return e._stack.push(this),this[Ie]}}),bn=e=>ol in e,f$=re(2,(e,t)=>bn(e)?e._tag==="Success"?t(e.value):e:Le(e,t)),d$=e=>Le(e,_e),xt=re(2,(e,t)=>Le(e,n=>Re(Jt(()=>t(n))))),h$=re(2,(e,t)=>bn(e)?S$(e,t):xt(e,t)),g$=re(2,(e,t)=>bn(e)?w$(e,t):$$(e,t)),p$=re(2,(e,t)=>bn(e)?k$(e,t):F$(e,t)),m$=re(2,(e,t)=>{if(bn(e)){if(e._tag==="Success")return e;const n=wo(e.cause);return jt(n)?e:t(n.success)}return _f(e,t)}),y$=e=>On(xm(e)),bm=e=>e._tag==="Success",x$=e=>e._tag==="Failure",v$=e=>e._tag==="Failure"?Dr(e.cause):Zn(e),Dn=it(void 0),S$=re(2,(e,t)=>e._tag==="Success"?it(t(e.value)):e),w$=re(2,(e,t)=>{if(e._tag==="Success")return e;const n=wo(e.cause);return jt(n)?e:yr(t(n.success))}),k$=re(2,(e,t)=>{if(e._tag==="Success")return it(t.onSuccess(e.value));const n=wo(e.cause);return jt(n)?e:yr(t.onFailure(n.success))}),C$=re(2,(e,t)=>bm(e)?t:e),b$=e=>{const t=[];for(const n of e)n._tag==="Failure"&&t.push(...n.cause.reasons);return t.length===0?Dn:On(il(t))},_$=e=>bm(e)?Me(e.value):An(),R$=e=>Ve(t=>Re(HM(t.context,e))),bf=re(2,(e,t)=>Ve(n=>{const s=n.context,i=t(s);return s===i?e:(n.setContext(i),FC(e,()=>{n.setContext(s)}))})),RC=re(3,(e,t,n)=>bf(e,s=>{const i=vf(s,t),a=n(i);return i===a?s:Is(s,t,a)})),E$=()=>P$,P$=Ve(e=>Re(e.context)),EC=e=>Ve(t=>e(t.context)),bl=re(2,(e,t)=>bn(e)?e:bf(e,ki(t))),_l=function(){return arguments.length===1?re(2,(e,t)=>IS(e,arguments[0],t)):re(3,(e,t,n)=>IS(e,t,n)).apply(this,arguments)},IS=(e,t,n)=>bf(e,s=>s.mapUnsafe.get(t.key)===n?s:Is(s,t,n)),PC=re(e=>Ht(e[1]),(e,t,n)=>I$(e,t,(s,i)=>[s,i],n)),I$=re(e=>Ht(e[1]),(e,t,n,s)=>s!=null&&s.concurrent?xt(rF([e,t],{concurrency:2}),([i,a])=>Jt(()=>n(i,a))):Le(e,i=>xt(t,a=>Jt(()=>n(i,a))))),j$=re(e=>Ht(e[0]),(e,t)=>Pm({while:rm,body:_s(t!=null&&t.disableYield?e:Le(e,n=>Cm)),step:Sl})),Rl=re(2,(e,t)=>{const n=Object.create(N$);return n[Ie]=e,n[gr]=t.length!==1?s=>t(s):t,n}),N$=kl({op:"OnFailure",[It](e){return e._stack.push(this),this[Ie]}}),IC=re(3,(e,t,n)=>Rl(e,s=>{const i=t(s);return jt(i)?Ft(i.failure):Jt(()=>n(i.success,s))})),_f=re(2,(e,t)=>IC(e,wo,n=>t(n))),M$=re(2,(e,t)=>Rl(e,n=>Cl(Jt(()=>t(n)),Ft(n)))),T$=re(e=>Ht(e[0]),(e,t,n,s)=>Rl(e,i=>{const a=wo(i);if(jt(a))return Ft(a.failure);const u=t(a.success);return jt(u)?s?Jt(()=>s(u.failure)):Ft(i):Jt(()=>n(u.success))})),$$=re(2,(e,t)=>_f(e,n=>vC(()=>t(n)))),F$=re(2,(e,t)=>_m(e,{onFailure:n=>vC(()=>t.onFailure(n)),onSuccess:n=>yt(()=>t.onSuccess(n))})),L$=e=>_f(e,Cf),O$=re(e=>Ht(e[0]),(e,t)=>{if(!(t!=null&&t.log))return _m(e,{onFailure:s=>ot,onSuccess:s=>ot});const n=JC(t.log===!0?void 0:t.log);return Rf(e,{onFailure(s){const i=DT(s);return jt(i)?Ft(i.failure):t.message===void 0?n(s):n(t.message,s)},onSuccess:s=>ot})}),lg=e=>z$(e,{onFailure:Zn,onSuccess:Dr}),Rf=re(2,(e,t)=>{const n=Object.create(A$);return n[Ie]=e,n[Cn]=t.onSuccess.length!==1?s=>t.onSuccess(s):t.onSuccess,n[gr]=t.onFailure.length!==1?s=>t.onFailure(s):t.onFailure,n}),A$=kl({op:"OnSuccessAndFailure",[It](e){return e._stack.push(this),this[Ie]}}),_m=re(2,(e,t)=>Rf(e,{onFailure:n=>{const s=n.reasons.find(um);return s?Jt(()=>t.onFailure(s.error)):Ft(n)},onSuccess:t.onSuccess})),D$=re(2,(e,t)=>_m(e,{onFailure:n=>yt(()=>t.onFailure(n)),onSuccess:n=>yt(()=>t.onSuccess(n))})),z$=re(2,(e,t)=>{if(bn(e)){if(e._tag==="Success")return it(t.onSuccess(e.value));const n=wo(e.cause);return jt(n)?e:it(t.onFailure(n.success))}return D$(e,t)}),Ef=e=>bn(e)?it(e):U$(e),U$=rr({op:"Exit",[It](e){return e._stack.push(this),this[Ie]},[Cn](e,t,n){return Re(n??it(e))},[gr](e,t,n){return Re(n??On(e))}}),V$=re(2,(e,t)=>Cl(Nm(t),e)),jC=re(2,(e,t)=>_C(e,Le(Nm(t.duration),t.orElse))),B$=re(2,(e,t)=>jC(e,{duration:t,orElse:()=>kf(new RF)})),jS="~effect/Scope",NS="~effect/Scope/Closeable",Pf=Un("effect/Scope"),NC=(e,t)=>St(()=>MC(e,t)??ot),MC=(e,t)=>{if(e.state._tag==="Closed")return;const n={_tag:"Closed",exit:t};if(e.state._tag==="Empty"){e.state=n;return}const{finalizers:s}=e.state;if(e.state=n,s.size!==0)return s.size===1?s.values().next().value(t):q$(e,s,t)},q$=wC(function*(e,t,n){let s=[];const i=[],a=Array.from(t.values()),u=wm();for(let f=a.length-1;f>=0;f--){const d=a[f];e.strategy==="sequential"?s.push(yield*Ef(d(n))):i.push(Nf(u,d(n),!0,!0,"inherit"))}return i.length>0&&(s=yield*xC(i)),yield*b$(s)}),H$=(e,t)=>{const n=Em(t);if(e.state._tag==="Closed")return n.state=e.state,n;const s={};return cl(e,s,i=>NC(n,i)),cl(n,s,i=>yt(()=>Rm(e,s))),n},Ci=(e,t)=>St(()=>e.state._tag==="Closed"?t(e.state.exit):(cl(e,{},t),ot)),W$=(e,t)=>Ci(e,_s(t)),cl=(e,t,n)=>{e.state._tag==="Empty"?e.state={_tag:"Open",finalizers:new Map([[t,n]])}:e.state._tag==="Open"&&e.state.finalizers.set(t,n)},Rm=(e,t)=>{e.state._tag==="Open"&&e.state.finalizers.delete(t)},Em=(e="sequential")=>({[NS]:NS,[jS]:jS,strategy:e,state:G$}),G$={_tag:"Empty"},TC=Pf.asEffect(),K$=_l(Pf),$C=e=>St(()=>{const t=Em();return js(e(t),n=>St(()=>MC(t,n)??ot))}),Q$=(e,t,n)=>EC(s=>DC(i=>Le(TC,a=>CC(n!=null&&n.interruptible?i(e):e,u=>Ci(a,f=>bl(t(u,f),s)))))),FC=rr({op:"OnExit",single:!1,[It](e){return e._stack.push(this),this[Ie][0]},[po](e){e.interruptible&&this[Ie][2]!==!0&&(e._stack.push(If),e.interruptible=!1)},[Cn](e,t,n){n??(n=it(e));const s=this[Ie][1](n);return s?Le(s,i=>n):n},[gr](e,t,n){n??(n=On(e));const s=this[Ie][1](n);return s?Le(s,i=>n):n}}),js=re(2,FC),J$=re(2,(e,t)=>js(e,n=>t)),Y$=re(3,(e,t,n)=>js(e,s=>{const i=t(s);return jt(i)?ot:n(i.success,s)})),X$=re(2,(e,t)=>Y$(e,v$,t)),Z$=re(3,(e,t,n)=>js(e,s=>{if(s._tag!=="Failure")return ot;const i=t(s.cause);return jt(i)?ot:n(i.success,s.cause)})),eF=re(2,(e,t)=>Z$(vm,t)(e)),tF=Ve(e=>Ft(xm(e.id))),LC=e=>Ve(t=>(t.interruptible&&(t.interruptible=!1,t._stack.push(If)),e)),OC=rr({op:"SetInterruptible",[po](e){if(e.interruptible=this[Ie],e._interruptedCause&&e.interruptible)return()=>Ft(e._interruptedCause)}}),If=OC(!0),nF=OC(!1),AC=e=>Ve(t=>t.interruptible?e:(t.interruptible=!0,t._stack.push(nF),t._interruptedCause?Ft(t._interruptedCause):e)),DC=e=>Ve(t=>t.interruptible?(t.interruptible=!1,t._stack.push(If),e(AC)):e(_e)),rF=(e,t)=>mN(e)?(t==null?void 0:t.mode)==="result"?Ys(e,lg,t):Ys(e,_e,t):t!=null&&t.discard?t.mode==="result"?Ys(Object.values(e),lg,t):Ys(Object.values(e),_e,t):St(()=>{const n={};return ji(Ys(Object.entries(e),([s,i])=>xt((t==null?void 0:t.mode)==="result"?lg(i):i,a=>{n[s]=a}),{discard:!0,concurrency:t==null?void 0:t.concurrency}),n)}),Pm=rr({op:"While",[Cn](e,t){return this[Ie].step(e),this[Ie].while()?(t._stack.push(this),this[Ie].body()):Dn},[It](e){return this[Ie].while()?(e._stack.push(this),this[Ie].body()):Dn}}),Ys=re(e=>typeof e[1]=="function",(e,t,n)=>Ve(s=>{const i=(n==null?void 0:n.concurrency)==="inherit"?s.getRef(ET):(n==null?void 0:n.concurrency)??1,a=i==="unbounded"?Number.POSITIVE_INFINITY:Math.max(1,i);if(a===1)return sF(e,t,n);const u=mr(e);let f=u.length;if(f===0)return n!=null&&n.discard?ot:Re([]);const d=n!=null&&n.discard?void 0:new Array(f),h=oF({f:t,out:d},u,{concurrency:a});return h?ji(h,d):Re(d)})),sF=(e,t,n)=>St(()=>{const s=n!=null&&n.discard?void 0:[],i=e[Symbol.iterator]();let a=i.next(),u=0;return ji(Pm({while:()=>!a.done,body:()=>t(a.value,u++),step:f=>{s&&s.push(f),a=i.next()}}),s)}),zC=e=>{const t=e.onItem,n=e.step;return(s,i,a)=>{let u=(a==null?void 0:a.start)??0;const f=(a==null?void 0:a.end)??i.length,d=(a==null?void 0:a.concurrency)??1;let h=!1,m,p,x,v=!1,w,k;const b=()=>{let _=!1;for(;!w&&u<f;u++){const R=i[u],j=k??t(s,R,u);if(bn(j)){if(w=n(s,R,j,u),w)break}else{if(d===1)return Le(Ef(j),E=>(w=n(s,R,E,u),u++,w??b()??ot));if(m){k=void 0;const E=Nf(m,j,!0,!0,"inherit");if(E._exit){if(w=n(s,R,E._exit,u),w)break;continue}p?p.add(E):p=new Set([E]);const T=u;if(E.addObserver($=>{if(p.delete(E),w){if(!v&&$._tag==="Failure")for(const L of $.cause.reasons)L._tag!=="Interrupt"&&(w._tag==="Failure"?w.cause.reasons.push(L):w=On(il([L])))}else{const L=n(s,R,$,T);L&&(w=L._tag==="Failure"?On(il(L.cause.reasons.slice())):L,b())}if(_){const L=b();L&&x(L)}else h&&p.size===0&&x(w??ot)}),p.size<d)continue;_=!0,u++;return}else return sr(E=>{m=wm(),k=j,x=E;const T=b();return T?E(T):St(()=>(w=Dn,v=!0,p?Oc(p):ot))})}}if(h=!0,w){if(p&&p.size>0){const R=wf(m);p.forEach(j=>j.interruptUnsafe(m.id,R));return}if(x||w._tag==="Failure")return w}else if(x)if(p)p.size===0&&x(ot);else return Dn};return b()}},jf=()=>zC,oF=zC({onItem(e,t,n){return e.f(t,n)},step(e,t,n,s){if(n._tag==="Failure")return n;e.out&&(e.out[s]=n.value)}}),Nf=(e,t,n=!1,s=!1,i=!1)=>{const a=i==="inherit"?e.interruptible:!i,u=new mC(e.context,a);return n?u.evaluate(t):e.currentDispatcher.scheduleTask(()=>u.evaluate(t),0),!s&&!u._exit&&(e.children().add(u),u.addObserver(()=>e._children.delete(u))),u},UC=re(e=>Ht(e[0]),(e,t,n)=>Ve(s=>{const i=Nf(s,e,n==null?void 0:n.startImmediately,!0,n==null?void 0:n.uninterruptible);if(!i._exit)if(t.state._tag!=="Closed"){const a={};cl(t,a,()=>s$(f=>f===i.id?ot:km(i))),i.addObserver(()=>Rm(t,a))}else i.interruptUnsafe(s.id,wf(s));return Re(i)})),iF=re(e=>Ht(e[0]),(e,t)=>Le(TC,n=>UC(e,n,t))),El=e=>(t,n)=>{const s=new mC(n!=null&&n.scheduler?Is(e,sC,n.scheduler):e,(n==null?void 0:n.uninterruptible)!==!0);if(s.evaluate(t),s._exit)return s;if(n!=null&&n.signal)if(n.signal.aborted)s.interruptUnsafe();else{const i=()=>s.interruptUnsafe();n.signal.addEventListener("abort",i,{once:!0}),s.addObserver(()=>n.signal.removeEventListener("abort",i))}return n!=null&&n.onFiberStart&&n.onFiberStart(s),s},aF=re(2,(e,t)=>{if(e._exit)return e;if(t.state._tag==="Closed")return e.interruptUnsafe(e.id),e;const n={};return cl(t,n,()=>km(e)),e.addObserver(()=>Rm(t,n)),e}),lF=El(er()),VC=e=>{const t=El(e);return(n,s)=>{const i=t(n,s);return s!=null&&s.onExit&&i.addObserver(s.onExit),a=>i.interruptUnsafe(a)}},uF=VC(er()),Im=e=>{const t=El(e);return(n,s)=>{const i=t(n,s);return new Promise(a=>{i.addObserver(u=>a(u))})}},cF=Im(er()),BC=e=>{const t=Im(e);return(n,s)=>t(n,s).then(i=>{if(i._tag==="Failure")throw Sm(i.cause);return i.value})},fF=BC(er()),jm=e=>{const t=El(e);return n=>{var a;if(bn(n))return n;const s=new iC("sync"),i=t(n,{scheduler:s});return(a=i.currentDispatcher)==null||a.flush(),i._exit??Si(new EF(i))}},dF=jm(er()),qC=e=>{const t=jm(e);return n=>{const s=t(n);if(s._tag==="Failure")throw Sm(s.cause);return s.value}},hF=qC(er()),MS=Re(!0),TS=Re(!1);class gF{constructor(t){O(this,"waiters",[]);O(this,"scheduled",!1);O(this,"isOpen");O(this,"flushWaiters",()=>{this.scheduled=!1;const t=this.waiters;this.waiters=[];for(let n=0;n<t.length;n++)t[n](Dn)});O(this,"open",Ve(t=>this.isOpen?TS:(this.isOpen=!0,this.scheduleUnsafe(t))));O(this,"release",Ve(t=>this.isOpen?TS:this.scheduleUnsafe(t)));O(this,"await",sr(t=>this.isOpen?t(ot):(this.waiters.push(t),yt(()=>{const n=this.waiters.indexOf(t);n!==-1&&this.waiters.splice(n,1)}))));O(this,"close",yt(()=>this.closeUnsafe()));O(this,"whenOpen",t=>Le(this.await,()=>t));this.isOpen=t}scheduleUnsafe(t){return this.scheduled||this.waiters.length===0||(this.scheduled=!0,t.currentDispatcher.scheduleTask(this.flushWaiters,0)),MS}openUnsafe(){return this.isOpen?!1:(this.isOpen=!0,this.flushWaiters(),!0)}closeUnsafe(){return this.isOpen?(this.isOpen=!1,!0):!1}}const pF=e=>new gF(e??!1),tp=BigInt(0),mF={_tag:"Span",spanId:"noop",traceId:"noop",sampled:!1,status:{_tag:"Ended",startTime:tp,endTime:tp,exit:Dn},attributes:new Map,links:[],kind:"internal",attribute(){},event(){},end(){},addLinks(){}},yF=e=>Object.assign(Object.create(mF),e),HC=e=>e?io(e.annotations,Xg)?e._tag==="Span"?HC(Gk(e.parent)):An():Me(e):An(),WC=(e,t,n)=>{const s=!e.getRef(PT)||(n==null?void 0:n.annotations)&&io(n.annotations,Xg),i=(n==null?void 0:n.parent)!==void 0?Me(n.parent):n!=null&&n.root?An():HC(e.currentSpan);let a;if(s)a=yF({name:t,parent:i,annotations:Is((n==null?void 0:n.annotations)??er(),Xg,!0)});else{const u=e.getRef(bT),f=e.getRef(Ni),d=e.getRef(cC),h=e.getRef(IT),m=e.getRef(jT),p=(n==null?void 0:n.level)??e.getRef(kT),x=(n==null?void 0:n.links)!==void 0?[...m,...n.links]:m.slice();a=u.span({name:t,parent:i,annotations:(n==null?void 0:n.annotations)??er(),links:x,startTime:d?f.currentTimeNanosUnsafe():BigInt(0),kind:(n==null?void 0:n.kind)??"internal",root:(n==null?void 0:n.root)??So(i),sampled:(n==null?void 0:n.sampled)??(ks(i)&&i.value.sampled===!1?!1:!KC(e.getRef(CT),p))});for(const[v,w]of Object.entries(h))a.attribute(v,w);if((n==null?void 0:n.attributes)!==void 0)for(const[v,w]of Object.entries(n.attributes))a.attribute(v,w)}return a},xF=(e,t)=>LC(Ve(n=>{const s=vf(n.context,Pf),i=WC(n,e,t??{}),a=n.getRef(Ni),u=n.getRef(cC);return ji(Ci(s,f=>SF(i,f,a,u)),i)})),vF=(e,t)=>(t=typeof t=="function"?t:uf,RC(uC,n=>({name:e,stack:t,parent:n}))),SF=(e,t,n,s)=>yt(()=>{e.status._tag!=="Ended"&&e.end(s?n.currentTimeNanosUnsafe():tp,t)}),wF=(e,...t)=>{const n=t.length===1?void 0:t[0],s=t[t.length-1];return Ve(i=>{const a=WC(i,e,n),u=i.getRef(Ni);return js(Jt(()=>s(a)),f=>yt(()=>{a.status._tag!=="Ended"&&a.end(u.currentTimeNanosUnsafe(),f)}))})},$S=_l(ST),kF=function(){const e=Ht(arguments[0]),t=e?arguments[1]:arguments[0];let n=e?arguments[2]:arguments[1],s=_e;return t._tag==="Span"&&(n=$T(n),s=vF(t.name,n==null?void 0:n.captureStackTrace)),e?$S(s(arguments[0]),t):i=>$S(s(i),t)},Ni=Xe("effect/Clock",{defaultValue:()=>new bF}),CF=2**31-1;class bF{constructor(){O(this,"currentTimeMillis",yt(()=>this.currentTimeMillisUnsafe()));O(this,"currentTimeNanos",yt(()=>this.currentTimeNanosUnsafe()))}currentTimeMillisUnsafe(){return Date.now()}currentTimeNanosUnsafe(){return _F()}sleep(t){const n=eC(t);return n<=0?Cm:sr(s=>{if(n>CF)return;const i=setTimeout(()=>s(ot),n);return yt(()=>clearTimeout(i))})}}const FS=(function(){const e=BigInt(1e6);if(typeof performance>"u"||typeof performance.now>"u")return()=>BigInt(Date.now())*e;if(typeof performance.timeOrigin=="number"&&performance.timeOrigin===0)return()=>BigInt(Math.round(performance.now()*1e6));const t=BigInt(Date.now())*e-BigInt(Math.round(performance.now()*1e6));return()=>t+BigInt(Math.round(performance.now()*1e6))})(),_F=(function(){const e=typeof process=="object"&&"hrtime"in process&&typeof process.hrtime.bigint=="function"?process.hrtime:void 0;if(!e)return FS;const t=FS()-e.bigint();return()=>t+e.bigint()})(),GC=e=>Ve(t=>e(t.getRef(Ni))),Nm=e=>GC(t=>t.sleep(pm(e))),LS="~effect/Cause/TimeoutError";var t1,n1;class RF extends(n1=fm("TimeoutError"),t1=LS,n1){constructor(n){super({message:n});O(this,t1,LS)}}const OS="~effect/Cause/AsyncFiberError";var r1,s1;class EF extends(s1=fm("AsyncFiberError"),r1=OS,s1){constructor(n){super({message:"An asynchronous Effect was executed with Effect.runSync",fiber:n});O(this,r1,OS)}}const PF=Xe("effect/Console/CurrentConsole",{defaultValue:()=>globalThis.console}),IF=e=>{switch(e){case"All":return Number.MIN_SAFE_INTEGER;case"Fatal":return 5e4;case"Error":return 4e4;case"Warn":return 3e4;case"Info":return 2e4;case"Debug":return 1e4;case"Trace":return 0;case"None":return Number.MAX_SAFE_INTEGER}},jF=pM(gM,IF),KC=mM(jF),NF=Xe("effect/Loggers/CurrentLoggers",{defaultValue:()=>new Set([DF,zF])}),MF=Xe("effect/Logger/LogToStderr",{defaultValue:vk}),TF="~effect/Logger",$F={[TF]:{_Message:_e,_Output:_e},pipe(){return Lt(this,arguments)}},QC=e=>{const t=Object.create($F);return t.log=e,t},FF=e=>e.replace(/[\s="]/g,"_"),LF=(e,t)=>`${FF(e[0])}=${t-e[1]}ms`,JC=e=>(...t)=>{let n;for(let s=0,i=t.length;s<i;s++){const a=t[s];mf(a)&&(n?t.splice(s,1):t=t.slice(0,s).concat(t.slice(s+1)),n=n?il(n.reasons.concat(a.reasons)):a,s--)}return n===void 0&&(n=JN),Ve(s=>{const i=e??s.currentLogLevel;if(KC(s.minimumLogLevel,i))return ot;const a=s.getRef(Ni),u=s.getRef(NF);if(u.size>0){const f=new Date(a.currentTimeMillisUnsafe());for(const d of u)d.log({cause:n,fiber:s,date:f,logLevel:i,message:t})}return ot})},OF=e=>`${e.getHours().toString().padStart(2,"0")}:${e.getMinutes().toString().padStart(2,"0")}:${e.getSeconds().toString().padStart(2,"0")}.${e.getMilliseconds().toString().padStart(3,"0")}`,AF=typeof process=="object"&&process!==null&&typeof process.stdout=="object"&&process.stdout!==null;AF&&process.stdout.isTTY;const DF=QC(({cause:e,date:t,fiber:n,logLevel:s,message:i})=>{const a=Array.isArray(i)?i.slice():[i];e.reasons.length>0&&a.push(gC(e));const u=t.getTime(),f=n.getRef(TT);let d="";for(const x of f)d+=` ${LF(x,u)}`;const h=n.getRef(ym);Object.keys(h).length>0&&a.push(h);const m=n.getRef(PF);(n.getRef(MF)?m.error:m.log)(`[${OF(t)}] ${s.toUpperCase()} (#${n.id})${d}:`,...a)}),zF=QC(({cause:e,fiber:t,logLevel:n,message:s})=>{const i=t.getRef(Ni),a=t.getRef(ym),u=t.currentSpan;if(u===void 0||u._tag==="ExternalSpan")return;const f={};for(const[d,h]of Object.entries(a))f[d]=h;f["effect.fiberId"]=t.id,f["effect.logLevel"]=n.toUpperCase(),e.reasons.length>0&&(f["effect.cause"]=gC(e)),u.event(VN(Array.isArray(s)&&s.length===1?s[0]:s),i.currentTimeNanosUnsafe(),f)}),UF=mf,VF=QN,np=il,rp=e=>new jk(e),sp=e=>new Mk(e),op=AT,BF=BT,YC=Sm,Pl=wo,qF=UT,HF=vm,Mm=rM,ao=oM,WF=Ik,ug=it,Ua=On,Il=yr,GF=Si,KF=y$,XC=Dn,QF=bm,ZC=x$,JF=_$,YF="~effect/Deferred",XF={[YF]:{_A:_e,_E:_e},pipe(){return Lt(this,arguments)}},Tm=()=>{const e=Object.create(XF);return e.resumes=void 0,e.effect=void 0,e},$m=e=>sr(t=>e.effect?t(e.effect):(e.resumes??(e.resumes=[]),e.resumes.push(t),yt(()=>{const n=e.resumes.indexOf(t);e.resumes.splice(n,1)}))),ZF=re(2,(e,t)=>yt(()=>Va(e,t))),eb=ZF,Va=(e,t)=>{if(e.effect)return!1;if(e.effect=t,e.resumes){for(let n=0;n<e.resumes.length;n++)e.resumes[n](t);e.resumes=void 0}return!0},eL=re(2,(e,t)=>DC(n=>Le(Ef(n(e)),s=>eb(t,s)))),tL=ym,AS=Pf,Fm=Em,Ac=K$,nL=Ci,rL=W$,Dc=H$,Mf=NC,sL="~effect/Layer",DS="~effect/Layer/MemoMap",oL={[sL]:{_ROut:_e,_E:_e,_RIn:_e},pipe(){return Lt(this,arguments)}},tb=e=>{const t=Object.create(oL);return t.build=e,t},Lm=e=>tb((t,n)=>{const s=Dc(n);return js(e(t,s),i=>i._tag==="Failure"?Mf(s,i):ot)}),iL=e=>{const t=Lm((n,s)=>n.getOrElseMemoize(t,s,e));return t};class aL{constructor(){O(this,"map",new Map)}get[DS](){return DS}getOrElseMemoize(t,n,s){if(this.map.has(t)){const f=this.map.get(t);return f.observers++,Cl(Ci(n,d=>f.finalizer(d)),f.effect)}const i=Fm(),a=Tm(),u={observers:1,effect:$m(a),finalizer:f=>St(()=>(u.observers--,u.observers===0?(this.map.delete(t),Mf(i,f)):ot))};return this.map.set(t,u),Ci(n,u.finalizer).pipe(Le(()=>s(this,i)),js(f=>(u.effect=f,eb(a,f))))}}const Om=()=>new aL,tf=class tf extends Un()("effect/Layer/CurrentMemoMap"){};O(tf,"getOrCreate",VM(tf,Om));let fl=tf;const Am=re(3,(e,t,n)=>_l(xt(e.build(t,n),Is(fl,t)),fl,t)),lL=re(2,(e,t)=>Ve(n=>Am(e,fl.getOrCreate(n.context),t))),Dm=function(){return arguments.length===1?e=>zS(wi(arguments[0],e)):zS(wi(arguments[0],arguments[1]))},zS=e=>tb(_s(Re(e))),ip=function(){return arguments.length===1?e=>US(arguments[0],e):US(arguments[0],arguments[1])},US=(e,t)=>ap(xt(t,n=>wi(e,n))),ap=e=>iL((t,n)=>Ac(e,n)),nb=(e,t,n)=>{const s=Dc(n,"parallel");return Ys(e,i=>i.build(t,Dc(s,"sequential")),{concurrency:e.length}).pipe(xt(i=>WM(...i)))},rb=(...e)=>Lm((t,n)=>nb(e,t,n)),uL=(e,t,n)=>Lm((s,i)=>Le(Array.isArray(t)?nb(t,s,i):t.build(s,i),a=>e.build(s,i).pipe(bl(a),xt(u=>n(u,a))))),lp=re(2,(e,t)=>uL(e,t,_e)),cL=class extends lf{constructor(t){super(),t&&Object.assign(this,t)}},bi=re(2,(e,t)=>IC(e,hL,n=>t(n))),VS=e=>e.reasons.some(fL),fL=e=>e._tag==="Fail"&&Mm(e.error),dL=rC(Pl,e=>Mm(e)?Dr(e):Zn(e)),hL=rC(Pl,e=>Mm(e)?Dr(e.value):Zn(e)),zm=re(2,(e,t)=>Rf(e,{onSuccess:t.onSuccess,onFailure:n=>{const s=dL(n);return jt(s)?t.onFailure(s.failure):t.onDone(s.success.value)}})),sb="~effect/Schedule",BS=Xe("effect/Schedule/CurrentMetadata",{defaultValue:_s({input:void 0,output:void 0,duration:mm,attempt:0,start:0,now:0,elapsed:0,elapsedSincePrevious:0})}),gL={[sb]:{_Out:_e,_In:_e,_Env:_e},pipe(){return Lt(this,arguments)}},pL=e=>De(e,sb),jl=e=>{const t=Object.create(gL);return t.step=e,t},Um=()=>{let e=0,t,n;return(s,i)=>{n===void 0&&(n=s);const a=s-n,u=t===void 0?0:s-t;return t=s,{input:i,attempt:++e,start:n,now:s,elapsed:a,elapsedSincePrevious:u}}},ob=e=>jl(xt(e,t=>{const n=Um();return(s,i)=>t(n(s,i))})),mo=e=>Rl(e.step,t=>Re(()=>Ft(t))),mL=e=>GC(t=>xt(mo(e),n=>{const s=Um();return i=>St(()=>{const a=t.currentTimeMillisUnsafe();return Le(n(a,i),([u,f])=>{const d=s(a,i);return d.output=u,d.duration=f,ji(Nm(f),d)})})})),yL=re(2,(e,t)=>xL(e,t,(n,s)=>[n,s])),xL=re(3,(e,t,n)=>jl(xt(PC(mo(e),mo(t)),([s,i])=>(a,u)=>zm(s(a,u),{onSuccess:f=>i(a,u).pipe(xt(d=>[n(f[0],d[0]),fT(f[1],d[1])]),bi(d=>ao(n(f[0],d)))),onDone:f=>i(a,u).pipe(Le(d=>ao(n(f,d[0]))),bi(d=>ao(n(f,d)))),onFailure:Ft})))),ib=re(2,(e,t)=>vL(e,t,(n,s)=>[n,s])),vL=re(3,(e,t,n)=>jl(xt(PC(mo(e),mo(t)),([s,i])=>(a,u)=>zm(s(a,u),{onSuccess:f=>i(a,u).pipe(xt(d=>[n(f[0],d[0]),cT(f[1],d[1])]),bi(d=>Re([n(f[0],d),f[1]]))),onFailure:Ft,onDone:f=>i(a,u).pipe(xt(d=>[n(f,d[0]),d[1]]),bi(d=>ao(n(f,d))))})))),ab=(e,t=2)=>{const n=eC(pm(e));return ob(Re(s=>{const i=ll(n*Math.pow(t,s.attempt-1));return Re([i,i])}))},lb=e=>jl(xt(mo(e),t=>(n,s)=>zm(t(n,s),{onSuccess:i=>Re([s,i[1]]),onFailure:Ft,onDone:()=>ao(s)}))),SL=e=>xc(ub,({attempt:t})=>Re(t<=e)),Vm=e=>{const t=pm(e);return ob(Re(n=>Re([n.attempt-1,t])))},xc=re(2,(e,t)=>jl(xt(mo(e),n=>{const s=Um();return(i,a)=>Le(n(i,a),u=>{const[f,d]=u,h=t({...s(i,a),output:f,duration:d});return Le(Ht(h)?h:Re(h),m=>m?Re(u):ao(f))})}))),ub=Vm(mm),wL=(e,t,n)=>$C(s=>Le(n!=null&&n.local?Am(t,Om(),s):lL(t,s),i=>bl(e,i))),kL=re(e=>Ht(e[0]),(e,t,n)=>Jk(t)?bl(e,t):wL(e,Array.isArray(t)?rb(...t):t,n)),CL=re(3,(e,t,n)=>Le(mL(t),s=>{let i=BS.defaultValue(),a;const u=_f(St(()=>_l(e,BS,i)),f=>(a=f,Le(s(f),d=>(i=d,u))));return bi(u,f=>Jt(()=>n(a,f)))})),bL=re(2,(e,t)=>{const n=typeof t=="function"?t(_e):pL(t)?t:RL(t);return CL(e,n,kf)}),_L=lb(ub),RL=e=>{let t=e.schedule?lb(e.schedule):_L;return e.while&&(t=xc(t,({input:n})=>{const s=e.while(n);return Ht(s)?s:Re(s)})),e.until&&(t=xc(t,({input:n})=>{const s=e.until(n);return Ht(s)?xt(s,i=>!i):Re(!s)})),e.times!==void 0&&(t=xc(t,({attempt:n})=>Re(n<=e.times))),t},hi=Ht,cb=Ys,fb=Pm,EL=r$,at=Re,Bm=n$,PL=t$,Ar=St,Ln=yt,rt=ot,qS=sr,IL=i$,up=a$,Ke=kf,jL=Ft,NL=Cf,zc=Ve,zn=Le,ML=d$,TL=Cl,$L=CC,HS=Ef,ko=xt,dl=Rl,FL=T$,vc=L$,LL=M$,OL=bL,AL=O$,DL=B$,zL=jC,UL=V$,db=_C,VL=Rf,Uc=E$,hb=EC,BL=kL,lo=bl,qL=R$,HL=bf,WL=_l,GL=$C,gb=Q$,pb=J$,KL=X$,mb=js,cp=tF,qm=AC,QL=eF,yb=j$,JL=xF,YL=wF,WS=kF,XL=UC,Hm=iF,fp=lF,Vc=El,ZL=VC,eO=uF,Ba=fF,tO=BC,nO=cF,rO=Im,Wm=hF,sO=qC,xb=dF,oO=jm,uo=wC,iO=JC("Error"),aO=re(e=>hi(e[0]),(e,...t)=>RC(e,tL,n=>{const s={...n};return t.length===1?Object.assign(s,t[0]):s[t[0]]=t[1],s})),vb=h$,Co=g$,hl=p$,ci=f$,lO=m$,dp=l$;function Ta(e,t,n){return t==="__proto__"?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n,e}function Sb(e){return e.checks?e.checks[e.checks.length-1].annotations:e.annotations}function uO(e){return t=>{var n;return(n=Sb(t))==null?void 0:n[e]}}const cO=uO("identifier"),Gm=Rs(e=>{const t=cO(e);return typeof t=="string"?t:e.getExpected(Gm)}),fO=e=>e.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&"),Sc=new WeakMap,wb="~effect/data/Redacted",dO=e=>De(e,wb),GS=(e,t)=>{const n=Object.create(hO);return Sc.set(n,e),n},hO={[wb]:{_A:e=>e},label:void 0,...Ps,toJSON(){return this.toString()},toString(){return`<redacted${sm(this.label)?":"+this.label:""}>`},[Yt](){return dt(Sc.get(this))},[Xt](e){return dO(e)&&kn(Sc.get(this),Sc.get(e))}},hp="~effect/SchemaIssue/Issue";function gO(e){return De(e,hp)}var o1;let xr=(o1=hp,class{constructor(){O(this,o1,hp)}toString(){return CO(this)}}),pO=class extends xr{constructor(n,s,i){super();O(this,"_tag","Filter");O(this,"actual");O(this,"filter");O(this,"issue");this.actual=n,this.filter=s,this.issue=i}};class mO extends xr{constructor(n,s,i){super();O(this,"_tag","Encoding");O(this,"ast");O(this,"actual");O(this,"issue");this.ast=n,this.actual=s,this.issue=i}}class tr extends xr{constructor(n,s){super();O(this,"_tag","Pointer");O(this,"path");O(this,"issue");this.path=n,this.issue=s}}class kb extends xr{constructor(n){super();O(this,"_tag","MissingKey");O(this,"annotations");this.annotations=n}}class Cb extends xr{constructor(n,s){super();O(this,"_tag","UnexpectedKey");O(this,"ast");O(this,"actual");this.ast=n,this.actual=s}}class qt extends xr{constructor(n,s,i){super();O(this,"_tag","Composite");O(this,"ast");O(this,"actual");O(this,"issues");this.ast=n,this.actual=s,this.issues=i}}class vr extends xr{constructor(n,s){super();O(this,"_tag","InvalidType");O(this,"ast");O(this,"actual");this.ast=n,this.actual=s}}class Bc extends xr{constructor(n,s){super();O(this,"_tag","InvalidValue");O(this,"actual");O(this,"annotations");this.actual=n,this.annotations=s}}class KS extends xr{constructor(n,s,i){super();O(this,"_tag","AnyOf");O(this,"ast");O(this,"actual");O(this,"issues");this.ast=n,this.actual=s,this.issues=i}}class yO extends xr{constructor(n,s,i){super();O(this,"_tag","OneOf");O(this,"ast");O(this,"actual");O(this,"successes");this.ast=n,this.actual=s,this.successes=i}}function gp(e,t){if(gO(t))return t;if(typeof t=="string")return new Bc(Me(e),{message:t});const n=typeof t.issue=="string"?new Bc(Me(e),{message:t.issue}):t.issue;return new tr(t.path,n)}function xO(e,t){if(t!==void 0)return typeof t=="boolean"?t?void 0:new Bc(Me(e)):gp(e,t)}function vO(e,t,n){return Array.isArray(n)?$c(n)?n.length===1?gp(e,n[0]):new qt(t,Me(e),OM(n,s=>gp(e,s))):void 0:xO(e,n)}const SO=e=>{const t=gl(e);if(t!==void 0)return t;switch(e._tag){case"InvalidType":return pp(Gm(e.ast),QS(e.actual));case"InvalidValue":return`Invalid data ${QS(e.actual)}`;case"MissingKey":return"Missing key";case"UnexpectedKey":return`Unexpected key with value ${vt(e.actual)}`;case"Forbidden":return"Forbidden operation";case"OneOf":return`Expected exactly one member to match the input ${vt(e.actual)}`}},wO=e=>gl(e.issue)??gl(e);function pp(e,t){return`Expected ${e}, got ${t}`}function ui(e,t,n,s){switch(e._tag){case"Filter":{const i=s(e);if(i!==void 0)return[{path:t,message:i}];switch(e.issue._tag){case"InvalidValue":return[{path:t,message:pp(bb(e.filter),vt(e.actual))}];default:return ui(e.issue,t,n,s)}}case"Encoding":return ui(e.issue,t,n,s);case"Pointer":return ui(e.issue,[...t,...e.path],n,s);case"Composite":return e.issues.flatMap(i=>ui(i,t,n,s));case"AnyOf":{const i=gl(e);if(e.issues.length===0){if(i!==void 0)return[{path:t,message:i}];const a=pp(Gm(e.ast),vt(e.actual));return[{path:t,message:a}]}return e.issues.flatMap(a=>ui(a,t,n,s))}default:return[{path:t,message:n(e)}]}}function bb(e){var n;const t=(n=e.annotations)==null?void 0:n.expected;if(typeof t=="string")return t;switch(e._tag){case"Filter":return"<filter>";case"FilterGroup":return e.checks.map(s=>bb(s)).join(" & ")}}function kO(){return e=>ui(e,[],SO,wO).map(bO).join(`
|
|
83
|
-
`)}const CO=kO();function bO(e){let t=e.message;if(e.path&&e.path.length>0){const n=DN(e.path);t+=`
|
|
84
|
-
at ${n}`}return t}function gl(e){switch(e._tag){case"InvalidType":case"OneOf":case"Composite":case"AnyOf":return Ea(e.ast.annotations);case"InvalidValue":case"Forbidden":return Ea(e.annotations);case"MissingKey":return Ea(e.annotations,"messageMissingKey");case"UnexpectedKey":return Ea(e.ast.annotations,"messageUnexpectedKey");case"Filter":return Ea(e.filter.annotations);case"Encoding":return gl(e.issue)}}function Ea(e,t="message"){const n=e==null?void 0:e[t];if(typeof n=="string")return n}function QS(e){return So(e)?"no value provided":vt(e.value)}class _i extends lf{constructor(n){super();O(this,"run");this.run=n}map(n){return new _i((s,i)=>this.run(s,i).pipe(vb(gm(n))))}compose(n){return JS(this)?n:JS(n)?this:new _i((s,i)=>this.run(s,i).pipe(ci(a=>n.run(a,i))))}}const _b=new _i(at);function JS(e){return e.run===_b.run}function Ri(){return _b}function un(e){return _O(gm(e))}function _O(e){return new _i(t=>at(e(t)))}function RO(e){return new _i(t=>{const n=SM(t,dN);return ks(n)?at(n):ko(e,Me)})}function EO(){return un(globalThis.String)}function Rb(){return un(globalThis.Number)}const mp="~effect/SchemaTransformation/Transformation";var i1;i1=mp;const nf=class nf{constructor(t,n){O(this,i1,mp);O(this,"_tag","Transformation");O(this,"decode");O(this,"encode");this.decode=t,this.encode=n}flip(){return new nf(this.encode,this.decode)}compose(t){return new nf(this.decode.compose(t.decode),t.encode.compose(this.encode))}};let _n=nf;function PO(e){return De(e,mp)}const Eb=e=>PO(e)?e:new _n(e.decode,e.encode);function Tf(e){return new _n(un(e.decode),un(e.encode))}const IO=new _n(Ri(),Ri());function Km(){return IO}const Pb=new _n(Rb(),EO()),Ib=e=>Tf({decode:t=>{const n=new Error(t.message);return typeof t.name=="string"&&t.name!=="Error"&&(n.name=t.name),typeof t.stack=="string"&&(n.stack=t.stack),n},encode:t=>{const n={name:t.name,message:t.message};return e!=null&&e.includeStack&&typeof t.stack=="string"&&(n.stack=t.stack),n}});function bo(e){return t=>t._tag===e}const jb=bo("Declaration"),jO=bo("Never"),qc=bo("Literal"),NO=bo("UniqueSymbol"),MO=bo("Arrays"),TO=bo("Objects"),$O=bo("Union");class Nt{constructor(t,n){O(this,"to");O(this,"transformation");this.to=t,this.transformation=n}}const FO={};class Ei{constructor(t,n,s=void 0,i=void 0){O(this,"isOptional");O(this,"isMutable");O(this,"defaultValue");O(this,"annotations");this.isOptional=t,this.isMutable=n,this.defaultValue=s,this.annotations=i}}const YS="~effect/Schema";var a1;a1=YS;class fn{constructor(t=void 0,n=void 0,s=void 0,i=void 0){O(this,a1,YS);O(this,"annotations");O(this,"checks");O(this,"encoding");O(this,"context");this.annotations=t,this.checks=n,this.encoding=s,this.context=i}toString(){return`<${this._tag}>`}}class Nl extends fn{constructor(n,s,i,a,u,f){super(i,a,u,f);O(this,"_tag","Declaration");O(this,"typeParameters");O(this,"run");this.typeParameters=n,this.run=s}getParser(){const n=this.run(this.typeParameters);return(s,i)=>So(s)?Bm:vb(n(s.value,this,i),Me)}recur(n){const s=Pi(this.typeParameters,n);return s===this.typeParameters?this:new Nl(s,this.run,this.annotations,this.checks,void 0,this.context)}getExpected(){var s;const n=(s=this.annotations)==null?void 0:s.expected;return typeof n=="string"?n:"<Declaration>"}}let LO=class extends fn{constructor(){super(...arguments);O(this,"_tag","Null")}getParser(){return Ff(this,null)}getExpected(){return"null"}};const Qm=new LO;let OO=class extends fn{constructor(){super(...arguments);O(this,"_tag","Undefined")}getParser(){return Ff(this,void 0)}toCodecJson(){return Et(this,[Nb])}getExpected(){return"undefined"}};const Nb=new Nt(Qm,new _n(un(()=>{}),un(()=>null))),AO=new OO;let DO=class extends fn{constructor(){super(...arguments);O(this,"_tag","Void")}getParser(){return Ff(this,void 0)}toCodecJson(){return Et(this,[Nb])}getExpected(){return"void"}};const zO=new DO;let UO=class extends fn{constructor(){super(...arguments);O(this,"_tag","Never")}getParser(){return _o(this,gN)}getExpected(){return"never"}};const VO=new UO;let BO=class extends fn{constructor(){super(...arguments);O(this,"_tag","Any")}getParser(){return _o(this,kk)}getExpected(){return"any"}};const qO=new BO;let HO=class extends fn{constructor(){super(...arguments);O(this,"_tag","Unknown")}getParser(){return _o(this,kk)}getExpected(){return"unknown"}};const Jm=new HO;let qa=class extends fn{constructor(n,s,i,a,u){super(s,i,a,u);O(this,"_tag","Literal");O(this,"literal");if(typeof n=="number"&&!globalThis.Number.isFinite(n))throw new Error(`A numeric literal must be finite, got ${vt(n)}`);this.literal=n}getParser(){return Ff(this,this.literal)}toCodecJson(){return typeof this.literal=="bigint"?XS(this):this}toCodecStringTree(){return typeof this.literal=="string"?this:XS(this)}getExpected(){return typeof this.literal=="string"?JSON.stringify(this.literal):globalThis.String(this.literal)}};function XS(e){const t=globalThis.String(e.literal);return Et(e,[new Nt(new qa(t),new _n(un(()=>e.literal),un(()=>t)))])}let WO=class extends fn{constructor(){super(...arguments);O(this,"_tag","String")}getParser(){return _o(this,sm)}getExpected(){return"string"}};const Mb=new WO;let GO=class extends fn{constructor(){super(...arguments);O(this,"_tag","Number")}getParser(){return _o(this,wk)}toCodecJson(){return this.checks&&($a(this.checks,"isFinite")||$a(this.checks,"isInt"))?this:Et(this,[s3])}toCodecStringTree(){return this.checks&&($a(this.checks,"isFinite")||$a(this.checks,"isInt"))?Et(this,[p3]):Et(this,[m3])}getExpected(){return"number"}};function $a(e,t){return e.some(n=>{var s,i;switch(n._tag){case"Filter":return((i=(s=n.annotations)==null?void 0:s.meta)==null?void 0:i._tag)===t;case"FilterGroup":return $a(n.checks,t)}})}const Tb=new GO;let KO=class extends fn{constructor(){super(...arguments);O(this,"_tag","Boolean")}getParser(){return _o(this,fN)}getExpected(){return"boolean"}};const QO=new KO;class Ml extends fn{constructor(n,s,i,a,u,f,d){super(a,u,f,d);O(this,"_tag","Arrays");O(this,"isMutable");O(this,"elements");O(this,"rest");this.isMutable=n,this.elements=s,this.rest=i;const h=s.findIndex(Fr);if(h!==-1&&(s.slice(h+1).some(m=>!Fr(m))||i.length>1))throw new Error("A required element cannot follow an optional element. ts(1257)");if(i.length>1&&i.slice(1).some(Fr))throw new Error("An optional element cannot follow a rest element. ts(1266)")}getParser(n){const s=this,i=s.elements.map(p=>({ast:p,parser:n(p)})),a=s.rest.map(p=>({ast:p,parser:n(p)})),u=i.length,[f,...d]=a,h=d.length;function m(p,x){return x<u?i[x]:x>=p?d[x-p]:f}return dp(function*(p,x){if(p._tag==="None")return p;const v=p.value;if(!Array.isArray(v))return yield*Ke(new vr(s,p));const w=v.length,k={ast:s,getParser:m,oinput:p,len:w,tailThreshold:YO(w,u,h),output:new globalThis.Array(w),issues:void 0,options:x},b=Ym(x==null?void 0:x.concurrency),_=JO(k,v,{concurrency:b==null?void 0:b.concurrency,end:s.rest.length===0?u:Math.max(w,u+h)});if(_&&(yield*_),s.rest.length===0&&w>u)for(let R=u;R<=w-1;R++){const j=new tr([R],new Cb(s,v[R]));if(x.errors==="all")k.issues?k.issues.push(j):k.issues=[j];else return yield*Ke(new qt(s,p,[j]))}return k.issues?yield*Ke(new qt(s,p,k.issues)):Me(k.output)})}recur(n){const s=Pi(this.elements,n),i=Pi(this.rest,n);return s===this.elements&&i===this.rest?this:new Ml(this.isMutable,s,i,this.annotations,this.checks,void 0,this.context)}getExpected(){return"array"}}const JO=jf()({onItem(e,t,n){const s=n<e.len?Me(t):An();return e.getParser(e.tailThreshold,n).parser(s,e.options)},step(e,t,n,s){var i;if(n._tag==="Failure")return Hc(e,e.ast,s,n);if(n.value._tag==="Some")e.output[s]=n.value.value;else{const a=e.getParser(e.tailThreshold,s);if(Fr(a.ast))return;const u=new tr([s],new kb((i=a.ast.context)==null?void 0:i.annotations));if(e.options.errors==="all")e.issues?e.issues.push(u):e.issues=[u];else return Il(new qt(e.ast,e.oinput,[u]))}}});function YO(e,t,n){return Math.max(t,e-n)}const Ym=e=>(e=e==="unbounded"?1/0:e??1,e>1?{concurrency:e}:void 0),Hc=(e,t,n,s)=>{const i=Pl(s.cause);if(jt(i))return s;const a=new tr([n],i.success);if(e.options.errors==="all")e.issues?e.issues.push(a):e.issues=[a];else return Il(new qt(t,e.oinput,[a]))},Xm="[+-]?\\d*\\.?\\d+(?:[Ee][+-]?\\d+)?",XO=new globalThis.RegExp(`(?:${Xm}|Infinity|-Infinity|NaN)`);function $b(e,t){const n=xs(t);switch(n._tag){case"String":return Object.keys(e);case"TemplateLiteral":{const s=f3(n);return Object.keys(e).filter(i=>s.test(i))}case"Symbol":return Object.getOwnPropertySymbols(e);case"Number":return Object.keys(e).filter(s=>XO.test(s));case"Union":return[...new Set(n.types.flatMap(s=>$b(e,s)))];default:return[]}}class Fb{constructor(t,n){O(this,"name");O(this,"type");this.name=t,this.type=n}}class ZO{constructor(t,n,s){O(this,"parameter");O(this,"type");O(this,"merge");if(this.parameter=t,this.type=n,this.merge=s,Fr(n)&&!Gb(n))throw new Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.")}}class Zm extends fn{constructor(n,s,i,a,u,f){super(i,a,u,f);O(this,"_tag","Objects");O(this,"propertySignatures");O(this,"indexSignatures");this.propertySignatures=n,this.indexSignatures=s;const d=n.map(h=>h.name).filter((h,m,p)=>p.indexOf(h)!==m);if(d.length>0)throw new Error(`Duplicate identifiers: ${JSON.stringify(d)}. ts(2300)`)}getParser(n){const s=this,i=[],a=new Set,u=[];for(const h of s.propertySignatures)i.push(h.name),a.add(h.name),u.push({ps:h,parser:n(h.type),name:h.name,type:h.type});const f=s.indexSignatures.length;if(s.propertySignatures.length===0&&s.indexSignatures.length===0)return _o(s,hN);const d=f>0?jf()({onItem:dp(function*(h,[m,p]){const v=n(Yb(p.parameter))(Me(m),h.options),w=bn(v)?v:yield*HS(v);if(w._tag==="Failure"){const j=Hc(h,s,m,w);j&&(yield*j);return}const k=Me(h.input[m]),_=n(p.type)(k,h.options),R=bn(_)?_:yield*HS(_);if(R._tag==="Failure"){const j=Hc(h,s,m,R);j&&(yield*j);return}else if(w.value._tag==="Some"&&R.value._tag==="Some"){const j=w.value.value,E=R.value.value;if(p.merge&&p.merge.decode&&Object.hasOwn(h.out,j)){const[T,$]=p.merge.decode.combine([j,h.out[j]],[j,E]);Ta(h.out,T,$)}else Ta(h.out,j,E)}}),step:(h,m,p)=>p._tag==="Failure"?p:void 0}):void 0;return dp(function*(h,m){if(h._tag==="None")return h;const p=h.value;if(!(typeof p=="object"&&p!==null&&!Array.isArray(p)))return yield*Ke(new vr(s,h));const x={},v={ast:s,oinput:h,input:p,out:x,issues:void 0,options:m},w=m.errors==="all",k=m.onExcessProperty==="error",b=m.onExcessProperty==="preserve";let _;if(s.indexSignatures.length===0&&(k||b)){_=Reflect.ownKeys(p);for(let E=0;E<_.length;E++){const T=_[E];if(!a.has(T))if(k){const $=new tr([T],new Cb(s,p[T]));if(w){v.issues?v.issues.push($):v.issues=[$];continue}else return yield*Ke(new qt(s,h,[$]))}else Ta(x,T,p[T])}}const R=Ym(m==null?void 0:m.concurrency),j=e3(v,u,R);if(j&&(yield*j),d){const E=LM();for(let $=0;$<f;$++){const L=s.indexSignatures[$],U=$b(p,L.parameter);for(let z=0;z<U.length;z++){const Z=U[z];E.push([Z,L])}}const T=d(v,E,R);T&&(yield*T)}if(v.issues)return yield*Ke(new qt(s,h,v.issues));if(m.propertyOrder==="original"){const E=(_??Reflect.ownKeys(p)).concat(i),T={};for(const $ of E)Object.hasOwn(x,$)&&Ta(T,$,x[$]);return Me(T)}return Me(x)})}rebuild(n,s){const i=Pi(this.propertySignatures,u=>{const f=n(u.type);return f===u.type?u:new Fb(u.name,f)}),a=Pi(this.indexSignatures,u=>{var m;const f=n(u.parameter),d=n(u.type),h=s?(m=u.merge)==null?void 0:m.flip():u.merge;return f===u.parameter&&d===u.type&&h===u.merge?u:new ZO(f,d,h)});return i===this.propertySignatures&&a===this.indexSignatures?this:new Zm(i,a,this.annotations,this.checks,void 0,this.context)}flip(n){return this.rebuild(n,!0)}recur(n){return this.rebuild(n,!1)}getExpected(){return this.propertySignatures.length===0&&this.indexSignatures.length===0?"object | array":"object"}}const e3=jf()({onItem(e,t){const n=Object.hasOwn(e.input,t.name)?Me(e.input[t.name]):An();return t.parser(n,e.options)},step(e,t,n){var s;if(n._tag==="Failure")return Hc(e,e.ast,t.name,n);if(n.value._tag==="Some")Ta(e.out,t.name,n.value.value);else if(!Fr(t.type)){const i=new tr([t.name],new kb((s=t.type.context)==null?void 0:s.annotations));if(e.options.errors==="all"){e.issues?e.issues.push(i):e.issues=[i];return}else return Il(new qt(e.ast,e.oinput,[i]))}}});function e0(e,t,n){return new Zm(Reflect.ownKeys(e).map(s=>new Fb(s,e[s].ast)),[],n,t)}function Lb(e){return e.ast}function t0(e,t,n){return new Tl(e.map(Lb),t,void 0,n)}function Ob(e){switch(e._tag){case"Null":return["null"];case"Undefined":case"Void":return["undefined"];case"String":case"TemplateLiteral":return["string"];case"Number":return["number"];case"Boolean":return["boolean"];case"Symbol":case"UniqueSymbol":return["symbol"];case"BigInt":return["bigint"];case"Arrays":return["array"];case"ObjectKeyword":return["object","array","function"];case"Objects":return e.propertySignatures.length||e.indexSignatures.length?["object"]:["object","array"];case"Enum":return Array.from(new Set(e.enums.map(([,t])=>typeof t)));case"Literal":return[typeof e.literal];case"Union":return Array.from(new Set(e.types.flatMap(Ob)));default:return["null","undefined","string","number","boolean","symbol","bigint","object","array","function"]}}function n0(e){var t;switch(e._tag){default:return[];case"Declaration":{const n=(t=e.annotations)==null?void 0:t["~sentinels"];return Array.isArray(n)?n:[]}case"Objects":return e.propertySignatures.flatMap(n=>{const s=n.type;if(!Fr(s)){if(qc(s))return[{key:n.name,literal:s.literal}];if(NO(s))return[{key:n.name,literal:s.symbol}]}return[]});case"Arrays":return e.elements.flatMap((n,s)=>qc(n)&&!Fr(n)?[{key:s,literal:n.literal}]:[]);case"Suspend":return n0(e.thunk())}}const ZS=new WeakMap;function t3(e){var n,s;let t=ZS.get(e);if(t)return t;t={};for(const i of e){const a=xs(i);if(jO(a))continue;const u=Ob(a),f=n0(a);t.byType??(t.byType={});for(const d of u)((n=t.byType)[d]??(n[d]=[])).push(i);if(f.length>0){t.bySentinel??(t.bySentinel=new Map);for(const{key:d,literal:h}of f){let m=t.bySentinel.get(d);m||t.bySentinel.set(d,m=new Map);let p=m.get(h);p||m.set(h,p=[]),p.push(i)}}else{t.otherwise??(t.otherwise={});for(const d of u)((s=t.otherwise)[d]??(s[d]=[])).push(i)}}return ZS.set(e,t),t}function ew(e){return t=>{const n=xs(t);return n._tag==="Literal"?n.literal===e:n._tag==="UniqueSymbol"?n.symbol===e:!0}}function n3(e,t){var i,a;const n=t3(t),s=e===null?"null":Array.isArray(e)?"array":typeof e;if(n.bySentinel){const u=((i=n.otherwise)==null?void 0:i[s])??[];if(s==="object"||s==="array"){for(const[f,d]of n.bySentinel)if(Object.hasOwn(e,f)){const h=d.get(e[f]);if(h)return[...h,...u].filter(ew(e))}}return u}return(((a=n.byType)==null?void 0:a[s])??[]).filter(ew(e))}let Tl=class Ab extends fn{constructor(n,s,i,a,u,f){super(i,a,u,f);O(this,"_tag","Union");O(this,"types");O(this,"mode");this.types=n,this.mode=s}getParser(n){const s=this;return(i,a)=>{if(i._tag==="None")return at(i);const u=i.value,f=n3(u,s.types),d={ast:s,recur:n,oinput:i,input:u,out:void 0,successes:[],issues:void 0,options:a},h=Ym(a==null?void 0:a.concurrency),m=r3(d,f,h);return m?zn(m,p=>d.out?at(d.out):Ke(new KS(s,u,d.issues??[]))):d.out?at(d.out):Ke(new KS(s,u,d.issues??[]))}}recur(n){const s=Pi(this.types,n);return s===this.types?this:new Ab(s,this.mode,this.annotations,this.checks,void 0,this.context)}getExpected(n){var a;const s=(a=this.annotations)==null?void 0:a.expected;if(typeof s=="string")return s;if(this.types.length===0)return"never";const i=this.types.map(u=>{const f=xs(u);switch(f._tag){case"Arrays":{const d=f.elements.filter(qc);if(d.length>0)return`${tw(f.isMutable)}[ ${d.map(h=>{var m;return n(h)+nw((m=h.context)==null?void 0:m.isOptional)}).join(", ")}, ... ]`;break}case"Objects":{const d=f.propertySignatures.filter(h=>qc(h.type));if(d.length>0)return`{ ${d.map(h=>{var m,p;return`${tw((m=h.type.context)==null?void 0:m.isMutable)}${Tc(h.name)}${nw((p=h.type.context)==null?void 0:p.isOptional)}: ${n(h.type)}`}).join(", ")}, ... }`;break}}return n(f)});return Array.from(new Set(i)).join(" | ")}};const r3=jf()({onItem(e,t){return e.recur(t)(e.oinput,e.options)},step(e,t,n){if(n._tag==="Failure"){const s=Pl(n.cause);if(jt(s))return n;e.issues?e.issues.push(s.success):e.issues=[s.success]}else{if(e.out&&e.ast.mode==="oneOf")return e.successes.push(t),Il(new yO(e.ast,e.input,e.successes));if(e.out=n.value,e.successes.push(t),e.ast.mode==="anyOf")return XC}}}),Db=new Tl([new qa("Infinity"),new qa("-Infinity"),new qa("NaN")],"anyOf"),s3=new Nt(new Tl([Tb,Db],"anyOf"),new _n(Rb(),un(e=>globalThis.Number.isFinite(e)?e:globalThis.String(e))));function tw(e){return e?"":"readonly "}function nw(e){return e?"?":""}class Wc extends lf{constructor(n,s=void 0,i=!1){super();O(this,"_tag","Filter");O(this,"run");O(this,"annotations");O(this,"aborted");this.run=n,this.annotations=s,this.aborted=i}annotate(n){return new Wc(this.run,{...this.annotations,...n},this.aborted)}abort(){return new Wc(this.run,this.annotations,!0)}and(n,s){return new Gc([this,n],s)}}class Gc extends lf{constructor(n,s=void 0){super();O(this,"_tag","FilterGroup");O(this,"checks");O(this,"annotations");this.checks=n,this.annotations=s}annotate(n){return new Gc(this.checks,{...this.annotations,...n})}and(n,s){return new Gc([this,n],s)}}function zb(e,t,n=!1){return new Wc((s,i,a)=>vO(s,i,e(s,i,a)),t,n)}function o3(e,t){const n=e.source;return zb(s=>e.test(s),{expected:`a string matching the RegExp ${n}`,meta:{_tag:"isPattern",regExp:e},toArbitraryConstraint:{string:{patterns:[e.source]}},...t})}function $f(e,t){const n=Object.getOwnPropertyDescriptors(e);return t(n),Object.create(Object.getPrototypeOf(e),n)}function Et(e,t){return e.encoding===t?e:$f(e,n=>{n.encoding.value=t})}function r0(e,t){return e.context===t?e:$f(e,n=>{n.context.value=t})}function Ub(e,t){if(e.checks){const n=e.checks[e.checks.length-1];return Vb(e,Kk(e.checks.slice(0,-1),n.annotate(t)))}return $f(e,n=>{n.annotations.value={...n.annotations.value,...t}})}function Vb(e,t){return e.checks===t?e:$f(e,n=>{n.checks.value=t})}function s0(e,t){return Vb(e,e.checks?[...e.checks,...t]:t)}function Bb(e,t){const n=e,s=n[n.length-1],i=t(s.to);return i!==s.to?Kk(e.slice(0,e.length-1),new Nt(i,s.transformation)):e}function i3(e){return t=>t.encoding?Et(t,Bb(t.encoding,e)):t}function a3(e,t,n){const s=new Nt(e,t);return Et(n,n.encoding?[...n.encoding,s]:[s])}function Pi(e,t){let n=!1;const s=new Array(e.length);for(let i=0;i<e.length;i++){const a=e[i],u=t(a);u!==a&&(n=!0),s[i]=u}return n?s:e}function qb(e,t){const n=e.context?new Ei(e.context.isOptional,e.context.isMutable,e.context.defaultValue,{...e.context.annotations,...t}):new Ei(!1,!1,void 0,t);return r0(e,n)}const Hb=i3(Wb);function Wb(e){const t=e.context?e.context.isOptional===!1?new Ei(!0,e.context.isMutable,e.context.defaultValue,e.context.annotations):e.context:new Ei(!0,!1);return Hb(r0(e,t))}function l3(e,t){const n=new _n(RO(t),Ri()),s=[new Nt(Jm,n)],i=e.context?new Ei(e.context.isOptional,e.context.isMutable,s,e.context.annotations):new Ei(!1,!1,s);return r0(e,i)}function u3(e,t,n){return a3(e,n,t)}function Fr(e){var t;return((t=e.context)==null?void 0:t.isOptional)??!1}const Kc=Rs(e=>{var n;if(e.encoding)return Kc(Et(e,void 0));const t=e;return((n=t.recur)==null?void 0:n.call(t,Kc))??t}),xs=Rs(e=>Kc(co(e)));function c3(e,t){const n=t,s=n.length,i=n[s-1],a=[new Nt(co(Et(e,void 0)),n[0].transformation.flip())];for(let f=1;f<s;f++)a.unshift(new Nt(co(n[f-1].to),n[f].transformation.flip()));const u=co(i.to);return u.encoding?Et(u,[...u.encoding,...a]):Et(u,a)}const co=Rs(e=>{var n,s;if(e.encoding)return c3(e,e.encoding);const t=e;return((n=t.flip)==null?void 0:n.call(t,co))??((s=t.recur)==null?void 0:s.call(t,co))??t});function Gb(e){switch(e._tag){case"Undefined":return!0;case"Union":return e.types.some(Gb);default:return!1}}function Kb(e,t){return e.encodedParts.map(n=>d3(n,Qb(n),t)).join("")}const f3=Rs(e=>new globalThis.RegExp(`^${Kb(e,!0)}$`));function Qb(e){switch(e._tag){case"Literal":return fO(globalThis.String(e.literal));case"String":return h3;case"Number":return Xm;case"BigInt":return y3;case"TemplateLiteral":return Kb(e,!1);case"Union":return e.types.map(Qb).join("|")}}function d3(e,t,n){if($O(e)){if(!n)return`(?:${t})`}else if(!n)return t;return`(${t})`}function Ff(e,t){const n=PL(t);return s=>s._tag==="None"?Bm:s.value===t?n:Ke(new vr(e,s))}function _o(e,t){return n=>n._tag==="None"?Bm:t(n.value)?at(n):Ke(new vr(e,n))}function Jb(e){function t(n){return n.encoding?Et(n,Bb(n.encoding,t)):e(n)}return Rs(t)}const Yb=Jb(e=>{switch(e._tag){default:return e;case"Number":return e.toCodecStringTree();case"Union":return e.recur(Yb)}}),h3="[\\s\\S]*?",rw=new globalThis.RegExp(`^${Xm}$`);function g3(e){return o3(rw,{expected:"a string representing a finite number",meta:{_tag:"isStringFinite",regExp:rw},...e})}const Xb=s0(Mb,[g3()]),p3=new Nt(Xb,Pb),m3=new Nt(new Tl([Xb,Db],"anyOf"),Pb),y3="-?\\d+";function yp(e,t,n,s,i){for(let a=0;a<e.length;a++){const u=e[a];if(u._tag==="FilterGroup")yp(u.checks,t,n,s,i);else{const f=u.run(t,s,i);if(f&&(n.push(new pO(t,u,f)),u.aborted||(i==null?void 0:i.errors)!=="all"))return}}}const Zb="~effect/Schema/Class",x3="~structural";function v3(e){const t=new Set,n=new Set;return s(e);function s(i){if(i===null||typeof i=="string"||typeof i=="boolean")return!0;if(typeof i=="number")return globalThis.Number.isFinite(i);if(typeof i!="object"||i===void 0||t.has(i))return!1;if(n.has(i))return!0;t.add(i);const a=Array.isArray(i)?i.every(s):Object.keys(i).every(u=>s(i[u]));return t.delete(i),a&&n.add(i),a}}const S3=new Nl([],()=>(e,t)=>v3(e)?at(e):Ke(new vr(t,Me(e))),{typeConstructor:{_tag:"effect/Json"},generation:{runtime:"Schema.Json",Type:"Schema.Json"},expected:"JSON value",toCodecJson:()=>new Nt(Jm,Km())}),w3=new Nt(Qm,new _n(Ri(),un(()=>null))),k3=new Nt(S3,Km()),C3=yC,Fa=km,b3=Oc,xp=wm,_3=aF,e_=pF,R3=Symbol.for("effect/MutableList/Empty"),E3=()=>({head:void 0,tail:void 0,length:0}),sw=()=>({array:[],mutable:!0,offset:0,next:void 0}),vp=(e,t)=>{e.tail?e.tail.mutable||(e.tail.next=sw(),e.tail=e.tail.next):e.head=e.tail=sw(),e.tail.array.push(t),e.length++},P3=(e,t)=>I3(e,mr(t),!Array.isArray(t)),I3=(e,t,n=!1)=>{if(t.length===0)return 0;const s={array:t,mutable:n,offset:0,next:void 0};return e.head?e.tail=e.tail.next=s:e.head=e.tail=s,e.length+=t.length,t.length},wc=e=>{e.head=e.tail=void 0,e.length=0},t_=(e,t)=>{var a;if(t<=0||!e.head)return[];if(t=Math.min(t,e.length),t===e.length&&((a=e.head)==null?void 0:a.offset)===0&&!e.head.next){const u=e.head.array;return wc(e),u}const n=new Array(t);let s=0,i=e.head;for(;i;){for(;i.offset<i.array.length;)if(n[s++]=i.array[i.offset],i.mutable&&(i.array[i.offset]=void 0),i.offset++,s===t)return e.head=i,e.length-=t,e.length===0&&wc(e),n;i=i.next}return wc(e),n},j3=e=>{if(!e.head)return R3;const t=e.head.array[e.head.offset];return e.head.mutable&&(e.head.array[e.head.offset]=void 0),e.head.offset++,e.length--,e.head.offset===e.head.array.length&&(e.head.next?e.head=e.head.next:wc(e)),t},N3="~effect/Queue",M3="~effect/Queue/Enqueue",T3="~effect/Queue/Dequeue",cg={_A:_e,_E:_e},$3={[N3]:cg,[M3]:cg,[T3]:cg,...Ps,toJSON(){return{_id:"effect/Queue",state:this.state._tag,size:U3(this)}}},F3=e=>Ve(t=>{const n=Object.create($3);return n.dispatcher=t.currentDispatcher,n.capacity=(e==null?void 0:e.capacity)??Number.POSITIVE_INFINITY,n.strategy=(e==null?void 0:e.strategy)??"suspend",n.messages=E3(),n.scheduleRunning=!1,n.state={_tag:"Open",takers:new Set,offers:new Set,awaiters:new Set},Re(n)}),L3=e=>F3({capacity:e}),O3=(e,t)=>St(()=>{if(e.state._tag!=="Open")return Re(mr(t));const n=A3(e,t);return n.length===0?it([]):e.strategy==="dropping"?Re(n):W3(e,n)}),A3=(e,t)=>{if(e.state._tag!=="Open")return mr(t);if(e.capacity===Number.POSITIVE_INFINITY||e.strategy==="sliding")return P3(e.messages,t),e.strategy==="sliding"&&t_(e.messages,e.messages.length-e.capacity),iw(e),[];const n=e.capacity<=0?e.state.takers.size:e.capacity-e.messages.length;if(n===0)return mr(t);const s=[];let i=0;for(const a of t)i<n?vp(e.messages,a):s.push(a),i++;return iw(e),s},La=re(2,(e,t)=>yt(()=>D3(e,t))),D3=(e,t)=>{if(e.state._tag!=="Open")return!1;const n=On(t),s=C$(n,B3);return e.state.offers.size===0&&e.messages.length===0?(r_(e,s),!0):(e.state={...e.state,_tag:"Closing",exit:s},!0)},ow=e=>La(e,Nk(dm())),z3=e=>n_(e,1,Number.POSITIVE_INFINITY),n_=(e,t,n)=>St(()=>H3(e,t,n)??Cl(G3(e),n_(e,1,n))),U3=e=>e.state._tag==="Done"?0:e.messages.length,V3=it(!0),B3=yr(dm()),q3=e=>{if(e.scheduleRunning=!1,!(e.state._tag==="Done"||e.state.takers.size===0)){for(const t of e.state.takers)if(e.state.takers.delete(t),t(Dn),e.messages.length===0)break}},iw=e=>{e.scheduleRunning||e.state._tag==="Done"||e.state.takers.size===0||(e.scheduleRunning=!0,e.dispatcher.scheduleTask(()=>q3(e),0))},H3=(e,t,n)=>{if(e.state._tag==="Done")return e.state.exit;if(n<=0||t<=0)return it([]);if(e.capacity<=0&&e.state.offers.size>0){e.capacity=1,fg(e),e.capacity=0;const s=[j3(e.messages)];return fg(e),it(s)}if(t=Math.min(t,e.capacity||1),t<=e.messages.length){const s=t_(e.messages,n);return fg(e),it(s)}},W3=(e,t)=>sr(n=>{if(e.state._tag!=="Open")return n(it(t));const s={_tag:"Array",remaining:t,offset:0,resume:n};return e.state.offers.add(s),yt(()=>{e.state._tag==="Open"&&e.state.offers.delete(s)})}),fg=e=>{if(e.state._tag==="Done")return VS(e.state.exit.cause);if(e.state.offers.size===0)return e.state._tag==="Closing"&&e.messages.length===0?(r_(e,e.state.exit),VS(e.state.exit.cause)):!1;let t=e.capacity-e.messages.length;for(const n of e.state.offers){if(t===0)break;if(n._tag==="Single")vp(e.messages,n.message),t--,n.resume(V3),e.state.offers.delete(n);else{for(;n.offset<n.remaining.length;n.offset++){if(t===0)return!1;vp(e.messages,n.remaining[n.offset]),t--}n.resume(it([])),e.state.offers.delete(n)}}return!1},G3=e=>sr(t=>e.state._tag==="Done"?t(e.state.exit):(e.state.takers.add(t),yt(()=>{e.state._tag!=="Done"&&e.state.takers.delete(t)}))),r_=(e,t)=>{if(e.state._tag==="Done")return;const n=e.state;e.state={_tag:"Done",exit:t};for(const s of n.takers)s(t);n.takers.clear();for(const s of n.awaiters)s(t);n.awaiters.clear()},K3="~effect/Channel",Q3={[K3]:{_Env:_e,_InErr:_e,_InElem:_e,_OutErr:_e,_OutElem:_e},pipe(){return Lt(this,arguments)}},o0=e=>{const t=Object.create(Q3);return t.transform=(n,s)=>dl(e(n,s),i=>at(jL(i))),t},J3=e=>o0((t,n)=>e),i0=e=>e.transform,Y3=e=>J3(at(z3(e))),X3=e=>o0((t,n)=>{let s;return at(Ar(()=>s||e.pipe(Ac(n),zn(i=>i0(i)(t,n)),zn(i=>s=i))))}),Z3=(e,t,n)=>Ar(()=>{const s=Fm(),i=i0(e)(ao(),s);return bi(zn(i,t),at).pipe(mb(a=>Mf(s,a)))}),eA=re(2,(e,t)=>o0((n,s)=>ko(lo(i0(e)(n,s),t),lo(t)))),tA=re(2,(e,t)=>Z3(e,n=>yb(zn(n,t),{disableYield:!0}))),Ro=e=>e,Oa=Rs(e=>{var t;switch(e._tag){case"Declaration":{const n=(t=e.annotations)==null?void 0:t[Zb];if(cf(n)){const s=n(e.typeParameters),i=Oa(s.to);return Et(e,i===s.to?[s]:[new Nt(i,s.transformation)])}return e}case"Objects":case"Arrays":return e.recur(n=>{var i;const s=(i=n.context)==null?void 0:i.defaultValue;return s?Et(Oa(n),s):Oa(n)});case"Suspend":return e.recur(Oa);default:return e}});function Lf(e){const t=Oa(Kc(e.ast)),n=a0(t);return(s,i)=>n(s,i!=null&&i.disableChecks?i!=null&&i.parseOptions?{...i.parseOptions,disableChecks:!0}:{disableChecks:!0}:i==null?void 0:i.parseOptions)}function s_(e){const t=Lf(e);return(n,s)=>JF(xb(t(n,s)))}function nA(e){const t=Lf(e);return(n,s)=>Wm(Co(t(n,s),i=>new Error(i.toString(),{cause:i})))}function yo(e){return a0(e.ast)}function rA(e){return iA(yo(e))}const sA=rA;function oA(e){return a0(co(e.ast))}function a0(e){const t=kc(e);return(n,s)=>ci(t(Me(n),s??FO),i=>i._tag==="None"?Ke(new Bc(i)):at(i.value))}function iA(e){return(t,n)=>Wm(Co(e(t,n),s=>new Error(s.toString(),{cause:s})))}const kc=Rs(e=>{var i;let t;const n=(i=Sb(e))==null?void 0:i.parseOptions;if(!e.context&&!e.encoding&&!e.checks)return(a,u)=>(t??(t=e.getParser(kc)),n&&(u={...u,...n}),t(a,u));const s=MO(e)||TO(e)||jb(e)&&e.typeParameters.length>0;return(a,u)=>{n&&(u={...u,...n});const f=e.encoding;let d;if(f){const m=f,p=m.length;for(let x=p-1;x>=0;x--){const v=m[x],w=v.to,k=kc(w);if(d=d?ci(d,b=>k(b,u)):k(a,u),v.transformation._tag==="Transformation"){const b=v.transformation.decode;d=ci(d,_=>b.run(_,u))}else d=v.transformation.decode(d,u)}d=Co(d,x=>new mO(e,a,x))}t??(t=e.getParser(kc));let h=d?ci(d,m=>t(m,u)):t(a,u);if(e.checks&&!(u!=null&&u.disableChecks)){const m=e.checks;(u==null?void 0:u.errors)==="all"&&s&&ks(a)&&(h=lO(h,p=>{const x=[];yp(m.filter(w=>{var k;return(k=w.annotations)==null?void 0:k[x3]}),a.value,x,e,u);const v=wS(x)?p._tag==="Composite"&&p.ast===e?new qt(e,p.actual,[...p.issues,...x]):new qt(e,a,[p,...x]):p;return Ke(v)})),h=ci(h,p=>{if(ks(p)){const x=p.value,v=[];if(yp(m,x,v,e,u),wS(v))return Ke(new qt(e,p,v))}return at(p)})}return h}}),Sp="~effect/Schema/Schema",aA={[Sp]:Sp,pipe(){return Lt(this,arguments)},annotate(e){return this.rebuild(Ub(this.ast,e))},annotateKey(e){return this.rebuild(qb(this.ast,e))},check(...e){return this.rebuild(s0(this.ast,e))}};function l0(e,t){const n=Object.create(aA);return t&&Object.assign(n,t),n.ast=e,n.rebuild=s=>l0(s,t),n.makeEffect=Sk(Lf(n),Co(s=>new Of(s))),n.make=nA(n),n.makeOption=s_(n),n}const aw="~effect/Schema/SchemaError";var l1;l1=aw;class Of{constructor(t){O(this,l1,aw);O(this,"_tag","SchemaError");O(this,"name","SchemaError");O(this,"issue");this.issue=t}get message(){return this.issue.toString()}toString(){return`SchemaError(${this.message})`}}const lA=cA(uA);function uA(e){switch(e._tag){case"BigInt":case"Symbol":case"UniqueSymbol":return 0;default:return 1}}function cA(e){return t=>{const n=new Map;for(let a=0;a<t.length;a++)n.set(xs(t[a]),a);const s=[...t].sort((a,u)=>{a=xs(a),u=xs(u);const f=e(a),d=e(u);return f!==d?f-d:n.get(a)-n.get(u)});return s.some((a,u)=>a!==t[u])?s:t}}const Ha=Sp;function Af(){return(e,t,n)=>Be(new Nl(e.map(Lb),s=>t(s.map(i=>Be(i))),n))}function o_(e,t){return Af()([],()=>(n,s)=>e(n)?at(n):Ke(new vr(s,Me(n))),t)}function lw(e){const t=yo(e);return(n,s)=>Co(t(n,s),i=>new Of(i))}const fA=sA;function dA(e){const t=oA(e);return(n,s)=>Co(t(n,s),i=>new Of(i))}const hA=dA,Be=l0;function u0(e){return De(e,Ha)&&e[Ha]===Ha}const Qc=Ro(e=>Be(Wb(e.ast),{schema:e})),Mi=Ro(e=>Qc(l_(e)));function vs(e){const t=Be(new qa(e),{literal:e,transform(n){return t.pipe(Xc(vs(n),{decode:un(()=>n),encode:un(()=>e)}))}});return t}const uw=Be(VO),cw=Be(qO),i_=Be(Jm),gA=Be(Qm),pA=Be(AO),gt=Be(Mb),Jc=Be(Tb),wp=Be(QO),Yc=Be(zO);function c0(e,t){return Be(e,{fields:t,mapFields(n,s){const i=n(this.fields);return c0(e0(i,s!=null&&s.unsafePreserveChecks?this.ast.checks:void 0),i)}})}function Pt(e){return c0(e0(e,void 0),e)}const gi=Ro(e=>Be(new Ml(!1,[],[e.ast]),{schema:e})),mA=Ro(e=>Be(new Ml(!1,[e.ast],[e.ast]),{schema:e})),dg=Ro(e=>Be(new Ml(!0,e.ast.elements,e.ast.rest),{schema:e}));function a_(e,t){return Be(e,{members:t,mapMembers(n,s){const i=n(this.members);return a_(t0(i,this.ast.mode,s!=null&&s.unsafePreserveChecks?this.ast.checks:void 0),i)}})}function nr(e,t){return a_(t0(e,"anyOf",void 0),e)}function Ss(e){const t=e.map(vs);return Be(t0(t,"anyOf",void 0),{literals:e,members:t,mapMembers(n){return nr(n(this.members))},pick(n){return Ss(n)},transform(n){return nr(t.map((s,i)=>s.transform(n[i])))}})}const kp=Ro(e=>nr([e,gA])),l_=Ro(e=>nr([e,pA]));function Xc(e,t){return n=>Be(u3(n.ast,e.ast,t?Eb(t):Km()),{from:n,to:e})}function yA(e){return t=>Be(l3(t.ast,e),{schema:t})}function dn(e){return vs(e).pipe(yA(at(e)))}function xA(e,t){return Pt({_tag:dn(e),...t})}function vA(e,t){return o_(n=>n instanceof e,t)}function $l(){return(e,t)=>new Nt(e.ast,Eb(t))}const SA=zb;function wA(e){return SA(t=>globalThis.Number.isFinite(t),{expected:"a finite number",meta:{_tag:"isFinite"},toArbitraryConstraint:{number:{noDefaultInfinity:!0,noNaN:!0}},...e})}function fw(e,t){const n=Af()([e,t],([s,i])=>(a,u,f)=>{if(!VF(a))return Ke(new vr(u,Me(a)));switch(a._tag){case"Fail":return hl(yo(s)(a.error,f),{onSuccess:rp,onFailure:d=>new qt(u,Me(a),[new tr(["error"],d)])});case"Die":return hl(yo(i)(a.defect,f),{onSuccess:sp,onFailure:d=>new qt(u,Me(a),[new tr(["defect"],d)])});case"Interrupt":return at(a)}},{typeConstructor:{_tag:"effect/Cause/Failure"},generation:{runtime:"Schema.CauseReason(?, ?)",Type:"Cause.Failure<?, ?>",importDeclaration:'import * as Cause from "effect/Cause"'},expected:"Cause.Failure",toCodec:([s,i])=>$l()(nr([Pt({_tag:vs("Fail"),error:s}),Pt({_tag:vs("Die"),defect:i}),Pt({_tag:vs("Interrupt"),fiberId:l_(bA)})]),Tf({decode:a=>{switch(a._tag){case"Fail":return rp(a.error);case"Die":return sp(a.defect);case"Interrupt":return op(a.fiberId)}},encode:_e})),toArbitrary:([s,i])=>u_(s,i),toEquivalence:([s,i])=>c_(s,i),toFormatter:([s,i])=>f_(s,i)});return Be(n.ast,{error:e,defect:t})}function u_(e,t){return(n,s)=>n.oneof(s!=null&&s.isSuspend?{maxDepth:2,depthIdentifier:"Cause.Failure"}:{},n.constant(op()),n.integer({min:1}).map(op),e.map(i=>rp(i)),t.map(i=>sp(i)))}function c_(e,t){return(n,s)=>{if(n._tag!==s._tag)return!1;switch(n._tag){case"Fail":return e(n.error,s.error);case"Die":return t(n.defect,s.defect);case"Interrupt":return n.fiberId===s.fiberId}}}function f_(e,t){return n=>{switch(n._tag){case"Fail":return`Fail(${e(n.error)})`;case"Die":return`Die(${t(n.defect)})`;case"Interrupt":return"Interrupt"}}}function dw(e,t){const n=Af()([e,t],([s,i])=>{const a=gi(fw(s,i));return(u,f,d)=>UF(u)?hl(yo(a)(u.reasons,d),{onSuccess:np,onFailure:h=>new qt(f,Me(u),[new tr(["failures"],h)])}):Ke(new vr(f,Me(u)))},{typeConstructor:{_tag:"effect/Cause"},generation:{runtime:"Schema.Cause(?, ?)",Type:"Cause.Cause<?, ?>",importDeclaration:'import * as Cause from "effect/Cause"'},expected:"Cause",toCodec:([s,i])=>$l()(gi(fw(s,i)),Tf({decode:np,encode:({reasons:a})=>a})),toArbitrary:([s,i])=>d_(s,i),toEquivalence:([s,i])=>h_(s,i),toFormatter:([s,i])=>g_(s,i)});return Be(n.ast,{error:e,defect:t})}function d_(e,t){return(n,s)=>n.array(u_(e,t)(n,s)).map(np)}function h_(e,t){const n=LN(c_(e,t));return(s,i)=>n(s.reasons,i.reasons)}function g_(e,t){const n=f_(e,t);return s=>`Cause([${s.reasons.map(n).join(", ")}])`}const p_=Pt({message:gt,name:Qc(gt),stack:Qc(gt)}),kA=vA(globalThis.Error,{typeConstructor:{_tag:"Error"},generation:{runtime:"Schema.Error",Type:"globalThis.Error"},expected:"Error",toCodecJson:()=>$l()(p_,Ib()),toArbitrary:()=>e=>e.string().map(t=>new globalThis.Error(t))}),hw=new _n(Ri(),un(e=>{try{return JSON.parse(JSON.stringify(e))}catch{return vt(e)}})),or=nr([p_.pipe(Xc(kA,Ib())),cw.pipe(Xc(i_.annotate({toCodecJson:()=>$l()(cw,hw),toArbitrary:()=>e=>e.json()}),hw))]);function CA(e,t,n){const s=Af()([e,t,n],([i,a,u])=>{const f=dw(a,u);return(d,h,m)=>{if(!WF(d))return Ke(new vr(h,Me(d)));switch(d._tag){case"Success":return hl(yo(i)(d.value,m),{onSuccess:ug,onFailure:p=>new qt(h,Me(d),[new tr(["value"],p)])});case"Failure":return hl(yo(f)(d.cause,m),{onSuccess:Ua,onFailure:p=>new qt(h,Me(d),[new tr(["cause"],p)])})}}},{typeConstructor:{_tag:"effect/Exit"},generation:{runtime:"Schema.Exit(?, ?, ?)",Type:"Exit.Exit<?, ?, ?>",importDeclaration:'import * as Exit from "effect/Exit"'},expected:"Exit",toCodec:([i,a,u])=>$l()(nr([Pt({_tag:vs("Success"),value:i}),Pt({_tag:vs("Failure"),cause:dw(a,u)})]),Tf({decode:f=>f._tag==="Success"?ug(f.value):Ua(f.cause),encode:f=>QF(f)?{_tag:"Success",value:f.value}:{_tag:"Failure",cause:f.cause}})),toArbitrary:([i,a,u])=>(f,d)=>f.oneof(d!=null&&d.isSuspend?{maxDepth:2,depthIdentifier:"Exit"}:{},i.map(h=>ug(h)),d_(a,u)(f,d).map(h=>Ua(h))),toEquivalence:([i,a,u])=>{const f=h_(a,u);return(d,h)=>{if(d._tag!==h._tag)return!1;switch(d._tag){case"Success":return i(d.value,h.value);case"Failure":return f(d.cause,h.cause)}}},toFormatter:([i,a,u])=>{const f=g_(a,u);return d=>{switch(d._tag){case"Success":return`Exit.Success(${i(d.value)})`;case"Failure":return`Exit.Failure(${f(d.cause)})`}}}});return Be(s.ast,{value:e,error:t,defect:n})}const bA=Jc.check(wA()),_A=globalThis.Symbol.for("immer-draftable");function f0(e,t,n,s,i){var d,h,m,p;const a=EA(n,t,s),u=m_(t),f=(p=class extends e{constructor(...[x,v]){x=x??{};const w=n.make(x,v);super({...x,...w},{...v,disableChecks:!0})}get[(m=Ha,h=u,d=_A,h)](){return u}static get ast(){return a(this).ast}static pipe(){return Lt(this,arguments)}static rebuild(x){return a(this).rebuild(x)}static make(x,v){return new this(x,v)}static makeOption(x,v){return s_(a(this))(x??{},v)}static makeEffect(x,v){return Co(Lf(a(this))(x??{},v),w=>new Of(w))}static annotate(x){return this.rebuild(Ub(this.ast,x))}static annotateKey(x){return this.rebuild(qb(this.ast,x))}static check(...x){return this.rebuild(s0(this.ast,x))}static extend(x){return(v,w)=>{const k={...n.fields,...v};return f0(this,x,c0(e0(k,n.ast.checks,{identifier:x}),k),w,i)}}static mapFields(x,v){return n.mapFields(x,v)}},O(p,m,Ha),O(p,d,!0),O(p,"identifier",t),O(p,"fields",n.fields),p);return i!==void 0&&Object.assign(f.prototype,i(t)),f}function RA(e){return new _n(un(t=>new e(t)),Ri())}function m_(e){return`~effect/Schema/Class/${e}`}function EA(e,t,n){let s;return i=>{if(s===void 0){const a=RA(i),u=Be(new Nl([e.ast],()=>(f,d)=>f instanceof i||De(f,m_(t))?at(f):Ke(new vr(d,Me(f))),{identifier:t,[Zb]:([f])=>new Nt(f,a),toCodec:([f])=>new Nt(f.ast,a),toArbitrary:([f])=>()=>f.map(d=>new i(d)),toFormatter:([f])=>d=>`${i.identifier}(${f(d)})`,"~sentinels":n0(e.ast),...n}));s=e.pipe(Xc(u,a))}return s}}function d0(e){return u0(e)}const PA=e=>(t,n)=>{const s=d0(t)?t:Pt(t);return f0(cL,e,s,n,i=>({toString(){return`${i}(${vt({...this})})`}}))},Vn=e=>(t,n)=>{const s=d0(t)?t:Pt(t);return f0($k,e,s,n,a=>({name:a}))},IA=e=>(t,n,s)=>Vn(e)(d0(n)?n.mapFields(i=>({_tag:dn(t),...i}),{unsafePreserveChecks:!0}):xA(t,n),s);function hg(e){return Be(y_(e.ast))}const y_=Jb(e=>{const t=jA(e,y_);return t!==e&&Fr(e)?Hb(t):t});function jA(e,t){var n,s;switch(e._tag){case"Declaration":{const i=((n=e.annotations)==null?void 0:n.toCodecJson)??((s=e.annotations)==null?void 0:s.toCodec);if(cf(i)){const a=jb(e)?e.typeParameters.map(d=>l0(xs(d))):[],u=i(a),f=t(u.to);return Et(e,f===u.to?[u]:[new Nt(f,u.transformation)])}return Et(e,[w3])}case"Unknown":case"ObjectKeyword":return Et(e,[k3]);case"Undefined":case"Void":case"Literal":case"Number":return e.toCodecJson();case"UniqueSymbol":case"Symbol":case"BigInt":return e.toCodecStringTree();case"Objects":{if(e.propertySignatures.some(i=>typeof i.name!="string"))throw new globalThis.Error("Objects property names must be strings",{cause:e});return e.recur(t)}case"Union":{const i=lA(e.types);return i!==e.types?new Tl(i,e.mode,e.annotations,e.checks,e.encoding,e.context).recur(t):e.recur(t)}case"Arrays":case"Suspend":return e.recur(t)}return e}const NA="~effect/Stream",MA={_R:_e,_E:_e,_A:_e},TA={[NA]:MA,pipe(){return Lt(this,arguments)}},$A=e=>{const t=Object.create(TA);return t.channel=e,t},FA="~effect/Stream",LA=e=>De(e,FA),h0=$A,OA=e=>e.channel,AA=e=>h0(Y3(e)),DA=e=>h0(X3(ko(e,OA))),zA=re(2,(e,t)=>h0(eA(e.channel,t))),UA=re(2,(e,t)=>tA(e.channel,n=>{let s=0;return fb({while:()=>s<n.length,body:()=>t(n[s++]),step:Sl})})),Cp="~effect/FiberSet",VA=e=>De(e,Cp),BA={[Cp]:Cp,[Symbol.iterator](){return this.state._tag==="Closed"?bM():this.state.backing[Symbol.iterator]()},...Ps,toJSON(){return{_id:"FiberMap",state:this.state}}},qA=(e,t)=>{const n=Object.create(BA);return n.state={_tag:"Open",backing:e},n.deferred=t,n},HA=()=>gb(Ln(()=>qA(new Set,Tm())),e=>Ar(()=>{const t=e.state;if(t._tag==="Closed")return rt;e.state={_tag:"Closed"};const n=t.backing;return b3(n).pipe(eL(e.deferred))})),x_=-1,WA=hT(pT(HF,gT(x_))),GA=re(e=>VA(e[0]),(e,t,n)=>{if(e.state._tag==="Closed"){t.interruptUnsafe(x_);return}else if(e.state.backing.has(t))return;e.state.backing.add(t),t.addObserver(s=>{e.state._tag!=="Closed"&&(e.state.backing.delete(t),ZC(s)&&((n==null?void 0:n.propagateInterruption)===!0?!WA(s.cause):!BF(s.cause))&&Va(e.deferred,s))})}),KA=(function(){let e;return()=>(e===void 0&&(e=fp(cp)),e)})(),QA=e=>()=>ko(Uc(),t=>{const n=Vc(t);return(s,i)=>{if(e.state._tag==="Closed")return KA();const a=n(s,i);return GA(e,a),a}}),gw=e=>$m(e.deferred),JA="~effect/interfaces/PrimaryKey",pw="~effect/ManagedRuntime",YA=(e,t)=>{const n=(t==null?void 0:t.memoMap)??Om(),s=Fm("parallel"),i=Dc(s,"sequential"),a={onFiberStart:_3(s)},u=m=>m?{...m,onFiberStart:m.onFiberStart?p=>{a.onFiberStart(p),m.onFiberStart(p)}:a.onFiberStart}:a;let f;const d=zc(m=>(f||(f=fp($L(Am(e,n,i),p=>Ln(()=>{h.cachedContext=p})),{...a,scheduler:m.currentScheduler})),ML(C3(f)))),h={[pw]:pw,memoMap:n,scope:s,contextEffect:d,cachedContext:void 0,context(){return h.cachedContext===void 0?Ba(h.contextEffect):Promise.resolve(h.cachedContext)},dispose(){return Ba(h.disposeEffect)},disposeEffect:Ar(()=>(h.contextEffect=NL("ManagedRuntime disposed"),h.cachedContext=void 0,Mf(h.scope,XC))),runFork(m,p){return h.cachedContext===void 0?fp(si(h,m),u(p)):Vc(h.cachedContext)(m,u(p))},runCallback(m,p){return h.cachedContext===void 0?eO(si(h,m),u(p)):ZL(h.cachedContext)(m,u(p))},runSyncExit(m){return h.cachedContext===void 0?xb(si(h,m)):oO(h.cachedContext)(m)},runSync(m){return h.cachedContext===void 0?Wm(si(h,m)):sO(h.cachedContext)(m)},runPromiseExit(m,p){return h.cachedContext===void 0?nO(si(h,m),u(p)):rO(h.cachedContext)(m,u(p))},runPromise(m,p){return h.cachedContext===void 0?Ba(si(h,m),u(p)):tO(h.cachedContext)(m,u(p))}};return h};function si(e,t){return zn(e.contextEffect,n=>lo(t,n))}const bp="~effect/rpc/RpcSchema/StreamSchema";function v_(e){return De(e,bp)}function S_(e){return v_(e)?Me({success:e.success,error:e.error}):An()}const XA=o_(LA);function ZA(e,t){return Be(XA.ast,{[bp]:bp,success:e,error:t})}const mw="~effect/rpc/Rpc",eD={[mw]:mw,pipe(){return Lt(this,arguments)},setSuccess(e){return as({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:e,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setError(e){return as({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:e,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},setPayload(e){return as({_tag:this._tag,payloadSchema:u0(e)?e:Pt(e),successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},middleware(e){return as({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:new Set([...this.middlewares,e])})},prefix(e){return as({_tag:`${e}${this._tag}`,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,annotations:this.annotations,middlewares:this.middlewares})},annotate(e,t){return as({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:Is(this.annotations,e,t)})},annotateMerge(e){return as({_tag:this._tag,payloadSchema:this.payloadSchema,successSchema:this.successSchema,errorSchema:this.errorSchema,defectSchema:this.defectSchema,middlewares:this.middlewares,annotations:ki(this.annotations,e)})}},as=e=>{function t(){}return Object.setPrototypeOf(t,eD),Object.assign(t,e),t.key=`effect/rpc/Rpc/${e._tag}`,t},Ti=(e,t)=>{const n=(t==null?void 0:t.success)??Yc,s=(t==null?void 0:t.error)??uw,i=(t==null?void 0:t.defect)??or;let a;return t!=null&&t.primaryKey?a=class extends PA(`effect/rpc/Rpc/${e}`)(t.payload){[JA](){return t.primaryKey(this)}}:a=u0(t==null?void 0:t.payload)?t==null?void 0:t.payload:t!=null&&t.payload?Pt(t==null?void 0:t.payload):Yc,as({_tag:e,payloadSchema:a,successSchema:t!=null&&t.stream?ZA(n,s):n,errorSchema:t!=null&&t.stream?uw:s,defectSchema:i,annotations:er(),middlewares:new Set})},gg=new WeakMap,tD=e=>{if(gg.has(e))return gg.get(e);const t=e,n=new Set([t.errorSchema]),s=S_(t.successSchema);ks(s)&&n.add(s.value.error);for(const a of t.middlewares)n.add(a.error);const i=CA(ks(s)?Yc:t.successSchema,nr([...n]),t.defectSchema);return gg.set(e,i),i},nD="~effect/rpc/Rpc/Wrapper",rD=e=>nD in e,yw=Symbol.for("~effect/http/Headers"),pl=Object.create(null);Object.defineProperties(pl,{[yw]:{value:yw},[df]:{value(e){return aD(this,io(e,lD))}},toJSON:{value(){return hf(this)}},[Xt]:{value(e){return oD(this,e)}},[Yt]:{value(){return im(this)}},toString:{value:yS.toString},[go]:{value:yS[go]}});const sD=e=>Object.assign(Object.create(pl),e),oD=PM(FN()),g0=Object.create(pl),iD=e=>{if(e===void 0)return g0;if(Symbol.iterator in e){const n=Object.create(pl);for(const[s,i]of e)n[s.toLowerCase()]=i;return n}const t=Object.create(pl);for(const[n,s]of Object.entries(e))Array.isArray(s)?t[n.toLowerCase()]=s.join(", "):s!==void 0&&(t[n.toLowerCase()]=s);return t},xw=re(2,(e,t)=>{const n=sD(e);return Object.assign(n,t),n}),aD=re(2,(e,t)=>{const n={...e},s=i=>{if(typeof i=="string"){const a=i.toLowerCase();a in e&&(n[a]=GS(e[a]))}else for(const a in e)i.test(a)&&(n[a]=GS(e[a]))};if(Array.isArray(t))for(let i=0;i<t.length;i++)s(t[i]);else s(t);return n}),lD=Xe("effect/Headers/CurrentRedactedNames",{defaultValue:()=>["authorization","cookie","set-cookie","x-api-key"]}),uD="~effect/http/HttpClientError";class p0 extends Vn(uD)({_tag:dn("HttpError"),kind:Ss(["EncodeError","DecodeError","TransportError","InvalidUrlError","StatusCodeError","EmptyBodyError"]),cause:Mi(or)}){static fromHttpClientError(t){return new p0({_tag:"HttpError",kind:t.reason._tag,cause:t.reason})}}const vw="~effect/socket/Socket",m0=Un("effect/socket/Socket"),cD=e=>m0.of({[vw]:vw,runRaw:e.runRaw,run:e.run??((t,n)=>e.runRaw(s=>typeof s=="string"?t(fD.encode(s)):s instanceof Uint8Array?t(s):t(new Uint8Array(s)),n)),runString:e.runString??(e.run?(t,n)=>e.run(s=>t(pg.decode(s)),n):(t,n)=>e.runRaw(s=>typeof s=="string"?t(s):s instanceof Uint8Array?t(pg.decode(s)):t(pg.decode(new Uint8Array(s))),n)),writer:e.writer}),fD=new TextEncoder,pg=new TextDecoder,dD="~effect/socket/Socket/CloseEvent",hD=e=>De(e,dD),Cc="~effect/socket/Socket/SocketError",gD=e=>De(e,Cc);class w_ extends Vn("effect/socket/Socket/SocketReadError")({_tag:dn("SocketReadError"),cause:or}){constructor(){super(...arguments);O(this,"message","An error occurred during Read")}}class pD extends Vn("effect/socket/Socket/SocketWriteError")({_tag:dn("SocketWriteError"),cause:or}){constructor(){super(...arguments);O(this,"message","An error occurred during Write")}}class Zc extends Vn("effect/socket/Socket/SocketOpenError")({_tag:dn("SocketOpenError"),kind:Ss(["Unknown","Timeout"]),cause:or}){get message(){return this.kind==="Timeout"?'timeout waiting for "open"':"An error occurred during Open"}}class ef extends Vn("effect/socket/Socket/SocketCloseError")({_tag:dn("SocketCloseError"),code:Jc,closeReason:Mi(gt)}){static filterClean(t){return function(n){return pi.is(n)&&n.reason._tag==="SocketCloseError"&&t(n.reason.code)?Dr(n.reason):Zn(n)}}get message(){return this.closeReason?`${this.code}: ${this.closeReason}`:`${this.code}`}}const k_=nr([w_,pD,Zc,ef]);var u1,c1;class pi extends(c1=IA(Cc)("SocketError",{_tag:dn("SocketError"),reason:k_}),u1=Cc,c1){constructor(n){var t=(...yU)=>(super(...yU),O(this,u1,Cc),O(this,"message",this.reason.message),this);"cause"in n.reason?t({...n,cause:n.reason.cause}):t(n)}static is(n){return gD(n)}}const mD=e=>!0;class yD extends Un()("~effect/socket/Socket/WebSocket"){}class C_ extends Un()("@effect/platform/Socket/WebSocketConstructor"){}const xD=Dm(C_)((e,t)=>new globalThis.WebSocket(e,t)),vD=(e,t)=>C_.use(n=>SD(gb((typeof e=="string"?at(e):e).pipe(ko(s=>n(s,t==null?void 0:t.protocols))),s=>Ln(()=>s.close(1e3))),t)),SD=(e,t)=>zc(n=>{let s;const i=e_(!1),a=n.context,u=(t==null?void 0:t.closeCodeIsError)??mD,f=(m,p)=>GL(uo(function*(x){const v=yield*HA().pipe(Ac(x)),w=yield*Ac(e,x),k=yield*WL(QA(v)(),yD,w);let b=!1;function _(E){if(E.data instanceof Blob){const $=zn(EL(()=>E.data.arrayBuffer()),L=>{const U=m(new Uint8Array(L));return hi(U)?U:rt});return k($)}const T=m(E.data);hi(T)&&k(T)}function R(E){w.removeEventListener("message",_),w.removeEventListener("close",j),Va(v.deferred,Ke(new pi({reason:b?new w_({cause:E}):new Zc({kind:"Unknown",cause:E})})))}function j(E){const T=typeof E.code=="number"?E.code:1001;w.removeEventListener("message",_),w.removeEventListener("error",R),Va(v.deferred,Ke(new pi({reason:new ef({code:T,closeReason:E.reason})})))}if(w.addEventListener("close",j,{once:!0}),w.addEventListener("error",R,{once:!0}),w.addEventListener("message",_),w.readyState!==1){const E=Tm();w.addEventListener("open",()=>{b=!0,Va(E,rt)},{once:!0}),yield*$m(E).pipe(zL({duration:(t==null?void 0:t.openTimeout)??1e4,orElse:()=>Ke(new pi({reason:new Zc({kind:"Timeout",cause:new Error('timeout waiting for "open"')})}))}),db(gw(v)))}return b=!0,s=w,i.openUnsafe(),p!=null&&p.onOpen&&(yield*p.onOpen),yield*FL(gw(v),ef.filterClean(E=>!u(E)),()=>rt)})).pipe(HL(x=>ki(a,x)),pb(Ln(()=>{i.closeUnsafe(),s=void 0}))),h=at(m=>i.whenOpen(Ln(()=>{const p=s;hD(m)?p.close(m.code,m.reason):p.send(m)})));return at(cD({runRaw:f,writer:h}))}),wD=Sk(vD,ip(m0));class b_ extends Un()("effect/workers/Transferable/Collector"){}const kD=()=>{let e=[];const t=i=>{e.push(...i)},n=()=>e,s=()=>{const i=e;return e=[],i};return b_.of({addAllUnsafe:t,addAll:i=>Ln(()=>t(i)),readUnsafe:n,read:Ln(n),clearUnsafe:s,clear:Ln(s)})};class CD extends Vn("effect/workers/WorkerError/WorkerSpawnError")({_tag:dn("WorkerSpawnError"),message:gt,cause:Mi(or)}){}class bD extends Vn("effect/workers/WorkerError/WorkerSendError")({_tag:dn("WorkerSendError"),message:gt,cause:Mi(or)}){}class _D extends Vn("effect/workers/WorkerError/WorkerReceiveError")({_tag:dn("WorkerReceiveError"),message:gt,cause:Mi(or)}){}class RD extends Vn("effect/workers/WorkerError/WorkerUnknownError")({_tag:dn("WorkerUnknownError"),message:gt,cause:Mi(or)}){}const ED=nr([CD,bD,_D,RD]),mg="~effect/rpc/RpcClientError";class _p extends Vn("effect/rpc/RpcClientError/RpcClientDefect")({_tag:dn("RpcClientDefect"),message:gt,cause:or}){}var f1,d1;class Sw extends(d1=Vn(mg)({_tag:dn("RpcClientError"),reason:nr([ED,k_,p0,_p])}),f1=mg,d1){constructor(){super(...arguments);O(this,f1,mg)}get message(){return`${this.reason._tag}: ${this.reason.message}`}}const nc=e=>typeof e=="bigint"?e:BigInt(e),PD={_tag:"Ping"};var Rp;try{Rp=new TextDecoder}catch{}var ue,pr,A=0,He={},Ne,hs,$n=0,hr=0,Rt,Lr,cn=[],je,ww={useRecords:!1,mapsAsObjects:!0};class __{}const R_=new __;R_.name="MessagePack 0xC1";var ws=!1,kw=2,ID;class ml{constructor(t){t&&(t.useRecords===!1&&t.mapsAsObjects===void 0&&(t.mapsAsObjects=!0),t.sequential&&t.trusted!==!1&&(t.trusted=!0,!t.structures&&t.useRecords!=!1&&(t.structures=[],t.maxSharedStructures||(t.maxSharedStructures=0))),t.structures?t.structures.sharedLength=t.structures.length:t.getStructures&&((t.structures=[]).uninitialized=!0,t.structures.sharedLength=0),t.int64AsNumber&&(t.int64AsType="number")),Object.assign(this,t)}unpack(t,n){if(ue)return M_(()=>(Pp(),this?this.unpack(t,n):ml.prototype.unpack.call(ww,t,n)));!t.buffer&&t.constructor===ArrayBuffer&&(t=typeof Buffer<"u"?Buffer.from(t):new Uint8Array(t)),typeof n=="object"?(pr=n.end||t.length,A=n.start||0):(A=0,pr=n>-1?n:t.length),hr=0,hs=null,Rt=null,ue=t;try{je=t.dataView||(t.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength))}catch(s){throw ue=null,t instanceof Uint8Array?s:new Error("Source must be a Uint8Array or Buffer but was a "+(t&&typeof t=="object"?t.constructor.name:typeof t))}if(this instanceof ml){if(He=this,this.structures)return Ne=this.structures,rc(n);(!Ne||Ne.length>0)&&(Ne=[])}else He=ww,(!Ne||Ne.length>0)&&(Ne=[]);return rc(n)}unpackMultiple(t,n){let s,i=0;try{ws=!0;let a=t.length,u=this?this.unpack(t,a):Df.unpack(t,a);if(n){if(n(u,i,A)===!1)return;for(;A<a;)if(i=A,n(rc(),i,A)===!1)return}else{for(s=[u];A<a;)i=A,s.push(rc());return s}}catch(a){throw a.lastPosition=i,a.values=s,a}finally{ws=!1,Pp()}}_mergeStructures(t,n){t=t||[],Object.isFrozen(t)&&(t=t.map(s=>s.slice(0)));for(let s=0,i=t.length;s<i;s++){let a=t[s];a&&(a.isShared=!0,s>=32&&(a.highByte=s-32>>5))}t.sharedLength=t.length;for(let s in n||[])if(s>=0){let i=t[s],a=n[s];a&&(i&&((t.restoreStructures||(t.restoreStructures=[]))[s]=i),t[s]=a)}return this.structures=t}decode(t,n){return this.unpack(t,n)}}function rc(e){try{if(!He.trusted&&!ws){let n=Ne.sharedLength||0;n<Ne.length&&(Ne.length=n)}let t;if(He.randomAccessStructure&&ue[A]<64&&ue[A]>=32&&ID||(t=ft()),Rt&&(A=Rt.postBundlePosition,Rt=null),ws&&(Ne.restoreStructures=null),A==pr)Ne&&Ne.restoreStructures&&Cw(),Ne=null,ue=null,Lr&&(Lr=null);else{if(A>pr)throw new Error("Unexpected end of MessagePack data");if(!ws){let n;try{n=JSON.stringify(t,(s,i)=>typeof i=="bigint"?`${i}n`:i).slice(0,100)}catch(s){n="(JSON view not available "+s+")"}throw new Error("Data read, but end of buffer not reached "+n)}}return t}catch(t){throw Ne&&Ne.restoreStructures&&Cw(),Pp(),(t instanceof RangeError||t.message.startsWith("Unexpected end of buffer")||A>pr)&&(t.incomplete=!0),t}}function Cw(){for(let e in Ne.restoreStructures)Ne[e]=Ne.restoreStructures[e];Ne.restoreStructures=null}function ft(){let e=ue[A++];if(e<160)if(e<128){if(e<64)return e;{let t=Ne[e&63]||He.getStructures&&E_()[e&63];return t?(t.read||(t.read=y0(t,e&63)),t.read()):e}}else if(e<144)if(e-=128,He.mapsAsObjects){let t={};for(let n=0;n<e;n++){let s=I_();s==="__proto__"&&(s="__proto_"),t[s]=ft()}return t}else{let t=new Map;for(let n=0;n<e;n++)t.set(ft(),ft());return t}else{e-=144;let t=new Array(e);for(let n=0;n<e;n++)t[n]=ft();return He.freezeData?Object.freeze(t):t}else if(e<192){let t=e-160;if(hr>=A)return hs.slice(A-$n,(A+=t)-$n);if(hr==0&&pr<140){let n=t<16?x0(t):P_(t);if(n!=null)return n}return Ep(t)}else{let t;switch(e){case 192:return null;case 193:return Rt?(t=ft(),t>0?Rt[1].slice(Rt.position1,Rt.position1+=t):Rt[0].slice(Rt.position0,Rt.position0-=t)):R_;case 194:return!1;case 195:return!0;case 196:if(t=ue[A++],t===void 0)throw new Error("Unexpected end of buffer");return yg(t);case 197:return t=je.getUint16(A),A+=2,yg(t);case 198:return t=je.getUint32(A),A+=4,yg(t);case 199:return Ks(ue[A++]);case 200:return t=je.getUint16(A),A+=2,Ks(t);case 201:return t=je.getUint32(A),A+=4,Ks(t);case 202:if(t=je.getFloat32(A),He.useFloat32>2){let n=v0[(ue[A]&127)<<1|ue[A+1]>>7];return A+=4,(n*t+(t>0?.5:-.5)>>0)/n}return A+=4,t;case 203:return t=je.getFloat64(A),A+=8,t;case 204:return ue[A++];case 205:return t=je.getUint16(A),A+=2,t;case 206:return t=je.getUint32(A),A+=4,t;case 207:return He.int64AsType==="number"?(t=je.getUint32(A)*4294967296,t+=je.getUint32(A+4)):He.int64AsType==="string"?t=je.getBigUint64(A).toString():He.int64AsType==="auto"?(t=je.getBigUint64(A),t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=je.getBigUint64(A),A+=8,t;case 208:return je.getInt8(A++);case 209:return t=je.getInt16(A),A+=2,t;case 210:return t=je.getInt32(A),A+=4,t;case 211:return He.int64AsType==="number"?(t=je.getInt32(A)*4294967296,t+=je.getUint32(A+4)):He.int64AsType==="string"?t=je.getBigInt64(A).toString():He.int64AsType==="auto"?(t=je.getBigInt64(A),t>=BigInt(-2)<<BigInt(52)&&t<=BigInt(2)<<BigInt(52)&&(t=Number(t))):t=je.getBigInt64(A),A+=8,t;case 212:if(t=ue[A++],t==114)return Iw(ue[A++]&63);{let n=cn[t];if(n)return n.read?(A++,n.read(ft())):n.noBuffer?(A++,n()):n(ue.subarray(A,++A));throw new Error("Unknown extension "+t)}case 213:return t=ue[A],t==114?(A++,Iw(ue[A++]&63,ue[A++])):Ks(2);case 214:return Ks(4);case 215:return Ks(8);case 216:return Ks(16);case 217:return t=ue[A++],hr>=A?hs.slice(A-$n,(A+=t)-$n):ND(t);case 218:return t=je.getUint16(A),A+=2,hr>=A?hs.slice(A-$n,(A+=t)-$n):MD(t);case 219:return t=je.getUint32(A),A+=4,hr>=A?hs.slice(A-$n,(A+=t)-$n):TD(t);case 220:return t=je.getUint16(A),A+=2,_w(t);case 221:return t=je.getUint32(A),A+=4,_w(t);case 222:return t=je.getUint16(A),A+=2,Rw(t);case 223:return t=je.getUint32(A),A+=4,Rw(t);default:if(e>=224)return e-256;if(e===void 0){let n=new Error("Unexpected end of MessagePack data");throw n.incomplete=!0,n}throw new Error("Unknown MessagePack token "+e)}}}const jD=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function y0(e,t){function n(){if(n.count++>kw){let i;try{i=e.read=new Function("r","return function(){return "+(He.freezeData?"Object.freeze":"")+"({"+e.map(a=>a==="__proto__"?"__proto_:r()":jD.test(a)?a+":r()":"["+JSON.stringify(a)+"]:r()").join(",")+"})}")(ft)}catch{return kw=1/0,n()}return e.read0=i,e.highByte===0&&(e.read=bw(t,e.read)),i()}let s={};for(let i=0,a=e.length;i<a;i++){let u=e[i];u==="__proto__"&&(u="__proto_"),s[u]=ft()}return He.freezeData?Object.freeze(s):s}return n.count=0,e.read0=n,e.highByte===0?bw(t,n):n}const bw=(e,t)=>function(){let n=ue[A++];if(n===0)return t();let s=e<32?-(e+(n<<5)):e+(n<<5),i=Ne[s]||E_()[s];if(!i)throw new Error("Record id is not defined for "+s);return i.read||(i.read=y0(i,e)),i.read()};function E_(){let e=M_(()=>(ue=null,He.getStructures()));return Ne=He._mergeStructures(e,Ne)}var Ep=Fl,ND=Fl,MD=Fl,TD=Fl;function Fl(e){let t;if(e<16&&(t=x0(e)))return t;if(e>64&&Rp)return Rp.decode(ue.subarray(A,A+=e));const n=A+e,s=[];for(t="";A<n;){const i=ue[A++];if((i&128)===0)s.push(i);else if((i&224)===192){const a=ue[A++]&63,u=(i&31)<<6|a;u<128?s.push(65533):s.push(u)}else if((i&240)===224){const a=ue[A++]&63,u=ue[A++]&63,f=(i&31)<<12|a<<6|u;f<2048||f>=55296&&f<=57343?s.push(65533):s.push(f)}else if((i&248)===240){const a=ue[A++]&63,u=ue[A++]&63,f=ue[A++]&63;let d=(i&7)<<18|a<<12|u<<6|f;d<65536||d>1114111?s.push(65533):(d>65535&&(d-=65536,s.push(d>>>10&1023|55296),d=56320|d&1023),s.push(d))}else s.push(65533);s.length>=4096&&(t+=bt.apply(String,s),s.length=0)}return s.length>0&&(t+=bt.apply(String,s)),t}function _w(e){let t=new Array(e);for(let n=0;n<e;n++)t[n]=ft();return He.freezeData?Object.freeze(t):t}function Rw(e){if(He.mapsAsObjects){let t={};for(let n=0;n<e;n++){let s=I_();s==="__proto__"&&(s="__proto_"),t[s]=ft()}return t}else{let t=new Map;for(let n=0;n<e;n++)t.set(ft(),ft());return t}}var bt=String.fromCharCode;function P_(e){let t=A,n=new Array(e);for(let s=0;s<e;s++){const i=ue[A++];if((i&128)>0){A=t;return}n[s]=i}return bt.apply(String,n)}function x0(e){if(e<4)if(e<2){if(e===0)return"";{let t=ue[A++];if((t&128)>1){A-=1;return}return bt(t)}}else{let t=ue[A++],n=ue[A++];if((t&128)>0||(n&128)>0){A-=2;return}if(e<3)return bt(t,n);let s=ue[A++];if((s&128)>0){A-=3;return}return bt(t,n,s)}else{let t=ue[A++],n=ue[A++],s=ue[A++],i=ue[A++];if((t&128)>0||(n&128)>0||(s&128)>0||(i&128)>0){A-=4;return}if(e<6){if(e===4)return bt(t,n,s,i);{let a=ue[A++];if((a&128)>0){A-=5;return}return bt(t,n,s,i,a)}}else if(e<8){let a=ue[A++],u=ue[A++];if((a&128)>0||(u&128)>0){A-=6;return}if(e<7)return bt(t,n,s,i,a,u);let f=ue[A++];if((f&128)>0){A-=7;return}return bt(t,n,s,i,a,u,f)}else{let a=ue[A++],u=ue[A++],f=ue[A++],d=ue[A++];if((a&128)>0||(u&128)>0||(f&128)>0||(d&128)>0){A-=8;return}if(e<10){if(e===8)return bt(t,n,s,i,a,u,f,d);{let h=ue[A++];if((h&128)>0){A-=9;return}return bt(t,n,s,i,a,u,f,d,h)}}else if(e<12){let h=ue[A++],m=ue[A++];if((h&128)>0||(m&128)>0){A-=10;return}if(e<11)return bt(t,n,s,i,a,u,f,d,h,m);let p=ue[A++];if((p&128)>0){A-=11;return}return bt(t,n,s,i,a,u,f,d,h,m,p)}else{let h=ue[A++],m=ue[A++],p=ue[A++],x=ue[A++];if((h&128)>0||(m&128)>0||(p&128)>0||(x&128)>0){A-=12;return}if(e<14){if(e===12)return bt(t,n,s,i,a,u,f,d,h,m,p,x);{let v=ue[A++];if((v&128)>0){A-=13;return}return bt(t,n,s,i,a,u,f,d,h,m,p,x,v)}}else{let v=ue[A++],w=ue[A++];if((v&128)>0||(w&128)>0){A-=14;return}if(e<15)return bt(t,n,s,i,a,u,f,d,h,m,p,x,v,w);let k=ue[A++];if((k&128)>0){A-=15;return}return bt(t,n,s,i,a,u,f,d,h,m,p,x,v,w,k)}}}}}function Ew(){let e=ue[A++],t;if(e<192)t=e-160;else switch(e){case 217:t=ue[A++];break;case 218:t=je.getUint16(A),A+=2;break;case 219:t=je.getUint32(A),A+=4;break;default:throw new Error("Expected string")}return Fl(t)}function yg(e){return He.copyBuffers?Uint8Array.prototype.slice.call(ue,A,A+=e):ue.subarray(A,A+=e)}function Ks(e){let t=ue[A++];if(cn[t]){let n;return cn[t](ue.subarray(A,n=A+=e),s=>{A=s;try{return ft()}finally{A=n}})}else throw new Error("Unknown extension type "+t)}var Pw=new Array(4096);function I_(){let e=ue[A++];if(e>=160&&e<192){if(e=e-160,hr>=A)return hs.slice(A-$n,(A+=e)-$n);if(!(hr==0&&pr<180))return Ep(e)}else return A--,j_(ft());let t=(e<<5^(e>1?je.getUint16(A):e>0?ue[A]:0))&4095,n=Pw[t],s=A,i=A+e-3,a,u=0;if(n&&n.bytes==e){for(;s<i;){if(a=je.getUint32(s),a!=n[u++]){s=1879048192;break}s+=4}for(i+=3;s<i;)if(a=ue[s++],a!=n[u++]){s=1879048192;break}if(s===i)return A=s,n.string;i-=3,s=A}for(n=[],Pw[t]=n,n.bytes=e;s<i;)a=je.getUint32(s),n.push(a),s+=4;for(i+=3;s<i;)a=ue[s++],n.push(a);let f=e<16?x0(e):P_(e);return f!=null?n.string=f:n.string=Ep(e)}function j_(e){if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean"||typeof e=="bigint")return e.toString();if(e==null)return e+"";if(He.allowArraysInMapKeys&&Array.isArray(e)&&e.flat().every(t=>["string","number","boolean","bigint"].includes(typeof t)))return e.flat().toString();throw new Error(`Invalid property type for record: ${typeof e}`)}const Iw=(e,t)=>{let n=ft().map(j_),s=e;t!==void 0&&(e=e<32?-((t<<5)+e):(t<<5)+e,n.highByte=t);let i=Ne[e];return i&&(i.isShared||ws)&&((Ne.restoreStructures||(Ne.restoreStructures=[]))[e]=i),Ne[e]=n,n.read=y0(n,s),(n.read0||n.read)()};cn[0]=()=>{};cn[0].noBuffer=!0;cn[66]=e=>{let t=e.byteLength%8||8,n=BigInt(e[0]&128?e[0]-256:e[0]);for(let s=1;s<t;s++)n<<=BigInt(8),n+=BigInt(e[s]);if(e.byteLength!==t){let s=new DataView(e.buffer,e.byteOffset,e.byteLength),i=(a,u)=>{let f=u-a;if(f<=40){let p=s.getBigUint64(a);for(let x=a+8;x<u;x+=8)p<<=BigInt(64),p|=s.getBigUint64(x);return p}let d=a+(f>>4<<3),h=i(a,d),m=i(d,u);return h<<BigInt((u-d)*8)|m};n=n<<BigInt((s.byteLength-t)*8)|i(t,s.byteLength)}return n};let jw={Error,EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,AggregateError:typeof AggregateError=="function"?AggregateError:null};cn[101]=()=>{let e=ft();if(!jw[e[0]]){let t=Error(e[1],{cause:e[2]});return t.name=e[0],t}return jw[e[0]](e[1],{cause:e[2]})};cn[105]=e=>{if(He.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=je.getUint32(A-4);Lr||(Lr=new Map);let n=ue[A],s;n>=144&&n<160||n==220||n==221?s=[]:n>=128&&n<144||n==222||n==223?s=new Map:(n>=199&&n<=201||n>=212&&n<=216)&&ue[A+1]===115?s=new Set:s={};let i={target:s};Lr.set(t,i);let a=ft();if(i.used)Object.assign(s,a);else return i.target=a;if(s instanceof Map)for(let[u,f]of a.entries())s.set(u,f);if(s instanceof Set)for(let u of Array.from(a))s.add(u);return s};cn[112]=e=>{if(He.structuredClone===!1)throw new Error("Structured clone extension is disabled");let t=je.getUint32(A-4),n=Lr.get(t);return n.used=!0,n.target};cn[115]=()=>new Set(ft());const N_=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(e=>e+"Array");let $D=typeof globalThis=="object"?globalThis:window;cn[116]=e=>{let t=e[0],n=Uint8Array.prototype.slice.call(e,1).buffer,s=N_[t];if(!s){if(t===16)return n;if(t===17)return new DataView(n);throw new Error("Could not find typed array for code "+t)}return new $D[s](n)};cn[120]=()=>{let e=ft();return new RegExp(e[0],e[1])};const FD=[];cn[98]=e=>{let t=(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3],n=A;return A+=t-e.length,Rt=FD,Rt=[Ew(),Ew()],Rt.position0=0,Rt.position1=0,Rt.postBundlePosition=A,A=n,ft()};cn[255]=e=>e.length==4?new Date((e[0]*16777216+(e[1]<<16)+(e[2]<<8)+e[3])*1e3):e.length==8?new Date(((e[0]<<22)+(e[1]<<14)+(e[2]<<6)+(e[3]>>2))/1e6+((e[3]&3)*4294967296+e[4]*16777216+(e[5]<<16)+(e[6]<<8)+e[7])*1e3):e.length==12?new Date(((e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3])/1e6+((e[4]&128?-281474976710656:0)+e[6]*1099511627776+e[7]*4294967296+e[8]*16777216+(e[9]<<16)+(e[10]<<8)+e[11])*1e3):new Date("invalid");function M_(e){let t=pr,n=A,s=$n,i=hr,a=hs,u=Lr,f=Rt,d=new Uint8Array(ue.slice(0,pr)),h=Ne,m=Ne.slice(0,Ne.length),p=He,x=ws,v=e();return pr=t,A=n,$n=s,hr=i,hs=a,Lr=u,Rt=f,ue=d,ws=x,Ne=h,Ne.splice(0,Ne.length,...m),He=p,je=new DataView(ue.buffer,ue.byteOffset,ue.byteLength),v}function Pp(){ue=null,Lr=null,Ne=null}const v0=new Array(147);for(let e=0;e<256;e++)v0[e]=+("1e"+Math.floor(45.15-e*.30103));var Df=new ml({useRecords:!1});Df.unpack;Df.unpackMultiple;Df.unpack;let LD=new Float32Array(1);new Uint8Array(LD.buffer,0,4);let bc;try{bc=new TextEncoder}catch{}let Ip,jp;const Ii=typeof Buffer<"u",sc=Ii?function(e){return Buffer.allocUnsafeSlow(e)}:Uint8Array,T_=Ii?Buffer:Uint8Array,Nw=Ii?4294967296:2144337920;let G,Pa,ze,D=0,Ut,tt=null,OD;const AD=21760,DD=/[\u0080-\uFFFF]/,oi=Symbol("record-id");class zD extends ml{constructor(t){super(t),this.offset=0;let n,s,i,a,u=T_.prototype.utf8Write?function(P,H){return G.utf8Write(P,H,G.byteLength-H)}:bc&&bc.encodeInto?function(P,H){return bc.encodeInto(P,G.subarray(H)).written}:!1,f=this;t||(t={});let d=t&&t.sequential,h=t.structures||t.saveStructures,m=t.maxSharedStructures;if(m==null&&(m=h?32:0),m>8160)throw new Error("Maximum maxSharedStructure is 8160");t.structuredClone&&t.moreTypes==null&&(this.moreTypes=!0);let p=t.maxOwnStructures;p==null&&(p=h?32:64),!this.structures&&t.useRecords!=!1&&(this.structures=[]);let x=m>32||p+m>64,v=m+64,w=m+p+64;if(w>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let k=[],b=0,_=0;this.pack=this.encode=function(P,H){if(G||(G=new sc(8192),ze=G.dataView||(G.dataView=new DataView(G.buffer,0,8192)),D=0),Ut=G.length-10,Ut-D<2048?(G=new sc(G.length),ze=G.dataView||(G.dataView=new DataView(G.buffer,0,G.length)),Ut=G.length-10,D=0):D=D+7&2147483640,n=D,H&HD&&(D+=H&255),a=f.structuredClone?new Map:null,f.bundleStrings&&typeof P!="string"?(tt=[],tt.size=1/0):tt=null,i=f.structures,i){i.uninitialized&&(i=f._mergeStructures(f.getStructures()));let K=i.sharedLength||0;if(K>m)throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+i.sharedLength);if(!i.transitions){i.transitions=Object.create(null);for(let q=0;q<K;q++){let Y=i[q];if(!Y)continue;let se,ee=i.transitions;for(let M=0,J=Y.length;M<J;M++){let pe=Y[M];se=ee[pe],se||(se=ee[pe]=Object.create(null)),ee=se}ee[oi]=q+64}this.lastNamedStructuresLength=K}d||(i.nextId=K+64)}s&&(s=!1);let X;try{f.randomAccessStructure&&!f.readOnlyStructures&&P&&typeof P=="object"?P.constructor===Object?ae(P):P.constructor!==Map&&!Array.isArray(P)&&!jp.some(q=>P instanceof q)?ae(P.toJSON?P.toJSON():P):E(P):E(P);let K=tt;if(tt&&Tw(n,E,0),a&&a.idsToInsert){let q=a.idsToInsert.sort((M,J)=>M.offset>J.offset?1:-1),Y=q.length,se=-1;for(;K&&Y>0;){let M=q[--Y].offset+n;M<K.stringsPosition+n&&se===-1&&(se=0),M>K.position+n?se>=0&&(se+=6):(se>=0&&(ze.setUint32(K.position+n,ze.getUint32(K.position+n)+se),se=-1),K=K.previous,Y++)}se>=0&&K&&ze.setUint32(K.position+n,ze.getUint32(K.position+n)+se),D+=q.length*6,D>Ut&&z(D),f.offset=D;let ee=UD(G.subarray(n,D),q);return a=null,ee}return f.offset=D,H&BD?(G.start=n,G.end=D,G):G.subarray(n,D)}catch(K){throw X=K,K}finally{if(i&&(R(),s&&f.saveStructures)){let K=i.sharedLength||0,q=G.subarray(n,D),Y=VD(i,f);if(!X)return f.saveStructures(Y,Y.isCompatible)===!1?(i.uninitialized=!0,f.pack(P,H)):(f.lastNamedStructuresLength=K,G.length>1073741824&&(G=null),q)}G.length>1073741824&&(G=null),H&qD&&(D=n)}};const R=()=>{_<10&&_++;let P=i.sharedLength||0;if(i.length>P&&!d&&(i.length=P),b>1e4)i.transitions=null,_=0,b=0,k.length>0&&(k=[]);else if(k.length>0&&!d){for(let H=0,X=k.length;H<X;H++)k[H][oi]=0;k=[]}},j=P=>{var H=P.length;H<16?G[D++]=144|H:H<65536?(G[D++]=220,G[D++]=H>>8,G[D++]=H&255):(G[D++]=221,ze.setUint32(D,H),D+=4);for(let X=0;X<H;X++)E(P[X])},E=P=>{D>Ut&&(G=z(D));var H=typeof P,X;if(H==="string"){let K=P.length;if(tt&&K>=4&&K<4096){if((tt.size+=K)>AD){let ee,M=(tt[0]?tt[0].length*3+tt[1].length:0)+10;D+M>Ut&&(G=z(D+M));let J;tt.position?(J=tt,G[D]=200,D+=3,G[D++]=98,ee=D-n,D+=4,Tw(n,E,0),ze.setUint16(ee+n-3,D-n-ee)):(G[D++]=214,G[D++]=98,ee=D-n,D+=4),tt=["",""],tt.previous=J,tt.size=0,tt.position=ee}let se=DD.test(P);tt[se?0:1]+=P,G[D++]=193,E(se?-K:K);return}let q;K<32?q=1:K<256?q=2:K<65536?q=3:q=5;let Y=K*3;if(D+Y>Ut&&(G=z(D+Y)),K<64||!u){let se,ee,M,J=D+q;for(se=0;se<K;se++)ee=P.charCodeAt(se),ee<128?G[J++]=ee:ee<2048?(G[J++]=ee>>6|192,G[J++]=ee&63|128):(ee&64512)===55296&&((M=P.charCodeAt(se+1))&64512)===56320?(ee=65536+((ee&1023)<<10)+(M&1023),se++,G[J++]=ee>>18|240,G[J++]=ee>>12&63|128,G[J++]=ee>>6&63|128,G[J++]=ee&63|128):(G[J++]=ee>>12|224,G[J++]=ee>>6&63|128,G[J++]=ee&63|128);X=J-D-q}else X=u(P,D+q);X<32?G[D++]=160|X:X<256?(q<2&&G.copyWithin(D+2,D+1,D+1+X),G[D++]=217,G[D++]=X):X<65536?(q<3&&G.copyWithin(D+3,D+2,D+2+X),G[D++]=218,G[D++]=X>>8,G[D++]=X&255):(q<5&&G.copyWithin(D+5,D+3,D+3+X),G[D++]=219,ze.setUint32(D,X),D+=4),D+=X}else if(H==="number")if(P>>>0===P)P<32||P<128&&this.useRecords===!1||P<64&&!this.randomAccessStructure?G[D++]=P:P<256?(G[D++]=204,G[D++]=P):P<65536?(G[D++]=205,G[D++]=P>>8,G[D++]=P&255):(G[D++]=206,ze.setUint32(D,P),D+=4);else if(P>>0===P)P>=-32?G[D++]=256+P:P>=-128?(G[D++]=208,G[D++]=P+256):P>=-32768?(G[D++]=209,ze.setInt16(D,P),D+=2):(G[D++]=210,ze.setInt32(D,P),D+=4);else{let K;if((K=this.useFloat32)>0&&P<4294967296&&P>=-2147483648){G[D++]=202,ze.setFloat32(D,P);let q;if(K<4||(q=P*v0[(G[D]&127)<<1|G[D+1]>>7])>>0===q){D+=4;return}else D--}G[D++]=203,ze.setFloat64(D,P),D+=8}else if(H==="object"||H==="function")if(!P)G[D++]=192;else{if(a){let q=a.get(P);if(q){if(!q.id){let Y=a.idsToInsert||(a.idsToInsert=[]);q.id=Y.push(q)}G[D++]=214,G[D++]=112,ze.setUint32(D,q.id),D+=4;return}else a.set(P,{offset:D-n})}let K=P.constructor;if(K===Object)U(P);else if(K===Array)j(P);else if(K===Map)if(this.mapAsEmptyObject)G[D++]=128;else{X=P.size,X<16?G[D++]=128|X:X<65536?(G[D++]=222,G[D++]=X>>8,G[D++]=X&255):(G[D++]=223,ze.setUint32(D,X),D+=4);for(let[q,Y]of P)E(q),E(Y)}else{for(let q=0,Y=Ip.length;q<Y;q++){let se=jp[q];if(P instanceof se){let ee=Ip[q];if(ee.write){ee.type&&(G[D++]=212,G[D++]=ee.type,G[D++]=0);let ce=ee.write.call(this,P);ce===P?Array.isArray(P)?j(P):U(P):E(ce);return}let M=G,J=ze,pe=D;G=null;let he;try{he=ee.pack.call(this,P,ce=>(G=M,M=null,D+=ce,D>Ut&&z(D),{target:G,targetView:ze,position:D-ce}),E)}finally{M&&(G=M,ze=J,D=pe,Ut=G.length-10)}he&&(he.length+D>Ut&&z(he.length+D),D=Mw(he,G,D,ee.type));return}}if(Array.isArray(P))j(P);else{if(P.toJSON){const q=P.toJSON();if(q!==P)return E(q)}if(H==="function")return E(this.writeFunction&&this.writeFunction(P));U(P)}}}else if(H==="boolean")G[D++]=P?195:194;else if(H==="bigint"){if(P<9223372036854776e3&&P>=-9223372036854776e3)G[D++]=211,ze.setBigInt64(D,P);else if(P<18446744073709552e3&&P>0)G[D++]=207,ze.setBigUint64(D,P);else if(this.largeBigIntToFloat)G[D++]=203,ze.setFloat64(D,Number(P));else{if(this.largeBigIntToString)return E(P.toString());if(this.useBigIntExtension||this.moreTypes){let K=P<0?BigInt(-1):BigInt(0),q;if(P>>BigInt(65536)===K){let Y=BigInt(18446744073709552e3)-BigInt(1),se=[];for(;se.push(P&Y),P>>BigInt(63)!==K;)P>>=BigInt(64);q=new Uint8Array(new BigUint64Array(se).buffer),q.reverse()}else{let Y=P<0,se=(Y?~P:P).toString(16);if(se.length%2?se="0"+se:parseInt(se.charAt(0),16)>=8&&(se="00"+se),Ii)q=Buffer.from(se,"hex");else{q=new Uint8Array(se.length/2);for(let ee=0;ee<q.length;ee++)q[ee]=parseInt(se.slice(ee*2,ee*2+2),16)}if(Y)for(let ee=0;ee<q.length;ee++)q[ee]=~q[ee]}q.length+D>Ut&&z(q.length+D),D=Mw(q,G,D,66);return}else throw new RangeError(P+" was too large to fit in MessagePack 64-bit integer format, use useBigIntExtension, or set largeBigIntToFloat to convert to float-64, or set largeBigIntToString to convert to string")}D+=8}else if(H==="undefined")this.encodeUndefinedAsNil?G[D++]=192:(G[D++]=212,G[D++]=0,G[D++]=0);else throw new Error("Unknown type: "+H)},T=this.variableMapSize||this.coercibleKeyAsNumber||this.skipValues?P=>{let H;if(this.skipValues){H=[];for(let q in P)(typeof P.hasOwnProperty!="function"||P.hasOwnProperty(q))&&!this.skipValues.includes(P[q])&&H.push(q)}else H=Object.keys(P);let X=H.length;X<16?G[D++]=128|X:X<65536?(G[D++]=222,G[D++]=X>>8,G[D++]=X&255):(G[D++]=223,ze.setUint32(D,X),D+=4);let K;if(this.coercibleKeyAsNumber)for(let q=0;q<X;q++){K=H[q];let Y=Number(K);E(isNaN(Y)?K:Y),E(P[K])}else for(let q=0;q<X;q++)E(K=H[q]),E(P[K])}:P=>{G[D++]=222;let H=D-n;D+=2;let X=0;for(let K in P)(typeof P.hasOwnProperty!="function"||P.hasOwnProperty(K))&&(E(K),E(P[K]),X++);if(X>65535)throw new Error('Object is too large to serialize with fast 16-bit map size, use the "variableMapSize" option to serialize this object');G[H+++n]=X>>8,G[H+n]=X&255},$=this.useRecords===!1?T:t.progressiveRecords&&!x?P=>{let H,X=i.transitions||(i.transitions=Object.create(null)),K=D++-n,q;for(let Y in P)if(typeof P.hasOwnProperty!="function"||P.hasOwnProperty(Y)){if(H=X[Y],H)X=H;else{let se=Object.keys(P),ee=X;X=i.transitions;let M=0;for(let J=0,pe=se.length;J<pe;J++){let he=se[J];H=X[he],H||(H=X[he]=Object.create(null),M++),X=H}K+n+1==D?(D--,Z(X,se,M)):te(X,se,K,M),q=!0,X=ee[Y]}E(P[Y])}if(!q){let Y=X[oi];Y?G[K+n]=Y:te(X,Object.keys(P),K,0)}}:P=>{let H,X=i.transitions||(i.transitions=Object.create(null)),K=0;for(let Y in P)(typeof P.hasOwnProperty!="function"||P.hasOwnProperty(Y))&&(H=X[Y],H||(H=X[Y]=Object.create(null),K++),X=H);let q=X[oi];q?q>=96&&x?(G[D++]=((q-=96)&31)+96,G[D++]=q>>5):G[D++]=q:Z(X,X.__keys__||Object.keys(P),K);for(let Y in P)(typeof P.hasOwnProperty!="function"||P.hasOwnProperty(Y))&&E(P[Y])},L=typeof this.useRecords=="function"&&this.useRecords,U=L?P=>{L(P)?$(P):T(P)}:$,z=P=>{let H;if(P>16777216){if(P-n>Nw)throw new Error("Packed buffer would be larger than maximum buffer size");H=Math.min(Nw,Math.round(Math.max((P-n)*(P>67108864?1.25:2),4194304)/4096)*4096)}else H=(Math.max(P-n<<2,G.length-1)>>12)+1<<12;let X=new sc(H);return ze=X.dataView||(X.dataView=new DataView(X.buffer,0,H)),P=Math.min(P,G.length),G.copy?G.copy(X,0,n,P):X.set(G.slice(n,P)),D-=n,n=0,Ut=X.length-10,G=X},Z=(P,H,X)=>{let K=i.nextId;K||(K=64),K<v&&this.shouldShareStructure&&!this.shouldShareStructure(H)?(K=i.nextOwnId,K<w||(K=v),i.nextOwnId=K+1):(K>=w&&(K=v),i.nextId=K+1);let q=H.highByte=K>=96&&x?K-96>>5:-1;P[oi]=K,P.__keys__=H,i[K-64]=H,K<v?(H.isShared=!0,i.sharedLength=K-63,s=!0,q>=0?(G[D++]=(K&31)+96,G[D++]=q):G[D++]=K):(q>=0?(G[D++]=213,G[D++]=114,G[D++]=(K&31)+96,G[D++]=q):(G[D++]=212,G[D++]=114,G[D++]=K),X&&(b+=_*X),k.length>=p&&(k.shift()[oi]=0),k.push(P),E(H))},te=(P,H,X,K)=>{let q=G,Y=D,se=Ut,ee=n;G=Pa,D=0,n=0,G||(Pa=G=new sc(8192)),Ut=G.length-10,Z(P,H,K),Pa=G;let M=D;if(G=q,D=Y,Ut=se,n=ee,M>1){let J=D+M-1;J>Ut&&z(J);let pe=X+n;G.copyWithin(pe+M,pe+1,D),G.set(Pa.slice(0,M),pe),D=J}else G[X+n]=Pa[0]},ae=P=>{let H=OD(P,G,n,D,i,z,(X,K,q)=>{if(q)return s=!0;D=K;let Y=G;return E(X),R(),Y!==G?{position:D,targetView:ze,target:G}:D},this);if(H===0)return U(P);D=H}}useBuffer(t){G=t,G.dataView||(G.dataView=new DataView(G.buffer,G.byteOffset,G.byteLength)),ze=G.dataView,D=0}set position(t){D=t}get position(){return D}clearSharedData(){this.structures&&(this.structures=[]),this.typedStructs&&(this.typedStructs=[])}}jp=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,DataView,__];Ip=[{pack(e,t,n){let s=e.getTime()/1e3;if((this.useTimestamp32||e.getMilliseconds()===0)&&s>=0&&s<4294967296){let{target:i,targetView:a,position:u}=t(6);i[u++]=214,i[u++]=255,a.setUint32(u,s)}else if(s>0&&s<4294967296){let{target:i,targetView:a,position:u}=t(10);i[u++]=215,i[u++]=255,a.setUint32(u,e.getMilliseconds()*4e6+(s/1e3/4294967296>>0)),a.setUint32(u+4,s)}else if(isNaN(s)){if(this.onInvalidDate)return t(0),n(this.onInvalidDate());let{target:i,targetView:a,position:u}=t(3);i[u++]=212,i[u++]=255,i[u++]=255}else{let{target:i,targetView:a,position:u}=t(15);i[u++]=199,i[u++]=12,i[u++]=255,a.setUint32(u,e.getMilliseconds()*1e6),a.setBigInt64(u+4,BigInt(Math.floor(s)))}}},{pack(e,t,n){if(this.setAsEmptyObject)return t(0),n({});let s=Array.from(e),{target:i,position:a}=t(this.moreTypes?3:0);this.moreTypes&&(i[a++]=212,i[a++]=115,i[a++]=0),n(s)}},{pack(e,t,n){let{target:s,position:i}=t(this.moreTypes?3:0);this.moreTypes&&(s[i++]=212,s[i++]=101,s[i++]=0),n([e.name,e.message,e.cause])}},{pack(e,t,n){let{target:s,position:i}=t(this.moreTypes?3:0);this.moreTypes&&(s[i++]=212,s[i++]=120,s[i++]=0),n([e.source,e.flags])}},{pack(e,t){this.moreTypes?xg(e,16,t):vg(Ii?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let n=e.constructor;n!==T_&&this.moreTypes?xg(e,N_.indexOf(n.name),t):vg(e,t)}},{pack(e,t){this.moreTypes?xg(e,17,t):vg(Ii?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let{target:n,position:s}=t(1);n[s]=193}}];function xg(e,t,n,s){let i=e.byteLength;if(i+1<256){var{target:a,position:u}=n(4+i);a[u++]=199,a[u++]=i+1}else if(i+1<65536){var{target:a,position:u}=n(5+i);a[u++]=200,a[u++]=i+1>>8,a[u++]=i+1&255}else{var{target:a,position:u,targetView:f}=n(7+i);a[u++]=201,f.setUint32(u,i+1),u+=4}a[u++]=116,a[u++]=t,e.buffer||(e=new Uint8Array(e)),a.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),u)}function vg(e,t){let n=e.byteLength;var s,i;if(n<256){var{target:s,position:i}=t(n+2);s[i++]=196,s[i++]=n}else if(n<65536){var{target:s,position:i}=t(n+3);s[i++]=197,s[i++]=n>>8,s[i++]=n&255}else{var{target:s,position:i,targetView:a}=t(n+5);s[i++]=198,a.setUint32(i,n),i+=4}s.set(e,i)}function Mw(e,t,n,s){let i=e.length;switch(i){case 1:t[n++]=212;break;case 2:t[n++]=213;break;case 4:t[n++]=214;break;case 8:t[n++]=215;break;case 16:t[n++]=216;break;default:i<256?(t[n++]=199,t[n++]=i):i<65536?(t[n++]=200,t[n++]=i>>8,t[n++]=i&255):(t[n++]=201,t[n++]=i>>24,t[n++]=i>>16&255,t[n++]=i>>8&255,t[n++]=i&255)}return t[n++]=s,t.set(e,n),n+=i,n}function UD(e,t){let n,s=t.length*6,i=e.length-s;for(;n=t.pop();){let a=n.offset,u=n.id;e.copyWithin(a+s,a,i),s-=6;let f=a+s;e[f++]=214,e[f++]=105,e[f++]=u>>24,e[f++]=u>>16&255,e[f++]=u>>8&255,e[f++]=u&255,i=a}return e}function Tw(e,t,n){if(tt.length>0){ze.setUint32(tt.position+e,D+n-tt.position-e),tt.stringsPosition=D-e;let s=tt;tt=null,t(s[0]),t(s[1])}}function VD(e,t){return e.isCompatible=n=>{let s=!n||(t.lastNamedStructuresLength||0)===n.length;return s||t._mergeStructures(n),s},e}let $_=new zD({useRecords:!1});$_.pack;$_.pack;const BD=512,qD=1024,HD=2048;class S0 extends Un()("effect/rpc/RpcSerialization"){}const WD=S0.of({contentType:"application/json",includesFraming:!1,makeUnsafe:()=>{const e=new TextDecoder;return{decode:t=>{const n=JSON.parse(typeof t=="string"?t:e.decode(t));return Array.isArray(n)?n:[n]},encode:t=>JSON.stringify(t)}}}),GD=Dm(S0)(WD),KD=e=>Ar(()=>{const t=new Set,n=new Map,s=new Map;let i=(a,u)=>hb(f=>{let d=n.get(a);return d||(d=[],n.set(a,d)),d.push([u,f]),rt});return ko(e((a,u)=>{const f=s.get(a);return f?f(u):i(a,u)},t),a=>({...a,run(u,f){return up(function*(){t.add(u),s.set(u,f);const d=n.get(u);if(d){n.delete(u);for(const[h,m]of d)yield*lo(Ar(()=>f(h)),m)}return yield*mb(IL,()=>(t.delete(u),s.delete(u),rt))})}}))});let QD=BigInt(0);const JD=uo(function*(e,t){const n=(t==null?void 0:t.spanPrefix)??"RpcClient",s=(t==null?void 0:t.supportsAck)??!0,i=(t==null?void 0:t.disableTracing)??!1,a=(t==null?void 0:t.generateRequestId)??(()=>QD++),u=yield*Uc(),f=io(u,AS),d=new Map;let h=!1;yield*rL(f,zc(R=>(h=!0,m(KF(R.id)))));const m=uo(function*(R){for(const[j,E]of d)d.delete(j),E._tag==="Queue"?yield*R._tag==="Success"?ow(E.queue):La(E.queue,R.cause):E.resume(R)}),p=R=>{const j=v_(R.successSchema),E=w(R);return(T,$)=>{const L=$!=null&&$.headers?iD($.headers):g0,U=($==null?void 0:$.context)??er();if(!j){const Z=te=>x(R,E,te,R.payloadSchema.make(T),L,U,($==null?void 0:$.discard)??!1);return i?Z(void 0):YL(`${n}.${R._tag}`,{attributes:t.spanAttributes},Z)}const z=v(R,E,R.payloadSchema.make(T),L,($==null?void 0:$.streamBufferSize)??16,U);return $!=null&&$.asQueue?z:DA(ko(z,AA))}},x=(R,j,E,T,$,L,U)=>zc(z=>{if(h)return cp;const Z=a(),te=j(P=>t.onFromClient({message:P,context:L,discard:U}),{_tag:"Request",id:Z,tag:R._tag,payload:T,...E?{traceId:E.traceId,spanId:E.spanId,sampled:E.sampled}:{},headers:xw(z.getRef(Fw),$)});if(U)return te;let ae;return QL(qS(P=>{const H={_tag:"Effect",rpc:R,context:L,resume(X){P(X),ae&&!ae.pollUnsafe()&&z.currentDispatcher.scheduleTask(()=>{ae.interruptUnsafe(z.id)},0)}};d.set(Z,H),ae=te.pipe(E?WS(E,{captureStackTrace:!1}):_e,Vc(z.context)),ae.addObserver(X=>{if(X._tag==="Failure")return P(X)})}),P=>(d.delete(Z),TL(Fa(ae),k(Z,Array.from(P),L))))}),v=uo(function*(R,j,E,T,$,L){if(h)return yield*cp;const U=i?void 0:yield*JL(`${n}.${R._tag}`,{attributes:t.spanAttributes}),z=xp(),Z=a(),te=vf(z.context,AS);yield*nL(te,P=>d.has(Z)?(d.delete(Z),k(Z,ZC(P)?Array.from(qF(P.cause)):[],L)):rt);const ae=yield*L3($);return d.set(Z,{_tag:"Queue",rpc:R,queue:ae,scope:te,context:L}),yield*j(P=>t.onFromClient({message:P,context:L,discard:!1}),{_tag:"Request",id:Z,tag:R._tag,payload:E,...U?{traceId:U.traceId,spanId:U.spanId,sampled:U.sampled}:{},headers:xw(z.getRef(Fw),T)}).pipe(U?WS(U,{captureStackTrace:!1}):_e,dl(P=>La(ae,P)),qm,XL(te,{startImmediately:!0})),ae}),w=R=>{const j=[];for(const E of R.middlewares.values()){const T=u.mapUnsafe.get(`${E.key}/Client`);T&&j.push(T)}return j.length===0?(E,T)=>E(T):function E(T,$,L=j.length-1){return L===-1?T($):j[L]({rpc:R,request:$,next(U){return E(T,U,L-1)}})}},k=(R,j,E)=>qS(T=>{const $=xp();t.onFromClient({message:{_tag:"Interrupt",requestId:R,interruptors:j},context:E,discard:!1}).pipe(DL(1e3),Vc($.context)).addObserver(()=>{T(rt)})}),b=R=>{switch(R._tag){case"Chunk":{const j=R.requestId,E=d.get(j);return!E||E._tag!=="Queue"?rt:O3(E.queue,R.values).pipe(s?zn(()=>t.onFromClient({message:{_tag:"Ack",requestId:R.requestId},context:E.context,discard:!1})):_e,dl(T=>La(E.queue,T)))}case"Exit":{const j=R.requestId,E=d.get(j);return E?(d.delete(j),E._tag==="Effect"?(E.resume(R.exit),rt):R.exit._tag==="Success"?ow(E.queue):La(E.queue,R.exit.cause)):rt}case"Defect":return m(GF(R.defect));case"ClientEnd":return rt}};let _;if(t.flatten){const R=new Map;_=function(E,T,$){let L=R.get(E);return L||(L=p(e.requests.get(E)),R.set(E,L)),L(T,$)}}else _={},e.requests.forEach(R=>{_[R._tag]=p(R)});return{client:_,write:b}});let YD=0;const XD=uo(function*(e,t){const n=YD++,{run:s,send:i,supportsAck:a,supportsTransferables:u}=yield*zf,f=new Map,{client:d,write:h}=yield*JD(e,{...t,supportsAck:a,onFromClient({message:m}){switch(m._tag){case"Request":{const p=e.requests.get(m.tag),x=u?kD():void 0,v=xp(),w={rpc:p,context:x?Is(v.context,b_,x):v.context,schemas:ZD(p)};return f.set(m.id,w),w.schemas.encodePayload(m.payload).pipe(lo(w.context),vc,zn(k=>i(n,{...m,id:String(m.id),payload:k,headers:Object.entries(m.headers)},x&&x.readUnsafe())))}case"Ack":return f.get(m.requestId)?i(n,{_tag:"Ack",requestId:String(m.requestId)}):rt;case"Interrupt":return f.get(m.requestId)?(f.delete(m.requestId),i(n,{_tag:"Interrupt",requestId:String(m.requestId)})):rt;case"Eof":return rt}}});return yield*s(n,m=>{switch(m._tag){case"Chunk":{const p=nc(m.requestId),x=f.get(p);return!x||So(x.schemas.decodeChunk)?rt:x.schemas.decodeChunk.value(m.values).pipe(lo(x.context),vc,zn(v=>h({_tag:"Chunk",clientId:0,requestId:nc(m.requestId),values:v})),KL(v=>h({_tag:"Exit",clientId:0,requestId:nc(m.requestId),exit:Ua(v)})))}case"Exit":{const p=nc(m.requestId),x=f.get(p);return x?(f.delete(p),x.schemas.decodeExit(m.exit).pipe(lo(x.context),vc,VL({onSuccess:v=>h({_tag:"Exit",clientId:0,requestId:p,exit:v}),onFailure:v=>h({_tag:"Exit",clientId:0,requestId:p,exit:Ua(v)})}))):rt}case"Defect":return h({_tag:"Defect",clientId:0,defect:r4(m.defect)});case"ClientProtocolError":{const p=Il(m.error);return cb(f.keys(),x=>h({_tag:"Exit",clientId:0,requestId:x,exit:p}))}default:return rt}}).pipe(dl(iO),qm,Hm),d}),$w=new WeakMap,ZD=e=>{let t=$w.get(e);if(t!==void 0)return t;const n=S_(e.successSchema);return t={decodeChunk:gm(n,s=>lw(hg(mA(s.success)))),encodePayload:hA(hg(e.payloadSchema)),decodeExit:lw(hg(tD(e)))},$w.set(e,t),t},Fw=Xe("effect/rpc/RpcClient/CurrentHeaders",{defaultValue:()=>g0});class zf extends Un()("effect/rpc/RpcClient/Protocol"){}O(zf,"make",KD);const e4=e=>zf.make(uo(function*(t,n){const s=yield*m0,i=yield*S0,a=yield*qL(Np),u=new Map,f=yield*s.writer;let d=i.makeUnsafe();const h=yield*n4(f(d.encode(PD)));let m;const p=Ar(()=>(m=void 0,ks(a)?a.value.onConnect:rt)),x=v=>cb(n,w=>t(w,v));return yield*Ar(()=>(d=i.makeUnsafe(),h.reset(),s.runRaw(v=>{try{const w=d.decode(v);if(w.length===0)return;let k=0;return fb({while:()=>k<w.length,body:()=>{const b=w[k++];if(b._tag==="Pong")return h.onPong(),rt;if("requestId"in b){const _=u.get(b.requestId);if(_!==void 0)return b._tag==="Exit"&&u.delete(b.requestId),t(_,b)}return x(b)},step:Sl})}catch(w){return x({_tag:"ClientProtocolError",error:new Sw({reason:new _p({message:"Error decoding message",cause:w})})})}},{onOpen:p}).pipe(db(zn(h.timeout,()=>Ke(new pi({reason:new Zc({kind:"Timeout",cause:new Error("ping timeout")})}))))))).pipe(zn(()=>Ke(new pi({reason:new ef({code:1e3})}))),ks(a)?pb(a.value.onDisconnect):_e,LL(v=>{const w=Pl(v),k=wM(w);return k&&w.success.reason._tag==="SocketOpenError"?rt:(m=new Sw({reason:k?w.success.reason:new _p({message:"Unknown socket error",cause:YC(v)})}),x({_tag:"ClientProtocolError",error:m}))}),OL((e==null?void 0:e.retryPolicy)??t4),aO({module:"RpcClient",method:"makeProtocolSocket"}),Hm),{send(v,w){if(m)return Ke(m);w._tag==="Request"&&u.set(w.id,v);const k=d.encode(w);return k===void 0?rt:vc(f(k))},supportsAck:!0,supportsTransferables:!1}})),t4=ab(500,1.5).pipe(ib(Vm(5e3))),n4=uo(function*(e){let t=!0;const n=e_(),s=()=>{t=!0,n.closeUnsafe()},i=()=>{t=!0};return yield*Ar(()=>t?(t=!1,e):n.open).pipe(UL("5 seconds"),AL,yb,qm,Hm),{timeout:n.await,reset:s,onPong:i}});class Np extends Un()("effect/rpc/RpcClient/ConnectionHooks"){}const r4=fA(or),s4={add(...e){const t=new Map(this.requests);for(const n of e)t.set(n._tag,n);return jr({requests:t,annotations:this.annotations})},merge(...e){const t=new Map(this.requests),n=new Map(this.annotations.mapUnsafe);for(const s of e){for(const[i,a]of s.requests)t.set(i,a);for(const[i,a]of s.annotations.mapUnsafe)n.set(i,a)}return jr({requests:t,annotations:ys(n)})},omit(...e){const t=new Map(this.requests);for(const n of e)t.delete(n);return jr({requests:t,annotations:this.annotations})},middleware(e){const t=new Map;for(const[n,s]of this.requests)t.set(n,s.middleware(e));return jr({requests:t,annotations:this.annotations})},toHandlers(e){const t=this;return up(function*(){const n=yield*Uc(),s=hi(e)?yield*e:e,i=new Map;for(const[a,u]of Object.entries(s)){const f=t.requests.get(a);i.set(f.key,{tag:f._tag,handler:u,context:n})}return ys(i)})},prefix(e){const t=new Map;for(const n of this.requests.values()){const s=n.prefix(e);t.set(s._tag,s)}return jr({requests:t,annotations:this.annotations})},toLayer(e){return ap(this.toHandlers(e))},of:_e,toLayerHandler(e,t){const n=this;return ap(up(function*(){const s=yield*Uc(),i=hi(t)?yield*t:t,a=new Map,u=n.requests.get(e);return a.set(u.key,{handler:i,context:s}),ys(a)}))},accessHandler(e){return hb(t=>{const n=this.requests.get(e),{handler:s,context:i}=t.mapUnsafe.get(n.key);return at((a,u)=>{u.rpc=n;const f=s(a,u),d=rD(f)?f.value:f;return hi(d)?BL(d,i):zA(d,i)})})},annotate(e,t){return jr({requests:this.requests,annotations:Is(this.annotations,e,t)})},annotateRpcs(e,t){return this.annotateRpcsMerge(wi(e,t))},annotateMerge(e){return jr({requests:this.requests,annotations:ki(this.annotations,e)})},annotateRpcsMerge(e){const t=new Map;for(const[n,s]of this.requests)t.set(n,s.annotateMerge(ki(e,s.annotations)));return jr({requests:t,annotations:this.annotations})}},jr=e=>Object.assign(function(){},s4,{requests:e.requests,annotations:e.annotations}),o4=(...e)=>jr({requests:new Map(e.map(t=>[t._tag,t])),annotations:er()}),i4="/ws",Fn={getConfig:"tokmon.getConfig",setConfig:"tokmon.setConfig",refresh:"tokmon.refresh",browseFs:"tokmon.browseFs",snapshot:"tokmon.snapshot",config:"tokmon.config"},a4=Ss(["all","summary","table","billing","peak"]),Mp=Ss(Da),l4=Pt({id:gt,providerId:Mp,name:gt,homeDir:gt,color:Qc(gt)}),F_=()=>i_,u4=Pt({interval:Jc,billingInterval:Jc,clearScreen:wp,timezone:kp(gt),accounts:dg(gi(l4)),activeAccountId:kp(gt),disabledProviders:dg(gi(Mp)),onboarded:wp,dashboardLayout:Ss(["grid","single"]),defaultFocus:Ss(["all","last"]),ascii:Ss(["auto","on","off"]),knownProviders:dg(gi(Mp))}),w0=F_(),c4=Pt({name:gt,path:gt,dir:wp}),f4=Pt({path:gt,parent:kp(gt),entries:gi(c4)}),d4=F_(),k0=Pt({}),h4=Ti(Fn.getConfig,{payload:k0,success:w0}),g4=Ti(Fn.setConfig,{payload:u4,success:w0}),p4=Ti(Fn.refresh,{payload:Pt({scope:a4}),success:Yc}),m4=Ti(Fn.browseFs,{payload:Pt({path:gt}),success:f4}),y4=Ti(Fn.snapshot,{payload:k0,success:d4,stream:!0}),x4=Ti(Fn.config,{payload:k0,success:w0,stream:!0}),v4=o4(h4,g4,p4,m4,y4,x4);class oc extends Un()("tokmon/client/DaemonRpcClient/TokmonRpcClient"){}const S4=new Function("specifier","return import(specifier)");function w4(e,t){const n=typeof window>"u"?void 0:window.location.origin,s=new URL(e,n);if(s.protocol==="http:"?s.protocol="ws:":s.protocol==="https:"&&(s.protocol="wss:"),s.protocol!=="ws:"&&s.protocol!=="wss:")throw new Error(`unsupported daemon RPC protocol: ${s.protocol}`);return s.pathname=i4,t&&s.searchParams.set("wsToken",t),s.toString()}function k4(e){return e==="node"?!0:e==="browser"?!1:typeof window>"u"}async function C4(e,t){return k4(t)?(await S4("@effect/platform-node/NodeSocket")).layerWebSocket(e):wD(e).pipe(lp(xD))}function b4(e){const t=e.reconnectBaseDelayMs??250,n=ab(ll(t),1.5).pipe(ib(Vm(ll(2500))));return typeof e.reconnectAttempts=="number"?n.pipe(yL(SL(e.reconnectAttempts))):n}function _4(e,t={}){const n=w4(e,t.wsToken),s=new Set;let i=null,a=null,u=!1;const f=(v,w)=>{var k;(k=t.onConn)==null||k.call(t,v,w)},d=v=>{const w=v??i;(v===void 0||v===i)&&(i=null),a=null,w&&w.runtime.dispose().catch(()=>{})},h=async()=>{const v=await C4(n,t.transport),w=Dm(Np,Np.of({onConnect:Ln(()=>{f("live")}),onDisconnect:Ln(()=>{u||(f("reconnecting"),d())})}));return ip(zf,e4({retryPolicy:b4(t)})).pipe(lp(rb(v,GD,w)))},m=async()=>{if(u)throw new Error("daemon RPC client is closed");return i||a||(f("connecting"),a=(async()=>{let v;try{const w=await h(),k=ip(oc,XD(v4)).pipe(lp(w));if(v=YA(k),await v.runPromise(oc.asEffect()),u)throw await v.dispose(),new Error("daemon RPC client is closed");return i={runtime:v},i}catch(w){throw a=null,await(v==null?void 0:v.dispose().catch(()=>{})),u||f("error",w),w}})(),a)},p=async v=>{const w=await m();try{return await w.runtime.runPromise(oc.use(k=>v(k)))}catch(k){throw u||(d(w),f("error",k)),k}},x=(v,w)=>{if(u)return()=>{};let k=null,b=!1,_=null;const R=()=>{if(!k)return;const T=k;k=null,s.delete(T),((i==null?void 0:i.runtime.runPromise(Fa(T)))??Ba(Fa(T))).catch(()=>{})},j=()=>{var T;u||b||_||(_=setTimeout(()=>{_=null,E()},t.reconnectBaseDelayMs??250),(T=_.unref)==null||T.call(_))},E=()=>{(async()=>{try{const T=await m();if(u||b)return;k=T.runtime.runFork(oc.use($=>v($).pipe(UA(L=>Ln(()=>{try{w(L)}catch{}})))).pipe(dl($=>Ln(()=>{!u&&!b&&(d(T),f("error",YC($)),j())})))),s.add(k),k.addObserver(()=>{k&&s.delete(k)})}catch(T){!u&&!b&&(d(),f("error",T),j())}})()};return E(),()=>{b=!0,_&&(clearTimeout(_),_=null),R()}};return{getConfig:()=>p(v=>v[Fn.getConfig]({})),setConfig:v=>p(w=>w[Fn.setConfig](v)),refresh:(v="all")=>p(w=>w[Fn.refresh]({scope:v})),browseFs:v=>p(w=>w[Fn.browseFs]({path:v})),subscribeSnapshot:v=>x(w=>w[Fn.snapshot]({}),v),subscribeConfig:v=>x(w=>w[Fn.config]({}),v),async close(){if(u)return;u=!0,f("closed");const v=[...s];s.clear();const w=i??await(a==null?void 0:a.catch(()=>null))??null;await Promise.all(v.map(k=>((w==null?void 0:w.runtime.runPromise(Fa(k)))??Ba(Fa(k))).catch(()=>{}))),i=null,a=null,w&&await w.runtime.dispose().catch(()=>{})}}}let Sg=null;const Tp=new Set;function R4(e){if(e!=="closed")for(const t of Tp)t(e)}function Ll(){return Sg||(Sg=_4(window.location.origin,{transport:"browser",onConn:R4})),Sg}function E4(e){return Tp.add(e),()=>{Tp.delete(e)}}async function P4(){return tm(await Ll().getConfig())}async function I4(e){return tm(await Ll().setConfig(e))}async function j4(e){return Ll().browseFs(e)}function N4(e){return Ll().subscribeConfig(t=>{e(tm(t))})}const st="focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent",Lw='button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])';function L_(e,{active:t,onEscape:n,initialFocusRef:s}){V.useEffect(()=>{var d,h;if(!t)return;const i=document.activeElement,a=e.current,u=a==null?void 0:a.querySelector(Lw);(h=(d=(s==null?void 0:s.current)??u??a)==null?void 0:d.focus)==null||h.call(d);const f=m=>{if(m.key==="Escape"){m.stopPropagation(),n();return}if(m.key!=="Tab"||!e.current)return;const p=e.current.querySelectorAll(Lw),x=Array.from(p).filter(k=>k.offsetParent!==null||k===document.activeElement);if(x.length===0)return;const v=x[0],w=x[x.length-1];m.shiftKey&&document.activeElement===v?(m.preventDefault(),w.focus()):!m.shiftKey&&document.activeElement===w&&(m.preventDefault(),v.focus())};return document.addEventListener("keydown",f),()=>{var m;document.removeEventListener("keydown",f),(m=i==null?void 0:i.focus)==null||m.call(i)}},[t])}function Ow(e,t={}){return{mode:"add",editingId:null,providerId:t.providerId??sl[0],name:t.name??"",homeDir:t.homeDir??"~",color:t.color??uN(e.accounts)}}function M4(e){return{mode:"edit",editingId:e.id,providerId:e.providerId,name:e.name,homeDir:e.homeDir,color:e.color||oo[e.providerId].color}}function T4(e,t){const n=e.mode==="edit"?t.filter(s=>s.id!==e.editingId):t;return e.mode==="edit"?e.editingId??"":xk(e.name.trim()||"account",n)}function $4(e,t){const n=e.name.trim(),s=e.homeDir.trim()||"~";return n?e.mode==="add"?{ok:!0,account:{id:xk(n,t),providerId:e.providerId,name:n,homeDir:s,color:e.color},mode:"add",editingId:null}:{ok:!0,account:{id:e.editingId,providerId:e.providerId,name:n,homeDir:s,color:e.color},mode:"edit",editingId:e.editingId}:{ok:!1,error:"Name required"}}function C0({title:e,right:t,children:n}){return y.jsxs("section",{className:"mb-6 last:mb-0",children:[y.jsxs("div",{className:"mb-2.5 flex items-center gap-2 border-b border-line pb-1.5",children:[y.jsx("h3",{className:"font-display text-[11px] uppercase tracking-wider text-fg-dim",children:e}),t&&y.jsx("div",{className:"ml-auto",children:t})]}),n]})}function Qs({label:e,hint:t,children:n}){return y.jsxs("div",{className:"flex items-center gap-3 py-1.5",children:[y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsx("div",{className:"text-sm text-fg",children:e}),t&&y.jsx("div",{className:"text-[11px] text-fg-faint",children:t})]}),y.jsx("div",{className:"shrink-0",children:n})]})}function ic({label:e,hint:t,children:n}){return y.jsxs("div",{children:[y.jsx("div",{className:"mb-1.5 text-xs font-medium text-fg",children:e}),n,t&&y.jsx("div",{className:"mt-1 text-[11px] text-fg-faint",children:t})]})}function Aw({value:e,min:t,unit:n,onChange:s}){const i=d=>s(Math.max(t,Math.round(d))),[a,u]=V.useState(null),f=()=>{if(a===null)return;const d=Number(a);i(Number.isFinite(d)&&a.trim()!==""?d:t),u(null)};return y.jsxs("div",{className:"flex items-center overflow-hidden rounded border border-line",children:[y.jsx("button",{type:"button","aria-label":"decrease",onClick:()=>i(e-1),className:`px-2 py-1 text-xs text-fg-dim transition hover:bg-bg-3 hover:text-fg ${st}`,children:"−"}),y.jsx("input",{type:"number",inputMode:"numeric",min:t,value:a??e,onChange:d=>{const h=d.target.value;u(h);const m=Number(h);h.trim()!==""&&Number.isFinite(m)&&m>=t&&i(m)},onBlur:f,"aria-label":`value (${n})`,className:`tnum w-12 border-x border-line bg-bg-2 px-1 py-1 text-center text-xs text-fg ${st} [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none`}),y.jsx("span",{className:"px-1.5 text-[10px] text-fg-faint",children:n}),y.jsx("button",{type:"button","aria-label":"increase",onClick:()=>i(e+1),className:`px-2 py-1 text-xs text-fg-dim transition hover:bg-bg-3 hover:text-fg ${st}`,children:"+"})]})}function Ia({label:e,onClick:t,disabled:n,danger:s,children:i}){return y.jsx("button",{type:"button","aria-label":e,title:e,disabled:n,onClick:t,className:`rounded p-1 text-fg-faint transition disabled:opacity-30 ${st} ${s?"hover:bg-warning/15 hover:text-warning":"hover:bg-bg-3 hover:text-fg"} disabled:hover:bg-transparent disabled:hover:text-fg-faint`,children:i})}function F4({draft:e,patch:t}){return y.jsxs(C0,{title:"General",children:[y.jsx(Qs,{label:"Refresh interval",hint:"dashboard poll, seconds",children:y.jsx(Aw,{value:e.interval,min:1,unit:"s",onChange:n=>t(s=>({...s,interval:n}))})}),y.jsx(Qs,{label:"Billing poll",hint:"billing refresh, minutes",children:y.jsx(Aw,{value:e.billingInterval,min:1,unit:"m",onChange:n=>t(s=>({...s,billingInterval:n}))})}),y.jsx(Qs,{label:"Clear screen",hint:"redraw on each refresh",children:y.jsx(Sn,{size:"xs",ariaLabel:"clear screen",options:[{value:"on",label:"on"},{value:"off",label:"off"}],value:e.clearScreen?"on":"off",onChange:n=>t(s=>({...s,clearScreen:n==="on"}))})}),y.jsx(Qs,{label:"Timezone",hint:"IANA name · empty = System",children:y.jsx(L4,{value:e.timezone,onChange:n=>t(s=>({...s,timezone:n}))})}),y.jsx(Qs,{label:"Dashboard",hint:"grid shows all · single cycles",children:y.jsx(Sn,{size:"xs",ariaLabel:"dashboard layout",options:[{value:"grid",label:"grid"},{value:"single",label:"single"}],value:e.dashboardLayout,onChange:n=>t(s=>({...s,dashboardLayout:n}))})}),y.jsx(Qs,{label:"Default focus",hint:"on open",children:y.jsx(Sn,{size:"xs",ariaLabel:"default focus",options:[{value:"all",label:"all"},{value:"last",label:"last"}],value:e.defaultFocus,onChange:n=>t(s=>({...s,defaultFocus:n}))})}),y.jsx(Qs,{label:"ASCII mode",hint:"glyph fallback",children:y.jsx(Sn,{size:"xs",ariaLabel:"ascii mode",options:[{value:"auto",label:"auto"},{value:"on",label:"on"},{value:"off",label:"off"}],value:e.ascii,onChange:n=>t(s=>({...s,ascii:n}))})})]})}function L4({value:e,onChange:t}){const[n,s]=V.useState(e??""),[i,a]=V.useState(!1);V.useEffect(()=>{s(e??""),a(!1)},[e]);const u=f=>{const d=nm(f);s(d);const h=d.trim();if(!h){a(!1),t(null);return}yk(h)?(a(!1),t(h)):a(!0)};return y.jsxs("div",{className:"flex flex-col items-end gap-0.5",children:[y.jsx("input",{type:"text",value:n,placeholder:"System",spellCheck:!1,"aria-invalid":i,onChange:f=>u(f.target.value),className:`w-44 rounded border bg-bg-2 px-2 py-1 text-xs text-fg ${st} ${i?"border-warning":"border-line"}`}),i&&y.jsx("span",{className:"text-[10px] text-warning",children:"invalid timezone"})]})}function O4({draft:e,patch:t}){const n=(s,i)=>t(a=>({...a,knownProviders:a.knownProviders.includes(s)?a.knownProviders:[...a.knownProviders,s],disabledProviders:i?a.disabledProviders.filter(u=>u!==s):Array.from(new Set([...a.disabledProviders,s]))}));return y.jsx(C0,{title:"Providers",children:y.jsx("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-2",children:sl.map(s=>{const i=!e.disabledProviders.includes(s),a=oo[s];return y.jsxs("button",{type:"button",role:"switch","aria-checked":i,onClick:()=>n(s,!i),className:`flex items-center gap-2.5 rounded border px-3 py-2 text-left text-xs transition ${st} ${i?"border-line-2 bg-bg-2 text-fg":"border-line bg-bg-1 text-fg-faint hover:border-line-2"}`,children:[y.jsx("span",{className:"inline-flex size-4 shrink-0 items-center justify-center rounded-sm border",style:{borderColor:i?so(a.color):"var(--color-line-2)",background:i?so(a.color):"transparent"},children:i&&y.jsx(yi,{className:"size-3 text-bg-0"})}),y.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{background:so(a.color)},"aria-hidden":!0}),y.jsx("span",{className:`font-medium ${i?"text-fg":"text-fg-faint"}`,children:a.name}),y.jsx("span",{className:"ml-auto text-[10px] uppercase tracking-wide text-fg-faint",children:i?"tracking":"off"})]},s)})})})}function A4(e,t){return t?t.accounts.find(n=>n.id===e.id)??null:null}function D4({draft:e,patch:t,snapshot:n,onEdit:s,onConfigure:i,onAdd:a}){const u=aN(e,void 0,(n==null?void 0:n.accounts)??void 0),f=m=>t(p=>({...p,activeAccountId:m})),d=m=>t(p=>({...p,accounts:p.accounts.filter(x=>x.id!==m),activeAccountId:p.activeAccountId===m?null:p.activeAccountId})),h=(m,p)=>t(x=>{const v=[...x.accounts],w=m+p;return w<0||w>=v.length?x:([v[m],v[w]]=[v[w],v[m]],{...x,accounts:v})});return y.jsx(C0,{title:"Accounts",right:y.jsxs("button",{type:"button",onClick:a,className:`flex items-center gap-1 rounded border border-accent/60 bg-bg-1 px-2 py-1 text-[11px] text-accent transition hover:bg-bg-2 ${st}`,children:[y.jsx(Qj,{className:"size-3"})," Add account"]}),children:u.length===0?y.jsx("p",{className:"rounded border border-line bg-bg-2/50 px-3 py-3 text-xs text-fg-faint",children:"None configured — enabled providers track automatically."}):y.jsx("ul",{className:"flex flex-col gap-1.5",role:"radiogroup","aria-label":"Active account",children:u.map(m=>{var R;const p=oo[m.providerId],x=A4(m,n),v=(x==null?void 0:x.email)||(x==null?void 0:x.displayName)||m.name||p.name,w=(x==null?void 0:x.plan)??((R=x==null?void 0:x.billing)==null?void 0:R.plan)??null,k=so(m.color||p.color),b=m.id===e.activeAccountId,_=m.source==="configured";return y.jsxs("li",{className:"flex items-center gap-2.5 rounded border border-line bg-bg-2/60 px-2.5 py-2",children:[y.jsx("button",{type:"button",role:"radio","aria-checked":b,"aria-label":`Set ${m.name} active`,title:b?"Active account (click to clear)":"Set active",onClick:()=>f(b?null:m.id),className:`relative inline-flex size-4 shrink-0 items-center justify-center rounded-full border transition ${st}`,style:{borderColor:k},children:b&&y.jsx("span",{className:"size-2 rounded-full",style:{background:k}})}),y.jsx("span",{className:"size-2.5 shrink-0 rounded-full",style:{background:k},"aria-hidden":!0}),y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"truncate text-sm text-fg-bright",children:v}),y.jsx("span",{className:"shrink-0 rounded bg-bg-3 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-fg-dim",children:p.name}),w&&y.jsx("span",{className:"shrink-0 rounded border border-line px-1.5 py-0.5 text-[10px] text-fg-dim",children:w}),y.jsx("span",{className:"shrink-0 rounded border border-line px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-fg-faint",children:m.source==="auto"?"auto":"configured"})]}),y.jsx("div",{className:"truncate font-mono text-[11px] text-fg-faint",children:m.homeDir})]}),y.jsx("div",{className:"flex shrink-0 items-center gap-0.5",children:_&&m.explicitIndex!==void 0?y.jsxs(y.Fragment,{children:[y.jsx(Ia,{label:"Move up",disabled:m.explicitIndex===0,onClick:()=>h(m.explicitIndex,-1),children:y.jsx(nk,{className:"size-3.5"})}),y.jsx(Ia,{label:"Move down",disabled:m.explicitIndex===e.accounts.length-1,onClick:()=>h(m.explicitIndex,1),children:y.jsx(Yp,{className:"size-3.5"})}),y.jsx(Ia,{label:"Edit account",onClick:()=>s(m),children:y.jsx(nS,{className:"size-3.5"})}),y.jsx(Ia,{label:"Delete account",danger:!0,onClick:()=>d(m.id),children:y.jsx(Jj,{className:"size-3.5"})})]}):y.jsx(Ia,{label:"Configure account",onClick:()=>i(m),children:y.jsx(nS,{className:"size-3.5"})})})]},`${m.source}:${m.id}`)})})})}function z4(e){const t=(e??"").trim();return t.length>0?t:"~"}function wg(e){const t=(e??"").trim();return t.length>0?t:"~"}function U4(e){const t=[];e.parent!==null&&t.push({kind:"parent",key:"..",label:"..",path:e.parent});for(const n of[...e.entries].filter(s=>s.dir).sort((s,i)=>s.name.localeCompare(i.name)))t.push({kind:"entry",key:n.path,label:n.name,path:n.path});return t}function V4({editor:e,accounts:t,onChange:n,onCancel:s,onSubmit:i}){const a=V.useRef(null),u=V.useRef(null),[f,d]=V.useState(null),h=so(e.color);L_(a,{active:!0,onEscape:s,initialFocusRef:u});const m=T4(e,t),p=()=>{const x=$4(e,t);if(!x.ok){d(x.error);return}i(x.account,x.mode,x.editingId)};return y.jsx("div",{className:"dialog-fade fixed inset-0 z-[70] flex items-start justify-center overflow-y-auto bg-bg-0/60 p-4 backdrop-blur-sm",onMouseDown:x=>{x.target===x.currentTarget&&s()},role:"dialog","aria-modal":"true","aria-label":e.mode==="add"?"New account":"Edit account",children:y.jsxs("div",{ref:a,tabIndex:-1,className:"dialog-pop my-8 w-full max-w-[460px] overflow-hidden rounded-md border-l-2 border border-line-2 bg-bg-1 focus:outline-none",style:{borderLeftColor:h},children:[y.jsxs("div",{className:"flex items-center gap-2 border-b border-line px-4 py-3",children:[y.jsx("span",{className:"size-2.5 rounded-full",style:{background:h},"aria-hidden":!0}),y.jsx("span",{className:"font-display text-xs uppercase tracking-wider text-fg-bright",children:e.mode==="add"?"New account":"Edit account"})]}),y.jsxs("div",{className:"flex flex-col gap-4 px-4 py-4",children:[y.jsx(ic,{label:"Provider",hint:"which tool this account tracks",children:y.jsx("div",{className:"flex flex-wrap gap-1.5",children:sl.map(x=>{const v=x===e.providerId,w=oo[x];return y.jsxs("button",{type:"button",onClick:()=>n({...e,providerId:x}),"aria-pressed":v,className:`flex items-center gap-1.5 rounded border px-2 py-1 text-xs transition ${st} ${v?"border-line-2 bg-bg-3 text-fg-bright":"border-line text-fg-dim hover:text-fg"}`,children:[y.jsx("span",{className:"size-2 rounded-full",style:{background:so(w.color)},"aria-hidden":!0}),w.name]},x)})})}),y.jsx(ic,{label:"Name",hint:"display name for this account",children:y.jsx("input",{ref:u,type:"text",value:e.name,placeholder:"e.g. Work, Personal",spellCheck:!1,onChange:x=>{d(null),n({...e,name:nm(x.target.value)})},onKeyDown:x=>{x.key==="Enter"&&p()},className:`w-full rounded border border-line bg-bg-2 px-2.5 py-1.5 text-sm text-fg ${st}`})}),y.jsx(ic,{label:"Home directory",hint:"path containing the tool's data dir · ~ for default",children:y.jsx(B4,{value:e.homeDir,onChange:x=>n({...e,homeDir:x}),onEnter:p})}),y.jsx(ic,{label:"Accent color",hint:"shows on dashboard, account strip, borders",children:y.jsx("div",{className:"flex flex-wrap gap-1.5",children:iN.map(x=>{const v=x===e.color;return y.jsx("button",{type:"button","aria-label":x,"aria-pressed":v,title:x,onClick:()=>n({...e,color:x}),className:`size-6 rounded-full border-2 transition ${st} ${v?"scale-110":"border-transparent hover:scale-105"}`,style:{background:so(x),borderColor:v?"var(--color-fg-bright)":"transparent"}},x)})})}),y.jsxs("div",{className:"flex items-center gap-2 rounded border border-line bg-bg-2/50 px-2.5 py-1.5 text-xs",children:[y.jsx("span",{className:"text-fg-faint",children:"id"}),y.jsx("span",{className:"font-mono text-fg",style:{color:h},children:m||"account"}),y.jsx("span",{className:"ml-auto text-[10px] text-fg-faint",children:e.mode==="add"?"auto-generated from name":"fixed"})]}),f&&y.jsx("p",{className:"text-xs text-warning",children:f})]}),y.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-line px-4 py-3",children:[y.jsx("button",{type:"button",onClick:s,className:`rounded border border-line bg-bg-1 px-3 py-1.5 text-xs text-fg-dim transition hover:border-line-2 hover:text-fg ${st}`,children:"cancel"}),y.jsxs("button",{type:"button",onClick:p,className:`flex items-center gap-1.5 rounded border border-accent/60 bg-bg-1 px-3 py-1.5 text-xs text-accent transition hover:bg-bg-2 active:scale-[0.97] ${st}`,children:[y.jsx(yi,{className:"size-3.5"})," ",e.mode==="add"?"Add account":"Save account"]})]})]})})}function B4({value:e,onChange:t,onEnter:n}){const[s,i]=V.useState(!1),[a,u]=V.useState(null),[f,d]=V.useState("~"),[h,m]=V.useState(!1),[p,x]=V.useState(null),v=V.useRef(0),w=V.useCallback(async $=>{const L=++v.current,U=z4($);d(U),m(!0),x(null);try{const z=await j4(U);if(L!==v.current)return;u(z)}catch(z){if(L!==v.current)return;u(null),x(z instanceof Error?z.message:"cannot read folder")}finally{L===v.current&&m(!1)}},[]);V.useEffect(()=>()=>{v.current++},[]);const k=()=>{i(!0),w(e)},b=()=>{v.current++,i(!1),m(!1),x(null)},_=$=>{h||w($)},R=()=>{!a||h||(t(wg(a.path)),b())},j=a?U4(a):[],E=j.filter($=>$.kind==="entry"),T=wg((a==null?void 0:a.path)??f);return y.jsxs("div",{className:"relative",children:[y.jsxs("div",{className:"flex overflow-hidden rounded border border-line bg-bg-2",children:[y.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 px-2.5",children:[y.jsx(Xh,{className:"size-4 shrink-0 text-fg-faint"}),y.jsx("input",{type:"text",value:e,placeholder:"~",spellCheck:!1,onChange:$=>{b(),t(nm($.target.value))},onKeyDown:$=>{$.key==="Enter"&&n()},className:`min-w-0 flex-1 bg-transparent py-1.5 font-mono text-sm text-fg ${st}`})]}),y.jsxs("button",{type:"button",onClick:k,disabled:h,className:`flex shrink-0 items-center gap-1 border-l border-line bg-bg-1 px-2.5 py-1.5 text-xs text-fg-dim transition hover:bg-bg-3 hover:text-fg disabled:opacity-50 ${st}`,children:[y.jsx(Yp,{className:"size-3.5"})," Browse"]})]}),s&&y.jsxs("div",{className:"mt-2 overflow-hidden rounded border border-line-2 bg-bg-1 shadow-[0_18px_60px_rgba(0,0,0,0.35)]",children:[y.jsxs("div",{className:"flex items-center gap-2 border-b border-line bg-bg-2 px-2.5 py-2",children:[y.jsx(Xh,{className:"size-4 shrink-0 text-accent"}),y.jsx("div",{className:"min-w-0 flex-1 truncate font-mono text-xs text-fg-bright",title:T,children:T}),h&&y.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-wide text-fg-faint",children:"loading"}),y.jsx("button",{type:"button",onClick:b,"aria-label":"Close folder picker",className:`rounded p-1 text-fg-faint transition hover:text-fg ${st}`,children:y.jsx(xi,{className:"size-3.5"})})]}),p?y.jsxs("div",{className:"px-2.5 py-3",children:[y.jsxs("div",{className:"text-xs text-warning",children:["can't read ",wg(f)]}),y.jsx("button",{type:"button",onClick:()=>{h||w(f)},disabled:h,className:`mt-2 rounded border border-line bg-bg-2 px-2 py-1 text-[11px] text-fg-dim transition hover:border-line-2 hover:text-fg disabled:opacity-50 ${st}`,children:"retry"})]}):y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"max-h-56 overflow-y-auto py-1",children:[j.map($=>y.jsxs("button",{type:"button",onClick:()=>_($.path),disabled:h,className:`flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-xs transition hover:bg-bg-3 hover:text-fg disabled:opacity-50 ${st} ${$.kind==="parent"?"text-fg-dim":"text-fg"}`,children:[$.kind==="parent"?y.jsx(nk,{className:"size-3.5 shrink-0"}):y.jsx(Xh,{className:"size-3.5 shrink-0 text-fg-faint"}),y.jsx("span",{className:"min-w-0 truncate font-mono",children:$.label})]},$.key)),!h&&E.length===0&&y.jsx("div",{className:"px-2.5 py-3 text-xs text-fg-faint",children:"no subdirectories"}),h&&!a&&y.jsx("div",{className:"px-2.5 py-3 text-xs text-fg-faint",children:"loading folders..."})]}),y.jsx("div",{className:"flex items-center justify-end gap-2 border-t border-line px-2.5 py-2",children:y.jsxs("button",{type:"button",onClick:R,disabled:!a||h,className:`flex items-center gap-1.5 rounded border border-accent/60 bg-bg-1 px-2.5 py-1.5 text-xs text-accent transition hover:bg-bg-2 active:scale-[0.97] disabled:opacity-50 ${st}`,children:[y.jsx(yi,{className:"size-3.5"})," Select this folder"]})})]})]})]})}const q4=[{value:"general",label:"General"},{value:"providers",label:"Providers"},{value:"accounts",label:"Accounts"}];function H4({onClose:e,snapshot:t}){const n=V.useRef(null),[s,i]=V.useState(null),[a,u]=V.useState(null),[f,d]=V.useState(!1),[h,m]=V.useState(null),[p,x]=V.useState(!1),[v,w]=V.useState(null),[k,b]=V.useState("general");V.useEffect(()=>{let j=!0;return P4().then(E=>{j&&i(E)}).catch(E=>{j&&u(E instanceof Error?E.message:"load failed")}),()=>{j=!1}},[]),V.useEffect(()=>{if(!p)return N4(j=>{p||i(j)})},[p]),L_(n,{active:!v,onEscape:e}),V.useEffect(()=>{const j=n.current;j&&(v?j.setAttribute("inert",""):j.removeAttribute("inert"))},[v]);const _=j=>{x(!0),m(null),i(E=>E&&j(E))},R=async()=>{if(s){d(!0),m(null);try{const j=await I4(s);i(j),x(!1),e()}catch(j){m(j instanceof Error?j.message:"save failed")}finally{d(!1)}}};return y.jsxs("div",{className:"dialog-fade fixed inset-0 z-[60] flex items-start justify-center overflow-y-auto bg-bg-0/70 p-4 backdrop-blur-sm",onMouseDown:j=>{j.target===j.currentTarget&&!v&&e()},role:"dialog","aria-modal":"true","aria-label":"Settings",children:[y.jsxs("div",{ref:n,tabIndex:-1,className:"dialog-pop relative my-6 flex w-full max-w-[720px] flex-col overflow-hidden rounded-md border border-line-2 bg-bg-1 focus:outline-none",children:[y.jsx("div",{className:"pointer-events-none absolute left-3 top-2 font-display text-[11px] uppercase tracking-wider text-fg-dim",children:"settings"}),y.jsx("button",{type:"button",onClick:e,"aria-label":"Close",className:`absolute right-2 top-2 z-10 rounded p-1 text-fg-faint transition hover:text-fg ${st}`,children:y.jsx(xi,{className:"size-4"})}),y.jsx("div",{className:"max-h-[78vh] overflow-y-auto px-5 pb-4 pt-9",children:a?y.jsx("div",{className:"rounded border border-warning/50 bg-bg-2 p-4 text-sm text-warning",children:a}):s?y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"mb-4 flex items-center justify-between gap-3 border-b border-line pb-3",children:y.jsx(Sn,{size:"xs",ariaLabel:"settings section",options:q4,value:k,onChange:b,containerClassName:"flex items-center overflow-hidden rounded border border-line bg-bg-1",btnClassName:"px-3 py-1.5 text-[11px] transition"})}),k==="general"&&y.jsx(F4,{draft:s,patch:_}),k==="providers"&&y.jsx(O4,{draft:s,patch:_}),k==="accounts"&&y.jsx(D4,{draft:s,patch:_,snapshot:t,onEdit:j=>w(M4(j)),onConfigure:j=>w(Ow(s,{providerId:j.providerId,name:j.name,homeDir:j.homeDir,color:j.color})),onAdd:()=>w(Ow(s))})]}):y.jsx("div",{className:"py-10 text-center text-sm text-fg-dim",children:"loading config…"})}),y.jsxs("div",{className:"flex items-center justify-end gap-3 border-t border-line px-5 py-3",children:[h&&y.jsx("span",{className:"mr-auto text-xs text-warning",children:h}),p&&!h&&y.jsx("span",{className:"mr-auto text-xs text-fg-faint",children:"unsaved changes"}),y.jsx("button",{type:"button",onClick:e,className:`rounded border border-line bg-bg-1 px-3 py-1.5 text-xs text-fg-dim transition hover:border-line-2 hover:text-fg ${st}`,children:"cancel"}),y.jsxs("button",{type:"button",onClick:R,disabled:!s||f||!p,className:`flex items-center gap-1.5 rounded border border-accent/60 bg-bg-1 px-3 py-1.5 text-xs text-accent transition hover:bg-bg-2 active:scale-[0.97] disabled:opacity-50 ${st}`,children:[y.jsx(yi,{className:"size-3.5"})," ",f?"saving…":"save"]})]})]}),v&&s&&y.jsx(V4,{editor:v,accounts:s.accounts,onChange:w,onCancel:()=>w(null),onSubmit:(j,E,T)=>{_($=>E==="add"?{...$,accounts:[...$.accounts,j]}:{...$,accounts:$.accounts.map(L=>L.id===T?j:L)}),w(null)}})]})}const W4="modulepreload",G4=function(e,t){return new URL(e,t).href},Dw={},O_=function(t,n,s){let i=Promise.resolve();if(n&&n.length>0){let u=function(m){return Promise.all(m.map(p=>Promise.resolve(p).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};const f=document.getElementsByTagName("link"),d=document.querySelector("meta[property=csp-nonce]"),h=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));i=u(n.map(m=>{if(m=G4(m,s),m in Dw)return;Dw[m]=!0;const p=m.endsWith(".css"),x=p?'[rel="stylesheet"]':"";if(!!s)for(let k=f.length-1;k>=0;k--){const b=f[k];if(b.href===m&&(!p||b.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${m}"]${x}`))return;const w=document.createElement("link");if(w.rel=p?"stylesheet":W4,p||(w.as="script"),w.crossOrigin="",w.href=m,h&&w.setAttribute("nonce",h),document.head.appendChild(w),p)return new Promise((k,b)=>{w.addEventListener("load",k),w.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${m}`)))})}))}function a(u){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=u,window.dispatchEvent(f),!f.defaultPrevented)throw u}return i.then(u=>{for(const f of u||[])f.status==="rejected"&&a(f.reason);return t().catch(a)})};function Uf({title:e,titleTag:t,right:n,captureName:s,children:i,className:a="",bodyClassName:u=""}){const f=V.useRef(null);return y.jsxs("section",{ref:f,className:`group relative rounded-md border border-line bg-bg-1/80 transition-colors hover:border-line-2 ${a}`,children:[e&&y.jsxs("div",{className:"pointer-events-none absolute -top-[7px] left-3 flex items-center gap-2 bg-bg-1 px-1.5",children:[y.jsx("span",{className:"font-display text-[11px] uppercase tracking-wider text-fg-dim",children:e}),t!=null&&y.jsx("span",{className:"text-[10px] normal-case tracking-normal text-fg-faint",children:t})]}),n&&y.jsx("div",{"data-chrome":!0,className:"absolute right-2 top-2 z-20 flex items-center gap-1.5 rounded bg-bg-1 px-0.5",children:n}),s&&y.jsx("div",{"data-chrome":!0,className:"absolute -top-[11px] right-3 z-20",children:y.jsx(K4,{getNode:()=>f.current,name:s})}),y.jsx("div",{className:`p-4 ${u}`,children:i})]})}function K4({getNode:e,name:t}){const n=mk();return y.jsx("button",{type:"button",title:"Share this panel","aria-label":"Share this panel as an image",onClick:()=>{const s=e();s&&n({kind:"panel",node:s,captureName:t})},className:"rounded border border-transparent bg-bg-1 p-1 text-fg-faint opacity-0 transition hover:border-line hover:text-accent group-hover:opacity-100 focus-visible:opacity-100",children:y.jsx(Uj,{className:"size-3.5"})})}function Q4({derived:e,periodLabel:t}){const n=e.totals,s=e.timeline.map(u=>u.total).slice(-30),i=e.timeline.map(u=>u.tokens).slice(-30),a=e.cacheSavingsSeries.map(u=>u.value).slice(-30);return y.jsxs("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(150px,1fr))] gap-3",children:[y.jsx(ja,{label:`spend · ${t}`,value:Ue(n.cost),accent:"text-cost",spark:s,sparkColor:"var(--color-cost)"}),y.jsx(ja,{label:"tokens",value:wn(n.tokens),spark:i,sparkColor:"var(--color-fg-dim)"}),y.jsx(ja,{label:"cache saved",value:Ue(n.cacheSavings),accent:"text-positive",spark:a,sparkColor:"var(--color-positive)"}),y.jsx(ja,{label:"calls",value:bs(n.calls)}),y.jsx(ja,{label:"burn · today",value:`${Ue(e.burnRate)}/hr`,accent:"text-warning"})]})}function ja({label:e,value:t,accent:n="text-fg-bright",spark:s,sparkColor:i}){return y.jsxs("div",{className:"rise flex min-w-0 flex-col rounded-md border border-line bg-bg-1/80 p-3.5 transition-colors hover:border-line-2",children:[y.jsx("div",{className:"font-display text-[10px] uppercase tracking-wide text-fg-faint",children:e}),y.jsx("div",{className:`tnum mt-1.5 text-xl sm:text-2xl ${n}`,children:t}),s&&s.length>1&&y.jsx("div",{className:"mt-auto overflow-hidden pt-2 text-right",children:y.jsx(rl,{data:s,color:i??"currentColor",className:"text-sm opacity-70"})})]})}function J4({accounts:e,nameOf:t}){return e.length===0?y.jsx(Uf,{title:"accounts",children:y.jsx("div",{className:"py-6 text-center text-xs text-fg-faint",children:"no accounts match the current filter"})}):y.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-[repeat(auto-fit,minmax(min(340px,100%),1fr))]",children:e.map((n,s)=>y.jsx(Y4,{account:n,index:s,providerName:t(n.providerId)},n.id))})}function Y4({account:e,index:t,providerName:n}){var h,m,p,x,v,w;const s=e.dashboard,i=((h=e.billing)==null?void 0:h.metrics)??[],a=((m=e.billing)==null?void 0:m.modelSpend)??[],u=(p=e.billing)==null?void 0:p.activity,f=bj(e.providerId),d=e.name&&e.name!==n;return y.jsxs("div",{className:"rise group relative overflow-hidden rounded-md border bg-bg-1/50 p-4 transition-colors",style:{animationDelay:`${t*40}ms`,borderColor:`color-mix(in oklab, ${f} 50%, var(--color-line))`},children:[y.jsxs("div",{className:"flex items-center justify-between gap-2",children:[y.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[y.jsx("span",{style:{color:f},children:"●"}),y.jsx("span",{className:"font-display text-sm tracking-wide text-fg-bright",children:n}),d&&y.jsxs("span",{className:"truncate text-xs text-fg-faint",children:["· ",e.name]})]}),((x=e.billing)==null?void 0:x.plan)&&y.jsx("span",{className:"shrink-0 rounded border border-line px-1.5 py-0.5 text-[10px] text-fg-dim",children:e.billing.plan})]}),s&&y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"mt-4 grid grid-cols-3 gap-2",children:[y.jsx(kg,{label:"today",cost:s.today.cost,tokens:s.today.tokens}),y.jsx(kg,{label:"week",cost:s.week.cost,tokens:s.week.tokens}),y.jsx(kg,{label:"month",cost:s.month.cost,tokens:s.month.tokens})]}),y.jsxs("div",{className:"mt-3 flex items-center justify-between border-t border-line-faint pt-3 text-xs",children:[y.jsxs("span",{className:"text-fg-dim",children:["burn ",y.jsxs("span",{className:"tnum text-warning",children:[Ue(s.burnRate),"/hr"]})]}),y.jsxs("span",{className:"text-fg-dim",children:["saved ",y.jsx("span",{className:"tnum text-positive",children:Ue(s.month.cacheSavings)})]})]})]}),i.length>0&&y.jsx("div",{className:`flex flex-col gap-2 ${s?"mt-3 border-t border-line-faint pt-3":"mt-4"}`,children:i.slice(0,8).map(k=>y.jsx(Z4,{metric:k},k.label))}),a.length>0&&y.jsxs("div",{className:"mt-3 flex flex-col gap-1 border-t border-line-faint pt-3",children:[y.jsx("div",{className:"text-[10px] uppercase tracking-wide text-fg-faint",children:"spend by model"}),a.slice(0,4).map(k=>y.jsxs("div",{className:"flex items-center justify-between gap-2 text-[11px]",children:[y.jsx("span",{className:"min-w-0 truncate text-fg-dim",children:Or(k.name)}),y.jsxs("span",{className:"tnum shrink-0 text-cost",children:[Ue(k.usd),y.jsxs("span",{className:"ml-1.5 text-fg-faint",children:[bs(k.requests)," req"]})]})]},k.name))]}),s&&s.series.length>0&&y.jsxs("div",{className:"mt-3 flex items-center gap-2 border-t border-line-faint pt-3",children:[y.jsx(rl,{data:s.series,color:f,className:"text-sm"}),y.jsxs("span",{className:"ml-auto text-[10px] text-fg-faint",children:[s.series.length,"d"]})]}),!s&&u&&u.series.length>0&&y.jsxs("div",{className:"mt-3 flex items-center gap-2 border-t border-line-faint pt-3",children:[y.jsx(rl,{data:u.series,color:f,className:"text-sm"}),y.jsx("span",{className:"ml-auto text-[10px] text-fg-faint",children:u.summary})]}),i.length===0&&((v=e.billing)==null?void 0:v.error)&&y.jsxs("div",{className:`flex items-start gap-1.5 text-xs text-warning ${s?"mt-3 border-t border-line-faint pt-3":"mt-4"}`,children:[y.jsx("span",{"aria-hidden":!0,children:"⚠"}),y.jsx("span",{children:e.billing.error})]}),!s&&i.length===0&&!((w=e.billing)!=null&&w.error)&&a.length===0&&!(u&&u.series.length)&&y.jsx("div",{className:"py-6 text-center text-xs text-fg-faint",children:e.hasUsage?"no usage data":"billing-only · no live metrics"})]})}function kg({label:e,cost:t,tokens:n}){const s=t>0||n===0;return y.jsxs("div",{children:[y.jsx("div",{className:"text-[10px] uppercase text-fg-faint",children:e}),y.jsx("div",{className:`tnum text-sm ${s?"text-cost":"text-fg-bright"}`,children:s?Ue(t):wn(n)}),y.jsx("div",{className:"tnum text-[10px] text-fg-faint",children:s?wn(n):Ue(t)})]})}function X4(e){return e.format.kind==="dollars"?Ue(e.used):e.format.kind==="count"?`${bs(e.used)}${e.format.suffix?" "+e.format.suffix:""}`:`${Math.round(e.used)}%`}function Z4({metric:e}){const t=e.format.kind==="percent"?Math.min(1,Math.max(0,e.used/100)):e.limit!=null&&e.limit>0?Math.min(1,Math.max(0,e.used/e.limit)):null,n=t==null?"var(--color-accent)":t>=.9?"var(--color-warning)":t>=.7?"var(--color-cost)":"var(--color-positive)";return y.jsxs("div",{children:[y.jsxs("div",{className:"flex items-center justify-between text-[11px]",children:[y.jsx("span",{className:"truncate text-fg-dim",children:e.label}),y.jsxs("span",{className:"tnum text-fg",children:[X4(e),e.format.kind!=="percent"&&e.limit!=null&&y.jsxs("span",{className:"text-fg-faint",children:[" / ",e.format.kind==="dollars"?Ue(e.limit):bs(e.limit)]}),e.resetsAt&&y.jsxs("span",{className:"ml-1.5 text-fg-faint",children:["· ",e.resetsAt]})]})]}),t!=null&&y.jsx("div",{className:"mt-1 h-1.5 w-full overflow-hidden rounded-full bg-bg-3",role:"progressbar","aria-label":e.label,"aria-valuenow":Math.round(t*100),"aria-valuemin":0,"aria-valuemax":100,children:y.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${t*100}%`,background:n}})})]})}const ez=[0,.32,.55,.78,1],zw=e=>e===0?"var(--color-bg-2)":`color-mix(in oklab, var(--color-cost) ${ez[e]*100}%, var(--color-bg-2))`,A_=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];function tz(e,t){const n=e,s=n.filter(m=>t(m)>0);if(s.length===0)return null;const i=n.reduce((m,p)=>m+t(p),0),a=s.reduce((m,p)=>t(p)>t(m)?p:m),u=new Array(7).fill(0);for(const m of n)u[nl($r(m.date))]+=t(m);const f=u.indexOf(Math.max(...u)),d=new Set(s.map(m=>m.date));let h=0;for(let m=$r(s[s.length-1].date);d.has(vl(m));m-=ds)h++;return{active:s.length,total:i,top:a,avg:i/s.length,busiest:f,streak:h,costed:e.some(m=>m.cost>0)}}function nz(e,t,n){const s=new Map(e.map(k=>[k.date,n(k)]));if(e.length===0)return null;const i=e[e.length-1].date,a=e[0].date;let u=$r(i),f=$r(a);(u-f)/(ds*7)>t&&(f=u-t*7*ds),f-=nl(f)*ds;const d=Math.max(...e.map(n),0),h=k=>{if(k<=0||d<=0)return 0;const b=k/d;return b>.66?4:b>.4?3:b>.15?2:1},m=[];let p=new Array(7).fill(null);const x=[];let v=-1,w=0;for(let k=f;k<=u;k+=ds){const b=vl(k),_=nl(k);_===0&&p.some(Boolean)&&(m.push(p),p=new Array(7).fill(null),w++);const R=new Date(k).getUTCMonth();R!==v&&_===0&&(x.push({col:w,text:Rj[R]}),v=R);const j=k>=$r(a);p[_]=j?{date:b,cost:s.get(b)??0,level:h(s.get(b)??0)}:null}return p.some(Boolean)&&m.push(p),{weeks:m,monthLabels:x}}function rz({derived:e,maxWeeks:t=26,periodLabel:n}){const[s,i]=V.useState(null),[a,u]=V.useState(null),f=s??a,d=V.useMemo(()=>new Map(e.calendar.map(k=>[k.date,k])),[e.calendar]),h=V.useMemo(()=>e.calendar.some(k=>k.cost>0),[e.calendar]),m=k=>h?k.cost:k.tokens,p=V.useMemo(()=>tz(e.calendar,m),[e,h]),x=V.useMemo(()=>nz(e.calendar,t,m),[e,t]),v=x?`repeat(${x.weeks.length}, minmax(0,1fr))`:void 0,w=x?x.weeks.length*25:void 0;return y.jsx(y.Fragment,{children:y.jsx(Uf,{title:"daily spend",titleTag:n,captureName:"calendar",children:!x||!p?y.jsx("div",{className:"py-6 text-center text-xs text-fg-faint",children:"no usage yet"}):y.jsxs("div",{className:"grid gap-x-8 gap-y-5 pt-1 md:grid-cols-[minmax(0,1fr)_210px] md:items-start",children:[y.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[y.jsx("div",{className:"pl-6",children:y.jsx("div",{className:"grid gap-[3px] text-[9px] text-fg-faint",style:{gridTemplateColumns:v,maxWidth:w},children:x.weeks.map((k,b)=>{const _=x.monthLabels.find(R=>R.col===b);return y.jsx("div",{className:"truncate",children:(_==null?void 0:_.text)??""},b)})})}),y.jsxs("div",{className:"flex gap-[3px]",children:[y.jsx("div",{className:"flex w-5 shrink-0 flex-col gap-[3px] text-[9px] text-fg-faint",children:["M","","W","","F","",""].map((k,b)=>y.jsx("div",{className:"flex flex-1 items-center",children:k},b))}),y.jsx("div",{className:"grid min-w-0 flex-1 gap-[3px]",style:{gridTemplateColumns:v,maxWidth:w},onMouseLeave:()=>i(null),children:x.weeks.map((k,b)=>y.jsx("div",{className:"flex flex-col gap-[3px]",children:k.map((_,R)=>_===null?y.jsx("div",{className:"aspect-square"},R):y.jsx("button",{type:"button","aria-label":`${el(_.date)} — click to pin`,"aria-pressed":(a==null?void 0:a.date)===_.date,className:`aspect-square block rounded-[3px] p-0 transition duration-150 hover:scale-[1.18] hover:ring-1 hover:ring-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent ${(a==null?void 0:a.date)===_.date?"ring-1 ring-fg-bright":""}`,style:{background:zw(_.level)},onMouseEnter:()=>i(d.get(_.date)??null),onFocus:()=>i(d.get(_.date)??null),onClick:()=>u(j=>(j==null?void 0:j.date)===_.date?null:d.get(_.date)??null)},R))},b))})]}),y.jsxs("div",{className:"flex items-center gap-1.5 pl-6 pt-1 text-[9px] text-fg-faint",children:["less",[0,1,2,3,4].map(k=>y.jsx("span",{className:"size-[11px] rounded-[2px]",style:{background:zw(k)}},k)),"more"]})]}),y.jsxs("div",{className:"relative border-line-faint md:border-l md:pl-6",children:[y.jsxs("div",{className:`grid grid-cols-2 gap-x-6 gap-y-4 transition-opacity duration-200 md:grid-cols-1 ${f?"opacity-0":"opacity-100"}`,children:[y.jsx(Zu,{label:"busiest day",value:p.costed?Ue(p.top.cost):wn(p.top.tokens),sub:el(p.top.date),valueClass:"text-cost"}),y.jsx(Zu,{label:"daily average",value:p.costed?Ue(p.avg):wn(p.avg),sub:`across ${p.active} active days`}),y.jsx(Zu,{label:"top weekday",value:A_[p.busiest],valueClass:"text-fg-bright"}),y.jsx(Zu,{label:"latest streak",value:`${p.streak}d`,sub:p.streak>0?"in a row":"idle today",valueClass:"text-positive"})]}),f&&y.jsx("div",{className:"dialog-fade absolute inset-0 md:pl-6",children:y.jsx(sz,{day:f,pinned:!s&&f===a})})]})]})})})}function sz({day:e,pinned:t=!1}){return y.jsxs("div",{className:"font-mono text-[11px]",children:[y.jsxs("div",{className:"flex items-baseline justify-between gap-3 border-b border-line-faint pb-2",children:[y.jsxs("span",{className:"text-fg-dim",children:[A_[nl($r(e.date))]," · ",el(e.date),t&&y.jsx("span",{className:"ml-1.5 text-[9px] uppercase tracking-wide text-accent",children:"pinned"})]}),y.jsx("span",{className:"tnum text-cost",children:e.cost>0?Ue(e.cost):"—"})]}),e.cost>0?y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"grid grid-cols-3 gap-2 py-2 text-[10px]",children:[y.jsxs("div",{children:[y.jsx("div",{className:"text-fg-faint",children:"calls"}),y.jsx("div",{className:"tnum text-fg",children:bs(e.calls)})]}),y.jsxs("div",{children:[y.jsx("div",{className:"text-fg-faint",children:"tokens"}),y.jsx("div",{className:"tnum text-fg",children:wn(e.tokens)})]}),y.jsxs("div",{children:[y.jsx("div",{className:"text-fg-faint",children:"saved"}),y.jsx("div",{className:"tnum text-positive",children:Ue(e.cacheSavings)})]})]}),y.jsxs("div",{className:"flex flex-col gap-1 border-t border-line-faint pt-2",children:[e.models.slice(0,5).map(n=>y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"size-1.5 shrink-0 rounded-full",style:{background:Qp(n.name)}}),y.jsx("span",{className:"min-w-0 flex-1 truncate text-fg-dim",children:Or(n.name)}),y.jsx("span",{className:"tnum w-16 shrink-0 text-right text-fg",children:Ue(n.cost)})]},n.name)),e.models.length>5&&y.jsxs("div",{className:"pt-0.5 text-fg-faint",children:["+",e.models.length-5," more"]})]})]}):y.jsx("div",{className:"pt-2 text-fg-faint",children:"no spend this day"})]})}const oz=[{value:"cost",label:"cost"},{value:"tokens",label:"tokens"},{value:"calls",label:"calls"}],Uw="1.75rem minmax(6rem,12rem) minmax(3.5rem,1fr) 3rem 5.5rem 5rem auto auto auto";function iz({derived:e,limit:t,periodLabel:n}){const[s,i]=V.useState(e.totals.cost>0?"cost":"tokens"),a=[...e.byModel].sort((m,p)=>p[s]-m[s]),u=t?a.slice(0,t):a,f=s==="tokens"?"tokenShare":s==="calls"?"callShare":"share",d=s==="tokens"?"block":"hidden md:block",h=s==="calls"?"block":"hidden lg:block";return y.jsx(Uf,{title:"model leaderboard",titleTag:n,captureName:"models",right:y.jsx(Sn,{options:oz,value:s,onChange:i,size:"xs",ariaLabel:"sort models by",containerClassName:"flex items-center gap-0.5",btnClassName:"rounded px-1.5 py-0.5 text-[11px] transition"}),children:u.length===0?y.jsx(Y2,{children:"no models in period"}):y.jsxs("div",{className:"mt-6 flex flex-col overflow-x-auto",children:[y.jsxs("div",{className:"grid items-center gap-x-3 border-b border-line px-2 pb-1.5 font-display text-[10px] uppercase tracking-wide text-fg-faint",style:{gridTemplateColumns:Uw},children:[y.jsx("span",{}),y.jsx("span",{}),y.jsx("span",{children:"share"}),y.jsx("span",{className:"text-right",children:"%"}),y.jsx("span",{className:"text-right text-cost/70",children:"cost"}),y.jsx("span",{className:"text-right",children:"trend"}),y.jsx("span",{className:"hidden text-right lg:block",children:"$/call"}),y.jsx("span",{className:`text-right ${d}`,children:"tokens"}),y.jsx("span",{className:`text-right ${h}`,children:"calls"})]}),u.map((m,p)=>y.jsxs("div",{className:"grid items-center gap-x-3 rounded border-b border-line-faint px-2 py-2 transition-colors last:border-0 hover:bg-bg-2/40",style:{gridTemplateColumns:Uw},children:[y.jsxs("span",{className:`tnum text-xs ${p===0?"font-medium text-accent":p<3?"text-fg-dim":"text-fg-faint"}`,children:["#",p+1]}),y.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[y.jsx("span",{className:"size-2 shrink-0 rounded-[2px]",style:{background:m.color}}),y.jsx("span",{className:"truncate text-fg",title:m.model,children:Or(m.model)})]}),y.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-bg-3",children:y.jsx("div",{className:"h-full rounded-full",style:{width:`${Math.min(100,m[f]*100)}%`,minWidth:m[f]>0?"2px":0,background:m.color}})}),y.jsx("span",{className:"tnum text-right text-[11px] text-fg-dim",children:Y1(m[f],m[f]>0&&m[f]<.01?1:0)}),y.jsx("span",{className:"tnum text-right text-xs text-cost",children:Ue(m.cost)}),y.jsx("span",{className:"overflow-hidden text-right",children:y.jsx(rl,{data:m.trend.slice(-30),color:m.color,className:"text-sm"})}),y.jsx("span",{className:"tnum hidden text-right text-xs text-fg-dim lg:block",children:Ue(m.calls?m.cost/m.calls:0)}),y.jsx("span",{className:`tnum text-right text-xs text-fg-dim ${d}`,children:m.tokens>0?wn(m.tokens):y.jsx("span",{className:"text-fg-faint",children:"—"})}),y.jsx("span",{className:`tnum text-right text-xs text-fg-faint ${h}`,children:bs(m.calls)})]},m.model))]})})}/**
|
|
85
|
-
* table-core
|
|
86
|
-
*
|
|
87
|
-
* Copyright (c) TanStack
|
|
88
|
-
*
|
|
89
|
-
* This source code is licensed under the MIT license found in the
|
|
90
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
91
|
-
*
|
|
92
|
-
* @license MIT
|
|
93
|
-
*/function az(){return{accessor:(e,t)=>typeof e=="function"?{...t,accessorFn:e}:{...t,accessorKey:e},display:e=>e,group:e=>e}}function gs(e,t){return typeof e=="function"?e(t):e}function Rn(e,t){return n=>{t.setState(s=>({...s,[e]:gs(n,s[e])}))}}function Vf(e){return e instanceof Function}function lz(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function uz(e,t){const n=[],s=i=>{i.forEach(a=>{n.push(a);const u=t(a);u!=null&&u.length&&s(u)})};return s(e),n}function Se(e,t,n){let s=[],i;return a=>{let u;n.key&&n.debug&&(u=Date.now());const f=e(a);if(!(f.length!==s.length||f.some((m,p)=>s[p]!==m)))return i;s=f;let h;if(n.key&&n.debug&&(h=Date.now()),i=t(...f),n==null||n.onChange==null||n.onChange(i),n.key&&n.debug&&n!=null&&n.debug()){const m=Math.round((Date.now()-u)*100)/100,p=Math.round((Date.now()-h)*100)/100,x=p/16,v=(w,k)=>{for(w=String(w);w.length<k;)w=" "+w;return w};console.info(`%c⏱ ${v(p,5)} /${v(m,5)} ms`,`
|
|
94
|
-
font-size: .6rem;
|
|
95
|
-
font-weight: bold;
|
|
96
|
-
color: hsl(${Math.max(0,Math.min(120-120*x,120))}deg 100% 31%);`,n==null?void 0:n.key)}return i}}function we(e,t,n,s){return{debug:()=>{var i;return(i=e==null?void 0:e.debugAll)!=null?i:e[t]},key:!1,onChange:s}}function cz(e,t,n,s){const i=()=>{var u;return(u=a.getValue())!=null?u:e.options.renderFallbackValue},a={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(s),renderValue:i,getContext:Se(()=>[e,n,t,a],(u,f,d,h)=>({table:u,column:f,row:d,cell:h,getValue:h.getValue,renderValue:h.renderValue}),we(e.options,"debugCells"))};return e._features.forEach(u=>{u.createCell==null||u.createCell(a,n,t,e)},{}),a}function fz(e,t,n,s){var i,a;const f={...e._getDefaultColumnDef(),...t},d=f.accessorKey;let h=(i=(a=f.id)!=null?a:d?typeof String.prototype.replaceAll=="function"?d.replaceAll(".","_"):d.replace(/\./g,"_"):void 0)!=null?i:typeof f.header=="string"?f.header:void 0,m;if(f.accessorFn?m=f.accessorFn:d&&(d.includes(".")?m=x=>{let v=x;for(const k of d.split(".")){var w;v=(w=v)==null?void 0:w[k]}return v}:m=x=>x[f.accessorKey]),!h)throw new Error;let p={id:`${String(h)}`,accessorFn:m,parent:s,depth:n,columnDef:f,columns:[],getFlatColumns:Se(()=>[!0],()=>{var x;return[p,...(x=p.columns)==null?void 0:x.flatMap(v=>v.getFlatColumns())]},we(e.options,"debugColumns")),getLeafColumns:Se(()=>[e._getOrderColumnsFn()],x=>{var v;if((v=p.columns)!=null&&v.length){let w=p.columns.flatMap(k=>k.getLeafColumns());return x(w)}return[p]},we(e.options,"debugColumns"))};for(const x of e._features)x.createColumn==null||x.createColumn(p,e);return p}const Vt="debugHeaders";function Vw(e,t,n){var s;let a={id:(s=n.id)!=null?s:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const u=[],f=d=>{d.subHeaders&&d.subHeaders.length&&d.subHeaders.map(f),u.push(d)};return f(a),u},getContext:()=>({table:e,header:a,column:t})};return e._features.forEach(u=>{u.createHeader==null||u.createHeader(a,e)}),a}const dz={createTable:e=>{e.getHeaderGroups=Se(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,s,i)=>{var a,u;const f=(a=s==null?void 0:s.map(p=>n.find(x=>x.id===p)).filter(Boolean))!=null?a:[],d=(u=i==null?void 0:i.map(p=>n.find(x=>x.id===p)).filter(Boolean))!=null?u:[],h=n.filter(p=>!(s!=null&&s.includes(p.id))&&!(i!=null&&i.includes(p.id)));return ac(t,[...f,...h,...d],e)},we(e.options,Vt)),e.getCenterHeaderGroups=Se(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,s,i)=>(n=n.filter(a=>!(s!=null&&s.includes(a.id))&&!(i!=null&&i.includes(a.id))),ac(t,n,e,"center")),we(e.options,Vt)),e.getLeftHeaderGroups=Se(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,s)=>{var i;const a=(i=s==null?void 0:s.map(u=>n.find(f=>f.id===u)).filter(Boolean))!=null?i:[];return ac(t,a,e,"left")},we(e.options,Vt)),e.getRightHeaderGroups=Se(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,s)=>{var i;const a=(i=s==null?void 0:s.map(u=>n.find(f=>f.id===u)).filter(Boolean))!=null?i:[];return ac(t,a,e,"right")},we(e.options,Vt)),e.getFooterGroups=Se(()=>[e.getHeaderGroups()],t=>[...t].reverse(),we(e.options,Vt)),e.getLeftFooterGroups=Se(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),we(e.options,Vt)),e.getCenterFooterGroups=Se(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),we(e.options,Vt)),e.getRightFooterGroups=Se(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),we(e.options,Vt)),e.getFlatHeaders=Se(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),we(e.options,Vt)),e.getLeftFlatHeaders=Se(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),we(e.options,Vt)),e.getCenterFlatHeaders=Se(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),we(e.options,Vt)),e.getRightFlatHeaders=Se(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),we(e.options,Vt)),e.getCenterLeafHeaders=Se(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var s;return!((s=n.subHeaders)!=null&&s.length)}),we(e.options,Vt)),e.getLeftLeafHeaders=Se(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var s;return!((s=n.subHeaders)!=null&&s.length)}),we(e.options,Vt)),e.getRightLeafHeaders=Se(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var s;return!((s=n.subHeaders)!=null&&s.length)}),we(e.options,Vt)),e.getLeafHeaders=Se(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,s)=>{var i,a,u,f,d,h;return[...(i=(a=t[0])==null?void 0:a.headers)!=null?i:[],...(u=(f=n[0])==null?void 0:f.headers)!=null?u:[],...(d=(h=s[0])==null?void 0:h.headers)!=null?d:[]].map(m=>m.getLeafHeaders()).flat()},we(e.options,Vt))}};function ac(e,t,n,s){var i,a;let u=0;const f=function(x,v){v===void 0&&(v=1),u=Math.max(u,v),x.filter(w=>w.getIsVisible()).forEach(w=>{var k;(k=w.columns)!=null&&k.length&&f(w.columns,v+1)},0)};f(e);let d=[];const h=(x,v)=>{const w={depth:v,id:[s,`${v}`].filter(Boolean).join("_"),headers:[]},k=[];x.forEach(b=>{const _=[...k].reverse()[0],R=b.column.depth===w.depth;let j,E=!1;if(R&&b.column.parent?j=b.column.parent:(j=b.column,E=!0),_&&(_==null?void 0:_.column)===j)_.subHeaders.push(b);else{const T=Vw(n,j,{id:[s,v,j.id,b==null?void 0:b.id].filter(Boolean).join("_"),isPlaceholder:E,placeholderId:E?`${k.filter($=>$.column===j).length}`:void 0,depth:v,index:k.length});T.subHeaders.push(b),k.push(T)}w.headers.push(b),b.headerGroup=w}),d.push(w),v>0&&h(k,v-1)},m=t.map((x,v)=>Vw(n,x,{depth:u,index:v}));h(m,u-1),d.reverse();const p=x=>x.filter(w=>w.column.getIsVisible()).map(w=>{let k=0,b=0,_=[0];w.subHeaders&&w.subHeaders.length?(_=[],p(w.subHeaders).forEach(j=>{let{colSpan:E,rowSpan:T}=j;k+=E,_.push(T)})):k=1;const R=Math.min(..._);return b=b+R,w.colSpan=k,w.rowSpan=b,{colSpan:k,rowSpan:b}});return p((i=(a=d[0])==null?void 0:a.headers)!=null?i:[]),d}const b0=(e,t,n,s,i,a,u)=>{let f={id:t,index:s,original:n,depth:i,parentId:u,_valuesCache:{},_uniqueValuesCache:{},getValue:d=>{if(f._valuesCache.hasOwnProperty(d))return f._valuesCache[d];const h=e.getColumn(d);if(h!=null&&h.accessorFn)return f._valuesCache[d]=h.accessorFn(f.original,s),f._valuesCache[d]},getUniqueValues:d=>{if(f._uniqueValuesCache.hasOwnProperty(d))return f._uniqueValuesCache[d];const h=e.getColumn(d);if(h!=null&&h.accessorFn)return h.columnDef.getUniqueValues?(f._uniqueValuesCache[d]=h.columnDef.getUniqueValues(f.original,s),f._uniqueValuesCache[d]):(f._uniqueValuesCache[d]=[f.getValue(d)],f._uniqueValuesCache[d])},renderValue:d=>{var h;return(h=f.getValue(d))!=null?h:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>uz(f.subRows,d=>d.subRows),getParentRow:()=>f.parentId?e.getRow(f.parentId,!0):void 0,getParentRows:()=>{let d=[],h=f;for(;;){const m=h.getParentRow();if(!m)break;d.push(m),h=m}return d.reverse()},getAllCells:Se(()=>[e.getAllLeafColumns()],d=>d.map(h=>cz(e,f,h,h.id)),we(e.options,"debugRows")),_getAllCellsByColumnId:Se(()=>[f.getAllCells()],d=>d.reduce((h,m)=>(h[m.column.id]=m,h),{}),we(e.options,"debugRows"))};for(let d=0;d<e._features.length;d++){const h=e._features[d];h==null||h.createRow==null||h.createRow(f,e)}return f},hz={createColumn:(e,t)=>{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},D_=(e,t,n)=>{var s,i;const a=n==null||(s=n.toString())==null?void 0:s.toLowerCase();return!!(!((i=e.getValue(t))==null||(i=i.toString())==null||(i=i.toLowerCase())==null)&&i.includes(a))};D_.autoRemove=e=>Yn(e);const z_=(e,t,n)=>{var s;return!!(!((s=e.getValue(t))==null||(s=s.toString())==null)&&s.includes(n))};z_.autoRemove=e=>Yn(e);const U_=(e,t,n)=>{var s;return((s=e.getValue(t))==null||(s=s.toString())==null?void 0:s.toLowerCase())===(n==null?void 0:n.toLowerCase())};U_.autoRemove=e=>Yn(e);const V_=(e,t,n)=>{var s;return(s=e.getValue(t))==null?void 0:s.includes(n)};V_.autoRemove=e=>Yn(e);const B_=(e,t,n)=>!n.some(s=>{var i;return!((i=e.getValue(t))!=null&&i.includes(s))});B_.autoRemove=e=>Yn(e)||!(e!=null&&e.length);const q_=(e,t,n)=>n.some(s=>{var i;return(i=e.getValue(t))==null?void 0:i.includes(s)});q_.autoRemove=e=>Yn(e)||!(e!=null&&e.length);const H_=(e,t,n)=>e.getValue(t)===n;H_.autoRemove=e=>Yn(e);const W_=(e,t,n)=>e.getValue(t)==n;W_.autoRemove=e=>Yn(e);const _0=(e,t,n)=>{let[s,i]=n;const a=e.getValue(t);return a>=s&&a<=i};_0.resolveFilterValue=e=>{let[t,n]=e,s=typeof t!="number"?parseFloat(t):t,i=typeof n!="number"?parseFloat(n):n,a=t===null||Number.isNaN(s)?-1/0:s,u=n===null||Number.isNaN(i)?1/0:i;if(a>u){const f=a;a=u,u=f}return[a,u]};_0.autoRemove=e=>Yn(e)||Yn(e[0])&&Yn(e[1]);const Nr={includesString:D_,includesStringSensitive:z_,equalsString:U_,arrIncludes:V_,arrIncludesAll:B_,arrIncludesSome:q_,equals:H_,weakEquals:W_,inNumberRange:_0};function Yn(e){return e==null||e===""}const gz={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:Rn("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{const n=t.getCoreRowModel().flatRows[0],s=n==null?void 0:n.getValue(e.id);return typeof s=="string"?Nr.includesString:typeof s=="number"?Nr.inNumberRange:typeof s=="boolean"||s!==null&&typeof s=="object"?Nr.equals:Array.isArray(s)?Nr.arrIncludes:Nr.weakEquals},e.getFilterFn=()=>{var n,s;return Vf(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(n=(s=t.options.filterFns)==null?void 0:s[e.columnDef.filterFn])!=null?n:Nr[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,s,i;return((n=e.columnDef.enableColumnFilter)!=null?n:!0)&&((s=t.options.enableColumnFilters)!=null?s:!0)&&((i=t.options.enableFilters)!=null?i:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return(n=t.getState().columnFilters)==null||(n=n.find(s=>s.id===e.id))==null?void 0:n.value},e.getFilterIndex=()=>{var n,s;return(n=(s=t.getState().columnFilters)==null?void 0:s.findIndex(i=>i.id===e.id))!=null?n:-1},e.setFilterValue=n=>{t.setColumnFilters(s=>{const i=e.getFilterFn(),a=s==null?void 0:s.find(m=>m.id===e.id),u=gs(n,a?a.value:void 0);if(Bw(i,u,e)){var f;return(f=s==null?void 0:s.filter(m=>m.id!==e.id))!=null?f:[]}const d={id:e.id,value:u};if(a){var h;return(h=s==null?void 0:s.map(m=>m.id===e.id?d:m))!=null?h:[]}return s!=null&&s.length?[...s,d]:[d]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{const n=e.getAllLeafColumns(),s=i=>{var a;return(a=gs(t,i))==null?void 0:a.filter(u=>{const f=n.find(d=>d.id===u.id);if(f){const d=f.getFilterFn();if(Bw(d,u.value,f))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(s)},e.resetColumnFilters=t=>{var n,s;e.setColumnFilters(t?[]:(n=(s=e.initialState)==null?void 0:s.columnFilters)!=null?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function Bw(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||typeof t>"u"||typeof t=="string"&&!t}const pz=(e,t,n)=>n.reduce((s,i)=>{const a=i.getValue(e);return s+(typeof a=="number"?a:0)},0),mz=(e,t,n)=>{let s;return n.forEach(i=>{const a=i.getValue(e);a!=null&&(s>a||s===void 0&&a>=a)&&(s=a)}),s},yz=(e,t,n)=>{let s;return n.forEach(i=>{const a=i.getValue(e);a!=null&&(s<a||s===void 0&&a>=a)&&(s=a)}),s},xz=(e,t,n)=>{let s,i;return n.forEach(a=>{const u=a.getValue(e);u!=null&&(s===void 0?u>=u&&(s=i=u):(s>u&&(s=u),i<u&&(i=u)))}),[s,i]},vz=(e,t)=>{let n=0,s=0;if(t.forEach(i=>{let a=i.getValue(e);a!=null&&(a=+a)>=a&&(++n,s+=a)}),n)return s/n},Sz=(e,t)=>{if(!t.length)return;const n=t.map(a=>a.getValue(e));if(!lz(n))return;if(n.length===1)return n[0];const s=Math.floor(n.length/2),i=n.sort((a,u)=>a-u);return n.length%2!==0?i[s]:(i[s-1]+i[s])/2},wz=(e,t)=>Array.from(new Set(t.map(n=>n.getValue(e))).values()),kz=(e,t)=>new Set(t.map(n=>n.getValue(e))).size,Cz=(e,t)=>t.length,Cg={sum:pz,min:mz,max:yz,extent:xz,mean:vz,median:Sz,unique:wz,uniqueCount:kz,count:Cz},bz={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return(t=(n=e.getValue())==null||n.toString==null?void 0:n.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:Rn("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(n=>n!=null&&n.includes(e.id)?n.filter(s=>s!==e.id):[...n??[],e.id])},e.getCanGroup=()=>{var n,s;return((n=e.columnDef.enableGrouping)!=null?n:!0)&&((s=t.options.enableGrouping)!=null?s:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const n=e.getCanGroup();return()=>{n&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const n=t.getCoreRowModel().flatRows[0],s=n==null?void 0:n.getValue(e.id);if(typeof s=="number")return Cg.sum;if(Object.prototype.toString.call(s)==="[object Date]")return Cg.extent},e.getAggregationFn=()=>{var n,s;if(!e)throw new Error;return Vf(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(n=(s=t.options.aggregationFns)==null?void 0:s[e.columnDef.aggregationFn])!=null?n:Cg[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,s;e.setGrouping(t?[]:(n=(s=e.initialState)==null?void 0:s.grouping)!=null?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const s=t.getColumn(n);return s!=null&&s.columnDef.getGroupingValue?(e._groupingValuesCache[n]=s.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,s)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var i;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((i=n.subRows)!=null&&i.length)}}};function _z(e,t,n){if(!(t!=null&&t.length)||!n)return e;const s=e.filter(a=>!t.includes(a.id));return n==="remove"?s:[...t.map(a=>e.find(u=>u.id===a)).filter(Boolean),...s]}const Rz={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Rn("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=Se(n=>[Wa(t,n)],n=>n.findIndex(s=>s.id===e.id),we(t.options,"debugColumns")),e.getIsFirstColumn=n=>{var s;return((s=Wa(t,n)[0])==null?void 0:s.id)===e.id},e.getIsLastColumn=n=>{var s;const i=Wa(t,n);return((s=i[i.length-1])==null?void 0:s.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:(n=e.initialState.columnOrder)!=null?n:[])},e._getOrderColumnsFn=Se(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,n,s)=>i=>{let a=[];if(!(t!=null&&t.length))a=i;else{const u=[...t],f=[...i];for(;f.length&&u.length;){const d=u.shift(),h=f.findIndex(m=>m.id===d);h>-1&&a.push(f.splice(h,1)[0])}a=[...a,...f]}return _z(a,n,s)},we(e.options,"debugTable"))}},bg=()=>({left:[],right:[]}),Ez={getInitialState:e=>({columnPinning:bg(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Rn("columnPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{const s=e.getLeafColumns().map(i=>i.id).filter(Boolean);t.setColumnPinning(i=>{var a,u;if(n==="right"){var f,d;return{left:((f=i==null?void 0:i.left)!=null?f:[]).filter(p=>!(s!=null&&s.includes(p))),right:[...((d=i==null?void 0:i.right)!=null?d:[]).filter(p=>!(s!=null&&s.includes(p))),...s]}}if(n==="left"){var h,m;return{left:[...((h=i==null?void 0:i.left)!=null?h:[]).filter(p=>!(s!=null&&s.includes(p))),...s],right:((m=i==null?void 0:i.right)!=null?m:[]).filter(p=>!(s!=null&&s.includes(p)))}}return{left:((a=i==null?void 0:i.left)!=null?a:[]).filter(p=>!(s!=null&&s.includes(p))),right:((u=i==null?void 0:i.right)!=null?u:[]).filter(p=>!(s!=null&&s.includes(p)))}})},e.getCanPin=()=>e.getLeafColumns().some(s=>{var i,a,u;return((i=s.columnDef.enablePinning)!=null?i:!0)&&((a=(u=t.options.enableColumnPinning)!=null?u:t.options.enablePinning)!=null?a:!0)}),e.getIsPinned=()=>{const n=e.getLeafColumns().map(f=>f.id),{left:s,right:i}=t.getState().columnPinning,a=n.some(f=>s==null?void 0:s.includes(f)),u=n.some(f=>i==null?void 0:i.includes(f));return a?"left":u?"right":!1},e.getPinnedIndex=()=>{var n,s;const i=e.getIsPinned();return i?(n=(s=t.getState().columnPinning)==null||(s=s[i])==null?void 0:s.indexOf(e.id))!=null?n:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=Se(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(n,s,i)=>{const a=[...s??[],...i??[]];return n.filter(u=>!a.includes(u.column.id))},we(t.options,"debugRows")),e.getLeftVisibleCells=Se(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(n,s)=>(s??[]).map(a=>n.find(u=>u.column.id===a)).filter(Boolean).map(a=>({...a,position:"left"})),we(t.options,"debugRows")),e.getRightVisibleCells=Se(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(n,s)=>(s??[]).map(a=>n.find(u=>u.column.id===a)).filter(Boolean).map(a=>({...a,position:"right"})),we(t.options,"debugRows"))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,s;return e.setColumnPinning(t?bg():(n=(s=e.initialState)==null?void 0:s.columnPinning)!=null?n:bg())},e.getIsSomeColumnsPinned=t=>{var n;const s=e.getState().columnPinning;if(!t){var i,a;return!!((i=s.left)!=null&&i.length||(a=s.right)!=null&&a.length)}return!!((n=s[t])!=null&&n.length)},e.getLeftLeafColumns=Se(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,n)=>(n??[]).map(s=>t.find(i=>i.id===s)).filter(Boolean),we(e.options,"debugColumns")),e.getRightLeafColumns=Se(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,n)=>(n??[]).map(s=>t.find(i=>i.id===s)).filter(Boolean),we(e.options,"debugColumns")),e.getCenterLeafColumns=Se(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,s)=>{const i=[...n??[],...s??[]];return t.filter(a=>!i.includes(a.id))},we(e.options,"debugColumns"))}};function Pz(e){return e||(typeof document<"u"?document:null)}const lc={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},_g=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Iz={getDefaultColumnDef:()=>lc,getInitialState:e=>({columnSizing:{},columnSizingInfo:_g(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Rn("columnSizing",e),onColumnSizingInfoChange:Rn("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,s,i;const a=t.getState().columnSizing[e.id];return Math.min(Math.max((n=e.columnDef.minSize)!=null?n:lc.minSize,(s=a??e.columnDef.size)!=null?s:lc.size),(i=e.columnDef.maxSize)!=null?i:lc.maxSize)},e.getStart=Se(n=>[n,Wa(t,n),t.getState().columnSizing],(n,s)=>s.slice(0,e.getIndex(n)).reduce((i,a)=>i+a.getSize(),0),we(t.options,"debugColumns")),e.getAfter=Se(n=>[n,Wa(t,n),t.getState().columnSizing],(n,s)=>s.slice(e.getIndex(n)+1).reduce((i,a)=>i+a.getSize(),0),we(t.options,"debugColumns")),e.resetSize=()=>{t.setColumnSizing(n=>{let{[e.id]:s,...i}=n;return i})},e.getCanResize=()=>{var n,s;return((n=e.columnDef.enableResizing)!=null?n:!0)&&((s=t.options.enableColumnResizing)!=null?s:!0)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let n=0;const s=i=>{if(i.subHeaders.length)i.subHeaders.forEach(s);else{var a;n+=(a=i.column.getSize())!=null?a:0}};return s(e),n},e.getStart=()=>{if(e.index>0){const n=e.headerGroup.headers[e.index-1];return n.getStart()+n.getSize()}return 0},e.getResizeHandler=n=>{const s=t.getColumn(e.column.id),i=s==null?void 0:s.getCanResize();return a=>{if(!s||!i||(a.persist==null||a.persist(),Rg(a)&&a.touches&&a.touches.length>1))return;const u=e.getSize(),f=e?e.getLeafHeaders().map(_=>[_.column.id,_.column.getSize()]):[[s.id,s.getSize()]],d=Rg(a)?Math.round(a.touches[0].clientX):a.clientX,h={},m=(_,R)=>{typeof R=="number"&&(t.setColumnSizingInfo(j=>{var E,T;const $=t.options.columnResizeDirection==="rtl"?-1:1,L=(R-((E=j==null?void 0:j.startOffset)!=null?E:0))*$,U=Math.max(L/((T=j==null?void 0:j.startSize)!=null?T:0),-.999999);return j.columnSizingStart.forEach(z=>{let[Z,te]=z;h[Z]=Math.round(Math.max(te+te*U,0)*100)/100}),{...j,deltaOffset:L,deltaPercentage:U}}),(t.options.columnResizeMode==="onChange"||_==="end")&&t.setColumnSizing(j=>({...j,...h})))},p=_=>m("move",_),x=_=>{m("end",_),t.setColumnSizingInfo(R=>({...R,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},v=Pz(n),w={moveHandler:_=>p(_.clientX),upHandler:_=>{v==null||v.removeEventListener("mousemove",w.moveHandler),v==null||v.removeEventListener("mouseup",w.upHandler),x(_.clientX)}},k={moveHandler:_=>(_.cancelable&&(_.preventDefault(),_.stopPropagation()),p(_.touches[0].clientX),!1),upHandler:_=>{var R;v==null||v.removeEventListener("touchmove",k.moveHandler),v==null||v.removeEventListener("touchend",k.upHandler),_.cancelable&&(_.preventDefault(),_.stopPropagation()),x((R=_.touches[0])==null?void 0:R.clientX)}},b=jz()?{passive:!1}:!1;Rg(a)?(v==null||v.addEventListener("touchmove",k.moveHandler,b),v==null||v.addEventListener("touchend",k.upHandler,b)):(v==null||v.addEventListener("mousemove",w.moveHandler,b),v==null||v.addEventListener("mouseup",w.upHandler,b)),t.setColumnSizingInfo(_=>({..._,startOffset:d,startSize:u,deltaOffset:0,deltaPercentage:0,columnSizingStart:f,isResizingColumn:s.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:(n=e.initialState.columnSizing)!=null?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?_g():(n=e.initialState.columnSizingInfo)!=null?n:_g())},e.getTotalSize=()=>{var t,n;return(t=(n=e.getHeaderGroups()[0])==null?void 0:n.headers.reduce((s,i)=>s+i.getSize(),0))!=null?t:0},e.getLeftTotalSize=()=>{var t,n;return(t=(n=e.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((s,i)=>s+i.getSize(),0))!=null?t:0},e.getCenterTotalSize=()=>{var t,n;return(t=(n=e.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((s,i)=>s+i.getSize(),0))!=null?t:0},e.getRightTotalSize=()=>{var t,n;return(t=(n=e.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((s,i)=>s+i.getSize(),0))!=null?t:0}}};let uc=null;function jz(){if(typeof uc=="boolean")return uc;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch{e=!1}return uc=e,uc}function Rg(e){return e.type==="touchstart"}const Nz={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Rn("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(s=>({...s,[e.id]:n??!e.getIsVisible()}))},e.getIsVisible=()=>{var n,s;const i=e.columns;return(n=i.length?i.some(a=>a.getIsVisible()):(s=t.getState().columnVisibility)==null?void 0:s[e.id])!=null?n:!0},e.getCanHide=()=>{var n,s;return((n=e.columnDef.enableHiding)!=null?n:!0)&&((s=t.options.enableHiding)!=null?s:!0)},e.getToggleVisibilityHandler=()=>n=>{e.toggleVisibility==null||e.toggleVisibility(n.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=Se(()=>[e.getAllCells(),t.getState().columnVisibility],n=>n.filter(s=>s.column.getIsVisible()),we(t.options,"debugRows")),e.getVisibleCells=Se(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(n,s,i)=>[...n,...s,...i],we(t.options,"debugRows"))},createTable:e=>{const t=(n,s)=>Se(()=>[s(),s().filter(i=>i.getIsVisible()).map(i=>i.id).join("_")],i=>i.filter(a=>a.getIsVisible==null?void 0:a.getIsVisible()),we(e.options,"debugColumns"));e.getVisibleFlatColumns=t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=n=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(n),e.resetColumnVisibility=n=>{var s;e.setColumnVisibility(n?{}:(s=e.initialState.columnVisibility)!=null?s:{})},e.toggleAllColumnsVisible=n=>{var s;n=(s=n)!=null?s:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((i,a)=>({...i,[a.id]:n||!(a.getCanHide!=null&&a.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(n=>!(n.getIsVisible!=null&&n.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(n=>n.getIsVisible==null?void 0:n.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>n=>{var s;e.toggleAllColumnsVisible((s=n.target)==null?void 0:s.checked)}}};function Wa(e,t){return t?t==="center"?e.getCenterVisibleLeafColumns():t==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const Mz={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},Tz={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:Rn("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;const s=(n=e.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[t.id])==null?void 0:n.getValue();return typeof s=="string"||typeof s=="number"}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var n,s,i,a;return((n=e.columnDef.enableGlobalFilter)!=null?n:!0)&&((s=t.options.enableGlobalFilter)!=null?s:!0)&&((i=t.options.enableFilters)!=null?i:!0)&&((a=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?a:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>Nr.includesString,e.getGlobalFilterFn=()=>{var t,n;const{globalFilterFn:s}=e.options;return Vf(s)?s:s==="auto"?e.getGlobalAutoFilterFn():(t=(n=e.options.filterFns)==null?void 0:n[s])!=null?t:Nr[s]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},$z={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Rn("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var s,i;if(!t){e._queue(()=>{t=!0});return}if((s=(i=e.options.autoResetAll)!=null?i:e.options.autoResetExpanded)!=null?s:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=s=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(s),e.toggleAllRowsExpanded=s=>{s??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=s=>{var i,a;e.setExpanded(s?{}:(i=(a=e.initialState)==null?void 0:a.expanded)!=null?i:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(s=>s.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>s=>{s.persist==null||s.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const s=e.getState().expanded;return s===!0||Object.values(s).some(Boolean)},e.getIsAllRowsExpanded=()=>{const s=e.getState().expanded;return typeof s=="boolean"?s===!0:!(!Object.keys(s).length||e.getRowModel().flatRows.some(i=>!i.getIsExpanded()))},e.getExpandedDepth=()=>{let s=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(a=>{const u=a.split(".");s=Math.max(s,u.length)}),s},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(s=>{var i;const a=s===!0?!0:!!(s!=null&&s[e.id]);let u={};if(s===!0?Object.keys(t.getRowModel().rowsById).forEach(f=>{u[f]=!0}):u=s,n=(i=n)!=null?i:!a,!a&&n)return{...u,[e.id]:!0};if(a&&!n){const{[e.id]:f,...d}=u;return d}return s})},e.getIsExpanded=()=>{var n;const s=t.getState().expanded;return!!((n=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?n:s===!0||s!=null&&s[e.id])},e.getCanExpand=()=>{var n,s,i;return(n=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?n:((s=t.options.enableExpanding)!=null?s:!0)&&!!((i=e.subRows)!=null&&i.length)},e.getIsAllParentsExpanded=()=>{let n=!0,s=e;for(;n&&s.parentId;)s=t.getRow(s.parentId,!0),n=s.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{const n=e.getCanExpand();return()=>{n&&e.toggleExpanded()}}}},$p=0,Fp=10,Eg=()=>({pageIndex:$p,pageSize:Fp}),Fz={getInitialState:e=>({...e,pagination:{...Eg(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:Rn("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var s,i;if(!t){e._queue(()=>{t=!0});return}if((s=(i=e.options.autoResetAll)!=null?i:e.options.autoResetPageIndex)!=null?s:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=s=>{const i=a=>gs(s,a);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(i)},e.resetPagination=s=>{var i;e.setPagination(s?Eg():(i=e.initialState.pagination)!=null?i:Eg())},e.setPageIndex=s=>{e.setPagination(i=>{let a=gs(s,i.pageIndex);const u=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return a=Math.max(0,Math.min(a,u)),{...i,pageIndex:a}})},e.resetPageIndex=s=>{var i,a;e.setPageIndex(s?$p:(i=(a=e.initialState)==null||(a=a.pagination)==null?void 0:a.pageIndex)!=null?i:$p)},e.resetPageSize=s=>{var i,a;e.setPageSize(s?Fp:(i=(a=e.initialState)==null||(a=a.pagination)==null?void 0:a.pageSize)!=null?i:Fp)},e.setPageSize=s=>{e.setPagination(i=>{const a=Math.max(1,gs(s,i.pageSize)),u=i.pageSize*i.pageIndex,f=Math.floor(u/a);return{...i,pageIndex:f,pageSize:a}})},e.setPageCount=s=>e.setPagination(i=>{var a;let u=gs(s,(a=e.options.pageCount)!=null?a:-1);return typeof u=="number"&&(u=Math.max(-1,u)),{...i,pageCount:u}}),e.getPageOptions=Se(()=>[e.getPageCount()],s=>{let i=[];return s&&s>0&&(i=[...new Array(s)].fill(null).map((a,u)=>u)),i},we(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:s}=e.getState().pagination,i=e.getPageCount();return i===-1?!0:i===0?!1:s<i-1},e.previousPage=()=>e.setPageIndex(s=>s-1),e.nextPage=()=>e.setPageIndex(s=>s+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var s;return(s=e.options.pageCount)!=null?s:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var s;return(s=e.options.rowCount)!=null?s:e.getPrePaginationRowModel().rows.length}}},Pg=()=>({top:[],bottom:[]}),Lz={getInitialState:e=>({rowPinning:Pg(),...e}),getDefaultOptions:e=>({onRowPinningChange:Rn("rowPinning",e)}),createRow:(e,t)=>{e.pin=(n,s,i)=>{const a=s?e.getLeafRows().map(d=>{let{id:h}=d;return h}):[],u=i?e.getParentRows().map(d=>{let{id:h}=d;return h}):[],f=new Set([...u,e.id,...a]);t.setRowPinning(d=>{var h,m;if(n==="bottom"){var p,x;return{top:((p=d==null?void 0:d.top)!=null?p:[]).filter(k=>!(f!=null&&f.has(k))),bottom:[...((x=d==null?void 0:d.bottom)!=null?x:[]).filter(k=>!(f!=null&&f.has(k))),...Array.from(f)]}}if(n==="top"){var v,w;return{top:[...((v=d==null?void 0:d.top)!=null?v:[]).filter(k=>!(f!=null&&f.has(k))),...Array.from(f)],bottom:((w=d==null?void 0:d.bottom)!=null?w:[]).filter(k=>!(f!=null&&f.has(k)))}}return{top:((h=d==null?void 0:d.top)!=null?h:[]).filter(k=>!(f!=null&&f.has(k))),bottom:((m=d==null?void 0:d.bottom)!=null?m:[]).filter(k=>!(f!=null&&f.has(k)))}})},e.getCanPin=()=>{var n;const{enableRowPinning:s,enablePinning:i}=t.options;return typeof s=="function"?s(e):(n=s??i)!=null?n:!0},e.getIsPinned=()=>{const n=[e.id],{top:s,bottom:i}=t.getState().rowPinning,a=n.some(f=>s==null?void 0:s.includes(f)),u=n.some(f=>i==null?void 0:i.includes(f));return a?"top":u?"bottom":!1},e.getPinnedIndex=()=>{var n,s;const i=e.getIsPinned();if(!i)return-1;const a=(n=i==="top"?t.getTopRows():t.getBottomRows())==null?void 0:n.map(u=>{let{id:f}=u;return f});return(s=a==null?void 0:a.indexOf(e.id))!=null?s:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,s;return e.setRowPinning(t?Pg():(n=(s=e.initialState)==null?void 0:s.rowPinning)!=null?n:Pg())},e.getIsSomeRowsPinned=t=>{var n;const s=e.getState().rowPinning;if(!t){var i,a;return!!((i=s.top)!=null&&i.length||(a=s.bottom)!=null&&a.length)}return!!((n=s[t])!=null&&n.length)},e._getPinnedRows=(t,n,s)=>{var i;return((i=e.options.keepPinnedRows)==null||i?(n??[]).map(u=>{const f=e.getRow(u,!0);return f.getIsAllParentsExpanded()?f:null}):(n??[]).map(u=>t.find(f=>f.id===u))).filter(Boolean).map(u=>({...u,position:s}))},e.getTopRows=Se(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,"top"),we(e.options,"debugRows")),e.getBottomRows=Se(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,"bottom"),we(e.options,"debugRows")),e.getCenterRows=Se(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(t,n,s)=>{const i=new Set([...n??[],...s??[]]);return t.filter(a=>!i.has(a.id))},we(e.options,"debugRows"))}},Oz={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Rn("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:(n=e.initialState.rowSelection)!=null?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();const s={...n},i=e.getPreGroupedRowModel().flatRows;return t?i.forEach(a=>{a.getCanSelect()&&(s[a.id]=!0)}):i.forEach(a=>{delete s[a.id]}),s})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{const s=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),i={...n};return e.getRowModel().rows.forEach(a=>{Lp(i,a.id,s,!0,e)}),i}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=Se(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?Ig(e,n):{rows:[],flatRows:[],rowsById:{}},we(e.options,"debugTable")),e.getFilteredSelectedRowModel=Se(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?Ig(e,n):{rows:[],flatRows:[],rowsById:{}},we(e.options,"debugTable")),e.getGroupedSelectedRowModel=Se(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?Ig(e,n):{rows:[],flatRows:[],rowsById:{}},we(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let s=!!(t.length&&Object.keys(n).length);return s&&t.some(i=>i.getCanSelect()&&!n[i.id])&&(s=!1),s},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter(i=>i.getCanSelect()),{rowSelection:n}=e.getState();let s=!!t.length;return s&&t.some(i=>!n[i.id])&&(s=!1),s},e.getIsSomeRowsSelected=()=>{var t;const n=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return n>0&&n<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(n=>n.getCanSelect()).some(n=>n.getIsSelected()||n.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,s)=>{const i=e.getIsSelected();t.setRowSelection(a=>{var u;if(n=typeof n<"u"?n:!i,e.getCanSelect()&&i===n)return a;const f={...a};return Lp(f,e.id,n,(u=s==null?void 0:s.selectChildren)!=null?u:!0,t),f})},e.getIsSelected=()=>{const{rowSelection:n}=t.getState();return R0(e,n)},e.getIsSomeSelected=()=>{const{rowSelection:n}=t.getState();return Op(e,n)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=t.getState();return Op(e,n)==="all"},e.getCanSelect=()=>{var n;return typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):(n=t.options.enableRowSelection)!=null?n:!0},e.getCanSelectSubRows=()=>{var n;return typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):(n=t.options.enableSubRowSelection)!=null?n:!0},e.getCanMultiSelect=()=>{var n;return typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):(n=t.options.enableMultiRowSelection)!=null?n:!0},e.getToggleSelectedHandler=()=>{const n=e.getCanSelect();return s=>{var i;n&&e.toggleSelected((i=s.target)==null?void 0:i.checked)}}}},Lp=(e,t,n,s,i)=>{var a;const u=i.getRow(t,!0);n?(u.getCanMultiSelect()||Object.keys(e).forEach(f=>delete e[f]),u.getCanSelect()&&(e[t]=!0)):delete e[t],s&&(a=u.subRows)!=null&&a.length&&u.getCanSelectSubRows()&&u.subRows.forEach(f=>Lp(e,f.id,n,s,i))};function Ig(e,t){const n=e.getState().rowSelection,s=[],i={},a=function(u,f){return u.map(d=>{var h;const m=R0(d,n);if(m&&(s.push(d),i[d.id]=d),(h=d.subRows)!=null&&h.length&&(d={...d,subRows:a(d.subRows)}),m)return d}).filter(Boolean)};return{rows:a(t.rows),flatRows:s,rowsById:i}}function R0(e,t){var n;return(n=t[e.id])!=null?n:!1}function Op(e,t,n){var s;if(!((s=e.subRows)!=null&&s.length))return!1;let i=!0,a=!1;return e.subRows.forEach(u=>{if(!(a&&!i)&&(u.getCanSelect()&&(R0(u,t)?a=!0:i=!1),u.subRows&&u.subRows.length)){const f=Op(u,t);f==="all"?a=!0:(f==="some"&&(a=!0),i=!1)}}),i?"all":a?"some":!1}const Ap=/([0-9]+)/gm,Az=(e,t,n)=>G_(Cs(e.getValue(n)).toLowerCase(),Cs(t.getValue(n)).toLowerCase()),Dz=(e,t,n)=>G_(Cs(e.getValue(n)),Cs(t.getValue(n))),zz=(e,t,n)=>E0(Cs(e.getValue(n)).toLowerCase(),Cs(t.getValue(n)).toLowerCase()),Uz=(e,t,n)=>E0(Cs(e.getValue(n)),Cs(t.getValue(n))),Vz=(e,t,n)=>{const s=e.getValue(n),i=t.getValue(n);return s>i?1:s<i?-1:0},Bz=(e,t,n)=>E0(e.getValue(n),t.getValue(n));function E0(e,t){return e===t?0:e>t?1:-1}function Cs(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function G_(e,t){const n=e.split(Ap).filter(Boolean),s=t.split(Ap).filter(Boolean);for(;n.length&&s.length;){const i=n.shift(),a=s.shift(),u=parseInt(i,10),f=parseInt(a,10),d=[u,f].sort();if(isNaN(d[0])){if(i>a)return 1;if(a>i)return-1;continue}if(isNaN(d[1]))return isNaN(u)?-1:1;if(u>f)return 1;if(f>u)return-1}return n.length-s.length}const Na={alphanumeric:Az,alphanumericCaseSensitive:Dz,text:zz,textCaseSensitive:Uz,datetime:Vz,basic:Bz},qz={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Rn("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let s=!1;for(const i of n){const a=i==null?void 0:i.getValue(e.id);if(Object.prototype.toString.call(a)==="[object Date]")return Na.datetime;if(typeof a=="string"&&(s=!0,a.split(Ap).length>1))return Na.alphanumeric}return s?Na.text:Na.basic},e.getAutoSortDir=()=>{const n=t.getFilteredRowModel().flatRows[0];return typeof(n==null?void 0:n.getValue(e.id))=="string"?"asc":"desc"},e.getSortingFn=()=>{var n,s;if(!e)throw new Error;return Vf(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(n=(s=t.options.sortingFns)==null?void 0:s[e.columnDef.sortingFn])!=null?n:Na[e.columnDef.sortingFn]},e.toggleSorting=(n,s)=>{const i=e.getNextSortingOrder(),a=typeof n<"u"&&n!==null;t.setSorting(u=>{const f=u==null?void 0:u.find(v=>v.id===e.id),d=u==null?void 0:u.findIndex(v=>v.id===e.id);let h=[],m,p=a?n:i==="desc";if(u!=null&&u.length&&e.getCanMultiSort()&&s?f?m="toggle":m="add":u!=null&&u.length&&d!==u.length-1?m="replace":f?m="toggle":m="replace",m==="toggle"&&(a||i||(m="remove")),m==="add"){var x;h=[...u,{id:e.id,desc:p}],h.splice(0,h.length-((x=t.options.maxMultiSortColCount)!=null?x:Number.MAX_SAFE_INTEGER))}else m==="toggle"?h=u.map(v=>v.id===e.id?{...v,desc:p}:v):m==="remove"?h=u.filter(v=>v.id!==e.id):h=[{id:e.id,desc:p}];return h})},e.getFirstSortDir=()=>{var n,s;return((n=(s=e.columnDef.sortDescFirst)!=null?s:t.options.sortDescFirst)!=null?n:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=n=>{var s,i;const a=e.getFirstSortDir(),u=e.getIsSorted();return u?u!==a&&((s=t.options.enableSortingRemoval)==null||s)&&(!(n&&(i=t.options.enableMultiRemove)!=null)||i)?!1:u==="desc"?"asc":"desc":a},e.getCanSort=()=>{var n,s;return((n=e.columnDef.enableSorting)!=null?n:!0)&&((s=t.options.enableSorting)!=null?s:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,s;return(n=(s=e.columnDef.enableMultiSort)!=null?s:t.options.enableMultiSort)!=null?n:!!e.accessorFn},e.getIsSorted=()=>{var n;const s=(n=t.getState().sorting)==null?void 0:n.find(i=>i.id===e.id);return s?s.desc?"desc":"asc":!1},e.getSortIndex=()=>{var n,s;return(n=(s=t.getState().sorting)==null?void 0:s.findIndex(i=>i.id===e.id))!=null?n:-1},e.clearSorting=()=>{t.setSorting(n=>n!=null&&n.length?n.filter(s=>s.id!==e.id):[])},e.getToggleSortingHandler=()=>{const n=e.getCanSort();return s=>{n&&(s.persist==null||s.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(s):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,s;e.setSorting(t?[]:(n=(s=e.initialState)==null?void 0:s.sorting)!=null?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},Hz=[dz,Nz,Rz,Ez,hz,gz,Mz,Tz,qz,bz,$z,Fz,Lz,Oz,Iz];function Wz(e){var t,n;const s=[...Hz,...(t=e._features)!=null?t:[]];let i={_features:s};const a=i._features.reduce((x,v)=>Object.assign(x,v.getDefaultOptions==null?void 0:v.getDefaultOptions(i)),{}),u=x=>i.options.mergeOptions?i.options.mergeOptions(a,x):{...a,...x};let d={...{},...(n=e.initialState)!=null?n:{}};i._features.forEach(x=>{var v;d=(v=x.getInitialState==null?void 0:x.getInitialState(d))!=null?v:d});const h=[];let m=!1;const p={_features:s,options:{...a,...e},initialState:d,_queue:x=>{h.push(x),m||(m=!0,Promise.resolve().then(()=>{for(;h.length;)h.shift()();m=!1}).catch(v=>setTimeout(()=>{throw v})))},reset:()=>{i.setState(i.initialState)},setOptions:x=>{const v=gs(x,i.options);i.options=u(v)},getState:()=>i.options.state,setState:x=>{i.options.onStateChange==null||i.options.onStateChange(x)},_getRowId:(x,v,w)=>{var k;return(k=i.options.getRowId==null?void 0:i.options.getRowId(x,v,w))!=null?k:`${w?[w.id,v].join("."):v}`},getCoreRowModel:()=>(i._getCoreRowModel||(i._getCoreRowModel=i.options.getCoreRowModel(i)),i._getCoreRowModel()),getRowModel:()=>i.getPaginationRowModel(),getRow:(x,v)=>{let w=(v?i.getPrePaginationRowModel():i.getRowModel()).rowsById[x];if(!w&&(w=i.getCoreRowModel().rowsById[x],!w))throw new Error;return w},_getDefaultColumnDef:Se(()=>[i.options.defaultColumn],x=>{var v;return x=(v=x)!=null?v:{},{header:w=>{const k=w.header.column.columnDef;return k.accessorKey?k.accessorKey:k.accessorFn?k.id:null},cell:w=>{var k,b;return(k=(b=w.renderValue())==null||b.toString==null?void 0:b.toString())!=null?k:null},...i._features.reduce((w,k)=>Object.assign(w,k.getDefaultColumnDef==null?void 0:k.getDefaultColumnDef()),{}),...x}},we(e,"debugColumns")),_getColumnDefs:()=>i.options.columns,getAllColumns:Se(()=>[i._getColumnDefs()],x=>{const v=function(w,k,b){return b===void 0&&(b=0),w.map(_=>{const R=fz(i,_,b,k),j=_;return R.columns=j.columns?v(j.columns,R,b+1):[],R})};return v(x)},we(e,"debugColumns")),getAllFlatColumns:Se(()=>[i.getAllColumns()],x=>x.flatMap(v=>v.getFlatColumns()),we(e,"debugColumns")),_getAllFlatColumnsById:Se(()=>[i.getAllFlatColumns()],x=>x.reduce((v,w)=>(v[w.id]=w,v),{}),we(e,"debugColumns")),getAllLeafColumns:Se(()=>[i.getAllColumns(),i._getOrderColumnsFn()],(x,v)=>{let w=x.flatMap(k=>k.getLeafColumns());return v(w)},we(e,"debugColumns")),getColumn:x=>i._getAllFlatColumnsById()[x]};Object.assign(i,p);for(let x=0;x<i._features.length;x++){const v=i._features[x];v==null||v.createTable==null||v.createTable(i)}return i}function Gz(){return e=>Se(()=>[e.options.data],t=>{const n={rows:[],flatRows:[],rowsById:{}},s=function(i,a,u){a===void 0&&(a=0);const f=[];for(let h=0;h<i.length;h++){const m=b0(e,e._getRowId(i[h],h,u),i[h],h,a,void 0,u==null?void 0:u.id);if(n.flatRows.push(m),n.rowsById[m.id]=m,f.push(m),e.options.getSubRows){var d;m.originalSubRows=e.options.getSubRows(i[h],h),(d=m.originalSubRows)!=null&&d.length&&(m.subRows=s(m.originalSubRows,a+1,m))}}return f};return n.rows=s(t),n},we(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function Kz(){return e=>Se(()=>[e.getState().expanded,e.getPreExpandedRowModel(),e.options.paginateExpandedRows],(t,n,s)=>!n.rows.length||t!==!0&&!Object.keys(t??{}).length||!s?n:Qz(n),we(e.options,"debugTable"))}function Qz(e){const t=[],n=s=>{var i;t.push(s),(i=s.subRows)!=null&&i.length&&s.getIsExpanded()&&s.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function Jz(e,t,n){return n.options.filterFromLeafRows?Yz(e,t,n):Xz(e,t,n)}function Yz(e,t,n){var s;const i=[],a={},u=(s=n.options.maxLeafRowFilterDepth)!=null?s:100,f=function(d,h){h===void 0&&(h=0);const m=[];for(let x=0;x<d.length;x++){var p;let v=d[x];const w=b0(n,v.id,v.original,v.index,v.depth,void 0,v.parentId);if(w.columnFilters=v.columnFilters,(p=v.subRows)!=null&&p.length&&h<u){if(w.subRows=f(v.subRows,h+1),v=w,t(v)&&!w.subRows.length){m.push(v),a[v.id]=v,i.push(v);continue}if(t(v)||w.subRows.length){m.push(v),a[v.id]=v,i.push(v);continue}}else v=w,t(v)&&(m.push(v),a[v.id]=v,i.push(v))}return m};return{rows:f(e),flatRows:i,rowsById:a}}function Xz(e,t,n){var s;const i=[],a={},u=(s=n.options.maxLeafRowFilterDepth)!=null?s:100,f=function(d,h){h===void 0&&(h=0);const m=[];for(let x=0;x<d.length;x++){let v=d[x];if(t(v)){var p;if((p=v.subRows)!=null&&p.length&&h<u){const k=b0(n,v.id,v.original,v.index,v.depth,void 0,v.parentId);k.subRows=f(v.subRows,h+1),v=k}m.push(v),i.push(v),a[v.id]=v}}return m};return{rows:f(e),flatRows:i,rowsById:a}}function Zz(){return e=>Se(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,n,s)=>{if(!t.rows.length||!(n!=null&&n.length)&&!s){for(let x=0;x<t.flatRows.length;x++)t.flatRows[x].columnFilters={},t.flatRows[x].columnFiltersMeta={};return t}const i=[],a=[];(n??[]).forEach(x=>{var v;const w=e.getColumn(x.id);if(!w)return;const k=w.getFilterFn();k&&i.push({id:x.id,filterFn:k,resolvedValue:(v=k.resolveFilterValue==null?void 0:k.resolveFilterValue(x.value))!=null?v:x.value})});const u=(n??[]).map(x=>x.id),f=e.getGlobalFilterFn(),d=e.getAllLeafColumns().filter(x=>x.getCanGlobalFilter());s&&f&&d.length&&(u.push("__global__"),d.forEach(x=>{var v;a.push({id:x.id,filterFn:f,resolvedValue:(v=f.resolveFilterValue==null?void 0:f.resolveFilterValue(s))!=null?v:s})}));let h,m;for(let x=0;x<t.flatRows.length;x++){const v=t.flatRows[x];if(v.columnFilters={},i.length)for(let w=0;w<i.length;w++){h=i[w];const k=h.id;v.columnFilters[k]=h.filterFn(v,k,h.resolvedValue,b=>{v.columnFiltersMeta[k]=b})}if(a.length){for(let w=0;w<a.length;w++){m=a[w];const k=m.id;if(m.filterFn(v,k,m.resolvedValue,b=>{v.columnFiltersMeta[k]=b})){v.columnFilters.__global__=!0;break}}v.columnFilters.__global__!==!0&&(v.columnFilters.__global__=!1)}}const p=x=>{for(let v=0;v<u.length;v++)if(x.columnFilters[u[v]]===!1)return!1;return!0};return Jz(t.rows,p,e)},we(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex()))}function e5(){return e=>Se(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(t!=null&&t.length))return n;const s=e.getState().sorting,i=[],a=s.filter(d=>{var h;return(h=e.getColumn(d.id))==null?void 0:h.getCanSort()}),u={};a.forEach(d=>{const h=e.getColumn(d.id);h&&(u[d.id]={sortUndefined:h.columnDef.sortUndefined,invertSorting:h.columnDef.invertSorting,sortingFn:h.getSortingFn()})});const f=d=>{const h=d.map(m=>({...m}));return h.sort((m,p)=>{for(let v=0;v<a.length;v+=1){var x;const w=a[v],k=u[w.id],b=k.sortUndefined,_=(x=w==null?void 0:w.desc)!=null?x:!1;let R=0;if(b){const j=m.getValue(w.id),E=p.getValue(w.id),T=j===void 0,$=E===void 0;if(T||$){if(b==="first")return T?-1:1;if(b==="last")return T?1:-1;R=T&&$?0:T?b:-b}}if(R===0&&(R=k.sortingFn(m,p,w.id)),R!==0)return _&&(R*=-1),k.invertSorting&&(R*=-1),R}return m.index-p.index}),h.forEach(m=>{var p;i.push(m),(p=m.subRows)!=null&&p.length&&(m.subRows=f(m.subRows))}),h};return{rows:f(n.rows),flatRows:i,rowsById:n.rowsById}},we(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}/**
|
|
97
|
-
* react-table
|
|
98
|
-
*
|
|
99
|
-
* Copyright (c) TanStack
|
|
100
|
-
*
|
|
101
|
-
* This source code is licensed under the MIT license found in the
|
|
102
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
103
|
-
*
|
|
104
|
-
* @license MIT
|
|
105
|
-
*/function jg(e,t){return e?t5(e)?V.createElement(e,t):e:null}function t5(e){return n5(e)||typeof e=="function"||r5(e)}function n5(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function r5(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function s5(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=V.useState(()=>({current:Wz(t)})),[s,i]=V.useState(()=>n.current.initialState);return n.current.setOptions(a=>({...a,...e,state:{...s,...e.state},onStateChange:u=>{i(u),e.onStateChange==null||e.onStateChange(u)}})),n.current}const ii=az(),K_=y.jsx("span",{className:"text-fg-faint",children:"—"}),o5=e=>`${el(e.label)} ${e.label} ${e.models.map(Or).join(" ")} ${e.models.join(" ")}`.toLowerCase();function i5(e){return V.useMemo(()=>[ii.accessor("label",{header:e,cell:t=>y.jsxs("button",{type:"button","aria-expanded":t.row.getIsExpanded(),onClick:n=>{n.stopPropagation(),t.row.toggleExpanded()},className:"flex items-center gap-1 rounded text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent",children:[y.jsx("span",{"aria-hidden":!0,className:t.row.getIsExpanded()?"text-accent":"text-fg-faint",children:t.row.getIsExpanded()?"▾":"▸"}),y.jsx("span",{className:"text-fg",children:el(t.getValue())})]})}),ii.display({id:"models",header:"models",cell:t=>y.jsx("span",{className:"line-clamp-1 text-fg-dim",children:t.row.original.models.map(Or).join(", ")})}),ii.accessor("total",{header:"tokens",meta:{align:"right"},cell:t=>t.getValue()>0?y.jsx("span",{className:"text-fg",children:wn(t.getValue())}):K_}),ii.accessor("cacheSavings",{header:"saved",meta:{align:"right",hiddenSm:!0},cell:t=>y.jsx("span",{className:"text-positive",children:Ue(t.getValue())})}),ii.accessor("count",{header:"calls",meta:{align:"right",hiddenSm:!0},cell:t=>y.jsx("span",{className:"text-fg-dim",children:J1(t.getValue())})}),ii.accessor("cost",{header:"cost",meta:{align:"right"},cell:t=>y.jsx("span",{className:"text-cost",children:Ue(t.getValue())})})],[e])}const a5=e=>`py-2 pr-3${(e==null?void 0:e.align)==="right"?" text-right":""}${e!=null&&e.hiddenSm?" hidden sm:table-cell":""}`;function l5({rows:e,granLabel:t,q:n}){const[s,i]=V.useState([{id:"label",desc:!0}]),[a,u]=V.useState({}),d=i5(t==="monthly"?"month":t==="weekly"?"week":"date"),h=s5({data:e,columns:d,state:{sorting:s,expanded:a,globalFilter:n},onSortingChange:i,onExpandedChange:u,getRowCanExpand:()=>!0,globalFilterFn:(x,v,w)=>!String(w).trim()||o5(x.original).includes(String(w).trim().toLowerCase()),getCoreRowModel:Gz(),getSortedRowModel:e5(),getFilteredRowModel:Zz(),getExpandedRowModel:Kz()}),m=h.getRowModel().rows,p=V.useMemo(()=>m.reduce((x,v)=>({total:x.total+v.original.total,cost:x.cost+v.original.cost,cacheSavings:x.cacheSavings+v.original.cacheSavings,count:x.count+v.original.count}),{total:0,cost:0,cacheSavings:0,count:0}),[m]);return y.jsx(Uf,{title:`explore · ${t}`,captureName:"explore",children:y.jsx("div",{className:"max-h-[calc(100vh-240px)] overflow-auto",children:y.jsxs("table",{className:"w-full border-collapse text-xs",children:[y.jsxs("colgroup",{children:[y.jsx("col",{}),y.jsx("col",{style:{width:"34%"}}),y.jsx("col",{style:{width:"13%"}}),y.jsx("col",{style:{width:"12%"}}),y.jsx("col",{style:{width:"11%"}}),y.jsx("col",{style:{width:"13%"}})]}),y.jsx("thead",{children:y.jsx("tr",{className:"sticky top-0 z-10 bg-bg-1 text-[11px] shadow-[inset_0_-1px_0_var(--color-line)]",children:h.getHeaderGroups()[0].headers.map(x=>{const v=x.column.columnDef.meta,w=x.column.getIsSorted();return y.jsx("th",{className:`py-2 pr-3 font-normal ${(v==null?void 0:v.align)==="right"?"text-right":"text-left"}${v!=null&&v.hiddenSm?" hidden sm:table-cell":""}`,children:x.column.getCanSort()?y.jsxs("button",{type:"button",onClick:x.column.getToggleSortingHandler(),className:`flex w-full items-center gap-1 text-fg-faint transition hover:text-fg ${(v==null?void 0:v.align)==="right"?"justify-end":""}`,children:[jg(x.column.columnDef.header,x.getContext()),w&&y.jsx("span",{className:"text-accent",children:w==="asc"?"▲":"▼"})]}):y.jsx("span",{className:"text-fg-faint",children:jg(x.column.columnDef.header,x.getContext())})},x.id)})})}),y.jsxs("tbody",{children:[m.length===0&&y.jsx("tr",{children:y.jsx("td",{colSpan:6,className:"py-8 text-center text-fg-faint",children:n.trim()?`no rows match “${n.trim()}”`:"no usage in this range"})}),m.map(x=>y.jsxs(V.Fragment,{children:[y.jsx("tr",{className:"cursor-pointer border-b border-line-faint transition hover:bg-bg-2/60",onClick:()=>x.toggleExpanded(),children:x.getVisibleCells().map(v=>y.jsx("td",{className:`${a5(v.column.columnDef.meta)}${v.column.id==="label"?" whitespace-nowrap":""} tnum`,children:jg(v.column.columnDef.cell,v.getContext())},v.id))}),x.getIsExpanded()&&x.original.breakdown.map(v=>{const w=tl(v);return y.jsxs("tr",{className:"border-b border-line-faint bg-bg-0/40 text-[11px]",children:[y.jsxs("td",{className:"py-1.5 pr-3 pl-5 text-fg-dim",colSpan:2,children:[y.jsx("span",{className:"mr-1.5 inline-block size-1.5 rounded-full align-middle",style:{background:Qp(v.name)}}),Or(v.name)]}),y.jsx("td",{className:"tnum py-1.5 pr-3 text-right text-fg-dim",children:w>0?wn(w):K_}),y.jsx("td",{className:"tnum hidden py-1.5 pr-3 text-right text-positive/80 sm:table-cell",children:Ue(v.cacheSavings)}),y.jsx("td",{className:"tnum hidden py-1.5 pr-3 text-right text-fg-faint sm:table-cell",children:bs(v.count)}),y.jsx("td",{className:"tnum py-1.5 text-right text-cost/90",children:Ue(v.cost)})]},v.name)})]},x.id))]}),m.length>0&&y.jsx("tfoot",{children:y.jsxs("tr",{className:"sticky bottom-0 z-10 bg-bg-1 text-fg shadow-[inset_0_1px_0_var(--color-line)]",children:[y.jsxs("td",{className:"py-2 pr-3 font-display text-[11px] uppercase text-fg-dim",colSpan:2,children:["total · ",m.length]}),y.jsx("td",{className:"tnum py-2 pr-3 text-right",children:wn(p.total)}),y.jsx("td",{className:"tnum hidden py-2 pr-3 text-right text-positive sm:table-cell",children:Ue(p.cacheSavings)}),y.jsx("td",{className:"tnum hidden py-2 pr-3 text-right sm:table-cell",children:J1(p.count)}),y.jsx("td",{className:"tnum py-2 text-right text-cost",children:Ue(p.cost)})]})})]})})})}const Bf=()=>O_(()=>import("./timeline-gDyrCQ0O.js"),__vite__mapDeps([0,1]),import.meta.url),Ol=()=>O_(()=>import("./breakdown-ClwCJce8.js"),__vite__mapDeps([2,1]),import.meta.url);Bf();Ol();const u5=V.lazy(()=>Bf().then(e=>({default:e.CostTimeline}))),c5=V.lazy(()=>Bf().then(e=>({default:e.CumulativeSpend}))),f5=V.lazy(()=>Bf().then(e=>({default:e.CacheSavings}))),Q_=V.lazy(()=>Ol().then(e=>({default:e.CostByModel}))),J_=V.lazy(()=>Ol().then(e=>({default:e.ProviderDonut}))),qw=V.lazy(()=>Ol().then(e=>({default:e.TokenComposition}))),d5=V.lazy(()=>Ol().then(e=>({default:e.CacheByModel}))),h5=({className:e})=>y.jsx("div",{className:e,"aria-hidden":!0}),us=({children:e})=>y.jsx(V.Suspense,{fallback:null,children:e}),Hw=[{key:"overview",label:"overview"},{key:"analytics",label:"analytics"},{key:"models",label:"models"},{key:"explore",label:"explore"}],g5=[{value:"daily",label:"daily"},{value:"weekly",label:"weekly"},{value:"monthly",label:"monthly"}];function p5({derived:e,periodLabel:t,scopeLabel:n,providers:s}){const i=a=>{var u;return((u=s.find(f=>f.id===a))==null?void 0:u.name)??a};return y.jsxs("div",{className:"flex flex-col gap-4",children:[y.jsx(Q4,{derived:e,periodLabel:t}),y.jsx(V.Suspense,{fallback:y.jsx(h5,{className:"h-[clamp(320px,42vh,560px)]"}),children:y.jsx(u5,{derived:e,periodLabel:n,heightClass:"h-[clamp(320px,42vh,560px)]"})}),y.jsx(J4,{accounts:e.cardAccounts,nameOf:i})]})}function m5({derived:e,scopeLabel:t}){const n=e.byProvider.length>1;return y.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[y.jsx("div",{className:"md:col-span-2",children:y.jsx(rz,{derived:e,periodLabel:t})}),y.jsx(us,{children:y.jsx(Q_,{derived:e,periodLabel:t})}),y.jsx(us,{children:n?y.jsx(J_,{derived:e,periodLabel:t}):y.jsx(qw,{derived:e,periodLabel:t})}),n&&y.jsx(us,{children:y.jsx(qw,{derived:e,periodLabel:t})}),y.jsx("div",{className:n?void 0:"md:col-span-2",children:y.jsx(us,{children:y.jsx(f5,{derived:e,periodLabel:t})})}),y.jsx("div",{className:"md:col-span-2",children:y.jsx(us,{children:y.jsx(c5,{derived:e,height:300,periodLabel:t})})})]})}function y5({derived:e,scopeLabel:t}){const n=e.byProvider.length>1;return y.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[y.jsx("div",{className:"md:col-span-2",children:y.jsx(iz,{derived:e,periodLabel:t})}),y.jsx("div",{className:n?void 0:"md:col-span-2",children:y.jsx(us,{children:y.jsx(Q_,{derived:e,metric:"tokens",limit:12,periodLabel:t})})}),n&&y.jsx(us,{children:y.jsx(J_,{derived:e,periodLabel:t})}),y.jsx("div",{className:"md:col-span-2",children:y.jsx(us,{children:y.jsx(d5,{derived:e,periodLabel:t})})})]})}function x5({snapshot:e,filters:t,periodLabel:n}){const[s,i]=V.useState(""),[a,u]=V.useState("daily"),f=V.useMemo(()=>Tj(e,t,a),[e,t,a]),d=V.useMemo(()=>(e?Jp(e,t):[]).some(m=>m.tableState!=="ready"),[e,t]),h=a!=="daily"?`showing up to ${a==="monthly"?"12 months":"12 weeks"}`:`scoped to ${n}`;return y.jsxs("div",{className:"flex flex-col gap-3",children:[y.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"text-xs text-fg-faint",children:"granularity:"}),y.jsx(Sn,{options:g5,value:a,onChange:u,size:"sm",ariaLabel:"row granularity",btnClassName:"px-3 py-1 text-xs capitalize transition"})]}),h&&y.jsx("span",{className:"text-xs text-fg-faint",children:h}),d&&y.jsxs("span",{className:"text-xs text-fg-faint",role:"status",children:["loading history",y.jsx("span",{className:"cursor-blink text-accent",children:"▋"})]}),y.jsxs("div",{className:"ml-auto flex items-center gap-1.5 rounded border border-line bg-bg-1 px-2 py-1 text-xs focus-within:border-line-2",children:[y.jsx(Hj,{className:"size-3 text-fg-faint"}),y.jsx("input",{type:"search",value:s,onChange:m=>i(m.target.value),onKeyDown:m=>{m.key==="Escape"&&i("")},placeholder:"filter rows…","aria-label":"Filter rows by date or model",autoComplete:"off",spellCheck:!1,className:"w-32 bg-transparent text-fg outline-none placeholder:text-fg-faint [&::-webkit-search-cancel-button]:appearance-none"}),s&&y.jsx("button",{type:"button",onClick:()=>i(""),"aria-label":"Clear filter",children:y.jsx(xi,{className:"size-3 text-fg-faint hover:text-fg","aria-hidden":!0})})]})]}),y.jsx(l5,{rows:f,granLabel:a,q:s})]})}function P0(e,t,n){try{return e(t)}catch(s){return iP("[nuqs] Error while parsing value `%s`: %O"+(n?" (for key `%s`)":""),t,s,n),null}}function ir(e){function t(n){if(typeof n>"u")return null;let s="";if(Array.isArray(n)){if(n[0]===void 0)return null;s=n[0]}return typeof n=="string"&&(s=n),P0(e.parse,s)}return{type:"single",eq:(n,s)=>n===s,...e,parseServerSide:t,withDefault(n){return{...this,defaultValue:n,parseServerSide(s){return t(s)??n}}},withOptions(n){return{...this,...n}}}}const Ng=ir({parse:e=>e,serialize:String});ir({parse:e=>{const t=parseInt(e);return t==t?t:null},serialize:e=>""+Math.round(e)});ir({parse:e=>{const t=parseInt(e);return t==t?t-1:null},serialize:e=>""+Math.round(e+1)});ir({parse:e=>{const t=parseInt(e,16);return t==t?t:null},serialize:e=>{const t=Math.round(e).toString(16);return(t.length&1?"0":"")+t}});ir({parse:e=>{const t=parseFloat(e);return t==t?t:null},serialize:String});ir({parse:e=>e.toLowerCase()==="true",serialize:String});function I0(e,t){return e.valueOf()===t.valueOf()}ir({parse:e=>{const t=parseInt(e);return t==t?new Date(t):null},serialize:e=>""+e.valueOf(),eq:I0});ir({parse:e=>{const t=new Date(e);return t.valueOf()==t.valueOf()?t:null},serialize:e=>e.toISOString(),eq:I0});ir({parse:e=>{const t=new Date(e.slice(0,10));return t.valueOf()==t.valueOf()?t:null},serialize:e=>e.toISOString().slice(0,10),eq:I0});function v5(e){return S5(e)}function S5(e){return ir({parse:t=>{const n=t;return e.includes(n)?n:null},serialize:String})}function Ww(e,t=","){const n=e.eq??((i,a)=>i===a),s=encodeURIComponent(t);return ir({parse:i=>i===""?[]:i.split(t).map((a,u)=>P0(e.parse,a.replaceAll(s,t),`[${u}]`)).filter(a=>a!=null),serialize:i=>i.map(a=>(e.serialize?e.serialize(a):String(a)).replaceAll(t,s)).join(t),eq(i,a){return i===a?!0:i.length!==a.length?!1:i.every((u,f)=>n(u,a[f]))}})}const Mg=Vp(),w5={};function k5(e,t={}){const n=V.useId(),s=gP(),i=pP(),{history:a="replace",scroll:u=(s==null?void 0:s.scroll)??!1,shallow:f=(s==null?void 0:s.shallow)??!0,throttleMs:d=Aa.timeMs,limitUrlUpdates:h=s==null?void 0:s.limitUrlUpdates,clearOnDefault:m=(s==null?void 0:s.clearOnDefault)??!0,startTransition:p,urlKeys:x=w5}=t,v=Object.keys(e).join(","),w=V.useMemo(()=>Object.fromEntries(Object.keys(e).map(U=>[U,x[U]??U])),[v,JSON.stringify(x)]),k=hP(Object.values(w)),b=k.searchParams,_=V.useRef({}),R=V.useMemo(()=>Object.fromEntries(Object.keys(e).map(U=>[U,e[U].defaultValue??null])),[Object.values(e).map(({defaultValue:U})=>U).join(",")]),j=Ah.useQueuedQueries(Object.values(w)),[E,T]=V.useState(()=>Tg(e,x,b??new URLSearchParams,j).state),$=V.useRef(E);if(Ye("[nuq+ %s `%s`] render - state: %O, iSP: %s",n,v,E,b),Object.keys(_.current).join("&")!==Object.values(w).join("&")){const{state:U,hasChanged:z}=Tg(e,x,b,j,_.current,$.current);z&&(Ye("[nuq+ %s `%s`] State changed: %O",n,v,{state:U,initialSearchParams:b,queuedQueries:j,queryRef:_.current,stateRef:$.current}),$.current=U,T(U)),_.current=Object.fromEntries(Object.entries(w).map(([Z,te])=>{var ae;return[te,((ae=e[Z])==null?void 0:ae.type)==="multi"?b==null?void 0:b.getAll(te):(b==null?void 0:b.get(te))??null]}))}V.useEffect(()=>{const{state:U,hasChanged:z}=Tg(e,x,b,j,_.current,$.current);z&&(Ye("[nuq+ %s `%s`] State changed: %O",n,v,{state:U,initialSearchParams:b,queuedQueries:j,queryRef:_.current,stateRef:$.current}),$.current=U,T(U))},[Object.values(w).map(U=>`${U}=${b==null?void 0:b.getAll(U)}`).join("&"),JSON.stringify(j)]),V.useEffect(()=>{const U=Object.keys(e).reduce((z,Z)=>(z[Z]=({state:te,query:ae})=>{T(P=>{const{defaultValue:H}=e[Z],X=w[Z],K=te??H??null,q=P[Z]??H??null;return Object.is(q,K)?(Ye("[nuq+ %s `%s`] Cross-hook key sync %s: %O (default: %O). no change, skipping, resolved: %O",n,v,X,te,H,$.current),P):($.current={...$.current,[Z]:K},_.current[X]=ae,Ye("[nuq+ %s `%s`] Cross-hook key sync %s: %O (default: %O). updateInternalState, resolved: %O",n,v,X,te,H,$.current),$.current)})},z),{});for(const z of Object.keys(e)){const Z=w[z];Ye("[nuq+ %s `%s`] Subscribing to sync for `%s`",n,Z,v),Mg.on(Z,U[z])}return()=>{for(const z of Object.keys(e)){const Z=w[z];Ye("[nuq+ %s `%s`] Unsubscribing to sync for `%s`",n,Z,v),Mg.off(Z,U[z])}}},[v,w]);const L=V.useCallback((U,z={})=>{var q,Y,se,ee,M,J;const Z=Object.fromEntries(Object.keys(e).map(pe=>[pe,null])),te=typeof U=="function"?U(Gw($.current,R))??Z:U??Z;Ye("[nuq+ %s `%s`] setState: %O",n,v,te);let ae,P=0,H=!1;const X=[];for(let[pe,he]of Object.entries(te)){const ce=e[pe],be=w[pe];if(!ce||he===void 0)continue;(z.clearOnDefault??ce.clearOnDefault??m)&&he!==null&&ce.defaultValue!==void 0&&(ce.eq??((Ee,lt)=>Ee===lt))(he,ce.defaultValue)&&(he=null);const $e=he===null?null:(ce.serialize??String)(he);Mg.emit(be,{state:he,query:$e});const Ce={key:be,query:$e,options:{history:z.history??ce.history??a,shallow:z.shallow??ce.shallow??f,scroll:z.scroll??ce.scroll??u,startTransition:z.startTransition??ce.startTransition??p}};if(((q=z==null?void 0:z.limitUrlUpdates)==null?void 0:q.method)==="debounce"||(h==null?void 0:h.method)==="debounce"||((Y=ce.limitUrlUpdates)==null?void 0:Y.method)==="debounce"){Ce.options.shallow===!0&&console.warn(xl(422));const Ee=((se=z==null?void 0:z.limitUrlUpdates)==null?void 0:se.timeMs)??(h==null?void 0:h.timeMs)??((ee=ce.limitUrlUpdates)==null?void 0:ee.timeMs)??Aa.timeMs,lt=Ah.push(Ce,Ee,k,i);P<Ee&&(ae=lt,P=Ee)}else{const Ee=((M=z==null?void 0:z.limitUrlUpdates)==null?void 0:M.timeMs)??((J=ce==null?void 0:ce.limitUrlUpdates)==null?void 0:J.timeMs)??(h==null?void 0:h.timeMs)??z.throttleMs??ce.throttleMs??d;X.push(Ah.abort(be)),fc.push(Ce,Ee),H=!0}}const K=X.reduce((pe,he)=>he(pe),H?fc.flush(k,i):fc.getPendingPromise(k));return ae??K},[v,a,f,u,d,h==null?void 0:h.method,h==null?void 0:h.timeMs,p,w,k.updateUrl,k.getSearchParamsSnapshot,k.rateLimitFactor,i,R]);return[V.useMemo(()=>Gw(E,R),[E,R]),L]}function Tg(e,t,n,s,i,a){let u=!1;const f=Object.entries(e).reduce((d,[h,m])=>{const p=(t==null?void 0:t[h])??h,x=s[p],v=m.type==="multi"?[]:null,w=x===void 0?(m.type==="multi"?n==null?void 0:n.getAll(p):n==null?void 0:n.get(p))??v:x;return i&&a&&p1(i[p]??v,w)?(d[h]=a[h]??null,d):(u=!0,d[h]=(xP(w)?null:P0(m.parse,w,p))??null,i&&(i[p]=w),d)},{});if(!u){const d=Object.keys(e),h=Object.keys(a??{});u=d.length!==h.length||d.some(m=>!h.includes(m))}return{state:f,hasChanged:u}}function Gw(e,t){return Object.fromEntries(Object.keys(e).map(n=>[n,e[n]??t[n]??null]))}const C5=["7d","30d","90d","mtd","all"];function b5(){const[e,t]=k5({p:Ww(Ng).withDefault([]),m:Ww(Ng).withDefault([]),a:Ng.withDefault("all"),period:v5(C5).withDefault(Ij.period)},{history:"replace"}),n=V.useMemo(()=>({providers:e.p,models:e.m,account:e.a,period:e.period}),[e.p,e.m,e.a,e.period]),s=V.useCallback(i=>{t(a=>{const u={providers:a.p,models:a.m,account:a.a,period:a.period},f=typeof i=="function"?i(u):i;return{p:f.providers,m:f.models,a:f.account,period:f.period}})},[t]);return[n,s]}function _5(){const[e,t]=V.useState(null),[n,s]=V.useState("connecting"),i=V.useRef(null);return V.useEffect(()=>{let a=!1;const u=Ll(),f=E4(h=>{a||s(h)}),d=u.subscribeSnapshot(h=>{a||(t(h),s("live"))});return i.current=d,()=>{var h;a=!0,f(),(h=i.current)==null||h.call(i),i.current=null}},[]),{snapshot:e,conn:n}}const Dp=e=>`/${e}`,Y_=V.createContext(null),qf=()=>{const e=V.useContext(Y_);if(!e)throw new Error("useDashboard outside provider");return e};function R5(e=1e3){const[t,n]=V.useState(()=>Date.now());return V.useEffect(()=>{const s=setInterval(()=>n(Date.now()),e);return()=>clearInterval(s)},[e]),t}function E5(){const[e,t]=V.useState(()=>document.documentElement.classList.contains("light")?"light":"dark");return V.useEffect(()=>{document.documentElement.classList.toggle("light",e==="light")},[e]),[e,()=>{const s=e==="dark"?"light":"dark";try{localStorage.setItem("tokmon-theme",s)}catch{}t(s)}]}function P5({theme:e,onToggle:t}){return y.jsx("button",{type:"button",onClick:t,title:e==="dark"?"Switch to light":"Switch to dark","aria-label":"Toggle theme",className:"rounded border border-line bg-bg-1 p-1.5 text-fg-dim transition hover:border-line-2 hover:text-fg max-sm:p-2.5",children:e==="dark"?y.jsx(Wj,{className:"size-3.5"}):y.jsx(Gj,{className:"size-3.5"})})}function I5({conn:e,freshAt:t}){const n=R5(),s=e==="live"?"var(--color-positive)":e==="error"?"var(--color-warning)":"var(--color-cost)",i=t?_j(t,n):null,a=e==="live"?i??"live":e==="connecting"?"connecting…":e==="reconnecting"?i?`reconnecting · ${i}`:"reconnecting…":i?`offline · ${i}`:"offline";return y.jsxs("span",{className:"flex items-center gap-1.5 text-xs",role:"status","aria-label":e==="live"?"live":e,children:[y.jsxs("span",{className:"relative flex size-2",children:[e==="live"&&y.jsx("span",{className:"absolute inline-flex size-full animate-ping rounded-full opacity-60",style:{background:s}}),y.jsx("span",{className:"relative inline-flex size-2 rounded-full",style:{background:s}})]}),y.jsx("span",{className:"inline-block truncate text-fg-dim max-sm:max-w-[7rem]","aria-hidden":!0,children:a})]})}function $g({label:e}){return y.jsxs("div",{className:"flex min-h-[50vh] flex-col items-center justify-center gap-2 text-sm text-fg-dim",children:[y.jsxs("span",{className:"font-display text-lg text-fg-dim",children:["tokmon",y.jsx("span",{className:"cursor-blink text-accent",children:"▋"})]}),y.jsx("span",{className:"text-fg-faint",children:e})]})}function j5({onOpen:e}){return y.jsx("button",{type:"button",onClick:e,title:"Settings","aria-label":"Open settings",className:"rounded border border-line bg-bg-1 p-1.5 text-fg-dim transition hover:border-line-2 hover:text-fg max-sm:p-2.5",children:y.jsx(Kj,{className:"size-3.5"})})}function N5(){var L,U;const{snapshot:e,conn:t}=_5(),[n,s]=b5(),[i,a]=E5(),[u,f]=V.useState(!1),d=V.useMemo(()=>zj(e,n),[e,n]),h=((L=X1.find(z=>z.key===n.period))==null?void 0:L.label)??n.period,m=n.period==="all"?void 0:h,p=wj({select:z=>z.location.pathname}),x=((U=Hw.find(z=>Dp(z.key)===p))==null?void 0:U.key)??"overview";V.useEffect(()=>{var X;if(!e)return;const z=new Set(e.providers.map(K=>K.id)),Z=new Set(e.accounts.map(K=>K.id)),te=n.providers.filter(K=>z.has(K)),ae=n.account==="all"||Z.has(n.account)?n.account:"all",P=new Set;for(const K of e.accounts)for(const q of((X=K.table)==null?void 0:X.monthly)??[])for(const Y of q.breakdown)P.add(Y.name);const H=P.size>0?n.models.filter(K=>P.has(K)):n.models;(te.length!==n.providers.length||ae!==n.account||H.length!==n.models.length)&&s(K=>({...K,providers:te,account:ae,models:H}))},[e,n,s]);const v=(e==null?void 0:e.accounts.filter(z=>z.hasUsage))??[],w=v.length>0,k=((e==null?void 0:e.accounts)??[]).some(Wg),b=((e==null?void 0:e.accounts)??[]).some(z=>z.hasBilling&&!Wg(z)),_=w&&v.every(z=>z.table!=null),R=V.useRef(!1);V.useEffect(()=>{_&&(R.current=!0)},[_]);const[j,E]=V.useState(!1);V.useEffect(()=>{const z=setTimeout(()=>E(!0),12e3);return()=>clearTimeout(z)},[]);const T=!w||_||R.current||j,$=V.useMemo(()=>e?{snapshot:e,filters:n,derived:d,periodLabel:h,scopeLabel:m}:null,[e,n,d,h,m]);return y.jsxs("div",{className:"min-h-screen",children:[y.jsxs("header",{className:"relative z-30 border-b border-line bg-bg-0/80 backdrop-blur",children:[y.jsxs("div",{className:"mx-auto max-w-[1600px] px-5 2xl:max-w-[1920px]",children:[y.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2 py-3.5",children:[y.jsx("span",{className:"font-display text-2xl text-fg-bright",children:"TOKMON"}),y.jsxs("span",{className:"hidden text-sm text-fg-faint sm:inline",children:["~/usage ",y.jsx("span",{className:"text-prompt",children:"$"})," ",y.jsx("span",{className:"text-fg-dim",children:x}),y.jsx("span",{className:"cursor-blink text-accent",children:"▋"})]}),y.jsxs("div",{className:"ml-auto flex min-w-0 items-center gap-3",children:[y.jsx(I5,{conn:t,freshAt:(e==null?void 0:e.generatedAt)??null}),y.jsx(j5,{onOpen:()=>f(!0)}),y.jsx(P5,{theme:i,onToggle:a}),T&&(w||k)&&y.jsx(sN,{derived:d,periodLabel:h,tz:(e==null?void 0:e.tz)??"",version:(e==null?void 0:e.version)??""})]})]}),y.jsx("nav",{className:"-mb-px flex items-center gap-1 overflow-x-auto",children:Hw.map(z=>y.jsx(Kp,{to:Dp(z.key),className:`relative shrink-0 border-b-2 px-3 py-2 font-display text-xs uppercase tracking-wider transition ${x===z.key?"border-accent text-fg-bright":"border-transparent text-fg-faint hover:text-fg-dim"}`,children:z.label},z.key))})]}),y.jsx(Yj,{snapshot:e,derived:d,filters:n,setFilters:s})]}),y.jsxs("main",{className:"mx-auto max-w-[1600px] px-5 2xl:max-w-[1920px] py-5",children:[(e==null?void 0:e.seeded)&&y.jsxs("div",{className:"mb-4 flex items-center gap-2 rounded border border-line bg-bg-1 px-3 py-1.5 text-xs text-fg-dim",role:"status",children:[y.jsx("span",{className:"inline-flex size-2 rounded-full",style:{background:"var(--color-cost)"},"aria-hidden":!0}),"showing cached data — refreshing…"]}),e?!w&&!k?b&&!j&&t!=="error"?y.jsx($g,{label:"reading billing…"}):y.jsx("div",{className:"rounded-md border border-line bg-bg-1 p-8 text-center text-sm text-fg-dim",children:"No providers detected. Open tokmon, enable a provider, then refresh."}):!T||!$?y.jsx($g,{label:t==="error"?"connection lost — retrying…":"reading usage history…"}):y.jsx(Y_.Provider,{value:$,children:y.jsx(Q1,{})}):y.jsx($g,{label:t==="error"?"connection lost — retrying…":"reading usage…"})]}),y.jsxs("footer",{className:"mx-auto max-w-[1600px] px-5 2xl:max-w-[1920px] py-6 text-center text-[11px] text-fg-faint",children:["tokmon",e!=null&&e.version?` v${e.version}`:""," · by David Ilie · live LLM usage dashboard"]}),u&&y.jsx(H4,{snapshot:e,onClose:()=>f(!1)})]})}function Kw(){const{derived:e,periodLabel:t,scopeLabel:n,snapshot:s}=qf();return y.jsx("div",{children:y.jsx(p5,{derived:e,periodLabel:t,scopeLabel:n,providers:s.providers})})}function M5(){const{derived:e,scopeLabel:t}=qf();return y.jsx("div",{children:y.jsx(m5,{derived:e,scopeLabel:t})})}function T5(){const{derived:e,scopeLabel:t}=qf();return y.jsx("div",{children:y.jsx(y5,{derived:e,scopeLabel:t})})}function $5(){const{snapshot:e,filters:t,periodLabel:n}=qf();return y.jsx("div",{children:y.jsx(x5,{snapshot:e,filters:t,periodLabel:n})})}const zp=sj({component:N5}),cc=(e,t)=>W1({getParentRoute:()=>zp,path:Dp(e),component:t}),F5=zp.addChildren([W1({getParentRoute:()=>zp,path:"/",component:Kw}),cc("overview",Kw),cc("analytics",M5),cc("models",T5),cc("explore",$5)]),L5=yj({routeTree:F5,history:hI(),defaultViewTransition:!0});function O5(){return y.jsx(Sj,{router:L5})}sP.createRoot(document.getElementById("root")).render(y.jsx(V.StrictMode,{children:y.jsx(PP,{children:y.jsx(rN,{children:y.jsx(O5,{})})})}));export{Y2 as E,Uf as P,Ga as R,Sn as S,z5 as T,U5 as a,Ue as b,wn as c,Y1 as d,tl as e,el as f,JE as g,D5 as h,y as j,V as r,Or as s};
|